|
@@ -1,5 +1,5 @@
|
|
|
// three.js - http://github.com/mrdoob/three.js
|
|
|
-'use strict';var THREE=THREE||{REVISION:"56"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};
|
|
|
+'use strict';var THREE=THREE||{REVISION:"57dev"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};
|
|
|
THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d<e;d++){var f=c[d];Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(b,f))}else for(f in c={}.hasOwnProperty,b)c.call(b,f)&&(a[f]=b[f]);return a};
|
|
|
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];void 0===window.requestAnimationFrame&&(window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g});window.cancelAnimationFrame=window.cancelAnimationFrame||
|
|
|
function(a){window.clearTimeout(a)}})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;
|
|
@@ -79,8 +79,8 @@ THREE.extend(THREE.Matrix4.prototype,{set:function(a,b,c,d,e,f,g,h,i,k,l,m,n,s,r
|
|
|
d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var k=g*i,l=g*f,m=d*i,n=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+m*e;c[5]=k-n*e;c[9]=-d*h;c[2]=n-k*e;c[6]=m+l*e;c[10]=g*h}else"YXZ"===b?(k=h*i,l=h*f,m=e*i,n=e*f,c[0]=k+n*d,c[4]=m*d-l,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=l*d-m,c[6]=n+k*d,c[10]=g*h):"ZXY"===b?(k=h*i,l=h*f,m=e*i,n=e*f,c[0]=k-n*d,c[4]=-g*f,c[8]=m+l*d,c[1]=l+m*d,c[5]=g*i,c[9]=n-k*d,c[2]=-g*e,c[6]=d,c[10]=g*h):
|
|
|
"ZYX"===b?(k=g*i,l=g*f,m=d*i,n=d*f,c[0]=h*i,c[4]=m*e-l,c[8]=k*e+n,c[1]=h*f,c[5]=n*e+k,c[9]=l*e-m,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(k=g*h,l=g*e,m=d*h,n=d*e,c[0]=h*i,c[4]=n-k*f,c[8]=m*f+l,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=l*f+m,c[10]=k-n*f):"XZY"===b&&(k=g*h,l=g*e,m=d*h,n=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=k*f+n,c[5]=g*i,c[9]=l*f-m,c[2]=m*f-l,c[6]=d*i,c[10]=n*f+k);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,k=c*h,
|
|
|
c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;
|
|
|
-g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],l=c[5],m=c[9],n=c[13],s=c[2],r=c[6],p=c[10],q=c[14],y=c[3],v=c[7],z=c[11],c=c[15],t=d[0],A=d[4],I=d[8],C=d[12],x=d[1],G=d[5],J=d[9],
|
|
|
-E=d[13],H=d[2],B=d[6],W=d[10],F=d[14],K=d[3],L=d[7],U=d[11],d=d[15];e[0]=f*t+g*x+h*H+i*K;e[4]=f*A+g*G+h*B+i*L;e[8]=f*I+g*J+h*W+i*U;e[12]=f*C+g*E+h*F+i*d;e[1]=k*t+l*x+m*H+n*K;e[5]=k*A+l*G+m*B+n*L;e[9]=k*I+l*J+m*W+n*U;e[13]=k*C+l*E+m*F+n*d;e[2]=s*t+r*x+p*H+q*K;e[6]=s*A+r*G+p*B+q*L;e[10]=s*I+r*J+p*W+q*U;e[14]=s*C+r*E+p*F+q*d;e[3]=y*t+v*x+z*H+c*K;e[7]=y*A+v*G+z*B+c*L;e[11]=y*I+v*J+z*W+c*U;e[15]=y*C+v*E+z*F+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);
|
|
|
+g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],l=c[5],m=c[9],n=c[13],s=c[2],r=c[6],p=c[10],q=c[14],y=c[3],v=c[7],z=c[11],c=c[15],t=d[0],A=d[4],I=d[8],B=d[12],x=d[1],G=d[5],J=d[9],
|
|
|
+E=d[13],H=d[2],C=d[6],W=d[10],F=d[14],K=d[3],L=d[7],U=d[11],d=d[15];e[0]=f*t+g*x+h*H+i*K;e[4]=f*A+g*G+h*C+i*L;e[8]=f*I+g*J+h*W+i*U;e[12]=f*B+g*E+h*F+i*d;e[1]=k*t+l*x+m*H+n*K;e[5]=k*A+l*G+m*C+n*L;e[9]=k*I+l*J+m*W+n*U;e[13]=k*B+l*E+m*F+n*d;e[2]=s*t+r*x+p*H+q*K;e[6]=s*A+r*G+p*C+q*L;e[10]=s*I+r*J+p*W+q*U;e[14]=s*B+r*E+p*F+q*d;e[3]=y*t+v*x+z*H+c*K;e[7]=y*A+v*G+z*C+c*L;e[11]=y*I+v*J+z*W+c*U;e[15]=y*B+v*E+z*F+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);
|
|
|
c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=
|
|
|
c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],l=a[6],m=a[10],n=a[14];return a[3]*(+e*h*l-d*i*l-e*g*m+c*i*m+d*g*n-c*h*n)+a[7]*
|
|
@@ -94,7 +94,7 @@ g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;
|
|
|
b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*k;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=
|
|
|
l*i-a*e;b[11]=l*k-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*k;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=l*i+a*e;b[11]=l*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*k;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*
|
|
|
k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),l=Math.sin(b),m=1-k,n=d*e*m,s=d*f*m,m=e*f*m,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=n+l,e=s-r,n=n-l,h=h+(1-h)*k,l=m+d,s=s+r,m=m-d,i=i+(1-i)*k,k=c[0],d=c[1],r=c[2],p=c[3],q=c[4],y=c[5],v=c[6],
|
|
|
-z=c[7],t=c[8],A=c[9],I=c[10],C=c[11];c[0]=f*k+g*q+e*t;c[1]=f*d+g*y+e*A;c[2]=f*r+g*v+e*I;c[3]=f*p+g*z+e*C;c[4]=n*k+h*q+l*t;c[5]=n*d+h*y+l*A;c[6]=n*r+h*v+l*I;c[7]=n*p+h*z+l*C;c[8]=s*k+m*q+i*t;c[9]=s*d+m*y+i*A;c[10]=s*r+m*v+i*I;c[11]=s*p+m*z+i*C;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*
|
|
|
+z=c[7],t=c[8],A=c[9],I=c[10],B=c[11];c[0]=f*k+g*q+e*t;c[1]=f*d+g*y+e*A;c[2]=f*r+g*v+e*I;c[3]=f*p+g*z+e*B;c[4]=n*k+h*q+l*t;c[5]=n*d+h*y+l*A;c[6]=n*r+h*v+l*I;c[7]=n*p+h*z+l*B;c[8]=s*k+m*q+i*t;c[9]=s*d+m*y+i*A;c[10]=s*r+m*v+i*I;c[11]=s*p+m*z+i*B;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*
|
|
|
a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,
|
|
|
0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*
|
|
|
f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],
|
|
@@ -124,7 +124,7 @@ midpoint:function(a){return(a||new THREE.Vector3).addVectors(this.a,this.b).add(
|
|
|
a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};
|
|
|
THREE.extend(THREE.Clock.prototype,{start:function(){this.oldTime=this.startTime=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now(),
|
|
|
a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}});THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=function(h,i,k){if(h instanceof a.Particle){f.getPositionFromMatrix(h.matrixWorld);i=i.ray.distanceToPoint(f);if(i>h.scale.x)return k;k.push({distance:i,point:h.position,face:null,object:h})}else if(h instanceof
|
|
|
-a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!i.ray.isIntersectionSphere(b))return k;var s=h.geometry,r=s.vertices,p=h.material instanceof a.MeshFaceMaterial,q=!0===p?h.material.materials:null,y=h.material.side,v,z,t,A=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);g.getInverse(h.matrixWorld);c.copy(i.ray).applyMatrix4(g);for(var I=0,C=s.faces.length;I<C;I++){var x=s.faces[I],y=!0===p?q[x.materialIndex]:
|
|
|
+a.Mesh){f.getPositionFromMatrix(h.matrixWorld);b.set(f,h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis());if(!i.ray.isIntersectionSphere(b))return k;var s=h.geometry,r=s.vertices,p=h.material instanceof a.MeshFaceMaterial,q=!0===p?h.material.materials:null,y=h.material.side,v,z,t,A=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);g.getInverse(h.matrixWorld);c.copy(i.ray).applyMatrix4(g);for(var I=0,B=s.faces.length;I<B;I++){var x=s.faces[I],y=!0===p?q[x.materialIndex]:
|
|
|
h.material;if(void 0!==y){d.setFromNormalAndCoplanarPoint(x.normal,r[x.a]);var G=c.distanceToPlane(d);if(!(Math.abs(G)<A)&&!(0>G)){y=y.side;if(y!==a.DoubleSide&&(v=c.direction.dot(d.normal),!(y===a.FrontSide?0>v:0<v)))continue;if(!(G<i.near||G>i.far)){e=c.at(G,e);if(x instanceof a.Face3){if(y=r[x.a],v=r[x.b],z=r[x.c],!a.Triangle.containsPoint(e,y,v,z))continue}else if(x instanceof a.Face4){if(y=r[x.a],v=r[x.b],z=r[x.c],t=r[x.d],!a.Triangle.containsPoint(e,y,v,t)&&!a.Triangle.containsPoint(e,v,z,t))continue}else throw Error("face type not supported");
|
|
|
k.push({distance:G,point:i.ray.at(G),face:x,faceIndex:I,object:h})}}}}}},k=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&k(a,this,c);i(a,this,c);c.sort(h);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<
|
|
|
e;d++)i(a[d],this,c),!0===b&&k(a[d],this,c);c.sort(h);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
@@ -136,19 +136,19 @@ traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.chi
|
|
|
!1===this.useQuaternion?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),
|
|
|
this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){void 0===a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);
|
|
|
a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(k===m){var a=new THREE.RenderableVertex;l.push(a);m++;k++;return a}return l[k++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
-c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,k,l=[],m=0,n,s,r=[],p=0,q,y=[],v=0,z,t,A=[],I=0,C,x,G=[],J=0,E={objects:[],sprites:[],lights:[],elements:[]},H=new THREE.Vector3,B=new THREE.Vector4,W=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),F=new THREE.Box3,K=Array(3),L=Array(4),U=new THREE.Matrix4,fa=new THREE.Matrix4,Ca,$a=new THREE.Matrix4,M=new THREE.Matrix3,ca=new THREE.Matrix3,qa=new THREE.Vector3,ha=new THREE.Frustum,ra=new THREE.Vector4,N=new THREE.Vector4;
|
|
|
-this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);fa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(fa)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);fa.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(fa)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
|
|
|
-c)};this.projectScene=function(g,h,m,Pa){var ta=!1,ka,aa,pa,Y,da,la,Z,oa,gb,nb,ia,Wa,ab;x=t=q=s=0;E.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();U.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));fa.multiplyMatrices(h.projectionMatrix,U);ca.getInverse(U);ca.transpose();ha.setFromMatrix(fa);f=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var Fa=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof
|
|
|
-THREE.Light)E.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===ha.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(H.getPositionFromMatrix(f.matrixWorld),H.applyProjection(fa),e.z=H.z),E.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(H.getPositionFromMatrix(f.matrixWorld),H.applyProjection(fa),e.z=H.z),E.sprites.push(e)):(e=a(),e.object=
|
|
|
-f,null!==f.renderDepth?e.z=f.renderDepth:(H.getPositionFromMatrix(f.matrixWorld),H.applyProjection(fa),e.z=H.z),E.objects.push(e));Fa(f)}}};Fa(g);!0===m&&E.objects.sort(c);g=0;for(m=E.objects.length;g<m;g++)if(oa=E.objects[g].object,Ca=oa.matrixWorld,k=0,oa instanceof THREE.Mesh){gb=oa.geometry;pa=gb.vertices;nb=gb.faces;gb=gb.faceVertexUvs;M.getInverse(Ca);M.transpose();Wa=oa.material instanceof THREE.MeshFaceMaterial;ab=!0===Wa?oa.material:null;ka=0;for(aa=pa.length;ka<aa;ka++)i=b(),i.positionWorld.copy(pa[ka]).applyMatrix4(Ca),
|
|
|
-i.positionScreen.copy(i.positionWorld).applyMatrix4(fa),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.positionScreen.z/=i.positionScreen.w,i.visible=!(-1>i.positionScreen.x||1<i.positionScreen.x||-1>i.positionScreen.y||1<i.positionScreen.y||-1>i.positionScreen.z||1<i.positionScreen.z);pa=0;for(ka=nb.length;pa<ka;pa++){aa=nb[pa];var Xa=!0===Wa?ab.materials[aa.materialIndex]:oa.material;if(void 0!==Xa){la=Xa.side;if(aa instanceof THREE.Face3)if(Y=l[aa.a],da=l[aa.b],
|
|
|
-Z=l[aa.c],K[0]=Y.positionScreen,K[1]=da.positionScreen,K[2]=Z.positionScreen,!0===Y.visible||!0===da.visible||!0===Z.visible||W.isIntersectionBox(F.setFromPoints(K)))if(ta=0>(Z.positionScreen.x-Y.positionScreen.x)*(da.positionScreen.y-Y.positionScreen.y)-(Z.positionScreen.y-Y.positionScreen.y)*(da.positionScreen.x-Y.positionScreen.x),la===THREE.DoubleSide||ta===(la===THREE.FrontSide))s===p?(ia=new THREE.RenderableFace3,r.push(ia),p++,s++,n=ia):n=r[s++],n.v1.copy(Y),n.v2.copy(da),n.v3.copy(Z);else continue;
|
|
|
-else continue;else if(aa instanceof THREE.Face4)if(Y=l[aa.a],da=l[aa.b],Z=l[aa.c],ia=l[aa.d],L[0]=Y.positionScreen,L[1]=da.positionScreen,L[2]=Z.positionScreen,L[3]=ia.positionScreen,!0===Y.visible||!0===da.visible||!0===Z.visible||!0===ia.visible||W.isIntersectionBox(F.setFromPoints(L)))if(ta=0>(ia.positionScreen.x-Y.positionScreen.x)*(da.positionScreen.y-Y.positionScreen.y)-(ia.positionScreen.y-Y.positionScreen.y)*(da.positionScreen.x-Y.positionScreen.x)||0>(da.positionScreen.x-Z.positionScreen.x)*
|
|
|
-(ia.positionScreen.y-Z.positionScreen.y)-(da.positionScreen.y-Z.positionScreen.y)*(ia.positionScreen.x-Z.positionScreen.x),la===THREE.DoubleSide||ta===(la===THREE.FrontSide)){if(q===v){var ub=new THREE.RenderableFace4;y.push(ub);v++;q++;n=ub}else n=y[q++];n.v1.copy(Y);n.v2.copy(da);n.v3.copy(Z);n.v4.copy(ia)}else continue;else continue;n.normalModel.copy(aa.normal);!1===ta&&(la===THREE.BackSide||la===THREE.DoubleSide)&&n.normalModel.negate();n.normalModel.applyMatrix3(M).normalize();n.normalModelView.copy(n.normalModel).applyMatrix3(ca);
|
|
|
-n.centroidModel.copy(aa.centroid).applyMatrix4(Ca);Z=aa.vertexNormals;Y=0;for(da=Z.length;Y<da;Y++)ia=n.vertexNormalsModel[Y],ia.copy(Z[Y]),!1===ta&&(la===THREE.BackSide||la===THREE.DoubleSide)&&ia.negate(),ia.applyMatrix3(M).normalize(),n.vertexNormalsModelView[Y].copy(ia).applyMatrix3(ca);n.vertexNormalsLength=Z.length;Y=0;for(da=gb.length;Y<da;Y++)if(ia=gb[Y][pa],void 0!==ia){la=0;for(Z=ia.length;la<Z;la++)n.uvs[Y][la]=ia[la]}n.color=aa.color;n.material=Xa;qa.copy(n.centroidModel).applyProjection(fa);
|
|
|
-n.z=qa.z;E.elements.push(n)}}}else if(oa instanceof THREE.Line){$a.multiplyMatrices(fa,Ca);pa=oa.geometry.vertices;Y=b();Y.positionScreen.copy(pa[0]).applyMatrix4($a);nb=oa.type===THREE.LinePieces?2:1;ka=1;for(aa=pa.length;ka<aa;ka++)Y=b(),Y.positionScreen.copy(pa[ka]).applyMatrix4($a),0<(ka+1)%nb||(da=l[k-2],ra.copy(Y.positionScreen),N.copy(da.positionScreen),!0===d(ra,N)&&(ra.multiplyScalar(1/ra.w),N.multiplyScalar(1/N.w),t===I?(gb=new THREE.RenderableLine,A.push(gb),I++,t++,z=gb):z=A[t++],z.v1.positionScreen.copy(ra),
|
|
|
-z.v2.positionScreen.copy(N),z.z=Math.max(ra.z,N.z),z.material=oa.material,E.elements.push(z)))}g=0;for(m=E.sprites.length;g<m;g++)oa=E.sprites[g].object,Ca=oa.matrixWorld,oa instanceof THREE.Particle&&(B.set(Ca.elements[12],Ca.elements[13],Ca.elements[14],1),B.applyMatrix4(fa),B.z/=B.w,0<B.z&&1>B.z&&(x===J?(ta=new THREE.RenderableParticle,G.push(ta),J++,x++,C=ta):C=G[x++],C.object=oa,C.x=B.x/B.w,C.y=B.y/B.w,C.z=B.z,C.rotation=oa.rotation.z,C.scale.x=oa.scale.x*Math.abs(C.x-(B.x+h.projectionMatrix.elements[0])/
|
|
|
-(B.w+h.projectionMatrix.elements[12])),C.scale.y=oa.scale.y*Math.abs(C.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),C.material=oa.material,E.elements.push(C)));!0===Pa&&E.elements.sort(c);return E}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
+c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,k,l=[],m=0,n,s,r=[],p=0,q,y=[],v=0,z,t,A=[],I=0,B,x,G=[],J=0,E={objects:[],sprites:[],lights:[],elements:[]},H=new THREE.Vector3,C=new THREE.Vector4,W=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),F=new THREE.Box3,K=Array(3),L=Array(4),U=new THREE.Matrix4,da=new THREE.Matrix4,Fa,Pa=new THREE.Matrix4,M=new THREE.Matrix3,ea=new THREE.Matrix3,wa=new THREE.Vector3,ia=new THREE.Frustum,sa=new THREE.Vector4,N=new THREE.Vector4;
|
|
|
+this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);da.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(da)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);da.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(da)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
|
|
|
+c)};this.projectScene=function(g,h,m,Oa){var Ea=!1,ma,ga,pa,Y,ba,ja,Z,qa,bb,mb,ha,cb,Va;x=t=q=s=0;E.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();U.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));da.multiplyMatrices(h.projectionMatrix,U);ea.getInverse(U);ea.transpose();ia.setFromMatrix(da);f=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var Wa=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof
|
|
|
+THREE.Light)E.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===ia.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(H.getPositionFromMatrix(f.matrixWorld),H.applyProjection(da),e.z=H.z),E.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(H.getPositionFromMatrix(f.matrixWorld),H.applyProjection(da),e.z=H.z),E.sprites.push(e)):(e=a(),e.object=
|
|
|
+f,null!==f.renderDepth?e.z=f.renderDepth:(H.getPositionFromMatrix(f.matrixWorld),H.applyProjection(da),e.z=H.z),E.objects.push(e));Wa(f)}}};Wa(g);!0===m&&E.objects.sort(c);g=0;for(m=E.objects.length;g<m;g++)if(qa=E.objects[g].object,Fa=qa.matrixWorld,k=0,qa instanceof THREE.Mesh){bb=qa.geometry;pa=bb.vertices;mb=bb.faces;bb=bb.faceVertexUvs;M.getInverse(Fa);M.transpose();cb=qa.material instanceof THREE.MeshFaceMaterial;Va=!0===cb?qa.material:null;ma=0;for(ga=pa.length;ma<ga;ma++)i=b(),i.positionWorld.copy(pa[ma]).applyMatrix4(Fa),
|
|
|
+i.positionScreen.copy(i.positionWorld).applyMatrix4(da),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.positionScreen.z/=i.positionScreen.w,i.visible=!(-1>i.positionScreen.x||1<i.positionScreen.x||-1>i.positionScreen.y||1<i.positionScreen.y||-1>i.positionScreen.z||1<i.positionScreen.z);pa=0;for(ma=mb.length;pa<ma;pa++){ga=mb[pa];var Qa=!0===cb?Va.materials[ga.materialIndex]:qa.material;if(void 0!==Qa){ja=Qa.side;if(ga instanceof THREE.Face3)if(Y=l[ga.a],ba=l[ga.b],
|
|
|
+Z=l[ga.c],K[0]=Y.positionScreen,K[1]=ba.positionScreen,K[2]=Z.positionScreen,!0===Y.visible||!0===ba.visible||!0===Z.visible||W.isIntersectionBox(F.setFromPoints(K)))if(Ea=0>(Z.positionScreen.x-Y.positionScreen.x)*(ba.positionScreen.y-Y.positionScreen.y)-(Z.positionScreen.y-Y.positionScreen.y)*(ba.positionScreen.x-Y.positionScreen.x),ja===THREE.DoubleSide||Ea===(ja===THREE.FrontSide))s===p?(ha=new THREE.RenderableFace3,r.push(ha),p++,s++,n=ha):n=r[s++],n.v1.copy(Y),n.v2.copy(ba),n.v3.copy(Z);else continue;
|
|
|
+else continue;else if(ga instanceof THREE.Face4)if(Y=l[ga.a],ba=l[ga.b],Z=l[ga.c],ha=l[ga.d],L[0]=Y.positionScreen,L[1]=ba.positionScreen,L[2]=Z.positionScreen,L[3]=ha.positionScreen,!0===Y.visible||!0===ba.visible||!0===Z.visible||!0===ha.visible||W.isIntersectionBox(F.setFromPoints(L)))if(Ea=0>(ha.positionScreen.x-Y.positionScreen.x)*(ba.positionScreen.y-Y.positionScreen.y)-(ha.positionScreen.y-Y.positionScreen.y)*(ba.positionScreen.x-Y.positionScreen.x)||0>(ba.positionScreen.x-Z.positionScreen.x)*
|
|
|
+(ha.positionScreen.y-Z.positionScreen.y)-(ba.positionScreen.y-Z.positionScreen.y)*(ha.positionScreen.x-Z.positionScreen.x),ja===THREE.DoubleSide||Ea===(ja===THREE.FrontSide)){if(q===v){var yb=new THREE.RenderableFace4;y.push(yb);v++;q++;n=yb}else n=y[q++];n.v1.copy(Y);n.v2.copy(ba);n.v3.copy(Z);n.v4.copy(ha)}else continue;else continue;n.normalModel.copy(ga.normal);!1===Ea&&(ja===THREE.BackSide||ja===THREE.DoubleSide)&&n.normalModel.negate();n.normalModel.applyMatrix3(M).normalize();n.normalModelView.copy(n.normalModel).applyMatrix3(ea);
|
|
|
+n.centroidModel.copy(ga.centroid).applyMatrix4(Fa);Z=ga.vertexNormals;Y=0;for(ba=Z.length;Y<ba;Y++)ha=n.vertexNormalsModel[Y],ha.copy(Z[Y]),!1===Ea&&(ja===THREE.BackSide||ja===THREE.DoubleSide)&&ha.negate(),ha.applyMatrix3(M).normalize(),n.vertexNormalsModelView[Y].copy(ha).applyMatrix3(ea);n.vertexNormalsLength=Z.length;Y=0;for(ba=bb.length;Y<ba;Y++)if(ha=bb[Y][pa],void 0!==ha){ja=0;for(Z=ha.length;ja<Z;ja++)n.uvs[Y][ja]=ha[ja]}n.color=ga.color;n.material=Qa;wa.copy(n.centroidModel).applyProjection(da);
|
|
|
+n.z=wa.z;E.elements.push(n)}}}else if(qa instanceof THREE.Line){Pa.multiplyMatrices(da,Fa);pa=qa.geometry.vertices;Y=b();Y.positionScreen.copy(pa[0]).applyMatrix4(Pa);mb=qa.type===THREE.LinePieces?2:1;ma=1;for(ga=pa.length;ma<ga;ma++)Y=b(),Y.positionScreen.copy(pa[ma]).applyMatrix4(Pa),0<(ma+1)%mb||(ba=l[k-2],sa.copy(Y.positionScreen),N.copy(ba.positionScreen),!0===d(sa,N)&&(sa.multiplyScalar(1/sa.w),N.multiplyScalar(1/N.w),t===I?(bb=new THREE.RenderableLine,A.push(bb),I++,t++,z=bb):z=A[t++],z.v1.positionScreen.copy(sa),
|
|
|
+z.v2.positionScreen.copy(N),z.z=Math.max(sa.z,N.z),z.material=qa.material,E.elements.push(z)))}g=0;for(m=E.sprites.length;g<m;g++)qa=E.sprites[g].object,Fa=qa.matrixWorld,qa instanceof THREE.Particle&&(C.set(Fa.elements[12],Fa.elements[13],Fa.elements[14],1),C.applyMatrix4(da),C.z/=C.w,0<C.z&&1>C.z&&(x===J?(Ea=new THREE.RenderableParticle,G.push(Ea),J++,x++,B=Ea):B=G[x++],B.object=qa,B.x=C.x/C.w,B.y=C.y/C.w,B.z=C.z,B.rotation=qa.rotation.z,B.scale.x=qa.scale.x*Math.abs(B.x-(C.x+h.projectionMatrix.elements[0])/
|
|
|
+(C.w+h.projectionMatrix.elements[12])),B.scale.y=qa.scale.y*Math.abs(B.y-(C.y+h.projectionMatrix.elements[5])/(C.w+h.projectionMatrix.elements[13])),B.material=qa.material,E.elements.push(B)));!0===Oa&&E.elements.sort(c);return E}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==g?g:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
@@ -163,9 +163,9 @@ e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.vertices.length;b<c;b+
|
|
|
d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=
|
|
|
[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=
|
|
|
this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],k=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,
|
|
|
-d,e,f,x){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];l=g[e];m=g[f];n=g[x];s=i.x-h.x;r=k.x-h.x;p=i.y-h.y;q=k.y-h.y;y=i.z-h.z;v=k.z-h.z;z=m.x-l.x;t=n.x-l.x;A=m.y-l.y;I=n.y-l.y;C=1/(z*I-t*A);E.set((I*s-A*r)*C,(I*p-A*q)*C,(I*y-A*v)*C);H.set((z*r-t*s)*C,(z*q-t*p)*C,(z*v-t*y)*C);G[b].add(E);G[c].add(E);G[d].add(E);J[b].add(H);J[c].add(H);J[d].add(H)}var b,c,d,e,f,g,h,i,k,l,m,n,s,r,p,q,y,v,z,t,A,I,C,x,G=[],J=[],E=new THREE.Vector3,H=new THREE.Vector3,B=new THREE.Vector3,W=new THREE.Vector3,F=new THREE.Vector3;
|
|
|
-b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,J[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var K=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)F.copy(f.vertexNormals[d]),e=f[K[d]],x=G[e],B.copy(x),B.sub(F.multiplyScalar(F.dot(x))).normalize(),
|
|
|
-W.crossVectors(f.vertexNormals[d],x),e=W.dot(J[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
+d,e,f,x){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];l=g[e];m=g[f];n=g[x];s=i.x-h.x;r=k.x-h.x;p=i.y-h.y;q=k.y-h.y;y=i.z-h.z;v=k.z-h.z;z=m.x-l.x;t=n.x-l.x;A=m.y-l.y;I=n.y-l.y;B=1/(z*I-t*A);E.set((I*s-A*r)*B,(I*p-A*q)*B,(I*y-A*v)*B);H.set((z*r-t*s)*B,(z*q-t*p)*B,(z*v-t*y)*B);G[b].add(E);G[c].add(E);G[d].add(E);J[b].add(H);J[c].add(H);J[d].add(H)}var b,c,d,e,f,g,h,i,k,l,m,n,s,r,p,q,y,v,z,t,A,I,B,x,G=[],J=[],E=new THREE.Vector3,H=new THREE.Vector3,C=new THREE.Vector3,W=new THREE.Vector3,F=new THREE.Vector3;
|
|
|
+b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,J[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var K=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)F.copy(f.vertexNormals[d]),e=f[K[d]],x=G[e],C.copy(x),C.sub(F.multiplyScalar(F.dot(x))).normalize(),
|
|
|
+W.crossVectors(f.vertexNormals[d],x),e=W.dot(J[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(C.x,C.y,C.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,k;this.__tmpVertices=void 0;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];
|
|
|
h=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(h[i]==h[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];h=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)h[i]==h[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){h.splice(d,1);var l=new THREE.Face3(h[0],h[1],h[2],a.normal,a.color,a.materialIndex);h=0;for(i=this.faceVertexUvs.length;h<i;h++)(k=this.faceVertexUvs[h][f])&&k.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(l.vertexNormals=a.vertexNormals,l.vertexNormals.splice(d,
|
|
|
1));a.vertexColors&&0<a.vertexColors.length&&(l.vertexColors=a.vertexColors,l.vertexColors.splice(d,1));this.faces[f]=l}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);h=0;for(i=this.faceVertexUvs.length;h<i;h++)this.faceVertexUvs[h].splice(f,1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];
|
|
@@ -175,10 +175,10 @@ var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.len
|
|
|
new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
|
|
|
0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,k,l,m,n=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var y=this.attributes.index.array,v=this.offsets;c=0;for(d=v.length;c<d;++c){b=v[c].start;g=v[c].count;var z=v[c].index;a=b;for(b+=g;a<b;a+=3)g=z+y[a],h=z+y[a+1],i=z+y[a+2],k=e[3*g],l=e[3*g+1],m=e[3*g+2],n.set(k,l,m),k=e[3*h],l=e[3*h+1],m=e[3*h+2],s.set(k,l,m),k=e[3*i],l=e[3*i+1],m=e[3*i+2],r.set(k,
|
|
|
l,m),p.subVectors(r,s),q.subVectors(n,s),p.cross(q),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],m=e[a+2],n.set(k,l,m),k=e[a+3],l=e[a+4],m=e[a+5],s.set(k,l,m),k=e[a+6],l=e[a+7],m=e[a+8],r.set(k,l,m),p.subVectors(r,s),q.subVectors(n,s),p.cross(q),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z}this.normalizeNormals();this.normalsNeedUpdate=
|
|
|
-!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){Ca.x=d[3*a];Ca.y=d[3*a+1];Ca.z=d[3*a+2];$a.copy(Ca);ca=i[a];U.copy(ca);U.sub(Ca.multiplyScalar(Ca.dot(ca))).normalize();fa.crossVectors($a,ca);qa=fa.dot(k[a]);M=0>qa?-1:1;h[4*a]=U.x;h[4*a+1]=U.y;h[4*a+2]=U.z;h[4*a+3]=M}if(void 0===this.attributes.index||void 0===this.attributes.position||
|
|
|
+!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){Fa.x=d[3*a];Fa.y=d[3*a+1];Fa.z=d[3*a+2];Pa.copy(Fa);ea=i[a];U.copy(ea);U.sub(Fa.multiplyScalar(Fa.dot(ea))).normalize();da.crossVectors(Pa,ea);wa=da.dot(k[a]);M=0>wa?-1:1;h[4*a]=U.x;h[4*a+1]=U.y;h[4*a+2]=U.z;h[4*a+3]=M}if(void 0===this.attributes.index||void 0===this.attributes.position||
|
|
|
void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],k=[],g=0;g<f;g++)i[g]=
|
|
|
-new THREE.Vector3,k[g]=new THREE.Vector3;var l,m,n,s,r,p,q,y,v,z,t,A,I,C,x,f=new THREE.Vector3,g=new THREE.Vector3,G,J,E,H,B,W,F,K=this.offsets;E=0;for(H=K.length;E<H;++E){J=K[E].start;B=K[E].count;var L=K[E].index;G=J;for(J+=B;G<J;G+=3)B=L+b[G],W=L+b[G+1],F=L+b[G+2],l=c[3*B],m=c[3*B+1],n=c[3*B+2],s=c[3*W],r=c[3*W+1],p=c[3*W+2],q=c[3*F],y=c[3*F+1],v=c[3*F+2],z=e[2*B],t=e[2*B+1],A=e[2*W],I=e[2*W+1],C=e[2*F],x=e[2*F+1],s-=l,l=q-l,r-=m,m=y-m,p-=n,n=v-n,A-=z,z=C-z,I-=t,t=x-t,x=1/(A*t-z*I),f.set((t*s-
|
|
|
-I*l)*x,(t*r-I*m)*x,(t*p-I*n)*x),g.set((A*l-z*s)*x,(A*m-z*r)*x,(A*n-z*p)*x),i[B].add(f),i[W].add(f),i[F].add(f),k[B].add(g),k[W].add(g),k[F].add(g)}var U=new THREE.Vector3,fa=new THREE.Vector3,Ca=new THREE.Vector3,$a=new THREE.Vector3,M,ca,qa;E=0;for(H=K.length;E<H;++E){J=K[E].start;B=K[E].count;L=K[E].index;G=J;for(J+=B;G<J;G+=3)B=L+b[G],W=L+b[G+1],F=L+b[G+2],a(B),a(W),a(F)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
+new THREE.Vector3,k[g]=new THREE.Vector3;var l,m,n,s,r,p,q,y,v,z,t,A,I,B,x,f=new THREE.Vector3,g=new THREE.Vector3,G,J,E,H,C,W,F,K=this.offsets;E=0;for(H=K.length;E<H;++E){J=K[E].start;C=K[E].count;var L=K[E].index;G=J;for(J+=C;G<J;G+=3)C=L+b[G],W=L+b[G+1],F=L+b[G+2],l=c[3*C],m=c[3*C+1],n=c[3*C+2],s=c[3*W],r=c[3*W+1],p=c[3*W+2],q=c[3*F],y=c[3*F+1],v=c[3*F+2],z=e[2*C],t=e[2*C+1],A=e[2*W],I=e[2*W+1],B=e[2*F],x=e[2*F+1],s-=l,l=q-l,r-=m,m=y-m,p-=n,n=v-n,A-=z,z=B-z,I-=t,t=x-t,x=1/(A*t-z*I),f.set((t*s-
|
|
|
+I*l)*x,(t*r-I*m)*x,(t*p-I*n)*x),g.set((A*l-z*s)*x,(A*m-z*r)*x,(A*n-z*p)*x),i[C].add(f),i[W].add(f),i[F].add(f),k[C].add(g),k[W].add(g),k[F].add(g)}var U=new THREE.Vector3,da=new THREE.Vector3,Fa=new THREE.Vector3,Pa=new THREE.Vector3,M,ea,wa;E=0;for(H=K.length;E<H;++E){J=K[E].start;C=K[E].count;L=K[E].index;G=J;for(J+=C;G<J;G+=3)C=L+b[G],W=L+b[G+1],F=L+b[G+2],a(C),a(W),a(F)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=
|
|
|
new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.groundColor=new THREE.Color(b);this.position=new THREE.Vector3(0,100,0);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=
|
|
@@ -194,33 +194,33 @@ a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(
|
|
|
k.uSpecularColor.value.setHex(i.specular),k.uAmbientColor.value.setHex(i.ambient),k.uShininess.value=i.shininess,void 0!==i.opacity&&(k.uOpacity.value=i.opacity),h=new THREE.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:k,lights:!0,fog:!0}),i.transparent&&(h.transparent=!0)):h=new THREE[h](i);void 0!==a.DbgName&&(h.name=a.DbgName);return h}};THREE.ImageLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),
|
|
|
e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,k,l,m,n,s,r,p,q,y,v,z,t=a.faces;r=a.vertices;var A=a.normals,I=a.colors,C=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&C++;for(f=0;f<C;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=r.length;i<k;)l=new THREE.Vector3,l.x=r[i++]*e,l.y=r[i++]*e,l.z=r[i++]*e,d.vertices.push(l);i=0;for(k=t.length;i<k;){r=t[i++];l=r&1;h=r&2;f=r&4;g=r&8;n=r&16;m=r&32;p=r&64;r&=128;l?(q=new THREE.Face4,
|
|
|
-q.a=t[i++],q.b=t[i++],q.c=t[i++],q.d=t[i++],l=4):(q=new THREE.Face3,q.a=t[i++],q.b=t[i++],q.c=t[i++],l=3);h&&(h=t[i++],q.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<C;f++)y=a.uvs[f],s=t[i++],z=y[2*s],s=y[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(z,s);if(g)for(f=0;f<C;f++){y=a.uvs[f];v=[];for(g=0;g<l;g++)s=t[i++],z=y[2*s],s=y[2*s+1],v[g]=new THREE.Vector2(z,s);d.faceVertexUvs[f][h]=v}n&&(n=3*t[i++],g=new THREE.Vector3,g.x=A[n++],g.y=A[n++],g.z=A[n],q.normal=g);if(m)for(f=0;f<l;f++)n=3*t[i++],g=
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,k,l,m,n,s,r,p,q,y,v,z,t=a.faces;r=a.vertices;var A=a.normals,I=a.colors,B=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&B++;for(f=0;f<B;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=r.length;i<k;)l=new THREE.Vector3,l.x=r[i++]*e,l.y=r[i++]*e,l.z=r[i++]*e,d.vertices.push(l);i=0;for(k=t.length;i<k;){r=t[i++];l=r&1;h=r&2;f=r&4;g=r&8;n=r&16;m=r&32;p=r&64;r&=128;l?(q=new THREE.Face4,
|
|
|
+q.a=t[i++],q.b=t[i++],q.c=t[i++],q.d=t[i++],l=4):(q=new THREE.Face3,q.a=t[i++],q.b=t[i++],q.c=t[i++],l=3);h&&(h=t[i++],q.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<B;f++)y=a.uvs[f],s=t[i++],z=y[2*s],s=y[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(z,s);if(g)for(f=0;f<B;f++){y=a.uvs[f];v=[];for(g=0;g<l;g++)s=t[i++],z=y[2*s],s=y[2*s+1],v[g]=new THREE.Vector2(z,s);d.faceVertexUvs[f][h]=v}n&&(n=3*t[i++],g=new THREE.Vector3,g.x=A[n++],g.y=A[n++],g.z=A[n],q.normal=g);if(m)for(f=0;f<l;f++)n=3*t[i++],g=
|
|
|
new THREE.Vector3,g.x=A[n++],g.y=A[n++],g.z=A[n],q.vertexNormals.push(g);p&&(m=t[i++],m=new THREE.Color(I[m]),q.color=m);if(r)for(f=0;f<l;f++)m=t[i++],m=new THREE.Color(I[m]),q.vertexColors.push(m);d.faces.push(q)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)t=a.skinWeights[i],A=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(t,A,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)t=a.skinIndices[i],A=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(t,A,0,0))}d.bones=
|
|
|
-a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];I=d.morphTargets[i].vertices;C=a.morphTargets[i].vertices;t=0;for(A=C.length;t<A;t+=3)r=new THREE.Vector3,r.x=C[t]*e,r.y=C[t+1]*e,r.z=C[t+2]*e,I.push(r)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
|
|
|
-[];A=d.morphColors[i].colors;I=a.morphColors[i].colors;e=0;for(t=I.length;e<t;e+=3)C=new THREE.Color(16755200),C.setRGB(I[e],I[e+1],I[e+2]),A.push(C)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
+a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];I=d.morphTargets[i].vertices;B=a.morphTargets[i].vertices;t=0;for(A=B.length;t<A;t+=3)r=new THREE.Vector3,r.x=B[t]*e,r.y=B[t+1]*e,r.z=B[t+2]*e,I.push(r)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
|
|
|
+[];A=d.morphColors[i].colors;I=a.morphColors[i].colors;e=0;for(t=I.length;e<t;e+=3)B=new THREE.Color(16755200),B.setRGB(I[e],I[e+1],I[e+2]),A.push(B)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
|
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){f(x.scene,J.objects)}function f(a,b){var c,e,g,i,k,m,p;for(p in b)if(void 0===x.objects[p]){var q=b[p],t=null;if(q.type&&q.type in l.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var B in q)B in e||(g[B]=q[B]);s=x.materials[q.material];q.loading=
|
|
|
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){f(x.scene,J.objects)}function f(a,b){var c,e,g,i,k,m,p;for(p in b)if(void 0===x.objects[p]){var q=b[p],t=null;if(q.type&&q.type in l.hierarchyHandlerMap){if(void 0===q.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var C in q)C in e||(g[C]=q[C]);s=x.materials[q.material];q.loading=
|
|
|
!0;e=l.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,J.urlBaseType),h(p,a,s,q)):e.load(d(q.url,J.urlBaseType),h(p,a,s,q),g)}}else if(void 0!==q.geometry){if(n=x.geometries[q.geometry]){t=!1;s=x.materials[q.material];t=s instanceof THREE.ShaderMaterial;g=q.position;i=q.rotation;k=q.scale;c=q.matrix;m=q.quaternion;q.material||(s=new THREE.MeshFaceMaterial(x.face_materials[q.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(x.face_materials[q.geometry]));
|
|
|
if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)t=t||s.materials[e]instanceof THREE.ShaderMaterial;t&&n.computeTangents();q.skin?t=new THREE.SkinnedMesh(n,s):q.morph?(t=new THREE.MorphAnimMesh(n,s),void 0!==q.duration&&(t.duration=q.duration),void 0!==q.time&&(t.time=q.time),void 0!==q.mirroredLoop&&(t.mirroredLoop=q.mirroredLoop),s.morphNormals&&n.computeMorphNormals()):t=new THREE.Mesh(n,s);t.name=p;c?(t.matrixAutoUpdate=!1,t.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])):(t.position.set(g[0],g[1],g[2]),m?(t.quaternion.set(m[0],m[1],m[2],m[3]),t.useQuaternion=!0):t.rotation.set(i[0],i[1],i[2]),t.scale.set(k[0],k[1],k[2]));t.visible=q.visible;t.castShadow=q.castShadow;t.receiveShadow=q.receiveShadow;a.add(t);x.objects[p]=t}}else"DirectionalLight"===q.type||"PointLight"===q.type||"AmbientLight"===q.type?(v=void 0!==q.color?q.color:16777215,z=void 0!==q.intensity?q.intensity:1,"DirectionalLight"===q.type?(g=q.direction,
|
|
|
y=new THREE.DirectionalLight(v,z),y.position.set(g[0],g[1],g[2]),q.target&&(G.push({object:y,targetName:q.target}),y.target=null)):"PointLight"===q.type?(g=q.position,e=q.distance,y=new THREE.PointLight(v,z,e),y.position.set(g[0],g[1],g[2])):"AmbientLight"===q.type&&(y=new THREE.AmbientLight(v)),a.add(y),y.name=p,x.lights[p]=y,x.objects[p]=y):"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?("PerspectiveCamera"===q.type?r=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===
|
|
|
q.type&&(r=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),g=q.position,r.position.set(g[0],g[1],g[2]),a.add(r),r.name=p,x.cameras[p]=r,x.objects[p]=r):(g=q.position,i=q.rotation,k=q.scale,m=q.quaternion,t=new THREE.Object3D,t.name=p,t.position.set(g[0],g[1],g[2]),m?(t.quaternion.set(m[0],m[1],m[2],m[3]),t.useQuaternion=!0):t.rotation.set(i[0],i[1],i[2]),t.scale.set(k[0],k[1],k[2]),t.visible=void 0!==q.visible?q.visible:!1,a.add(t),x.objects[p]=t,x.empties[p]=t);if(t){if(void 0!==
|
|
|
-q.properties)for(var C in q.properties)t.properties[C]=q.properties[C];if(void 0!==q.groups)for(e=0;e<q.groups.length;e++)g=q.groups[e],void 0===x.groups[g]&&(x.groups[g]=[]),x.groups[g].push(p);void 0!==q.children&&f(t,q.children)}}}function g(a){return function(b,c){x.geometries[a]=b;x.face_materials[a]=c;e();t-=1;l.onLoadComplete();k()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,n=d.scale;f.position.set(g[0],g[1],g[2]);
|
|
|
-i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(n[0],n[1],n[2]);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;x.objects[a]=f;e();t-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){x.geometries[a]=b;x.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:I,totalTextures:C,loadedModels:I-t,loadedTextures:C-A},x);l.onLoadProgress();if(0===
|
|
|
-t&&0===A){for(var a=0;a<G.length;a++){var c=G[a],d=x.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,x.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(x)}}var l=this,m=THREE.Loader.prototype.extractUrlBase(c),n,s,r,p,q,y,v,z,t,A,I,C,x,G=[],J=a,E;for(E in this.geometryHandlerMap)a=this.geometryHandlerMap[E].loaderClass,this.geometryHandlerMap[E].loaderObject=new a;for(E in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[E].loaderClass,
|
|
|
+q.properties)for(var B in q.properties)t.properties[B]=q.properties[B];if(void 0!==q.groups)for(e=0;e<q.groups.length;e++)g=q.groups[e],void 0===x.groups[g]&&(x.groups[g]=[]),x.groups[g].push(p);void 0!==q.children&&f(t,q.children)}}}function g(a){return function(b,c){x.geometries[a]=b;x.face_materials[a]=c;e();t-=1;l.onLoadComplete();k()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,n=d.scale;f.position.set(g[0],g[1],g[2]);
|
|
|
+i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(n[0],n[1],n[2]);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;x.objects[a]=f;e();t-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){x.geometries[a]=b;x.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:I,totalTextures:B,loadedModels:I-t,loadedTextures:B-A},x);l.onLoadProgress();if(0===
|
|
|
+t&&0===A){for(var a=0;a<G.length;a++){var c=G[a],d=x.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,x.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(x)}}var l=this,m=THREE.Loader.prototype.extractUrlBase(c),n,s,r,p,q,y,v,z,t,A,I,B,x,G=[],J=a,E;for(E in this.geometryHandlerMap)a=this.geometryHandlerMap[E].loaderClass,this.geometryHandlerMap[E].loaderObject=new a;for(E in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[E].loaderClass,
|
|
|
this.hierarchyHandlerMap[E].loaderObject=new a;A=t=0;x={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(J.transform&&(E=J.transform.position,a=J.transform.rotation,c=J.transform.scale,E&&x.scene.position.set(E[0],E[1],E[2]),a&&x.scene.rotation.set(a[0],a[1],a[2]),c&&x.scene.scale.set(c[0],c[1],c[2]),E||a||c))x.scene.updateMatrix(),x.scene.updateMatrixWorld();E=function(a){return function(){A-=a;k();l.onLoadComplete()}};
|
|
|
-for(var H in J.fogs)a=J.fogs[H],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),x.fogs[H]=p;for(var B in J.geometries)p=J.geometries[B],p.type in this.geometryHandlerMap&&(t+=1,l.onLoadStart());for(var W in J.objects)p=J.objects[W],p.type&&p.type in this.hierarchyHandlerMap&&(t+=1,l.onLoadStart());I=t;for(B in J.geometries)if(p=J.geometries[B],"cube"===p.type)n=new THREE.CubeGeometry(p.width,p.height,p.depth,
|
|
|
-p.widthSegments,p.heightSegments,p.depthSegments),x.geometries[B]=n;else if("plane"===p.type)n=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),x.geometries[B]=n;else if("sphere"===p.type)n=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),x.geometries[B]=n;else if("cylinder"===p.type)n=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),x.geometries[B]=n;else if("torus"===p.type)n=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,
|
|
|
-p.segmentsT),x.geometries[B]=n;else if("icosahedron"===p.type)n=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),x.geometries[B]=n;else if(p.type in this.geometryHandlerMap){W={};for(q in p)"type"!==q&&"url"!==q&&(W[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,J.urlBaseType),g(B),W)}else"embedded"===p.type&&(W=J.embeds[p.id],W.metadata=J.metadata,W&&this.geometryHandlerMap.ascii.loaderObject.createModel(W,i(B),""));for(var F in J.textures)if(B=J.textures[F],B.url instanceof
|
|
|
-Array){A+=B.url.length;for(q=0;q<B.url.length;q++)l.onLoadStart()}else A+=1,l.onLoadStart();C=A;for(F in J.textures){B=J.textures[F];void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){W=B.url.length;p=[];for(q=0;q<W;q++)p[q]=d(B.url[q],J.urlBaseType);q=(q=/\.dds$/i.test(p[0]))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,E(W)):THREE.ImageUtils.loadTextureCube(p,B.mapping,E(W))}else q=/\.dds$/i.test(B.url),W=d(B.url,J.urlBaseType),p=
|
|
|
-E(1),q=q?THREE.ImageUtils.loadCompressedTexture(W,B.mapping,p):THREE.ImageUtils.loadTexture(W,B.mapping,p),void 0!==THREE[B.minFilter]&&(q.minFilter=THREE[B.minFilter]),void 0!==THREE[B.magFilter]&&(q.magFilter=THREE[B.magFilter]),B.anisotropy&&(q.anisotropy=B.anisotropy),B.repeat&&(q.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),B.offset&&q.offset.set(B.offset[0],B.offset[1]),B.wrap&&(W={repeat:THREE.RepeatWrapping,
|
|
|
-mirror:THREE.MirroredRepeatWrapping},void 0!==W[B.wrap[0]]&&(q.wrapS=W[B.wrap[0]]),void 0!==W[B.wrap[1]]&&(q.wrapT=W[B.wrap[1]]));x.textures[F]=q}var K,L;for(K in J.materials){F=J.materials[K];for(L in F.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?F.parameters[L]=x.textures[F.parameters[L]]:"shading"===L?F.parameters[L]="flat"===F.parameters[L]?THREE.FlatShading:THREE.SmoothShading:"side"===L?F.parameters[L]="double"==F.parameters[L]?THREE.DoubleSide:"back"==F.parameters[L]?
|
|
|
+for(var H in J.fogs)a=J.fogs[H],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),x.fogs[H]=p;for(var C in J.geometries)p=J.geometries[C],p.type in this.geometryHandlerMap&&(t+=1,l.onLoadStart());for(var W in J.objects)p=J.objects[W],p.type&&p.type in this.hierarchyHandlerMap&&(t+=1,l.onLoadStart());I=t;for(C in J.geometries)if(p=J.geometries[C],"cube"===p.type)n=new THREE.CubeGeometry(p.width,p.height,p.depth,
|
|
|
+p.widthSegments,p.heightSegments,p.depthSegments),x.geometries[C]=n;else if("plane"===p.type)n=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),x.geometries[C]=n;else if("sphere"===p.type)n=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),x.geometries[C]=n;else if("cylinder"===p.type)n=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),x.geometries[C]=n;else if("torus"===p.type)n=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,
|
|
|
+p.segmentsT),x.geometries[C]=n;else if("icosahedron"===p.type)n=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),x.geometries[C]=n;else if(p.type in this.geometryHandlerMap){W={};for(q in p)"type"!==q&&"url"!==q&&(W[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,J.urlBaseType),g(C),W)}else"embedded"===p.type&&(W=J.embeds[p.id],W.metadata=J.metadata,W&&this.geometryHandlerMap.ascii.loaderObject.createModel(W,i(C),""));for(var F in J.textures)if(C=J.textures[F],C.url instanceof
|
|
|
+Array){A+=C.url.length;for(q=0;q<C.url.length;q++)l.onLoadStart()}else A+=1,l.onLoadStart();B=A;for(F in J.textures){C=J.textures[F];void 0!==C.mapping&&void 0!==THREE[C.mapping]&&(C.mapping=new THREE[C.mapping]);if(C.url instanceof Array){W=C.url.length;p=[];for(q=0;q<W;q++)p[q]=d(C.url[q],J.urlBaseType);q=(q=/\.dds$/i.test(p[0]))?THREE.ImageUtils.loadCompressedTextureCube(p,C.mapping,E(W)):THREE.ImageUtils.loadTextureCube(p,C.mapping,E(W))}else q=/\.dds$/i.test(C.url),W=d(C.url,J.urlBaseType),p=
|
|
|
+E(1),q=q?THREE.ImageUtils.loadCompressedTexture(W,C.mapping,p):THREE.ImageUtils.loadTexture(W,C.mapping,p),void 0!==THREE[C.minFilter]&&(q.minFilter=THREE[C.minFilter]),void 0!==THREE[C.magFilter]&&(q.magFilter=THREE[C.magFilter]),C.anisotropy&&(q.anisotropy=C.anisotropy),C.repeat&&(q.repeat.set(C.repeat[0],C.repeat[1]),1!==C.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==C.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),C.offset&&q.offset.set(C.offset[0],C.offset[1]),C.wrap&&(W={repeat:THREE.RepeatWrapping,
|
|
|
+mirror:THREE.MirroredRepeatWrapping},void 0!==W[C.wrap[0]]&&(q.wrapS=W[C.wrap[0]]),void 0!==W[C.wrap[1]]&&(q.wrapT=W[C.wrap[1]]));x.textures[F]=q}var K,L;for(K in J.materials){F=J.materials[K];for(L in F.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?F.parameters[L]=x.textures[F.parameters[L]]:"shading"===L?F.parameters[L]="flat"===F.parameters[L]?THREE.FlatShading:THREE.SmoothShading:"side"===L?F.parameters[L]="double"==F.parameters[L]?THREE.DoubleSide:"back"==F.parameters[L]?
|
|
|
THREE.BackSide:THREE.FrontSide:"blending"===L?F.parameters[L]=F.parameters[L]in THREE?THREE[F.parameters[L]]:THREE.NormalBlending:"combine"===L?F.parameters[L]=F.parameters[L]in THREE?THREE[F.parameters[L]]:THREE.MultiplyOperation:"vertexColors"===L?"face"==F.parameters[L]?F.parameters[L]=THREE.FaceColors:F.parameters[L]&&(F.parameters[L]=THREE.VertexColors):"wrapRGB"===L&&(E=F.parameters[L],F.parameters[L]=new THREE.Vector3(E[0],E[1],E[2]));void 0!==F.parameters.opacity&&1>F.parameters.opacity&&
|
|
|
-(F.parameters.transparent=!0);F.parameters.normalMap?(E=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(E.uniforms),q=F.parameters.color,W=F.parameters.specular,p=F.parameters.ambient,H=F.parameters.shininess,B.tNormal.value=x.textures[F.parameters.normalMap],F.parameters.normalScale&&B.uNormalScale.value.set(F.parameters.normalScale[0],F.parameters.normalScale[1]),F.parameters.map&&(B.tDiffuse.value=F.parameters.map,B.enableDiffuse.value=!0),F.parameters.envMap&&(B.tCube.value=F.parameters.envMap,
|
|
|
-B.enableReflection.value=!0,B.uReflectivity.value=F.parameters.reflectivity),F.parameters.lightMap&&(B.tAO.value=F.parameters.lightMap,B.enableAO.value=!0),F.parameters.specularMap&&(B.tSpecular.value=x.textures[F.parameters.specularMap],B.enableSpecular.value=!0),F.parameters.displacementMap&&(B.tDisplacement.value=x.textures[F.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=F.parameters.displacementBias,B.uDisplacementScale.value=F.parameters.displacementScale),
|
|
|
-B.uDiffuseColor.value.setHex(q),B.uSpecularColor.value.setHex(W),B.uAmbientColor.value.setHex(p),B.uShininess.value=H,F.parameters.opacity&&(B.uOpacity.value=F.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:E.fragmentShader,vertexShader:E.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[F.type](F.parameters);x.materials[K]=s}for(K in J.materials)if(F=J.materials[K],F.parameters.materials){L=[];for(q=0;q<F.parameters.materials.length;q++)L.push(x.materials[F.parameters.materials[q]]);
|
|
|
+(F.parameters.transparent=!0);F.parameters.normalMap?(E=THREE.ShaderLib.normalmap,C=THREE.UniformsUtils.clone(E.uniforms),q=F.parameters.color,W=F.parameters.specular,p=F.parameters.ambient,H=F.parameters.shininess,C.tNormal.value=x.textures[F.parameters.normalMap],F.parameters.normalScale&&C.uNormalScale.value.set(F.parameters.normalScale[0],F.parameters.normalScale[1]),F.parameters.map&&(C.tDiffuse.value=F.parameters.map,C.enableDiffuse.value=!0),F.parameters.envMap&&(C.tCube.value=F.parameters.envMap,
|
|
|
+C.enableReflection.value=!0,C.uReflectivity.value=F.parameters.reflectivity),F.parameters.lightMap&&(C.tAO.value=F.parameters.lightMap,C.enableAO.value=!0),F.parameters.specularMap&&(C.tSpecular.value=x.textures[F.parameters.specularMap],C.enableSpecular.value=!0),F.parameters.displacementMap&&(C.tDisplacement.value=x.textures[F.parameters.displacementMap],C.enableDisplacement.value=!0,C.uDisplacementBias.value=F.parameters.displacementBias,C.uDisplacementScale.value=F.parameters.displacementScale),
|
|
|
+C.uDiffuseColor.value.setHex(q),C.uSpecularColor.value.setHex(W),C.uAmbientColor.value.setHex(p),C.uShininess.value=H,F.parameters.opacity&&(C.uOpacity.value=F.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:E.fragmentShader,vertexShader:E.vertexShader,uniforms:C,lights:!0,fog:!0})):s=new THREE[F.type](F.parameters);x.materials[K]=s}for(K in J.materials)if(F=J.materials[K],F.parameters.materials){L=[];for(q=0;q<F.parameters.materials.length;q++)L.push(x.materials[F.parameters.materials[q]]);
|
|
|
x.materials[K].materials=L}e();x.cameras&&J.defaults.camera&&(x.currentCamera=x.cameras[J.defaults.camera]);x.fogs&&J.defaults.fog&&(x.scene.fog=x.fogs[J.defaults.fog]);l.callbackSync(x);k()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype.setValues=function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
|
|
|
THREE.Material.prototype.clone=function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
|
|
@@ -264,37 +264,36 @@ THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInver
|
|
|
!1}};THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);(1!==this.scale.x||1!==this.scale.y)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0};
|
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
-THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){C!==a&&(C=t.globalAlpha=a)}function c(a){x!==a&&(a===THREE.NormalBlending?t.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?t.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(t.globalCompositeOperation="darker"),x=a)}function d(a){E!==a&&(E=t.lineWidth=a)}function e(a){H!==a&&(H=t.lineCap=a)}function f(a){B!==a&&(B=t.lineJoin=a)}function g(a){G!==a&&(G=t.strokeStyle=a)}function h(a){J!==a&&(J=t.fillStyle=a)}function i(a,
|
|
|
-b){if(W!==a||F!==b)t.setLineDash([a,b]),W=a,F=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var k=THREE.Math.smoothstep,a=a||{},l=this,m,n,s,r=new THREE.Projector,p=void 0!==a.canvas?a.canvas:document.createElement("canvas"),q,y,v,z,t=p.getContext("2d"),A=new THREE.Color(0),I=0,C=1,x=0,G=null,J=null,E=null,H=null,B=null,W=null,F=0,K,L,U,fa,Ca=new THREE.RenderableVertex,$a=new THREE.RenderableVertex,M,ca,qa,ha,ra,N,Ma,Na,mb,Pa,ta,ka,aa=new THREE.Color,pa=new THREE.Color,Y=new THREE.Color,da=
|
|
|
-new THREE.Color,la=new THREE.Color,Z=new THREE.Color,oa=new THREE.Color,gb=new THREE.Color,nb={},ia={},Wa,ab,Fa,Xa,ub,Ib,Jb,fc,Ab,mc,pb=new THREE.Box2,Ka=new THREE.Box2,Va=new THREE.Box2,gc=!1,vb=new THREE.Color,Qa=new THREE.Color,La=new THREE.Color,bb=new THREE.Vector3,xb,j,yb,Ra,cb,Sa,zb=16;xb=document.createElement("canvas");xb.width=xb.height=2;j=xb.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);yb=j.getImageData(0,0,2,2);Ra=yb.data;cb=document.createElement("canvas");cb.width=
|
|
|
-cb.height=zb;Sa=cb.getContext("2d");Sa.translate(-zb/2,-zb/2);Sa.scale(zb,zb);zb--;void 0===t.setLineDash&&(t.setLineDash=void 0!==t.mozDash?function(a){t.mozDash=null!==a[0]?a:null}:function(){});this.domElement=p;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};
|
|
|
-this.setSize=function(a,b){q=a*this.devicePixelRatio;y=b*this.devicePixelRatio;v=Math.floor(q/2);z=Math.floor(y/2);p.width=q;p.height=y;p.style.width=a+"px";p.style.height=b+"px";pb.set(new THREE.Vector2(-v,-z),new THREE.Vector2(v,z));Ka.set(new THREE.Vector2(-v,-z),new THREE.Vector2(v,z));C=1;x=0;B=H=E=J=G=null};this.setClearColor=function(a,b){A.copy(a);I=void 0!==b?b:1;Ka.set(new THREE.Vector2(-v,-z),new THREE.Vector2(v,z))};this.setClearColorHex=function(a,b){A.setHex(a);I=void 0!==b?b:1;Ka.set(new THREE.Vector2(-v,
|
|
|
--z),new THREE.Vector2(v,z))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){t.setTransform(1,0,0,-1,v,z);!1===Ka.empty()&&(Ka.intersect(pb),Ka.expandByScalar(2),1>I&&t.clearRect(Ka.min.x|0,Ka.min.y|0,Ka.max.x-Ka.min.x|0,Ka.max.y-Ka.min.y|0),0<I&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*A.r)+","+Math.floor(255*A.g)+","+Math.floor(255*A.b)+","+I+")"),t.fillRect(Ka.min.x|0,Ka.min.y|0,Ka.max.x-Ka.min.x|0,Ka.max.y-Ka.min.y|0)),Ka.makeEmpty())};this.render=function(a,p){function q(a,
|
|
|
-b,c){for(var d=0,e=s.length;d<e;d++){var f=s[d];gb.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=bb.getPositionFromMatrix(f.matrixWorld).normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(gb.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=bb.getPositionFromMatrix(f.matrixWorld),j=b.dot(bb.subVectors(g,a).normalize()),0>=j||(j*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=j&&(j*=f.intensity,c.add(gb.multiplyScalar(j)))))}}function x(a,d,e,f,g,j,h,i){l.info.render.vertices+=
|
|
|
-3;l.info.render.faces++;b(i.opacity);c(i.blending);M=a.positionScreen.x;ca=a.positionScreen.y;qa=d.positionScreen.x;ha=d.positionScreen.y;ra=e.positionScreen.x;N=e.positionScreen.y;y(M,ca,qa,ha,ra,N);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(Z.copy(i.color),oa.copy(i.emissive),i.vertexColors===THREE.FaceColors&&Z.multiply(h.color),!0===gc?!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(pa.copy(vb),Y.copy(vb),da.copy(vb),
|
|
|
-q(h.v1.positionWorld,h.vertexNormalsModel[0],pa),q(h.v2.positionWorld,h.vertexNormalsModel[1],Y),q(h.v3.positionWorld,h.vertexNormalsModel[2],da),pa.multiply(Z).add(oa),Y.multiply(Z).add(oa),da.multiply(Z).add(oa),la.addColors(Y,da).multiplyScalar(0.5),Fa=E(pa,Y,da,la),G(M,ca,qa,ha,ra,N,0,0,1,0,0,1,Fa)):(aa.copy(vb),q(h.centroidModel,h.normalModel,aa),aa.multiply(Z).add(oa),!0===i.wireframe?C(aa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(aa)):!0===i.wireframe?C(i.color,i.wireframeLinewidth,
|
|
|
-i.wireframeLinecap,i.wireframeLinejoin):A(i.color)):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Xa=h.uvs[0],F(M,ca,qa,ha,ra,N,Xa[f].x,Xa[f].y,Xa[g].x,Xa[g].y,Xa[j].x,Xa[j].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(bb.copy(h.vertexNormalsModelView[f]),ub=0.5*bb.x+0.5,Ib=0.5*bb.y+0.5,bb.copy(h.vertexNormalsModelView[g]),Jb=0.5*
|
|
|
-bb.x+0.5,fc=0.5*bb.y+0.5,bb.copy(h.vertexNormalsModelView[j]),Ab=0.5*bb.x+0.5,mc=0.5*bb.y+0.5,F(M,ca,qa,ha,ra,N,ub,Ib,Jb,fc,Ab,mc,i.envMap)):(aa.copy(i.color),i.vertexColors===THREE.FaceColors&&aa.multiply(h.color),!0===i.wireframe?C(aa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(aa)):i instanceof THREE.MeshDepthMaterial?(Wa=p.near,ab=p.far,pa.r=pa.g=pa.b=1-k(a.positionScreen.z*a.positionScreen.w,Wa,ab),Y.r=Y.g=Y.b=1-k(d.positionScreen.z*d.positionScreen.w,Wa,ab),da.r=da.g=da.b=
|
|
|
-1-k(e.positionScreen.z*e.positionScreen.w,Wa,ab),la.addColors(Y,da).multiplyScalar(0.5),Fa=E(pa,Y,da,la),G(M,ca,qa,ha,ra,N,0,0,1,0,0,1,Fa)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(a=h.normalModelView,aa.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?C(aa,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(aa)):i.shading==THREE.SmoothShading&&(a=h.vertexNormalsModelView[f],pa.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=
|
|
|
-h.vertexNormalsModelView[g],Y.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=h.vertexNormalsModelView[j],da.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),la.addColors(Y,da).multiplyScalar(0.5),Fa=E(pa,Y,da,la),G(M,ca,qa,ha,ra,N,0,0,1,0,0,1,Fa)))}function y(a,b,c,d,e,f){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.closePath()}function B(a,b,c,d,e,f,g,j){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.lineTo(g,j);t.closePath()}function C(a,b,c,j){d(b);e(c);
|
|
|
-f(j);g(a.getStyle());t.stroke();Va.expandByScalar(2*b)}function A(a){h(a.getStyle());t.fill()}function F(a,b,c,d,e,f,g,j,i,wa,k,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var m=n.wrapS==THREE.RepeatWrapping,hb=n.wrapT==THREE.RepeatWrapping;nb[n.id]=t.createPattern(n.image,!0===m&&!0===hb?"repeat":!0===m&&!1===hb?"repeat-x":!1===m&&!0===hb?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===nb[n.id]?h("rgba(0,0,0,1)"):h(nb[n.id]);var m=n.offset.x/
|
|
|
-n.repeat.x,hb=n.offset.y/n.repeat.y,p=n.image.width*n.repeat.x,q=n.image.height*n.repeat.y,g=(g+m)*p,j=(1-j+hb)*q,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+m)*p-g,wa=(1-wa+hb)*q-j,k=(k+m)*p-g,l=(1-l+hb)*q-j,m=i*l-k*wa;0===m?(void 0===ia[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),ia[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ia[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),aa.setRGB(b[g]/255,
|
|
|
-b[g+1]/255,b[g+2]/255),A(aa)):(m=1/m,n=(l*c-wa*e)*m,wa=(l*d-wa*f)*m,c=(i*e-k*c)*m,d=(i*f-k*d)*m,a=a-n*g-c*j,g=b-wa*g-d*j,t.save(),t.transform(n,wa,c,d,a,g),t.fill(),t.restore())}}function G(a,b,c,d,e,f,g,j,i,h,wa,k,n){var l,m;l=n.width-1;m=n.height-1;g*=l;j*=m;c-=a;d-=b;e-=a;f-=b;i=i*l-g;h=h*m-j;wa=wa*l-g;k=k*m-j;m=1/(i*k-wa*h);l=(k*c-h*e)*m;h=(k*d-h*f)*m;c=(i*e-wa*c)*m;d=(i*f-wa*d)*m;a=a-l*g-c*j;b=b-h*g-d*j;t.save();t.transform(l,h,c,d,a,b);t.clip();t.drawImage(n,0,0);t.restore()}function E(a,b,
|
|
|
-c,d){Ra[0]=255*a.r|0;Ra[1]=255*a.g|0;Ra[2]=255*a.b|0;Ra[4]=255*b.r|0;Ra[5]=255*b.g|0;Ra[6]=255*b.b|0;Ra[8]=255*c.r|0;Ra[9]=255*c.g|0;Ra[10]=255*c.b|0;Ra[12]=255*d.r|0;Ra[13]=255*d.g|0;Ra[14]=255*d.b|0;j.putImageData(yb,0,0);Sa.drawImage(xb,0,0);return cb}function I(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===p instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===
|
|
|
-this.autoClear&&this.clear();t.setTransform(1,0,0,-1,v,z);l.info.render.vertices=0;l.info.render.faces=0;m=r.projectScene(a,p,this.sortObjects,this.sortElements);n=m.elements;s=m.lights;gc=0<s.length;if(!0===gc){vb.setRGB(0,0,0);Qa.setRGB(0,0,0);La.setRGB(0,0,0);for(var J=0,W=s.length;J<W;J++){var P=s[J],X=P.color;P instanceof THREE.AmbientLight?vb.add(X):P instanceof THREE.DirectionalLight?Qa.add(X):P instanceof THREE.PointLight&&La.add(X)}}J=0;for(W=n.length;J<W;J++){var H=n[J],P=H.material;if(!(void 0===
|
|
|
-P||!1===P.visible)){Va.makeEmpty();if(H instanceof THREE.RenderableParticle){K=H;K.x*=v;K.y*=z;var X=K,wa=H;b(P.opacity);c(P.blending);var Bb=void 0,hb=void 0,Cb=void 0,Db=void 0,md=H=void 0,nd=void 0;P instanceof THREE.ParticleBasicMaterial?null===P.map?(Cb=wa.object.scale.x,Db=wa.object.scale.y,Cb*=wa.scale.x*v,Db*=wa.scale.y*z,Va.min.set(X.x-Cb,X.y-Db),Va.max.set(X.x+Cb,X.y+Db),!1!==pb.isIntersectionBox(Va)&&(h(P.color.getStyle()),t.save(),t.translate(X.x,X.y),t.rotate(-wa.rotation),t.scale(Cb,
|
|
|
-Db),t.fillRect(-1,-1,2,2),t.restore())):(H=P.map.image,md=H.width>>1,nd=H.height>>1,Cb=wa.scale.x*v,Db=wa.scale.y*z,Bb=Cb*md,hb=Db*nd,Va.min.set(X.x-Bb,X.y-hb),Va.max.set(X.x+Bb,X.y+hb),!1!==pb.isIntersectionBox(Va)&&(t.save(),t.translate(X.x,X.y),t.rotate(-wa.rotation),t.scale(Cb,-Db),t.translate(-md,-nd),t.drawImage(H,0,0),t.restore())):P instanceof THREE.ParticleCanvasMaterial&&(Bb=wa.scale.x*v,hb=wa.scale.y*z,Va.min.set(X.x-Bb,X.y-hb),Va.max.set(X.x+Bb,X.y+hb),!1!==pb.isIntersectionBox(Va)&&(g(P.color.getStyle()),
|
|
|
-h(P.color.getStyle()),t.save(),t.translate(X.x,X.y),t.rotate(-wa.rotation),t.scale(Bb,hb),P.program(t),t.restore()))}else if(H instanceof THREE.RenderableLine)K=H.v1,L=H.v2,K.positionScreen.x*=v,K.positionScreen.y*=z,L.positionScreen.x*=v,L.positionScreen.y*=z,Va.setFromPoints([K.positionScreen,L.positionScreen]),!0===pb.isIntersectionBox(Va)&&(X=K,wa=L,b(P.opacity),c(P.blending),t.beginPath(),t.moveTo(X.positionScreen.x,X.positionScreen.y),t.lineTo(wa.positionScreen.x,wa.positionScreen.y),P instanceof
|
|
|
-THREE.LineBasicMaterial?(d(P.linewidth),e(P.linecap),f(P.linejoin),g(P.color.getStyle()),i(null,null),t.stroke(),Va.expandByScalar(2*P.linewidth)):P instanceof THREE.LineDashedMaterial&&(d(P.linewidth),e(P.linecap),f(P.linejoin),g(P.color.getStyle()),i(P.dashSize,P.gapSize),t.stroke(),Va.expandByScalar(2*P.linewidth)));else if(H instanceof THREE.RenderableFace3){K=H.v1;L=H.v2;U=H.v3;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>
|
|
|
-U.positionScreen.z||1<U.positionScreen.z)continue;K.positionScreen.x*=v;K.positionScreen.y*=z;L.positionScreen.x*=v;L.positionScreen.y*=z;U.positionScreen.x*=v;U.positionScreen.y*=z;!0===P.overdraw&&(I(K.positionScreen,L.positionScreen),I(L.positionScreen,U.positionScreen),I(U.positionScreen,K.positionScreen));Va.setFromPoints([K.positionScreen,L.positionScreen,U.positionScreen]);x(K,L,U,0,1,2,H,P)}else if(H instanceof THREE.RenderableFace4){K=H.v1;L=H.v2;U=H.v3;fa=H.v4;if(-1>K.positionScreen.z||
|
|
|
-1<K.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>U.positionScreen.z||1<U.positionScreen.z)continue;if(-1>fa.positionScreen.z||1<fa.positionScreen.z)continue;K.positionScreen.x*=v;K.positionScreen.y*=z;L.positionScreen.x*=v;L.positionScreen.y*=z;U.positionScreen.x*=v;U.positionScreen.y*=z;fa.positionScreen.x*=v;fa.positionScreen.y*=z;Ca.positionScreen.copy(L.positionScreen);$a.positionScreen.copy(fa.positionScreen);!0===P.overdraw&&(I(K.positionScreen,L.positionScreen),
|
|
|
-I(L.positionScreen,fa.positionScreen),I(fa.positionScreen,K.positionScreen),I(U.positionScreen,Ca.positionScreen),I(U.positionScreen,$a.positionScreen));Va.setFromPoints([K.positionScreen,L.positionScreen,U.positionScreen,fa.positionScreen]);X=K;wa=L;Bb=U;hb=fa;Cb=Ca;Db=$a;l.info.render.vertices+=4;l.info.render.faces++;b(P.opacity);c(P.blending);void 0!==P.map&&null!==P.map||void 0!==P.envMap&&null!==P.envMap?(x(X,wa,hb,0,1,3,H,P),x(Cb,Bb,Db,1,2,3,H,P)):(M=X.positionScreen.x,ca=X.positionScreen.y,
|
|
|
-qa=wa.positionScreen.x,ha=wa.positionScreen.y,ra=Bb.positionScreen.x,N=Bb.positionScreen.y,Ma=hb.positionScreen.x,Na=hb.positionScreen.y,mb=Cb.positionScreen.x,Pa=Cb.positionScreen.y,ta=Db.positionScreen.x,ka=Db.positionScreen.y,P instanceof THREE.MeshLambertMaterial||P instanceof THREE.MeshPhongMaterial?(Z.copy(P.color),oa.copy(P.emissive),P.vertexColors===THREE.FaceColors&&Z.multiply(H.color),!0===gc?!1===P.wireframe&&P.shading==THREE.SmoothShading&&4==H.vertexNormalsLength?(pa.copy(vb),Y.copy(vb),
|
|
|
-da.copy(vb),la.copy(vb),q(H.v1.positionWorld,H.vertexNormalsModel[0],pa),q(H.v2.positionWorld,H.vertexNormalsModel[1],Y),q(H.v4.positionWorld,H.vertexNormalsModel[3],da),q(H.v3.positionWorld,H.vertexNormalsModel[2],la),pa.multiply(Z).add(oa),Y.multiply(Z).add(oa),da.multiply(Z).add(oa),la.multiply(Z).add(oa),Fa=E(pa,Y,da,la),y(M,ca,qa,ha,Ma,Na),G(M,ca,qa,ha,Ma,Na,0,0,1,0,0,1,Fa),y(mb,Pa,ra,N,ta,ka),G(mb,Pa,ra,N,ta,ka,1,0,1,1,0,1,Fa)):(aa.copy(vb),q(H.centroidModel,H.normalModel,aa),aa.multiply(Z).add(oa),
|
|
|
-B(M,ca,qa,ha,ra,N,Ma,Na),!0===P.wireframe?C(aa,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):A(aa)):(aa.addColors(Z,oa),B(M,ca,qa,ha,ra,N,Ma,Na),!0===P.wireframe?C(aa,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):A(aa))):P instanceof THREE.MeshBasicMaterial?(aa.copy(P.color),P.vertexColors===THREE.FaceColors&&aa.multiply(H.color),B(M,ca,qa,ha,ra,N,Ma,Na),!0===P.wireframe?C(aa,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):A(aa)):P instanceof THREE.MeshNormalMaterial?
|
|
|
-(X=void 0,P.shading==THREE.FlatShading?(X=H.normalModelView,aa.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),B(M,ca,qa,ha,ra,N,Ma,Na),!0===P.wireframe?C(aa,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):A(aa)):P.shading==THREE.SmoothShading&&(X=H.vertexNormalsModelView[0],pa.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),X=H.vertexNormalsModelView[1],Y.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),X=H.vertexNormalsModelView[3],da.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
-X=H.vertexNormalsModelView[2],la.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),Fa=E(pa,Y,da,la),y(M,ca,qa,ha,Ma,Na),G(M,ca,qa,ha,Ma,Na,0,0,1,0,0,1,Fa),y(mb,Pa,ra,N,ta,ka),G(mb,Pa,ra,N,ta,ka,1,0,1,1,0,1,Fa))):P instanceof THREE.MeshDepthMaterial&&(Wa=p.near,ab=p.far,pa.r=pa.g=pa.b=1-k(X.positionScreen.z*X.positionScreen.w,Wa,ab),Y.r=Y.g=Y.b=1-k(wa.positionScreen.z*wa.positionScreen.w,Wa,ab),da.r=da.g=da.b=1-k(hb.positionScreen.z*hb.positionScreen.w,Wa,ab),la.r=la.g=la.b=1-k(Bb.positionScreen.z*
|
|
|
-Bb.positionScreen.w,Wa,ab),Fa=E(pa,Y,da,la),y(M,ca,qa,ha,Ma,Na),G(M,ca,qa,ha,Ma,Na,0,0,1,0,0,1,Fa),y(mb,Pa,ra,N,ta,ka),G(mb,Pa,ra,N,ta,ka,1,0,1,1,0,1,Fa)))}Ka.union(Va)}}t.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
+THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){B!==a&&(B=t.globalAlpha=a)}function c(a){x!==a&&(a===THREE.NormalBlending?t.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?t.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(t.globalCompositeOperation="darker"),x=a)}function d(a){E!==a&&(E=t.lineWidth=a)}function e(a){H!==a&&(H=t.lineCap=a)}function f(a){C!==a&&(C=t.lineJoin=a)}function g(a){G!==a&&(G=t.strokeStyle=a)}function h(a){J!==a&&(J=t.fillStyle=a)}function i(a,
|
|
|
+b){if(W!==a||F!==b)t.setLineDash([a,b]),W=a,F=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var k=THREE.Math.smoothstep,a=a||{},l=this,m,n,s,r=new THREE.Projector,p=void 0!==a.canvas?a.canvas:document.createElement("canvas"),q,y,v,z,t=p.getContext("2d"),A=new THREE.Color(0),I=0,B=1,x=0,G=null,J=null,E=null,H=null,C=null,W=null,F=0,K,L,U,da,Fa=new THREE.RenderableVertex,Pa=new THREE.RenderableVertex,M,ea,wa,ia,sa,N,Na,pb,ab,Oa,Ea,ma,ga=new THREE.Color,pa=new THREE.Color,Y=new THREE.Color,ba=
|
|
|
+new THREE.Color,ja=new THREE.Color,Z=new THREE.Color,qa=new THREE.Color,bb=new THREE.Color,mb={},ha={},cb,Va,Wa,Qa,yb,Hb,Ib,ec,Ab,kc,qb=new THREE.Box2,Ka=new THREE.Box2,Ba=new THREE.Box2,rb=new THREE.Color,wc=new THREE.Color,Ra=new THREE.Color,ka=new THREE.Vector3,db,zb,j,Xa,wb,nb,Ya=16;db=document.createElement("canvas");db.width=db.height=2;zb=db.getContext("2d");zb.fillStyle="rgba(0,0,0,1)";zb.fillRect(0,0,2,2);j=zb.getImageData(0,0,2,2);Xa=j.data;wb=document.createElement("canvas");wb.width=wb.height=
|
|
|
+Ya;nb=wb.getContext("2d");nb.translate(-Ya/2,-Ya/2);nb.scale(Ya,Ya);Ya--;void 0===t.setLineDash&&(t.setLineDash=void 0!==t.mozDash?function(a){t.mozDash=null!==a[0]?a:null}:function(){});this.domElement=p;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=
|
|
|
+function(a,b){q=a*this.devicePixelRatio;y=b*this.devicePixelRatio;v=Math.floor(q/2);z=Math.floor(y/2);p.width=q;p.height=y;p.style.width=a+"px";p.style.height=b+"px";qb.set(new THREE.Vector2(-v,-z),new THREE.Vector2(v,z));Ka.set(new THREE.Vector2(-v,-z),new THREE.Vector2(v,z));B=1;x=0;C=H=E=J=G=null};this.setClearColor=function(a,b){A.copy(a);I=void 0!==b?b:1;Ka.set(new THREE.Vector2(-v,-z),new THREE.Vector2(v,z))};this.setClearColorHex=function(a,b){A.setHex(a);I=void 0!==b?b:1;Ka.set(new THREE.Vector2(-v,
|
|
|
+-z),new THREE.Vector2(v,z))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){t.setTransform(1,0,0,-1,v,z);!1===Ka.empty()&&(Ka.intersect(qb),Ka.expandByScalar(2),1>I&&t.clearRect(Ka.min.x|0,Ka.min.y|0,Ka.max.x-Ka.min.x|0,Ka.max.y-Ka.min.y|0),0<I&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*A.r)+","+Math.floor(255*A.g)+","+Math.floor(255*A.b)+","+I+")"),t.fillRect(Ka.min.x|0,Ka.min.y|0,Ka.max.x-Ka.min.x|0,Ka.max.y-Ka.min.y|0)),Ka.makeEmpty())};this.render=function(a,p){function q(a,
|
|
|
+b,c){for(var d=0,e=s.length;d<e;d++){var f=s[d];bb.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ka.getPositionFromMatrix(f.matrixWorld).normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(bb.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=ka.getPositionFromMatrix(f.matrixWorld),j=b.dot(ka.subVectors(g,a).normalize()),0>=j||(j*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=j&&(j*=f.intensity,c.add(bb.multiplyScalar(j)))))}}function x(a,d,e,f,g,j,h,i){l.info.render.vertices+=
|
|
|
+3;l.info.render.faces++;b(i.opacity);c(i.blending);M=a.positionScreen.x;ea=a.positionScreen.y;wa=d.positionScreen.x;ia=d.positionScreen.y;sa=e.positionScreen.x;N=e.positionScreen.y;y(M,ea,wa,ia,sa,N);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(Z.copy(i.color),qa.copy(i.emissive),i.vertexColors===THREE.FaceColors&&Z.multiply(h.color),!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(pa.copy(rb),Y.copy(rb),ba.copy(rb),q(h.v1.positionWorld,
|
|
|
+h.vertexNormalsModel[0],pa),q(h.v2.positionWorld,h.vertexNormalsModel[1],Y),q(h.v3.positionWorld,h.vertexNormalsModel[2],ba),pa.multiply(Z).add(qa),Y.multiply(Z).add(qa),ba.multiply(Z).add(qa),ja.addColors(Y,ba).multiplyScalar(0.5),Wa=E(pa,Y,ba,ja),G(M,ea,wa,ia,sa,N,0,0,1,0,0,1,Wa)):(ga.copy(rb),q(h.centroidModel,h.normalModel,ga),ga.multiply(Z).add(qa),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga))):i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||
|
|
|
+i instanceof THREE.MeshPhongMaterial?null!==i.map?i.map.mapping instanceof THREE.UVMapping&&(Qa=h.uvs[0],F(M,ea,wa,ia,sa,N,Qa[f].x,Qa[f].y,Qa[g].x,Qa[g].y,Qa[j].x,Qa[j].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ka.copy(h.vertexNormalsModelView[f]),yb=0.5*ka.x+0.5,Hb=0.5*ka.y+0.5,ka.copy(h.vertexNormalsModelView[g]),Ib=0.5*ka.x+0.5,ec=0.5*ka.y+0.5,ka.copy(h.vertexNormalsModelView[j]),Ab=0.5*ka.x+0.5,kc=0.5*ka.y+0.5,F(M,ea,wa,ia,sa,N,yb,Hb,Ib,ec,Ab,kc,
|
|
|
+i.envMap)):(ga.copy(i.color),i.vertexColors===THREE.FaceColors&&ga.multiply(h.color),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i instanceof THREE.MeshDepthMaterial?(cb=p.near,Va=p.far,pa.r=pa.g=pa.b=1-k(a.positionScreen.z*a.positionScreen.w,cb,Va),Y.r=Y.g=Y.b=1-k(d.positionScreen.z*d.positionScreen.w,cb,Va),ba.r=ba.g=ba.b=1-k(e.positionScreen.z*e.positionScreen.w,cb,Va),ja.addColors(Y,ba).multiplyScalar(0.5),Wa=E(pa,Y,ba,ja),G(M,ea,wa,ia,sa,N,0,0,1,
|
|
|
+0,0,1,Wa)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(a=h.normalModelView,ga.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?B(ga,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ga)):i.shading==THREE.SmoothShading&&(a=h.vertexNormalsModelView[f],pa.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=h.vertexNormalsModelView[g],Y.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=h.vertexNormalsModelView[j],ba.setRGB(a.x,
|
|
|
+a.y,a.z).multiplyScalar(0.5).addScalar(0.5),ja.addColors(Y,ba).multiplyScalar(0.5),Wa=E(pa,Y,ba,ja),G(M,ea,wa,ia,sa,N,0,0,1,0,0,1,Wa)))}function y(a,b,c,d,e,f){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.closePath()}function C(a,b,c,d,e,f,g,j){t.beginPath();t.moveTo(a,b);t.lineTo(c,d);t.lineTo(e,f);t.lineTo(g,j);t.closePath()}function B(a,b,c,j){d(b);e(c);f(j);g(a.getStyle());t.stroke();Ba.expandByScalar(2*b)}function A(a){h(a.getStyle());t.fill()}function F(a,b,c,d,e,f,g,j,i,La,k,l,
|
|
|
+n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var m=n.wrapS==THREE.RepeatWrapping,hb=n.wrapT==THREE.RepeatWrapping;mb[n.id]=t.createPattern(n.image,!0===m&&!0===hb?"repeat":!0===m&&!1===hb?"repeat-x":!1===m&&!0===hb?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===mb[n.id]?h("rgba(0,0,0,1)"):h(mb[n.id]);var m=n.offset.x/n.repeat.x,hb=n.offset.y/n.repeat.y,p=n.image.width*n.repeat.x,q=n.image.height*n.repeat.y,g=(g+m)*p,j=(1-j+hb)*q,c=c-a,d=d-
|
|
|
+b,e=e-a,f=f-b,i=(i+m)*p-g,La=(1-La+hb)*q-j,k=(k+m)*p-g,l=(1-l+hb)*q-j,m=i*l-k*La;0===m?(void 0===ha[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),ha[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ha[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),ga.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),A(ga)):(m=1/m,n=(l*c-La*e)*m,La=(l*d-La*f)*m,c=(i*e-k*c)*m,d=(i*f-k*d)*m,a=a-n*g-c*j,g=b-La*g-d*j,t.save(),
|
|
|
+t.transform(n,La,c,d,a,g),t.fill(),t.restore())}}function G(a,b,c,d,e,f,g,j,h,i,La,k,n){var l,m;l=n.width-1;m=n.height-1;g*=l;j*=m;c-=a;d-=b;e-=a;f-=b;h=h*l-g;i=i*m-j;La=La*l-g;k=k*m-j;m=1/(h*k-La*i);l=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-La*c)*m;d=(h*f-La*d)*m;a=a-l*g-c*j;b=b-i*g-d*j;t.save();t.transform(l,i,c,d,a,b);t.clip();t.drawImage(n,0,0);t.restore()}function E(a,b,c,d){Xa[0]=255*a.r|0;Xa[1]=255*a.g|0;Xa[2]=255*a.b|0;Xa[4]=255*b.r|0;Xa[5]=255*b.g|0;Xa[6]=255*b.b|0;Xa[8]=255*c.r|0;Xa[9]=255*c.g|
|
|
|
+0;Xa[10]=255*c.b|0;Xa[12]=255*d.r|0;Xa[13]=255*d.g|0;Xa[14]=255*d.b|0;zb.putImageData(j,0,0);nb.drawImage(db,0,0);return wb}function I(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===p instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();t.setTransform(1,0,0,-1,v,z);l.info.render.vertices=0;l.info.render.faces=0;m=r.projectScene(a,p,this.sortObjects,
|
|
|
+this.sortElements);n=m.elements;s=m.lights;rb.setRGB(0,0,0);wc.setRGB(0,0,0);Ra.setRGB(0,0,0);for(var J=0,W=s.length;J<W;J++){var Q=s[J],X=Q.color;Q instanceof THREE.AmbientLight?rb.add(X):Q instanceof THREE.DirectionalLight?wc.add(X):Q instanceof THREE.PointLight&&Ra.add(X)}J=0;for(W=n.length;J<W;J++){var H=n[J],Q=H.material;if(!(void 0===Q||!1===Q.visible)){Ba.makeEmpty();if(H instanceof THREE.RenderableParticle){K=H;K.x*=v;K.y*=z;var X=K,Ta=H;b(Q.opacity);c(Q.blending);var La=void 0,Bb=void 0,
|
|
|
+hb=void 0,Cb=void 0,ld=H=void 0,md=void 0;Q instanceof THREE.ParticleBasicMaterial?null===Q.map?(hb=Ta.object.scale.x,Cb=Ta.object.scale.y,hb*=Ta.scale.x*v,Cb*=Ta.scale.y*z,Ba.min.set(X.x-hb,X.y-Cb),Ba.max.set(X.x+hb,X.y+Cb),!1!==qb.isIntersectionBox(Ba)&&(h(Q.color.getStyle()),t.save(),t.translate(X.x,X.y),t.rotate(-Ta.rotation),t.scale(hb,Cb),t.fillRect(-1,-1,2,2),t.restore())):(H=Q.map.image,ld=H.width>>1,md=H.height>>1,hb=Ta.scale.x*v,Cb=Ta.scale.y*z,La=hb*ld,Bb=Cb*md,Ba.min.set(X.x-La,X.y-Bb),
|
|
|
+Ba.max.set(X.x+La,X.y+Bb),!1!==qb.isIntersectionBox(Ba)&&(t.save(),t.translate(X.x,X.y),t.rotate(-Ta.rotation),t.scale(hb,-Cb),t.translate(-ld,-md),t.drawImage(H,0,0),t.restore())):Q instanceof THREE.ParticleCanvasMaterial&&(La=Ta.scale.x*v,Bb=Ta.scale.y*z,Ba.min.set(X.x-La,X.y-Bb),Ba.max.set(X.x+La,X.y+Bb),!1!==qb.isIntersectionBox(Ba)&&(g(Q.color.getStyle()),h(Q.color.getStyle()),t.save(),t.translate(X.x,X.y),t.rotate(-Ta.rotation),t.scale(La,Bb),Q.program(t),t.restore()))}else if(H instanceof THREE.RenderableLine)K=
|
|
|
+H.v1,L=H.v2,K.positionScreen.x*=v,K.positionScreen.y*=z,L.positionScreen.x*=v,L.positionScreen.y*=z,Ba.setFromPoints([K.positionScreen,L.positionScreen]),!0===qb.isIntersectionBox(Ba)&&(X=K,Ta=L,b(Q.opacity),c(Q.blending),t.beginPath(),t.moveTo(X.positionScreen.x,X.positionScreen.y),t.lineTo(Ta.positionScreen.x,Ta.positionScreen.y),Q instanceof THREE.LineBasicMaterial?(d(Q.linewidth),e(Q.linecap),f(Q.linejoin),g(Q.color.getStyle()),i(null,null),t.stroke(),Ba.expandByScalar(2*Q.linewidth)):Q instanceof
|
|
|
+THREE.LineDashedMaterial&&(d(Q.linewidth),e(Q.linecap),f(Q.linejoin),g(Q.color.getStyle()),i(Q.dashSize,Q.gapSize),t.stroke(),Ba.expandByScalar(2*Q.linewidth)));else if(H instanceof THREE.RenderableFace3){K=H.v1;L=H.v2;U=H.v3;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>U.positionScreen.z||1<U.positionScreen.z)continue;K.positionScreen.x*=v;K.positionScreen.y*=z;L.positionScreen.x*=v;L.positionScreen.y*=z;U.positionScreen.x*=
|
|
|
+v;U.positionScreen.y*=z;!0===Q.overdraw&&(I(K.positionScreen,L.positionScreen),I(L.positionScreen,U.positionScreen),I(U.positionScreen,K.positionScreen));Ba.setFromPoints([K.positionScreen,L.positionScreen,U.positionScreen]);x(K,L,U,0,1,2,H,Q)}else if(H instanceof THREE.RenderableFace4){K=H.v1;L=H.v2;U=H.v3;da=H.v4;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>U.positionScreen.z||1<U.positionScreen.z)continue;if(-1>da.positionScreen.z||
|
|
|
+1<da.positionScreen.z)continue;K.positionScreen.x*=v;K.positionScreen.y*=z;L.positionScreen.x*=v;L.positionScreen.y*=z;U.positionScreen.x*=v;U.positionScreen.y*=z;da.positionScreen.x*=v;da.positionScreen.y*=z;Fa.positionScreen.copy(L.positionScreen);Pa.positionScreen.copy(da.positionScreen);!0===Q.overdraw&&(I(K.positionScreen,L.positionScreen),I(L.positionScreen,da.positionScreen),I(da.positionScreen,K.positionScreen),I(U.positionScreen,Fa.positionScreen),I(U.positionScreen,Pa.positionScreen));Ba.setFromPoints([K.positionScreen,
|
|
|
+L.positionScreen,U.positionScreen,da.positionScreen]);X=K;Ta=L;La=U;Bb=da;hb=Fa;Cb=Pa;l.info.render.vertices+=4;l.info.render.faces++;b(Q.opacity);c(Q.blending);void 0!==Q.map&&null!==Q.map||void 0!==Q.envMap&&null!==Q.envMap?(x(X,Ta,Bb,0,1,3,H,Q),x(hb,La,Cb,1,2,3,H,Q)):(M=X.positionScreen.x,ea=X.positionScreen.y,wa=Ta.positionScreen.x,ia=Ta.positionScreen.y,sa=La.positionScreen.x,N=La.positionScreen.y,Na=Bb.positionScreen.x,pb=Bb.positionScreen.y,ab=hb.positionScreen.x,Oa=hb.positionScreen.y,Ea=
|
|
|
+Cb.positionScreen.x,ma=Cb.positionScreen.y,Q instanceof THREE.MeshLambertMaterial||Q instanceof THREE.MeshPhongMaterial?(Z.copy(Q.color),qa.copy(Q.emissive),Q.vertexColors===THREE.FaceColors&&Z.multiply(H.color),!1===Q.wireframe&&Q.shading==THREE.SmoothShading&&4==H.vertexNormalsLength?(pa.copy(rb),Y.copy(rb),ba.copy(rb),ja.copy(rb),q(H.v1.positionWorld,H.vertexNormalsModel[0],pa),q(H.v2.positionWorld,H.vertexNormalsModel[1],Y),q(H.v4.positionWorld,H.vertexNormalsModel[3],ba),q(H.v3.positionWorld,
|
|
|
+H.vertexNormalsModel[2],ja),pa.multiply(Z).add(qa),Y.multiply(Z).add(qa),ba.multiply(Z).add(qa),ja.multiply(Z).add(qa),Wa=E(pa,Y,ba,ja),y(M,ea,wa,ia,Na,pb),G(M,ea,wa,ia,Na,pb,0,0,1,0,0,1,Wa),y(ab,Oa,sa,N,Ea,ma),G(ab,Oa,sa,N,Ea,ma,1,0,1,1,0,1,Wa)):(ga.copy(rb),q(H.centroidModel,H.normalModel,ga),ga.multiply(Z).add(qa),C(M,ea,wa,ia,sa,N,Na,pb),!0===Q.wireframe?B(ga,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):A(ga))):Q instanceof THREE.MeshBasicMaterial?(ga.copy(Q.color),Q.vertexColors===
|
|
|
+THREE.FaceColors&&ga.multiply(H.color),C(M,ea,wa,ia,sa,N,Na,pb),!0===Q.wireframe?B(ga,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):A(ga)):Q instanceof THREE.MeshNormalMaterial?(X=void 0,Q.shading==THREE.FlatShading?(X=H.normalModelView,ga.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),C(M,ea,wa,ia,sa,N,Na,pb),!0===Q.wireframe?B(ga,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):A(ga)):Q.shading==THREE.SmoothShading&&(X=H.vertexNormalsModelView[0],pa.setRGB(X.x,
|
|
|
+X.y,X.z).multiplyScalar(0.5).addScalar(0.5),X=H.vertexNormalsModelView[1],Y.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),X=H.vertexNormalsModelView[3],ba.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),X=H.vertexNormalsModelView[2],ja.setRGB(X.x,X.y,X.z).multiplyScalar(0.5).addScalar(0.5),Wa=E(pa,Y,ba,ja),y(M,ea,wa,ia,Na,pb),G(M,ea,wa,ia,Na,pb,0,0,1,0,0,1,Wa),y(ab,Oa,sa,N,Ea,ma),G(ab,Oa,sa,N,Ea,ma,1,0,1,1,0,1,Wa))):Q instanceof THREE.MeshDepthMaterial&&(cb=p.near,Va=p.far,pa.r=pa.g=
|
|
|
+pa.b=1-k(X.positionScreen.z*X.positionScreen.w,cb,Va),Y.r=Y.g=Y.b=1-k(Ta.positionScreen.z*Ta.positionScreen.w,cb,Va),ba.r=ba.g=ba.b=1-k(Bb.positionScreen.z*Bb.positionScreen.w,cb,Va),ja.r=ja.g=ja.b=1-k(La.positionScreen.z*La.positionScreen.w,cb,Va),Wa=E(pa,Y,ba,ja),y(M,ea,wa,ia,Na,pb),G(M,ea,wa,ia,Na,pb,0,0,1,0,0,1,Wa),y(ab,Oa,sa,N,Ea,ma),G(ab,Oa,sa,N,Ea,ma,1,0,1,1,0,1,Wa)))}Ka.union(Ba)}}t.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",
|
|
@@ -351,16 +350,16 @@ n;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a
|
|
|
"v3"===c.type?h=3:"v4"===c.type?h=4:"c"===c.type&&(h=3),c.size=h,c.array=new Float32Array(i*h),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
|
|
|
THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){var b,c,d;for(b in a.attributes)d="index"===b?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,c=a.attributes[b],c.buffer=j.createBuffer(),j.bindBuffer(d,c.buffer),j.bufferData(d,c.array,j.STATIC_DRAW)}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;a.elementsNeedUpdate&&
|
|
|
void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){Ka[a]||(j.enableVertexAttribArray(a),Ka[a]=!0)}function l(){for(var a in Ka)Ka[a]&&(j.disableVertexAttribArray(a),Ka[a]=!1)}function m(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function n(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)aa=
|
|
|
-mb=null,ta=ka=la=da=Wa=ia=Z=-1,bb=!0,a[d].render(b,c,mc,pb),aa=mb=null,ta=ka=la=da=Wa=ia=Z=-1,bb=!0}function r(a,b,c,d,e,f,g,j){var h,i,k,n;b?(i=a.length-1,n=b=-1):(i=0,b=a.length,n=1);for(var l=i;l!==b;l+=n)if(h=a[l],h.render){i=h.object;k=h.buffer;if(j)h=j;else{h=h[c];if(!h)continue;g&&N.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);N.setDepthTest(h.depthTest);N.setDepthWrite(h.depthWrite);E(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}N.setMaterialFaces(h);k instanceof
|
|
|
+i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){Ka[a]||(j.enableVertexAttribArray(a),Ka[a]=!0)}function l(){for(var a in Ka)Ka[a]&&(j.disableVertexAttribArray(a),Ka[a]=!1)}function m(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function n(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ga=
|
|
|
+ab=null,Ea=ma=ja=ba=cb=ha=Z=-1,db=!0,a[d].render(b,c,kc,qb),ga=ab=null,Ea=ma=ja=ba=cb=ha=Z=-1,db=!0}function r(a,b,c,d,e,f,g,j){var h,i,k,n;b?(i=a.length-1,n=b=-1):(i=0,b=a.length,n=1);for(var l=i;l!==b;l+=n)if(h=a[l],h.render){i=h.object;k=h.buffer;if(j)h=j;else{h=h[c];if(!h)continue;g&&N.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);N.setDepthTest(h.depthTest);N.setDepthWrite(h.depthWrite);E(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}N.setMaterialFaces(h);k instanceof
|
|
|
THREE.BufferGeometry?N.renderBufferDirect(d,e,f,h,k,i):N.renderBuffer(d,e,f,h,k,i)}}function p(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&N.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);N.setDepthTest(h.depthTest);N.setDepthWrite(h.depthWrite);E(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}N.renderImmediateObject(c,d,e,h,j)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
-function y(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function v(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function t(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function A(a,b,c,d,e){Y=0;d.needsUpdate&&(d.program&&Pc(d),N.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(N.maxMorphTargets));
|
|
|
-var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==mb&&(j.useProgram(g),mb=g,f=!0);d.id!==ta&&(ta=d.id,f=!0);if(f||a!==aa)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==aa&&(aa=a);if(d.skinning)if(tc&&e.useVertexTexture){if(null!==h.boneTexture){var k=I();j.uniform1i(h.boneTexture,k);N.setTexture(e.boneTexture,k)}}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(bb){for(var n,l=k=0,m=0,p,q,s,r=xb,t=r.directional.colors,v=r.directional.positions,y=r.point.colors,z=r.point.positions,B=r.point.distances,C=r.spot.colors,A=r.spot.positions,F=r.spot.distances,E=r.spot.directions,J=r.spot.anglesCos,K=r.spot.exponents,H=r.hemi.skyColors,M=r.hemi.groundColors,P=r.hemi.positions,
|
|
|
-X=0,da=0,ka=0,fa=0,ca=0,pa=0,Ma=0,ha=0,O=n=0,c=s=O=0,f=b.length;c<f;c++)n=b[c],n.onlyShadow||(p=n.color,q=n.intensity,s=n.distance,n instanceof THREE.AmbientLight?n.visible&&(N.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,m+=p.b*p.b):(k+=p.r,l+=p.g,m+=p.b)):n instanceof THREE.DirectionalLight?(ca+=1,n.visible&&(La.getPositionFromMatrix(n.matrixWorld),Qa.getPositionFromMatrix(n.target.matrixWorld),La.sub(Qa),La.normalize(),0===La.x&&0===La.y&&0===La.z||(n=3*X,v[n]=La.x,v[n+1]=La.y,v[n+2]=La.z,N.gammaInput?x(t,
|
|
|
-n,p,q*q):G(t,n,p,q),X+=1))):n instanceof THREE.PointLight?(pa+=1,n.visible&&(O=3*da,N.gammaInput?x(y,O,p,q*q):G(y,O,p,q),Qa.getPositionFromMatrix(n.matrixWorld),z[O]=Qa.x,z[O+1]=Qa.y,z[O+2]=Qa.z,B[da]=s,da+=1)):n instanceof THREE.SpotLight?(Ma+=1,n.visible&&(O=3*ka,N.gammaInput?x(C,O,p,q*q):G(C,O,p,q),Qa.getPositionFromMatrix(n.matrixWorld),A[O]=Qa.x,A[O+1]=Qa.y,A[O+2]=Qa.z,F[ka]=s,La.copy(Qa),Qa.getPositionFromMatrix(n.target.matrixWorld),La.sub(Qa),La.normalize(),E[O]=La.x,E[O+1]=La.y,E[O+2]=La.z,
|
|
|
-J[ka]=Math.cos(n.angle),K[ka]=n.exponent,ka+=1)):n instanceof THREE.HemisphereLight&&(ha+=1,n.visible&&(La.getPositionFromMatrix(n.matrixWorld),La.normalize(),0===La.x&&0===La.y&&0===La.z||(s=3*fa,P[s]=La.x,P[s+1]=La.y,P[s+2]=La.z,p=n.color,n=n.groundColor,N.gammaInput?(q*=q,x(H,s,p,q),x(M,s,n,q)):(G(H,s,p,q),G(M,s,n,q)),fa+=1))));c=3*X;for(f=Math.max(t.length,3*ca);c<f;c++)t[c]=0;c=3*da;for(f=Math.max(y.length,3*pa);c<f;c++)y[c]=0;c=3*ka;for(f=Math.max(C.length,3*Ma);c<f;c++)C[c]=0;c=3*fa;for(f=
|
|
|
-Math.max(H.length,3*ha);c<f;c++)H[c]=0;c=3*fa;for(f=Math.max(M.length,3*ha);c<f;c++)M[c]=0;r.directional.length=X;r.point.length=da;r.spot.length=ka;r.hemi.length=fa;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=m;bb=!1}c=xb;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=
|
|
|
+function y(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function v(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function t(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function A(a,b,c,d,e){Y=0;d.needsUpdate&&(d.program&&Ta(d),N.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(N.maxMorphTargets));
|
|
|
+var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==ab&&(j.useProgram(g),ab=g,f=!0);d.id!==Ea&&(Ea=d.id,f=!0);if(f||a!==ga)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ga&&(ga=a);if(d.skinning)if(qc&&e.useVertexTexture){if(null!==h.boneTexture){var k=I();j.uniform1i(h.boneTexture,k);N.setTexture(e.boneTexture,k)}}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(db){for(var n,l=k=0,m=0,p,q,s,r=zb,t=r.directional.colors,v=r.directional.positions,y=r.point.colors,z=r.point.positions,C=r.point.distances,B=r.spot.colors,A=r.spot.positions,F=r.spot.distances,E=r.spot.directions,J=r.spot.anglesCos,K=r.spot.exponents,H=r.hemi.skyColors,M=r.hemi.groundColors,Q=r.hemi.positions,
|
|
|
+X=0,ba=0,ma=0,da=0,pa=0,ea=0,Na=0,ia=0,O=n=0,c=s=O=0,f=b.length;c<f;c++)n=b[c],n.onlyShadow||(p=n.color,q=n.intensity,s=n.distance,n instanceof THREE.AmbientLight?n.visible&&(N.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,m+=p.b*p.b):(k+=p.r,l+=p.g,m+=p.b)):n instanceof THREE.DirectionalLight?(pa+=1,n.visible&&(ka.getPositionFromMatrix(n.matrixWorld),Ra.getPositionFromMatrix(n.target.matrixWorld),ka.sub(Ra),ka.normalize(),0===ka.x&&0===ka.y&&0===ka.z||(n=3*X,v[n]=ka.x,v[n+1]=ka.y,v[n+2]=ka.z,N.gammaInput?x(t,
|
|
|
+n,p,q*q):G(t,n,p,q),X+=1))):n instanceof THREE.PointLight?(ea+=1,n.visible&&(O=3*ba,N.gammaInput?x(y,O,p,q*q):G(y,O,p,q),Ra.getPositionFromMatrix(n.matrixWorld),z[O]=Ra.x,z[O+1]=Ra.y,z[O+2]=Ra.z,C[ba]=s,ba+=1)):n instanceof THREE.SpotLight?(Na+=1,n.visible&&(O=3*ma,N.gammaInput?x(B,O,p,q*q):G(B,O,p,q),Ra.getPositionFromMatrix(n.matrixWorld),A[O]=Ra.x,A[O+1]=Ra.y,A[O+2]=Ra.z,F[ma]=s,ka.copy(Ra),Ra.getPositionFromMatrix(n.target.matrixWorld),ka.sub(Ra),ka.normalize(),E[O]=ka.x,E[O+1]=ka.y,E[O+2]=ka.z,
|
|
|
+J[ma]=Math.cos(n.angle),K[ma]=n.exponent,ma+=1)):n instanceof THREE.HemisphereLight&&(ia+=1,n.visible&&(ka.getPositionFromMatrix(n.matrixWorld),ka.normalize(),0===ka.x&&0===ka.y&&0===ka.z||(s=3*da,Q[s]=ka.x,Q[s+1]=ka.y,Q[s+2]=ka.z,p=n.color,n=n.groundColor,N.gammaInput?(q*=q,x(H,s,p,q),x(M,s,n,q)):(G(H,s,p,q),G(M,s,n,q)),da+=1))));c=3*X;for(f=Math.max(t.length,3*pa);c<f;c++)t[c]=0;c=3*ba;for(f=Math.max(y.length,3*ea);c<f;c++)y[c]=0;c=3*ma;for(f=Math.max(B.length,3*Na);c<f;c++)B[c]=0;c=3*da;for(f=
|
|
|
+Math.max(H.length,3*ia);c<f;c++)H[c]=0;c=3*da;for(f=Math.max(M.length,3*ia);c<f;c++)M[c]=0;r.directional.length=X;r.point.length=ba;r.spot.length=ma;r.hemi.length=da;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=m;db=!1}c=zb;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;N.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 Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,Z=Z.repeat,i.offsetRepeat.value.set(c.x,c.y,Z.x,Z.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=
|
|
@@ -370,45 +369,45 @@ i.shadowMatrix){c=Z=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instance
|
|
|
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(m=k.length;l<m;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(m=k.length;l<m;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(m=k.length;l<m;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(m=k.length;l<m;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=I(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),N.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++)N.autoScaleCubemaps&&!f?(m=k,r=l,t=c.image[l],y=gd,t.width<=y&&t.height<=y||(z=Math.max(t.width,t.height),v=Math.floor(t.width*y/z),y=Math.floor(t.height*y/z),z=document.createElement("canvas"),z.width=v,z.height=y,z.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,y),t=z),m[r]=t):k[l]=c.image[l];l=k[0];m=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=L(c.format);
|
|
|
-t=L(c.type);W(j.TEXTURE_CUBE_MAP,c,m);for(l=0;6>l;l++)if(f){y=k[l].mipmaps;z=0;for(B=y.length;z<B;z++)v=y[z],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,z,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&m&&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)):N.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(m=c.value.length;l<m;l++)c._array[l]=I();j.uniform1iv(f,c._array);l=0;for(m=c.value.length;l<m;l++)r=c.value[l],k=c._array[l],r&&N.setTexture(r,k)}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 I(){var a=Y;a>=Mc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
-a+" texture units while this GPU supports only "+Mc);Y+=1;return a}function C(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function x(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function J(a){a!==ub&&(j.lineWidth(a),ub=a)}function E(a,b,c){ab!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ab=a);if(a&&
|
|
|
-(Fa!==b||Xa!==c))j.polygonOffset(b,c),Fa=b,Xa=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 B(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(H(b)),null):c}function W(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,L(b.wrapS)),j.texParameteri(a,
|
|
|
-j.TEXTURE_WRAP_T,L(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(b.minFilter)));if(cb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,cb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Cc)),b.__oldAnisotropy=
|
|
|
+c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)N.autoScaleCubemaps&&!f?(m=k,r=l,t=c.image[l],y=fd,t.width<=y&&t.height<=y||(z=Math.max(t.width,t.height),v=Math.floor(t.width*y/z),y=Math.floor(t.height*y/z),z=document.createElement("canvas"),z.width=v,z.height=y,z.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,y),t=z),m[r]=t):k[l]=c.image[l];l=k[0];m=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=L(c.format);
|
|
|
+t=L(c.type);W(j.TEXTURE_CUBE_MAP,c,m);for(l=0;6>l;l++)if(f){y=k[l].mipmaps;z=0;for(C=y.length;z<C;z++)v=y[z],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,z,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&m&&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)):N.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(m=c.value.length;l<m;l++)c._array[l]=I();j.uniform1iv(f,c._array);l=0;for(m=c.value.length;l<m;l++)r=c.value[l],k=c._array[l],r&&N.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)Ra.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,Ra.x,Ra.y,
|
|
|
+Ra.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 I(){var a=Y;a>=Lc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
+a+" texture units while this GPU supports only "+Lc);Y+=1;return a}function B(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function x(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function J(a){a!==yb&&(j.lineWidth(a),yb=a)}function E(a,b,c){Va!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Va=a);if(a&&
|
|
|
+(Wa!==b||Qa!==c))j.polygonOffset(b,c),Wa=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 C(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,L(b.wrapS)),j.texParameteri(a,
|
|
|
+j.TEXTURE_WRAP_T,L(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(b.minFilter)));if(nb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,nb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Bc)),b.__oldAnisotropy=
|
|
|
b.anisotropy}function F(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}
|
|
|
function K(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function L(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===
|
|
|
THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===
|
|
|
THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;
|
|
|
if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;
|
|
|
-if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Sa){if(a===THREE.RGB_S3TC_DXT1_Format)return Sa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Sa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},U=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-fa=void 0!==a.precision?a.precision:"highp",Ca=void 0!==a.alpha?a.alpha:!0,$a=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,M=void 0!==a.antialias?a.antialias:!1,ca=void 0!==a.stencil?a.stencil:!0,qa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ha=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),ra=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=U;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?
|
|
|
+if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Ya){if(a===THREE.RGB_S3TC_DXT1_Format)return Ya.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ya.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ya.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ya.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},U=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
+da=void 0!==a.precision?a.precision:"highp",Fa=void 0!==a.alpha?a.alpha:!0,Pa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,M=void 0!==a.antialias?a.antialias:!1,ea=void 0!==a.stencil?a.stencil:!0,wa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ia=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),sa=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=U;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?
|
|
|
window.devicePixelRatio:1;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=
|
|
|
-[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var N=this,Ma=[],Na=0,mb=null,Pa=null,ta=-1,ka=null,aa=null,pa=0,Y=0,da=-1,la=-1,Z=-1,oa=-1,gb=-1,nb=-1,ia=-1,Wa=-1,ab=null,Fa=null,Xa=null,ub=null,Ib=0,Jb=0,fc=0,Ab=0,mc=0,pb=0,Ka={},Va=new THREE.Frustum,gc=new THREE.Matrix4,vb=new THREE.Matrix4,Qa=new THREE.Vector3,La=new THREE.Vector3,bb=!0,xb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
-colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,yb,Ra,cb,Sa;try{if(!(j=U.getContext("experimental-webgl",{alpha:Ca,premultipliedAlpha:$a,antialias:M,stencil:ca,preserveDrawingBuffer:qa})))throw"Error creating WebGL context.";}catch(zb){console.error(zb)}yb=j.getExtension("OES_texture_float");Ra=j.getExtension("OES_standard_derivatives");cb=j.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
-j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Sa=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");yb||console.log("THREE.WebGLRenderer: Float textures not supported.");Ra||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");cb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
-Sa||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ha.r,ha.g,ha.b,ra);this.context=j;
|
|
|
-var Mc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),fd=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var gd=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Cc=cb?j.getParameter(cb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,sc=0<fd,tc=sc&&yb;Sa&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var jd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),kd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var ld=
|
|
|
-j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),id=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 hd=0<jd.precision&&0<ld.precision,Nc=0<kd.precision&&0<id.precision;"highp"===fa&&!hd&&(Nc?(fa="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(fa="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===fa&&!Nc&&(fa="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return sc};this.supportsFloatTextures=function(){return yb};
|
|
|
-this.supportsStandardDerivatives=function(){return Ra};this.supportsCompressedTextureS3TC=function(){return Sa};this.getMaxAnisotropy=function(){return Cc};this.getPrecision=function(){return fa};this.setSize=function(a,b){U.width=a*this.devicePixelRatio;U.height=b*this.devicePixelRatio;U.style.width=a+"px";U.style.height=b+"px";this.setViewport(0,0,U.width,U.height)};this.setViewport=function(a,b,c,d){Ib=void 0!==a?a:0;Jb=void 0!==b?b:0;fc=void 0!==c?c:U.width;Ab=void 0!==d?d:U.height;j.viewport(Ib,
|
|
|
-Jb,fc,Ab)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ha.setHex(a);ra=b;j.clearColor(ha.r,ha.g,ha.b,ra)};this.setClearColor=function(a,b){ha.copy(a);ra=b;j.clearColor(ha.r,ha.g,ha.b,ra)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return ra};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;
|
|
|
-if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){mb=null;ta=ka=Wa=ia=Z=-1;bb=!0;la=da=-1;this.shadowMapPlugin.update(a,b)};var wd=function(a){a=a.target;a.removeEventListener("dispose",wd);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&
|
|
|
+[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var N=this,Na=[],pb=0,ab=null,Oa=null,Ea=-1,ma=null,ga=null,pa=0,Y=0,ba=-1,ja=-1,Z=-1,qa=-1,bb=-1,mb=-1,ha=-1,cb=-1,Va=null,Wa=null,Qa=null,yb=null,Hb=0,Ib=0,ec=0,Ab=0,kc=0,qb=0,Ka={},Ba=new THREE.Frustum,rb=new THREE.Matrix4,wc=new THREE.Matrix4,Ra=new THREE.Vector3,ka=new THREE.Vector3,db=!0,zb={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,Xa,wb,nb,Ya;try{if(!(j=U.getContext("experimental-webgl",{alpha:Fa,premultipliedAlpha:Pa,antialias:M,stencil:ea,preserveDrawingBuffer:wa})))throw"Error creating WebGL context.";}catch(dd){console.error(dd)}Xa=j.getExtension("OES_texture_float");wb=j.getExtension("OES_standard_derivatives");nb=j.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
+j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ya=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Xa||console.log("THREE.WebGLRenderer: Float textures not supported.");wb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");nb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
+Ya||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ia.r,ia.g,ia.b,sa);this.context=j;
|
|
|
+var Lc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),ed=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var fd=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Bc=nb?j.getParameter(nb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,rc=0<ed,qc=rc&&Xa;Ya&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var id=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),jd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var hd=
|
|
|
+j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),gd=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 kd=0<id.precision&&0<hd.precision,Mc=0<jd.precision&&0<gd.precision;"highp"===da&&!kd&&(Mc?(da="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(da="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===da&&!Mc&&(da="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return rc};this.supportsFloatTextures=function(){return Xa};
|
|
|
+this.supportsStandardDerivatives=function(){return wb};this.supportsCompressedTextureS3TC=function(){return Ya};this.getMaxAnisotropy=function(){return Bc};this.getPrecision=function(){return da};this.setSize=function(a,b){U.width=a*this.devicePixelRatio;U.height=b*this.devicePixelRatio;U.style.width=a+"px";U.style.height=b+"px";this.setViewport(0,0,U.width,U.height)};this.setViewport=function(a,b,c,d){Hb=void 0!==a?a:0;Ib=void 0!==b?b:0;ec=void 0!==c?c:U.width;Ab=void 0!==d?d:U.height;j.viewport(Hb,
|
|
|
+Ib,ec,Ab)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ia.setHex(a);sa=b;j.clearColor(ia.r,ia.g,ia.b,sa)};this.setClearColor=function(a,b){ia.copy(a);sa=b;j.clearColor(ia.r,ia.g,ia.b,sa)};this.getClearColor=function(){return ia};this.getClearAlpha=function(){return sa};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){ab=null;Ea=ma=cb=ha=Z=-1;db=!0;ja=ba=-1;this.shadowMapPlugin.update(a,b)};var vd=function(a){a=a.target;a.removeEventListener("dispose",vd);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&
|
|
|
j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);
|
|
|
void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);
|
|
|
-N.info.memory.geometries--},Oc=function(a){a=a.target;a.removeEventListener("dispose",Oc);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));N.info.memory.textures--},P=function(a){a=a.target;a.removeEventListener("dispose",P);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);N.info.memory.textures--},X=function(a){a=a.target;a.removeEventListener("dispose",X);Pc(a)},Pc=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=Ma.length;a<c;a++)if(d=Ma[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Ma.length;a<c;a++)d=Ma[a],d.program!==b&&e.push(d);Ma=e;j.deleteProgram(b);N.info.memory.programs--}}};this.renderBufferImmediate=
|
|
|
+N.info.memory.geometries--},Q=function(a){a=a.target;a.removeEventListener("dispose",Q);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));N.info.memory.textures--},X=function(a){a=a.target;a.removeEventListener("dispose",X);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);N.info.memory.textures--},Nc=function(a){a=a.target;a.removeEventListener("dispose",Nc);Ta(a)},Ta=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=Na.length;a<c;a++)if(d=Na[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Na.length;a<c;a++)d=Na[a],d.program!==b&&e.push(d);Na=e;j.deleteProgram(b);N.info.memory.programs--}}};this.renderBufferImmediate=
|
|
|
function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,
|
|
|
3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,i,h,k,l,n,m,p,q=3*a.count;for(p=0;p<q;p+=9)m=a.normalArray,d=m[p],e=m[p+1],f=m[p+2],g=m[p+3],h=m[p+4],l=m[p+5],i=m[p+6],k=m[p+7],n=m[p+8],d=(d+g+i)/3,e=(e+h+k)/3,f=(f+l+n)/3,m[p]=d,m[p+1]=e,m[p+2]=f,m[p+3]=d,m[p+4]=e,m[p+5]=f,m[p+6]=d,m[p+7]=e,m[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
|
|
|
3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,
|
|
|
-0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=A(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0),c!==ka&&(ka=c,b=!0),b&&l(),f instanceof THREE.Mesh)if(d=e.attributes.index){f=e.offsets;1<f.length&&(b=!0);for(var c=0,g=f.length;c<g;c++){var i=f[c].index;if(b){var h=e.attributes.position,n=h.itemSize;j.bindBuffer(j.ARRAY_BUFFER,h.buffer);k(a.position);j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,4*i*n);n=e.attributes.normal;if(0<=
|
|
|
+0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=A(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0),c!==ma&&(ma=c,b=!0),b&&l(),f instanceof THREE.Mesh)if(d=e.attributes.index){f=e.offsets;1<f.length&&(b=!0);for(var c=0,g=f.length;c<g;c++){var i=f[c].index;if(b){var h=e.attributes.position,n=h.itemSize;j.bindBuffer(j.ARRAY_BUFFER,h.buffer);k(a.position);j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,4*i*n);n=e.attributes.normal;if(0<=
|
|
|
a.normal&&n){var m=n.itemSize;j.bindBuffer(j.ARRAY_BUFFER,n.buffer);k(a.normal);j.vertexAttribPointer(a.normal,m,j.FLOAT,!1,0,4*i*m)}n=e.attributes.uv;0<=a.uv&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.uv),j.vertexAttribPointer(a.uv,m,j.FLOAT,!1,0,4*i*m));n=e.attributes.color;0<=a.color&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,m,j.FLOAT,!1,0,4*i*m));n=e.attributes.tangent;0<=a.tangent&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
n.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,m,j.FLOAT,!1,0,4*i*m));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,d.buffer)}j.drawElements(j.TRIANGLES,f[c].count,j.UNSIGNED_SHORT,2*f[c].start);N.info.render.calls++;N.info.render.vertices+=f[c].count;N.info.render.faces+=f[c].count/3}}else b&&(h=e.attributes.position,n=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,0),n=e.attributes.normal,0<=a.normal&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
n.buffer),k(a.normal),j.vertexAttribPointer(a.normal,m,j.FLOAT,!1,0,0)),n=e.attributes.uv,0<=a.uv&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.uv),j.vertexAttribPointer(a.uv,m,j.FLOAT,!1,0,0)),n=e.attributes.color,0<=a.color&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,m,j.FLOAT,!1,0,0)),n=e.attributes.tangent,0<=a.tangent&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,m,j.FLOAT,
|
|
|
!1,0,0))),j.drawArrays(j.TRIANGLES,0,h.numItems/3),N.info.render.calls++,N.info.render.vertices+=h.numItems/3,N.info.render.faces+=h.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(h=e.attributes.position,n=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,0),n=e.attributes.color,0<=a.color&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,m,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,
|
|
|
h.numItems/3),N.info.render.calls++,N.info.render.points+=h.numItems/3):f instanceof THREE.Line&&b&&(h=e.attributes.position,n=h.itemSize,j.bindBuffer(j.ARRAY_BUFFER,h.buffer),k(a.position),j.vertexAttribPointer(a.position,n,j.FLOAT,!1,0,0),n=e.attributes.color,0<=a.color&&n&&(m=n.itemSize,j.bindBuffer(j.ARRAY_BUFFER,n.buffer),k(a.color),j.vertexAttribPointer(a.color,m,j.FLOAT,!1,0,0)),J(d.linewidth),j.drawArrays(j.LINE_STRIP,0,h.numItems/3),N.info.render.calls++,N.info.render.points+=h.numItems)};
|
|
|
-this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,i,c=A(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ka&&(ka=c,b=!0);b&&l();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),
|
|
|
+this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,i,c=A(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ma&&(ma=c,b=!0);b&&l();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),
|
|
|
j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var h=0;i=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<i.length;)0<=c["morphTarget"+h]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[h]]),k(c["morphTarget"+h]),j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0)),0<=
|
|
|
c["morphNormal"+h]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[h]]),k(c["morphNormal"+h]),j.vertexAttribPointer(c["morphNormal"+h],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]=g[i[h]],h++}else{i=[];g=f.morphTargetInfluences;var m,p=g.length;for(m=0;m<p;m++)h=g[m],0<h&&i.push([h,m]);i.length>d.numSupportedMorphTargets?(i.sort(n),i.length=d.numSupportedMorphTargets):i.length>d.numSupportedMorphNormals?i.sort(n):0===i.length&&i.push([0,0]);for(h=0;h<d.numSupportedMorphTargets;)i[h]?
|
|
|
(m=i[h][1],0<=c["morphTarget"+h]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]),k(c["morphTarget"+h]),j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+h]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[m]),k(c["morphNormal"+h]),j.vertexAttribPointer(c["morphNormal"+h],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]=g[m]):f.__webglMorphTargetInfluences[h]=0,h++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
|
|
@@ -416,89 +415,89 @@ f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){g=0;for(
|
|
|
e.__webglNormalBuffer),k(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),k(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),k(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0));0<=a.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),k(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
e.__webglSkinIndicesBuffer),k(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(J(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)),N.info.render.calls++,N.info.render.vertices+=e.__webglFaceCount,N.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,J(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),N.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),
|
|
|
-N.info.render.calls++,N.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),N.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,i,h=a.__lights,k=a.fog;ta=-1;bb=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
-gc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Va.setFromMatrix(gc);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);N.info.render.calls=0;N.info.render.vertices=0;N.info.render.faces=0;N.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);i=a.__webglObjects;d=0;for(e=i.length;d<e;d++)if(f=i[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof
|
|
|
-THREE.ParticleSystem)||!g.frustumCulled||Va.intersectsObject(g))){C(g,b);var n=f,l=n.buffer,q=void 0,t=q=void 0,t=n.object.material;if(t instanceof THREE.MeshFaceMaterial)q=l.materialIndex,q=t.materials[q],q.transparent?(n.transparent=q,n.opaque=null):(n.opaque=q,n.transparent=null);else if(q=t)q.transparent?(n.transparent=q,n.opaque=null):(n.opaque=q,n.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Qa.getPositionFromMatrix(g.matrixWorld),Qa.applyProjection(gc),
|
|
|
-f.z=Qa.z),f.id=g.id)}this.sortObjects&&i.sort(m);i=a.__webglObjectsImmediate;d=0;for(e=i.length;d<e;d++)f=i[d],g=f.object,g.visible&&(C(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),E(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,
|
|
|
+N.info.render.calls++,N.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),N.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,i,h=a.__lights,k=a.fog;Ea=-1;db=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+rb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Ba.setFromMatrix(rb);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);N.info.render.calls=0;N.info.render.vertices=0;N.info.render.faces=0;N.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);i=a.__webglObjects;d=0;for(e=i.length;d<e;d++)if(f=i[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof
|
|
|
+THREE.ParticleSystem)||!g.frustumCulled||Ba.intersectsObject(g))){B(g,b);var n=f,l=n.buffer,q=void 0,t=q=void 0,t=n.object.material;if(t instanceof THREE.MeshFaceMaterial)q=l.materialIndex,q=t.materials[q],q.transparent?(n.transparent=q,n.opaque=null):(n.opaque=q,n.transparent=null);else if(q=t)q.transparent?(n.transparent=q,n.opaque=null):(n.opaque=q,n.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Ra.getPositionFromMatrix(g.matrixWorld),Ra.applyProjection(rb),
|
|
|
+f.z=Ra.z),f.id=g.id)}this.sortObjects&&i.sort(m);i=a.__webglObjectsImmediate;d=0;for(e=i.length;d<e;d++)f=i[d],g=f.object,g.visible&&(B(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),E(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,
|
|
|
h,k,!0,d),p(a.__webglObjectsImmediate,"",b,h,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,h,k,!1,d),p(a.__webglObjectsImmediate,"opaque",b,h,k,!1,d),r(a.__webglObjects,!1,"transparent",b,h,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,h,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),
|
|
|
-j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=A(a,b,c,d,e);ka=-1;N.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Va):e.render(function(a){N.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=
|
|
|
-[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,l=void 0,m=void 0,p=void 0,r=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",wd)),b instanceof THREE.Mesh)if(m=b.geometry,p=b.material,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var s=
|
|
|
+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=A(a,b,c,d,e);ma=-1;N.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ba):e.render(function(a){N.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=
|
|
|
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,l=void 0,m=void 0,p=void 0,r=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",vd)),b instanceof THREE.Mesh)if(m=b.geometry,p=b.material,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var s=
|
|
|
m,x=void 0,C=void 0,B=void 0,A=void 0,F=void 0,E=void 0,G={},I=s.morphTargets.length,J=s.morphNormals.length,K=p instanceof THREE.MeshFaceMaterial;s.geometryGroups={};x=0;for(C=s.faces.length;x<C;x++)B=s.faces[x],A=K?B.materialIndex:0,void 0===G[A]&&(G[A]={hash:A,counter:0}),E=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[E]&&(s.geometryGroups[E]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:I,numMorphNormals:J}),F=B instanceof THREE.Face3?3:4,65535<s.geometryGroups[E].vertices+
|
|
|
F&&(G[A].counter+=1,E=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[E]&&(s.geometryGroups[E]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:I,numMorphNormals:J})),B instanceof THREE.Face3?s.geometryGroups[E].faces3.push(x):s.geometryGroups[E].faces4.push(x),s.geometryGroups[E].vertices+=F;s.geometryGroupsList=[];var L=void 0;for(L in s.geometryGroups)s.geometryGroups[L].id=pa++,s.geometryGroupsList.push(s.geometryGroups[L])}for(l in m.geometryGroups)if(r=m.geometryGroups[l],
|
|
|
-!r.__webglVertexBuffer){var H=r;H.__webglVertexBuffer=j.createBuffer();H.__webglNormalBuffer=j.createBuffer();H.__webglTangentBuffer=j.createBuffer();H.__webglColorBuffer=j.createBuffer();H.__webglUVBuffer=j.createBuffer();H.__webglUV2Buffer=j.createBuffer();H.__webglSkinIndicesBuffer=j.createBuffer();H.__webglSkinWeightsBuffer=j.createBuffer();H.__webglFaceBuffer=j.createBuffer();H.__webglLineBuffer=j.createBuffer();var M=void 0,P=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];M=0;
|
|
|
-for(P=H.numMorphTargets;M<P;M++)H.__webglMorphTargetsBuffers.push(j.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];M=0;for(P=H.numMorphNormals;M<P;M++)H.__webglMorphNormalsBuffers.push(j.createBuffer())}N.info.memory.geometries++;d(r,b);m.verticesNeedUpdate=!0;m.morphTargetsNeedUpdate=!0;m.elementsNeedUpdate=!0;m.uvsNeedUpdate=!0;m.normalsNeedUpdate=!0;m.tangentsNeedUpdate=!0;m.colorsNeedUpdate=!0}}else m instanceof THREE.BufferGeometry&&h(m);else if(b instanceof THREE.Ribbon){if(m=
|
|
|
-b.geometry,!m.__webglVertexBuffer){var U=m;U.__webglVertexBuffer=j.createBuffer();U.__webglColorBuffer=j.createBuffer();U.__webglNormalBuffer=j.createBuffer();N.info.memory.geometries++;var aa=m,W=b,Y=aa.vertices.length;aa.__vertexArray=new Float32Array(3*Y);aa.__colorArray=new Float32Array(3*Y);aa.__normalArray=new Float32Array(3*Y);aa.__webglVertexCount=Y;c(aa,W);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0;m.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(m=b.geometry,!m.__webglVertexBuffer)if(m instanceof
|
|
|
-THREE.Geometry){var Z=m;Z.__webglVertexBuffer=j.createBuffer();Z.__webglColorBuffer=j.createBuffer();Z.__webglLineDistanceBuffer=j.createBuffer();N.info.memory.geometries++;var X=m,da=b,ka=X.vertices.length;X.__vertexArray=new Float32Array(3*ka);X.__colorArray=new Float32Array(3*ka);X.__lineDistanceArray=new Float32Array(1*ka);X.__webglLineCount=ka;c(X,da);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0;m.lineDistancesNeedUpdate=!0}else m instanceof THREE.BufferGeometry&&h(m)}else if(b instanceof THREE.ParticleSystem&&
|
|
|
-(m=b.geometry,!m.__webglVertexBuffer))if(m instanceof THREE.Geometry){var fa=m;fa.__webglVertexBuffer=j.createBuffer();fa.__webglColorBuffer=j.createBuffer();N.info.memory.geometries++;var ca=m,Ma=b,ha=ca.vertices.length;ca.__vertexArray=new Float32Array(3*ha);ca.__colorArray=new Float32Array(3*ha);ca.__sortArray=[];ca.__webglParticleCount=ha;c(ca,Ma);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0}else m instanceof THREE.BufferGeometry&&h(m);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(m=b.geometry,
|
|
|
+!r.__webglVertexBuffer){var H=r;H.__webglVertexBuffer=j.createBuffer();H.__webglNormalBuffer=j.createBuffer();H.__webglTangentBuffer=j.createBuffer();H.__webglColorBuffer=j.createBuffer();H.__webglUVBuffer=j.createBuffer();H.__webglUV2Buffer=j.createBuffer();H.__webglSkinIndicesBuffer=j.createBuffer();H.__webglSkinWeightsBuffer=j.createBuffer();H.__webglFaceBuffer=j.createBuffer();H.__webglLineBuffer=j.createBuffer();var M=void 0,Q=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];M=0;
|
|
|
+for(Q=H.numMorphTargets;M<Q;M++)H.__webglMorphTargetsBuffers.push(j.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];M=0;for(Q=H.numMorphNormals;M<Q;M++)H.__webglMorphNormalsBuffers.push(j.createBuffer())}N.info.memory.geometries++;d(r,b);m.verticesNeedUpdate=!0;m.morphTargetsNeedUpdate=!0;m.elementsNeedUpdate=!0;m.uvsNeedUpdate=!0;m.normalsNeedUpdate=!0;m.tangentsNeedUpdate=!0;m.colorsNeedUpdate=!0}}else m instanceof THREE.BufferGeometry&&h(m);else if(b instanceof THREE.Ribbon){if(m=
|
|
|
+b.geometry,!m.__webglVertexBuffer){var U=m;U.__webglVertexBuffer=j.createBuffer();U.__webglColorBuffer=j.createBuffer();U.__webglNormalBuffer=j.createBuffer();N.info.memory.geometries++;var W=m,ga=b,Y=W.vertices.length;W.__vertexArray=new Float32Array(3*Y);W.__colorArray=new Float32Array(3*Y);W.__normalArray=new Float32Array(3*Y);W.__webglVertexCount=Y;c(W,ga);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0;m.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(m=b.geometry,!m.__webglVertexBuffer)if(m instanceof
|
|
|
+THREE.Geometry){var Z=m;Z.__webglVertexBuffer=j.createBuffer();Z.__webglColorBuffer=j.createBuffer();Z.__webglLineDistanceBuffer=j.createBuffer();N.info.memory.geometries++;var X=m,ba=b,ma=X.vertices.length;X.__vertexArray=new Float32Array(3*ma);X.__colorArray=new Float32Array(3*ma);X.__lineDistanceArray=new Float32Array(1*ma);X.__webglLineCount=ma;c(X,ba);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0;m.lineDistancesNeedUpdate=!0}else m instanceof THREE.BufferGeometry&&h(m)}else if(b instanceof THREE.ParticleSystem&&
|
|
|
+(m=b.geometry,!m.__webglVertexBuffer))if(m instanceof THREE.Geometry){var da=m;da.__webglVertexBuffer=j.createBuffer();da.__webglColorBuffer=j.createBuffer();N.info.memory.geometries++;var ea=m,Na=b,ia=ea.vertices.length;ea.__vertexArray=new Float32Array(3*ia);ea.__colorArray=new Float32Array(3*ia);ea.__sortArray=[];ea.__webglParticleCount=ia;c(ea,Na);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0}else m instanceof THREE.BufferGeometry&&h(m);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(m=b.geometry,
|
|
|
m instanceof THREE.BufferGeometry)q(k.__webglObjects,m,b);else{if(m instanceof THREE.Geometry)for(l in m.geometryGroups)r=m.geometryGroups[l],q(k.__webglObjects,r,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(m=b.geometry,q(k.__webglObjects,m,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?k.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?k.__webglSprites.push(b):b instanceof THREE.LensFlare&&
|
|
|
-k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var Na=a.__objectsRemoved[0],la=a;Na instanceof THREE.Mesh||Na instanceof THREE.ParticleSystem||Na instanceof THREE.Ribbon||Na instanceof THREE.Line?z(la.__webglObjects,Na):Na instanceof THREE.Sprite?t(la.__webglSprites,Na):Na instanceof THREE.LensFlare?t(la.__webglFlares,Na):(Na instanceof THREE.ImmediateRenderObject||Na.immediateRenderCallback)&&z(la.__webglObjectsImmediate,Na);Na.__webglActive=
|
|
|
-!1;a.__objectsRemoved.splice(0,1)}for(var oa=0,ra=a.__webglObjects.length;oa<ra;oa++){var ta=a.__webglObjects[oa].object,O=ta.geometry,mb=void 0,qa=void 0,ia=void 0;if(ta instanceof THREE.Mesh)if(O instanceof THREE.BufferGeometry)(O.verticesNeedUpdate||O.elementsNeedUpdate||O.uvsNeedUpdate||O.normalsNeedUpdate||O.colorsNeedUpdate||O.tangentsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.elementsNeedUpdate=!1,O.uvsNeedUpdate=!1,O.normalsNeedUpdate=!1,O.colorsNeedUpdate=!1,O.tangentsNeedUpdate=
|
|
|
-!1;else{for(var Ca=0,Ka=O.geometryGroupsList.length;Ca<Ka;Ca++)if(mb=O.geometryGroupsList[Ca],ia=e(ta,mb),O.buffersNeedUpdate&&d(mb,ta),qa=ia.attributes&&y(ia),O.verticesNeedUpdate||O.morphTargetsNeedUpdate||O.elementsNeedUpdate||O.uvsNeedUpdate||O.normalsNeedUpdate||O.colorsNeedUpdate||O.tangentsNeedUpdate||qa){var sa=mb,La=ta,Pa=j.DYNAMIC_DRAW,Va=!O.dynamic,Fa=ia;if(sa.__inittedArrays){var gb=f(Fa),Wa=Fa.vertexColors?Fa.vertexColors:!1,bb=g(Fa),$a=gb===THREE.SmoothShading,D=void 0,V=void 0,Ra=void 0,
|
|
|
-Q=void 0,ab=void 0,Xa=void 0,Sa=void 0,nb=void 0,cb=void 0,pb=void 0,ub=void 0,R=void 0,S=void 0,T=void 0,na=void 0,Mb=void 0,Nb=void 0,Ob=void 0,xb=void 0,Pb=void 0,Qb=void 0,Rb=void 0,yb=void 0,Sb=void 0,Tb=void 0,Ub=void 0,zb=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Ib=void 0,Yb=void 0,Zb=void 0,$b=void 0,Jb=void 0,xa=void 0,fc=void 0,nc=void 0,Ab=void 0,yc=void 0,db=void 0,mc=void 0,Ya=void 0,Za=void 0,oc=void 0,hc=void 0,Oa=0,Ua=0,ic=0,jc=0,Eb=0,kb=0,Aa=0,ob=0,Ta=0,ba=0,ja=0,w=0,ya=void 0,eb=sa.__vertexArray,
|
|
|
-Dc=sa.__uvArray,Ec=sa.__uv2Array,Fb=sa.__normalArray,Ga=sa.__tangentArray,fb=sa.__colorArray,Ha=sa.__skinIndexArray,Ia=sa.__skinWeightArray,sc=sa.__morphTargetsArrays,tc=sa.__morphNormalsArrays,od=sa.__webglCustomAttributesList,u=void 0,ac=sa.__faceArray,wb=sa.__lineArray,qb=La.geometry,Mc=qb.elementsNeedUpdate,Cc=qb.uvsNeedUpdate,Nc=qb.normalsNeedUpdate,Oc=qb.tangentsNeedUpdate,Pc=qb.colorsNeedUpdate,fd=qb.morphTargetsNeedUpdate,uc=qb.vertices,ua=sa.faces3,va=sa.faces4,lb=qb.faces,pd=qb.faceVertexUvs[0],
|
|
|
-qd=qb.faceVertexUvs[1],vc=qb.skinIndices,pc=qb.skinWeights,qc=qb.morphTargets,Qc=qb.morphNormals;if(qb.verticesNeedUpdate){D=0;for(V=ua.length;D<V;D++)Q=lb[ua[D]],R=uc[Q.a],S=uc[Q.b],T=uc[Q.c],eb[Ua]=R.x,eb[Ua+1]=R.y,eb[Ua+2]=R.z,eb[Ua+3]=S.x,eb[Ua+4]=S.y,eb[Ua+5]=S.z,eb[Ua+6]=T.x,eb[Ua+7]=T.y,eb[Ua+8]=T.z,Ua+=9;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],R=uc[Q.a],S=uc[Q.b],T=uc[Q.c],na=uc[Q.d],eb[Ua]=R.x,eb[Ua+1]=R.y,eb[Ua+2]=R.z,eb[Ua+3]=S.x,eb[Ua+4]=S.y,eb[Ua+5]=S.z,eb[Ua+6]=T.x,eb[Ua+7]=T.y,eb[Ua+
|
|
|
-8]=T.z,eb[Ua+9]=na.x,eb[Ua+10]=na.y,eb[Ua+11]=na.z,Ua+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,eb,Pa)}if(fd){db=0;for(mc=qc.length;db<mc;db++){D=ja=0;for(V=ua.length;D<V;D++)oc=ua[D],Q=lb[oc],R=qc[db].vertices[Q.a],S=qc[db].vertices[Q.b],T=qc[db].vertices[Q.c],Ya=sc[db],Ya[ja]=R.x,Ya[ja+1]=R.y,Ya[ja+2]=R.z,Ya[ja+3]=S.x,Ya[ja+4]=S.y,Ya[ja+5]=S.z,Ya[ja+6]=T.x,Ya[ja+7]=T.y,Ya[ja+8]=T.z,Fa.morphNormals&&($a?(hc=Qc[db].vertexNormals[oc],Pb=hc.a,Qb=hc.b,Rb=hc.c):
|
|
|
-Rb=Qb=Pb=Qc[db].faceNormals[oc],Za=tc[db],Za[ja]=Pb.x,Za[ja+1]=Pb.y,Za[ja+2]=Pb.z,Za[ja+3]=Qb.x,Za[ja+4]=Qb.y,Za[ja+5]=Qb.z,Za[ja+6]=Rb.x,Za[ja+7]=Rb.y,Za[ja+8]=Rb.z),ja+=9;D=0;for(V=va.length;D<V;D++)oc=va[D],Q=lb[oc],R=qc[db].vertices[Q.a],S=qc[db].vertices[Q.b],T=qc[db].vertices[Q.c],na=qc[db].vertices[Q.d],Ya=sc[db],Ya[ja]=R.x,Ya[ja+1]=R.y,Ya[ja+2]=R.z,Ya[ja+3]=S.x,Ya[ja+4]=S.y,Ya[ja+5]=S.z,Ya[ja+6]=T.x,Ya[ja+7]=T.y,Ya[ja+8]=T.z,Ya[ja+9]=na.x,Ya[ja+10]=na.y,Ya[ja+11]=na.z,Fa.morphNormals&&($a?
|
|
|
-(hc=Qc[db].vertexNormals[oc],Pb=hc.a,Qb=hc.b,Rb=hc.c,yb=hc.d):yb=Rb=Qb=Pb=Qc[db].faceNormals[oc],Za=tc[db],Za[ja]=Pb.x,Za[ja+1]=Pb.y,Za[ja+2]=Pb.z,Za[ja+3]=Qb.x,Za[ja+4]=Qb.y,Za[ja+5]=Qb.z,Za[ja+6]=Rb.x,Za[ja+7]=Rb.y,Za[ja+8]=Rb.z,Za[ja+9]=yb.x,Za[ja+10]=yb.y,Za[ja+11]=yb.z),ja+=12;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphTargetsBuffers[db]);j.bufferData(j.ARRAY_BUFFER,sc[db],Pa);Fa.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglMorphNormalsBuffers[db]),j.bufferData(j.ARRAY_BUFFER,tc[db],
|
|
|
-Pa))}}if(pc.length){D=0;for(V=ua.length;D<V;D++)Q=lb[ua[D]],Vb=pc[Q.a],Wb=pc[Q.b],Xb=pc[Q.c],Ia[ba]=Vb.x,Ia[ba+1]=Vb.y,Ia[ba+2]=Vb.z,Ia[ba+3]=Vb.w,Ia[ba+4]=Wb.x,Ia[ba+5]=Wb.y,Ia[ba+6]=Wb.z,Ia[ba+7]=Wb.w,Ia[ba+8]=Xb.x,Ia[ba+9]=Xb.y,Ia[ba+10]=Xb.z,Ia[ba+11]=Xb.w,Yb=vc[Q.a],Zb=vc[Q.b],$b=vc[Q.c],Ha[ba]=Yb.x,Ha[ba+1]=Yb.y,Ha[ba+2]=Yb.z,Ha[ba+3]=Yb.w,Ha[ba+4]=Zb.x,Ha[ba+5]=Zb.y,Ha[ba+6]=Zb.z,Ha[ba+7]=Zb.w,Ha[ba+8]=$b.x,Ha[ba+9]=$b.y,Ha[ba+10]=$b.z,Ha[ba+11]=$b.w,ba+=12;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],
|
|
|
-Vb=pc[Q.a],Wb=pc[Q.b],Xb=pc[Q.c],Ib=pc[Q.d],Ia[ba]=Vb.x,Ia[ba+1]=Vb.y,Ia[ba+2]=Vb.z,Ia[ba+3]=Vb.w,Ia[ba+4]=Wb.x,Ia[ba+5]=Wb.y,Ia[ba+6]=Wb.z,Ia[ba+7]=Wb.w,Ia[ba+8]=Xb.x,Ia[ba+9]=Xb.y,Ia[ba+10]=Xb.z,Ia[ba+11]=Xb.w,Ia[ba+12]=Ib.x,Ia[ba+13]=Ib.y,Ia[ba+14]=Ib.z,Ia[ba+15]=Ib.w,Yb=vc[Q.a],Zb=vc[Q.b],$b=vc[Q.c],Jb=vc[Q.d],Ha[ba]=Yb.x,Ha[ba+1]=Yb.y,Ha[ba+2]=Yb.z,Ha[ba+3]=Yb.w,Ha[ba+4]=Zb.x,Ha[ba+5]=Zb.y,Ha[ba+6]=Zb.z,Ha[ba+7]=Zb.w,Ha[ba+8]=$b.x,Ha[ba+9]=$b.y,Ha[ba+10]=$b.z,Ha[ba+11]=$b.w,Ha[ba+12]=Jb.x,Ha[ba+
|
|
|
-13]=Jb.y,Ha[ba+14]=Jb.z,Ha[ba+15]=Jb.w,ba+=16;0<ba&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ha,Pa),j.bindBuffer(j.ARRAY_BUFFER,sa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ia,Pa))}if(Pc&&Wa){D=0;for(V=ua.length;D<V;D++)Q=lb[ua[D]],Sa=Q.vertexColors,nb=Q.color,3===Sa.length&&Wa===THREE.VertexColors?(Sb=Sa[0],Tb=Sa[1],Ub=Sa[2]):Ub=Tb=Sb=nb,fb[Ta]=Sb.r,fb[Ta+1]=Sb.g,fb[Ta+2]=Sb.b,fb[Ta+3]=Tb.r,fb[Ta+4]=Tb.g,fb[Ta+5]=Tb.b,fb[Ta+6]=Ub.r,fb[Ta+7]=
|
|
|
-Ub.g,fb[Ta+8]=Ub.b,Ta+=9;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],Sa=Q.vertexColors,nb=Q.color,4===Sa.length&&Wa===THREE.VertexColors?(Sb=Sa[0],Tb=Sa[1],Ub=Sa[2],zb=Sa[3]):zb=Ub=Tb=Sb=nb,fb[Ta]=Sb.r,fb[Ta+1]=Sb.g,fb[Ta+2]=Sb.b,fb[Ta+3]=Tb.r,fb[Ta+4]=Tb.g,fb[Ta+5]=Tb.b,fb[Ta+6]=Ub.r,fb[Ta+7]=Ub.g,fb[Ta+8]=Ub.b,fb[Ta+9]=zb.r,fb[Ta+10]=zb.g,fb[Ta+11]=zb.b,Ta+=12;0<Ta&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,fb,Pa))}if(Oc&&qb.hasTangents){D=0;for(V=ua.length;D<V;D++)Q=
|
|
|
-lb[ua[D]],cb=Q.vertexTangents,Mb=cb[0],Nb=cb[1],Ob=cb[2],Ga[Aa]=Mb.x,Ga[Aa+1]=Mb.y,Ga[Aa+2]=Mb.z,Ga[Aa+3]=Mb.w,Ga[Aa+4]=Nb.x,Ga[Aa+5]=Nb.y,Ga[Aa+6]=Nb.z,Ga[Aa+7]=Nb.w,Ga[Aa+8]=Ob.x,Ga[Aa+9]=Ob.y,Ga[Aa+10]=Ob.z,Ga[Aa+11]=Ob.w,Aa+=12;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],cb=Q.vertexTangents,Mb=cb[0],Nb=cb[1],Ob=cb[2],xb=cb[3],Ga[Aa]=Mb.x,Ga[Aa+1]=Mb.y,Ga[Aa+2]=Mb.z,Ga[Aa+3]=Mb.w,Ga[Aa+4]=Nb.x,Ga[Aa+5]=Nb.y,Ga[Aa+6]=Nb.z,Ga[Aa+7]=Nb.w,Ga[Aa+8]=Ob.x,Ga[Aa+9]=Ob.y,Ga[Aa+10]=Ob.z,Ga[Aa+11]=Ob.w,Ga[Aa+
|
|
|
-12]=xb.x,Ga[Aa+13]=xb.y,Ga[Aa+14]=xb.z,Ga[Aa+15]=xb.w,Aa+=16;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ga,Pa)}if(Nc&&gb){D=0;for(V=ua.length;D<V;D++)if(Q=lb[ua[D]],ab=Q.vertexNormals,Xa=Q.normal,3===ab.length&&$a)for(xa=0;3>xa;xa++)nc=ab[xa],Fb[kb]=nc.x,Fb[kb+1]=nc.y,Fb[kb+2]=nc.z,kb+=3;else for(xa=0;3>xa;xa++)Fb[kb]=Xa.x,Fb[kb+1]=Xa.y,Fb[kb+2]=Xa.z,kb+=3;D=0;for(V=va.length;D<V;D++)if(Q=lb[va[D]],ab=Q.vertexNormals,Xa=Q.normal,4===ab.length&&$a)for(xa=0;4>xa;xa++)nc=
|
|
|
-ab[xa],Fb[kb]=nc.x,Fb[kb+1]=nc.y,Fb[kb+2]=nc.z,kb+=3;else for(xa=0;4>xa;xa++)Fb[kb]=Xa.x,Fb[kb+1]=Xa.y,Fb[kb+2]=Xa.z,kb+=3;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Fb,Pa)}if(Cc&&pd&&bb){D=0;for(V=ua.length;D<V;D++)if(Ra=ua[D],pb=pd[Ra],void 0!==pb)for(xa=0;3>xa;xa++)Ab=pb[xa],Dc[ic]=Ab.x,Dc[ic+1]=Ab.y,ic+=2;D=0;for(V=va.length;D<V;D++)if(Ra=va[D],pb=pd[Ra],void 0!==pb)for(xa=0;4>xa;xa++)Ab=pb[xa],Dc[ic]=Ab.x,Dc[ic+1]=Ab.y,ic+=2;0<ic&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-sa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Dc,Pa))}if(Cc&&qd&&bb){D=0;for(V=ua.length;D<V;D++)if(Ra=ua[D],ub=qd[Ra],void 0!==ub)for(xa=0;3>xa;xa++)yc=ub[xa],Ec[jc]=yc.x,Ec[jc+1]=yc.y,jc+=2;D=0;for(V=va.length;D<V;D++)if(Ra=va[D],ub=qd[Ra],void 0!==ub)for(xa=0;4>xa;xa++)yc=ub[xa],Ec[jc]=yc.x,Ec[jc+1]=yc.y,jc+=2;0<jc&&(j.bindBuffer(j.ARRAY_BUFFER,sa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Ec,Pa))}if(Mc){D=0;for(V=ua.length;D<V;D++)ac[Eb]=Oa,ac[Eb+1]=Oa+1,ac[Eb+2]=Oa+2,Eb+=3,wb[ob]=Oa,wb[ob+
|
|
|
-1]=Oa+1,wb[ob+2]=Oa,wb[ob+3]=Oa+2,wb[ob+4]=Oa+1,wb[ob+5]=Oa+2,ob+=6,Oa+=3;D=0;for(V=va.length;D<V;D++)ac[Eb]=Oa,ac[Eb+1]=Oa+1,ac[Eb+2]=Oa+3,ac[Eb+3]=Oa+1,ac[Eb+4]=Oa+2,ac[Eb+5]=Oa+3,Eb+=6,wb[ob]=Oa,wb[ob+1]=Oa+1,wb[ob+2]=Oa,wb[ob+3]=Oa+3,wb[ob+4]=Oa+1,wb[ob+5]=Oa+2,wb[ob+6]=Oa+2,wb[ob+7]=Oa+3,ob+=8,Oa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ac,Pa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,sa.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-wb,Pa)}if(od){xa=0;for(fc=od.length;xa<fc;xa++)if(u=od[xa],u.__original.needsUpdate){w=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)Q=lb[ua[D]],u.array[w]=u.value[Q.a],u.array[w+1]=u.value[Q.b],u.array[w+2]=u.value[Q.c],w+=3;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],u.array[w]=u.value[Q.a],u.array[w+1]=u.value[Q.b],u.array[w+2]=u.value[Q.c],u.array[w+3]=u.value[Q.d],w+=4}else{if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)ya=u.value[ua[D]],u.array[w]=
|
|
|
-ya,u.array[w+1]=ya,u.array[w+2]=ya,w+=3;D=0;for(V=va.length;D<V;D++)ya=u.value[va[D]],u.array[w]=ya,u.array[w+1]=ya,u.array[w+2]=ya,u.array[w+3]=ya,w+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)Q=lb[ua[D]],R=u.value[Q.a],S=u.value[Q.b],T=u.value[Q.c],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,w+=6;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],R=u.value[Q.a],S=u.value[Q.b],T=u.value[Q.c],na=u.value[Q.d],
|
|
|
-u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,u.array[w+6]=na.x,u.array[w+7]=na.y,w+=8}else{if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)T=S=R=ya=u.value[ua[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,w+=6;D=0;for(V=va.length;D<V;D++)na=T=S=R=ya=u.value[va[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,u.array[w+6]=na.x,u.array[w+
|
|
|
-7]=na.y,w+=8}}else if(3===u.size){var $;$="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)Q=lb[ua[D]],R=u.value[Q.a],S=u.value[Q.b],T=u.value[Q.c],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],w+=9;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],R=u.value[Q.a],S=u.value[Q.b],T=u.value[Q.c],na=u.value[Q.d],
|
|
|
-u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],u.array[w+9]=na[$[0]],u.array[w+10]=na[$[1]],u.array[w+11]=na[$[2]],w+=12}else if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)T=S=R=ya=u.value[ua[D]],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],
|
|
|
-u.array[w+8]=T[$[2]],w+=9;D=0;for(V=va.length;D<V;D++)na=T=S=R=ya=u.value[va[D]],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],u.array[w+9]=na[$[0]],u.array[w+10]=na[$[1]],u.array[w+11]=na[$[2]],w+=12}else if("faceVertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)ya=u.value[ua[D]],R=ya[0],S=ya[1],T=ya[2],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=
|
|
|
-R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],w+=9;D=0;for(V=va.length;D<V;D++)ya=u.value[va[D]],R=ya[0],S=ya[1],T=ya[2],na=ya[3],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],u.array[w+9]=na[$[0]],u.array[w+10]=na[$[1]],u.array[w+11]=na[$[2]],w+=12}}else if(4===u.size)if(void 0===
|
|
|
-u.boundTo||"vertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)Q=lb[ua[D]],R=u.value[Q.a],S=u.value[Q.b],T=u.value[Q.c],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,w+=12;D=0;for(V=va.length;D<V;D++)Q=lb[va[D]],R=u.value[Q.a],S=u.value[Q.b],T=u.value[Q.c],na=u.value[Q.d],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+
|
|
|
-4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,u.array[w+12]=na.x,u.array[w+13]=na.y,u.array[w+14]=na.z,u.array[w+15]=na.w,w+=16}else if("faces"===u.boundTo){D=0;for(V=ua.length;D<V;D++)T=S=R=ya=u.value[ua[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,w+=12;
|
|
|
-D=0;for(V=va.length;D<V;D++)na=T=S=R=ya=u.value[va[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,u.array[w+12]=na.x,u.array[w+13]=na.y,u.array[w+14]=na.z,u.array[w+15]=na.w,w+=16}else if("faceVertices"===u.boundTo){D=0;for(V=ua.length;D<V;D++)ya=u.value[ua[D]],R=ya[0],S=ya[1],T=ya[2],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+
|
|
|
-3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,w+=12;D=0;for(V=va.length;D<V;D++)ya=u.value[va[D]],R=ya[0],S=ya[1],T=ya[2],na=ya[3],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,u.array[w+12]=na.x,u.array[w+13]=na.y,u.array[w+14]=na.z,u.array[w+
|
|
|
-15]=na.w,w+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,Pa)}}Va&&(delete sa.__inittedArrays,delete sa.__colorArray,delete sa.__normalArray,delete sa.__tangentArray,delete sa.__uvArray,delete sa.__uv2Array,delete sa.__faceArray,delete sa.__vertexArray,delete sa.__lineArray,delete sa.__skinIndexArray,delete sa.__skinWeightArray)}}O.verticesNeedUpdate=!1;O.morphTargetsNeedUpdate=!1;O.elementsNeedUpdate=!1;O.uvsNeedUpdate=!1;O.normalsNeedUpdate=!1;O.colorsNeedUpdate=!1;
|
|
|
-O.tangentsNeedUpdate=!1;O.buffersNeedUpdate=!1;ia.attributes&&v(ia)}else if(ta instanceof THREE.Ribbon){ia=e(ta,O);qa=ia.attributes&&y(ia);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.normalsNeedUpdate||qa){var Gb=O,Rc=j.DYNAMIC_DRAW,Fc=void 0,Gc=void 0,Hc=void 0,Sc=void 0,za=void 0,Tc=void 0,Uc=void 0,Vc=void 0,xd=void 0,ib=void 0,zc=void 0,Da=void 0,rb=void 0,yd=Gb.vertices,zd=Gb.colors,Ad=Gb.normals,gd=yd.length,hd=zd.length,id=Ad.length,Wc=Gb.__vertexArray,Xc=Gb.__colorArray,Yc=Gb.__normalArray,
|
|
|
-jd=Gb.colorsNeedUpdate,kd=Gb.normalsNeedUpdate,rd=Gb.__webglCustomAttributesList;if(Gb.verticesNeedUpdate){for(Fc=0;Fc<gd;Fc++)Sc=yd[Fc],za=3*Fc,Wc[za]=Sc.x,Wc[za+1]=Sc.y,Wc[za+2]=Sc.z;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Wc,Rc)}if(jd){for(Gc=0;Gc<hd;Gc++)Tc=zd[Gc],za=3*Gc,Xc[za]=Tc.r,Xc[za+1]=Tc.g,Xc[za+2]=Tc.b;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Xc,Rc)}if(kd){for(Hc=0;Hc<id;Hc++)Uc=Ad[Hc],za=3*Hc,Yc[za]=Uc.x,Yc[za+
|
|
|
-1]=Uc.y,Yc[za+2]=Uc.z;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Yc,Rc)}if(rd){Vc=0;for(xd=rd.length;Vc<xd;Vc++)if(Da=rd[Vc],Da.needsUpdate&&(void 0===Da.boundTo||"vertices"===Da.boundTo)){za=0;zc=Da.value.length;if(1===Da.size)for(ib=0;ib<zc;ib++)Da.array[ib]=Da.value[ib];else if(2===Da.size)for(ib=0;ib<zc;ib++)rb=Da.value[ib],Da.array[za]=rb.x,Da.array[za+1]=rb.y,za+=2;else if(3===Da.size)if("c"===Da.type)for(ib=0;ib<zc;ib++)rb=Da.value[ib],Da.array[za]=rb.r,
|
|
|
-Da.array[za+1]=rb.g,Da.array[za+2]=rb.b,za+=3;else for(ib=0;ib<zc;ib++)rb=Da.value[ib],Da.array[za]=rb.x,Da.array[za+1]=rb.y,Da.array[za+2]=rb.z,za+=3;else if(4===Da.size)for(ib=0;ib<zc;ib++)rb=Da.value[ib],Da.array[za]=rb.x,Da.array[za+1]=rb.y,Da.array[za+2]=rb.z,Da.array[za+3]=rb.w,za+=4;j.bindBuffer(j.ARRAY_BUFFER,Da.buffer);j.bufferData(j.ARRAY_BUFFER,Da.array,Rc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.normalsNeedUpdate=!1;ia.attributes&&v(ia)}else if(ta instanceof THREE.Line)if(O instanceof
|
|
|
-THREE.BufferGeometry)(O.verticesNeedUpdate||O.colorsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.colorsNeedUpdate=!1;else{ia=e(ta,O);qa=ia.attributes&&y(ia);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.lineDistancesNeedUpdate||qa){var Hb=O,Zc=j.DYNAMIC_DRAW,Ic=void 0,Jc=void 0,Kc=void 0,$c=void 0,Ja=void 0,ad=void 0,Bd=Hb.vertices,Cd=Hb.colors,Dd=Hb.lineDistances,ld=Bd.length,Jd=Cd.length,Kd=Dd.length,bd=Hb.__vertexArray,cd=Hb.__colorArray,Ed=Hb.__lineDistanceArray,Ld=Hb.colorsNeedUpdate,
|
|
|
-Md=Hb.lineDistancesNeedUpdate,sd=Hb.__webglCustomAttributesList,dd=void 0,Fd=void 0,jb=void 0,Ac=void 0,sb=void 0,Ea=void 0;if(Hb.verticesNeedUpdate){for(Ic=0;Ic<ld;Ic++)$c=Bd[Ic],Ja=3*Ic,bd[Ja]=$c.x,bd[Ja+1]=$c.y,bd[Ja+2]=$c.z;j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,bd,Zc)}if(Ld){for(Jc=0;Jc<Jd;Jc++)ad=Cd[Jc],Ja=3*Jc,cd[Ja]=ad.r,cd[Ja+1]=ad.g,cd[Ja+2]=ad.b;j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,cd,Zc)}if(Md){for(Kc=0;Kc<
|
|
|
-Kd;Kc++)Ed[Kc]=Dd[Kc];j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Ed,Zc)}if(sd){dd=0;for(Fd=sd.length;dd<Fd;dd++)if(Ea=sd[dd],Ea.needsUpdate&&(void 0===Ea.boundTo||"vertices"===Ea.boundTo)){Ja=0;Ac=Ea.value.length;if(1===Ea.size)for(jb=0;jb<Ac;jb++)Ea.array[jb]=Ea.value[jb];else if(2===Ea.size)for(jb=0;jb<Ac;jb++)sb=Ea.value[jb],Ea.array[Ja]=sb.x,Ea.array[Ja+1]=sb.y,Ja+=2;else if(3===Ea.size)if("c"===Ea.type)for(jb=0;jb<Ac;jb++)sb=Ea.value[jb],Ea.array[Ja]=
|
|
|
-sb.r,Ea.array[Ja+1]=sb.g,Ea.array[Ja+2]=sb.b,Ja+=3;else for(jb=0;jb<Ac;jb++)sb=Ea.value[jb],Ea.array[Ja]=sb.x,Ea.array[Ja+1]=sb.y,Ea.array[Ja+2]=sb.z,Ja+=3;else if(4===Ea.size)for(jb=0;jb<Ac;jb++)sb=Ea.value[jb],Ea.array[Ja]=sb.x,Ea.array[Ja+1]=sb.y,Ea.array[Ja+2]=sb.z,Ea.array[Ja+3]=sb.w,Ja+=4;j.bindBuffer(j.ARRAY_BUFFER,Ea.buffer);j.bufferData(j.ARRAY_BUFFER,Ea.array,Zc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.lineDistancesNeedUpdate=!1;ia.attributes&&v(ia)}else if(ta instanceof THREE.ParticleSystem)if(O instanceof
|
|
|
-THREE.BufferGeometry)(O.verticesNeedUpdate||O.colorsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.colorsNeedUpdate=!1;else{ia=e(ta,O);qa=ia.attributes&&y(ia);if(O.verticesNeedUpdate||O.colorsNeedUpdate||ta.sortParticles||qa){var bc=O,td=j.DYNAMIC_DRAW,Lc=ta,tb=void 0,cc=void 0,dc=void 0,ga=void 0,ec=void 0,rc=void 0,ed=bc.vertices,ud=ed.length,vd=bc.colors,Gd=vd.length,wc=bc.__vertexArray,xc=bc.__colorArray,kc=bc.__sortArray,Hd=bc.verticesNeedUpdate,Id=bc.colorsNeedUpdate,
|
|
|
-lc=bc.__webglCustomAttributesList,Kb=void 0,Bc=void 0,ma=void 0,Lb=void 0,Ba=void 0,ea=void 0;if(Lc.sortParticles){vb.copy(gc);vb.multiply(Lc.matrixWorld);for(tb=0;tb<ud;tb++)dc=ed[tb],Qa.copy(dc),Qa.applyProjection(vb),kc[tb]=[Qa.z,tb];kc.sort(n);for(tb=0;tb<ud;tb++)dc=ed[kc[tb][1]],ga=3*tb,wc[ga]=dc.x,wc[ga+1]=dc.y,wc[ga+2]=dc.z;for(cc=0;cc<Gd;cc++)ga=3*cc,rc=vd[kc[cc][1]],xc[ga]=rc.r,xc[ga+1]=rc.g,xc[ga+2]=rc.b;if(lc){Kb=0;for(Bc=lc.length;Kb<Bc;Kb++)if(ea=lc[Kb],void 0===ea.boundTo||"vertices"===
|
|
|
-ea.boundTo)if(ga=0,Lb=ea.value.length,1===ea.size)for(ma=0;ma<Lb;ma++)ec=kc[ma][1],ea.array[ma]=ea.value[ec];else if(2===ea.size)for(ma=0;ma<Lb;ma++)ec=kc[ma][1],Ba=ea.value[ec],ea.array[ga]=Ba.x,ea.array[ga+1]=Ba.y,ga+=2;else if(3===ea.size)if("c"===ea.type)for(ma=0;ma<Lb;ma++)ec=kc[ma][1],Ba=ea.value[ec],ea.array[ga]=Ba.r,ea.array[ga+1]=Ba.g,ea.array[ga+2]=Ba.b,ga+=3;else for(ma=0;ma<Lb;ma++)ec=kc[ma][1],Ba=ea.value[ec],ea.array[ga]=Ba.x,ea.array[ga+1]=Ba.y,ea.array[ga+2]=Ba.z,ga+=3;else if(4===
|
|
|
-ea.size)for(ma=0;ma<Lb;ma++)ec=kc[ma][1],Ba=ea.value[ec],ea.array[ga]=Ba.x,ea.array[ga+1]=Ba.y,ea.array[ga+2]=Ba.z,ea.array[ga+3]=Ba.w,ga+=4}}else{if(Hd)for(tb=0;tb<ud;tb++)dc=ed[tb],ga=3*tb,wc[ga]=dc.x,wc[ga+1]=dc.y,wc[ga+2]=dc.z;if(Id)for(cc=0;cc<Gd;cc++)rc=vd[cc],ga=3*cc,xc[ga]=rc.r,xc[ga+1]=rc.g,xc[ga+2]=rc.b;if(lc){Kb=0;for(Bc=lc.length;Kb<Bc;Kb++)if(ea=lc[Kb],ea.needsUpdate&&(void 0===ea.boundTo||"vertices"===ea.boundTo))if(Lb=ea.value.length,ga=0,1===ea.size)for(ma=0;ma<Lb;ma++)ea.array[ma]=
|
|
|
-ea.value[ma];else if(2===ea.size)for(ma=0;ma<Lb;ma++)Ba=ea.value[ma],ea.array[ga]=Ba.x,ea.array[ga+1]=Ba.y,ga+=2;else if(3===ea.size)if("c"===ea.type)for(ma=0;ma<Lb;ma++)Ba=ea.value[ma],ea.array[ga]=Ba.r,ea.array[ga+1]=Ba.g,ea.array[ga+2]=Ba.b,ga+=3;else for(ma=0;ma<Lb;ma++)Ba=ea.value[ma],ea.array[ga]=Ba.x,ea.array[ga+1]=Ba.y,ea.array[ga+2]=Ba.z,ga+=3;else if(4===ea.size)for(ma=0;ma<Lb;ma++)Ba=ea.value[ma],ea.array[ga]=Ba.x,ea.array[ga+1]=Ba.y,ea.array[ga+2]=Ba.z,ea.array[ga+3]=Ba.w,ga+=4}}if(Hd||
|
|
|
-Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,wc,td);if(Id||Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xc,td);if(lc){Kb=0;for(Bc=lc.length;Kb<Bc;Kb++)if(ea=lc[Kb],ea.needsUpdate||Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ea.buffer),j.bufferData(j.ARRAY_BUFFER,ea.array,td)}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;ia.attributes&&v(ia)}}};this.initMaterial=function(a,b,c,d){var e,f,g,i;a.addEventListener("dispose",
|
|
|
-X);var h,k,m,n,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.LineDashedMaterial?l="dashed":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var p=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=
|
|
|
-p.vertexShader;a.fragmentShader=p.fragmentShader}var q,s,r;e=g=s=r=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;i=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);n=q;tc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),
|
|
|
+k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var ja=a.__objectsRemoved[0],pb=a;ja instanceof THREE.Mesh||ja instanceof THREE.ParticleSystem||ja instanceof THREE.Ribbon||ja instanceof THREE.Line?z(pb.__webglObjects,ja):ja instanceof THREE.Sprite?t(pb.__webglSprites,ja):ja instanceof THREE.LensFlare?t(pb.__webglFlares,ja):(ja instanceof THREE.ImmediateRenderObject||ja.immediateRenderCallback)&&z(pb.__webglObjectsImmediate,ja);ja.__webglActive=
|
|
|
+!1;a.__objectsRemoved.splice(0,1)}for(var qa=0,sa=a.__webglObjects.length;qa<sa;qa++){var ka=a.__webglObjects[qa].object,O=ka.geometry,Ea=void 0,ab=void 0,ha=void 0;if(ka instanceof THREE.Mesh)if(O instanceof THREE.BufferGeometry)(O.verticesNeedUpdate||O.elementsNeedUpdate||O.uvsNeedUpdate||O.normalsNeedUpdate||O.colorsNeedUpdate||O.tangentsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.elementsNeedUpdate=!1,O.uvsNeedUpdate=!1,O.normalsNeedUpdate=!1,O.colorsNeedUpdate=!1,O.tangentsNeedUpdate=
|
|
|
+!1;else{for(var wa=0,Fa=O.geometryGroupsList.length;wa<Fa;wa++)if(Ea=O.geometryGroupsList[wa],ha=e(ka,Ea),O.buffersNeedUpdate&&d(Ea,ka),ab=ha.attributes&&y(ha),O.verticesNeedUpdate||O.morphTargetsNeedUpdate||O.elementsNeedUpdate||O.uvsNeedUpdate||O.normalsNeedUpdate||O.colorsNeedUpdate||O.tangentsNeedUpdate||ab){var ra=Ea,Ka=ka,Oa=j.DYNAMIC_DRAW,Ta=!O.dynamic,Ba=ha;if(ra.__inittedArrays){var Wa=f(Ba),bb=Ba.vertexColors?Ba.vertexColors:!1,cb=g(Ba),Xa=Wa===THREE.SmoothShading,D=void 0,V=void 0,Pa=void 0,
|
|
|
+P=void 0,Ya=void 0,Va=void 0,Qa=void 0,mb=void 0,db=void 0,nb=void 0,qb=void 0,R=void 0,S=void 0,T=void 0,oa=void 0,Lb=void 0,Mb=void 0,Nb=void 0,wb=void 0,Ob=void 0,Pb=void 0,Qb=void 0,yb=void 0,Rb=void 0,Sb=void 0,Tb=void 0,zb=void 0,Ub=void 0,Vb=void 0,Wb=void 0,Hb=void 0,Xb=void 0,Yb=void 0,Zb=void 0,Ib=void 0,va=void 0,ec=void 0,lc=void 0,Ab=void 0,xc=void 0,eb=void 0,kc=void 0,Za=void 0,$a=void 0,mc=void 0,fc=void 0,Ma=0,Ua=0,gc=0,hc=0,Db=0,kb=0,za=0,ob=0,Sa=0,aa=0,la=0,w=0,xa=void 0,fb=ra.__vertexArray,
|
|
|
+Cc=ra.__uvArray,Dc=ra.__uv2Array,Eb=ra.__normalArray,Ga=ra.__tangentArray,gb=ra.__colorArray,Ha=ra.__skinIndexArray,Ia=ra.__skinWeightArray,qc=ra.__morphTargetsArrays,rc=ra.__morphNormalsArrays,nd=ra.__webglCustomAttributesList,u=void 0,$b=ra.__faceArray,xb=ra.__lineArray,sb=Ka.geometry,Lc=sb.elementsNeedUpdate,Bc=sb.uvsNeedUpdate,Mc=sb.normalsNeedUpdate,Nc=sb.tangentsNeedUpdate,dd=sb.colorsNeedUpdate,ed=sb.morphTargetsNeedUpdate,sc=sb.vertices,ta=ra.faces3,ua=ra.faces4,lb=sb.faces,od=sb.faceVertexUvs[0],
|
|
|
+pd=sb.faceVertexUvs[1],tc=sb.skinIndices,nc=sb.skinWeights,oc=sb.morphTargets,Oc=sb.morphNormals;if(sb.verticesNeedUpdate){D=0;for(V=ta.length;D<V;D++)P=lb[ta[D]],R=sc[P.a],S=sc[P.b],T=sc[P.c],fb[Ua]=R.x,fb[Ua+1]=R.y,fb[Ua+2]=R.z,fb[Ua+3]=S.x,fb[Ua+4]=S.y,fb[Ua+5]=S.z,fb[Ua+6]=T.x,fb[Ua+7]=T.y,fb[Ua+8]=T.z,Ua+=9;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],R=sc[P.a],S=sc[P.b],T=sc[P.c],oa=sc[P.d],fb[Ua]=R.x,fb[Ua+1]=R.y,fb[Ua+2]=R.z,fb[Ua+3]=S.x,fb[Ua+4]=S.y,fb[Ua+5]=S.z,fb[Ua+6]=T.x,fb[Ua+7]=T.y,fb[Ua+
|
|
|
+8]=T.z,fb[Ua+9]=oa.x,fb[Ua+10]=oa.y,fb[Ua+11]=oa.z,Ua+=12;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,fb,Oa)}if(ed){eb=0;for(kc=oc.length;eb<kc;eb++){D=la=0;for(V=ta.length;D<V;D++)mc=ta[D],P=lb[mc],R=oc[eb].vertices[P.a],S=oc[eb].vertices[P.b],T=oc[eb].vertices[P.c],Za=qc[eb],Za[la]=R.x,Za[la+1]=R.y,Za[la+2]=R.z,Za[la+3]=S.x,Za[la+4]=S.y,Za[la+5]=S.z,Za[la+6]=T.x,Za[la+7]=T.y,Za[la+8]=T.z,Ba.morphNormals&&(Xa?(fc=Oc[eb].vertexNormals[mc],Ob=fc.a,Pb=fc.b,Qb=fc.c):
|
|
|
+Qb=Pb=Ob=Oc[eb].faceNormals[mc],$a=rc[eb],$a[la]=Ob.x,$a[la+1]=Ob.y,$a[la+2]=Ob.z,$a[la+3]=Pb.x,$a[la+4]=Pb.y,$a[la+5]=Pb.z,$a[la+6]=Qb.x,$a[la+7]=Qb.y,$a[la+8]=Qb.z),la+=9;D=0;for(V=ua.length;D<V;D++)mc=ua[D],P=lb[mc],R=oc[eb].vertices[P.a],S=oc[eb].vertices[P.b],T=oc[eb].vertices[P.c],oa=oc[eb].vertices[P.d],Za=qc[eb],Za[la]=R.x,Za[la+1]=R.y,Za[la+2]=R.z,Za[la+3]=S.x,Za[la+4]=S.y,Za[la+5]=S.z,Za[la+6]=T.x,Za[la+7]=T.y,Za[la+8]=T.z,Za[la+9]=oa.x,Za[la+10]=oa.y,Za[la+11]=oa.z,Ba.morphNormals&&(Xa?
|
|
|
+(fc=Oc[eb].vertexNormals[mc],Ob=fc.a,Pb=fc.b,Qb=fc.c,yb=fc.d):yb=Qb=Pb=Ob=Oc[eb].faceNormals[mc],$a=rc[eb],$a[la]=Ob.x,$a[la+1]=Ob.y,$a[la+2]=Ob.z,$a[la+3]=Pb.x,$a[la+4]=Pb.y,$a[la+5]=Pb.z,$a[la+6]=Qb.x,$a[la+7]=Qb.y,$a[la+8]=Qb.z,$a[la+9]=yb.x,$a[la+10]=yb.y,$a[la+11]=yb.z),la+=12;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglMorphTargetsBuffers[eb]);j.bufferData(j.ARRAY_BUFFER,qc[eb],Oa);Ba.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglMorphNormalsBuffers[eb]),j.bufferData(j.ARRAY_BUFFER,rc[eb],
|
|
|
+Oa))}}if(nc.length){D=0;for(V=ta.length;D<V;D++)P=lb[ta[D]],Ub=nc[P.a],Vb=nc[P.b],Wb=nc[P.c],Ia[aa]=Ub.x,Ia[aa+1]=Ub.y,Ia[aa+2]=Ub.z,Ia[aa+3]=Ub.w,Ia[aa+4]=Vb.x,Ia[aa+5]=Vb.y,Ia[aa+6]=Vb.z,Ia[aa+7]=Vb.w,Ia[aa+8]=Wb.x,Ia[aa+9]=Wb.y,Ia[aa+10]=Wb.z,Ia[aa+11]=Wb.w,Xb=tc[P.a],Yb=tc[P.b],Zb=tc[P.c],Ha[aa]=Xb.x,Ha[aa+1]=Xb.y,Ha[aa+2]=Xb.z,Ha[aa+3]=Xb.w,Ha[aa+4]=Yb.x,Ha[aa+5]=Yb.y,Ha[aa+6]=Yb.z,Ha[aa+7]=Yb.w,Ha[aa+8]=Zb.x,Ha[aa+9]=Zb.y,Ha[aa+10]=Zb.z,Ha[aa+11]=Zb.w,aa+=12;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],
|
|
|
+Ub=nc[P.a],Vb=nc[P.b],Wb=nc[P.c],Hb=nc[P.d],Ia[aa]=Ub.x,Ia[aa+1]=Ub.y,Ia[aa+2]=Ub.z,Ia[aa+3]=Ub.w,Ia[aa+4]=Vb.x,Ia[aa+5]=Vb.y,Ia[aa+6]=Vb.z,Ia[aa+7]=Vb.w,Ia[aa+8]=Wb.x,Ia[aa+9]=Wb.y,Ia[aa+10]=Wb.z,Ia[aa+11]=Wb.w,Ia[aa+12]=Hb.x,Ia[aa+13]=Hb.y,Ia[aa+14]=Hb.z,Ia[aa+15]=Hb.w,Xb=tc[P.a],Yb=tc[P.b],Zb=tc[P.c],Ib=tc[P.d],Ha[aa]=Xb.x,Ha[aa+1]=Xb.y,Ha[aa+2]=Xb.z,Ha[aa+3]=Xb.w,Ha[aa+4]=Yb.x,Ha[aa+5]=Yb.y,Ha[aa+6]=Yb.z,Ha[aa+7]=Yb.w,Ha[aa+8]=Zb.x,Ha[aa+9]=Zb.y,Ha[aa+10]=Zb.z,Ha[aa+11]=Zb.w,Ha[aa+12]=Ib.x,Ha[aa+
|
|
|
+13]=Ib.y,Ha[aa+14]=Ib.z,Ha[aa+15]=Ib.w,aa+=16;0<aa&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ha,Oa),j.bindBuffer(j.ARRAY_BUFFER,ra.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ia,Oa))}if(dd&&bb){D=0;for(V=ta.length;D<V;D++)P=lb[ta[D]],Qa=P.vertexColors,mb=P.color,3===Qa.length&&bb===THREE.VertexColors?(Rb=Qa[0],Sb=Qa[1],Tb=Qa[2]):Tb=Sb=Rb=mb,gb[Sa]=Rb.r,gb[Sa+1]=Rb.g,gb[Sa+2]=Rb.b,gb[Sa+3]=Sb.r,gb[Sa+4]=Sb.g,gb[Sa+5]=Sb.b,gb[Sa+6]=Tb.r,gb[Sa+7]=
|
|
|
+Tb.g,gb[Sa+8]=Tb.b,Sa+=9;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],Qa=P.vertexColors,mb=P.color,4===Qa.length&&bb===THREE.VertexColors?(Rb=Qa[0],Sb=Qa[1],Tb=Qa[2],zb=Qa[3]):zb=Tb=Sb=Rb=mb,gb[Sa]=Rb.r,gb[Sa+1]=Rb.g,gb[Sa+2]=Rb.b,gb[Sa+3]=Sb.r,gb[Sa+4]=Sb.g,gb[Sa+5]=Sb.b,gb[Sa+6]=Tb.r,gb[Sa+7]=Tb.g,gb[Sa+8]=Tb.b,gb[Sa+9]=zb.r,gb[Sa+10]=zb.g,gb[Sa+11]=zb.b,Sa+=12;0<Sa&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,gb,Oa))}if(Nc&&sb.hasTangents){D=0;for(V=ta.length;D<V;D++)P=
|
|
|
+lb[ta[D]],db=P.vertexTangents,Lb=db[0],Mb=db[1],Nb=db[2],Ga[za]=Lb.x,Ga[za+1]=Lb.y,Ga[za+2]=Lb.z,Ga[za+3]=Lb.w,Ga[za+4]=Mb.x,Ga[za+5]=Mb.y,Ga[za+6]=Mb.z,Ga[za+7]=Mb.w,Ga[za+8]=Nb.x,Ga[za+9]=Nb.y,Ga[za+10]=Nb.z,Ga[za+11]=Nb.w,za+=12;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],db=P.vertexTangents,Lb=db[0],Mb=db[1],Nb=db[2],wb=db[3],Ga[za]=Lb.x,Ga[za+1]=Lb.y,Ga[za+2]=Lb.z,Ga[za+3]=Lb.w,Ga[za+4]=Mb.x,Ga[za+5]=Mb.y,Ga[za+6]=Mb.z,Ga[za+7]=Mb.w,Ga[za+8]=Nb.x,Ga[za+9]=Nb.y,Ga[za+10]=Nb.z,Ga[za+11]=Nb.w,Ga[za+
|
|
|
+12]=wb.x,Ga[za+13]=wb.y,Ga[za+14]=wb.z,Ga[za+15]=wb.w,za+=16;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ga,Oa)}if(Mc&&Wa){D=0;for(V=ta.length;D<V;D++)if(P=lb[ta[D]],Ya=P.vertexNormals,Va=P.normal,3===Ya.length&&Xa)for(va=0;3>va;va++)lc=Ya[va],Eb[kb]=lc.x,Eb[kb+1]=lc.y,Eb[kb+2]=lc.z,kb+=3;else for(va=0;3>va;va++)Eb[kb]=Va.x,Eb[kb+1]=Va.y,Eb[kb+2]=Va.z,kb+=3;D=0;for(V=ua.length;D<V;D++)if(P=lb[ua[D]],Ya=P.vertexNormals,Va=P.normal,4===Ya.length&&Xa)for(va=0;4>va;va++)lc=
|
|
|
+Ya[va],Eb[kb]=lc.x,Eb[kb+1]=lc.y,Eb[kb+2]=lc.z,kb+=3;else for(va=0;4>va;va++)Eb[kb]=Va.x,Eb[kb+1]=Va.y,Eb[kb+2]=Va.z,kb+=3;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Eb,Oa)}if(Bc&&od&&cb){D=0;for(V=ta.length;D<V;D++)if(Pa=ta[D],nb=od[Pa],void 0!==nb)for(va=0;3>va;va++)Ab=nb[va],Cc[gc]=Ab.x,Cc[gc+1]=Ab.y,gc+=2;D=0;for(V=ua.length;D<V;D++)if(Pa=ua[D],nb=od[Pa],void 0!==nb)for(va=0;4>va;va++)Ab=nb[va],Cc[gc]=Ab.x,Cc[gc+1]=Ab.y,gc+=2;0<gc&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+ra.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Cc,Oa))}if(Bc&&pd&&cb){D=0;for(V=ta.length;D<V;D++)if(Pa=ta[D],qb=pd[Pa],void 0!==qb)for(va=0;3>va;va++)xc=qb[va],Dc[hc]=xc.x,Dc[hc+1]=xc.y,hc+=2;D=0;for(V=ua.length;D<V;D++)if(Pa=ua[D],qb=pd[Pa],void 0!==qb)for(va=0;4>va;va++)xc=qb[va],Dc[hc]=xc.x,Dc[hc+1]=xc.y,hc+=2;0<hc&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Dc,Oa))}if(Lc){D=0;for(V=ta.length;D<V;D++)$b[Db]=Ma,$b[Db+1]=Ma+1,$b[Db+2]=Ma+2,Db+=3,xb[ob]=Ma,xb[ob+
|
|
|
+1]=Ma+1,xb[ob+2]=Ma,xb[ob+3]=Ma+2,xb[ob+4]=Ma+1,xb[ob+5]=Ma+2,ob+=6,Ma+=3;D=0;for(V=ua.length;D<V;D++)$b[Db]=Ma,$b[Db+1]=Ma+1,$b[Db+2]=Ma+3,$b[Db+3]=Ma+1,$b[Db+4]=Ma+2,$b[Db+5]=Ma+3,Db+=6,xb[ob]=Ma,xb[ob+1]=Ma+1,xb[ob+2]=Ma,xb[ob+3]=Ma+3,xb[ob+4]=Ma+1,xb[ob+5]=Ma+2,xb[ob+6]=Ma+2,xb[ob+7]=Ma+3,ob+=8,Ma+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ra.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,$b,Oa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ra.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+xb,Oa)}if(nd){va=0;for(ec=nd.length;va<ec;va++)if(u=nd[va],u.__original.needsUpdate){w=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ta.length;D<V;D++)P=lb[ta[D]],u.array[w]=u.value[P.a],u.array[w+1]=u.value[P.b],u.array[w+2]=u.value[P.c],w+=3;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],u.array[w]=u.value[P.a],u.array[w+1]=u.value[P.b],u.array[w+2]=u.value[P.c],u.array[w+3]=u.value[P.d],w+=4}else{if("faces"===u.boundTo){D=0;for(V=ta.length;D<V;D++)xa=u.value[ta[D]],u.array[w]=
|
|
|
+xa,u.array[w+1]=xa,u.array[w+2]=xa,w+=3;D=0;for(V=ua.length;D<V;D++)xa=u.value[ua[D]],u.array[w]=xa,u.array[w+1]=xa,u.array[w+2]=xa,u.array[w+3]=xa,w+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ta.length;D<V;D++)P=lb[ta[D]],R=u.value[P.a],S=u.value[P.b],T=u.value[P.c],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,w+=6;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],R=u.value[P.a],S=u.value[P.b],T=u.value[P.c],oa=u.value[P.d],
|
|
|
+u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,u.array[w+6]=oa.x,u.array[w+7]=oa.y,w+=8}else{if("faces"===u.boundTo){D=0;for(V=ta.length;D<V;D++)T=S=R=xa=u.value[ta[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,w+=6;D=0;for(V=ua.length;D<V;D++)oa=T=S=R=xa=u.value[ua[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=S.x,u.array[w+3]=S.y,u.array[w+4]=T.x,u.array[w+5]=T.y,u.array[w+6]=oa.x,u.array[w+
|
|
|
+7]=oa.y,w+=8}}else if(3===u.size){var $;$="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(V=ta.length;D<V;D++)P=lb[ta[D]],R=u.value[P.a],S=u.value[P.b],T=u.value[P.c],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],w+=9;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],R=u.value[P.a],S=u.value[P.b],T=u.value[P.c],oa=u.value[P.d],
|
|
|
+u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],u.array[w+9]=oa[$[0]],u.array[w+10]=oa[$[1]],u.array[w+11]=oa[$[2]],w+=12}else if("faces"===u.boundTo){D=0;for(V=ta.length;D<V;D++)T=S=R=xa=u.value[ta[D]],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],
|
|
|
+u.array[w+8]=T[$[2]],w+=9;D=0;for(V=ua.length;D<V;D++)oa=T=S=R=xa=u.value[ua[D]],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],u.array[w+9]=oa[$[0]],u.array[w+10]=oa[$[1]],u.array[w+11]=oa[$[2]],w+=12}else if("faceVertices"===u.boundTo){D=0;for(V=ta.length;D<V;D++)xa=u.value[ta[D]],R=xa[0],S=xa[1],T=xa[2],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=
|
|
|
+R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],w+=9;D=0;for(V=ua.length;D<V;D++)xa=u.value[ua[D]],R=xa[0],S=xa[1],T=xa[2],oa=xa[3],u.array[w]=R[$[0]],u.array[w+1]=R[$[1]],u.array[w+2]=R[$[2]],u.array[w+3]=S[$[0]],u.array[w+4]=S[$[1]],u.array[w+5]=S[$[2]],u.array[w+6]=T[$[0]],u.array[w+7]=T[$[1]],u.array[w+8]=T[$[2]],u.array[w+9]=oa[$[0]],u.array[w+10]=oa[$[1]],u.array[w+11]=oa[$[2]],w+=12}}else if(4===u.size)if(void 0===
|
|
|
+u.boundTo||"vertices"===u.boundTo){D=0;for(V=ta.length;D<V;D++)P=lb[ta[D]],R=u.value[P.a],S=u.value[P.b],T=u.value[P.c],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,w+=12;D=0;for(V=ua.length;D<V;D++)P=lb[ua[D]],R=u.value[P.a],S=u.value[P.b],T=u.value[P.c],oa=u.value[P.d],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+
|
|
|
+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,u.array[w+12]=oa.x,u.array[w+13]=oa.y,u.array[w+14]=oa.z,u.array[w+15]=oa.w,w+=16}else if("faces"===u.boundTo){D=0;for(V=ta.length;D<V;D++)T=S=R=xa=u.value[ta[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,w+=12;
|
|
|
+D=0;for(V=ua.length;D<V;D++)oa=T=S=R=xa=u.value[ua[D]],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,u.array[w+12]=oa.x,u.array[w+13]=oa.y,u.array[w+14]=oa.z,u.array[w+15]=oa.w,w+=16}else if("faceVertices"===u.boundTo){D=0;for(V=ta.length;D<V;D++)xa=u.value[ta[D]],R=xa[0],S=xa[1],T=xa[2],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+
|
|
|
+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,w+=12;D=0;for(V=ua.length;D<V;D++)xa=u.value[ua[D]],R=xa[0],S=xa[1],T=xa[2],oa=xa[3],u.array[w]=R.x,u.array[w+1]=R.y,u.array[w+2]=R.z,u.array[w+3]=R.w,u.array[w+4]=S.x,u.array[w+5]=S.y,u.array[w+6]=S.z,u.array[w+7]=S.w,u.array[w+8]=T.x,u.array[w+9]=T.y,u.array[w+10]=T.z,u.array[w+11]=T.w,u.array[w+12]=oa.x,u.array[w+13]=oa.y,u.array[w+14]=oa.z,u.array[w+
|
|
|
+15]=oa.w,w+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,Oa)}}Ta&&(delete ra.__inittedArrays,delete ra.__colorArray,delete ra.__normalArray,delete ra.__tangentArray,delete ra.__uvArray,delete ra.__uv2Array,delete ra.__faceArray,delete ra.__vertexArray,delete ra.__lineArray,delete ra.__skinIndexArray,delete ra.__skinWeightArray)}}O.verticesNeedUpdate=!1;O.morphTargetsNeedUpdate=!1;O.elementsNeedUpdate=!1;O.uvsNeedUpdate=!1;O.normalsNeedUpdate=!1;O.colorsNeedUpdate=!1;
|
|
|
+O.tangentsNeedUpdate=!1;O.buffersNeedUpdate=!1;ha.attributes&&v(ha)}else if(ka instanceof THREE.Ribbon){ha=e(ka,O);ab=ha.attributes&&y(ha);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.normalsNeedUpdate||ab){var Fb=O,Pc=j.DYNAMIC_DRAW,Ec=void 0,Fc=void 0,Gc=void 0,Qc=void 0,ya=void 0,Rc=void 0,Sc=void 0,Tc=void 0,wd=void 0,ib=void 0,yc=void 0,Ca=void 0,tb=void 0,xd=Fb.vertices,yd=Fb.colors,zd=Fb.normals,fd=xd.length,gd=yd.length,hd=zd.length,Uc=Fb.__vertexArray,Vc=Fb.__colorArray,Wc=Fb.__normalArray,
|
|
|
+id=Fb.colorsNeedUpdate,jd=Fb.normalsNeedUpdate,qd=Fb.__webglCustomAttributesList;if(Fb.verticesNeedUpdate){for(Ec=0;Ec<fd;Ec++)Qc=xd[Ec],ya=3*Ec,Uc[ya]=Qc.x,Uc[ya+1]=Qc.y,Uc[ya+2]=Qc.z;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Uc,Pc)}if(id){for(Fc=0;Fc<gd;Fc++)Rc=yd[Fc],ya=3*Fc,Vc[ya]=Rc.r,Vc[ya+1]=Rc.g,Vc[ya+2]=Rc.b;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Vc,Pc)}if(jd){for(Gc=0;Gc<hd;Gc++)Sc=zd[Gc],ya=3*Gc,Wc[ya]=Sc.x,Wc[ya+
|
|
|
+1]=Sc.y,Wc[ya+2]=Sc.z;j.bindBuffer(j.ARRAY_BUFFER,Fb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Wc,Pc)}if(qd){Tc=0;for(wd=qd.length;Tc<wd;Tc++)if(Ca=qd[Tc],Ca.needsUpdate&&(void 0===Ca.boundTo||"vertices"===Ca.boundTo)){ya=0;yc=Ca.value.length;if(1===Ca.size)for(ib=0;ib<yc;ib++)Ca.array[ib]=Ca.value[ib];else if(2===Ca.size)for(ib=0;ib<yc;ib++)tb=Ca.value[ib],Ca.array[ya]=tb.x,Ca.array[ya+1]=tb.y,ya+=2;else if(3===Ca.size)if("c"===Ca.type)for(ib=0;ib<yc;ib++)tb=Ca.value[ib],Ca.array[ya]=tb.r,
|
|
|
+Ca.array[ya+1]=tb.g,Ca.array[ya+2]=tb.b,ya+=3;else for(ib=0;ib<yc;ib++)tb=Ca.value[ib],Ca.array[ya]=tb.x,Ca.array[ya+1]=tb.y,Ca.array[ya+2]=tb.z,ya+=3;else if(4===Ca.size)for(ib=0;ib<yc;ib++)tb=Ca.value[ib],Ca.array[ya]=tb.x,Ca.array[ya+1]=tb.y,Ca.array[ya+2]=tb.z,Ca.array[ya+3]=tb.w,ya+=4;j.bindBuffer(j.ARRAY_BUFFER,Ca.buffer);j.bufferData(j.ARRAY_BUFFER,Ca.array,Pc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.normalsNeedUpdate=!1;ha.attributes&&v(ha)}else if(ka instanceof THREE.Line)if(O instanceof
|
|
|
+THREE.BufferGeometry)(O.verticesNeedUpdate||O.colorsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.colorsNeedUpdate=!1;else{ha=e(ka,O);ab=ha.attributes&&y(ha);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.lineDistancesNeedUpdate||ab){var Gb=O,Xc=j.DYNAMIC_DRAW,Hc=void 0,Ic=void 0,Jc=void 0,Yc=void 0,Ja=void 0,Zc=void 0,Ad=Gb.vertices,Bd=Gb.colors,Cd=Gb.lineDistances,kd=Ad.length,Id=Bd.length,Jd=Cd.length,$c=Gb.__vertexArray,ad=Gb.__colorArray,Dd=Gb.__lineDistanceArray,Kd=Gb.colorsNeedUpdate,
|
|
|
+Ld=Gb.lineDistancesNeedUpdate,rd=Gb.__webglCustomAttributesList,bd=void 0,Ed=void 0,jb=void 0,zc=void 0,ub=void 0,Da=void 0;if(Gb.verticesNeedUpdate){for(Hc=0;Hc<kd;Hc++)Yc=Ad[Hc],Ja=3*Hc,$c[Ja]=Yc.x,$c[Ja+1]=Yc.y,$c[Ja+2]=Yc.z;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,$c,Xc)}if(Kd){for(Ic=0;Ic<Id;Ic++)Zc=Bd[Ic],Ja=3*Ic,ad[Ja]=Zc.r,ad[Ja+1]=Zc.g,ad[Ja+2]=Zc.b;j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,ad,Xc)}if(Ld){for(Jc=0;Jc<
|
|
|
+Jd;Jc++)Dd[Jc]=Cd[Jc];j.bindBuffer(j.ARRAY_BUFFER,Gb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Dd,Xc)}if(rd){bd=0;for(Ed=rd.length;bd<Ed;bd++)if(Da=rd[bd],Da.needsUpdate&&(void 0===Da.boundTo||"vertices"===Da.boundTo)){Ja=0;zc=Da.value.length;if(1===Da.size)for(jb=0;jb<zc;jb++)Da.array[jb]=Da.value[jb];else if(2===Da.size)for(jb=0;jb<zc;jb++)ub=Da.value[jb],Da.array[Ja]=ub.x,Da.array[Ja+1]=ub.y,Ja+=2;else if(3===Da.size)if("c"===Da.type)for(jb=0;jb<zc;jb++)ub=Da.value[jb],Da.array[Ja]=
|
|
|
+ub.r,Da.array[Ja+1]=ub.g,Da.array[Ja+2]=ub.b,Ja+=3;else for(jb=0;jb<zc;jb++)ub=Da.value[jb],Da.array[Ja]=ub.x,Da.array[Ja+1]=ub.y,Da.array[Ja+2]=ub.z,Ja+=3;else if(4===Da.size)for(jb=0;jb<zc;jb++)ub=Da.value[jb],Da.array[Ja]=ub.x,Da.array[Ja+1]=ub.y,Da.array[Ja+2]=ub.z,Da.array[Ja+3]=ub.w,Ja+=4;j.bindBuffer(j.ARRAY_BUFFER,Da.buffer);j.bufferData(j.ARRAY_BUFFER,Da.array,Xc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.lineDistancesNeedUpdate=!1;ha.attributes&&v(ha)}else if(ka instanceof THREE.ParticleSystem)if(O instanceof
|
|
|
+THREE.BufferGeometry)(O.verticesNeedUpdate||O.colorsNeedUpdate)&&i(O,j.DYNAMIC_DRAW,!O.dynamic),O.verticesNeedUpdate=!1,O.colorsNeedUpdate=!1;else{ha=e(ka,O);ab=ha.attributes&&y(ha);if(O.verticesNeedUpdate||O.colorsNeedUpdate||ka.sortParticles||ab){var ac=O,sd=j.DYNAMIC_DRAW,Kc=ka,vb=void 0,bc=void 0,cc=void 0,fa=void 0,dc=void 0,pc=void 0,cd=ac.vertices,td=cd.length,ud=ac.colors,Fd=ud.length,uc=ac.__vertexArray,vc=ac.__colorArray,ic=ac.__sortArray,Gd=ac.verticesNeedUpdate,Hd=ac.colorsNeedUpdate,
|
|
|
+jc=ac.__webglCustomAttributesList,Jb=void 0,Ac=void 0,na=void 0,Kb=void 0,Aa=void 0,ca=void 0;if(Kc.sortParticles){wc.copy(rb);wc.multiply(Kc.matrixWorld);for(vb=0;vb<td;vb++)cc=cd[vb],Ra.copy(cc),Ra.applyProjection(wc),ic[vb]=[Ra.z,vb];ic.sort(n);for(vb=0;vb<td;vb++)cc=cd[ic[vb][1]],fa=3*vb,uc[fa]=cc.x,uc[fa+1]=cc.y,uc[fa+2]=cc.z;for(bc=0;bc<Fd;bc++)fa=3*bc,pc=ud[ic[bc][1]],vc[fa]=pc.r,vc[fa+1]=pc.g,vc[fa+2]=pc.b;if(jc){Jb=0;for(Ac=jc.length;Jb<Ac;Jb++)if(ca=jc[Jb],void 0===ca.boundTo||"vertices"===
|
|
|
+ca.boundTo)if(fa=0,Kb=ca.value.length,1===ca.size)for(na=0;na<Kb;na++)dc=ic[na][1],ca.array[na]=ca.value[dc];else if(2===ca.size)for(na=0;na<Kb;na++)dc=ic[na][1],Aa=ca.value[dc],ca.array[fa]=Aa.x,ca.array[fa+1]=Aa.y,fa+=2;else if(3===ca.size)if("c"===ca.type)for(na=0;na<Kb;na++)dc=ic[na][1],Aa=ca.value[dc],ca.array[fa]=Aa.r,ca.array[fa+1]=Aa.g,ca.array[fa+2]=Aa.b,fa+=3;else for(na=0;na<Kb;na++)dc=ic[na][1],Aa=ca.value[dc],ca.array[fa]=Aa.x,ca.array[fa+1]=Aa.y,ca.array[fa+2]=Aa.z,fa+=3;else if(4===
|
|
|
+ca.size)for(na=0;na<Kb;na++)dc=ic[na][1],Aa=ca.value[dc],ca.array[fa]=Aa.x,ca.array[fa+1]=Aa.y,ca.array[fa+2]=Aa.z,ca.array[fa+3]=Aa.w,fa+=4}}else{if(Gd)for(vb=0;vb<td;vb++)cc=cd[vb],fa=3*vb,uc[fa]=cc.x,uc[fa+1]=cc.y,uc[fa+2]=cc.z;if(Hd)for(bc=0;bc<Fd;bc++)pc=ud[bc],fa=3*bc,vc[fa]=pc.r,vc[fa+1]=pc.g,vc[fa+2]=pc.b;if(jc){Jb=0;for(Ac=jc.length;Jb<Ac;Jb++)if(ca=jc[Jb],ca.needsUpdate&&(void 0===ca.boundTo||"vertices"===ca.boundTo))if(Kb=ca.value.length,fa=0,1===ca.size)for(na=0;na<Kb;na++)ca.array[na]=
|
|
|
+ca.value[na];else if(2===ca.size)for(na=0;na<Kb;na++)Aa=ca.value[na],ca.array[fa]=Aa.x,ca.array[fa+1]=Aa.y,fa+=2;else if(3===ca.size)if("c"===ca.type)for(na=0;na<Kb;na++)Aa=ca.value[na],ca.array[fa]=Aa.r,ca.array[fa+1]=Aa.g,ca.array[fa+2]=Aa.b,fa+=3;else for(na=0;na<Kb;na++)Aa=ca.value[na],ca.array[fa]=Aa.x,ca.array[fa+1]=Aa.y,ca.array[fa+2]=Aa.z,fa+=3;else if(4===ca.size)for(na=0;na<Kb;na++)Aa=ca.value[na],ca.array[fa]=Aa.x,ca.array[fa+1]=Aa.y,ca.array[fa+2]=Aa.z,ca.array[fa+3]=Aa.w,fa+=4}}if(Gd||
|
|
|
+Kc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ac.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,uc,sd);if(Hd||Kc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ac.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,vc,sd);if(jc){Jb=0;for(Ac=jc.length;Jb<Ac;Jb++)if(ca=jc[Jb],ca.needsUpdate||Kc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ca.buffer),j.bufferData(j.ARRAY_BUFFER,ca.array,sd)}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;ha.attributes&&v(ha)}}};this.initMaterial=function(a,b,c,d){var e,f,g,i;a.addEventListener("dispose",
|
|
|
+Nc);var h,k,m,n,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.LineDashedMaterial?l="dashed":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var p=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=
|
|
|
+p.vertexShader;a.fragmentShader=p.fragmentShader}var q,s,r;e=g=s=r=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;i=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);n=q;qc&&d&&d.useVertexTexture?m=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),
|
|
|
b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),m=b);a:{s=a.fragmentShader;r=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
-fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:m,useVertexTexture:tc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:i,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,
|
|
|
-shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,y,d=[];l?d.push(l):(d.push(s),d.push(r));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);l=d.join();t=0;for(v=Ma.length;t<v;t++)if(d=Ma[t],d.code===l){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":
|
|
|
-c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");v=[];for(y in q)d=q[y],!1!==d&&(d="#define "+y+" "+d,v.push(d));d=v.join("\n");y=j.createProgram();v=["precision "+fa+" float;",d,sc?"#define VERTEX_TEXTURES":"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"",N.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,
|
|
|
+fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:m,useVertexTexture:qc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:i,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,
|
|
|
+shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,y,d=[];l?d.push(l):(d.push(s),d.push(r));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);l=d.join();t=0;for(v=Na.length;t<v;t++)if(d=Na[t],d.code===l){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":
|
|
|
+c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");v=[];for(y in q)d=q[y],!1!==d&&(d="#define "+y+" "+d,v.push(d));d=v.join("\n");y=j.createProgram();v=["precision "+da+" float;",d,rc?"#define VERTEX_TEXTURES":"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"",N.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,
|
|
|
"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):
|
|
|
"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":
|
|
|
"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-t=["precision "+fa+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"",N.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
+t=["precision "+da+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"",N.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=B("fragment",t+s);v=B("vertex",v+r);j.attachShader(y,v);j.attachShader(y,t);j.linkProgram(y);j.getProgramParameter(y,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(y,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=C("fragment",t+s);v=C("vertex",v+r);j.attachShader(y,v);j.attachShader(y,t);j.linkProgram(y);j.getProgramParameter(y,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(y,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
j.getError()+"]");j.deleteShader(t);j.deleteShader(v);y.uniforms={};y.attributes={};var x;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(x in p)t.push(x);x=t;t=0;for(v=x.length;t<v;t++)p=x[t],y.uniforms[p]=j.getUniformLocation(y,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(x=0;x<c.maxMorphTargets;x++)t.push("morphTarget"+
|
|
|
-x);for(x=0;x<c.maxMorphNormals;x++)t.push("morphNormal"+x);for(k in b)t.push(k);k=t;x=0;for(b=k.length;x<b;x++)t=k[x],y.attributes[t]=j.getAttribLocation(y,t);y.id=Na++;Ma.push({program:y,code:l,usedTimes:1});N.info.memory.programs=Ma.length;k=y}a.program=k;x=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)y=b+k,0<=x[y]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)y=
|
|
|
-b+k,0<=x[y]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};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;da!==
|
|
|
-b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),da=b);la!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),la=a)};this.setDepthTest=function(a){ia!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ia=a)};this.setDepthWrite=function(a){Wa!==a&&(j.depthMask(a),Wa=a)};this.setBlending=function(a,b,c,d){a!==Z&&(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)),Z=a);if(a===THREE.CustomBlending){if(b!==oa&&(j.blendEquation(L(b)),oa=b),c!==gb||d!==nb)j.blendFunc(L(c),L(d)),gb=c,nb=d}else nb=
|
|
|
-gb=oa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Oc),a.__webglTexture=j.createTexture(),N.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=L(a.format),
|
|
|
+x);for(x=0;x<c.maxMorphNormals;x++)t.push("morphNormal"+x);for(k in b)t.push(k);k=t;x=0;for(b=k.length;x<b;x++)t=k[x],y.attributes[t]=j.getAttribLocation(y,t);y.id=pb++;Na.push({program:y,code:l,usedTimes:1});N.info.memory.programs=Na.length;k=y}a.program=k;x=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)y=b+k,0<=x[y]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)y=
|
|
|
+b+k,0<=x[y]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};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;ba!==
|
|
|
+b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ba=b);ja!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ja=a)};this.setDepthTest=function(a){ha!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ha=a)};this.setDepthWrite=function(a){cb!==a&&(j.depthMask(a),cb=a)};this.setBlending=function(a,b,c,d){a!==Z&&(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)),Z=a);if(a===THREE.CustomBlending){if(b!==qa&&(j.blendEquation(L(b)),qa=b),c!==bb||d!==mb)j.blendFunc(L(c),L(d)),bb=c,mb=d}else mb=
|
|
|
+bb=qa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Q),a.__webglTexture=j.createTexture(),N.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=L(a.format),
|
|
|
f=L(a.type);W(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var i=0,h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,i,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){i=0;for(h=g.length;i<h;i++)c=g[i],j.compressedTexImage2D(j.TEXTURE_2D,i,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){i=0;for(h=g.length;i<h;i++)c=g[i],j.texImage2D(j.TEXTURE_2D,
|
|
|
-i,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",P);a.__webglTexture=
|
|
|
+i,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",X);a.__webglTexture=
|
|
|
j.createTexture();N.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=L(a.format),e=L(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);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 g=a,i=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,i,g.__webglTexture,0);F(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),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):F(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=fc,a=Ab,d=Ib,e=Jb);b!==Pa&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Pa=b);mc=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){THREE.EventDispatcher.call(this);this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);
|
|
|
+null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ec,a=Ab,d=Hb,e=Ib);b!==Oa&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Oa=b);kc=c;qb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){THREE.EventDispatcher.call(this);this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);
|
|
|
this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a};
|
|
|
THREE.WebGLRenderTarget.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
|
|
@@ -525,7 +524,7 @@ c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.Dat
|
|
|
c+d;l=b[a++]*c;s=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(s,r,i,l);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var v=g/h;THREE.Shape.Utils.b2(v,m,s,i);THREE.Shape.Utils.b2(v,n,r,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,s=b[a++]*c+d,r=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,s,r,p,q),g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++)v=g/h,THREE.Shape.Utils.b3(v,m,s,p,i),THREE.Shape.Utils.b3(v,n,r,q,l)}}}return{offset:y.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var m=2*e;for(k=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{var s=n=void 0,r=void 0,p=void 0,q=void 0,y=void 0,v=void 0,z=void 0,t=
|
|
|
-void 0,s=a[g[i]].x,r=a[g[i]].y,p=a[g[k]].x,q=a[g[k]].y,y=a[g[l]].x,v=a[g[l]].y;if(1E-10>(p-s)*(v-r)-(q-r)*(y-s))n=!1;else{var A=void 0,I=void 0,C=void 0,x=void 0,G=void 0,J=void 0,E=void 0,H=void 0,B=void 0,W=void 0,B=H=E=t=z=void 0,A=y-p,I=v-q,C=s-y,x=r-v,G=p-s,J=q-r;for(n=0;n<e;n++)if(!(n===i||n===k||n===l))if(z=a[g[n]].x,t=a[g[n]].y,E=z-s,H=t-r,B=z-p,W=t-q,z-=y,t-=v,B=A*W-I*B,E=G*H-J*E,H=C*t-x*z,0<=B&&0<=H&&0<=E){n=!1;break a}n=!0}}if(n){f.push([a[g[i]],a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);
|
|
|
+void 0,s=a[g[i]].x,r=a[g[i]].y,p=a[g[k]].x,q=a[g[k]].y,y=a[g[l]].x,v=a[g[l]].y;if(1E-10>(p-s)*(v-r)-(q-r)*(y-s))n=!1;else{var A=void 0,I=void 0,B=void 0,x=void 0,G=void 0,J=void 0,E=void 0,H=void 0,C=void 0,W=void 0,C=H=E=t=z=void 0,A=y-p,I=v-q,B=s-y,x=r-v,G=p-s,J=q-r;for(n=0;n<e;n++)if(!(n===i||n===k||n===l))if(z=a[g[n]].x,t=a[g[n]].y,E=z-s,H=t-r,C=z-p,W=t-q,z-=y,t-=v,C=A*W-I*C,E=G*H-J*E,H=B*t-x*z,0<=C&&0<=H&&0<=E){n=!1;break a}n=!0}}if(n){f.push([a[g[i]],a[g[k]],a[g[l]]]);h.push([g[i],g[k],g[l]]);
|
|
|
i=k;for(l=k+1;l<e;i++,l++)g[i]=g[l];e--;m=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -601,20 +600,20 @@ THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*
|
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a,d=0.707*b,c=[[a,0,0],[b,0,0],[-a,0,0],[-b,0,0],[0,a,0],[0,b,0],[0,-a,0],[0,-b,0],[0,0,a],[0,0,b],[0,0,-a],[0,0,-b],[c,c,0],[d,d,0],[-c,-c,0],[-d,-d,0],[c,-c,0],[d,-d,0],[-c,c,0],[-d,d,0],[c,0,c],[d,0,d],[-c,0,-c],[-d,0,-d],[c,0,-c],[d,0,-d],[-c,0,c],[-d,0,d],[0,c,c],[0,d,d],[0,-c,-c],[0,-d,-d],[0,c,-c],[0,d,-d],[0,-c,c],[0,-d,d]],d=0,e=c.length;d<e;d++)this.vertices.push(new THREE.Vector3(c[d][0],c[d][1],c[d][2]))};
|
|
|
THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),
|
|
|
-this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var q,y=h.widthSegments,v=h.heightSegments,z=e/2,t=f/2,A=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",v=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",y=h.depthSegments;var I=y+1,C=v+1,x=e/y,G=f/v,J=new THREE.Vector3;J[q]=0<g?1:-1;for(e=0;e<C;e++)for(f=0;f<I;f++){var E=new THREE.Vector3;E[a]=(f*x-z)*c;E[b]=(e*G-t)*d;E[q]=g;h.vertices.push(E)}for(e=
|
|
|
+this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var q,y=h.widthSegments,v=h.heightSegments,z=e/2,t=f/2,A=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",v=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",y=h.depthSegments;var I=y+1,B=v+1,x=e/y,G=f/v,J=new THREE.Vector3;J[q]=0<g?1:-1;for(e=0;e<B;e++)for(f=0;f<I;f++){var E=new THREE.Vector3;E[a]=(f*x-z)*c;E[b]=(e*G-t)*d;E[q]=g;h.vertices.push(E)}for(e=
|
|
|
0;e<v;e++)for(f=0;f<y;f++)a=new THREE.Face4(f+I*e+A,f+I*(e+1)+A,f+1+I*(e+1)+A,f+1+I*e+A),a.normal.copy(J),a.vertexNormals.push(J.clone(),J.clone(),J.clone(),J.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/y,1-e/v),new THREE.Vector2(f/y,1-(e+1)/v),new THREE.Vector2((f+1)/y,1-(e+1)/v),new THREE.Vector2((f+1)/y,1-e/v)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],s=i/e,r=s*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,q=new THREE.Vector3;q.x=r*Math.sin(2*p*Math.PI);q.y=-s*c+g;q.z=r*Math.cos(2*p*Math.PI);this.vertices.push(q);m.push(this.vertices.length-1);n.push(new THREE.Vector2(p,1-s))}k.push(m);l.push(n)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(m=this.vertices[k[0][h]].clone(),
|
|
|
-n=this.vertices[k[0][h+1]].clone()):(m=this.vertices[k[1][h]].clone(),n=this.vertices[k[1][h+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],p=k[i+1][h+1],q=k[i][h+1],y=m.clone(),v=m.clone(),z=n.clone(),t=n.clone(),A=l[i][h].clone(),I=l[i+1][h].clone(),C=l[i+1][h+1].clone(),x=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,p,q,[y,v,z,t]));this.faceVertexUvs[0].push([A,I,C,x])}}if(!f&&0<
|
|
|
-a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],p=this.vertices.length-1,y=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),A=l[0][h].clone(),I=l[0][h+1].clone(),C=new THREE.Vector2(I.u,0),this.faces.push(new THREE.Face3(s,r,p,[y,v,z])),this.faceVertexUvs[0].push([A,I,C])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],r=k[i][h],p=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,
|
|
|
--1,0),z=new THREE.Vector3(0,-1,0),A=l[i][h+1].clone(),I=l[i][h].clone(),C=new THREE.Vector2(I.u,1),this.faces.push(new THREE.Face3(s,r,p,[y,v,z])),this.faceVertexUvs[0].push([A,I,C])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+n=this.vertices[k[0][h+1]].clone()):(m=this.vertices[k[1][h]].clone(),n=this.vertices[k[1][h+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],r=k[i+1][h],p=k[i+1][h+1],q=k[i][h+1],y=m.clone(),v=m.clone(),z=n.clone(),t=n.clone(),A=l[i][h].clone(),I=l[i+1][h].clone(),B=l[i+1][h+1].clone(),x=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,p,q,[y,v,z,t]));this.faceVertexUvs[0].push([A,I,B,x])}}if(!f&&0<
|
|
|
+a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],r=k[0][h+1],p=this.vertices.length-1,y=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),A=l[0][h].clone(),I=l[0][h+1].clone(),B=new THREE.Vector2(I.u,0),this.faces.push(new THREE.Face3(s,r,p,[y,v,z])),this.faceVertexUvs[0].push([A,I,B])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],r=k[i][h],p=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,
|
|
|
+-1,0),z=new THREE.Vector3(0,-1,0),A=l[i][h+1].clone(),I=l[i][h].clone(),B=new THREE.Vector2(I.u,1),this.faces.push(new THREE.Face3(s,r,p,[y,v,z])),this.faceVertexUvs[0].push([A,I,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,i=THREE.ExtrudeGeometry.__v5,h=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);i.copy(a).add(f);h.copy(a).add(g);if(i.equals(h))return g.clone();
|
|
|
i.copy(b).add(f);h.copy(c).add(g);f=d.dot(g);g=h.sub(i).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(i).sub(a).clone()}function e(c,d){var e,f;for(M=c.length;0<=--M;){e=M;f=M-1;0>f&&(f=c.length-1);for(var g=0,i=s+2*l,
|
|
|
-g=0;g<i;g++){var h=fa*g,k=fa*(g+1),m=d+e+h,h=d+f+h,n=d+f+k,k=d+e+k,p=c,q=g,r=i,t=e,y=f,m=m+H,h=h+H,n=n+H,k=k+H;E.faces.push(new THREE.Face4(m,h,n,k,null,null,v));m=z.generateSideWallUV(E,a,p,b,m,h,n,k,q,r,t,y);E.faceVertexUvs[0].push(m)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=H;d+=H;e+=H;E.faces.push(new THREE.Face3(c,d,e,null,null,y));c=f?z.generateBottomUV(E,a,b,c,d,e):z.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
|
|
|
-100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,y=b.material,v=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,A,I,C;r&&(p=r.getSpacedPoints(s),q=!0,m=!1,t=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,
|
|
|
-!1),A=new THREE.Vector3,I=new THREE.Vector3,C=new THREE.Vector3);m||(k=i=l=0);var x,G,J,E=this,H=this.vertices.length,n=a.extractPoints(n),B=n.shape,n=n.holes;if(r=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();G=0;for(J=n.length;G<J;G++)x=n[G],THREE.Shape.Utils.isClockWise(x)&&(n[G]=x.reverse());r=!1}var W=THREE.Shape.Utils.triangulateShape(B,n),r=B;G=0;for(J=n.length;G<J;G++)x=n[G],B=B.concat(x);var F,K,L,U,fa=B.length,Ca=W.length,$a=[],M=0,ca=r.length;F=ca-1;for(K=M+1;M<ca;M++,F++,K++)F===ca&&
|
|
|
-(F=0),K===ca&&(K=0),$a[M]=d(r[M],r[F],r[K]);var qa=[],ha,ra=$a.concat();G=0;for(J=n.length;G<J;G++){x=n[G];ha=[];M=0;ca=x.length;F=ca-1;for(K=M+1;M<ca;M++,F++,K++)F===ca&&(F=0),K===ca&&(K=0),ha[M]=d(x[M],x[F],x[K]);qa.push(ha);ra=ra.concat(ha)}for(F=0;F<l;F++){x=F/l;L=i*(1-x);K=k*Math.sin(x*Math.PI/2);M=0;for(ca=r.length;M<ca;M++)U=c(r[M],$a[M],K),f(U.x,U.y,-L);G=0;for(J=n.length;G<J;G++){x=n[G];ha=qa[G];M=0;for(ca=x.length;M<ca;M++)U=c(x[M],ha[M],K),f(U.x,U.y,-L)}}K=k;for(M=0;M<fa;M++)U=m?c(B[M],
|
|
|
-ra[M],K):B[M],q?(I.copy(t.normals[0]).multiplyScalar(U.x),A.copy(t.binormals[0]).multiplyScalar(U.y),C.copy(p[0]).add(I).add(A),f(C.x,C.y,C.z)):f(U.x,U.y,0);for(x=1;x<=s;x++)for(M=0;M<fa;M++)U=m?c(B[M],ra[M],K):B[M],q?(I.copy(t.normals[x]).multiplyScalar(U.x),A.copy(t.binormals[x]).multiplyScalar(U.y),C.copy(p[x]).add(I).add(A),f(C.x,C.y,C.z)):f(U.x,U.y,h/s*x);for(F=l-1;0<=F;F--){x=F/l;L=i*(1-x);K=k*Math.sin(x*Math.PI/2);M=0;for(ca=r.length;M<ca;M++)U=c(r[M],$a[M],K),f(U.x,U.y,h+L);G=0;for(J=n.length;G<
|
|
|
-J;G++){x=n[G];ha=qa[G];M=0;for(ca=x.length;M<ca;M++)U=c(x[M],ha[M],K),q?f(U.x,U.y+p[s-1].y,p[s-1].x+L):f(U.x,U.y,h+L)}}if(m){i=0*fa;for(M=0;M<Ca;M++)h=W[M],g(h[2]+i,h[1]+i,h[0]+i,!0);i=fa*(s+2*l);for(M=0;M<Ca;M++)h=W[M],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(M=0;M<Ca;M++)h=W[M],g(h[2],h[1],h[0],!0);for(M=0;M<Ca;M++)h=W[M],g(h[0]+fa*s,h[1]+fa*s,h[2]+fa*s,!1)}h=0;e(r,h);h+=r.length;G=0;for(J=n.length;G<J;G++)x=n[G],e(x,h),h+=x.length};
|
|
|
+g=0;g<i;g++){var h=da*g,k=da*(g+1),m=d+e+h,h=d+f+h,n=d+f+k,k=d+e+k,p=c,q=g,r=i,t=e,y=f,m=m+H,h=h+H,n=n+H,k=k+H;E.faces.push(new THREE.Face4(m,h,n,k,null,null,v));m=z.generateSideWallUV(E,a,p,b,m,h,n,k,q,r,t,y);E.faceVertexUvs[0].push(m)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=H;d+=H;e+=H;E.faces.push(new THREE.Face3(c,d,e,null,null,y));c=f?z.generateBottomUV(E,a,b,c,d,e):z.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
|
|
|
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,y=b.material,v=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,A,I,B;r&&(p=r.getSpacedPoints(s),q=!0,m=!1,t=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,
|
|
|
+!1),A=new THREE.Vector3,I=new THREE.Vector3,B=new THREE.Vector3);m||(k=i=l=0);var x,G,J,E=this,H=this.vertices.length,n=a.extractPoints(n),C=n.shape,n=n.holes;if(r=!THREE.Shape.Utils.isClockWise(C)){C=C.reverse();G=0;for(J=n.length;G<J;G++)x=n[G],THREE.Shape.Utils.isClockWise(x)&&(n[G]=x.reverse());r=!1}var W=THREE.Shape.Utils.triangulateShape(C,n),r=C;G=0;for(J=n.length;G<J;G++)x=n[G],C=C.concat(x);var F,K,L,U,da=C.length,Fa=W.length,Pa=[],M=0,ea=r.length;F=ea-1;for(K=M+1;M<ea;M++,F++,K++)F===ea&&
|
|
|
+(F=0),K===ea&&(K=0),Pa[M]=d(r[M],r[F],r[K]);var wa=[],ia,sa=Pa.concat();G=0;for(J=n.length;G<J;G++){x=n[G];ia=[];M=0;ea=x.length;F=ea-1;for(K=M+1;M<ea;M++,F++,K++)F===ea&&(F=0),K===ea&&(K=0),ia[M]=d(x[M],x[F],x[K]);wa.push(ia);sa=sa.concat(ia)}for(F=0;F<l;F++){x=F/l;L=i*(1-x);K=k*Math.sin(x*Math.PI/2);M=0;for(ea=r.length;M<ea;M++)U=c(r[M],Pa[M],K),f(U.x,U.y,-L);G=0;for(J=n.length;G<J;G++){x=n[G];ia=wa[G];M=0;for(ea=x.length;M<ea;M++)U=c(x[M],ia[M],K),f(U.x,U.y,-L)}}K=k;for(M=0;M<da;M++)U=m?c(C[M],
|
|
|
+sa[M],K):C[M],q?(I.copy(t.normals[0]).multiplyScalar(U.x),A.copy(t.binormals[0]).multiplyScalar(U.y),B.copy(p[0]).add(I).add(A),f(B.x,B.y,B.z)):f(U.x,U.y,0);for(x=1;x<=s;x++)for(M=0;M<da;M++)U=m?c(C[M],sa[M],K):C[M],q?(I.copy(t.normals[x]).multiplyScalar(U.x),A.copy(t.binormals[x]).multiplyScalar(U.y),B.copy(p[x]).add(I).add(A),f(B.x,B.y,B.z)):f(U.x,U.y,h/s*x);for(F=l-1;0<=F;F--){x=F/l;L=i*(1-x);K=k*Math.sin(x*Math.PI/2);M=0;for(ea=r.length;M<ea;M++)U=c(r[M],Pa[M],K),f(U.x,U.y,h+L);G=0;for(J=n.length;G<
|
|
|
+J;G++){x=n[G];ia=wa[G];M=0;for(ea=x.length;M<ea;M++)U=c(x[M],ia[M],K),q?f(U.x,U.y+p[s-1].y,p[s-1].x+L):f(U.x,U.y,h+L)}}if(m){i=0*da;for(M=0;M<Fa;M++)h=W[M],g(h[2]+i,h[1]+i,h[0]+i,!0);i=da*(s+2*l);for(M=0;M<Fa;M++)h=W[M],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(M=0;M<Fa;M++)h=W[M],g(h[2],h[1],h[0],!0);for(M=0;M<Fa;M++)h=W[M],g(h[0]+da*s,h[1]+da*s,h[2]+da*s,!1)}h=0;e(r,h);h+=r.length;G=0;for(J=n.length;G<J;G++)x=n[G],e(x,h),h+=x.length};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,
|
|
|
l=a.vertices[g].y,g=a.vertices[g].z,m=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(m,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(n,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
@@ -673,18 +672,18 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
|
e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,m=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};s={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");s.renderType=b.getUniformLocation(m,"renderType");s.map=b.getUniformLocation(m,"map");s.occlusionMap=b.getUniformLocation(m,"occlusionMap");s.opacity=
|
|
|
-b.getUniformLocation(m,"opacity");s.color=b.getUniformLocation(m,"color");s.scale=b.getUniformLocation(m,"scale");s.rotation=b.getUniformLocation(m,"rotation");s.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,v=a.length;if(v){var z=new THREE.Vector3,t=f/e,A=0.5*e,I=0.5*f,C=16/f,x=new THREE.Vector2(C*t,C),G=new THREE.Vector3(1,1,0),J=new THREE.Vector2(1,1),E=s,C=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
-b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(C.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var H,B,W,F,K;for(H=0;H<v;H++)if(C=16/f,x.set(C*t,C),F=a[H],z.set(F.matrixWorld.elements[12],F.matrixWorld.elements[13],F.matrixWorld.elements[14]),z.applyMatrix4(d.matrixWorldInverse),z.applyProjection(d.projectionMatrix),G.copy(z),J.x=G.x*A+A,
|
|
|
+b.getUniformLocation(m,"opacity");s.color=b.getUniformLocation(m,"color");s.scale=b.getUniformLocation(m,"scale");s.rotation=b.getUniformLocation(m,"rotation");s.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,v=a.length;if(v){var z=new THREE.Vector3,t=f/e,A=0.5*e,I=0.5*f,B=16/f,x=new THREE.Vector2(B*t,B),G=new THREE.Vector3(1,1,0),J=new THREE.Vector2(1,1),E=s,B=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
+b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(B.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var H,C,W,F,K;for(H=0;H<v;H++)if(B=16/f,x.set(B*t,B),F=a[H],z.set(F.matrixWorld.elements[12],F.matrixWorld.elements[13],F.matrixWorld.elements[14]),z.applyMatrix4(d.matrixWorldInverse),z.applyProjection(d.projectionMatrix),G.copy(z),J.x=G.x*A+A,
|
|
|
J.y=G.y*I+I,l||0<J.x&&J.x<e&&0<J.y&&J.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,J.x-8,J.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,x.x,x.y);b.uniform3f(E.screenPosition,G.x,G.y,G.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,J.x-8,J.y-8,16,16,0);b.uniform1i(E.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);F.positionScreen.copy(G);F.customUpdateCallback?F.customUpdateCallback(F):F.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);B=0;for(W=F.lensFlares.length;B<W;B++)K=F.lensFlares[B],0.001<K.opacity&&0.001<K.scale&&(G.x=K.x,G.y=K.y,G.z=K.z,C=K.size*K.scale/f,x.x=C*t,x.y=C,b.uniform3f(E.screenPosition,G.x,G.y,G.z),b.uniform2f(E.scale,x.x,x.y),b.uniform1f(E.rotation,K.rotation),b.uniform1f(E.opacity,
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);F.positionScreen.copy(G);F.customUpdateCallback?F.customUpdateCallback(F):F.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);C=0;for(W=F.lensFlares.length;C<W;C++)K=F.lensFlares[C],0.001<K.opacity&&0.001<K.scale&&(G.x=K.x,G.y=K.y,G.z=K.z,B=K.size*K.scale/f,x.x=B*t,x.y=B,b.uniform3f(E.screenPosition,G.x,G.y,G.z),b.uniform2f(E.scale,x.x,x.y),b.uniform1f(E.rotation,K.rotation),b.uniform1f(E.opacity,
|
|
|
K.opacity),b.uniform3f(E.color,K.color.r,K.color.g,K.color.b),c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst),c.setTexture(K.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,i=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:i,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:i,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var s,r,p,q,y,v,z,t,A,I=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=m.__lights.length;s<r;s++)if(p=m.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(y=0;y<p.shadowCascadeCount;y++){var C;if(p.shadowCascadeArray[y])C=p.shadowCascadeArray[y];else{A=p;z=y;C=new THREE.DirectionalLight;C.isVirtual=!0;C.onlyShadow=!0;C.castShadow=!0;C.shadowCameraNear=A.shadowCameraNear;C.shadowCameraFar=A.shadowCameraFar;C.shadowCameraLeft=A.shadowCameraLeft;C.shadowCameraRight=A.shadowCameraRight;
|
|
|
-C.shadowCameraBottom=A.shadowCameraBottom;C.shadowCameraTop=A.shadowCameraTop;C.shadowCameraVisible=A.shadowCameraVisible;C.shadowDarkness=A.shadowDarkness;C.shadowBias=A.shadowCascadeBias[z];C.shadowMapWidth=A.shadowCascadeWidth[z];C.shadowMapHeight=A.shadowCascadeHeight[z];C.pointsWorld=[];C.pointsFrustum=[];t=C.pointsWorld;v=C.pointsFrustum;for(var x=0;8>x;x++)t[x]=new THREE.Vector3,v[x]=new THREE.Vector3;t=A.shadowCascadeNearZ[z];A=A.shadowCascadeFarZ[z];v[0].set(-1,-1,t);v[1].set(1,-1,t);v[2].set(-1,
|
|
|
-1,t);v[3].set(1,1,t);v[4].set(-1,-1,A);v[5].set(1,-1,A);v[6].set(-1,1,A);v[7].set(1,1,A);C.originalCamera=n;v=new THREE.Gyroscope;v.position=p.shadowCascadeOffset;v.add(C);v.add(C.target);n.add(v);p.shadowCascadeArray[y]=C;console.log("Created virtualLight",C)}z=p;t=y;A=z.shadowCascadeArray[t];A.position.copy(z.position);A.target.position.copy(z.target.position);A.lookAt(A.target);A.shadowCameraVisible=z.shadowCameraVisible;A.shadowDarkness=z.shadowDarkness;A.shadowBias=z.shadowCascadeBias[t];v=z.shadowCascadeNearZ[t];
|
|
|
-z=z.shadowCascadeFarZ[t];A=A.pointsFrustum;A[0].z=v;A[1].z=v;A[2].z=v;A[3].z=v;A[4].z=z;A[5].z=z;A[6].z=z;A[7].z=z;I[q]=C;q++}else I[q]=p,q++;s=0;for(r=I.length;s<r;s++){p=I[s];p.shadowMap||(y=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(y=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:y,magFilter:y,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=m.__lights.length;s<r;s++)if(p=m.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(y=0;y<p.shadowCascadeCount;y++){var B;if(p.shadowCascadeArray[y])B=p.shadowCascadeArray[y];else{A=p;z=y;B=new THREE.DirectionalLight;B.isVirtual=!0;B.onlyShadow=!0;B.castShadow=!0;B.shadowCameraNear=A.shadowCameraNear;B.shadowCameraFar=A.shadowCameraFar;B.shadowCameraLeft=A.shadowCameraLeft;B.shadowCameraRight=A.shadowCameraRight;
|
|
|
+B.shadowCameraBottom=A.shadowCameraBottom;B.shadowCameraTop=A.shadowCameraTop;B.shadowCameraVisible=A.shadowCameraVisible;B.shadowDarkness=A.shadowDarkness;B.shadowBias=A.shadowCascadeBias[z];B.shadowMapWidth=A.shadowCascadeWidth[z];B.shadowMapHeight=A.shadowCascadeHeight[z];B.pointsWorld=[];B.pointsFrustum=[];t=B.pointsWorld;v=B.pointsFrustum;for(var x=0;8>x;x++)t[x]=new THREE.Vector3,v[x]=new THREE.Vector3;t=A.shadowCascadeNearZ[z];A=A.shadowCascadeFarZ[z];v[0].set(-1,-1,t);v[1].set(1,-1,t);v[2].set(-1,
|
|
|
+1,t);v[3].set(1,1,t);v[4].set(-1,-1,A);v[5].set(1,-1,A);v[6].set(-1,1,A);v[7].set(1,1,A);B.originalCamera=n;v=new THREE.Gyroscope;v.position=p.shadowCascadeOffset;v.add(B);v.add(B.target);n.add(v);p.shadowCascadeArray[y]=B;console.log("Created virtualLight",B)}z=p;t=y;A=z.shadowCascadeArray[t];A.position.copy(z.position);A.target.position.copy(z.target.position);A.lookAt(A.target);A.shadowCameraVisible=z.shadowCameraVisible;A.shadowDarkness=z.shadowDarkness;A.shadowBias=z.shadowCascadeBias[t];v=z.shadowCascadeNearZ[t];
|
|
|
+z=z.shadowCascadeFarZ[t];A=A.pointsFrustum;A[0].z=v;A[1].z=v;A[2].z=v;A[3].z=v;A[4].z=z;A[5].z=z;A[6].z=z;A[7].z=z;I[q]=B;q++}else I[q]=p,q++;s=0;for(r=I.length;s<r;s++){p=I[s];p.shadowMap||(y=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(y=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:y,magFilter:y,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(p.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}p.shadowCameraVisible&&
|
|
|
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&C.originalCamera==n){y=n;q=p.shadowCamera;v=p.pointsFrustum;A=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(z=0;8>z;z++)t=A[z],t.copy(v[z]),THREE.ShadowMapPlugin.__projector.unprojectVector(t,y),t.applyMatrix4(q.matrixWorldInverse),t.x<i.x&&(i.x=t.x),t.x>k.x&&(k.x=t.x),t.y<i.y&&(i.y=t.y),t.y>k.y&&(k.y=t.y),t.z<i.z&&(i.z=t.z),t.z>k.z&&
|
|
|
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&B.originalCamera==n){y=n;q=p.shadowCamera;v=p.pointsFrustum;A=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(z=0;8>z;z++)t=A[z],t.copy(v[z]),THREE.ShadowMapPlugin.__projector.unprojectVector(t,y),t.applyMatrix4(q.matrixWorldInverse),t.x<i.x&&(i.x=t.x),t.x>k.x&&(k.x=t.x),t.y<i.y&&(i.y=t.y),t.y>k.y&&(k.y=t.y),t.z<i.z&&(i.z=t.z),t.z>k.z&&
|
|
|
(k.z=t.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;v=p.shadowMatrix;y=p.shadowCamera;y.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);y.lookAt(l);y.updateMatrixWorld();y.matrixWorldInverse.getInverse(y.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiply(y.projectionMatrix);v.multiply(y.matrixWorldInverse);
|
|
|
h.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();A=m.__webglObjects;p=0;for(q=A.length;p<q;p++)if(z=A[p],v=z.object,z.render=!1,v.visible&&v.castShadow&&(!(v instanceof THREE.Mesh||v instanceof THREE.ParticleSystem)||!v.frustumCulled||g.intersectsObject(v)))v._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,v.matrixWorld),z.render=!0;p=0;for(q=A.length;p<q;p++)z=A[p],z.render&&(v=z.object,z=z.buffer,x=v.material instanceof THREE.MeshFaceMaterial?
|
|
|
v.material.materials[0]:v.material,t=0<v.geometry.morphTargets.length&&x.morphTargets,x=v instanceof THREE.SkinnedMesh&&x.skinning,t=v.customDepthMaterial?v.customDepthMaterial:x?t?f:e:t?d:c,z instanceof THREE.BufferGeometry?b.renderBufferDirect(y,m.__lights,null,t,z,v):b.renderBuffer(y,m.__lights,null,t,z,v));A=m.__webglObjectsImmediate;p=0;for(q=A.length;p<q;p++)z=A[p],v=z.object,v.visible&&v.castShadow&&(v._modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,v.matrixWorld),b.renderImmediateObject(y,
|
|
@@ -693,9 +692,9 @@ e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_A
|
|
|
"uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,"uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");l.screenPosition=b.getUniformLocation(i,
|
|
|
"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,r){var p=d.__webglSprites,q=p.length;if(q){var y=k,v=l,z=r/
|
|
|
f,f=0.5*f,t=0.5*r;b.useProgram(i);b.enableVertexAttribArray(y.position);b.enableVertexAttribArray(y.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(y.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(y.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(v.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(v.map,0);var A=y=0,I=d.fog;I?(b.uniform3f(v.fogColor,I.color.r,I.color.g,I.color.b),
|
|
|
-I instanceof THREE.Fog?(b.uniform1f(v.fogNear,I.near),b.uniform1f(v.fogFar,I.far),b.uniform1i(v.fogType,1),A=y=1):I instanceof THREE.FogExp2&&(b.uniform1f(v.fogDensity,I.density),b.uniform1i(v.fogType,2),A=y=2)):(b.uniform1i(v.fogType,0),A=y=0);for(var C,x,G=[],I=0;I<q;I++)C=p[I],x=C.material,C.visible&&0!==x.opacity&&(x.useScreenCoordinates?C.z=-C.position.z:(C._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,C.matrixWorld),C.z=-C._modelViewMatrix.elements[14]));p.sort(a);for(I=0;I<q;I++)C=
|
|
|
-p[I],x=C.material,C.visible&&0!==x.opacity&&(x.map&&x.map.image&&x.map.image.width)&&(b.uniform1f(v.alphaTest,x.alphaTest),!0===x.useScreenCoordinates?(b.uniform1i(v.useScreenCoordinates,1),b.uniform3f(v.screenPosition,(C.position.x*c.devicePixelRatio-f)/f,(t-C.position.y*c.devicePixelRatio)/t,Math.max(0,Math.min(1,C.position.z))),G[0]=c.devicePixelRatio,G[1]=c.devicePixelRatio):(b.uniform1i(v.useScreenCoordinates,0),b.uniform1i(v.sizeAttenuation,x.sizeAttenuation?1:0),b.uniformMatrix4fv(v.modelViewMatrix,
|
|
|
-!1,C._modelViewMatrix.elements),G[0]=1,G[1]=1),e=d.fog&&x.fog?A:0,y!==e&&(b.uniform1i(v.fogType,e),y=e),e=1/(x.scaleByViewport?r:1),G[0]*=e*z*C.scale.x,G[1]*=e*C.scale.y,b.uniform2f(v.uvScale,x.uvScale.x,x.uvScale.y),b.uniform2f(v.uvOffset,x.uvOffset.x,x.uvOffset.y),b.uniform2f(v.alignment,x.alignment.x,x.alignment.y),b.uniform1f(v.opacity,x.opacity),b.uniform3f(v.color,x.color.r,x.color.g,x.color.b),b.uniform1f(v.rotation,C.rotation),b.uniform2fv(v.scale,G),c.setBlending(x.blending,x.blendEquation,
|
|
|
+I instanceof THREE.Fog?(b.uniform1f(v.fogNear,I.near),b.uniform1f(v.fogFar,I.far),b.uniform1i(v.fogType,1),A=y=1):I instanceof THREE.FogExp2&&(b.uniform1f(v.fogDensity,I.density),b.uniform1i(v.fogType,2),A=y=2)):(b.uniform1i(v.fogType,0),A=y=0);for(var B,x,G=[],I=0;I<q;I++)B=p[I],x=B.material,B.visible&&0!==x.opacity&&(x.useScreenCoordinates?B.z=-B.position.z:(B._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,B.matrixWorld),B.z=-B._modelViewMatrix.elements[14]));p.sort(a);for(I=0;I<q;I++)B=
|
|
|
+p[I],x=B.material,B.visible&&0!==x.opacity&&(x.map&&x.map.image&&x.map.image.width)&&(b.uniform1f(v.alphaTest,x.alphaTest),!0===x.useScreenCoordinates?(b.uniform1i(v.useScreenCoordinates,1),b.uniform3f(v.screenPosition,(B.position.x*c.devicePixelRatio-f)/f,(t-B.position.y*c.devicePixelRatio)/t,Math.max(0,Math.min(1,B.position.z))),G[0]=c.devicePixelRatio,G[1]=c.devicePixelRatio):(b.uniform1i(v.useScreenCoordinates,0),b.uniform1i(v.sizeAttenuation,x.sizeAttenuation?1:0),b.uniformMatrix4fv(v.modelViewMatrix,
|
|
|
+!1,B._modelViewMatrix.elements),G[0]=1,G[1]=1),e=d.fog&&x.fog?A:0,y!==e&&(b.uniform1i(v.fogType,e),y=e),e=1/(x.scaleByViewport?r:1),G[0]*=e*z*B.scale.x,G[1]*=e*B.scale.y,b.uniform2f(v.uvScale,x.uvScale.x,x.uvScale.y),b.uniform2f(v.uvOffset,x.uvOffset.x,x.uvOffset.y),b.uniform2f(v.alignment,x.alignment.x,x.alignment.y),b.uniform1f(v.opacity,x.opacity),b.uniform3f(v.color,x.color.r,x.color.g,x.color.b),b.uniform1f(v.rotation,B.rotation),b.uniform2fv(v.scale,G),c.setBlending(x.blending,x.blendEquation,
|
|
|
x.blendSrc,x.blendDst),c.setDepthTest(x.depthTest),c.setDepthWrite(x.depthWrite),c.setTexture(x.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var l,m,n,s,r,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiplyMatrices(k.projectionMatrix,
|
|
|
k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;l=0;for(m=p.length;l<m;l++)if(n=p[l],r=n.object,n.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||g.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),n.render=!0;var q;l=0;for(m=p.length;l<m;l++)if(n=p[l],n.render&&(r=n.object,n=n.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(q=
|