|
@@ -90,7 +90,7 @@ f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=m+a*c,b[10]=f*h):"ZXY"===a.order?(
|
|
|
h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+m,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=m*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,a=c*h,k=c*g,c=
|
|
|
c*i,m=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(m+e);b[4]=k-f;b[8]=c+g;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+m);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);h[0]=a.x;
|
|
|
h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],m=c[5],l=c[9],p=c[13],s=c[2],r=c[6],q=c[10],n=c[14],v=c[3],u=c[7],t=c[11],c=c[15],
|
|
|
-w=d[0],F=d[4],B=d[8],y=d[12],z=d[1],x=d[5],G=d[9],H=d[13],D=d[2],J=d[6],A=d[10],M=d[14],E=d[3],T=d[7],R=d[11],d=d[15];e[0]=f*w+h*z+g*D+i*E;e[4]=f*F+h*x+g*J+i*T;e[8]=f*B+h*G+g*A+i*R;e[12]=f*y+h*H+g*M+i*d;e[1]=k*w+m*z+l*D+p*E;e[5]=k*F+m*x+l*J+p*T;e[9]=k*B+m*G+l*A+p*R;e[13]=k*y+m*H+l*M+p*d;e[2]=s*w+r*z+q*D+n*E;e[6]=s*F+r*x+q*J+n*T;e[10]=s*B+r*G+q*A+n*R;e[14]=s*y+r*H+q*M+n*d;e[3]=v*w+u*z+t*D+c*E;e[7]=v*F+u*x+t*J+c*T;e[11]=v*B+u*G+t*A+c*R;e[15]=v*y+u*H+t*M+c*d;return this},multiplyToArray:function(a,b,
|
|
|
+x=d[0],G=d[4],B=d[8],y=d[12],z=d[1],D=d[5],H=d[9],F=d[13],w=d[2],J=d[6],A=d[10],N=d[14],E=d[3],T=d[7],R=d[11],d=d[15];e[0]=f*x+h*z+g*w+i*E;e[4]=f*G+h*D+g*J+i*T;e[8]=f*B+h*H+g*A+i*R;e[12]=f*y+h*F+g*N+i*d;e[1]=k*x+m*z+l*w+p*E;e[5]=k*G+m*D+l*J+p*T;e[9]=k*B+m*H+l*A+p*R;e[13]=k*y+m*F+l*N+p*d;e[2]=s*x+r*z+q*w+n*E;e[6]=s*G+r*D+q*J+n*T;e[10]=s*B+r*H+q*A+n*R;e[14]=s*y+r*F+q*N+n*d;e[3]=v*x+u*z+t*w+c*E;e[7]=v*G+u*D+t*J+c*T;e[11]=v*B+u*H+t*A+c*R;e[15]=v*y+u*F+t*N+c*d;return this},multiplyToArray:function(a,b,
|
|
|
c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
|
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],k=a[2],m=a[6],l=a[10],p=a[14];return a[3]*(+e*g*m-d*i*m-e*h*l+c*i*l+d*h*p-c*g*p)+a[7]*(+b*g*p-b*i*l+e*f*l-d*f*p+d*i*k-e*g*k)+a[11]*(+b*i*m-b*h*p-e*f*m+c*f*p+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*m+b*h*l+d*f*m-c*f*
|
|
@@ -140,11 +140,11 @@ a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.Ev
|
|
|
THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
|
|
|
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,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(){var a=[];return function(b){if(void 0!==this._listeners){var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=c.length,e=0;e<d;e++)a[e]=c[e];for(e=0;e<d;e++)a[e].call(this,b)}}}}()};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=new a.Vector3,g=new a.Vector3,i=new a.Vector3,k=function(f,m,s){if(f instanceof a.Sprite){d.getPositionFromMatrix(f.matrixWorld);var r=m.ray.distanceToPoint(d);if(r>f.scale.x)return s;s.push({distance:r,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
a.LOD)d.getPositionFromMatrix(f.matrixWorld),r=m.ray.origin.distanceTo(d),k(f.getObjectForDistance(r),m,s);else if(f instanceof a.Mesh){var q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(null!==q.boundingBox&&!1===c.isIntersectionBox(q.boundingBox))return s;if(q instanceof a.BufferGeometry){var n=f.material;if(void 0===
|
|
|
-n||!1===q.dynamic)return s;var v,u,t=m.precision;if(void 0!==q.attributes.index)for(var w=q.offsets,F=q.attributes.index.array,B=q.attributes.position.array,y=q.offsets.length,z=q.attributes.index.array.length/3,z=0;z<y;++z)for(var r=w[z].start,x=w[z].index,q=r,G=r+w[z].count;q<G;q+=3)r=x+F[q],v=x+F[q+1],u=x+F[q+2],h.set(B[3*r],B[3*r+1],B[3*r+2]),g.set(B[3*v],B[3*v+1],B[3*v+2]),i.set(B[3*u],B[3*u+1],B[3*u+2]),v=n.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,n.side!==a.DoubleSide),
|
|
|
+n||!1===q.dynamic)return s;var v,u,t=m.precision;if(void 0!==q.attributes.index)for(var x=q.offsets,G=q.attributes.index.array,B=q.attributes.position.array,y=q.offsets.length,z=q.attributes.index.array.length/3,z=0;z<y;++z)for(var r=x[z].start,D=x[z].index,q=r,H=r+x[z].count;q<H;q+=3)r=D+G[q],v=D+G[q+1],u=D+G[q+2],h.set(B[3*r],B[3*r+1],B[3*r+2]),g.set(B[3*v],B[3*v+1],B[3*v+2]),i.set(B[3*u],B[3*u+1],B[3*u+2]),v=n.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,n.side!==a.DoubleSide),
|
|
|
null!==v&&(v.applyMatrix4(f.matrixWorld),r=m.ray.origin.distanceTo(v),r<t||(r<m.near||r>m.far)||s.push({distance:r,point:v,face:null,faceIndex:null,object:f}));else{B=q.attributes.position.array;z=q.attributes.position.array.length;for(q=0;q<z;q+=3)r=q,v=q+1,u=q+2,h.set(B[3*r],B[3*r+1],B[3*r+2]),g.set(B[3*v],B[3*v+1],B[3*v+2]),i.set(B[3*u],B[3*u+1],B[3*u+2]),v=n.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,n.side!==a.DoubleSide),null!==v&&(v.applyMatrix4(f.matrixWorld),
|
|
|
-r=m.ray.origin.distanceTo(v),r<t||(r<m.near||r>m.far)||s.push({distance:r,point:v,face:null,faceIndex:null,object:f}))}}else if(q instanceof a.Geometry){F=f.material instanceof a.MeshFaceMaterial;B=!0===F?f.material.materials:null;t=m.precision;w=q.vertices;y=0;for(z=q.faces.length;y<z;y++)x=q.faces[y],n=!0===F?B[x.materialIndex]:f.material,void 0!==n&&(r=w[x.a],v=w[x.b],u=w[x.c],v=n.side===a.BackSide?c.intersectTriangle(u,v,r,!0):c.intersectTriangle(r,v,u,n.side!==a.DoubleSide),null!==v&&(v.applyMatrix4(f.matrixWorld),
|
|
|
-r=m.ray.origin.distanceTo(v),r<t||(r<m.near||r>m.far)||s.push({distance:r,point:v,face:x,faceIndex:y,object:f})))}}else if(f instanceof a.Line){t=m.linePrecision;n=t*t;q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(q instanceof a.Geometry){w=q.vertices;t=w.length;v=new a.Vector3;u=new a.Vector3;z=f.type===a.LineStrip?1:
|
|
|
-2;for(q=0;q<t-1;q+=z)c.distanceSqToSegment(w[q],w[q+1],u,v)>n||(r=c.origin.distanceTo(u),r<m.near||r>m.far||s.push({distance:r,point:v.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},m=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&m(a,
|
|
|
+r=m.ray.origin.distanceTo(v),r<t||(r<m.near||r>m.far)||s.push({distance:r,point:v,face:null,faceIndex:null,object:f}))}}else if(q instanceof a.Geometry){G=f.material instanceof a.MeshFaceMaterial;B=!0===G?f.material.materials:null;t=m.precision;x=q.vertices;y=0;for(z=q.faces.length;y<z;y++)D=q.faces[y],n=!0===G?B[D.materialIndex]:f.material,void 0!==n&&(r=x[D.a],v=x[D.b],u=x[D.c],v=n.side===a.BackSide?c.intersectTriangle(u,v,r,!0):c.intersectTriangle(r,v,u,n.side!==a.DoubleSide),null!==v&&(v.applyMatrix4(f.matrixWorld),
|
|
|
+r=m.ray.origin.distanceTo(v),r<t||(r<m.near||r>m.far)||s.push({distance:r,point:v,face:D,faceIndex:y,object:f})))}}else if(f instanceof a.Line){t=m.linePrecision;n=t*t;q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(q instanceof a.Geometry){x=q.vertices;t=x.length;v=new a.Vector3;u=new a.Vector3;z=f.type===a.LineStrip?1:
|
|
|
+2;for(q=0;q<t-1;q+=z)c.distanceSqToSegment(x[q],x[q+1],u,v)>n||(r=c.origin.distanceTo(u),r<m.near||r>m.far||s.push({distance:r,point:v.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},m=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&m(a,
|
|
|
this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&m(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this._rotation=new THREE.Euler;this._quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this._rotation._quaternion=this.quaternion;this._quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
|
this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,get rotation(){return this._rotation},set rotation(a){this._rotation=a;this._rotation._quaternion=this._quaternion;this._quaternion._euler=this._rotation;this._rotation._updateQuaternion()},get quaternion(){return this._quaternion},set quaternion(a){this._quaternion=a;this._quaternion._euler=this._rotation;this._rotation._quaternion=this._quaternion;this._quaternion._updateEuler()},get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");
|
|
@@ -158,17 +158,17 @@ for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},getObje
|
|
|
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(i===m){var a=new THREE.RenderableVertex;k.push(a);m++;i++;return a}return k[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
|
|
|
-0,g,i,k=[],m=0,l,p,s=[],r=0,q,n,v=[],u=0,t,w,F=[],B=0,y={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,x=new THREE.Vector4,G=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),H=new THREE.Box3,D=Array(3),J=new THREE.Matrix4,A=new THREE.Matrix4,M,E=new THREE.Matrix4,T=new THREE.Matrix3,R=new THREE.Matrix3,Q=new THREE.Vector3,aa=new THREE.Frustum,V=new THREE.Vector4,C=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+0,g,i,k=[],m=0,l,p,s=[],r=0,q,n,v=[],u=0,t,x,G=[],B=0,y={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,D=new THREE.Vector4,H=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),F=new THREE.Box3,w=Array(3),J=new THREE.Matrix4,A=new THREE.Matrix4,N,E=new THREE.Matrix4,T=new THREE.Matrix3,R=new THREE.Matrix3,M=new THREE.Vector3,Q=new THREE.Frustum,ha=new THREE.Vector4,C=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
A.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(A)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);A.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(A)};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 S=function(a){if(e===h){var b=new THREE.RenderableObject;
|
|
|
-f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(z.getPositionFromMatrix(a.matrixWorld),z.applyProjection(A),d.z=z.z);return d},Z=function(a){if(!1!==a.visible){a instanceof THREE.Light?y.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===aa.intersectsObject(a))&&y.objects.push(S(a)):a instanceof THREE.Sprite&&y.sprites.push(S(a));for(var b=0,c=a.children.length;b<c;b++)Z(a.children[b])}};this.projectScene=function(d,
|
|
|
-f,h,m){var z=!1,S,N,fa,O,P,ca,X,ka,ra,ia,Ka,Fa;w=n=p=0;y.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();J.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));A.multiplyMatrices(f.projectionMatrix,J);R.getNormalMatrix(J);aa.setFromMatrix(A);e=0;y.objects.length=0;y.sprites.length=0;y.lights.length=0;Z(d);!0===h&&y.objects.sort(b);d=0;for(h=y.objects.length;d<h;d++)if(X=y.objects[d].object,M=X.matrixWorld,i=0,X instanceof THREE.Mesh){ka=X.geometry;
|
|
|
-fa=ka.vertices;ra=ka.faces;ka=ka.faceVertexUvs;T.getNormalMatrix(M);Ka=X.material instanceof THREE.MeshFaceMaterial;Fa=!0===Ka?X.material:null;S=0;for(N=fa.length;S<N;S++){g=a();g.positionWorld.copy(fa[S]).applyMatrix4(M);g.positionScreen.copy(g.positionWorld).applyMatrix4(A);var la=1/g.positionScreen.w;g.positionScreen.x*=la;g.positionScreen.y*=la;g.positionScreen.z*=la;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||-1>g.positionScreen.z||1<
|
|
|
-g.positionScreen.z)}fa=0;for(S=ra.length;fa<S;fa++)if(N=ra[fa],la=!0===Ka?Fa.materials[N.materialIndex]:X.material,void 0!==la&&(ca=la.side,O=k[N.a],P=k[N.b],ia=k[N.c],D[0]=O.positionScreen,D[1]=P.positionScreen,D[2]=ia.positionScreen,!0===O.visible||!0===P.visible||!0===ia.visible||G.isIntersectionBox(H.setFromPoints(D))))if(z=0>(ia.positionScreen.x-O.positionScreen.x)*(P.positionScreen.y-O.positionScreen.y)-(ia.positionScreen.y-O.positionScreen.y)*(P.positionScreen.x-O.positionScreen.x),ca===THREE.DoubleSide||
|
|
|
-z===(ca===THREE.FrontSide)){if(p===r){var Ba=new THREE.RenderableFace3;s.push(Ba);r++;p++;l=Ba}else l=s[p++];l.id=X.id;l.v1.copy(O);l.v2.copy(P);l.v3.copy(ia);l.normalModel.copy(N.normal);!1===z&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&l.normalModel.negate();l.normalModel.applyMatrix3(T).normalize();l.normalModelView.copy(l.normalModel).applyMatrix3(R);l.centroidModel.copy(N.centroid).applyMatrix4(M);ia=N.vertexNormals;O=0;for(P=Math.min(ia.length,3);O<P;O++)Ba=l.vertexNormalsModel[O],Ba.copy(ia[O]),
|
|
|
-!1===z&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&Ba.negate(),Ba.applyMatrix3(T).normalize(),l.vertexNormalsModelView[O].copy(Ba).applyMatrix3(R);l.vertexNormalsLength=ia.length;z=0;for(O=Math.min(ka.length,3);z<O;z++)if(ia=ka[z][fa],void 0!==ia){P=0;for(ca=ia.length;P<ca;P++)l.uvs[z][P]=ia[P]}l.color=N.color;l.material=la;Q.copy(l.centroidModel).applyProjection(A);l.z=Q.z;y.elements.push(l)}}else if(X instanceof THREE.Line){E.multiplyMatrices(A,M);fa=X.geometry.vertices;O=a();O.positionScreen.copy(fa[0]).applyMatrix4(E);
|
|
|
-ra=X.type===THREE.LinePieces?2:1;S=1;for(N=fa.length;S<N;S++)O=a(),O.positionScreen.copy(fa[S]).applyMatrix4(E),0<(S+1)%ra||(P=k[i-2],V.copy(O.positionScreen),C.copy(P.positionScreen),!0===c(V,C)&&(V.multiplyScalar(1/V.w),C.multiplyScalar(1/C.w),n===u?(ka=new THREE.RenderableLine,v.push(ka),u++,n++,q=ka):q=v[n++],q.id=X.id,q.v1.positionScreen.copy(V),q.v2.positionScreen.copy(C),q.z=Math.max(V.z,C.z),q.material=X.material,X.material.vertexColors===THREE.VertexColors&&(q.vertexColors[0].copy(X.geometry.colors[S]),
|
|
|
-q.vertexColors[1].copy(X.geometry.colors[S-1])),y.elements.push(q)))}d=0;for(h=y.sprites.length;d<h;d++)X=y.sprites[d].object,M=X.matrixWorld,X instanceof THREE.Sprite&&(x.set(M.elements[12],M.elements[13],M.elements[14],1),x.applyMatrix4(A),la=1/x.w,x.z*=la,-1<x.z&&1>x.z&&(w===B?(ra=new THREE.RenderableSprite,F.push(ra),B++,w++,t=ra):t=F[w++],t.id=X.id,t.x=x.x*la,t.y=x.y*la,t.z=x.z,t.object=X,t.rotation=X.rotation,t.scale.x=X.scale.x*Math.abs(t.x-(x.x+f.projectionMatrix.elements[0])/(x.w+f.projectionMatrix.elements[12])),
|
|
|
-t.scale.y=X.scale.y*Math.abs(t.y-(x.y+f.projectionMatrix.elements[5])/(x.w+f.projectionMatrix.elements[13])),t.material=X.material,y.elements.push(t)));!0===m&&y.elements.sort(b);return y}};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};
|
|
|
+f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(z.getPositionFromMatrix(a.matrixWorld),z.applyProjection(A),d.z=z.z);return d},Y=function(a){if(!1!==a.visible){a instanceof THREE.Light?y.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===Q.intersectsObject(a))&&y.objects.push(S(a)):a instanceof THREE.Sprite&&y.sprites.push(S(a));for(var b=0,c=a.children.length;b<c;b++)Y(a.children[b])}};this.projectScene=function(d,
|
|
|
+f,h,m){var z=!1,S,ba,ea,O,P,aa,W,ka,ra,ia,Ka,Fa;x=n=p=0;y.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();J.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));A.multiplyMatrices(f.projectionMatrix,J);R.getNormalMatrix(J);Q.setFromMatrix(A);e=0;y.objects.length=0;y.sprites.length=0;y.lights.length=0;Y(d);!0===h&&y.objects.sort(b);d=0;for(h=y.objects.length;d<h;d++)if(W=y.objects[d].object,N=W.matrixWorld,i=0,W instanceof THREE.Mesh){ka=W.geometry;
|
|
|
+ea=ka.vertices;ra=ka.faces;ka=ka.faceVertexUvs;T.getNormalMatrix(N);Ka=W.material instanceof THREE.MeshFaceMaterial;Fa=!0===Ka?W.material:null;S=0;for(ba=ea.length;S<ba;S++){g=a();g.positionWorld.copy(ea[S]).applyMatrix4(N);g.positionScreen.copy(g.positionWorld).applyMatrix4(A);var la=1/g.positionScreen.w;g.positionScreen.x*=la;g.positionScreen.y*=la;g.positionScreen.z*=la;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||-1>g.positionScreen.z||
|
|
|
+1<g.positionScreen.z)}ea=0;for(S=ra.length;ea<S;ea++)if(ba=ra[ea],la=!0===Ka?Fa.materials[ba.materialIndex]:W.material,void 0!==la&&(aa=la.side,O=k[ba.a],P=k[ba.b],ia=k[ba.c],w[0]=O.positionScreen,w[1]=P.positionScreen,w[2]=ia.positionScreen,!0===O.visible||!0===P.visible||!0===ia.visible||H.isIntersectionBox(F.setFromPoints(w))))if(z=0>(ia.positionScreen.x-O.positionScreen.x)*(P.positionScreen.y-O.positionScreen.y)-(ia.positionScreen.y-O.positionScreen.y)*(P.positionScreen.x-O.positionScreen.x),
|
|
|
+aa===THREE.DoubleSide||z===(aa===THREE.FrontSide)){if(p===r){var Ca=new THREE.RenderableFace3;s.push(Ca);r++;p++;l=Ca}else l=s[p++];l.id=W.id;l.v1.copy(O);l.v2.copy(P);l.v3.copy(ia);l.normalModel.copy(ba.normal);!1===z&&(aa===THREE.BackSide||aa===THREE.DoubleSide)&&l.normalModel.negate();l.normalModel.applyMatrix3(T).normalize();l.normalModelView.copy(l.normalModel).applyMatrix3(R);l.centroidModel.copy(ba.centroid).applyMatrix4(N);ia=ba.vertexNormals;O=0;for(P=Math.min(ia.length,3);O<P;O++)Ca=l.vertexNormalsModel[O],
|
|
|
+Ca.copy(ia[O]),!1===z&&(aa===THREE.BackSide||aa===THREE.DoubleSide)&&Ca.negate(),Ca.applyMatrix3(T).normalize(),l.vertexNormalsModelView[O].copy(Ca).applyMatrix3(R);l.vertexNormalsLength=ia.length;z=0;for(O=Math.min(ka.length,3);z<O;z++)if(ia=ka[z][ea],void 0!==ia){P=0;for(aa=ia.length;P<aa;P++)l.uvs[z][P]=ia[P]}l.color=ba.color;l.material=la;M.copy(l.centroidModel).applyProjection(A);l.z=M.z;y.elements.push(l)}}else if(W instanceof THREE.Line){E.multiplyMatrices(A,N);ea=W.geometry.vertices;O=a();
|
|
|
+O.positionScreen.copy(ea[0]).applyMatrix4(E);ra=W.type===THREE.LinePieces?2:1;S=1;for(ba=ea.length;S<ba;S++)O=a(),O.positionScreen.copy(ea[S]).applyMatrix4(E),0<(S+1)%ra||(P=k[i-2],ha.copy(O.positionScreen),C.copy(P.positionScreen),!0===c(ha,C)&&(ha.multiplyScalar(1/ha.w),C.multiplyScalar(1/C.w),n===u?(ka=new THREE.RenderableLine,v.push(ka),u++,n++,q=ka):q=v[n++],q.id=W.id,q.v1.positionScreen.copy(ha),q.v2.positionScreen.copy(C),q.z=Math.max(ha.z,C.z),q.material=W.material,W.material.vertexColors===
|
|
|
+THREE.VertexColors&&(q.vertexColors[0].copy(W.geometry.colors[S]),q.vertexColors[1].copy(W.geometry.colors[S-1])),y.elements.push(q)))}d=0;for(h=y.sprites.length;d<h;d++)W=y.sprites[d].object,N=W.matrixWorld,W instanceof THREE.Sprite&&(D.set(N.elements[12],N.elements[13],N.elements[14],1),D.applyMatrix4(A),la=1/D.w,D.z*=la,-1<D.z&&1>D.z&&(x===B?(ra=new THREE.RenderableSprite,G.push(ra),B++,x++,t=ra):t=G[x++],t.id=W.id,t.x=D.x*la,t.y=D.y*la,t.z=D.z,t.object=W,t.rotation=W.rotation,t.scale.x=W.scale.x*
|
|
|
+Math.abs(t.x-(D.x+f.projectionMatrix.elements[0])/(D.w+f.projectionMatrix.elements[12])),t.scale.y=W.scale.y*Math.abs(t.y-(D.y+f.projectionMatrix.elements[5])/(D.w+f.projectionMatrix.elements[13])),t.material=W.material,y.elements.push(t)));!0===m&&y.elements.sort(b);return y}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,h){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
|
this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
@@ -178,9 +178,9 @@ h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
|
|
|
new THREE.Vector3;new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],g.subVectors(h,f),i.subVectors(a,f),g.cross(i),e[d.a].add(g),e[d.b].add(g),e[d.c].add(g)}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
|
|
|
d.vertexNormals[2].copy(e[d.c])},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=
|
|
|
this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var h=this.morphNormals[a].vertexNormals,g,i;c=0;for(d=this.faces.length;c<d;c++)g=new THREE.Vector3,i={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),h.push(i)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();
|
|
|
-c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,m,l,p,s,r,q,n,v=[],u=[];c=new THREE.Vector3;var t=new THREE.Vector3,w=new THREE.Vector3,F=new THREE.Vector3,B=new THREE.Vector3;
|
|
|
+c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,m,l,p,s,r,q,n,v=[],u=[];c=new THREE.Vector3;var t=new THREE.Vector3,x=new THREE.Vector3,G=new THREE.Vector3,B=new THREE.Vector3;
|
|
|
a=0;for(b=this.vertices.length;a<b;a++)v[a]=new THREE.Vector3,u[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,n=e.b,e=e.c,h=this.vertices[d],g=this.vertices[n],i=this.vertices[e],k=f[0],m=f[1],l=f[2],f=g.x-h.x,p=i.x-h.x,s=g.y-h.y,r=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=m.x-k.x,q=l.x-k.x,m=m.y-k.y,k=l.y-k.y,l=1/(i*k-q*m),c.set((k*f-m*p)*l,(k*s-m*r)*l,(k*g-m*h)*l),t.set((i*p-q*f)*l,(i*r-q*s)*l,(i*h-q*g)*l),v[d].add(c),v[n].add(c),v[e].add(c),u[d].add(t),
|
|
|
-u[n].add(t),u[e].add(t);t=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)B.copy(e.vertexNormals[c]),d=e[t[c]],n=v[d],w.copy(n),w.sub(B.multiplyScalar(B.dot(n))).normalize(),F.crossVectors(e.vertexNormals[c],n),d=F.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=
|
|
|
+u[n].add(t),u[e].add(t);t=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)B.copy(e.vertexNormals[c]),d=e[t[c]],n=v[d],x.copy(n),x.sub(B.multiplyScalar(B.dot(n))).normalize(),G.crossVectors(e.vertexNormals[c],n),d=G.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(x.x,x.y,x.z,d)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=
|
|
|
a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*
|
|
|
e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=a.length-1;0<=f;f--){e=a[f];this.faces.splice(e,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(e,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=
|
|
|
b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
@@ -189,11 +189,11 @@ this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.positi
|
|
|
new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var h=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),h=Math.max(h,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(h)}}}(),computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;
|
|
|
if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,m,l,p=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3;if(this.attributes.index){var v=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;h=u[c].count;var t=
|
|
|
u[c].index;a=b;for(b+=h;a<b;a+=3)h=t+v[a],g=t+v[a+1],i=t+v[a+2],k=e[3*h],m=e[3*h+1],l=e[3*h+2],p.set(k,m,l),k=e[3*g],m=e[3*g+1],l=e[3*g+2],s.set(k,m,l),k=e[3*i],m=e[3*i+1],l=e[3*i+2],r.set(k,m,l),q.subVectors(r,s),n.subVectors(p,s),q.cross(n),f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*i]+=q.x,f[3*i+1]+=q.y,f[3*i+2]+=q.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],l=e[a+2],p.set(k,m,l),k=e[a+3],m=e[a+4],l=e[a+5],s.set(k,m,l),k=e[a+6],m=e[a+7],l=e[a+8],
|
|
|
-r.set(k,m,l),q.subVectors(r,s),n.subVectors(p,s),q.cross(n),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.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){aa.x=d[3*a];aa.y=d[3*a+1];aa.z=d[3*a+2];V.copy(aa);S=g[a];R.copy(S);R.sub(aa.multiplyScalar(aa.dot(S))).normalize();
|
|
|
-Q.crossVectors(V,S);Z=Q.dot(i[a]);C=0>Z?-1:1;h[4*a]=R.x;h[4*a+1]=R.y;h[4*a+2]=R.z;h[4*a+3]=C}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&
|
|
|
-(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var m,l,p,s,r,q,n,v,u,t,w,F,B,y,z,f=new THREE.Vector3,k=new THREE.Vector3,x,G,H,D,J,A,M,E=this.offsets;H=0;for(D=E.length;H<D;++H){G=E[H].start;J=E[H].count;var T=E[H].index;x=G;for(G+=J;x<G;x+=3)J=T+b[x],A=T+b[x+1],M=T+b[x+2],m=c[3*J],l=c[3*J+1],p=c[3*J+2],s=c[3*A],r=c[3*A+1],q=c[3*A+2],n=c[3*M],v=c[3*M+1],u=c[3*M+2],t=e[2*
|
|
|
-J],w=e[2*J+1],F=e[2*A],B=e[2*A+1],y=e[2*M],z=e[2*M+1],s-=m,m=n-m,r-=l,l=v-l,q-=p,p=u-p,F-=t,t=y-t,B-=w,w=z-w,z=1/(F*w-t*B),f.set((w*s-B*m)*z,(w*r-B*l)*z,(w*q-B*p)*z),k.set((F*m-t*s)*z,(F*l-t*r)*z,(F*p-t*q)*z),g[J].add(f),g[A].add(f),g[M].add(f),i[J].add(k),i[A].add(k),i[M].add(k)}var R=new THREE.Vector3,Q=new THREE.Vector3,aa=new THREE.Vector3,V=new THREE.Vector3,C,S,Z;H=0;for(D=E.length;H<D;++H){G=E[H].start;J=E[H].count;T=E[H].index;x=G;for(G+=J;x<G;x+=3)J=T+b[x],A=T+b[x+1],M=T+b[x+2],a(J),a(A),
|
|
|
-a(M)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);break}}a.attributes[c]=f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,
|
|
|
+r.set(k,m,l),q.subVectors(r,s),n.subVectors(p,s),q.cross(n),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.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){Q.x=d[3*a];Q.y=d[3*a+1];Q.z=d[3*a+2];ha.copy(Q);S=g[a];R.copy(S);R.sub(Q.multiplyScalar(Q.dot(S))).normalize();
|
|
|
+M.crossVectors(ha,S);Y=M.dot(i[a]);C=0>Y?-1:1;h[4*a]=R.x;h[4*a+1]=R.y;h[4*a+2]=R.z;h[4*a+3]=C}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&
|
|
|
+(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var m,l,p,s,r,q,n,v,u,t,x,G,B,y,z,f=new THREE.Vector3,k=new THREE.Vector3,D,H,F,w,J,A,N,E=this.offsets;F=0;for(w=E.length;F<w;++F){H=E[F].start;J=E[F].count;var T=E[F].index;D=H;for(H+=J;D<H;D+=3)J=T+b[D],A=T+b[D+1],N=T+b[D+2],m=c[3*J],l=c[3*J+1],p=c[3*J+2],s=c[3*A],r=c[3*A+1],q=c[3*A+2],n=c[3*N],v=c[3*N+1],u=c[3*N+2],t=e[2*
|
|
|
+J],x=e[2*J+1],G=e[2*A],B=e[2*A+1],y=e[2*N],z=e[2*N+1],s-=m,m=n-m,r-=l,l=v-l,q-=p,p=u-p,G-=t,t=y-t,B-=x,x=z-x,z=1/(G*x-t*B),f.set((x*s-B*m)*z,(x*r-B*l)*z,(x*q-B*p)*z),k.set((G*m-t*s)*z,(G*l-t*r)*z,(G*p-t*q)*z),g[J].add(f),g[A].add(f),g[N].add(f),i[J].add(k),i[A].add(k),i[N].add(k)}var R=new THREE.Vector3,M=new THREE.Vector3,Q=new THREE.Vector3,ha=new THREE.Vector3,C,S,Y;F=0;for(w=E.length;F<w;++F){H=E[F].start;J=E[F].count;T=E[F].index;D=H;for(H+=J;D<H;D+=3)J=T+b[D],A=T+b[D+1],N=T+b[D+2],a(J),a(A),
|
|
|
+a(N)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);break}}a.attributes[c]=f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,
|
|
|
index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=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);a.projectionMatrixInverse.copy(this.projectionMatrixInverse);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()};
|
|
@@ -206,7 +206,7 @@ this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototy
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,n){var v=/\.dds$/i.test(f),u=b+"/"+f;if(v){var t=THREE.ImageUtils.loadCompressedTexture(u);a[e]=t}else t=document.createElement("canvas"),a[e]=new THREE.Texture(t);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
|
|
|
-f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));n&&(a[e].anisotropy=n);if(!v){var w=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);w.image.width=a;w.image.height=b;w.image.getContext("2d").drawImage(this,0,0,a,b)}else w.image=this;w.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
+f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));n&&(a[e].anisotropy=n);if(!v){var x=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);x.image.width=a;x.image.height=b;x.image.getContext("2d").drawImage(this,0,0,a,b)}else x.image=this;x.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
|
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
|
|
@@ -216,12 +216,12 @@ 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(){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,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===h&&
|
|
|
(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=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,e,f,h,g,i,k,m,l,p,s,r,q,n,v,u=a.faces;p=a.vertices;var t=a.normals,w=a.colors,F=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&F++;for(e=0;e<F;e++)c.faceVertexUvs[e]=[]}g=0;for(i=p.length;g<i;)k=new THREE.Vector3,k.x=p[g++]*d,k.y=p[g++]*d,k.z=p[g++]*d,c.vertices.push(k);g=0;for(i=u.length;g<i;)if(p=u[g++],s=p&1,h=p&2,e=p&8,m=p&16,r=p&32,k=p&64,p&=128,s){s=new THREE.Face3;s.a=u[g];
|
|
|
-s.b=u[g+1];s.c=u[g+3];q=new THREE.Face3;q.a=u[g+1];q.b=u[g+2];q.c=u[g+3];g+=4;h&&(h=u[g++],s.materialIndex=h,q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<F;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];c.faceVertexUvs[e][h+1]=[];for(f=0;4>f;f++)l=u[g++],v=n[2*l],l=n[2*l+1],v=new THREE.Vector2(v,l),2!==f&&c.faceVertexUvs[e][h].push(v),0!==f&&c.faceVertexUvs[e][h+1].push(v)}m&&(m=3*u[g++],s.normal.set(t[m++],t[m++],t[m]),q.normal.copy(s.normal));if(r)for(e=0;4>e;e++)m=3*u[g++],r=new THREE.Vector3(t[m++],
|
|
|
-t[m++],t[m]),2!==e&&s.vertexNormals.push(r),0!==e&&q.vertexNormals.push(r);k&&(k=u[g++],k=w[k],s.color.setHex(k),q.color.setHex(k));if(p)for(e=0;4>e;e++)k=u[g++],k=w[k],2!==e&&s.vertexColors.push(new THREE.Color(k)),0!==e&&q.vertexColors.push(new THREE.Color(k));c.faces.push(s);c.faces.push(q)}else{s=new THREE.Face3;s.a=u[g++];s.b=u[g++];s.c=u[g++];h&&(h=u[g++],s.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<F;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];for(f=0;3>f;f++)l=u[g++],v=n[2*l],l=n[2*l+1],
|
|
|
-v=new THREE.Vector2(v,l),c.faceVertexUvs[e][h].push(v)}m&&(m=3*u[g++],s.normal.set(t[m++],t[m++],t[m]));if(r)for(e=0;3>e;e++)m=3*u[g++],r=new THREE.Vector3(t[m++],t[m++],t[m]),s.vertexNormals.push(r);k&&(k=u[g++],s.color.setHex(w[k]));if(p)for(e=0;3>e;e++)k=u[g++],s.vertexColors.push(new THREE.Color(w[k]));c.faces.push(s)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)u=a.skinWeights[g],t=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(u,t,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<
|
|
|
-i;g+=2)u=a.skinIndices[g],t=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(u,t,0,0))}c.bones=a.bones;c.animation=a.animation;c.animations=a.animations;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];w=c.morphTargets[g].vertices;F=a.morphTargets[g].vertices;u=0;for(t=F.length;u<t;u+=3)p=new THREE.Vector3,p.x=F[u]*d,p.y=F[u+1]*d,p.z=F[u+2]*d,w.push(p)}}if(void 0!==a.morphColors){g=
|
|
|
-0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=[];t=c.morphColors[g].colors;w=a.morphColors[g].colors;d=0;for(u=w.length;d<u;d+=3)F=new THREE.Color(16755200),F.setRGB(w[d],w[d+1],w[d+2]),t.push(F)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,m,l,p,s,r,q,n,v,u=a.faces;p=a.vertices;var t=a.normals,x=a.colors,G=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&G++;for(e=0;e<G;e++)c.faceVertexUvs[e]=[]}g=0;for(i=p.length;g<i;)k=new THREE.Vector3,k.x=p[g++]*d,k.y=p[g++]*d,k.z=p[g++]*d,c.vertices.push(k);g=0;for(i=u.length;g<i;)if(p=u[g++],s=p&1,h=p&2,e=p&8,m=p&16,r=p&32,k=p&64,p&=128,s){s=new THREE.Face3;s.a=u[g];
|
|
|
+s.b=u[g+1];s.c=u[g+3];q=new THREE.Face3;q.a=u[g+1];q.b=u[g+2];q.c=u[g+3];g+=4;h&&(h=u[g++],s.materialIndex=h,q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];c.faceVertexUvs[e][h+1]=[];for(f=0;4>f;f++)l=u[g++],v=n[2*l],l=n[2*l+1],v=new THREE.Vector2(v,l),2!==f&&c.faceVertexUvs[e][h].push(v),0!==f&&c.faceVertexUvs[e][h+1].push(v)}m&&(m=3*u[g++],s.normal.set(t[m++],t[m++],t[m]),q.normal.copy(s.normal));if(r)for(e=0;4>e;e++)m=3*u[g++],r=new THREE.Vector3(t[m++],
|
|
|
+t[m++],t[m]),2!==e&&s.vertexNormals.push(r),0!==e&&q.vertexNormals.push(r);k&&(k=u[g++],k=x[k],s.color.setHex(k),q.color.setHex(k));if(p)for(e=0;4>e;e++)k=u[g++],k=x[k],2!==e&&s.vertexColors.push(new THREE.Color(k)),0!==e&&q.vertexColors.push(new THREE.Color(k));c.faces.push(s);c.faces.push(q)}else{s=new THREE.Face3;s.a=u[g++];s.b=u[g++];s.c=u[g++];h&&(h=u[g++],s.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];for(f=0;3>f;f++)l=u[g++],v=n[2*l],l=n[2*l+1],
|
|
|
+v=new THREE.Vector2(v,l),c.faceVertexUvs[e][h].push(v)}m&&(m=3*u[g++],s.normal.set(t[m++],t[m++],t[m]));if(r)for(e=0;3>e;e++)m=3*u[g++],r=new THREE.Vector3(t[m++],t[m++],t[m]),s.vertexNormals.push(r);k&&(k=u[g++],s.color.setHex(x[k]));if(p)for(e=0;3>e;e++)k=u[g++],s.vertexColors.push(new THREE.Color(x[k]));c.faces.push(s)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)u=a.skinWeights[g],t=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(u,t,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<
|
|
|
+i;g+=2)u=a.skinIndices[g],t=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(u,t,0,0))}c.bones=a.bones;c.animation=a.animation;c.animations=a.animations;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];x=c.morphTargets[g].vertices;G=a.morphTargets[g].vertices;u=0;for(t=G.length;u<t;u+=3)p=new THREE.Vector3,p.x=G[u]*d,p.y=G[u+1]*d,p.z=G[u+2]*d,x.push(p)}}if(void 0!==a.morphColors){g=
|
|
|
+0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=[];t=c.morphColors[g].colors;x=a.morphColors[g].colors;d=0;for(u=x.length;d<u;d+=3)G=new THREE.Color(16755200),G.setRGB(x[d],x[d+1],x[d+2]),t.push(G)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
|
THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d=a.offsets,a=a.boundingSphere,e;for(e in c){var f=c[e];b.attributes[e]={itemSize:f.itemSize,array:new self[f.type](f.array)}}void 0!==d&&(b.offsets=JSON.parse(JSON.stringify(d)));
|
|
|
void 0!==a&&(b.boundingSphere=new THREE.Sphere((new THREE.Vector3).fromArray(void 0!==a.center?a.center:[0,0,0]),a.radius));return b}};THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
|
THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&
|
|
@@ -234,27 +234,27 @@ b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.r
|
|
|
b.intensity);break;case "Mesh":e=c[b.geometry];var f=d[b.material];void 0===e&&console.error("THREE.ObjectLoader: Undefined geometry "+b.geometry);void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Mesh(e,f);break;case "Sprite":f=d[b.material];void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Sprite(f);break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),
|
|
|
a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var h in b.children)e.add(this.parseObject(b.children[h],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
|
|
|
THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:p+"/"+a}function e(){f(y.scene,
|
|
|
-x.objects)}function f(a,b){var c,e,h,i,k,m;for(m in b){var p=y.objects[m],n=b[m];if(void 0===p){if(n.type&&n.type in l.hierarchyHandlers){if(void 0===n.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var t={},v;for(v in n)v in c||(t[v]=n[v]);r=y.materials[n.material];n.loading=!0;c=l.hierarchyHandlers[n.type].loaderObject;c.options?c.load(d(n.url,x.urlBaseType),g(m,a,r,n)):c.load(d(n.url,x.urlBaseType),g(m,
|
|
|
+D.objects)}function f(a,b){var c,e,h,i,k,m;for(m in b){var p=y.objects[m],n=b[m];if(void 0===p){if(n.type&&n.type in l.hierarchyHandlers){if(void 0===n.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var t={},v;for(v in n)v in c||(t[v]=n[v]);r=y.materials[n.material];n.loading=!0;c=l.hierarchyHandlers[n.type].loaderObject;c.options?c.load(d(n.url,D.urlBaseType),g(m,a,r,n)):c.load(d(n.url,D.urlBaseType),g(m,
|
|
|
a,r,n),t)}}else if(void 0!==n.geometry){if(s=y.geometries[n.geometry]){p=!1;r=y.materials[n.material];p=r instanceof THREE.ShaderMaterial;e=n.position;h=n.rotation;i=n.scale;c=n.matrix;k=n.quaternion;n.material||(r=new THREE.MeshFaceMaterial(y.face_materials[n.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(y.face_materials[n.geometry]));if(r instanceof THREE.MeshFaceMaterial)for(t=0;t<r.materials.length;t++)p=p||r.materials[t]instanceof THREE.ShaderMaterial;
|
|
|
p&&s.computeTangents();n.skin?p=new THREE.SkinnedMesh(s,r):n.morph?(p=new THREE.MorphAnimMesh(s,r),void 0!==n.duration&&(p.duration=n.duration),void 0!==n.time&&(p.time=n.time),void 0!==n.mirroredLoop&&(p.mirroredLoop=n.mirroredLoop),r.morphNormals&&s.computeMorphNormals()):p=new THREE.Mesh(s,r);p.name=m;c?(p.matrixAutoUpdate=!1,p.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),
|
|
|
p.scale.fromArray(i));p.visible=n.visible;p.castShadow=n.castShadow;p.receiveShadow=n.receiveShadow;a.add(p);y.objects[m]=p}}else if("AmbientLight"===n.type||"PointLight"===n.type||"DirectionalLight"===n.type||"SpotLight"===n.type||"HemisphereLight"===n.type||"AreaLight"===n.type){t=n.color;c=n.intensity;e=n.distance;h=n.position;i=n.rotation;switch(n.type){case "AmbientLight":u=new THREE.AmbientLight(t);break;case "PointLight":u=new THREE.PointLight(t,c,e);u.position.fromArray(h);break;case "DirectionalLight":u=
|
|
|
new THREE.DirectionalLight(t,c);u.position.fromArray(n.direction);break;case "SpotLight":u=new THREE.SpotLight(t,c,e,1);u.angle=n.angle;u.position.fromArray(h);u.target.set(h[0],h[1]-e,h[2]);u.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "HemisphereLight":u=new THREE.DirectionalLight(t,c,e);u.target.set(h[0],h[1]-e,h[2]);u.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "AreaLight":u=new THREE.AreaLight(t,c),u.position.fromArray(h),u.width=n.size,u.height=
|
|
|
n.size_y}a.add(u);u.name=m;y.lights[m]=u;y.objects[m]=u}else"PerspectiveCamera"===n.type||"OrthographicCamera"===n.type?(e=n.position,h=n.rotation,k=n.quaternion,"PerspectiveCamera"===n.type?q=new THREE.PerspectiveCamera(n.fov,n.aspect,n.near,n.far):"OrthographicCamera"===n.type&&(q=new THREE.OrthographicCamera(n.left,n.right,n.top,n.bottom,n.near,n.far)),q.name=m,q.position.fromArray(e),void 0!==k?q.quaternion.fromArray(k):void 0!==h&&q.rotation.fromArray(h),a.add(q),y.cameras[m]=q,y.objects[m]=
|
|
|
-q):(e=n.position,h=n.rotation,i=n.scale,k=n.quaternion,p=new THREE.Object3D,p.name=m,p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),p.scale.fromArray(i),p.visible=void 0!==n.visible?n.visible:!1,a.add(p),y.objects[m]=p,y.empties[m]=p);if(p){if(void 0!==n.userData)for(var w in n.userData)p.userData[w]=n.userData[w];if(void 0!==n.groups)for(t=0;t<n.groups.length;t++)c=n.groups[t],void 0===y.groups[c]&&(y.groups[c]=[]),y.groups[c].push(m)}}void 0!==p&&void 0!==n.children&&
|
|
|
+q):(e=n.position,h=n.rotation,i=n.scale,k=n.quaternion,p=new THREE.Object3D,p.name=m,p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),p.scale.fromArray(i),p.visible=void 0!==n.visible?n.visible:!1,a.add(p),y.objects[m]=p,y.empties[m]=p);if(p){if(void 0!==n.userData)for(var x in n.userData)p.userData[x]=n.userData[x];if(void 0!==n.groups)for(t=0;t<n.groups.length;t++)c=n.groups[t],void 0===y.groups[c]&&(y.groups[c]=[]),y.groups[c].push(m)}}void 0!==p&&void 0!==n.children&&
|
|
|
f(p,n.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();t-=1;l.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var m=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=m});b.add(f);f.name=a;y.objects[a]=
|
|
|
-f;e();t-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:F,totalTextures:B,loadedModels:F-t,loadedTextures:B-w},y);l.onLoadProgress();if(0===t&&0===w){for(var a=0;a<z.length;a++){var c=z[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,y.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(y)}}function m(a,b){b(a);if(void 0!==a.children)for(var c in a.children)m(a.children[c],
|
|
|
-b)}var l=this,p=THREE.Loader.prototype.extractUrlBase(c),s,r,q,n,v,u,t,w,F,B,y,z=[],x=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;w=t=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(x.transform&&(G=x.transform.position,
|
|
|
-a=x.transform.rotation,c=x.transform.scale,G&&y.scene.position.fromArray(G),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),G||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();G=function(a){return function(){w-=a;k();l.onLoadComplete()}};for(var H in x.fogs)a=x.fogs[H],"linear"===a.type?n=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(n=new THREE.FogExp2(0,a.density)),a=a.color,n.color.setRGB(a[0],a[1],a[2]),y.fogs[H]=n;for(var D in x.geometries)n=x.geometries[D],n.type in
|
|
|
-this.geometryHandlers&&(t+=1,l.onLoadStart());for(var J in x.objects)m(x.objects[J],function(a){a.type&&a.type in l.hierarchyHandlers&&(t+=1,l.onLoadStart())});F=t;for(D in x.geometries)if(n=x.geometries[D],"cube"===n.type)s=new THREE.CubeGeometry(n.width,n.height,n.depth,n.widthSegments,n.heightSegments,n.depthSegments),s.name=D,y.geometries[D]=s;else if("plane"===n.type)s=new THREE.PlaneGeometry(n.width,n.height,n.widthSegments,n.heightSegments),s.name=D,y.geometries[D]=s;else if("sphere"===n.type)s=
|
|
|
-new THREE.SphereGeometry(n.radius,n.widthSegments,n.heightSegments),s.name=D,y.geometries[D]=s;else if("cylinder"===n.type)s=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),s.name=D,y.geometries[D]=s;else if("torus"===n.type)s=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),s.name=D,y.geometries[D]=s;else if("icosahedron"===n.type)s=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),s.name=D,y.geometries[D]=s;else if(n.type in this.geometryHandlers){J=
|
|
|
-{};for(v in n)"type"!==v&&"url"!==v&&(J[v]=n[v]);this.geometryHandlers[n.type].loaderObject.load(d(n.url,x.urlBaseType),h(D),J)}else"embedded"===n.type&&(J=x.embeds[n.id],J.metadata=x.metadata,J&&(J=this.geometryHandlers.ascii.loaderObject.parse(J,""),i(D)(J.geometry,J.materials)));for(var A in x.textures)if(D=x.textures[A],D.url instanceof Array){w+=D.url.length;for(v=0;v<D.url.length;v++)l.onLoadStart()}else w+=1,l.onLoadStart();B=w;for(A in x.textures){D=x.textures[A];void 0!==D.mapping&&void 0!==
|
|
|
-THREE[D.mapping]&&(D.mapping=new THREE[D.mapping]);if(D.url instanceof Array){J=D.url.length;n=[];for(v=0;v<J;v++)n[v]=d(D.url[v],x.urlBaseType);v=(v=/\.dds$/i.test(n[0]))?THREE.ImageUtils.loadCompressedTextureCube(n,D.mapping,G(J)):THREE.ImageUtils.loadTextureCube(n,D.mapping,G(J))}else v=/\.dds$/i.test(D.url),J=d(D.url,x.urlBaseType),n=G(1),v=v?THREE.ImageUtils.loadCompressedTexture(J,D.mapping,n):THREE.ImageUtils.loadTexture(J,D.mapping,n),void 0!==THREE[D.minFilter]&&(v.minFilter=THREE[D.minFilter]),
|
|
|
-void 0!==THREE[D.magFilter]&&(v.magFilter=THREE[D.magFilter]),D.anisotropy&&(v.anisotropy=D.anisotropy),D.repeat&&(v.repeat.set(D.repeat[0],D.repeat[1]),1!==D.repeat[0]&&(v.wrapS=THREE.RepeatWrapping),1!==D.repeat[1]&&(v.wrapT=THREE.RepeatWrapping)),D.offset&&v.offset.set(D.offset[0],D.offset[1]),D.wrap&&(J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==J[D.wrap[0]]&&(v.wrapS=J[D.wrap[0]]),void 0!==J[D.wrap[1]]&&(v.wrapT=J[D.wrap[1]]));y.textures[A]=v}var M,E;for(M in x.materials){A=
|
|
|
-x.materials[M];for(E in A.parameters)"envMap"===E||"map"===E||"lightMap"===E||"bumpMap"===E?A.parameters[E]=y.textures[A.parameters[E]]:"shading"===E?A.parameters[E]="flat"===A.parameters[E]?THREE.FlatShading:THREE.SmoothShading:"side"===E?A.parameters[E]="double"==A.parameters[E]?THREE.DoubleSide:"back"==A.parameters[E]?THREE.BackSide:THREE.FrontSide:"blending"===E?A.parameters[E]=A.parameters[E]in THREE?THREE[A.parameters[E]]:THREE.NormalBlending:"combine"===E?A.parameters[E]=A.parameters[E]in THREE?
|
|
|
-THREE[A.parameters[E]]:THREE.MultiplyOperation:"vertexColors"===E?"face"==A.parameters[E]?A.parameters[E]=THREE.FaceColors:A.parameters[E]&&(A.parameters[E]=THREE.VertexColors):"wrapRGB"===E&&(G=A.parameters[E],A.parameters[E]=new THREE.Vector3(G[0],G[1],G[2]));void 0!==A.parameters.opacity&&1>A.parameters.opacity&&(A.parameters.transparent=!0);A.parameters.normalMap?(G=THREE.ShaderLib.normalmap,D=THREE.UniformsUtils.clone(G.uniforms),v=A.parameters.color,J=A.parameters.specular,n=A.parameters.ambient,
|
|
|
-H=A.parameters.shininess,D.tNormal.value=y.textures[A.parameters.normalMap],A.parameters.normalScale&&D.uNormalScale.value.set(A.parameters.normalScale[0],A.parameters.normalScale[1]),A.parameters.map&&(D.tDiffuse.value=A.parameters.map,D.enableDiffuse.value=!0),A.parameters.envMap&&(D.tCube.value=A.parameters.envMap,D.enableReflection.value=!0,D.uReflectivity.value=A.parameters.reflectivity),A.parameters.lightMap&&(D.tAO.value=A.parameters.lightMap,D.enableAO.value=!0),A.parameters.specularMap&&
|
|
|
-(D.tSpecular.value=y.textures[A.parameters.specularMap],D.enableSpecular.value=!0),A.parameters.displacementMap&&(D.tDisplacement.value=y.textures[A.parameters.displacementMap],D.enableDisplacement.value=!0,D.uDisplacementBias.value=A.parameters.displacementBias,D.uDisplacementScale.value=A.parameters.displacementScale),D.uDiffuseColor.value.setHex(v),D.uSpecularColor.value.setHex(J),D.uAmbientColor.value.setHex(n),D.uShininess.value=H,A.parameters.opacity&&(D.uOpacity.value=A.parameters.opacity),
|
|
|
-r=new THREE.ShaderMaterial({fragmentShader:G.fragmentShader,vertexShader:G.vertexShader,uniforms:D,lights:!0,fog:!0})):r=new THREE[A.type](A.parameters);r.name=M;y.materials[M]=r}for(M in x.materials)if(A=x.materials[M],A.parameters.materials){E=[];for(v=0;v<A.parameters.materials.length;v++)E.push(y.materials[A.parameters.materials[v]]);y.materials[M].materials=E}e();y.cameras&&x.defaults.camera&&(y.currentCamera=y.cameras[x.defaults.camera]);y.fogs&&x.defaults.fog&&(y.scene.fog=y.fogs[x.defaults.fog]);
|
|
|
+f;e();t-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:G,totalTextures:B,loadedModels:G-t,loadedTextures:B-x},y);l.onLoadProgress();if(0===t&&0===x){for(var a=0;a<z.length;a++){var c=z[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,y.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(y)}}function m(a,b){b(a);if(void 0!==a.children)for(var c in a.children)m(a.children[c],
|
|
|
+b)}var l=this,p=THREE.Loader.prototype.extractUrlBase(c),s,r,q,n,v,u,t,x,G,B,y,z=[],D=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;x=t=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(D.transform&&(H=D.transform.position,
|
|
|
+a=D.transform.rotation,c=D.transform.scale,H&&y.scene.position.fromArray(H),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),H||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();H=function(a){return function(){x-=a;k();l.onLoadComplete()}};for(var F in D.fogs)a=D.fogs[F],"linear"===a.type?n=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(n=new THREE.FogExp2(0,a.density)),a=a.color,n.color.setRGB(a[0],a[1],a[2]),y.fogs[F]=n;for(var w in D.geometries)n=D.geometries[w],n.type in
|
|
|
+this.geometryHandlers&&(t+=1,l.onLoadStart());for(var J in D.objects)m(D.objects[J],function(a){a.type&&a.type in l.hierarchyHandlers&&(t+=1,l.onLoadStart())});G=t;for(w in D.geometries)if(n=D.geometries[w],"cube"===n.type)s=new THREE.CubeGeometry(n.width,n.height,n.depth,n.widthSegments,n.heightSegments,n.depthSegments),s.name=w,y.geometries[w]=s;else if("plane"===n.type)s=new THREE.PlaneGeometry(n.width,n.height,n.widthSegments,n.heightSegments),s.name=w,y.geometries[w]=s;else if("sphere"===n.type)s=
|
|
|
+new THREE.SphereGeometry(n.radius,n.widthSegments,n.heightSegments),s.name=w,y.geometries[w]=s;else if("cylinder"===n.type)s=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),s.name=w,y.geometries[w]=s;else if("torus"===n.type)s=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),s.name=w,y.geometries[w]=s;else if("icosahedron"===n.type)s=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),s.name=w,y.geometries[w]=s;else if(n.type in this.geometryHandlers){J=
|
|
|
+{};for(v in n)"type"!==v&&"url"!==v&&(J[v]=n[v]);this.geometryHandlers[n.type].loaderObject.load(d(n.url,D.urlBaseType),h(w),J)}else"embedded"===n.type&&(J=D.embeds[n.id],J.metadata=D.metadata,J&&(J=this.geometryHandlers.ascii.loaderObject.parse(J,""),i(w)(J.geometry,J.materials)));for(var A in D.textures)if(w=D.textures[A],w.url instanceof Array){x+=w.url.length;for(v=0;v<w.url.length;v++)l.onLoadStart()}else x+=1,l.onLoadStart();B=x;for(A in D.textures){w=D.textures[A];void 0!==w.mapping&&void 0!==
|
|
|
+THREE[w.mapping]&&(w.mapping=new THREE[w.mapping]);if(w.url instanceof Array){J=w.url.length;n=[];for(v=0;v<J;v++)n[v]=d(w.url[v],D.urlBaseType);v=(v=/\.dds$/i.test(n[0]))?THREE.ImageUtils.loadCompressedTextureCube(n,w.mapping,H(J)):THREE.ImageUtils.loadTextureCube(n,w.mapping,H(J))}else v=/\.dds$/i.test(w.url),J=d(w.url,D.urlBaseType),n=H(1),v=v?THREE.ImageUtils.loadCompressedTexture(J,w.mapping,n):THREE.ImageUtils.loadTexture(J,w.mapping,n),void 0!==THREE[w.minFilter]&&(v.minFilter=THREE[w.minFilter]),
|
|
|
+void 0!==THREE[w.magFilter]&&(v.magFilter=THREE[w.magFilter]),w.anisotropy&&(v.anisotropy=w.anisotropy),w.repeat&&(v.repeat.set(w.repeat[0],w.repeat[1]),1!==w.repeat[0]&&(v.wrapS=THREE.RepeatWrapping),1!==w.repeat[1]&&(v.wrapT=THREE.RepeatWrapping)),w.offset&&v.offset.set(w.offset[0],w.offset[1]),w.wrap&&(J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==J[w.wrap[0]]&&(v.wrapS=J[w.wrap[0]]),void 0!==J[w.wrap[1]]&&(v.wrapT=J[w.wrap[1]]));y.textures[A]=v}var N,E;for(N in D.materials){A=
|
|
|
+D.materials[N];for(E in A.parameters)"envMap"===E||"map"===E||"lightMap"===E||"bumpMap"===E?A.parameters[E]=y.textures[A.parameters[E]]:"shading"===E?A.parameters[E]="flat"===A.parameters[E]?THREE.FlatShading:THREE.SmoothShading:"side"===E?A.parameters[E]="double"==A.parameters[E]?THREE.DoubleSide:"back"==A.parameters[E]?THREE.BackSide:THREE.FrontSide:"blending"===E?A.parameters[E]=A.parameters[E]in THREE?THREE[A.parameters[E]]:THREE.NormalBlending:"combine"===E?A.parameters[E]=A.parameters[E]in THREE?
|
|
|
+THREE[A.parameters[E]]:THREE.MultiplyOperation:"vertexColors"===E?"face"==A.parameters[E]?A.parameters[E]=THREE.FaceColors:A.parameters[E]&&(A.parameters[E]=THREE.VertexColors):"wrapRGB"===E&&(H=A.parameters[E],A.parameters[E]=new THREE.Vector3(H[0],H[1],H[2]));void 0!==A.parameters.opacity&&1>A.parameters.opacity&&(A.parameters.transparent=!0);A.parameters.normalMap?(H=THREE.ShaderLib.normalmap,w=THREE.UniformsUtils.clone(H.uniforms),v=A.parameters.color,J=A.parameters.specular,n=A.parameters.ambient,
|
|
|
+F=A.parameters.shininess,w.tNormal.value=y.textures[A.parameters.normalMap],A.parameters.normalScale&&w.uNormalScale.value.set(A.parameters.normalScale[0],A.parameters.normalScale[1]),A.parameters.map&&(w.tDiffuse.value=A.parameters.map,w.enableDiffuse.value=!0),A.parameters.envMap&&(w.tCube.value=A.parameters.envMap,w.enableReflection.value=!0,w.uReflectivity.value=A.parameters.reflectivity),A.parameters.lightMap&&(w.tAO.value=A.parameters.lightMap,w.enableAO.value=!0),A.parameters.specularMap&&
|
|
|
+(w.tSpecular.value=y.textures[A.parameters.specularMap],w.enableSpecular.value=!0),A.parameters.displacementMap&&(w.tDisplacement.value=y.textures[A.parameters.displacementMap],w.enableDisplacement.value=!0,w.uDisplacementBias.value=A.parameters.displacementBias,w.uDisplacementScale.value=A.parameters.displacementScale),w.uDiffuseColor.value.setHex(v),w.uSpecularColor.value.setHex(J),w.uAmbientColor.value.setHex(n),w.uShininess.value=F,A.parameters.opacity&&(w.uOpacity.value=A.parameters.opacity),
|
|
|
+r=new THREE.ShaderMaterial({fragmentShader:H.fragmentShader,vertexShader:H.vertexShader,uniforms:w,lights:!0,fog:!0})):r=new THREE[A.type](A.parameters);r.name=N;y.materials[N]=r}for(N in D.materials)if(A=D.materials[N],A.parameters.materials){E=[];for(v=0;v<A.parameters.materials.length;v++)E.push(y.materials[A.parameters.materials[v]]);y.materials[N].materials=E}e();y.cameras&&D.defaults.camera&&(y.currentCamera=y.cameras[D.defaults.camera]);y.fogs&&D.defaults.fog&&(y.scene.fog=y.fogs[D.defaults.fog]);
|
|
|
l.callbackSync(y);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
|
|
|
a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
|
|
@@ -295,29 +295,29 @@ THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAn
|
|
|
THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.getPositionFromMatrix(c.matrixWorld);b.getPositionFromMatrix(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d<e;d++)this.objects[d].object.visible=!1}}}();THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0};THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Particle=THREE.Sprite;THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}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));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=w.length;d<e;d++){var f=w[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=sa.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ka.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=sa.getPositionFromMatrix(f.matrixWorld),g=b.dot(sa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Ka.multiplyScalar(g)))))}}
|
|
|
-function c(a,b,c,d){m(b);l(c);p(d);s(a.getStyle());H.stroke();Ca.expandByScalar(2*b)}function d(a){r(a.getStyle());H.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0===n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS===THREE.RepeatWrapping,q=n.wrapT===THREE.RepeatWrapping;Fa[n.id]=H.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Fa[n.id]?r("rgba(0,0,0,1)"):
|
|
|
+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=x.length;d<e;d++){var f=x[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=sa.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ka.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=sa.getPositionFromMatrix(f.matrixWorld),g=b.dot(sa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Ka.multiplyScalar(g)))))}}
|
|
|
+function c(a,b,c,d){m(b);l(c);p(d);s(a.getStyle());F.stroke();Da.expandByScalar(2*b)}function d(a){r(a.getStyle());F.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0===n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS===THREE.RepeatWrapping,q=n.wrapT===THREE.RepeatWrapping;Fa[n.id]=F.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Fa[n.id]?r("rgba(0,0,0,1)"):
|
|
|
r(Fa[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,s=n.image.width*n.repeat.x,t=n.image.height*n.repeat.y,g=(g+p)*s,j=(1-j+q)*t,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*s-g,k=(1-k+q)*t-j,m=(m+p)*s-g,l=(1-l+q)*t-j,p=i*l-m*k;0===p?(void 0===la[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),la[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=la[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
|
|
|
-O.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(O)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,H.save(),H.transform(n,k,c,e,a,g),H.fill(),H.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,n){var l,p;l=n.width-1;p=n.height-1;h*=l;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*l-h;i=i*p-g;k=k*l-h;m=m*p-g;p=1/(j*m-k*i);l=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-l*h-c*g;b=b-i*h-d*g;H.save();H.transform(l,i,c,d,a,b);H.clip();H.drawImage(n,0,0);H.restore()}function h(a,
|
|
|
-b,c,d){ta[0]=255*a.r|0;ta[1]=255*a.g|0;ta[2]=255*a.b|0;ta[4]=255*b.r|0;ta[5]=255*b.g|0;ta[6]=255*b.b|0;ta[8]=255*c.r|0;ta[9]=255*c.g|0;ta[10]=255*c.b|0;ta[12]=255*d.r|0;ta[13]=255*d.g|0;ta[14]=255*d.b|0;j.putImageData(Oa,0,0);Da.drawImage(Pa,0,0);return La}function g(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 i(a){A!==a&&(A=H.globalAlpha=a)}function k(a){M!==a&&(a===THREE.NormalBlending?H.globalCompositeOperation="source-over":
|
|
|
-a===THREE.AdditiveBlending?H.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(H.globalCompositeOperation="darker"),M=a)}function m(a){R!==a&&(R=H.lineWidth=a)}function l(a){Q!==a&&(Q=H.lineCap=a)}function p(a){aa!==a&&(aa=H.lineJoin=a)}function s(a){E!==a&&(E=H.strokeStyle=a)}function r(a){T!==a&&(T=H.fillStyle=a)}function q(a,b){if(V!==a||C!==b)H.setLineDash([a,b]),V=a,C=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var n=THREE.Math.smoothstep,a=a||{},v=this,u,t,w,F=new THREE.Projector,
|
|
|
-B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),y=B.width,z=B.height,x=Math.floor(y/2),G=Math.floor(z/2),H=B.getContext("2d"),D=new THREE.Color(0),J=0,A=1,M=0,E=null,T=null,R=null,Q=null,aa=null,V=null,C=0,S,Z,K,ea;new THREE.RenderableVertex;new THREE.RenderableVertex;var Ea,za,Ga,ya,N,fa,O=new THREE.Color,P=new THREE.Color,ca=new THREE.Color,X=new THREE.Color,ka=new THREE.Color,ra=new THREE.Color,ia=new THREE.Color,Ka=new THREE.Color,Fa={},la={},Ba,Ua,Qa,va,bb,cb,Ma,fb,sb,pb,ua=new THREE.Box2,
|
|
|
-ma=new THREE.Box2,Ca=new THREE.Box2,gb=new THREE.Color,qa=new THREE.Color,ga=new THREE.Color,sa=new THREE.Vector3,Pa,j,Oa,ta,La,Da,Ra=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;j=Pa.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);Oa=j.getImageData(0,0,2,2);ta=Oa.data;La=document.createElement("canvas");La.width=La.height=Ra;Da=La.getContext("2d");Da.translate(-Ra/2,-Ra/2);Da.scale(Ra,Ra);Ra--;void 0===H.setLineDash&&(H.setLineDash=void 0!==H.mozDash?function(a){H.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){y=a*this.devicePixelRatio;z=b*this.devicePixelRatio;x=Math.floor(y/2);G=Math.floor(z/2);B.width=y;B.height=z;1!==this.devicePixelRatio&&
|
|
|
-!1!==c&&(B.style.width=a+"px",B.style.height=b+"px");ua.set(new THREE.Vector2(-x,-G),new THREE.Vector2(x,G));ma.set(new THREE.Vector2(-x,-G),new THREE.Vector2(x,G));A=1;M=0;aa=Q=R=T=E=null};this.setClearColor=function(a,b){D.set(a);J=void 0!==b?b:1;ma.set(new THREE.Vector2(-x,-G),new THREE.Vector2(x,G))};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(){H.setTransform(1,0,0,-1,x,G);!1===ma.empty()&&(ma.intersect(ua),ma.expandByScalar(2),1>J&&H.clearRect(ma.min.x|0,ma.min.y|0,ma.max.x-ma.min.x|0,ma.max.y-ma.min.y|0),0<J&&(k(THREE.NormalBlending),i(1),r("rgba("+Math.floor(255*D.r)+","+Math.floor(255*D.g)+","+Math.floor(255*D.b)+","+J+")"),H.fillRect(ma.min.x|0,ma.min.y|0,ma.max.x-ma.min.x|0,ma.max.y-ma.min.y|0)),ma.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{!0===this.autoClear&&this.clear();H.setTransform(1,0,0,-1,x,G);v.info.render.vertices=0;v.info.render.faces=0;u=F.projectScene(a,j,this.sortObjects,this.sortElements);t=u.elements;w=u.lights;S=j;gb.setRGB(0,0,0);qa.setRGB(0,0,0);ga.setRGB(0,0,0);for(var y=0,D=w.length;y<D;y++){var z=w[y],E=z.color;z instanceof THREE.AmbientLight?gb.add(E):z instanceof THREE.DirectionalLight?qa.add(E):z instanceof THREE.PointLight&&ga.add(E)}y=0;for(D=t.length;y<D;y++){var A=t[y],B=A.material;if(!(void 0===B||
|
|
|
-!1===B.visible)){Ca.makeEmpty();if(A instanceof THREE.RenderableSprite){Z=A;Z.x*=x;Z.y*=G;var z=Z,E=A,J=B;i(J.opacity);k(J.blending);A=E.scale.x*x;B=E.scale.y*G;Ca.min.set(z.x-0.5*A,z.y-0.5*B);Ca.max.set(z.x+0.5*A,z.y+0.5*B);!1===ua.isIntersectionBox(Ca)?Ca.makeEmpty():J instanceof THREE.SpriteMaterial||J instanceof THREE.ParticleSystemMaterial?(null!==J.map?(E=J.map.image,H.save(),H.translate(z.x,z.y),H.rotate(-J.rotation),H.scale(A,-B),H.drawImage(E,0,0,E.width,E.height,-0.5,-0.5,1,1)):(r(J.color.getStyle()),
|
|
|
-H.save(),H.translate(z.x,z.y),H.rotate(-E.rotation),H.scale(A,B),H.fillRect(-0.5,-0.5,1,1)),H.restore()):J instanceof THREE.SpriteCanvasMaterial&&(s(J.color.getStyle()),r(J.color.getStyle()),H.save(),H.translate(z.x,z.y),H.rotate(-E.rotation),H.scale(A,B),J.program(H),H.restore())}else if(A instanceof THREE.RenderableLine){if(Z=A.v1,K=A.v2,Z.positionScreen.x*=x,Z.positionScreen.y*=G,K.positionScreen.x*=x,K.positionScreen.y*=G,Ca.setFromPoints([Z.positionScreen,K.positionScreen]),!0===ua.isIntersectionBox(Ca))if(z=
|
|
|
-Z,E=K,J=A,A=B,i(A.opacity),k(A.blending),H.beginPath(),H.moveTo(z.positionScreen.x,z.positionScreen.y),H.lineTo(E.positionScreen.x,E.positionScreen.y),A instanceof THREE.LineBasicMaterial){m(A.linewidth);l(A.linecap);p(A.linejoin);if(A.vertexColors!==THREE.VertexColors)s(A.color.getStyle());else if(B=J.vertexColors[0].getStyle(),J=J.vertexColors[1].getStyle(),B===J)s(B);else{try{var M=H.createLinearGradient(z.positionScreen.x,z.positionScreen.y,E.positionScreen.x,E.positionScreen.y);M.addColorStop(0,
|
|
|
-B);M.addColorStop(1,J)}catch(C){M=B}s(M)}H.stroke();Ca.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(m(A.linewidth),l(A.linecap),p(A.linejoin),s(A.color.getStyle()),q(A.dashSize,A.gapSize),H.stroke(),Ca.expandByScalar(2*A.linewidth),q(null,null))}else if(A instanceof THREE.RenderableFace3){Z=A.v1;K=A.v2;ea=A.v3;if(-1>Z.positionScreen.z||1<Z.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>ea.positionScreen.z||1<ea.positionScreen.z)continue;
|
|
|
-Z.positionScreen.x*=x;Z.positionScreen.y*=G;K.positionScreen.x*=x;K.positionScreen.y*=G;ea.positionScreen.x*=x;ea.positionScreen.y*=G;0<B.overdraw&&(g(Z.positionScreen,K.positionScreen,B.overdraw),g(K.positionScreen,ea.positionScreen,B.overdraw),g(ea.positionScreen,Z.positionScreen,B.overdraw));Ca.setFromPoints([Z.positionScreen,K.positionScreen,ea.positionScreen]);if(!0===ua.isIntersectionBox(Ca)){z=Z;E=K;J=ea;v.info.render.vertices+=3;v.info.render.faces++;i(B.opacity);k(B.blending);Ea=z.positionScreen.x;
|
|
|
-za=z.positionScreen.y;Ga=E.positionScreen.x;ya=E.positionScreen.y;N=J.positionScreen.x;fa=J.positionScreen.y;var R=Ea,T=za,V=Ga,Q=ya,aa=N,la=fa;H.beginPath();H.moveTo(R,T);H.lineTo(V,Q);H.lineTo(aa,la);H.closePath();(B instanceof THREE.MeshLambertMaterial||B instanceof THREE.MeshPhongMaterial)&&null===B.map?(ra.copy(B.color),ia.copy(B.emissive),B.vertexColors===THREE.FaceColors&&ra.multiply(A.color),!1===B.wireframe&&B.shading===THREE.SmoothShading&&3===A.vertexNormalsLength?(P.copy(gb),ca.copy(gb),
|
|
|
-X.copy(gb),b(A.v1.positionWorld,A.vertexNormalsModel[0],P),b(A.v2.positionWorld,A.vertexNormalsModel[1],ca),b(A.v3.positionWorld,A.vertexNormalsModel[2],X),P.multiply(ra).add(ia),ca.multiply(ra).add(ia),X.multiply(ra).add(ia),ka.addColors(ca,X).multiplyScalar(0.5),Qa=h(P,ca,X,ka),f(Ea,za,Ga,ya,N,fa,0,0,1,0,0,1,Qa)):(O.copy(gb),b(A.centroidModel,A.normalModel,O),O.multiply(ra).add(ia),!0===B.wireframe?c(O,B.wireframeLinewidth,B.wireframeLinecap,B.wireframeLinejoin):d(O))):B instanceof THREE.MeshBasicMaterial||
|
|
|
-B instanceof THREE.MeshLambertMaterial||B instanceof THREE.MeshPhongMaterial?null!==B.map?B.map.mapping instanceof THREE.UVMapping&&(va=A.uvs[0],e(Ea,za,Ga,ya,N,fa,va[0].x,va[0].y,va[1].x,va[1].y,va[2].x,va[2].y,B.map)):null!==B.envMap?B.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(sa.copy(A.vertexNormalsModelView[0]),bb=0.5*sa.x+0.5,cb=0.5*sa.y+0.5,sa.copy(A.vertexNormalsModelView[1]),Ma=0.5*sa.x+0.5,fb=0.5*sa.y+0.5,sa.copy(A.vertexNormalsModelView[2]),sb=0.5*sa.x+0.5,pb=0.5*sa.y+
|
|
|
-0.5,e(Ea,za,Ga,ya,N,fa,bb,cb,Ma,fb,sb,pb,B.envMap)):(O.copy(B.color),B.vertexColors===THREE.FaceColors&&O.multiply(A.color),!0===B.wireframe?c(O,B.wireframeLinewidth,B.wireframeLinecap,B.wireframeLinejoin):d(O)):B instanceof THREE.MeshDepthMaterial?(Ba=S.near,Ua=S.far,P.r=P.g=P.b=1-n(z.positionScreen.z*z.positionScreen.w,Ba,Ua),ca.r=ca.g=ca.b=1-n(E.positionScreen.z*E.positionScreen.w,Ba,Ua),X.r=X.g=X.b=1-n(J.positionScreen.z*J.positionScreen.w,Ba,Ua),ka.addColors(ca,X).multiplyScalar(0.5),Qa=h(P,
|
|
|
-ca,X,ka),f(Ea,za,Ga,ya,N,fa,0,0,1,0,0,1,Qa)):B instanceof THREE.MeshNormalMaterial&&(z=void 0,B.shading===THREE.FlatShading?(z=A.normalModelView,O.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),!0===B.wireframe?c(O,B.wireframeLinewidth,B.wireframeLinecap,B.wireframeLinejoin):d(O)):B.shading===THREE.SmoothShading&&(z=A.vertexNormalsModelView[0],P.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),z=A.vertexNormalsModelView[1],ca.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),z=
|
|
|
-A.vertexNormalsModelView[2],X.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),ka.addColors(ca,X).multiplyScalar(0.5),Qa=h(P,ca,X,ka),f(Ea,za,Ga,ya,N,fa,0,0,1,0,0,1,Qa)))}}ma.union(Ca)}}H.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",
|
|
|
+O.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(O)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,F.save(),F.transform(n,k,c,e,a,g),F.fill(),F.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,n){var l,p;l=n.width-1;p=n.height-1;h*=l;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*l-h;i=i*p-g;k=k*l-h;m=m*p-g;p=1/(j*m-k*i);l=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-l*h-c*g;b=b-i*h-d*g;F.save();F.transform(l,i,c,d,a,b);F.clip();F.drawImage(n,0,0);F.restore()}function h(a,
|
|
|
+b,c,d){ta[0]=255*a.r|0;ta[1]=255*a.g|0;ta[2]=255*a.b|0;ta[4]=255*b.r|0;ta[5]=255*b.g|0;ta[6]=255*b.b|0;ta[8]=255*c.r|0;ta[9]=255*c.g|0;ta[10]=255*c.b|0;ta[12]=255*d.r|0;ta[13]=255*d.g|0;ta[14]=255*d.b|0;j.putImageData(Oa,0,0);Ea.drawImage(Pa,0,0);return La}function g(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 i(a){A!==a&&(A=F.globalAlpha=a)}function k(a){N!==a&&(a===THREE.NormalBlending?F.globalCompositeOperation="source-over":
|
|
|
+a===THREE.AdditiveBlending?F.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(F.globalCompositeOperation="darker"),N=a)}function m(a){R!==a&&(R=F.lineWidth=a)}function l(a){M!==a&&(M=F.lineCap=a)}function p(a){Q!==a&&(Q=F.lineJoin=a)}function s(a){E!==a&&(E=F.strokeStyle=a)}function r(a){T!==a&&(T=F.fillStyle=a)}function q(a,b){if(ha!==a||C!==b)F.setLineDash([a,b]),ha=a,C=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var n=THREE.Math.smoothstep,a=a||{},v=this,u,t,x,G=new THREE.Projector,
|
|
|
+B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),y=B.width,z=B.height,D=Math.floor(y/2),H=Math.floor(z/2),F=B.getContext("2d"),w=new THREE.Color(0),J=0,A=1,N=0,E=null,T=null,R=null,M=null,Q=null,ha=null,C=0,S,Y,K,da;new THREE.RenderableVertex;new THREE.RenderableVertex;var ya,Aa,Ga,za,ba,ea,O=new THREE.Color,P=new THREE.Color,aa=new THREE.Color,W=new THREE.Color,ka=new THREE.Color,ra=new THREE.Color,ia=new THREE.Color,Ka=new THREE.Color,Fa={},la={},Ca,Ua,Qa,va,bb,cb,Ma,fb,sb,pb,ua=new THREE.Box2,
|
|
|
+ma=new THREE.Box2,Da=new THREE.Box2,gb=new THREE.Color,qa=new THREE.Color,fa=new THREE.Color,sa=new THREE.Vector3,Pa,j,Oa,ta,La,Ea,Ra=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;j=Pa.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);Oa=j.getImageData(0,0,2,2);ta=Oa.data;La=document.createElement("canvas");La.width=La.height=Ra;Ea=La.getContext("2d");Ea.translate(-Ra/2,-Ra/2);Ea.scale(Ra,Ra);Ra--;void 0===F.setLineDash&&(F.setLineDash=void 0!==F.mozDash?function(a){F.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){y=a*this.devicePixelRatio;z=b*this.devicePixelRatio;D=Math.floor(y/2);H=Math.floor(z/2);B.width=y;B.height=z;1!==this.devicePixelRatio&&
|
|
|
+!1!==c&&(B.style.width=a+"px",B.style.height=b+"px");ua.set(new THREE.Vector2(-D,-H),new THREE.Vector2(D,H));ma.set(new THREE.Vector2(-D,-H),new THREE.Vector2(D,H));A=1;N=0;Q=M=R=T=E=null};this.setClearColor=function(a,b){w.set(a);J=void 0!==b?b:1;ma.set(new THREE.Vector2(-D,-H),new THREE.Vector2(D,H))};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(){F.setTransform(1,0,0,-1,D,H);!1===ma.empty()&&(ma.intersect(ua),ma.expandByScalar(2),1>J&&F.clearRect(ma.min.x|0,ma.min.y|0,ma.max.x-ma.min.x|0,ma.max.y-ma.min.y|0),0<J&&(k(THREE.NormalBlending),i(1),r("rgba("+Math.floor(255*w.r)+","+Math.floor(255*w.g)+","+Math.floor(255*w.b)+","+J+")"),F.fillRect(ma.min.x|0,ma.min.y|0,ma.max.x-ma.min.x|0,ma.max.y-ma.min.y|0)),ma.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{!0===this.autoClear&&this.clear();F.setTransform(1,0,0,-1,D,H);v.info.render.vertices=0;v.info.render.faces=0;u=G.projectScene(a,j,this.sortObjects,this.sortElements);t=u.elements;x=u.lights;S=j;gb.setRGB(0,0,0);qa.setRGB(0,0,0);fa.setRGB(0,0,0);for(var y=0,w=x.length;y<w;y++){var z=x[y],E=z.color;z instanceof THREE.AmbientLight?gb.add(E):z instanceof THREE.DirectionalLight?qa.add(E):z instanceof THREE.PointLight&&fa.add(E)}y=0;for(w=t.length;y<w;y++){var A=t[y],B=A.material;if(!(void 0===B||
|
|
|
+!1===B.visible)){Da.makeEmpty();if(A instanceof THREE.RenderableSprite){Y=A;Y.x*=D;Y.y*=H;var z=Y,E=A,J=B;i(J.opacity);k(J.blending);A=E.scale.x*D;B=E.scale.y*H;Da.min.set(z.x-0.5*A,z.y-0.5*B);Da.max.set(z.x+0.5*A,z.y+0.5*B);!1===ua.isIntersectionBox(Da)?Da.makeEmpty():J instanceof THREE.SpriteMaterial||J instanceof THREE.ParticleSystemMaterial?(null!==J.map?(E=J.map.image,F.save(),F.translate(z.x,z.y),F.rotate(-J.rotation),F.scale(A,-B),F.drawImage(E,0,0,E.width,E.height,-0.5,-0.5,1,1)):(r(J.color.getStyle()),
|
|
|
+F.save(),F.translate(z.x,z.y),F.rotate(-E.rotation),F.scale(A,B),F.fillRect(-0.5,-0.5,1,1)),F.restore()):J instanceof THREE.SpriteCanvasMaterial&&(s(J.color.getStyle()),r(J.color.getStyle()),F.save(),F.translate(z.x,z.y),F.rotate(-E.rotation),F.scale(A,B),J.program(F),F.restore())}else if(A instanceof THREE.RenderableLine){if(Y=A.v1,K=A.v2,Y.positionScreen.x*=D,Y.positionScreen.y*=H,K.positionScreen.x*=D,K.positionScreen.y*=H,Da.setFromPoints([Y.positionScreen,K.positionScreen]),!0===ua.isIntersectionBox(Da))if(z=
|
|
|
+Y,E=K,J=A,A=B,i(A.opacity),k(A.blending),F.beginPath(),F.moveTo(z.positionScreen.x,z.positionScreen.y),F.lineTo(E.positionScreen.x,E.positionScreen.y),A instanceof THREE.LineBasicMaterial){m(A.linewidth);l(A.linecap);p(A.linejoin);if(A.vertexColors!==THREE.VertexColors)s(A.color.getStyle());else if(B=J.vertexColors[0].getStyle(),J=J.vertexColors[1].getStyle(),B===J)s(B);else{try{var N=F.createLinearGradient(z.positionScreen.x,z.positionScreen.y,E.positionScreen.x,E.positionScreen.y);N.addColorStop(0,
|
|
|
+B);N.addColorStop(1,J)}catch(C){N=B}s(N)}F.stroke();Da.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(m(A.linewidth),l(A.linecap),p(A.linejoin),s(A.color.getStyle()),q(A.dashSize,A.gapSize),F.stroke(),Da.expandByScalar(2*A.linewidth),q(null,null))}else if(A instanceof THREE.RenderableFace3){Y=A.v1;K=A.v2;da=A.v3;if(-1>Y.positionScreen.z||1<Y.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>da.positionScreen.z||1<da.positionScreen.z)continue;
|
|
|
+Y.positionScreen.x*=D;Y.positionScreen.y*=H;K.positionScreen.x*=D;K.positionScreen.y*=H;da.positionScreen.x*=D;da.positionScreen.y*=H;0<B.overdraw&&(g(Y.positionScreen,K.positionScreen,B.overdraw),g(K.positionScreen,da.positionScreen,B.overdraw),g(da.positionScreen,Y.positionScreen,B.overdraw));Da.setFromPoints([Y.positionScreen,K.positionScreen,da.positionScreen]);if(!0===ua.isIntersectionBox(Da)){z=Y;E=K;J=da;v.info.render.vertices+=3;v.info.render.faces++;i(B.opacity);k(B.blending);ya=z.positionScreen.x;
|
|
|
+Aa=z.positionScreen.y;Ga=E.positionScreen.x;za=E.positionScreen.y;ba=J.positionScreen.x;ea=J.positionScreen.y;var R=ya,T=Aa,M=Ga,Q=za,ha=ba,la=ea;F.beginPath();F.moveTo(R,T);F.lineTo(M,Q);F.lineTo(ha,la);F.closePath();(B instanceof THREE.MeshLambertMaterial||B instanceof THREE.MeshPhongMaterial)&&null===B.map?(ra.copy(B.color),ia.copy(B.emissive),B.vertexColors===THREE.FaceColors&&ra.multiply(A.color),!1===B.wireframe&&B.shading===THREE.SmoothShading&&3===A.vertexNormalsLength?(P.copy(gb),aa.copy(gb),
|
|
|
+W.copy(gb),b(A.v1.positionWorld,A.vertexNormalsModel[0],P),b(A.v2.positionWorld,A.vertexNormalsModel[1],aa),b(A.v3.positionWorld,A.vertexNormalsModel[2],W),P.multiply(ra).add(ia),aa.multiply(ra).add(ia),W.multiply(ra).add(ia),ka.addColors(aa,W).multiplyScalar(0.5),Qa=h(P,aa,W,ka),f(ya,Aa,Ga,za,ba,ea,0,0,1,0,0,1,Qa)):(O.copy(gb),b(A.centroidModel,A.normalModel,O),O.multiply(ra).add(ia),!0===B.wireframe?c(O,B.wireframeLinewidth,B.wireframeLinecap,B.wireframeLinejoin):d(O))):B instanceof THREE.MeshBasicMaterial||
|
|
|
+B instanceof THREE.MeshLambertMaterial||B instanceof THREE.MeshPhongMaterial?null!==B.map?B.map.mapping instanceof THREE.UVMapping&&(va=A.uvs[0],e(ya,Aa,Ga,za,ba,ea,va[0].x,va[0].y,va[1].x,va[1].y,va[2].x,va[2].y,B.map)):null!==B.envMap?B.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(sa.copy(A.vertexNormalsModelView[0]),bb=0.5*sa.x+0.5,cb=0.5*sa.y+0.5,sa.copy(A.vertexNormalsModelView[1]),Ma=0.5*sa.x+0.5,fb=0.5*sa.y+0.5,sa.copy(A.vertexNormalsModelView[2]),sb=0.5*sa.x+0.5,pb=0.5*sa.y+
|
|
|
+0.5,e(ya,Aa,Ga,za,ba,ea,bb,cb,Ma,fb,sb,pb,B.envMap)):(O.copy(B.color),B.vertexColors===THREE.FaceColors&&O.multiply(A.color),!0===B.wireframe?c(O,B.wireframeLinewidth,B.wireframeLinecap,B.wireframeLinejoin):d(O)):B instanceof THREE.MeshDepthMaterial?(Ca=S.near,Ua=S.far,P.r=P.g=P.b=1-n(z.positionScreen.z*z.positionScreen.w,Ca,Ua),aa.r=aa.g=aa.b=1-n(E.positionScreen.z*E.positionScreen.w,Ca,Ua),W.r=W.g=W.b=1-n(J.positionScreen.z*J.positionScreen.w,Ca,Ua),ka.addColors(aa,W).multiplyScalar(0.5),Qa=h(P,
|
|
|
+aa,W,ka),f(ya,Aa,Ga,za,ba,ea,0,0,1,0,0,1,Qa)):B instanceof THREE.MeshNormalMaterial&&(z=void 0,B.shading===THREE.FlatShading?(z=A.normalModelView,O.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),!0===B.wireframe?c(O,B.wireframeLinewidth,B.wireframeLinecap,B.wireframeLinejoin):d(O)):B.shading===THREE.SmoothShading&&(z=A.vertexNormalsModelView[0],P.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),z=A.vertexNormalsModelView[1],aa.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),z=
|
|
|
+A.vertexNormalsModelView[2],W.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),ka.addColors(aa,W).multiplyScalar(0.5),Qa=h(P,aa,W,ka),f(ya,Aa,Ga,za,ba,ea,0,0,1,0,0,1,Qa)))}}ma.union(Da)}}F.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",
|
|
@@ -372,8 +372,8 @@ function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.leng
|
|
|
(a.__skinIndexArray=new Float32Array(4*g),a.__skinWeightArray=new Float32Array(4*g));a.__faceArray=new Uint16Array(3*i);a.__lineArray=new Uint16Array(2*k);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<m;c++)a.__morphTargetsArrays.push(new Float32Array(3*g))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*g))}a.__webglFaceCount=3*i;a.__webglLineCount=2*k;if(h.attributes){void 0===a.__webglCustomAttributesList&&
|
|
|
(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?
|
|
|
a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){ua[a]||(j.enableVertexAttribArray(a),ua[a]=!0)}function g(){for(var a in ua)ua[a]&&(j.disableVertexAttribArray(a),ua[a]=
|
|
|
-!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function m(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)fa=za=null,ya=N=X=ca=la=Fa=ka=-1,sa=!0,a[d].render(b,c,sb,pb),fa=za=null,ya=N=X=ca=la=Fa=ka=-1,sa=!0}function l(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
|
|
|
-K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);x(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,j,k,i):K.renderBuffer(d,e,f,j,k,i)}}function p(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);x(g.polygonOffset,
|
|
|
+!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function m(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ea=Aa=null,za=ba=W=aa=la=Fa=ka=-1,sa=!0,a[d].render(b,c,sb,pb),ea=Aa=null,za=ba=W=aa=la=Fa=ka=-1,sa=!0}function l(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
|
|
|
+K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);D(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,j,k,i):K.renderBuffer(d,e,f,j,k,i)}}function p(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);D(g.polygonOffset,
|
|
|
g.polygonOffsetFactor,g.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,g,j)}}function s(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Cb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],
|
|
|
void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,s=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],l=s?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&
|
|
|
(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[l].counter+=1,n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=O++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
|
|
@@ -383,13 +383,13 @@ j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuff
|
|
|
K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)r(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],r(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof
|
|
|
THREE.ParticleSystem?(f=a.geometry,r(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function r(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
|
|
|
return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?u(b.__webglObjects,a):a instanceof THREE.Sprite?t(b.__webglSprites,a):a instanceof THREE.LensFlare?t(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&u(b.__webglObjectsImmediate,a);delete a.__webglActive}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}
|
|
|
-function t(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function w(a,b,c,d,e){P=0;d.needsUpdate&&(d.program&&Gb(d),K.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==za&&(j.useProgram(g),za=g,f=!0);d.id!==ya&&(ya=d.id,f=!0);if(f||a!==fa)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==fa&&(fa=a);if(d.skinning)if(yb&&
|
|
|
-e.useVertexTexture){if(null!==h.boneTexture){var k=F();j.uniform1i(h.boneTexture,k);K.setTexture(e.boneTexture,k)}null!==h.boneTextureWidth&&j.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&j.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&
|
|
|
-(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(sa){for(var m,l=k=0,n=0,p,q,s,r=Pa,t=r.directional.colors,u=r.directional.positions,v=r.point.colors,w=r.point.positions,A=r.point.distances,z=r.spot.colors,x=r.spot.positions,H=r.spot.distances,G=r.spot.directions,J=r.spot.anglesCos,C=r.spot.exponents,O=r.hemi.skyColors,R=r.hemi.groundColors,S=r.hemi.positions,X=0,T=0,V=0,ca=0,Ea=0,dc=0,$=0,Y=0,N=m=0,c=s=N=0,f=b.length;c<
|
|
|
-f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,s=m.distance,m instanceof THREE.AmbientLight?m.visible&&(K.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(Ea+=1,m.visible&&(ga.getPositionFromMatrix(m.matrixWorld),qa.getPositionFromMatrix(m.target.matrixWorld),ga.sub(qa),ga.normalize(),0===ga.x&&0===ga.y&&0===ga.z||(m=3*X,u[m]=ga.x,u[m+1]=ga.y,u[m+2]=ga.z,K.gammaInput?B(t,m,p,q*q):y(t,m,p,q),X+=1))):m instanceof THREE.PointLight?(dc+=1,
|
|
|
-m.visible&&(N=3*T,K.gammaInput?B(v,N,p,q*q):y(v,N,p,q),qa.getPositionFromMatrix(m.matrixWorld),w[N]=qa.x,w[N+1]=qa.y,w[N+2]=qa.z,A[T]=s,T+=1)):m instanceof THREE.SpotLight?($+=1,m.visible&&(N=3*V,K.gammaInput?B(z,N,p,q*q):y(z,N,p,q),qa.getPositionFromMatrix(m.matrixWorld),x[N]=qa.x,x[N+1]=qa.y,x[N+2]=qa.z,H[V]=s,ga.copy(qa),qa.getPositionFromMatrix(m.target.matrixWorld),ga.sub(qa),ga.normalize(),G[N]=ga.x,G[N+1]=ga.y,G[N+2]=ga.z,J[V]=Math.cos(m.angle),C[V]=m.exponent,V+=1)):m instanceof THREE.HemisphereLight&&
|
|
|
-(Y+=1,m.visible&&(ga.getPositionFromMatrix(m.matrixWorld),ga.normalize(),0===ga.x&&0===ga.y&&0===ga.z||(s=3*ca,S[s]=ga.x,S[s+1]=ga.y,S[s+2]=ga.z,p=m.color,m=m.groundColor,K.gammaInput?(q*=q,B(O,s,p,q),B(R,s,m,q)):(y(O,s,p,q),y(R,s,m,q)),ca+=1))));c=3*X;for(f=Math.max(t.length,3*Ea);c<f;c++)t[c]=0;c=3*T;for(f=Math.max(v.length,3*dc);c<f;c++)v[c]=0;c=3*V;for(f=Math.max(z.length,3*$);c<f;c++)z[c]=0;c=3*ca;for(f=Math.max(O.length,3*Y);c<f;c++)O[c]=0;c=3*ca;for(f=Math.max(R.length,3*Y);c<f;c++)R[c]=0;
|
|
|
-r.directional.length=X;r.point.length=T;r.spot.length=V;r.hemi.length=ca;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;sa=!1}c=Pa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=
|
|
|
+function t(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function x(a,b,c,d,e){P=0;d.needsUpdate&&(d.program&&Gb(d),K.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Aa&&(j.useProgram(g),Aa=g,f=!0);d.id!==za&&(za=d.id,f=!0);if(f||a!==ea)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ea&&(ea=a);if(d.skinning)if(yb&&
|
|
|
+e.useVertexTexture){if(null!==h.boneTexture){var k=G();j.uniform1i(h.boneTexture,k);K.setTexture(e.boneTexture,k)}null!==h.boneTextureWidth&&j.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&j.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&
|
|
|
+(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(sa){for(var m,l=k=0,n=0,p,q,s,r=Pa,t=r.directional.colors,u=r.directional.positions,v=r.point.colors,x=r.point.positions,A=r.point.distances,z=r.spot.colors,D=r.spot.positions,F=r.spot.distances,H=r.spot.directions,J=r.spot.anglesCos,C=r.spot.exponents,O=r.hemi.skyColors,R=r.hemi.groundColors,S=r.hemi.positions,W=0,T=0,aa=0,ya=0,ba=0,dc=0,Z=0,X=0,M=m=0,c=s=M=0,f=b.length;c<
|
|
|
+f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,s=m.distance,m instanceof THREE.AmbientLight?m.visible&&(K.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(ba+=1,m.visible&&(fa.getPositionFromMatrix(m.matrixWorld),qa.getPositionFromMatrix(m.target.matrixWorld),fa.sub(qa),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(m=3*W,u[m]=fa.x,u[m+1]=fa.y,u[m+2]=fa.z,K.gammaInput?B(t,m,p,q*q):y(t,m,p,q),W+=1))):m instanceof THREE.PointLight?(dc+=1,
|
|
|
+m.visible&&(M=3*T,K.gammaInput?B(v,M,p,q*q):y(v,M,p,q),qa.getPositionFromMatrix(m.matrixWorld),x[M]=qa.x,x[M+1]=qa.y,x[M+2]=qa.z,A[T]=s,T+=1)):m instanceof THREE.SpotLight?(Z+=1,m.visible&&(M=3*aa,K.gammaInput?B(z,M,p,q*q):y(z,M,p,q),qa.getPositionFromMatrix(m.matrixWorld),D[M]=qa.x,D[M+1]=qa.y,D[M+2]=qa.z,F[aa]=s,fa.copy(qa),qa.getPositionFromMatrix(m.target.matrixWorld),fa.sub(qa),fa.normalize(),H[M]=fa.x,H[M+1]=fa.y,H[M+2]=fa.z,J[aa]=Math.cos(m.angle),C[aa]=m.exponent,aa+=1)):m instanceof THREE.HemisphereLight&&
|
|
|
+(X+=1,m.visible&&(fa.getPositionFromMatrix(m.matrixWorld),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(s=3*ya,S[s]=fa.x,S[s+1]=fa.y,S[s+2]=fa.z,p=m.color,m=m.groundColor,K.gammaInput?(q*=q,B(O,s,p,q),B(R,s,m,q)):(y(O,s,p,q),y(R,s,m,q)),ya+=1))));c=3*W;for(f=Math.max(t.length,3*ba);c<f;c++)t[c]=0;c=3*T;for(f=Math.max(v.length,3*dc);c<f;c++)v[c]=0;c=3*aa;for(f=Math.max(z.length,3*Z);c<f;c++)z[c]=0;c=3*ya;for(f=Math.max(O.length,3*X);c<f;c++)O[c]=0;c=3*ya;for(f=Math.max(R.length,3*X);c<f;c++)R[c]=0;
|
|
|
+r.directional.length=W;r.point.length=T;r.spot.length=aa;r.hemi.length=ya;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;sa=!1}c=Pa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=
|
|
|
c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):
|
|
|
i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Q;d.map?Q=d.map:d.specularMap?Q=d.specularMap:d.normalMap?Q=d.normalMap:d.bumpMap&&(Q=d.bumpMap);void 0!==Q&&(c=Q.offset,Q=Q.repeat,i.offsetRepeat.value.set(c.x,c.y,Q.x,Q.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
|
1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?
|
|
@@ -398,46 +398,46 @@ i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specular
|
|
|
THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Q]=k.shadowMap,i.shadowMapSize.value[Q]=k.shadowMapSize,i.shadowMatrix.value[Q]=k.shadowMatrix,i.shadowDarkness.value[Q]=k.shadowDarkness,i.shadowBias.value[Q]=k.shadowBias,Q++}b=d.uniformsList;i=0;for(Q=b.length;i<Q;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,
|
|
|
k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=
|
|
|
k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=
|
|
|
-new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=F(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Db),c.image.__webglTextureCube=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
|
|
|
-j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=k,r=l,t=c.image[l],v=ac,t.width<=v&&t.height<=v||(w=Math.max(t.width,t.height),u=Math.floor(t.width*v/w),v=Math.floor(t.height*v/w),w=document.createElement("canvas"),w.width=u,w.height=v,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,v),t=w),n[r]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=M(c.format);t=M(c.type);D(j.TEXTURE_CUBE_MAP,
|
|
|
-c,n);for(l=0;6>l;l++)if(f){v=k[l].mipmaps;w=0;for(A=v.length;w<A;w++)u=v[w],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,r,u.width,u.height,0,r,t,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
-c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=F();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&K.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
+new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=G(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Db),c.image.__webglTextureCube=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
|
|
|
+j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=k,r=l,t=c.image[l],v=ac,t.width<=v&&t.height<=v||(x=Math.max(t.width,t.height),u=Math.floor(t.width*v/x),v=Math.floor(t.height*v/x),x=document.createElement("canvas"),x.width=u,x.height=v,x.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,v),t=x),n[r]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=N(c.format);t=N(c.type);w(j.TEXTURE_CUBE_MAP,
|
|
|
+c,n);for(l=0;6>l;l++)if(f){v=k[l].mipmaps;x=0;for(A=v.length;x<A;x++)u=v[x],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,x,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,x,r,u.width,u.height,0,r,t,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
+c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=G();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&K.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)qa.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,qa.x,qa.y,qa.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);
|
|
|
-null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function F(){var a=P;a>=Mb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Mb);P+=1;return a}function B(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 y(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!==va&&(j.lineWidth(a),va=a)}function x(a,b,c){Ba!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ba=a);
|
|
|
-if(a&&(Ua!==b||Qa!==c))j.polygonOffset(b,c),Ua=b,Qa=c}function G(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function H(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(G(b)),null):c}function D(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,M(b.wrapS)),j.texParameteri(a,
|
|
|
-j.TEXTURE_WRAP_T,M(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,M(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,M(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter)));if(La&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,La.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nb)),b.__oldAnisotropy=
|
|
|
+null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function G(){var a=P;a>=Mb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Mb);P+=1;return a}function B(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 y(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!==va&&(j.lineWidth(a),va=a)}function D(a,b,c){Ca!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ca=a);
|
|
|
+if(a&&(Ua!==b||Qa!==c))j.polygonOffset(b,c),Ua=b,Qa=c}function H(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function F(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(H(b)),null):c}function w(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,N(b.wrapS)),j.texParameteri(a,
|
|
|
+j.TEXTURE_WRAP_T,N(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,N(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,N(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter)));if(La&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,La.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nb)),b.__oldAnisotropy=
|
|
|
b.anisotropy}function J(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}
|
|
|
-function A(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function M(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===
|
|
|
+function A(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function N(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===
|
|
|
THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===
|
|
|
THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;
|
|
|
if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;
|
|
|
-if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Da){if(a===THREE.RGB_S3TC_DXT1_Format)return Da.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Da.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Da.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Da.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},E=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-T=void 0!==a.precision?a.precision:"highp",R=void 0!==a.alpha?a.alpha:!1,Q=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,aa=void 0!==a.antialias?a.antialias:!1,V=void 0!==a.stencil?a.stencil:!0,C=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,S=new THREE.Color(0),Z=0;this.domElement=E;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
+if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Ea){if(a===THREE.RGB_S3TC_DXT1_Format)return Ea.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ea.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},E=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
+T=void 0!==a.precision?a.precision:"highp",R=void 0!==a.alpha?a.alpha:!1,M=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Q=void 0!==a.antialias?a.antialias:!1,ha=void 0!==a.stencil?a.stencil:!0,C=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,S=new THREE.Color(0),Y=0;this.domElement=E;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.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,
|
|
|
-faces:0,points:0}};var K=this,ea=[],Ea=0,za=null,Ga=null,ya=-1,N=null,fa=null,O=0,P=0,ca=-1,X=-1,ka=-1,ra=-1,ia=-1,Ka=-1,Fa=-1,la=-1,Ba=null,Ua=null,Qa=null,va=null,bb=0,cb=0,Ma=E.width,fb=E.height,sb=0,pb=0,ua={},ma=new THREE.Frustum,Ca=new THREE.Matrix4,gb=new THREE.Matrix4,qa=new THREE.Vector3,ga=new THREE.Vector3,sa=!0,Pa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],
|
|
|
-anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Oa,ta,La,Da;try{var Ra={alpha:R,premultipliedAlpha:Q,antialias:aa,stencil:V,preserveDrawingBuffer:C};j=E.getContext("webgl",Ra)||E.getContext("experimental-webgl",Ra);if(null===j)throw"Error creating WebGL context.";}catch(Zb){console.error(Zb)}Oa=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");ta=j.getExtension("OES_standard_derivatives");La=j.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
-j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Da=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Oa||console.log("THREE.WebGLRenderer: Float textures not supported.");ta||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");La||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
-Da||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.viewport(bb,cb,Ma,fb);j.clearColor(S.r,S.g,S.b,
|
|
|
-Z);this.context=j;var Mb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),$b=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var ac=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Nb=La?j.getParameter(La.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Bb=0<$b,yb=Bb&&Oa;Da&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var bc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),cc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);
|
|
|
+faces:0,points:0}};var K=this,da=[],ya=0,Aa=null,Ga=null,za=-1,ba=null,ea=null,O=0,P=0,aa=-1,W=-1,ka=-1,ra=-1,ia=-1,Ka=-1,Fa=-1,la=-1,Ca=null,Ua=null,Qa=null,va=null,bb=0,cb=0,Ma=E.width,fb=E.height,sb=0,pb=0,ua={},ma=new THREE.Frustum,Da=new THREE.Matrix4,gb=new THREE.Matrix4,qa=new THREE.Vector3,fa=new THREE.Vector3,sa=!0,Pa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],
|
|
|
+anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Oa,ta,La,Ea;try{var Ra={alpha:R,premultipliedAlpha:M,antialias:Q,stencil:ha,preserveDrawingBuffer:C};j=E.getContext("webgl",Ra)||E.getContext("experimental-webgl",Ra);if(null===j)throw"Error creating WebGL context.";}catch(Zb){console.error(Zb)}Oa=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");ta=j.getExtension("OES_standard_derivatives");La=j.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
+j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ea=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Oa||console.log("THREE.WebGLRenderer: Float textures not supported.");ta||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");La||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
+Ea||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.viewport(bb,cb,Ma,fb);j.clearColor(S.r,S.g,S.b,
|
|
|
+Y);this.context=j;var Mb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),$b=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var ac=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Nb=La?j.getParameter(La.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Bb=0<$b,yb=Bb&&Oa;Ea&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var bc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),cc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);
|
|
|
var qc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),rc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
|
|
|
j.LOW_INT);var sc=0<bc.precision&&0<qc.precision,Ob=0<cc.precision&&0<rc.precision;"highp"===T&&!sc&&(Ob?(T="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(T="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===T&&!Ob&&(T="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Bb};this.supportsFloatTextures=function(){return Oa};
|
|
|
-this.supportsStandardDerivatives=function(){return ta};this.supportsCompressedTextureS3TC=function(){return Da};this.getMaxAnisotropy=function(){return Nb};this.getPrecision=function(){return T};this.setSize=function(a,b,c){E.width=a*this.devicePixelRatio;E.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(E.style.width=a+"px",E.style.height=b+"px");this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){bb=void 0!==a?a:0;cb=void 0!==b?b:0;Ma=void 0!==c?c:E.width;
|
|
|
-fb=void 0!==d?d:E.height;j.viewport(bb,cb,Ma,fb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){S.set(a);Z=void 0!==b?b:1;j.clearColor(S.r,S.g,S.b,Z)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return S};this.getClearAlpha=function(){return Z};
|
|
|
-this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){za=null;ya=N=la=Fa=ka=-1;sa=!0;X=ca=-1;this.shadowMapPlugin.update(a,b)};
|
|
|
+this.supportsStandardDerivatives=function(){return ta};this.supportsCompressedTextureS3TC=function(){return Ea};this.getMaxAnisotropy=function(){return Nb};this.getPrecision=function(){return T};this.setSize=function(a,b,c){E.width=a*this.devicePixelRatio;E.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(E.style.width=a+"px",E.style.height=b+"px");this.setViewport(0,0,E.width,E.height)};this.setViewport=function(a,b,c,d){bb=void 0!==a?a:0;cb=void 0!==b?b:0;Ma=void 0!==c?c:E.width;
|
|
|
+fb=void 0!==d?d:E.height;j.viewport(bb,cb,Ma,fb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){S.set(a);Y=void 0!==b?b:1;j.clearColor(S.r,S.g,S.b,Y)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return S};this.getClearAlpha=function(){return Y};
|
|
|
+this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Aa=null;za=ba=la=Fa=ka=-1;sa=!0;W=aa=-1;this.shadowMapPlugin.update(a,b)};
|
|
|
var Cb=function(a){a=a.target;a.removeEventListener("dispose",Cb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer);K.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Hb(c)}else Hb(a)},
|
|
|
Db=function(a){a=a.target;a.removeEventListener("dispose",Db);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));K.info.memory.textures--},Eb=function(a){a=a.target;a.removeEventListener("dispose",Eb);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);K.info.memory.textures--},Fb=function(a){a=a.target;a.removeEventListener("dispose",Fb);Gb(a)},Hb=function(a){void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
|
|
|
j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer);
|
|
|
-K.info.memory.geometries--},Gb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=ea.length;a<c;a++)if(d=ea[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ea.length;a<c;a++)d=ea[a],d.program!==b&&e.push(d);ea=e;j.deleteProgram(b);K.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=
|
|
|
+K.info.memory.geometries--},Gb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=da.length;a<c;a++)if(d=da[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=da.length;a<c;a++)d=da[a],d.program!==b&&e.push(d);da=e;j.deleteProgram(b);K.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=
|
|
|
j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
|
|
|
e,f,h,g,i,k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],h=n[p+3],i=n[p+4],l=n[p+5],g=n[p+6],k=n[p+7],m=n[p+8],d=(d+h+g)/3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var i,
|
|
|
-k,l,m;i=w(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==N&&(N=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(f=a.index){e=e.offsets;1<e.length&&(c=!0);for(var n=0,p=e.length;n<p;n++){var q=e[n].index;if(c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,4*q*m)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):
|
|
|
+k,l,m;i=x(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==ba&&(ba=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(f=a.index){e=e.offsets;1<e.length&&(c=!0);for(var n=0,p=e.length;n<p;n++){var q=e[n].index;if(c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,4*q*m)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):
|
|
|
3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,e[n].count,j.UNSIGNED_SHORT,2*e[n].start);K.info.render.calls++;K.info.render.vertices+=e[n].count;K.info.render.faces+=e[n].count/3}}else{if(c)for(k in b)"index"!==k&&(l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&
|
|
|
(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k]))));d=e.attributes.position;j.drawArrays(j.TRIANGLES,0,d.numItems/3);K.info.render.calls++;K.info.render.vertices+=d.numItems/3;K.info.render.faces+=d.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,
|
|
|
m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));d=a.position;j.drawArrays(j.POINTS,0,d.numItems/3);K.info.render.calls++;K.info.render.points+=d.numItems/3}}else if(f instanceof THREE.Line&&c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,
|
|
|
-m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;z(d.linewidth);d=a.position;j.drawArrays(k,0,d.numItems/3);K.info.render.calls++;K.info.render.points+=d.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=w(a,b,c,d,f),
|
|
|
-a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==N&&(N=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;z(d.linewidth);d=a.position;j.drawArrays(k,0,d.numItems/3);K.info.render.calls++;K.info.render.points+=d.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=x(a,b,c,d,f),
|
|
|
+a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ba&&(ba=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglVertexBuffer),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;l=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<l.length;)0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[m]]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[m]]),
|
|
|
h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[l[m]],m++}else{l=[];i=f.morphTargetInfluences;var n,p=i.length;for(n=0;n<p;n++)m=i[n],0<m&&l.push([m,n]);l.length>d.numSupportedMorphTargets?(l.sort(k),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(k):0===l.length&&l.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)l[m]?(n=l[m][1],0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),
|
|
|
h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[n]):f.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){i=
|
|
@@ -446,62 +446,61 @@ d.defaultAttributeValues.color));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__w
|
|
|
0<=a.uv2&&(f.geometry.faceVertexUvs[1]?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv2,d.defaultAttributeValues.uv2));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,
|
|
|
4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(z(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),K.info.render.calls++,
|
|
|
K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,z(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):f instanceof THREE.ParticleSystem&&(j.drawArrays(j.POINTS,0,e.__webglParticleCount),K.info.render.calls++,K.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{var e,f,h,g,k=a.__lights,n=a.fog;ya=-1;sa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ca.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);ma.setFromMatrix(Ca);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
+else{var e,f,h,g,k=a.__lights,n=a.fog;za=-1;sa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Da.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);ma.setFromMatrix(Da);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||ma.intersectsObject(h))){var q=h;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,r=q.buffer,s=void 0,t=s=void 0,t=q.object.material;if(t instanceof THREE.MeshFaceMaterial)s=r.materialIndex,s=t.materials[s],
|
|
|
-s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);else if(s=t)s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(qa.getPositionFromMatrix(h.matrixWorld),qa.applyProjection(Ca),f.z=qa.z))}this.sortObjects&&g.sort(i);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),
|
|
|
-h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,k,n,!0,d),p(a.__webglObjectsImmediate,"",b,k,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),
|
|
|
+s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);else if(s=t)s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(qa.getPositionFromMatrix(h.matrixWorld),qa.applyProjection(Da),f.z=qa.z))}this.sortObjects&&g.sort(i);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),
|
|
|
+h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),D(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,k,n,!0,d),p(a.__webglObjectsImmediate,"",b,k,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),
|
|
|
l(a.__webglObjects,!0,"opaque",b,k,n,!1,d),p(a.__webglObjectsImmediate,"opaque",b,k,n,!1,d),l(a.__webglObjects,!1,"transparent",b,k,n,!0,d),p(a.__webglObjectsImmediate,"transparent",b,k,n,!0,d));m(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,
|
|
|
-c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=w(a,b,c,d,e);N=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,ma):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],
|
|
|
-a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)v(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&v(g,a),s(g,a));var i=g,l=i.geometry,m=void 0,p=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var t=j.DYNAMIC_DRAW,u=!l.dynamic,w=l.attributes,y=void 0,z=void 0;for(y in w)z=w[y],z.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=x(a,b,c,d,e);ba=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,ma):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],
|
|
|
+a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)v(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&v(g,a),s(g,a));var i=g,l=i.geometry,m=void 0,p=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var t=j.DYNAMIC_DRAW,u=!l.dynamic,x=l.attributes,y=void 0,z=void 0;for(y in x)z=x[y],z.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
z.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,z.array,t)):(j.bindBuffer(j.ARRAY_BUFFER,z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,t)),z.needsUpdate=!1),u&&!z.dynamic&&(z.array=null)}else if(i instanceof THREE.Mesh){for(var A=0,B=l.geometryGroupsList.length;A<B;A++)if(m=l.geometryGroupsList[A],r=d(i,m),l.buffersNeedUpdate&&c(m,i),p=r.attributes&&q(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||
|
|
|
-p){var x=m,H=i,D=j.DYNAMIC_DRAW,F=!l.dynamic,E=r;if(x.__inittedArrays){var G=e(E),J=E.vertexColors?E.vertexColors:!1,K=f(E),M=G===THREE.SmoothShading,C=void 0,O=void 0,Q=void 0,N=void 0,R=void 0,S=void 0,X=void 0,V=void 0,T=void 0,ca=void 0,Ea=void 0,P=void 0,$=void 0,Y=void 0,Z=void 0,za=void 0,Ga=void 0,fa=void 0,aa=void 0,ya=void 0,ea=void 0,ia=void 0,ga=void 0,ka=void 0,la=void 0,ma=void 0,ra=void 0,sa=void 0,ta=void 0,Aa=void 0,Ba=void 0,Fa=void 0,Da=void 0,Ka=void 0,Sa=void 0,La=void 0,ua=void 0,
|
|
|
-va=void 0,Qa=void 0,Ra=void 0,db=0,eb=0,Oa=0,Pa=0,Ua=0,hb=0,Ta=0,tb=0,Za=0,pa=0,wa=0,L=0,Na=void 0,ib=x.__vertexArray,bb=x.__uvArray,cb=x.__uv2Array,Ma=x.__normalArray,Va=x.__tangentArray,jb=x.__colorArray,Wa=x.__skinIndexArray,Xa=x.__skinWeightArray,fb=x.__morphTargetsArrays,sb=x.__morphNormalsArrays,pb=x.__webglCustomAttributesList,I=void 0,Pb=x.__faceArray,vb=x.__lineArray,Ha=H.geometry,Bb=Ha.elementsNeedUpdate,yb=Ha.uvsNeedUpdate,Db=Ha.normalsNeedUpdate,Mb=Ha.tangentsNeedUpdate,Nb=Ha.colorsNeedUpdate,
|
|
|
-Ob=Ha.morphTargetsNeedUpdate,ec=Ha.vertices,da=x.faces3,kb=Ha.faces,Cb=Ha.faceVertexUvs[0],Eb=Ha.faceVertexUvs[1],fc=Ha.skinIndices,Qb=Ha.skinWeights,Rb=Ha.morphTargets,Fb=Ha.morphNormals;if(Ha.verticesNeedUpdate){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],P=ec[N.a],$=ec[N.b],Y=ec[N.c],ib[eb]=P.x,ib[eb+1]=P.y,ib[eb+2]=P.z,ib[eb+3]=$.x,ib[eb+4]=$.y,ib[eb+5]=$.z,ib[eb+6]=Y.x,ib[eb+7]=Y.y,ib[eb+8]=Y.z,eb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,D)}if(Ob){Sa=0;
|
|
|
-for(La=Rb.length;Sa<La;Sa++){C=wa=0;for(O=da.length;C<O;C++)Qa=da[C],N=kb[Qa],P=Rb[Sa].vertices[N.a],$=Rb[Sa].vertices[N.b],Y=Rb[Sa].vertices[N.c],ua=fb[Sa],ua[wa]=P.x,ua[wa+1]=P.y,ua[wa+2]=P.z,ua[wa+3]=$.x,ua[wa+4]=$.y,ua[wa+5]=$.z,ua[wa+6]=Y.x,ua[wa+7]=Y.y,ua[wa+8]=Y.z,E.morphNormals&&(M?(Ra=Fb[Sa].vertexNormals[Qa],fa=Ra.a,aa=Ra.b,ya=Ra.c):ya=aa=fa=Fb[Sa].faceNormals[Qa],va=sb[Sa],va[wa]=fa.x,va[wa+1]=fa.y,va[wa+2]=fa.z,va[wa+3]=aa.x,va[wa+4]=aa.y,va[wa+5]=aa.z,va[wa+6]=ya.x,va[wa+7]=ya.y,va[wa+
|
|
|
-8]=ya.z),wa+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Sa]);j.bufferData(j.ARRAY_BUFFER,fb[Sa],D);E.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Sa]),j.bufferData(j.ARRAY_BUFFER,sb[Sa],D))}}if(Qb.length){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],ka=Qb[N.a],la=Qb[N.b],ma=Qb[N.c],Xa[pa]=ka.x,Xa[pa+1]=ka.y,Xa[pa+2]=ka.z,Xa[pa+3]=ka.w,Xa[pa+4]=la.x,Xa[pa+5]=la.y,Xa[pa+6]=la.z,Xa[pa+7]=la.w,Xa[pa+8]=ma.x,Xa[pa+9]=ma.y,Xa[pa+10]=ma.z,Xa[pa+11]=ma.w,ra=fc[N.a],sa=
|
|
|
-fc[N.b],ta=fc[N.c],Wa[pa]=ra.x,Wa[pa+1]=ra.y,Wa[pa+2]=ra.z,Wa[pa+3]=ra.w,Wa[pa+4]=sa.x,Wa[pa+5]=sa.y,Wa[pa+6]=sa.z,Wa[pa+7]=sa.w,Wa[pa+8]=ta.x,Wa[pa+9]=ta.y,Wa[pa+10]=ta.z,Wa[pa+11]=ta.w,pa+=12;0<pa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Wa,D),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Xa,D))}if(Nb&&J){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],X=N.vertexColors,V=N.color,3===X.length&&J===THREE.VertexColors?(ea=X[0],
|
|
|
-ia=X[1],ga=X[2]):ga=ia=ea=V,jb[Za]=ea.r,jb[Za+1]=ea.g,jb[Za+2]=ea.b,jb[Za+3]=ia.r,jb[Za+4]=ia.g,jb[Za+5]=ia.b,jb[Za+6]=ga.r,jb[Za+7]=ga.g,jb[Za+8]=ga.b,Za+=9;0<Za&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,jb,D))}if(Mb&&Ha.hasTangents){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],T=N.vertexTangents,Z=T[0],za=T[1],Ga=T[2],Va[Ta]=Z.x,Va[Ta+1]=Z.y,Va[Ta+2]=Z.z,Va[Ta+3]=Z.w,Va[Ta+4]=za.x,Va[Ta+5]=za.y,Va[Ta+6]=za.z,Va[Ta+7]=za.w,Va[Ta+8]=Ga.x,Va[Ta+9]=Ga.y,Va[Ta+10]=Ga.z,
|
|
|
-Va[Ta+11]=Ga.w,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Va,D)}if(Db&&G){C=0;for(O=da.length;C<O;C++)if(N=kb[da[C]],R=N.vertexNormals,S=N.normal,3===R.length&&M)for(Aa=0;3>Aa;Aa++)Fa=R[Aa],Ma[hb]=Fa.x,Ma[hb+1]=Fa.y,Ma[hb+2]=Fa.z,hb+=3;else for(Aa=0;3>Aa;Aa++)Ma[hb]=S.x,Ma[hb+1]=S.y,Ma[hb+2]=S.z,hb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,D)}if(yb&&Cb&&K){C=0;for(O=da.length;C<O;C++)if(Q=da[C],ca=Cb[Q],void 0!==
|
|
|
-ca)for(Aa=0;3>Aa;Aa++)Da=ca[Aa],bb[Oa]=Da.x,bb[Oa+1]=Da.y,Oa+=2;0<Oa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,bb,D))}if(yb&&Eb&&K){C=0;for(O=da.length;C<O;C++)if(Q=da[C],Ea=Eb[Q],void 0!==Ea)for(Aa=0;3>Aa;Aa++)Ka=Ea[Aa],cb[Pa]=Ka.x,cb[Pa+1]=Ka.y,Pa+=2;0<Pa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,cb,D))}if(Bb){C=0;for(O=da.length;C<O;C++)Pb[Ua]=db,Pb[Ua+1]=db+1,Pb[Ua+2]=db+2,Ua+=3,vb[tb]=db,vb[tb+1]=db+1,vb[tb+2]=db,vb[tb+3]=
|
|
|
-db+2,vb[tb+4]=db+1,vb[tb+5]=db+2,tb+=6,db+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Pb,D);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,vb,D)}if(pb){Aa=0;for(Ba=pb.length;Aa<Ba;Aa++)if(I=pb[Aa],I.__original.needsUpdate){L=0;if(1===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],I.array[L]=I.value[N.a],I.array[L+1]=I.value[N.b],I.array[L+2]=I.value[N.c],
|
|
|
-L+=3}else{if("faces"===I.boundTo){C=0;for(O=da.length;C<O;C++)Na=I.value[da[C]],I.array[L]=Na,I.array[L+1]=Na,I.array[L+2]=Na,L+=3}}else if(2===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],P=I.value[N.a],$=I.value[N.b],Y=I.value[N.c],I.array[L]=P.x,I.array[L+1]=P.y,I.array[L+2]=$.x,I.array[L+3]=$.y,I.array[L+4]=Y.x,I.array[L+5]=Y.y,L+=6}else{if("faces"===I.boundTo){C=0;for(O=da.length;C<O;C++)Y=$=P=Na=I.value[da[C]],I.array[L]=P.x,I.array[L+1]=P.y,
|
|
|
-I.array[L+2]=$.x,I.array[L+3]=$.y,I.array[L+4]=Y.x,I.array[L+5]=Y.y,L+=6}}else if(3===I.size){var oa;oa="c"===I.type?["r","g","b"]:["x","y","z"];if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],P=I.value[N.a],$=I.value[N.b],Y=I.value[N.c],I.array[L]=P[oa[0]],I.array[L+1]=P[oa[1]],I.array[L+2]=P[oa[2]],I.array[L+3]=$[oa[0]],I.array[L+4]=$[oa[1]],I.array[L+5]=$[oa[2]],I.array[L+6]=Y[oa[0]],I.array[L+7]=Y[oa[1]],I.array[L+8]=Y[oa[2]],L+=9}else if("faces"===I.boundTo){C=
|
|
|
-0;for(O=da.length;C<O;C++)Y=$=P=Na=I.value[da[C]],I.array[L]=P[oa[0]],I.array[L+1]=P[oa[1]],I.array[L+2]=P[oa[2]],I.array[L+3]=$[oa[0]],I.array[L+4]=$[oa[1]],I.array[L+5]=$[oa[2]],I.array[L+6]=Y[oa[0]],I.array[L+7]=Y[oa[1]],I.array[L+8]=Y[oa[2]],L+=9}else if("faceVertices"===I.boundTo){C=0;for(O=da.length;C<O;C++)Na=I.value[da[C]],P=Na[0],$=Na[1],Y=Na[2],I.array[L]=P[oa[0]],I.array[L+1]=P[oa[1]],I.array[L+2]=P[oa[2]],I.array[L+3]=$[oa[0]],I.array[L+4]=$[oa[1]],I.array[L+5]=$[oa[2]],I.array[L+6]=Y[oa[0]],
|
|
|
-I.array[L+7]=Y[oa[1]],I.array[L+8]=Y[oa[2]],L+=9}}else if(4===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=da.length;C<O;C++)N=kb[da[C]],P=I.value[N.a],$=I.value[N.b],Y=I.value[N.c],I.array[L]=P.x,I.array[L+1]=P.y,I.array[L+2]=P.z,I.array[L+3]=P.w,I.array[L+4]=$.x,I.array[L+5]=$.y,I.array[L+6]=$.z,I.array[L+7]=$.w,I.array[L+8]=Y.x,I.array[L+9]=Y.y,I.array[L+10]=Y.z,I.array[L+11]=Y.w,L+=12}else if("faces"===I.boundTo){C=0;for(O=da.length;C<O;C++)Y=$=P=Na=I.value[da[C]],I.array[L]=
|
|
|
-P.x,I.array[L+1]=P.y,I.array[L+2]=P.z,I.array[L+3]=P.w,I.array[L+4]=$.x,I.array[L+5]=$.y,I.array[L+6]=$.z,I.array[L+7]=$.w,I.array[L+8]=Y.x,I.array[L+9]=Y.y,I.array[L+10]=Y.z,I.array[L+11]=Y.w,L+=12}else if("faceVertices"===I.boundTo){C=0;for(O=da.length;C<O;C++)Na=I.value[da[C]],P=Na[0],$=Na[1],Y=Na[2],I.array[L]=P.x,I.array[L+1]=P.y,I.array[L+2]=P.z,I.array[L+3]=P.w,I.array[L+4]=$.x,I.array[L+5]=$.y,I.array[L+6]=$.z,I.array[L+7]=$.w,I.array[L+8]=Y.x,I.array[L+9]=Y.y,I.array[L+10]=Y.z,I.array[L+
|
|
|
-11]=Y.w,L+=12}j.bindBuffer(j.ARRAY_BUFFER,I.buffer);j.bufferData(j.ARRAY_BUFFER,I.array,D)}}F&&(delete x.__inittedArrays,delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=
|
|
|
+p){var w=m,D=i,F=j.DYNAMIC_DRAW,G=!l.dynamic,E=r;if(w.__inittedArrays){var H=e(E),J=E.vertexColors?E.vertexColors:!1,K=f(E),N=H===THREE.SmoothShading,C=void 0,O=void 0,Q=void 0,M=void 0,R=void 0,S=void 0,W=void 0,aa=void 0,T=void 0,ya=void 0,ba=void 0,P=void 0,Z=void 0,X=void 0,Y=void 0,Aa=void 0,Ga=void 0,ea=void 0,za=void 0,da=void 0,ia=void 0,fa=void 0,ha=void 0,ka=void 0,la=void 0,ma=void 0,ra=void 0,sa=void 0,ta=void 0,Ba=void 0,Ca=void 0,Fa=void 0,Ea=void 0,Ka=void 0,Sa=void 0,La=void 0,ua=
|
|
|
+void 0,va=void 0,Qa=void 0,Ra=void 0,db=0,eb=0,Oa=0,Pa=0,Ua=0,hb=0,Ta=0,tb=0,Za=0,pa=0,wa=0,L=0,Na=void 0,ib=w.__vertexArray,bb=w.__uvArray,cb=w.__uv2Array,Ma=w.__normalArray,Va=w.__tangentArray,jb=w.__colorArray,Wa=w.__skinIndexArray,Xa=w.__skinWeightArray,fb=w.__morphTargetsArrays,sb=w.__morphNormalsArrays,pb=w.__webglCustomAttributesList,I=void 0,Pb=w.__faceArray,vb=w.__lineArray,Ha=D.geometry,Bb=Ha.elementsNeedUpdate,yb=Ha.uvsNeedUpdate,Db=Ha.normalsNeedUpdate,Mb=Ha.tangentsNeedUpdate,Nb=Ha.colorsNeedUpdate,
|
|
|
+Ob=Ha.morphTargetsNeedUpdate,ec=Ha.vertices,ca=w.faces3,kb=Ha.faces,Cb=Ha.faceVertexUvs[0],Eb=Ha.faceVertexUvs[1],fc=Ha.skinIndices,Qb=Ha.skinWeights,Rb=Ha.morphTargets,Fb=Ha.morphNormals;if(Ha.verticesNeedUpdate){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],P=ec[M.a],Z=ec[M.b],X=ec[M.c],ib[eb]=P.x,ib[eb+1]=P.y,ib[eb+2]=P.z,ib[eb+3]=Z.x,ib[eb+4]=Z.y,ib[eb+5]=Z.z,ib[eb+6]=X.x,ib[eb+7]=X.y,ib[eb+8]=X.z,eb+=9;j.bindBuffer(j.ARRAY_BUFFER,w.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,F)}if(Ob){Sa=0;
|
|
|
+for(La=Rb.length;Sa<La;Sa++){C=wa=0;for(O=ca.length;C<O;C++)Qa=ca[C],M=kb[Qa],P=Rb[Sa].vertices[M.a],Z=Rb[Sa].vertices[M.b],X=Rb[Sa].vertices[M.c],ua=fb[Sa],ua[wa]=P.x,ua[wa+1]=P.y,ua[wa+2]=P.z,ua[wa+3]=Z.x,ua[wa+4]=Z.y,ua[wa+5]=Z.z,ua[wa+6]=X.x,ua[wa+7]=X.y,ua[wa+8]=X.z,E.morphNormals&&(N?(Ra=Fb[Sa].vertexNormals[Qa],ea=Ra.a,za=Ra.b,da=Ra.c):da=za=ea=Fb[Sa].faceNormals[Qa],va=sb[Sa],va[wa]=ea.x,va[wa+1]=ea.y,va[wa+2]=ea.z,va[wa+3]=za.x,va[wa+4]=za.y,va[wa+5]=za.z,va[wa+6]=da.x,va[wa+7]=da.y,va[wa+
|
|
|
+8]=da.z),wa+=9;j.bindBuffer(j.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[Sa]);j.bufferData(j.ARRAY_BUFFER,fb[Sa],F);E.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglMorphNormalsBuffers[Sa]),j.bufferData(j.ARRAY_BUFFER,sb[Sa],F))}}if(Qb.length){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],ka=Qb[M.a],la=Qb[M.b],ma=Qb[M.c],Xa[pa]=ka.x,Xa[pa+1]=ka.y,Xa[pa+2]=ka.z,Xa[pa+3]=ka.w,Xa[pa+4]=la.x,Xa[pa+5]=la.y,Xa[pa+6]=la.z,Xa[pa+7]=la.w,Xa[pa+8]=ma.x,Xa[pa+9]=ma.y,Xa[pa+10]=ma.z,Xa[pa+11]=ma.w,ra=fc[M.a],sa=
|
|
|
+fc[M.b],ta=fc[M.c],Wa[pa]=ra.x,Wa[pa+1]=ra.y,Wa[pa+2]=ra.z,Wa[pa+3]=ra.w,Wa[pa+4]=sa.x,Wa[pa+5]=sa.y,Wa[pa+6]=sa.z,Wa[pa+7]=sa.w,Wa[pa+8]=ta.x,Wa[pa+9]=ta.y,Wa[pa+10]=ta.z,Wa[pa+11]=ta.w,pa+=12;0<pa&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Wa,F),j.bindBuffer(j.ARRAY_BUFFER,w.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Xa,F))}if(Nb&&J){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],W=M.vertexColors,aa=M.color,3===W.length&&J===THREE.VertexColors?(ia=
|
|
|
+W[0],fa=W[1],ha=W[2]):ha=fa=ia=aa,jb[Za]=ia.r,jb[Za+1]=ia.g,jb[Za+2]=ia.b,jb[Za+3]=fa.r,jb[Za+4]=fa.g,jb[Za+5]=fa.b,jb[Za+6]=ha.r,jb[Za+7]=ha.g,jb[Za+8]=ha.b,Za+=9;0<Za&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,jb,F))}if(Mb&&Ha.hasTangents){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],T=M.vertexTangents,Y=T[0],Aa=T[1],Ga=T[2],Va[Ta]=Y.x,Va[Ta+1]=Y.y,Va[Ta+2]=Y.z,Va[Ta+3]=Y.w,Va[Ta+4]=Aa.x,Va[Ta+5]=Aa.y,Va[Ta+6]=Aa.z,Va[Ta+7]=Aa.w,Va[Ta+8]=Ga.x,Va[Ta+9]=Ga.y,Va[Ta+
|
|
|
+10]=Ga.z,Va[Ta+11]=Ga.w,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,w.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Va,F)}if(Db&&H){C=0;for(O=ca.length;C<O;C++)if(M=kb[ca[C]],R=M.vertexNormals,S=M.normal,3===R.length&&N)for(Ba=0;3>Ba;Ba++)Fa=R[Ba],Ma[hb]=Fa.x,Ma[hb+1]=Fa.y,Ma[hb+2]=Fa.z,hb+=3;else for(Ba=0;3>Ba;Ba++)Ma[hb]=S.x,Ma[hb+1]=S.y,Ma[hb+2]=S.z,hb+=3;j.bindBuffer(j.ARRAY_BUFFER,w.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,F)}if(yb&&Cb&&K){C=0;for(O=ca.length;C<O;C++)if(Q=ca[C],ya=Cb[Q],
|
|
|
+void 0!==ya)for(Ba=0;3>Ba;Ba++)Ea=ya[Ba],bb[Oa]=Ea.x,bb[Oa+1]=Ea.y,Oa+=2;0<Oa&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,bb,F))}if(yb&&Eb&&K){C=0;for(O=ca.length;C<O;C++)if(Q=ca[C],ba=Eb[Q],void 0!==ba)for(Ba=0;3>Ba;Ba++)Ka=ba[Ba],cb[Pa]=Ka.x,cb[Pa+1]=Ka.y,Pa+=2;0<Pa&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,cb,F))}if(Bb){C=0;for(O=ca.length;C<O;C++)Pb[Ua]=db,Pb[Ua+1]=db+1,Pb[Ua+2]=db+2,Ua+=3,vb[tb]=db,vb[tb+1]=db+1,vb[tb+2]=db,
|
|
|
+vb[tb+3]=db+2,vb[tb+4]=db+1,vb[tb+5]=db+2,tb+=6,db+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Pb,F);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,vb,F)}if(pb){Ba=0;for(Ca=pb.length;Ba<Ca;Ba++)if(I=pb[Ba],I.__original.needsUpdate){L=0;if(1===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],I.array[L]=I.value[M.a],I.array[L+1]=I.value[M.b],I.array[L+2]=I.value[M.c],
|
|
|
+L+=3}else{if("faces"===I.boundTo){C=0;for(O=ca.length;C<O;C++)Na=I.value[ca[C]],I.array[L]=Na,I.array[L+1]=Na,I.array[L+2]=Na,L+=3}}else if(2===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],P=I.value[M.a],Z=I.value[M.b],X=I.value[M.c],I.array[L]=P.x,I.array[L+1]=P.y,I.array[L+2]=Z.x,I.array[L+3]=Z.y,I.array[L+4]=X.x,I.array[L+5]=X.y,L+=6}else{if("faces"===I.boundTo){C=0;for(O=ca.length;C<O;C++)X=Z=P=Na=I.value[ca[C]],I.array[L]=P.x,I.array[L+1]=P.y,
|
|
|
+I.array[L+2]=Z.x,I.array[L+3]=Z.y,I.array[L+4]=X.x,I.array[L+5]=X.y,L+=6}}else if(3===I.size){var oa;oa="c"===I.type?["r","g","b"]:["x","y","z"];if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],P=I.value[M.a],Z=I.value[M.b],X=I.value[M.c],I.array[L]=P[oa[0]],I.array[L+1]=P[oa[1]],I.array[L+2]=P[oa[2]],I.array[L+3]=Z[oa[0]],I.array[L+4]=Z[oa[1]],I.array[L+5]=Z[oa[2]],I.array[L+6]=X[oa[0]],I.array[L+7]=X[oa[1]],I.array[L+8]=X[oa[2]],L+=9}else if("faces"===I.boundTo){C=
|
|
|
+0;for(O=ca.length;C<O;C++)X=Z=P=Na=I.value[ca[C]],I.array[L]=P[oa[0]],I.array[L+1]=P[oa[1]],I.array[L+2]=P[oa[2]],I.array[L+3]=Z[oa[0]],I.array[L+4]=Z[oa[1]],I.array[L+5]=Z[oa[2]],I.array[L+6]=X[oa[0]],I.array[L+7]=X[oa[1]],I.array[L+8]=X[oa[2]],L+=9}else if("faceVertices"===I.boundTo){C=0;for(O=ca.length;C<O;C++)Na=I.value[ca[C]],P=Na[0],Z=Na[1],X=Na[2],I.array[L]=P[oa[0]],I.array[L+1]=P[oa[1]],I.array[L+2]=P[oa[2]],I.array[L+3]=Z[oa[0]],I.array[L+4]=Z[oa[1]],I.array[L+5]=Z[oa[2]],I.array[L+6]=X[oa[0]],
|
|
|
+I.array[L+7]=X[oa[1]],I.array[L+8]=X[oa[2]],L+=9}}else if(4===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo){C=0;for(O=ca.length;C<O;C++)M=kb[ca[C]],P=I.value[M.a],Z=I.value[M.b],X=I.value[M.c],I.array[L]=P.x,I.array[L+1]=P.y,I.array[L+2]=P.z,I.array[L+3]=P.w,I.array[L+4]=Z.x,I.array[L+5]=Z.y,I.array[L+6]=Z.z,I.array[L+7]=Z.w,I.array[L+8]=X.x,I.array[L+9]=X.y,I.array[L+10]=X.z,I.array[L+11]=X.w,L+=12}else if("faces"===I.boundTo){C=0;for(O=ca.length;C<O;C++)X=Z=P=Na=I.value[ca[C]],I.array[L]=
|
|
|
+P.x,I.array[L+1]=P.y,I.array[L+2]=P.z,I.array[L+3]=P.w,I.array[L+4]=Z.x,I.array[L+5]=Z.y,I.array[L+6]=Z.z,I.array[L+7]=Z.w,I.array[L+8]=X.x,I.array[L+9]=X.y,I.array[L+10]=X.z,I.array[L+11]=X.w,L+=12}else if("faceVertices"===I.boundTo){C=0;for(O=ca.length;C<O;C++)Na=I.value[ca[C]],P=Na[0],Z=Na[1],X=Na[2],I.array[L]=P.x,I.array[L+1]=P.y,I.array[L+2]=P.z,I.array[L+3]=P.w,I.array[L+4]=Z.x,I.array[L+5]=Z.y,I.array[L+6]=Z.z,I.array[L+7]=Z.w,I.array[L+8]=X.x,I.array[L+9]=X.y,I.array[L+10]=X.z,I.array[L+
|
|
|
+11]=X.w,L+=12}j.bindBuffer(j.ARRAY_BUFFER,I.buffer);j.bufferData(j.ARRAY_BUFFER,I.array,F)}}G&&(delete w.__inittedArrays,delete w.__colorArray,delete w.__normalArray,delete w.__tangentArray,delete w.__uvArray,delete w.__uv2Array,delete w.__faceArray,delete w.__vertexArray,delete w.__lineArray,delete w.__skinIndexArray,delete w.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=
|
|
|
!1;l.buffersNeedUpdate=!1;r.attributes&&n(r)}else if(i instanceof THREE.Line){r=d(i,l);p=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||p){var Ya=l,Sb=j.DYNAMIC_DRAW,Ib=void 0,Jb=void 0,Kb=void 0,Tb=void 0,na=void 0,Ub=void 0,Gb=Ya.vertices,Hb=Ya.colors,kc=Ya.lineDistances,Zb=Gb.length,$b=Hb.length,ac=kc.length,Vb=Ya.__vertexArray,Wb=Ya.__colorArray,lc=Ya.__lineDistanceArray,bc=Ya.colorsNeedUpdate,cc=Ya.lineDistancesNeedUpdate,gc=Ya.__webglCustomAttributesList,
|
|
|
Xb=void 0,mc=void 0,xa=void 0,zb=void 0,Ia=void 0,ja=void 0;if(Ya.verticesNeedUpdate){for(Ib=0;Ib<Zb;Ib++)Tb=Gb[Ib],na=3*Ib,Vb[na]=Tb.x,Vb[na+1]=Tb.y,Vb[na+2]=Tb.z;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Vb,Sb)}if(bc){for(Jb=0;Jb<$b;Jb++)Ub=Hb[Jb],na=3*Jb,Wb[na]=Ub.r,Wb[na+1]=Ub.g,Wb[na+2]=Ub.b;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Wb,Sb)}if(cc){for(Kb=0;Kb<ac;Kb++)lc[Kb]=kc[Kb];j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglLineDistanceBuffer);
|
|
|
j.bufferData(j.ARRAY_BUFFER,lc,Sb)}if(gc){Xb=0;for(mc=gc.length;Xb<mc;Xb++)if(ja=gc[Xb],ja.needsUpdate&&(void 0===ja.boundTo||"vertices"===ja.boundTo)){na=0;zb=ja.value.length;if(1===ja.size)for(xa=0;xa<zb;xa++)ja.array[xa]=ja.value[xa];else if(2===ja.size)for(xa=0;xa<zb;xa++)Ia=ja.value[xa],ja.array[na]=Ia.x,ja.array[na+1]=Ia.y,na+=2;else if(3===ja.size)if("c"===ja.type)for(xa=0;xa<zb;xa++)Ia=ja.value[xa],ja.array[na]=Ia.r,ja.array[na+1]=Ia.g,ja.array[na+2]=Ia.b,na+=3;else for(xa=0;xa<zb;xa++)Ia=
|
|
|
ja.value[xa],ja.array[na]=Ia.x,ja.array[na+1]=Ia.y,ja.array[na+2]=Ia.z,na+=3;else if(4===ja.size)for(xa=0;xa<zb;xa++)Ia=ja.value[xa],ja.array[na]=Ia.x,ja.array[na+1]=Ia.y,ja.array[na+2]=Ia.z,ja.array[na+3]=Ia.w,na+=4;j.bindBuffer(j.ARRAY_BUFFER,ja.buffer);j.bufferData(j.ARRAY_BUFFER,ja.array,Sb)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&n(r)}else if(i instanceof THREE.ParticleSystem){r=d(i,l);p=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||
|
|
|
-i.sortParticles||p){var lb=l,hc=j.DYNAMIC_DRAW,Lb=i,Ja=void 0,mb=void 0,nb=void 0,W=void 0,ob=void 0,ub=void 0,Yb=lb.vertices,ic=Yb.length,jc=lb.colors,nc=jc.length,wb=lb.__vertexArray,xb=lb.__colorArray,qb=lb.__sortArray,oc=lb.verticesNeedUpdate,pc=lb.colorsNeedUpdate,rb=lb.__webglCustomAttributesList,$a=void 0,Ab=void 0,ba=void 0,ab=void 0,ha=void 0,U=void 0;if(Lb.sortParticles){gb.copy(Ca);gb.multiply(Lb.matrixWorld);for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],qa.copy(nb),qa.applyProjection(gb),qb[Ja]=[qa.z,
|
|
|
-Ja];qb.sort(k);for(Ja=0;Ja<ic;Ja++)nb=Yb[qb[Ja][1]],W=3*Ja,wb[W]=nb.x,wb[W+1]=nb.y,wb[W+2]=nb.z;for(mb=0;mb<nc;mb++)W=3*mb,ub=jc[qb[mb][1]],xb[W]=ub.r,xb[W+1]=ub.g,xb[W+2]=ub.b;if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(U=rb[$a],void 0===U.boundTo||"vertices"===U.boundTo)if(W=0,ab=U.value.length,1===U.size)for(ba=0;ba<ab;ba++)ob=qb[ba][1],U.array[ba]=U.value[ob];else if(2===U.size)for(ba=0;ba<ab;ba++)ob=qb[ba][1],ha=U.value[ob],U.array[W]=ha.x,U.array[W+1]=ha.y,W+=2;else if(3===U.size)if("c"===U.type)for(ba=
|
|
|
-0;ba<ab;ba++)ob=qb[ba][1],ha=U.value[ob],U.array[W]=ha.r,U.array[W+1]=ha.g,U.array[W+2]=ha.b,W+=3;else for(ba=0;ba<ab;ba++)ob=qb[ba][1],ha=U.value[ob],U.array[W]=ha.x,U.array[W+1]=ha.y,U.array[W+2]=ha.z,W+=3;else if(4===U.size)for(ba=0;ba<ab;ba++)ob=qb[ba][1],ha=U.value[ob],U.array[W]=ha.x,U.array[W+1]=ha.y,U.array[W+2]=ha.z,U.array[W+3]=ha.w,W+=4}}else{if(oc)for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],W=3*Ja,wb[W]=nb.x,wb[W+1]=nb.y,wb[W+2]=nb.z;if(pc)for(mb=0;mb<nc;mb++)ub=jc[mb],W=3*mb,xb[W]=ub.r,xb[W+1]=ub.g,
|
|
|
-xb[W+2]=ub.b;if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(U=rb[$a],U.needsUpdate&&(void 0===U.boundTo||"vertices"===U.boundTo))if(ab=U.value.length,W=0,1===U.size)for(ba=0;ba<ab;ba++)U.array[ba]=U.value[ba];else if(2===U.size)for(ba=0;ba<ab;ba++)ha=U.value[ba],U.array[W]=ha.x,U.array[W+1]=ha.y,W+=2;else if(3===U.size)if("c"===U.type)for(ba=0;ba<ab;ba++)ha=U.value[ba],U.array[W]=ha.r,U.array[W+1]=ha.g,U.array[W+2]=ha.b,W+=3;else for(ba=0;ba<ab;ba++)ha=U.value[ba],U.array[W]=ha.x,U.array[W+1]=ha.y,U.array[W+
|
|
|
-2]=ha.z,W+=3;else if(4===U.size)for(ba=0;ba<ab;ba++)ha=U.value[ba],U.array[W]=ha.x,U.array[W+1]=ha.y,U.array[W+2]=ha.z,U.array[W+3]=ha.w,W+=4}}if(oc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,wb,hc);if(pc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xb,hc);if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(U=rb[$a],U.needsUpdate||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,U.buffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-U.array,hc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;r.attributes&&n(r)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Fb);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?
|
|
|
-n="dashed":a instanceof THREE.ParticleSystemMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0,s=p=0;for(f=b.length;s<f;s++)h=b[s],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&p++);f=q;h=r;g=p;r=p=0;for(q=b.length;r<q;r++)s=b[r],s.castShadow&&(s instanceof
|
|
|
-THREE.SpotLight&&p++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&p++);m=p;yb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,
|
|
|
-envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:m,
|
|
|
-shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},d=a.index0AttributeName,t,u,v;e=[];n?e.push(n):(e.push(r),e.push(q));for(u in s)e.push(u),e.push(s[u]);for(t in c)e.push(t),e.push(c[t]);n=e.join();t=0;for(u=ea.length;t<u;t++)if(e=ea[t],
|
|
|
-e.code===n){e.usedTimes++;k=e.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in s)e=s[v],!1!==e&&(e="#define "+v+" "+e,u.push(e));e=u.join("\n");v=j.createProgram();u=["precision "+T+" float;","precision "+T+" int;",e,Bb?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
-"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?
|
|
|
-"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?
|
|
|
-"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+i.sortParticles||p){var lb=l,hc=j.DYNAMIC_DRAW,Lb=i,Ja=void 0,mb=void 0,nb=void 0,V=void 0,ob=void 0,ub=void 0,Yb=lb.vertices,ic=Yb.length,jc=lb.colors,nc=jc.length,wb=lb.__vertexArray,xb=lb.__colorArray,qb=lb.__sortArray,oc=lb.verticesNeedUpdate,pc=lb.colorsNeedUpdate,rb=lb.__webglCustomAttributesList,$a=void 0,Ab=void 0,$=void 0,ab=void 0,ga=void 0,U=void 0;if(Lb.sortParticles){gb.copy(Da);gb.multiply(Lb.matrixWorld);for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],qa.copy(nb),qa.applyProjection(gb),qb[Ja]=[qa.z,
|
|
|
+Ja];qb.sort(k);for(Ja=0;Ja<ic;Ja++)nb=Yb[qb[Ja][1]],V=3*Ja,wb[V]=nb.x,wb[V+1]=nb.y,wb[V+2]=nb.z;for(mb=0;mb<nc;mb++)V=3*mb,ub=jc[qb[mb][1]],xb[V]=ub.r,xb[V+1]=ub.g,xb[V+2]=ub.b;if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(U=rb[$a],void 0===U.boundTo||"vertices"===U.boundTo)if(V=0,ab=U.value.length,1===U.size)for($=0;$<ab;$++)ob=qb[$][1],U.array[$]=U.value[ob];else if(2===U.size)for($=0;$<ab;$++)ob=qb[$][1],ga=U.value[ob],U.array[V]=ga.x,U.array[V+1]=ga.y,V+=2;else if(3===U.size)if("c"===U.type)for($=
|
|
|
+0;$<ab;$++)ob=qb[$][1],ga=U.value[ob],U.array[V]=ga.r,U.array[V+1]=ga.g,U.array[V+2]=ga.b,V+=3;else for($=0;$<ab;$++)ob=qb[$][1],ga=U.value[ob],U.array[V]=ga.x,U.array[V+1]=ga.y,U.array[V+2]=ga.z,V+=3;else if(4===U.size)for($=0;$<ab;$++)ob=qb[$][1],ga=U.value[ob],U.array[V]=ga.x,U.array[V+1]=ga.y,U.array[V+2]=ga.z,U.array[V+3]=ga.w,V+=4}}else{if(oc)for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],V=3*Ja,wb[V]=nb.x,wb[V+1]=nb.y,wb[V+2]=nb.z;if(pc)for(mb=0;mb<nc;mb++)ub=jc[mb],V=3*mb,xb[V]=ub.r,xb[V+1]=ub.g,xb[V+2]=ub.b;
|
|
|
+if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(U=rb[$a],U.needsUpdate&&(void 0===U.boundTo||"vertices"===U.boundTo))if(ab=U.value.length,V=0,1===U.size)for($=0;$<ab;$++)U.array[$]=U.value[$];else if(2===U.size)for($=0;$<ab;$++)ga=U.value[$],U.array[V]=ga.x,U.array[V+1]=ga.y,V+=2;else if(3===U.size)if("c"===U.type)for($=0;$<ab;$++)ga=U.value[$],U.array[V]=ga.r,U.array[V+1]=ga.g,U.array[V+2]=ga.b,V+=3;else for($=0;$<ab;$++)ga=U.value[$],U.array[V]=ga.x,U.array[V+1]=ga.y,U.array[V+2]=ga.z,V+=3;else if(4===
|
|
|
+U.size)for($=0;$<ab;$++)ga=U.value[$],U.array[V]=ga.x,U.array[V+1]=ga.y,U.array[V+2]=ga.z,U.array[V+3]=ga.w,V+=4}}if(oc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,wb,hc);if(pc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xb,hc);if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(U=rb[$a],U.needsUpdate||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,U.buffer),j.bufferData(j.ARRAY_BUFFER,U.array,hc)}}l.verticesNeedUpdate=
|
|
|
+!1;l.colorsNeedUpdate=!1;r.attributes&&n(r)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Fb);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleSystemMaterial&&
|
|
|
+(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0,s=p=0;for(f=b.length;s<f;s++)h=b[s],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&p++);f=q;h=r;g=p;r=p=0;for(q=b.length;r<q;r++)s=b[r],s.castShadow&&(s instanceof THREE.SpotLight&&p++,s instanceof THREE.DirectionalLight&&
|
|
|
+!s.shadowCascade&&p++);m=p;yb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,
|
|
|
+normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,
|
|
|
+shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},d=a.index0AttributeName,t,u,v;e=[];n?e.push(n):(e.push(r),e.push(q));for(u in s)e.push(u),e.push(s[u]);for(t in c)e.push(t),e.push(c[t]);n=e.join();t=0;for(u=da.length;t<u;t++)if(e=da[t],e.code===n){e.usedTimes++;k=e.program;break a}t="SHADOWMAP_TYPE_BASIC";
|
|
|
+c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in s)e=s[v],!1!==e&&(e="#define "+v+" "+e,u.push(e));e=u.join("\n");v=j.createProgram();u=["precision "+T+" float;","precision "+T+" int;",e,Bb?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
|
|
+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":
|
|
|
+"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
t=["precision "+T+" float;","precision "+T+" 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:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=H("vertex",u+q);t=H("fragment",t+r);j.attachShader(v,u);j.attachShader(v,t);d&&j.bindAttribLocation(v,0,d);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=F("vertex",u+q);t=F("fragment",t+r);j.attachShader(v,u);j.attachShader(v,t);d&&j.bindAttribLocation(v,0,d);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,
|
|
|
j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]"),console.error("Program Info Log: "+j.getProgramInfoLog(v)));j.deleteShader(t);j.deleteShader(u);v.uniforms={};v.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(t.push("boneTexture"),t.push("boneTextureWidth"),t.push("boneTextureHeight")):t.push("boneGlobalMatrices");for(w in p)t.push(w);w=t;t=0;for(u=w.length;t<u;t++)p=w[t],v.uniforms[p]=
|
|
|
-j.getUniformLocation(v,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],v.attributes[t]=j.getAttribLocation(v,t);v.id=Ea++;ea.push({program:v,code:n,usedTimes:1});K.info.memory.programs=ea.length;k=v}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";
|
|
|
+j.getUniformLocation(v,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],v.attributes[t]=j.getAttribLocation(v,t);v.id=ya++;da.push({program:v,code:n,usedTimes:1});K.info.memory.programs=da.length;k=v}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";
|
|
|
for(k=0;k<this.maxMorphTargets;k++)v=b+k,0<=w[v]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)v=b+k,0<=w[v]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?
|
|
|
-j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;ca!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ca=b);X!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),X=a)};this.setDepthTest=function(a){Fa!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Fa=a)};this.setDepthWrite=function(a){la!==a&&(j.depthMask(a),la=a)};this.setBlending=function(a,b,c,d){a!==ka&&(a===THREE.NoBlending?
|
|
|
+j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;aa!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),aa=b);W!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),W=a)};this.setDepthTest=function(a){Fa!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Fa=a)};this.setDepthWrite=function(a){la!==a&&(j.depthMask(a),la=a)};this.setBlending=function(a,b,c,d){a!==ka&&(a===THREE.NoBlending?
|
|
|
j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,
|
|
|
-j.ONE,j.ONE_MINUS_SRC_ALPHA)),ka=a);if(a===THREE.CustomBlending){if(b!==ra&&(j.blendEquation(M(b)),ra=b),c!==ia||d!==Ka)j.blendFunc(M(c),M(d)),ia=c,Ka=d}else Ka=ia=ra=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Db),a.__webglTexture=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
|
|
|
-a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=M(a.format),f=M(a.type);D(j.TEXTURE_2D,a,d);var h=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<h.length&&d){for(var g=0,i=h.length;g<i;g++)c=h[g],j.texImage2D(j.TEXTURE_2D,g,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){g=0;for(i=h.length;g<
|
|
|
+j.ONE,j.ONE_MINUS_SRC_ALPHA)),ka=a);if(a===THREE.CustomBlending){if(b!==ra&&(j.blendEquation(N(b)),ra=b),c!==ia||d!==Ka)j.blendFunc(N(c),N(d)),ia=c,Ka=d}else Ka=ia=ra=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Db),a.__webglTexture=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,
|
|
|
+a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=N(a.format),f=N(a.type);w(j.TEXTURE_2D,a,d);var h=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<h.length&&d){for(var g=0,i=h.length;g<i;g++)c=h[g],j.texImage2D(j.TEXTURE_2D,g,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){g=0;for(i=h.length;g<
|
|
|
i;g++)c=h[g],a.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_2D,g,e,c.width,c.height,0,c.data):j.texImage2D(j.TEXTURE_2D,g,e,c.width,c.height,0,e,f,c.data)}else if(0<h.length&&d){g=0;for(i=h.length;g<i;g++)c=h[g],j.texImage2D(j.TEXTURE_2D,g,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};
|
|
|
-this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Eb);a.__webglTexture=j.createTexture();K.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=M(a.format),e=M(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);D(j.TEXTURE_CUBE_MAP,
|
|
|
+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",Eb);a.__webglTexture=j.createTexture();K.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=N(a.format),e=N(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,
|
|
|
a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,h.__webglTexture,0);J(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=
|
|
|
-a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),D(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&
|
|
|
+a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&
|
|
|
a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):J(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Ma,a=fb,d=bb,e=cb);b!==Ga&&(j.bindFramebuffer(j.FRAMEBUFFER,b),
|
|
|
j.viewport(d,e,c,a),Ga=b);sb=c;pb=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};
|
|
@@ -519,7 +518,7 @@ e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.
|
|
|
b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;var h=new XMLHttpRequest;h.onload=function(){var a=THREE.ImageUtils.parseDDS(h.response,!0);if(a.isCubemap)for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var m=0;m<a.mipmapCount;m++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+m]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}else f.image.width=a.width,f.image.height=a.height,
|
|
|
f.mipmaps=a.mipmaps;f.format=a.format;f.needsUpdate=!0;c&&c(f)};h.onerror=d;h.open("GET",a,!0);h.responseType="arraybuffer";h.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&
|
|
|
4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),d;var i=g[21],k=!1;switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:if(32==g[22]&&g[23]&16711680&&g[24]&65280&&g[25]&255&&g[26]&4278190080)k=!0,e=64,d.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&
|
|
|
-255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,m=0;m<i;m++){for(var l=0;l<d.mipmapCount;l++){if(k){var p;p=f;for(var s=h,r=4*p*s,q=new Uint8Array(a,g,r),r=new Uint8Array(r),n=0,v=0,u=0;u<s;u++)for(var t=0;t<p;t++){var w=q[v];v++;var F=q[v];v++;var B=q[v];v++;var y=q[v];v++;r[n]=B;n++;r[n]=F;n++;r[n]=w;n++;r[n]=y;n++}p=r;s=p.length}else s=
|
|
|
+255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,m=0;m<i;m++){for(var l=0;l<d.mipmapCount;l++){if(k){var p;p=f;for(var s=h,r=4*p*s,q=new Uint8Array(a,g,r),r=new Uint8Array(r),n=0,v=0,u=0;u<s;u++)for(var t=0;t<p;t++){var x=q[v];v++;var G=q[v];v++;var B=q[v];v++;var y=q[v];v++;r[n]=B;n++;r[n]=G;n++;r[n]=x;n++;r[n]=y;n++}p=r;s=p.length}else s=
|
|
|
Math.max(4,f)/4*Math.max(4,h)/4*e,p=new Uint8Array(a,g,s);d.mipmaps.push({data:p,width:f,height:h});g+=s;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,0,d,e).data,i=h.createImageData(d,e),k=i.data,m=0;m<
|
|
|
d;m++)for(var l=0;l<e;l++){var p=0>l-1?0:l-1,s=l+1>e-1?e-1:l+1,r=0>m-1?0:m-1,q=m+1>d-1?d-1:m+1,n=[],v=[0,0,g[4*(l*d+m)]/255*b];n.push([-1,0,g[4*(l*d+r)]/255*b]);n.push([-1,-1,g[4*(p*d+r)]/255*b]);n.push([0,-1,g[4*(p*d+m)]/255*b]);n.push([1,-1,g[4*(p*d+q)]/255*b]);n.push([1,0,g[4*(l*d+q)]/255*b]);n.push([1,1,g[4*(s*d+q)]/255*b]);n.push([0,1,g[4*(s*d+m)]/255*b]);n.push([-1,1,g[4*(s*d+r)]/255*b]);p=[];r=n.length;for(s=0;s<r;s++){var q=n[s],u=n[(s+1)%r],q=[q[0]-v[0],q[1]-v[1],q[2]-v[2]],u=[u[0]-v[0],
|
|
|
u[1]-v[1],u[2]-v[2]];p.push(c([q[1]*u[2]-q[2]*u[1],q[2]*u[0]-q[0]*u[2],q[0]*u[1]-q[1]*u[0]]))}n=[0,0,0];for(s=0;s<p.length;s++)n[0]+=p[s][0],n[1]+=p[s][1],n[2]+=p[s][2];n[0]/=p.length;n[1]/=p.length;n[2]/=p.length;v=4*(l*d+m);k[v]=255*((n[0]+1)/2)|0;k[v+1]=255*((n[1]+1)/2)|0;k[v+2]=255*n[2]|0;k[v+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+
|
|
@@ -527,8 +526,8 @@ u[1]-v[1],u[2]-v[2]];p.push(c([q[1]*u[2]-q[2]*u[1],q[2]*u[0]-q[0]*u[2],q[0]*u[1]
|
|
|
0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,k,m,l,p,s,r,q,n,v=b.glyphs[a]||b.glyphs["?"];if(v){if(v.o){b=v._cachedOutline||(v._cachedOutline=v.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
|
|
|
c+d;m=b[a++]*c;s=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(s,r,i,m);if(h=f[f.length-1]){l=h.x;p=h.y;h=1;for(g=this.divisions;h<=g;h++){var u=h/g;THREE.Shape.Utils.b2(u,l,s,i);THREE.Shape.Utils.b2(u,p,r,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,s=b[a++]*c+d,r=b[a++]*-c,q=b[a++]*c+d,n=b[a++]*-c,e.bezierCurveTo(i,m,s,r,q,n),h=f[f.length-1]){l=h.x;p=h.y;h=1;for(g=this.divisions;h<=g;h++)u=h/g,THREE.Shape.Utils.b3(u,l,s,q,i),THREE.Shape.Utils.b3(u,p,r,n,m)}}}return{offset:v.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,m;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var l=2*e;for(k=e-1;2<e;){if(0>=l--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var p;a:{var s=p=void 0,r=void 0,q=void 0,n=void 0,v=void 0,u=void 0,t=void 0,w=
|
|
|
-void 0,s=a[h[i]].x,r=a[h[i]].y,q=a[h[k]].x,n=a[h[k]].y,v=a[h[m]].x,u=a[h[m]].y;if(1E-10>(q-s)*(u-r)-(n-r)*(v-s))p=!1;else{var F=void 0,B=void 0,y=void 0,z=void 0,x=void 0,G=void 0,H=void 0,D=void 0,J=void 0,A=void 0,J=D=H=w=t=void 0,F=v-q,B=u-n,y=s-v,z=r-u,x=q-s,G=n-r;for(p=0;p<e;p++)if(!(p===i||p===k||p===m))if(t=a[h[p]].x,w=a[h[p]].y,H=t-s,D=w-r,J=t-q,A=w-n,t-=v,w-=u,J=F*A-B*J,H=x*D-G*H,D=y*w-z*t,-1E-10<=J&&-1E-10<=D&&-1E-10<=H){p=!1;break a}p=!0}}if(p){f.push([a[h[i]],a[h[k]],a[h[m]]]);g.push([h[i],
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,m;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var l=2*e;for(k=e-1;2<e;){if(0>=l--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var p;a:{var s=p=void 0,r=void 0,q=void 0,n=void 0,v=void 0,u=void 0,t=void 0,x=
|
|
|
+void 0,s=a[h[i]].x,r=a[h[i]].y,q=a[h[k]].x,n=a[h[k]].y,v=a[h[m]].x,u=a[h[m]].y;if(1E-10>(q-s)*(u-r)-(n-r)*(v-s))p=!1;else{var G=void 0,B=void 0,y=void 0,z=void 0,D=void 0,H=void 0,F=void 0,w=void 0,J=void 0,A=void 0,J=w=F=x=t=void 0,G=v-q,B=u-n,y=s-v,z=r-u,D=q-s,H=n-r;for(p=0;p<e;p++)if(!(p===i||p===k||p===m))if(t=a[h[p]].x,x=a[h[p]].y,F=t-s,w=x-r,J=t-q,A=x-n,t-=v,x-=u,J=G*A-B*J,F=D*w-H*F,w=y*x-z*t,-1E-10<=J&&-1E-10<=w&&-1E-10<=F){p=!1;break a}p=!0}}if(p){f.push([a[h[i]],a[h[k]],a[h[m]]]);g.push([h[i],
|
|
|
h[k],h[m]]);i=k;for(m=k+1;m<e;i++,m++)h[i]=h[m];e--;l=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -596,21 +595,21 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
|
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a=a||50;this.segments=b=void 0!==b?Math.max(3,b):8;this.thetaStart=c=void 0!==c?c:0;this.thetaLength=d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,
|
|
|
-e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),h.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,q){var n,v=g.widthSegments,u=g.heightSegments,t=e/2,w=f/2,F=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",u=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",v=g.depthSegments;var B=v+1,y=u+1,z=e/v,x=f/u,G=new THREE.Vector3;G[n]=0<h?1:-1;for(e=0;e<y;e++)for(f=0;f<B;f++){var H=new THREE.Vector3;H[a]=(f*z-t)*c;H[b]=(e*x-w)*d;H[n]=h;g.vertices.push(H)}for(e=
|
|
|
-0;e<u;e++)for(f=0;f<v;f++)w=f+B*e,a=f+B*(e+1),b=f+1+B*(e+1),c=f+1+B*e,d=new THREE.Vector2(f/v,1-e/u),h=new THREE.Vector2(f/v,1-(e+1)/u),n=new THREE.Vector2((f+1)/v,1-(e+1)/u),t=new THREE.Vector2((f+1)/v,1-e/u),w=new THREE.Face3(w+F,a+F,c+F),w.normal.copy(G),w.vertexNormals.push(G.clone(),G.clone(),G.clone()),w.materialIndex=q,g.faces.push(w),g.faceVertexUvs[0].push([d,h,t]),w=new THREE.Face3(a+F,b+F,c+F),w.normal.copy(G),w.vertexNormals.push(G.clone(),G.clone(),G.clone()),w.materialIndex=q,g.faces.push(w),
|
|
|
+e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),h.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,q){var n,v=g.widthSegments,u=g.heightSegments,t=e/2,x=f/2,G=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",u=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",v=g.depthSegments;var B=v+1,y=u+1,z=e/v,D=f/u,H=new THREE.Vector3;H[n]=0<h?1:-1;for(e=0;e<y;e++)for(f=0;f<B;f++){var F=new THREE.Vector3;F[a]=(f*z-t)*c;F[b]=(e*D-x)*d;F[n]=h;g.vertices.push(F)}for(e=
|
|
|
+0;e<u;e++)for(f=0;f<v;f++)x=f+B*e,a=f+B*(e+1),b=f+1+B*(e+1),c=f+1+B*e,d=new THREE.Vector2(f/v,1-e/u),h=new THREE.Vector2(f/v,1-(e+1)/u),n=new THREE.Vector2((f+1)/v,1-(e+1)/u),t=new THREE.Vector2((f+1)/v,1-e/u),x=new THREE.Face3(x+G,a+G,c+G),x.normal.copy(H),x.vertexNormals.push(H.clone(),H.clone(),H.clone()),x.materialIndex=q,g.faces.push(x),g.faceVertexUvs[0].push([d,h,t]),x=new THREE.Face3(a+G,b+G,c+G),x.normal.copy(H),x.vertexNormals.push(H.clone(),H.clone(),H.clone()),x.materialIndex=q,g.faces.push(x),
|
|
|
g.faceVertexUvs[0].push([h.clone(),n,t.clone()])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/2;b=this.height/2;c=this.depth/2;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("x","y",-1,-1,this.width,this.height,-c,
|
|
|
5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],m=[];for(i=0;i<=e;i++){var l=[],p=[],s=i/e,r=s*(b-a)+a;for(g=0;g<=d;g++){var q=g/d,n=new THREE.Vector3;n.x=r*Math.sin(2*q*Math.PI);n.y=-s*c+h;n.z=r*Math.cos(2*q*Math.PI);this.vertices.push(n);l.push(this.vertices.length-1);p.push(new THREE.Vector2(q,
|
|
|
-1-s))}k.push(l);m.push(p)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(l=this.vertices[k[0][g]].clone(),p=this.vertices[k[0][g+1]].clone()):(l=this.vertices[k[1][g]].clone(),p=this.vertices[k[1][g+1]].clone());l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][g],r=k[i+1][g],q=k[i+1][g+1],n=k[i][g+1],v=l.clone(),u=l.clone(),t=p.clone(),w=p.clone(),F=m[i][g].clone(),B=m[i+1][g].clone(),y=m[i+1][g+1].clone(),z=m[i][g+1].clone();this.faces.push(new THREE.Face3(s,
|
|
|
-r,n,[v,u,w]));this.faceVertexUvs[0].push([F,B,z]);this.faces.push(new THREE.Face3(r,q,n,[u.clone(),t,w.clone()]));this.faceVertexUvs[0].push([B.clone(),y,z.clone()])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)s=k[0][g],r=k[0][g+1],q=this.vertices.length-1,v=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),F=m[0][g].clone(),B=m[0][g+1].clone(),y=new THREE.Vector2(B.x,0),this.faces.push(new THREE.Face3(s,r,q,[v,u,t])),this.faceVertexUvs[0].push([F,
|
|
|
-B,y])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)s=k[i][g+1],r=k[i][g],q=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,-1,0),F=m[i][g+1].clone(),B=m[i][g].clone(),y=new THREE.Vector2(B.x,1),this.faces.push(new THREE.Face3(s,r,q,[v,u,t])),this.faceVertexUvs[0].push([F,B,y])}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-s))}k.push(l);m.push(p)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(l=this.vertices[k[0][g]].clone(),p=this.vertices[k[0][g+1]].clone()):(l=this.vertices[k[1][g]].clone(),p=this.vertices[k[1][g+1]].clone());l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][g],r=k[i+1][g],q=k[i+1][g+1],n=k[i][g+1],v=l.clone(),u=l.clone(),t=p.clone(),x=p.clone(),G=m[i][g].clone(),B=m[i+1][g].clone(),y=m[i+1][g+1].clone(),z=m[i][g+1].clone();this.faces.push(new THREE.Face3(s,
|
|
|
+r,n,[v,u,x]));this.faceVertexUvs[0].push([G,B,z]);this.faces.push(new THREE.Face3(r,q,n,[u.clone(),t,x.clone()]));this.faceVertexUvs[0].push([B.clone(),y,z.clone()])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)s=k[0][g],r=k[0][g+1],q=this.vertices.length-1,v=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),G=m[0][g].clone(),B=m[0][g+1].clone(),y=new THREE.Vector2(B.x,0),this.faces.push(new THREE.Face3(s,r,q,[v,u,t])),this.faceVertexUvs[0].push([G,
|
|
|
+B,y])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)s=k[i][g+1],r=k[i][g],q=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,-1,0),G=m[i][g+1].clone(),B=m[i][g].clone(),y=new THREE.Vector2(B.x,1),this.faces.push(new THREE.Face3(s,r,q,[v,u,t])),this.faceVertexUvs[0].push([G,B,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
|
h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(C=c.length;0<=--C;){e=C;f=C-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*m,
|
|
|
-g=0;g<h;g++){var i=Q*g,k=Q*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,v=e,w=f,l=l+D,i=i+D,n=n+D,k=k+D;H.faces.push(new THREE.Face3(l,i,k,null,null,u));H.faces.push(new THREE.Face3(i,n,k,null,null,u));l=t.generateSideWallUV(H,a,p,b,l,i,n,k,q,r,v,w);H.faceVertexUvs[0].push([l[0],l[1],l[3]]);H.faceVertexUvs[0].push([l[1],l[2],l[3]])}}}function f(a,b,c){H.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=D;d+=D;e+=D;H.faces.push(new THREE.Face3(c,d,e,null,null,v));c=f?t.generateBottomUV(H,
|
|
|
-a,b,c,d,e):t.generateTopUV(H,a,b,c,d,e);H.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,l=void 0!==b.bevelEnabled?b.bevelEnabled:!0,p=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,q,n=!1,v=b.material,u=b.extrudeMaterial,t=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,F,B,y;r&&(q=
|
|
|
-r.getSpacedPoints(s),n=!0,l=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,!1),F=new THREE.Vector3,B=new THREE.Vector3,y=new THREE.Vector3);l||(k=i=m=0);var z,x,G,H=this,D=this.vertices.length,p=a.extractPoints(p),J=p.shape,p=p.holes;if(r=!THREE.Shape.Utils.isClockWise(J)){J=J.reverse();x=0;for(G=p.length;x<G;x++)z=p[x],THREE.Shape.Utils.isClockWise(z)&&(p[x]=z.reverse());r=!1}var A=THREE.Shape.Utils.triangulateShape(J,p),r=J;x=0;for(G=p.length;x<G;x++)z=p[x],J=J.concat(z);
|
|
|
-var M,E,T,R,Q=J.length,aa=A.length,V=[],C=0,S=r.length;M=S-1;for(E=C+1;C<S;C++,M++,E++)M===S&&(M=0),E===S&&(E=0),V[C]=d(r[C],r[M],r[E]);var Z=[],K,ea=V.concat();x=0;for(G=p.length;x<G;x++){z=p[x];K=[];C=0;S=z.length;M=S-1;for(E=C+1;C<S;C++,M++,E++)M===S&&(M=0),E===S&&(E=0),K[C]=d(z[C],z[M],z[E]);Z.push(K);ea=ea.concat(K)}for(M=0;M<m;M++){z=M/m;T=i*(1-z);E=k*Math.sin(z*Math.PI/2);C=0;for(S=r.length;C<S;C++)R=c(r[C],V[C],E),f(R.x,R.y,-T);x=0;for(G=p.length;x<G;x++){z=p[x];K=Z[x];C=0;for(S=z.length;C<
|
|
|
-S;C++)R=c(z[C],K[C],E),f(R.x,R.y,-T)}}E=k;for(C=0;C<Q;C++)R=l?c(J[C],ea[C],E):J[C],n?(B.copy(w.normals[0]).multiplyScalar(R.x),F.copy(w.binormals[0]).multiplyScalar(R.y),y.copy(q[0]).add(B).add(F),f(y.x,y.y,y.z)):f(R.x,R.y,0);for(z=1;z<=s;z++)for(C=0;C<Q;C++)R=l?c(J[C],ea[C],E):J[C],n?(B.copy(w.normals[z]).multiplyScalar(R.x),F.copy(w.binormals[z]).multiplyScalar(R.y),y.copy(q[z]).add(B).add(F),f(y.x,y.y,y.z)):f(R.x,R.y,g/s*z);for(M=m-1;0<=M;M--){z=M/m;T=i*(1-z);E=k*Math.sin(z*Math.PI/2);C=0;for(S=
|
|
|
-r.length;C<S;C++)R=c(r[C],V[C],E),f(R.x,R.y,g+T);x=0;for(G=p.length;x<G;x++){z=p[x];K=Z[x];C=0;for(S=z.length;C<S;C++)R=c(z[C],K[C],E),n?f(R.x,R.y+q[s-1].y,q[s-1].x+T):f(R.x,R.y,g+T)}}if(l){i=0*Q;for(C=0;C<aa;C++)g=A[C],h(g[2]+i,g[1]+i,g[0]+i,!0);i=Q*(s+2*m);for(C=0;C<aa;C++)g=A[C],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(C=0;C<aa;C++)g=A[C],h(g[2],g[1],g[0],!0);for(C=0;C<aa;C++)g=A[C],h(g[0]+Q*s,g[1]+Q*s,g[2]+Q*s,!1)}g=0;e(r,g);g+=r.length;x=0;for(G=p.length;x<G;x++)z=p[x],e(z,g),g+=z.length};
|
|
|
+g=0;g<h;g++){var i=M*g,k=M*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,v=e,x=f,l=l+w,i=i+w,n=n+w,k=k+w;F.faces.push(new THREE.Face3(l,i,k,null,null,u));F.faces.push(new THREE.Face3(i,n,k,null,null,u));l=t.generateSideWallUV(F,a,p,b,l,i,n,k,q,r,v,x);F.faceVertexUvs[0].push([l[0],l[1],l[3]]);F.faceVertexUvs[0].push([l[1],l[2],l[3]])}}}function f(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=w;d+=w;e+=w;F.faces.push(new THREE.Face3(c,d,e,null,null,v));c=f?t.generateBottomUV(F,
|
|
|
+a,b,c,d,e):t.generateTopUV(F,a,b,c,d,e);F.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,l=void 0!==b.bevelEnabled?b.bevelEnabled:!0,p=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,q,n=!1,v=b.material,u=b.extrudeMaterial,t=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,x,G,B,y;r&&(q=
|
|
|
+r.getSpacedPoints(s),n=!0,l=!1,x=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,!1),G=new THREE.Vector3,B=new THREE.Vector3,y=new THREE.Vector3);l||(k=i=m=0);var z,D,H,F=this,w=this.vertices.length,p=a.extractPoints(p),J=p.shape,p=p.holes;if(r=!THREE.Shape.Utils.isClockWise(J)){J=J.reverse();D=0;for(H=p.length;D<H;D++)z=p[D],THREE.Shape.Utils.isClockWise(z)&&(p[D]=z.reverse());r=!1}var A=THREE.Shape.Utils.triangulateShape(J,p),r=J;D=0;for(H=p.length;D<H;D++)z=p[D],J=J.concat(z);
|
|
|
+var N,E,T,R,M=J.length,Q=A.length,ha=[],C=0,S=r.length;N=S-1;for(E=C+1;C<S;C++,N++,E++)N===S&&(N=0),E===S&&(E=0),ha[C]=d(r[C],r[N],r[E]);var Y=[],K,da=ha.concat();D=0;for(H=p.length;D<H;D++){z=p[D];K=[];C=0;S=z.length;N=S-1;for(E=C+1;C<S;C++,N++,E++)N===S&&(N=0),E===S&&(E=0),K[C]=d(z[C],z[N],z[E]);Y.push(K);da=da.concat(K)}for(N=0;N<m;N++){z=N/m;T=i*(1-z);E=k*Math.sin(z*Math.PI/2);C=0;for(S=r.length;C<S;C++)R=c(r[C],ha[C],E),f(R.x,R.y,-T);D=0;for(H=p.length;D<H;D++){z=p[D];K=Y[D];C=0;for(S=z.length;C<
|
|
|
+S;C++)R=c(z[C],K[C],E),f(R.x,R.y,-T)}}E=k;for(C=0;C<M;C++)R=l?c(J[C],da[C],E):J[C],n?(B.copy(x.normals[0]).multiplyScalar(R.x),G.copy(x.binormals[0]).multiplyScalar(R.y),y.copy(q[0]).add(B).add(G),f(y.x,y.y,y.z)):f(R.x,R.y,0);for(z=1;z<=s;z++)for(C=0;C<M;C++)R=l?c(J[C],da[C],E):J[C],n?(B.copy(x.normals[z]).multiplyScalar(R.x),G.copy(x.binormals[z]).multiplyScalar(R.y),y.copy(q[z]).add(B).add(G),f(y.x,y.y,y.z)):f(R.x,R.y,g/s*z);for(N=m-1;0<=N;N--){z=N/m;T=i*(1-z);E=k*Math.sin(z*Math.PI/2);C=0;for(S=
|
|
|
+r.length;C<S;C++)R=c(r[C],ha[C],E),f(R.x,R.y,g+T);D=0;for(H=p.length;D<H;D++){z=p[D];K=Y[D];C=0;for(S=z.length;C<S;C++)R=c(z[C],K[C],E),n?f(R.x,R.y+q[s-1].y,q[s-1].x+T):f(R.x,R.y,g+T)}}if(l){i=0*M;for(C=0;C<Q;C++)g=A[C],h(g[2]+i,g[1]+i,g[0]+i,!0);i=M*(s+2*m);for(C=0;C<Q;C++)g=A[C],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(C=0;C<Q;C++)g=A[C],h(g[2],g[1],g[0],!0);for(C=0;C<Q;C++)g=A[C],h(g[0]+M*s,g[1]+M*s,g[2]+M*s,!1)}g=0;e(r,g);g+=r.length;D=0;for(H=p.length;D<H;D++)z=p[D],e(z,g),g+=z.length};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,h,g){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[h].x,
|
|
|
m=a.vertices[h].y,h=a.vertices[h].z,l=a.vertices[g].x,p=a.vertices[g].y,a=a.vertices[g].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-h),new THREE.Vector2(l,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-h),new THREE.Vector2(p,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
@@ -671,29 +670,29 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
|
e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,l=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture,d));p={};s={};p.vertex=b.getAttribLocation(l,"position");p.uv=b.getAttribLocation(l,"uv");s.renderType=b.getUniformLocation(l,"renderType");s.map=b.getUniformLocation(l,"map");s.occlusionMap=b.getUniformLocation(l,"occlusionMap");s.opacity=
|
|
|
-b.getUniformLocation(l,"opacity");s.color=b.getUniformLocation(l,"color");s.scale=b.getUniformLocation(l,"scale");s.rotation=b.getUniformLocation(l,"rotation");s.screenPosition=b.getUniformLocation(l,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var t=new THREE.Vector3,w=f/e,F=0.5*e,B=0.5*f,y=16/f,z=new THREE.Vector2(y*w,y),x=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),H=s,y=p;b.useProgram(l);b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);
|
|
|
-b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(y.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(y.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var D,J,A,M,E;for(D=0;D<u;D++)if(y=16/f,z.set(y*w,y),M=a[D],t.set(M.matrixWorld.elements[12],M.matrixWorld.elements[13],M.matrixWorld.elements[14]),t.applyMatrix4(d.matrixWorldInverse),t.applyProjection(d.projectionMatrix),x.copy(t),G.x=x.x*F+F,
|
|
|
-G.y=x.y*B+B,m||0<G.x&&G.x<e&&0<G.y&&G.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,G.x-8,G.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,z.x,z.y);b.uniform3f(H.screenPosition,x.x,x.y,x.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,G.x-8,G.y-8,16,16,0);b.uniform1i(H.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);M.positionScreen.copy(x);M.customUpdateCallback?M.customUpdateCallback(M):M.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);J=0;for(A=M.lensFlares.length;J<A;J++)E=M.lensFlares[J],0.0010<E.opacity&&0.0010<E.scale&&(x.x=E.x,x.y=E.y,x.z=E.z,y=E.size*E.scale/f,z.x=y*w,z.y=y,b.uniform3f(H.screenPosition,x.x,x.y,x.z),b.uniform2f(H.scale,z.x,z.y),b.uniform1f(H.rotation,E.rotation),
|
|
|
-b.uniform1f(H.opacity,E.opacity),b.uniform3f(H.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,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,p){var s,r,q,n,v,u,t,w,F,B=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=l.__lights.length;s<r;s++)if(q=l.__lights[s],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(v=0;v<q.shadowCascadeCount;v++){var y;if(q.shadowCascadeArray[v])y=q.shadowCascadeArray[v];else{F=q;t=v;y=new THREE.DirectionalLight;y.isVirtual=!0;y.onlyShadow=!0;y.castShadow=!0;y.shadowCameraNear=F.shadowCameraNear;y.shadowCameraFar=F.shadowCameraFar;y.shadowCameraLeft=F.shadowCameraLeft;y.shadowCameraRight=F.shadowCameraRight;
|
|
|
-y.shadowCameraBottom=F.shadowCameraBottom;y.shadowCameraTop=F.shadowCameraTop;y.shadowCameraVisible=F.shadowCameraVisible;y.shadowDarkness=F.shadowDarkness;y.shadowBias=F.shadowCascadeBias[t];y.shadowMapWidth=F.shadowCascadeWidth[t];y.shadowMapHeight=F.shadowCascadeHeight[t];y.pointsWorld=[];y.pointsFrustum=[];w=y.pointsWorld;u=y.pointsFrustum;for(var z=0;8>z;z++)w[z]=new THREE.Vector3,u[z]=new THREE.Vector3;w=F.shadowCascadeNearZ[t];F=F.shadowCascadeFarZ[t];u[0].set(-1,-1,w);u[1].set(1,-1,w);u[2].set(-1,
|
|
|
-1,w);u[3].set(1,1,w);u[4].set(-1,-1,F);u[5].set(1,-1,F);u[6].set(-1,1,F);u[7].set(1,1,F);y.originalCamera=p;u=new THREE.Gyroscope;u.position=q.shadowCascadeOffset;u.add(y);u.add(y.target);p.add(u);q.shadowCascadeArray[v]=y;console.log("Created virtualLight",y)}t=q;w=v;F=t.shadowCascadeArray[w];F.position.copy(t.position);F.target.position.copy(t.target.position);F.lookAt(F.target);F.shadowCameraVisible=t.shadowCameraVisible;F.shadowDarkness=t.shadowDarkness;F.shadowBias=t.shadowCascadeBias[w];u=t.shadowCascadeNearZ[w];
|
|
|
-t=t.shadowCascadeFarZ[w];F=F.pointsFrustum;F[0].z=u;F[1].z=u;F[2].z=u;F[3].z=u;F[4].z=t;F[5].z=t;F[6].z=t;F[7].z=t;B[n]=y;n++}else B[n]=q,n++;s=0;for(r=B.length;s<r;s++){q=B[s];q.shadowMap||(v=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(v=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:v,magFilter:v,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
|
+b.getUniformLocation(l,"opacity");s.color=b.getUniformLocation(l,"color");s.scale=b.getUniformLocation(l,"scale");s.rotation=b.getUniformLocation(l,"rotation");s.screenPosition=b.getUniformLocation(l,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var t=new THREE.Vector3,x=f/e,G=0.5*e,B=0.5*f,y=16/f,z=new THREE.Vector2(y*x,y),D=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),F=s,y=p;b.useProgram(l);b.enableVertexAttribArray(p.vertex);b.enableVertexAttribArray(p.uv);
|
|
|
+b.uniform1i(F.occlusionMap,0);b.uniform1i(F.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(y.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(y.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var w,J,A,N,E;for(w=0;w<u;w++)if(y=16/f,z.set(y*x,y),N=a[w],t.set(N.matrixWorld.elements[12],N.matrixWorld.elements[13],N.matrixWorld.elements[14]),t.applyMatrix4(d.matrixWorldInverse),t.applyProjection(d.projectionMatrix),D.copy(t),H.x=D.x*G+G,
|
|
|
+H.y=D.y*B+B,m||0<H.x&&H.x<e&&0<H.y&&H.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,z.x,z.y);b.uniform3f(F.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(F.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);N.positionScreen.copy(D);N.customUpdateCallback?N.customUpdateCallback(N):N.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);J=0;for(A=N.lensFlares.length;J<A;J++)E=N.lensFlares[J],0.0010<E.opacity&&0.0010<E.scale&&(D.x=E.x,D.y=E.y,D.z=E.z,y=E.size*E.scale/f,z.x=y*x,z.y=y,b.uniform3f(F.screenPosition,D.x,D.y,D.z),b.uniform2f(F.scale,z.x,z.y),b.uniform1f(F.rotation,E.rotation),
|
|
|
+b.uniform1f(F.opacity,E.opacity),b.uniform3f(F.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,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,p){var s,r,q,n,v,u,t,x,G,B=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=l.__lights.length;s<r;s++)if(q=l.__lights[s],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(v=0;v<q.shadowCascadeCount;v++){var y;if(q.shadowCascadeArray[v])y=q.shadowCascadeArray[v];else{G=q;t=v;y=new THREE.DirectionalLight;y.isVirtual=!0;y.onlyShadow=!0;y.castShadow=!0;y.shadowCameraNear=G.shadowCameraNear;y.shadowCameraFar=G.shadowCameraFar;y.shadowCameraLeft=G.shadowCameraLeft;y.shadowCameraRight=G.shadowCameraRight;
|
|
|
+y.shadowCameraBottom=G.shadowCameraBottom;y.shadowCameraTop=G.shadowCameraTop;y.shadowCameraVisible=G.shadowCameraVisible;y.shadowDarkness=G.shadowDarkness;y.shadowBias=G.shadowCascadeBias[t];y.shadowMapWidth=G.shadowCascadeWidth[t];y.shadowMapHeight=G.shadowCascadeHeight[t];y.pointsWorld=[];y.pointsFrustum=[];x=y.pointsWorld;u=y.pointsFrustum;for(var z=0;8>z;z++)x[z]=new THREE.Vector3,u[z]=new THREE.Vector3;x=G.shadowCascadeNearZ[t];G=G.shadowCascadeFarZ[t];u[0].set(-1,-1,x);u[1].set(1,-1,x);u[2].set(-1,
|
|
|
+1,x);u[3].set(1,1,x);u[4].set(-1,-1,G);u[5].set(1,-1,G);u[6].set(-1,1,G);u[7].set(1,1,G);y.originalCamera=p;u=new THREE.Gyroscope;u.position=q.shadowCascadeOffset;u.add(y);u.add(y.target);p.add(u);q.shadowCascadeArray[v]=y;console.log("Created virtualLight",y)}t=q;x=v;G=t.shadowCascadeArray[x];G.position.copy(t.position);G.target.position.copy(t.target.position);G.lookAt(G.target);G.shadowCameraVisible=t.shadowCameraVisible;G.shadowDarkness=t.shadowDarkness;G.shadowBias=t.shadowCascadeBias[x];u=t.shadowCascadeNearZ[x];
|
|
|
+t=t.shadowCascadeFarZ[x];G=G.pointsFrustum;G[0].z=u;G[1].z=u;G[2].z=u;G[3].z=u;G[4].z=t;G[5].z=t;G[6].z=t;G[7].z=t;B[n]=y;n++}else B[n]=q,n++;s=0;for(r=B.length;s<r;s++){q=B[s];q.shadowMap||(v=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(v=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:v,magFilter:v,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}l.add(q.shadowCamera);!0===l.autoUpdate&&l.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
|
-!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&y.originalCamera==p){v=p;n=q.shadowCamera;u=q.pointsFrustum;F=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(t=0;8>t;t++)w=F[t],w.copy(u[t]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,v),w.applyMatrix4(n.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
-(k.z=w.z);n.left=i.x;n.right=k.x;n.top=k.y;n.bottom=i.y;n.updateProjectionMatrix()}n=q.shadowMap;u=q.shadowMatrix;v=q.shadowCamera;v.position.getPositionFromMatrix(q.matrixWorld);m.getPositionFromMatrix(q.target.matrixWorld);v.lookAt(m);v.updateMatrixWorld();v.matrixWorldInverse.getInverse(v.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(v.projectionMatrix);u.multiply(v.matrixWorldInverse);
|
|
|
-g.multiplyMatrices(v.projectionMatrix,v.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(n);b.clear();F=l.__webglObjects;q=0;for(n=F.length;q<n;q++)if(t=F[q],u=t.object,t.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||h.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,u.matrixWorld),t.render=!0;q=0;for(n=F.length;q<n;q++)t=F[q],t.render&&(u=t.object,t=t.buffer,z=u.material instanceof THREE.MeshFaceMaterial?
|
|
|
-u.material.materials[0]:u.material,w=0<u.geometry.morphTargets.length&&z.morphTargets,z=u instanceof THREE.SkinnedMesh&&z.skinning,w=u.customDepthMaterial?u.customDepthMaterial:z?w?f:e:w?d:c,t instanceof THREE.BufferGeometry?b.renderBufferDirect(v,l.__lights,null,w,t,u):b.renderBuffer(v,l.__lights,null,w,t,u));F=l.__webglObjectsImmediate;q=0;for(n=F.length;q<n;q++)t=F[q],u=t.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(v,
|
|
|
-l.__lights,null,c,u))}s=b.getClearColor();r=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,h,g,i,k,m,l,p,s,r,q,n,v;function u(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var t,w,F,B,y,z,x,G;this.init=function(u){t=u.context;w=u;B=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]);y=new Uint16Array([0,1,2,0,2,3]);z=t.createBuffer();x=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,z);t.bufferData(t.ARRAY_BUFFER,B,t.STATIC_DRAW);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,x);t.bufferData(t.ELEMENT_ARRAY_BUFFER,y,t.STATIC_DRAW);var u=t.createProgram(),
|
|
|
-D=t.createShader(t.VERTEX_SHADER),J=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(D,["precision "+w.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nuniform vec2 halfViewport;\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"));
|
|
|
-t.shaderSource(J,["precision "+w.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"));
|
|
|
-t.compileShader(D);t.compileShader(J);t.attachShader(u,D);t.attachShader(u,J);t.linkProgram(u);G=u;n=t.getAttribLocation(G,"position");v=t.getAttribLocation(G,"uv");a=t.getUniformLocation(G,"uvOffset");b=t.getUniformLocation(G,"uvScale");c=t.getUniformLocation(G,"rotation");d=t.getUniformLocation(G,"scale");e=t.getUniformLocation(G,"halfViewport");f=t.getUniformLocation(G,"color");h=t.getUniformLocation(G,"map");g=t.getUniformLocation(G,"opacity");i=t.getUniformLocation(G,"modelViewMatrix");k=t.getUniformLocation(G,
|
|
|
-"projectionMatrix");m=t.getUniformLocation(G,"fogType");l=t.getUniformLocation(G,"fogDensity");p=t.getUniformLocation(G,"fogNear");s=t.getUniformLocation(G,"fogFar");r=t.getUniformLocation(G,"fogColor");q=t.getUniformLocation(G,"alphaTest");u=document.createElement("canvas");u.width=8;u.height=8;D=u.getContext("2d");D.fillStyle="#ffffff";D.fillRect(0,0,u.width,u.height);F=new THREE.Texture(u);F.needsUpdate=!0};this.render=function(y,B,J,A){var M=y.__webglSprites,E=M.length;if(E){J*=0.5;A*=0.5;t.useProgram(G);
|
|
|
-t.enableVertexAttribArray(n);t.enableVertexAttribArray(v);t.disable(t.CULL_FACE);t.enable(t.BLEND);t.bindBuffer(t.ARRAY_BUFFER,z);t.vertexAttribPointer(n,2,t.FLOAT,!1,16,0);t.vertexAttribPointer(v,2,t.FLOAT,!1,16,8);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,x);t.uniformMatrix4fv(k,!1,B.projectionMatrix.elements);t.activeTexture(t.TEXTURE0);t.uniform1i(h,0);var T=0,R=0,Q=y.fog;Q?(t.uniform3f(r,Q.color.r,Q.color.g,Q.color.b),Q instanceof THREE.Fog?(t.uniform1f(p,Q.near),t.uniform1f(s,Q.far),t.uniform1i(m,
|
|
|
-1),R=T=1):Q instanceof THREE.FogExp2&&(t.uniform1f(l,Q.density),t.uniform1i(m,2),R=T=2)):(t.uniform1i(m,0),R=T=0);for(var aa,V,C=[],Q=0;Q<E;Q++)aa=M[Q],V=aa.material,aa.visible&&0!==V.opacity&&(aa._modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,aa.matrixWorld),aa.z=-aa._modelViewMatrix.elements[14]);M.sort(u);for(Q=0;Q<E;Q++)aa=M[Q],!1!==aa.visible&&(V=aa.material,t.uniform1f(q,V.alphaTest),t.uniformMatrix4fv(i,!1,aa._modelViewMatrix.elements),C[0]=aa.scale.x,C[1]=aa.scale.y,B=y.fog&&V.fog?
|
|
|
-R:0,T!==B&&(t.uniform1i(m,B),T=B),t.uniform2f(b,V.uvScale.x,V.uvScale.y),t.uniform2f(a,V.uvOffset.x,V.uvOffset.y),t.uniform1f(g,V.opacity),t.uniform3f(f,V.color.r,V.color.g,V.color.b),t.uniform1f(c,V.rotation),t.uniform2fv(d,C),t.uniform2f(e,J,A),w.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),w.setDepthTest(V.depthTest),w.setDepthWrite(V.depthWrite),V.map&&V.map.image&&V.map.image.width?w.setTexture(V.map,0):w.setTexture(F,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0));t.enable(t.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&y.originalCamera==p){v=p;n=q.shadowCamera;u=q.pointsFrustum;G=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(t=0;8>t;t++)x=G[t],x.copy(u[t]),THREE.ShadowMapPlugin.__projector.unprojectVector(x,v),x.applyMatrix4(n.matrixWorldInverse),x.x<i.x&&(i.x=x.x),x.x>k.x&&(k.x=x.x),x.y<i.y&&(i.y=x.y),x.y>k.y&&(k.y=x.y),x.z<i.z&&(i.z=x.z),x.z>k.z&&
|
|
|
+(k.z=x.z);n.left=i.x;n.right=k.x;n.top=k.y;n.bottom=i.y;n.updateProjectionMatrix()}n=q.shadowMap;u=q.shadowMatrix;v=q.shadowCamera;v.position.getPositionFromMatrix(q.matrixWorld);m.getPositionFromMatrix(q.target.matrixWorld);v.lookAt(m);v.updateMatrixWorld();v.matrixWorldInverse.getInverse(v.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(v.projectionMatrix);u.multiply(v.matrixWorldInverse);
|
|
|
+g.multiplyMatrices(v.projectionMatrix,v.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(n);b.clear();G=l.__webglObjects;q=0;for(n=G.length;q<n;q++)if(t=G[q],u=t.object,t.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||h.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,u.matrixWorld),t.render=!0;q=0;for(n=G.length;q<n;q++)t=G[q],t.render&&(u=t.object,t=t.buffer,z=u.material instanceof THREE.MeshFaceMaterial?
|
|
|
+u.material.materials[0]:u.material,x=0<u.geometry.morphTargets.length&&z.morphTargets,z=u instanceof THREE.SkinnedMesh&&z.skinning,x=u.customDepthMaterial?u.customDepthMaterial:z?x?f:e:x?d:c,t instanceof THREE.BufferGeometry?b.renderBufferDirect(v,l.__lights,null,x,t,u):b.renderBuffer(v,l.__lights,null,x,t,u));G=l.__webglObjectsImmediate;q=0;for(n=G.length;q<n;q++)t=G[q],u=t.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(v,
|
|
|
+l.__lights,null,c,u))}s=b.getClearColor();r=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,h,g,i,k,m,l,p,s,r,q,n,v;function u(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var t,x,G,B,y,z,D,H;this.init=function(u){t=u.context;x=u;B=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]);y=new Uint16Array([0,1,2,0,2,3]);z=t.createBuffer();D=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,z);t.bufferData(t.ARRAY_BUFFER,B,t.STATIC_DRAW);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,D);t.bufferData(t.ELEMENT_ARRAY_BUFFER,y,t.STATIC_DRAW);var u=t.createProgram(),
|
|
|
+w=t.createShader(t.VERTEX_SHADER),J=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(w,["precision "+x.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nuniform vec2 halfViewport;\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"));
|
|
|
+t.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"));
|
|
|
+t.compileShader(w);t.compileShader(J);t.attachShader(u,w);t.attachShader(u,J);t.linkProgram(u);H=u;n=t.getAttribLocation(H,"position");v=t.getAttribLocation(H,"uv");a=t.getUniformLocation(H,"uvOffset");b=t.getUniformLocation(H,"uvScale");c=t.getUniformLocation(H,"rotation");d=t.getUniformLocation(H,"scale");e=t.getUniformLocation(H,"halfViewport");f=t.getUniformLocation(H,"color");h=t.getUniformLocation(H,"map");g=t.getUniformLocation(H,"opacity");i=t.getUniformLocation(H,"modelViewMatrix");k=t.getUniformLocation(H,
|
|
|
+"projectionMatrix");m=t.getUniformLocation(H,"fogType");l=t.getUniformLocation(H,"fogDensity");p=t.getUniformLocation(H,"fogNear");s=t.getUniformLocation(H,"fogFar");r=t.getUniformLocation(H,"fogColor");q=t.getUniformLocation(H,"alphaTest");u=document.createElement("canvas");u.width=8;u.height=8;w=u.getContext("2d");w.fillStyle="#ffffff";w.fillRect(0,0,u.width,u.height);G=new THREE.Texture(u);G.needsUpdate=!0};this.render=function(y,w,B,A){var N=y.__webglSprites,E=N.length;if(E){B*=0.5;A*=0.5;t.useProgram(H);
|
|
|
+t.enableVertexAttribArray(n);t.enableVertexAttribArray(v);t.disable(t.CULL_FACE);t.enable(t.BLEND);t.bindBuffer(t.ARRAY_BUFFER,z);t.vertexAttribPointer(n,2,t.FLOAT,!1,16,0);t.vertexAttribPointer(v,2,t.FLOAT,!1,16,8);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,D);t.uniformMatrix4fv(k,!1,w.projectionMatrix.elements);t.activeTexture(t.TEXTURE0);t.uniform1i(h,0);var T=0,R=0,M=y.fog;M?(t.uniform3f(r,M.color.r,M.color.g,M.color.b),M instanceof THREE.Fog?(t.uniform1f(p,M.near),t.uniform1f(s,M.far),t.uniform1i(m,
|
|
|
+1),R=T=1):M instanceof THREE.FogExp2&&(t.uniform1f(l,M.density),t.uniform1i(m,2),R=T=2)):(t.uniform1i(m,0),R=T=0);for(var Q,ha=[],M=0;M<E;M++)Q=N[M],!1!==Q.visible&&(Q._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,Q.matrixWorld),Q.z=-Q._modelViewMatrix.elements[14]);N.sort(u);for(M=0;M<E;M++)Q=N[M],!1!==Q.visible&&(w=Q.material,t.uniform1f(q,w.alphaTest),t.uniformMatrix4fv(i,!1,Q._modelViewMatrix.elements),ha[0]=Q.scale.x,ha[1]=Q.scale.y,Q=y.fog&&w.fog?R:0,T!==Q&&(t.uniform1i(m,Q),T=Q),t.uniform2f(b,
|
|
|
+w.uvScale.x,w.uvScale.y),t.uniform2f(a,w.uvOffset.x,w.uvOffset.y),t.uniform1f(g,w.opacity),t.uniform3f(f,w.color.r,w.color.g,w.color.b),t.uniform1f(c,w.rotation),t.uniform2fv(d,ha),t.uniform2f(e,B,A),x.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst),x.setDepthTest(w.depthTest),x.setDepthWrite(w.depthWrite),w.map&&w.map.image&&w.map.image.width?x.setTexture(w.map,0):x.setTexture(G,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0));t.enable(t.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var m,l,p,s,r,q;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
|
|
|
k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();q=i.__webglObjects;m=0;for(l=q.length;m<l;m++)if(p=q[m],r=p.object,p.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||h.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),p.render=!0;var n;m=0;for(l=q.length;m<l;m++)if(p=q[m],p.render&&(r=p.object,p=p.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(n=
|
|
|
r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),s=0<r.geometry.morphTargets.length&&n.morphTargets,n=r instanceof THREE.SkinnedMesh&&n.skinning,s=r.customDepthMaterial?r.customDepthMaterial:n?s?f:e:s?d:c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,s,p,r):b.renderBuffer(k,i.__lights,null,s,p,r);q=i.__webglObjectsImmediate;m=0;for(l=q.length;m<l;m++)p=q[m],r=p.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|