|
@@ -22,9 +22,9 @@ palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:1677
|
|
|
tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
THREE.extend(THREE.Quaternion.prototype,{set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"YXZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h-f*g*e,this.w=c*
|
|
|
d*e+f*g*h):"ZXY"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"ZYX"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e+f*g*h):"YZX"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e-f*g*h):"XZY"===b&&(this.x=f*d*e-c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e+f*g*h);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},
|
|
|
-setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],k=c+f+b;0<k?(c=0.5/Math.sqrt(k+1),this.w=0.25/c,this.x=(i-g)*c,this.y=(d-h)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
|
|
|
+setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(i-g)*c,this.y=(d-h)*c,this.z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
|
|
|
return this},conjugate:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=this.length();0===a?(this.z=this.y=this.x=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
|
|
|
-this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,k=b.w;this.x=c*k+f*g+d*i-e*h;this.y=d*k+f*h+e*g-c*i;this.z=e*k+f*i+c*h-d*g;this.w=f*k-c*g-d*h-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
|
|
|
+this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a.x,d=a.y,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,j=b.w;this.x=c*j+f*g+d*i-e*h;this.y=d*j+f*h+e*g-c*i;this.z=e*j+f*i+c*h-d*g;this.w=f*j-c*g-d*h-e*i;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this.x,d=this.y,e=this.z,
|
|
|
f=this.w,g=f*a.w+c*a.x+d*a.y+e*a.z;0>g?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,g=-g):this.copy(a);if(1<=g)return this.w=f,this.x=c,this.y=d,this.z=e,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},equals:function(a){return a.x===this.x&&a.y===
|
|
|
this.y&&a.z===this.z&&a.w===this.w},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}});THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
|
|
|
THREE.extend(THREE.Vector2.prototype,{set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==
|
|
@@ -36,14 +36,14 @@ THREE.extend(THREE.Vector3.prototype,{set:function(a,b,c){this.x=a;this.y=b;this
|
|
|
a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
|
|
|
this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*
|
|
|
b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements,e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);
|
|
|
-this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,a=a.w,h=a*b+f*d-g*c,i=a*c+g*b-e*d,k=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+i*-g-k*-f;this.y=i*a+b*-f+k*-e-h*-g;this.z=k*a+b*-g+h*-f-i*-e;return this},applyEuler:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromEuler(b,c);this.applyQuaternion(d);return this}}(),applyAxisAngle:function(){var a=
|
|
|
+this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,a=a.w,h=a*b+f*d-g*c,i=a*c+g*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+i*-g-j*-f;this.y=i*a+b*-f+j*-e-h*-g;this.z=j*a+b*-g+h*-f-i*-e;return this},applyEuler:function(){var a=new THREE.Quaternion;return function(b,c){var d=a.setFromEuler(b,c);this.applyQuaternion(d);return this}}(),applyAxisAngle:function(){var a=
|
|
|
new THREE.Quaternion;return function(b,c){var d=a.setFromAxisAngle(b,c);this.applyQuaternion(d);return this}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=
|
|
|
a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*
|
|
|
this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),
|
|
|
this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},projectOnVector:function(){var a=new THREE.Vector3;return function(b){a.copy(b).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),
|
|
|
reflect:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b).multiplyScalar(2);return this.subVectors(a,this)}}(),angleTo:function(a){return Math.acos(this.dot(a)/this.length()/a.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,
|
|
|
-b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],k=d[9],l=d[2],n=d[6],d=d[10];void 0===b||"XYZ"===b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-k,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(n,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(k)),0.99999>Math.abs(k)?(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-l,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(n)),0.99999>Math.abs(n)?(this.y=Math.atan2(-l,d),
|
|
|
-this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(l)),0.99999>Math.abs(l)?(this.x=Math.atan2(n,d),this.z=Math.atan2(h,e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-k,i),this.y=Math.atan2(-l,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(n,i),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-k,d),this.y=0));return this},setEulerFromQuaternion:function(a,
|
|
|
+b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],k=d[2],n=d[6],d=d[10];void 0===b||"XYZ"===b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-f,e)):(this.x=Math.atan2(n,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-k,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(n)),0.99999>Math.abs(n)?(this.y=Math.atan2(-k,d),
|
|
|
+this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(k)),0.99999>Math.abs(k)?(this.x=Math.atan2(n,d),this.z=Math.atan2(h,e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-k,e)):(this.x=0,this.y=Math.atan2(g,d))):"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(n,i),this.y=Math.atan2(g,e)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,
|
|
|
b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,e=a.y*a.y,f=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-e+f),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-e+f),this.z=
|
|
|
Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getScaleFromMatrix:function(a){var b=
|
|
|
this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},toArray:function(){return[this.x,this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}});THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
@@ -51,8 +51,8 @@ THREE.extend(THREE.Vector4.prototype,{set:function(a,b,c,d){this.x=a;this.y=b;th
|
|
|
case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,
|
|
|
b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=
|
|
|
this.x,c=this.y,d=this.z,e=this.w,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},
|
|
|
-setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var k=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+k-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;k=(k+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>k?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>k?0.01>h?(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(h),
|
|
|
-b=d/c,d=i/c):0.01>k?(c=b=0.707106781,d=0):(d=Math.sqrt(k),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+k-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=
|
|
|
+setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>j?0.01>h?(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(h),
|
|
|
+b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=
|
|
|
a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+
|
|
|
this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},toArray:function(){return[this.x,
|
|
|
this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}});THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)};
|
|
@@ -68,33 +68,33 @@ this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max
|
|
|
this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},transform:function(){var a=[new THREE.Vector3,new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,
|
|
|
this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}});THREE.Matrix3=function(a,b,c,d,e,f,g,h,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,g||0,h||0,void 0!==i?i:1)};
|
|
|
-THREE.extend(THREE.Matrix3.prototype,{set:function(a,b,c,d,e,f,g,h,i){var k=this.elements;k[0]=a;k[3]=b;k[6]=c;k[1]=d;k[4]=e;k[7]=f;k[2]=g;k[5]=h;k[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},multiplyVector3Array:function(){var a=
|
|
|
+THREE.extend(THREE.Matrix3.prototype,{set:function(a,b,c,d,e,f,g,h,i){var j=this.elements;j[0]=a;j[3]=b;j[6]=c;j[1]=d;j[4]=e;j[7]=f;j[2]=g;j[5]=h;j[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(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.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],a=a[8];return b*f*a-b*g*i-c*e*a+c*g*h+d*e*i-d*f*h},getInverse:function(a,b){var c=a.elements,d=this.elements;
|
|
|
d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},transpose:function(){var a,
|
|
|
-b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}});THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,l,n,m,s,r,p){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=g||0;q[13]=h||0;q[2]=i||0;q[6]=k||0;q[10]=void 0!==l?l:1;q[14]=n||0;q[3]=m||0;q[7]=s||0;q[11]=r||0;q[15]=void 0!==p?p:1};
|
|
|
-THREE.extend(THREE.Matrix4.prototype,{set:function(a,b,c,d,e,f,g,h,i,k,l,n,m,s,r,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=k;q[10]=l;q[14]=n;q[3]=m;q[7]=s;q[11]=r;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},setRotationFromEuler:function(a,b){var c=this.elements,
|
|
|
-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,n=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+n*e;c[5]=k-m*e;c[9]=-d*h;c[2]=m-k*e;c[6]=n+l*e;c[10]=g*h}else"YXZ"===b?(k=h*i,l=h*f,n=e*i,m=e*f,c[0]=k+m*d,c[4]=n*d-l,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=l*d-n,c[6]=m+k*d,c[10]=g*h):"ZXY"===b?(k=h*i,l=h*f,n=e*i,m=e*f,c[0]=k-m*d,c[4]=-g*f,c[8]=n+l*d,c[1]=l+n*d,c[5]=g*i,c[9]=m-k*d,c[2]=-g*e,c[6]=d,c[10]=g*h):
|
|
|
-"ZYX"===b?(k=g*i,l=g*f,n=d*i,m=d*f,c[0]=h*i,c[4]=n*e-l,c[8]=k*e+m,c[1]=h*f,c[5]=m*e+k,c[9]=l*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(k=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=m-k*f,c[8]=n*f+l,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=l*f+n,c[10]=k-m*f):"XZY"===b&&(k=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=k*f+m,c[5]=g*i,c[9]=l*f-n,c[2]=n*f-l,c[6]=d*i,c[10]=m*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],n=c[9],m=c[13],s=c[2],r=c[6],p=c[10],q=c[14],x=c[3],t=c[7],v=c[11],c=c[15],w=d[0],E=d[4],J=d[8],A=d[12],z=d[1],G=d[5],I=d[9],
|
|
|
-F=d[13],V=d[2],B=d[6],T=d[10],C=d[14],K=d[3],L=d[7],W=d[11],d=d[15];e[0]=f*w+g*z+h*V+i*K;e[4]=f*E+g*G+h*B+i*L;e[8]=f*J+g*I+h*T+i*W;e[12]=f*A+g*F+h*C+i*d;e[1]=k*w+l*z+n*V+m*K;e[5]=k*E+l*G+n*B+m*L;e[9]=k*J+l*I+n*T+m*W;e[13]=k*A+l*F+n*C+m*d;e[2]=s*w+r*z+p*V+q*K;e[6]=s*E+r*G+p*B+q*L;e[10]=s*J+r*I+p*T+q*W;e[14]=s*A+r*F+p*C+q*d;e[3]=x*w+t*z+v*V+c*K;e[7]=x*E+t*G+v*B+c*L;e[11]=x*J+t*I+v*T+c*W;e[15]=x*A+t*F+v*C+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);
|
|
|
+b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}});THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,k,n,m,s,u,p){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=g||0;q[13]=h||0;q[2]=i||0;q[6]=j||0;q[10]=void 0!==k?k:1;q[14]=n||0;q[3]=m||0;q[7]=s||0;q[11]=u||0;q[15]=void 0!==p?p:1};
|
|
|
+THREE.extend(THREE.Matrix4.prototype,{set:function(a,b,c,d,e,f,g,h,i,j,k,n,m,s,u,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=i;q[6]=j;q[10]=k;q[14]=n;q[3]=m;q[7]=s;q[11]=u;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},setRotationFromEuler:function(a,b){var c=this.elements,
|
|
|
+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 j=g*i,k=g*f,n=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=k+n*e;c[5]=j-m*e;c[9]=-d*h;c[2]=m-j*e;c[6]=n+k*e;c[10]=g*h}else"YXZ"===b?(j=h*i,k=h*f,n=e*i,m=e*f,c[0]=j+m*d,c[4]=n*d-k,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=k*d-n,c[6]=m+j*d,c[10]=g*h):"ZXY"===b?(j=h*i,k=h*f,n=e*i,m=e*f,c[0]=j-m*d,c[4]=-g*f,c[8]=n+k*d,c[1]=k+n*d,c[5]=g*i,c[9]=m-j*d,c[2]=-g*e,c[6]=d,c[10]=g*h):
|
|
|
+"ZYX"===b?(j=g*i,k=g*f,n=d*i,m=d*f,c[0]=h*i,c[4]=n*e-k,c[8]=j*e+m,c[1]=h*f,c[5]=m*e+j,c[9]=k*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(j=g*h,k=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=m-j*f,c[8]=n*f+k,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=k*f+n,c[10]=j-m*f):"XZY"===b&&(j=g*h,k=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=j*f+m,c[5]=g*i,c[9]=k*f-n,c[2]=n*f-k,c[6]=d*i,c[10]=m*f+j);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,j=c*h,
|
|
|
+c=c*i,k=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(k+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+k);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],j=c[1],k=c[5],n=c[9],m=c[13],s=c[2],u=c[6],p=c[10],q=c[14],w=c[3],v=c[7],y=c[11],c=c[15],z=d[0],r=d[4],E=d[8],D=d[12],l=d[1],H=d[5],F=d[9],
|
|
|
+B=d[13],N=d[2],A=d[6],Q=d[10],C=d[14],G=d[3],t=d[7],I=d[11],d=d[15];e[0]=f*z+g*l+h*N+i*G;e[4]=f*r+g*H+h*A+i*t;e[8]=f*E+g*F+h*Q+i*I;e[12]=f*D+g*B+h*C+i*d;e[1]=j*z+k*l+n*N+m*G;e[5]=j*r+k*H+n*A+m*t;e[9]=j*E+k*F+n*Q+m*I;e[13]=j*D+k*B+n*C+m*d;e[2]=s*z+u*l+p*N+q*G;e[6]=s*r+u*H+p*A+q*t;e[10]=s*E+u*F+p*Q+q*I;e[14]=s*D+u*B+p*C+q*d;e[3]=w*z+v*l+y*N+c*G;e[7]=w*r+v*H+y*A+c*t;e[11]=w*E+v*F+y*Q+c*I;e[15]=w*D+v*B+y*C+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],n=a[10],m=a[14];return a[3]*(+e*h*l-d*i*l-e*g*n+c*i*n+d*g*m-c*h*m)+a[7]*
|
|
|
-(+b*h*m-b*i*n+e*f*n-d*f*m+d*i*k-e*h*k)+a[11]*(+b*i*l-b*g*m-e*f*l+c*f*m+e*g*k-c*i*k)+a[15]*(-d*g*k-b*h*l+b*g*n+d*f*l-c*f*n+c*h*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=
|
|
|
+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],j=a[2],k=a[6],n=a[10],m=a[14];return a[3]*(+e*h*k-d*i*k-e*g*n+c*i*n+d*g*m-c*h*m)+a[7]*
|
|
|
+(+b*h*m-b*i*n+e*f*n-d*f*m+d*i*j-e*h*j)+a[11]*(+b*i*k-b*g*m-e*f*k+c*f*m+e*g*j-c*i*j)+a[15]*(-d*g*j-b*h*k+b*g*n+d*f*k-c*f*n+c*h*j)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=
|
|
|
b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");
|
|
|
-var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],i=d[1],k=d[5],l=d[9],n=d[13],m=d[2],s=d[6],r=d[10],p=d[14],q=d[3],x=d[7],t=d[11],v=d[15];c[0]=l*p*x-n*r*x+n*s*t-k*p*t-l*s*v+k*r*v;c[4]=h*r*x-g*p*x-h*s*t+f*p*t+g*s*v-f*r*v;c[8]=g*n*x-h*l*x+h*k*t-f*n*t-g*k*v+f*l*v;c[12]=h*l*s-g*n*s-h*k*r+f*n*r+g*k*p-f*l*p;c[1]=n*r*q-l*p*q-
|
|
|
-n*m*t+i*p*t+l*m*v-i*r*v;c[5]=g*p*q-h*r*q+h*m*t-e*p*t-g*m*v+e*r*v;c[9]=h*l*q-g*n*q-h*i*t+e*n*t+g*i*v-e*l*v;c[13]=g*n*m-h*l*m+h*i*r-e*n*r-g*i*p+e*l*p;c[2]=k*p*q-n*s*q+n*m*x-i*p*x-k*m*v+i*s*v;c[6]=h*s*q-f*p*q-h*m*x+e*p*x+f*m*v-e*s*v;c[10]=f*n*q-h*k*q+h*i*x-e*n*x-f*i*v+e*k*v;c[14]=h*k*m-f*n*m-h*i*s+e*n*s+f*i*p-e*k*p;c[3]=l*s*q-k*r*q-l*m*x+i*r*x+k*m*t-i*s*t;c[7]=f*r*q-g*s*q+g*m*x-e*r*x-f*m*t+e*s*t;c[11]=g*k*q-f*l*q-g*i*x+e*l*x+f*i*t-e*k*t;c[15]=f*l*m-g*k*m+g*i*s-e*l*s-f*i*r+e*k*r;c=d[0]*c[0]+d[1]*c[4]+
|
|
|
+var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],i=d[1],j=d[5],k=d[9],n=d[13],m=d[2],s=d[6],u=d[10],p=d[14],q=d[3],w=d[7],v=d[11],y=d[15];c[0]=k*p*w-n*u*w+n*s*v-j*p*v-k*s*y+j*u*y;c[4]=h*u*w-g*p*w-h*s*v+f*p*v+g*s*y-f*u*y;c[8]=g*n*w-h*k*w+h*j*v-f*n*v-g*j*y+f*k*y;c[12]=h*k*s-g*n*s-h*j*u+f*n*u+g*j*p-f*k*p;c[1]=n*u*q-k*p*q-
|
|
|
+n*m*v+i*p*v+k*m*y-i*u*y;c[5]=g*p*q-h*u*q+h*m*v-e*p*v-g*m*y+e*u*y;c[9]=h*k*q-g*n*q-h*i*v+e*n*v+g*i*y-e*k*y;c[13]=g*n*m-h*k*m+h*i*u-e*n*u-g*i*p+e*k*p;c[2]=j*p*q-n*s*q+n*m*w-i*p*w-j*m*y+i*s*y;c[6]=h*s*q-f*p*q-h*m*w+e*p*w+f*m*y-e*s*y;c[10]=f*n*q-h*j*q+h*i*w-e*n*w-f*i*y+e*j*y;c[14]=h*j*m-f*n*m-h*i*s+e*n*s+f*i*p-e*j*p;c[3]=k*s*q-j*u*q-k*m*w+i*u*w+j*m*v-i*s*v;c[7]=f*u*q-g*s*q+g*m*w-e*u*w-f*m*v+e*s*v;c[11]=g*j*q-f*k*q-g*i*w+e*k*w+f*i*v-e*j*v;c[15]=f*k*m-g*j*m+g*i*s-e*k*s-f*i*u+e*j*u;c=d[0]*c[0]+d[1]*c[4]+
|
|
|
d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},compose:function(){var a=new THREE.Matrix4,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements;a.identity();a.setRotationFromQuaternion(d);b.makeScale(e.x,e.y,e.z);this.multiplyMatrices(a,b);f[12]=c.x;f[13]=c.y;f[14]=c.z;return this}}(),decompose:function(){var a=
|
|
|
new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Matrix4;return function(e,f,g){var h=this.elements;a.set(h[0],h[1],h[2]);b.set(h[4],h[5],h[6]);c.set(h[8],h[9],h[10]);e=e instanceof THREE.Vector3?e:new THREE.Vector3;f=f instanceof THREE.Quaternion?f:new THREE.Quaternion;g=g instanceof THREE.Vector3?g:new THREE.Vector3;g.x=a.length();g.y=b.length();g.z=c.length();e.x=h[12];e.y=h[13];e.z=h[14];d.copy(this);d.elements[0]/=g.x;d.elements[1]/=g.x;d.elements[2]/=g.x;d.elements[4]/=
|
|
|
g.y;d.elements[5]/=g.y;d.elements[6]/=g.y;d.elements[8]/=g.z;d.elements[9]/=g.z;d.elements[10]/=g.z;f.setFromRotationMatrix(d);return[e,f,g]}}(),extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=
|
|
|
-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),n=1-k,m=d*e*n,s=d*f*n,n=e*f*n,d=d*l,r=e*l,l=f*l,f=g+(1-g)*k,g=m+l,e=s-r,m=m-l,h=h+(1-h)*k,l=n+d,s=s+r,n=n-d,i=i+(1-i)*k,k=c[0],d=c[1],r=c[2],p=c[3],q=c[4],x=c[5],t=c[6],
|
|
|
-v=c[7],w=c[8],E=c[9],J=c[10],A=c[11];c[0]=f*k+g*q+e*w;c[1]=f*d+g*x+e*E;c[2]=f*r+g*t+e*J;c[3]=f*p+g*v+e*A;c[4]=m*k+h*q+l*w;c[5]=m*d+h*x+l*E;c[6]=m*r+h*t+l*J;c[7]=m*p+h*v+l*A;c[8]=s*k+n*q+i*w;c[9]=s*d+n*x+i*E;c[10]=s*r+n*t+i*J;c[11]=s*p+n*v+i*A;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]*
|
|
|
+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],j=b[11],k=Math.cos(a),a=Math.sin(a);b[4]=k*c+a*g;b[5]=k*d+a*h;b[6]=k*e+a*i;b[7]=k*f+a*j;b[8]=k*g-a*c;b[9]=k*h-a*d;b[10]=
|
|
|
+k*i-a*e;b[11]=k*j-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],j=b[11],k=Math.cos(a),a=Math.sin(a);b[0]=k*c-a*g;b[1]=k*d-a*h;b[2]=k*e-a*i;b[3]=k*f-a*j;b[8]=k*g+a*c;b[9]=k*h+a*d;b[10]=k*i+a*e;b[11]=k*j+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],j=b[7],k=Math.cos(a),a=Math.sin(a);b[0]=k*c+a*g;b[1]=k*d+a*h;b[2]=k*e+a*i;b[3]=k*f+a*j;b[4]=k*g-a*c;b[5]=k*h-a*d;b[6]=k*i-a*e;b[7]=k*
|
|
|
+j-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,j=Math.cos(b),k=Math.sin(b),n=1-j,m=d*e*n,s=d*f*n,n=e*f*n,d=d*k,u=e*k,k=f*k,f=g+(1-g)*j,g=m+k,e=s-u,m=m-k,h=h+(1-h)*j,k=n+d,s=s+u,n=n-d,i=i+(1-i)*j,j=c[0],d=c[1],u=c[2],p=c[3],q=c[4],w=c[5],v=c[6],
|
|
|
+y=c[7],z=c[8],r=c[9],E=c[10],D=c[11];c[0]=f*j+g*q+e*z;c[1]=f*d+g*w+e*r;c[2]=f*u+g*v+e*E;c[3]=f*p+g*y+e*D;c[4]=m*j+h*q+k*z;c[5]=m*d+h*w+k*r;c[6]=m*u+h*v+k*E;c[7]=m*p+h*y+k*D;c[8]=s*j+n*q+i*z;c[9]=s*d+n*w+i*r;c[10]=s*u+n*v+i*E;c[11]=s*p+n*y+i*D;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*
|
|
|
a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,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],
|
|
|
+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,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*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,j=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/j;g[14]=-((f+e)/j);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],
|
|
|
a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}});THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
|
|
|
THREE.extend(THREE.Ray.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);var d=
|
|
|
c.dot(this.direction);return c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){return 0!=a.normal.dot(this.direction)||0==a.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(a){var b=
|
|
@@ -102,29 +102,29 @@ a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))retur
|
|
|
THREE.extend(THREE.Sphere.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromCenterAndPoints:function(a,b){for(var c=0,d=0,e=b.length;d<e;d++)var f=a.distanceToSquared(b[d]),c=Math.max(c,f);this.center=a;this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
|
|
|
this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},transform:function(a){this.center.applyMatrix4(a);
|
|
|
this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}});THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
|
|
|
-THREE.extend(THREE.Frustum.prototype,{set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],k=c[7],l=c[8],n=c[9],m=c[10],s=c[11],r=c[12],p=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,k-g,s-l,c-r).normalize();b[1].setComponents(f+
|
|
|
-a,k+g,s+l,c+r).normalize();b[2].setComponents(f+d,k+h,s+n,c+p).normalize();b[3].setComponents(f-d,k-h,s-n,c-p).normalize();b[4].setComponents(f-e,k-i,s-m,c-q).normalize();b[5].setComponents(f+e,k+i,s+m,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
|
|
|
+THREE.extend(THREE.Frustum.prototype,{set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],k=c[8],n=c[9],m=c[10],s=c[11],u=c[12],p=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,j-g,s-k,c-u).normalize();b[1].setComponents(f+
|
|
|
+a,j+g,s+k,c+u).normalize();b[2].setComponents(f+d,j+h,s+n,c+p).normalize();b[3].setComponents(f-d,j-h,s-n,c-p).normalize();b[4].setComponents(f-e,j-i,s-m,c-q).normalize();b[5].setComponents(f+e,j+i,s+m,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.matrixWorld,d=this.planes,b=-b.geometry.boundingSphere.radius*c.getMaxScaleOnAxis();a.getPositionFromMatrix(c);for(c=0;6>c;c++)if(d[c].distanceToPoint(a)<b)return!1;return!0}}(),intersectsSphere:function(a){for(var b=
|
|
|
this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}});THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
|
|
|
THREE.extend(THREE.Plane.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),
|
|
|
copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,
|
|
|
b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a,b){var c=this.distanceToPoint(a),d=this.distanceToPoint(b);return 0>c&&0<d||0>d&&0<c},intersectLine:function(){var a=new THREE.Vector3;return function(b,c,d){var d=d||new THREE.Vector3,c=a.subVectors(c,b),e=this.normal.dot(c);if(0==e){if(0==this.distanceToPoint(b))return d.copy(b)}else return e=-(b.dot(this.normal)+this.constant)/e,0>e||1<e?void 0:d.copy(c).multiplyScalar(e).add(b)}}(),
|
|
|
coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},transform:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){var d=d||(new THREE.Matrix3).getInverse(c).transpose(),e=a.copy(this.normal).applyMatrix3(d),f=this.coplanarPoint(b);f.applyMatrix4(c);this.setFromNormalAndCoplanarPoint(e,f);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&
|
|
|
a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}});THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*
|
|
|
-a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,l,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
-f+2;k=this.points[c[0]];l=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,l.x,n.x,m.x,g,h,i);d.y=b(k.y,l.y,n.y,m.y,g,h,i);d.z=b(k.z,l.z,n.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
|
|
|
-a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
|
|
|
-h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
|
|
|
-THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),i=b.dot(b),g=b.dot(c),k=d*i-e*e,h=h||new THREE.Vector3;if(0==k)return h.set(-2,-1,-1);k=1/k;i=(i*f-e*g)*k;d=(d*g-e*f)*k;return h.set(1-i-d,d,i)}}();
|
|
|
+a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,k,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
+f+2;j=this.points[c[0]];k=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,k.x,n.x,m.x,g,h,i);d.y=b(j.y,k.y,n.y,m.y,g,h,i);d.z=b(j.z,k.z,n.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,i=[],h=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
|
|
|
+a/c,d=this.getPoint(b),g.copy(d),h+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=h,e=b);i[i.length]=h;return{chunks:i,total:h}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,i=[],h=new THREE.Vector3,k=this.getLength();i.push(h.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];g=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
|
|
|
+i.push(h.copy(d).clone());i.push(h.copy(this.points[b]).clone())}this.points=i}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
|
|
|
+THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),i=b.dot(b),g=b.dot(c),j=d*i-e*e,h=h||new THREE.Vector3;if(0==j)return h.set(-2,-1,-1);j=1/j;i=(i*f-e*g)*j;d=(d*g-e*f)*j;return h.set(1-i-d,d,i)}}();
|
|
|
THREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}();
|
|
|
THREE.extend(THREE.Triangle.prototype,{constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return 0.5*a.cross(b).length()}}(),
|
|
|
midpoint:function(a){return(a||new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&
|
|
|
a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}});THREE.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,x=h.material.side,t,v,w,E=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);g.getInverse(h.matrixWorld);c.copy(i.ray).transform(g);for(var J=0,A=s.faces.length;J<A;J++){var z=s.faces[J],x=!0===p?q[z.materialIndex]:
|
|
|
-h.material;if(void 0!==x){d.setFromNormalAndCoplanarPoint(z.normal,r[z.a]);var G=c.distanceToPlane(d);if(!(Math.abs(G)<E)&&!(0>G)){x=x.side;if(x!==a.DoubleSide&&(t=c.direction.dot(d.normal),!(x===a.FrontSide?0>t:0<t)))continue;if(!(G<i.near||G>i.far)){e=c.at(G,e);if(z instanceof a.Face3){if(x=r[z.a],t=r[z.b],v=r[z.c],!a.Triangle.containsPoint(e,x,t,v))continue}else if(z instanceof a.Face4){if(x=r[z.a],t=r[z.b],v=r[z.c],w=r[z.d],!a.Triangle.containsPoint(e,x,t,w)&&!a.Triangle.containsPoint(e,t,v,w))continue}else throw Error("face type not supported");
|
|
|
-k.push({distance:G,point:i.ray.at(G),face:z,faceIndex:J,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=
|
|
|
+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(i,h,j){if(i instanceof a.Particle){f.getPositionFromMatrix(i.matrixWorld);h=h.ray.distanceToPoint(f);if(h>i.scale.x)return j;j.push({distance:h,point:i.position,face:null,object:i})}else if(i instanceof
|
|
|
+a.Mesh){f.getPositionFromMatrix(i.matrixWorld);b.set(f,i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis());if(!h.ray.isIntersectionSphere(b))return j;var s=i.geometry,u=s.vertices,p=i.material instanceof a.MeshFaceMaterial,q=!0===p?i.material.materials:null,w=i.material.side,v,y,z,r=h.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);g.getInverse(i.matrixWorld);c.copy(h.ray).transform(g);for(var E=0,D=s.faces.length;E<D;E++){var l=s.faces[E],w=!0===p?q[l.materialIndex]:
|
|
|
+i.material;if(void 0!==w){d.setFromNormalAndCoplanarPoint(l.normal,u[l.a]);var H=c.distanceToPlane(d);if(!(Math.abs(H)<r)&&!(0>H)){w=w.side;if(w!==a.DoubleSide&&(v=c.direction.dot(d.normal),!(w===a.FrontSide?0>v:0<v)))continue;if(!(H<h.near||H>h.far)){e=c.at(H,e);if(l instanceof a.Face3){if(w=u[l.a],v=u[l.b],y=u[l.c],!a.Triangle.containsPoint(e,w,v,y))continue}else if(l instanceof a.Face4){if(w=u[l.a],v=u[l.b],y=u[l.c],z=u[l.d],!a.Triangle.containsPoint(e,w,v,z)&&!a.Triangle.containsPoint(e,v,y,z))continue}else throw Error("face type not supported");
|
|
|
+j.push({distance:H,point:h.ray.at(H),face:l,faceIndex:E,object:i})}}}}}},j=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&&j(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&&j(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=
|
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);a=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.add(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
|
|
|
this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(a){return a.applyMatrix4(THREE.Object3D.__m1.getInverse(this.matrixWorld))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))},add:function(a){if(a===
|
|
@@ -132,20 +132,20 @@ this)console.warn("THREE.Object3D.add: An object can't be added as a child of it
|
|
|
traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},getChildByName:function(a,b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name===a||!0===b&&(e=e.getChildByName(a,b),void 0!==e))return e}},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
!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===n){var a=new THREE.RenderableVertex;l.push(a);n++;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=[],n=0,m,s,r=[],p=0,q,x=[],t=0,v,w,E=[],J=0,A,z,G=[],I=0,F={objects:[],sprites:[],lights:[],elements:[]},V=new THREE.Vector3,B=new THREE.Vector4,T=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,K=Array(3),L=Array(4),W=new THREE.Matrix4,X=new THREE.Matrix4,qa,ga=new THREE.Matrix4,H=new THREE.Matrix3,ba=new THREE.Matrix3,Ca=new THREE.Vector3,ja=new THREE.Frustum,oa=new THREE.Vector4,M=new THREE.Vector4;
|
|
|
-this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);X.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(X)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);X.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(X)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,
|
|
|
-c)};this.projectScene=function(g,h,n,xb){var za=!1,ca,ma,na,Z,ha,sa,ka,Ia,db,$a,ua,Wa,Ta;z=w=q=s=0;F.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();W.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));X.multiplyMatrices(h.projectionMatrix,W);ba.getInverse(W);ba.transpose();ja.setFromMatrix(X);f=0;F.objects.length=0;F.sprites.length=0;F.lights.length=0;var Ua=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)F.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===ja.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(X),e.z=V.z),F.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(X),e.z=V.z),F.sprites.push(e)):(e=a(),e.object=
|
|
|
-f,null!==f.renderDepth?e.z=f.renderDepth:(V.getPositionFromMatrix(f.matrixWorld),V.applyProjection(X),e.z=V.z),F.objects.push(e));Ua(f)}}};Ua(g);!0===n&&F.objects.sort(c);g=0;for(n=F.objects.length;g<n;g++)if(Ia=F.objects[g].object,qa=Ia.matrixWorld,k=0,Ia instanceof THREE.Mesh){db=Ia.geometry;na=db.vertices;$a=db.faces;db=db.faceVertexUvs;H.getInverse(qa);H.transpose();Wa=Ia.material instanceof THREE.MeshFaceMaterial;Ta=!0===Wa?Ia.material:null;ca=0;for(ma=na.length;ca<ma;ca++)i=b(),i.positionWorld.copy(na[ca]).applyMatrix4(qa),
|
|
|
-i.positionScreen.copy(i.positionWorld).applyMatrix4(X),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);na=0;for(ca=$a.length;na<ca;na++){ma=$a[na];var nb=!0===Wa?Ta.materials[ma.materialIndex]:Ia.material;if(void 0!==nb){sa=nb.side;if(ma instanceof THREE.Face3)if(Z=l[ma.a],ha=l[ma.b],
|
|
|
-ka=l[ma.c],K[0]=Z.positionScreen,K[1]=ha.positionScreen,K[2]=ka.positionScreen,!0===Z.visible||!0===ha.visible||!0===ka.visible||T.isIntersectionBox(C.setFromPoints(K)))if(za=0>(ka.positionScreen.x-Z.positionScreen.x)*(ha.positionScreen.y-Z.positionScreen.y)-(ka.positionScreen.y-Z.positionScreen.y)*(ha.positionScreen.x-Z.positionScreen.x),sa===THREE.DoubleSide||za===(sa===THREE.FrontSide))s===p?(ua=new THREE.RenderableFace3,r.push(ua),p++,s++,m=ua):m=r[s++],m.v1.copy(Z),m.v2.copy(ha),m.v3.copy(ka);
|
|
|
-else continue;else continue;else if(ma instanceof THREE.Face4)if(Z=l[ma.a],ha=l[ma.b],ka=l[ma.c],ua=l[ma.d],L[0]=Z.positionScreen,L[1]=ha.positionScreen,L[2]=ka.positionScreen,L[3]=ua.positionScreen,!0===Z.visible||!0===ha.visible||!0===ka.visible||!0===ua.visible||T.isIntersectionBox(C.setFromPoints(L)))if(za=0>(ua.positionScreen.x-Z.positionScreen.x)*(ha.positionScreen.y-Z.positionScreen.y)-(ua.positionScreen.y-Z.positionScreen.y)*(ha.positionScreen.x-Z.positionScreen.x)||0>(ha.positionScreen.x-
|
|
|
-ka.positionScreen.x)*(ua.positionScreen.y-ka.positionScreen.y)-(ha.positionScreen.y-ka.positionScreen.y)*(ua.positionScreen.x-ka.positionScreen.x),sa===THREE.DoubleSide||za===(sa===THREE.FrontSide)){if(q===t){var yb=new THREE.RenderableFace4;x.push(yb);t++;q++;m=yb}else m=x[q++];m.v1.copy(Z);m.v2.copy(ha);m.v3.copy(ka);m.v4.copy(ua)}else continue;else continue;m.normalModel.copy(ma.normal);!1===za&&(sa===THREE.BackSide||sa===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(H).normalize();
|
|
|
-m.normalModelView.copy(m.normalModel).applyMatrix3(ba);m.centroidModel.copy(ma.centroid).applyMatrix4(qa);ka=ma.vertexNormals;Z=0;for(ha=ka.length;Z<ha;Z++)ua=m.vertexNormalsModel[Z],ua.copy(ka[Z]),!1===za&&(sa===THREE.BackSide||sa===THREE.DoubleSide)&&ua.negate(),ua.applyMatrix3(H).normalize(),m.vertexNormalsModelView[Z].copy(ua).applyMatrix3(ba);m.vertexNormalsLength=ka.length;Z=0;for(ha=db.length;Z<ha;Z++)if(ua=db[Z][na],void 0!==ua){sa=0;for(ka=ua.length;sa<ka;sa++)m.uvs[Z][sa]=ua[sa]}m.color=
|
|
|
-ma.color;m.material=nb;Ca.copy(m.centroidModel).applyProjection(X);m.z=Ca.z;F.elements.push(m)}}}else if(Ia instanceof THREE.Line){ga.multiplyMatrices(X,qa);na=Ia.geometry.vertices;Z=b();Z.positionScreen.copy(na[0]).applyMatrix4(ga);$a=Ia.type===THREE.LinePieces?2:1;ca=1;for(ma=na.length;ca<ma;ca++)Z=b(),Z.positionScreen.copy(na[ca]).applyMatrix4(ga),0<(ca+1)%$a||(ha=l[k-2],oa.copy(Z.positionScreen),M.copy(ha.positionScreen),!0===d(oa,M)&&(oa.multiplyScalar(1/oa.w),M.multiplyScalar(1/M.w),w===J?(db=
|
|
|
-new THREE.RenderableLine,E.push(db),J++,w++,v=db):v=E[w++],v.v1.positionScreen.copy(oa),v.v2.positionScreen.copy(M),v.z=Math.max(oa.z,M.z),v.material=Ia.material,F.elements.push(v)))}g=0;for(n=F.sprites.length;g<n;g++)Ia=F.sprites[g].object,qa=Ia.matrixWorld,Ia instanceof THREE.Particle&&(B.set(qa.elements[12],qa.elements[13],qa.elements[14],1),B.applyMatrix4(X),B.z/=B.w,0<B.z&&1>B.z&&(z===I?(za=new THREE.RenderableParticle,G.push(za),I++,z++,A=za):A=G[z++],A.object=Ia,A.x=B.x/B.w,A.y=B.y/B.w,A.z=
|
|
|
-B.z,A.rotation=Ia.rotation.z,A.scale.x=Ia.scale.x*Math.abs(A.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),A.scale.y=Ia.scale.y*Math.abs(A.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),A.material=Ia.material,F.elements.push(A)));!0===xb&&F.elements.sort(c);return F}};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};
|
|
|
+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(j===n){var a=new THREE.RenderableVertex;k.push(a);n++;j++;return a}return k[j++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=i)return!0;if(0>e&&0>f||0>g&&0>i)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-i)):0>i&&(d=Math.min(d,g/(g-i)));if(d<
|
|
|
+c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var e,f,g=[],h=0,i,j,k=[],n=0,m,s,u=[],p=0,q,w=[],v=0,y,z,r=[],E=0,D,l,H=[],F=0,B={objects:[],sprites:[],lights:[],elements:[]},N=new THREE.Vector3,A=new THREE.Vector4,Q=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,G=Array(3),t=Array(4),I=new THREE.Matrix4,M=new THREE.Matrix4,J,x=new THREE.Matrix4,K=new THREE.Matrix3,S=new THREE.Matrix3,aa=new THREE.Vector3,Y=new THREE.Frustum,V=new THREE.Vector4,L=new THREE.Vector4;
|
|
|
+this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(M)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);M.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(M)};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,n,X){var U=!1,T,$,ba,P,Z,ca,da,fa,pa,Aa,ea,sa,la;l=z=q=s=0;B.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();I.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));M.multiplyMatrices(h.projectionMatrix,I);S.getInverse(I);S.transpose();Y.setFromMatrix(M);f=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;var ya=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)B.lights.push(f);
|
|
|
+else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===Y.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(N.getPositionFromMatrix(f.matrixWorld),N.applyProjection(M),e.z=N.z),B.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(N.getPositionFromMatrix(f.matrixWorld),N.applyProjection(M),e.z=N.z),B.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=
|
|
|
+f.renderDepth:(N.getPositionFromMatrix(f.matrixWorld),N.applyProjection(M),e.z=N.z),B.objects.push(e));ya(f)}}};ya(g);!0===n&&B.objects.sort(c);g=0;for(n=B.objects.length;g<n;g++)if(fa=B.objects[g].object,J=fa.matrixWorld,j=0,fa instanceof THREE.Mesh){pa=fa.geometry;ba=pa.vertices;Aa=pa.faces;pa=pa.faceVertexUvs;K.getInverse(J);K.transpose();sa=fa.material instanceof THREE.MeshFaceMaterial;la=!0===sa?fa.material:null;T=0;for($=ba.length;T<$;T++)i=b(),i.positionWorld.copy(ba[T]).applyMatrix4(J),i.positionScreen.copy(i.positionWorld).applyMatrix4(M),
|
|
|
+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);ba=0;for(T=Aa.length;ba<T;ba++){$=Aa[ba];var Ga=!0===sa?la.materials[$.materialIndex]:fa.material;if(void 0!==Ga){ca=Ga.side;if($ instanceof THREE.Face3)if(P=k[$.a],Z=k[$.b],da=k[$.c],G[0]=P.positionScreen,G[1]=Z.positionScreen,G[2]=da.positionScreen,
|
|
|
+!0===P.visible||!0===Z.visible||!0===da.visible||Q.isIntersectionBox(C.setFromPoints(G)))if(U=0>(da.positionScreen.x-P.positionScreen.x)*(Z.positionScreen.y-P.positionScreen.y)-(da.positionScreen.y-P.positionScreen.y)*(Z.positionScreen.x-P.positionScreen.x),ca===THREE.DoubleSide||U===(ca===THREE.FrontSide))s===p?(ea=new THREE.RenderableFace3,u.push(ea),p++,s++,m=ea):m=u[s++],m.v1.copy(P),m.v2.copy(Z),m.v3.copy(da);else continue;else continue;else if($ instanceof THREE.Face4)if(P=k[$.a],Z=k[$.b],da=
|
|
|
+k[$.c],ea=k[$.d],t[0]=P.positionScreen,t[1]=Z.positionScreen,t[2]=da.positionScreen,t[3]=ea.positionScreen,!0===P.visible||!0===Z.visible||!0===da.visible||!0===ea.visible||Q.isIntersectionBox(C.setFromPoints(t)))if(U=0>(ea.positionScreen.x-P.positionScreen.x)*(Z.positionScreen.y-P.positionScreen.y)-(ea.positionScreen.y-P.positionScreen.y)*(Z.positionScreen.x-P.positionScreen.x)||0>(Z.positionScreen.x-da.positionScreen.x)*(ea.positionScreen.y-da.positionScreen.y)-(Z.positionScreen.y-da.positionScreen.y)*
|
|
|
+(ea.positionScreen.x-da.positionScreen.x),ca===THREE.DoubleSide||U===(ca===THREE.FrontSide)){if(q===v){var Ja=new THREE.RenderableFace4;w.push(Ja);v++;q++;m=Ja}else m=w[q++];m.v1.copy(P);m.v2.copy(Z);m.v3.copy(da);m.v4.copy(ea)}else continue;else continue;m.normalModel.copy($.normal);!1===U&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(K).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(S);m.centroidModel.copy($.centroid).applyMatrix4(J);
|
|
|
+da=$.vertexNormals;P=0;for(Z=da.length;P<Z;P++)ea=m.vertexNormalsModel[P],ea.copy(da[P]),!1===U&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&ea.negate(),ea.applyMatrix3(K).normalize(),m.vertexNormalsModelView[P].copy(ea).applyMatrix3(S);m.vertexNormalsLength=da.length;P=0;for(Z=pa.length;P<Z;P++)if(ea=pa[P][ba],void 0!==ea){ca=0;for(da=ea.length;ca<da;ca++)m.uvs[P][ca]=ea[ca]}m.color=$.color;m.material=Ga;aa.copy(m.centroidModel).applyProjection(M);m.z=aa.z;B.elements.push(m)}}}else if(fa instanceof
|
|
|
+THREE.Line){x.multiplyMatrices(M,J);ba=fa.geometry.vertices;P=b();P.positionScreen.copy(ba[0]).applyMatrix4(x);Aa=fa.type===THREE.LinePieces?2:1;T=1;for($=ba.length;T<$;T++)P=b(),P.positionScreen.copy(ba[T]).applyMatrix4(x),0<(T+1)%Aa||(Z=k[j-2],V.copy(P.positionScreen),L.copy(Z.positionScreen),!0===d(V,L)&&(V.multiplyScalar(1/V.w),L.multiplyScalar(1/L.w),z===E?(pa=new THREE.RenderableLine,r.push(pa),E++,z++,y=pa):y=r[z++],y.v1.positionScreen.copy(V),y.v2.positionScreen.copy(L),y.z=Math.max(V.z,L.z),
|
|
|
+y.material=fa.material,B.elements.push(y)))}g=0;for(n=B.sprites.length;g<n;g++)fa=B.sprites[g].object,J=fa.matrixWorld,fa instanceof THREE.Particle&&(A.set(J.elements[12],J.elements[13],J.elements[14],1),A.applyMatrix4(M),A.z/=A.w,0<A.z&&1>A.z&&(l===F?(U=new THREE.RenderableParticle,H.push(U),F++,l++,D=U):D=H[l++],D.object=fa,D.x=A.x/A.w,D.y=A.y/A.w,D.z=A.z,D.rotation=fa.rotation.z,D.scale.x=fa.scale.x*Math.abs(D.x-(A.x+h.projectionMatrix.elements[0])/(A.w+h.projectionMatrix.elements[12])),D.scale.y=
|
|
|
+fa.scale.y*Math.abs(D.y-(A.y+h.projectionMatrix.elements[5])/(A.w+h.projectionMatrix.elements[13])),D.material=fa.material,B.elements.push(D)));!0===X&&B.elements.sort(c);return B}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,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();
|
|
@@ -154,71 +154,71 @@ this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesN
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getInverse(a).transpose(),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,g=e.vertexNormals.length;f<g;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],
|
|
|
c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.add(this.vertices[c.d]),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=
|
|
|
this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.subVectors(f,e),h.subVectors(d,e),g.cross(h),g.normalize(),c.normal.copy(g)},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]:d instanceof
|
|
|
-THREE.Face4&&(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,h,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i.subVectors(g,f),k.subVectors(a,f),i.cross(k),e[d.a].add(i),
|
|
|
-e[d.b].add(i),e[d.c].add(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h=this.vertices[d.d],l.subVectors(h,f),k.subVectors(a,f),l.cross(k),e[d.a].add(l),e[d.b].add(l),e[d.d].add(l),n.subVectors(h,g),m.subVectors(f,g),n.cross(m),e[d.b].add(n),e[d.c].add(n),e[d.d].add(n))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)):d instanceof THREE.Face4&&(e[d.a].add(d.normal),
|
|
|
+THREE.Face4&&(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,h,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i.subVectors(g,f),j.subVectors(a,f),i.cross(j),e[d.a].add(i),
|
|
|
+e[d.b].add(i),e[d.c].add(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h=this.vertices[d.d],k.subVectors(h,f),j.subVectors(a,f),k.cross(j),e[d.a].add(k),e[d.b].add(k),e[d.d].add(k),n.subVectors(h,g),m.subVectors(f,g),n.cross(m),e[d.b].add(n),e[d.c].add(n),e[d.d].add(n))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)):d instanceof THREE.Face4&&(e[d.a].add(d.normal),
|
|
|
e[d.b].add(d.normal),e[d.c].add(d.normal),e[d.d].add(d.normal))}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeMorphNormals:function(){var a,b,c,d,e;c=0;
|
|
|
for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]=
|
|
|
-{};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];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,z){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];l=g[e];n=g[f];m=g[z];s=i.x-h.x;r=k.x-h.x;p=i.y-h.y;q=k.y-h.y;x=i.z-h.z;t=k.z-h.z;v=n.x-l.x;w=m.x-l.x;E=n.y-l.y;J=m.y-l.y;A=1/(v*J-w*E);F.set((J*s-E*r)*A,(J*p-E*q)*A,(J*x-E*t)*A);V.set((v*r-w*s)*A,(v*q-w*p)*A,(v*t-w*x)*A);G[b].add(F);G[c].add(F);G[d].add(F);I[b].add(V);I[c].add(V);I[d].add(V)}var b,c,d,e,f,g,h,i,k,l,n,m,s,r,p,q,x,t,v,w,E,J,A,z,G=[],I=[],F=new THREE.Vector3,V=new THREE.Vector3,B=new THREE.Vector3,T=new THREE.Vector3,C=new THREE.Vector3;
|
|
|
-b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,I[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++)C.copy(f.vertexNormals[d]),e=f[K[d]],z=G[e],B.copy(z),B.sub(C.multiplyScalar(C.dot(z))).normalize(),
|
|
|
-T.crossVectors(f.vertexNormals[d],z),e=T.dot(I[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);
|
|
|
-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];
|
|
|
+{};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=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(j)}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],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.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,l){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];k=g[e];n=g[f];m=g[l];s=i.x-h.x;u=j.x-h.x;p=i.y-h.y;q=j.y-h.y;w=i.z-h.z;v=j.z-h.z;y=n.x-k.x;z=m.x-k.x;r=n.y-k.y;E=m.y-k.y;D=1/(y*E-z*r);B.set((E*s-r*u)*D,(E*p-r*q)*D,(E*w-r*v)*D);N.set((y*u-z*s)*D,(y*q-z*p)*D,(y*v-z*w)*D);H[b].add(B);H[c].add(B);H[d].add(B);F[b].add(N);F[c].add(N);F[d].add(N)}var b,c,d,e,f,g,h,i,j,k,n,m,s,u,p,q,w,v,y,z,r,E,D,l,H=[],F=[],B=new THREE.Vector3,N=new THREE.Vector3,A=new THREE.Vector3,Q=new THREE.Vector3,C=new THREE.Vector3;
|
|
|
+b=0;for(c=this.vertices.length;b<c;b++)H[b]=new THREE.Vector3,F[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var G=["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++)C.copy(f.vertexNormals[d]),e=f[G[d]],l=H[e],A.copy(l),A.sub(C.multiplyScalar(C.dot(l))).normalize(),
|
|
|
+Q.crossVectors(f.vertexNormals[d],l),e=Q.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(A.x,A.y,A.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
+this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,j;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 k=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++)(j=this.faceVertexUvs[h][f])&&j.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(k.vertexNormals=a.vertexNormals,k.vertexNormals.splice(d,
|
|
|
+1));a.vertexColors&&0<a.vertexColors.length&&(k.vertexColors=a.vertexColors,k.vertexColors.splice(d,1));this.faces[f]=k}}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];
|
|
|
c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){THREE.EventDispatcher.call(this);this.id=THREE.GeometryIdCount++;this.attributes={};this.dynamic=!1;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);
|
|
|
var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=
|
|
|
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,n,m=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var x=this.attributes.index.array,t=this.offsets;c=0;for(d=t.length;c<d;++c){b=t[c].start;g=t[c].count;var v=t[c].index;a=b;for(b+=g;a<b;a+=3)g=v+x[a],h=v+x[a+1],i=v+x[a+2],k=e[3*g],l=e[3*g+1],n=e[3*g+2],m.set(k,l,n),k=e[3*h],l=e[3*h+1],n=e[3*h+2],s.set(k,l,n),k=e[3*i],l=e[3*i+1],n=e[3*i+2],r.set(k,
|
|
|
-l,n),p.subVectors(r,s),q.subVectors(m,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],n=e[a+2],m.set(k,l,n),k=e[a+3],l=e[a+4],n=e[a+5],s.set(k,l,n),k=e[a+6],l=e[a+7],n=e[a+8],r.set(k,l,n),p.subVectors(r,s),q.subVectors(m,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){qa.x=d[3*a];qa.y=d[3*a+1];qa.z=d[3*a+2];ga.copy(qa);ba=i[a];W.copy(ba);W.sub(qa.multiplyScalar(qa.dot(ba))).normalize();X.crossVectors(ga,ba);Ca=X.dot(k[a]);H=0>Ca?-1:1;h[4*a]=W.x;h[4*a+1]=W.y;h[4*a+2]=W.z;h[4*a+3]=H}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,n,m,s,r,p,q,x,t,v,w,E,J,A,z,f=new THREE.Vector3,g=new THREE.Vector3,G,I,F,V,B,T,C,K=this.offsets;F=0;for(V=K.length;F<V;++F){I=K[F].start;B=K[F].count;var L=K[F].index;G=I;for(I+=B;G<I;G+=3)B=L+b[G],T=L+b[G+1],C=L+b[G+2],l=c[3*B],n=c[3*B+1],m=c[3*B+2],s=c[3*T],r=c[3*T+1],p=c[3*T+2],q=c[3*C],x=c[3*C+1],t=c[3*C+2],v=e[2*B],w=e[2*B+1],E=e[2*T],J=e[2*T+1],A=e[2*C],z=e[2*C+1],s-=l,l=q-l,r-=n,n=x-n,p-=m,m=t-m,E-=v,v=A-v,J-=w,w=z-w,z=1/(E*w-v*J),f.set((w*s-
|
|
|
-J*l)*z,(w*r-J*n)*z,(w*p-J*m)*z),g.set((E*l-v*s)*z,(E*n-v*r)*z,(E*m-v*p)*z),i[B].add(f),i[T].add(f),i[C].add(f),k[B].add(g),k[T].add(g),k[C].add(g)}var W=new THREE.Vector3,X=new THREE.Vector3,qa=new THREE.Vector3,ga=new THREE.Vector3,H,ba,Ca;F=0;for(V=K.length;F<V;++F){I=K[F].start;B=K[F].count;L=K[F].index;G=I;for(I+=B;G<I;G+=3)B=L+b[G],T=L+b[G+1],C=L+b[G+2],a(B),a(T),a(C)}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()};
|
|
|
+0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,j,k,n,m=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var w=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 y=v[c].index;a=b;for(b+=g;a<b;a+=3)g=y+w[a],h=y+w[a+1],i=y+w[a+2],j=e[3*g],k=e[3*g+1],n=e[3*g+2],m.set(j,k,n),j=e[3*h],k=e[3*h+1],n=e[3*h+2],s.set(j,k,n),j=e[3*i],k=e[3*i+1],n=e[3*i+2],u.set(j,
|
|
|
+k,n),p.subVectors(u,s),q.subVectors(m,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)j=e[a],k=e[a+1],n=e[a+2],m.set(j,k,n),j=e[a+3],k=e[a+4],n=e[a+5],s.set(j,k,n),j=e[a+6],k=e[a+7],n=e[a+8],u.set(j,k,n),p.subVectors(u,s),q.subVectors(m,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){J.x=d[3*a];J.y=d[3*a+1];J.z=d[3*a+2];x.copy(J);S=i[a];I.copy(S);I.sub(J.multiplyScalar(J.dot(S))).normalize();M.crossVectors(x,S);aa=M.dot(j[a]);K=0>aa?-1:1;h[4*a]=I.x;h[4*a+1]=I.y;h[4*a+2]=I.z;h[4*a+3]=K}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=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,
|
|
|
+j[g]=new THREE.Vector3;var k,n,m,s,u,p,q,w,v,y,z,r,E,D,l,f=new THREE.Vector3,g=new THREE.Vector3,H,F,B,N,A,Q,C,G=this.offsets;B=0;for(N=G.length;B<N;++B){F=G[B].start;A=G[B].count;var t=G[B].index;H=F;for(F+=A;H<F;H+=3)A=t+b[H],Q=t+b[H+1],C=t+b[H+2],k=c[3*A],n=c[3*A+1],m=c[3*A+2],s=c[3*Q],u=c[3*Q+1],p=c[3*Q+2],q=c[3*C],w=c[3*C+1],v=c[3*C+2],y=e[2*A],z=e[2*A+1],r=e[2*Q],E=e[2*Q+1],D=e[2*C],l=e[2*C+1],s-=k,k=q-k,u-=n,n=w-n,p-=m,m=v-m,r-=y,y=D-y,E-=z,z=l-z,l=1/(r*z-y*E),f.set((z*s-E*k)*l,(z*u-E*n)*l,
|
|
|
+(z*p-E*m)*l),g.set((r*k-y*s)*l,(r*n-y*u)*l,(r*m-y*p)*l),i[A].add(f),i[Q].add(f),i[C].add(f),j[A].add(g),j[Q].add(g),j[C].add(g)}var I=new THREE.Vector3,M=new THREE.Vector3,J=new THREE.Vector3,x=new THREE.Vector3,K,S,aa;B=0;for(N=G.length;B<N;++B){F=G[B].start;A=G[B].count;t=G[B].index;H=F;for(F+=A;H<F;H+=3)A=t+b[H],Q=t+b[H+1],C=t+b[H+2],a(A),a(Q),a(C)}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=
|
|
|
this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,k,q){var x=f.toLowerCase().endsWith(".dds"),t=b+"/"+f;if(x){var v=THREE.ImageUtils.loadCompressedTexture(t);a[e]=v}else v=document.createElement("canvas"),a[e]=new THREE.Texture(v);a[e].sourceFile=f;h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
|
|
|
-void 0!==f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));q&&(a[e].anisotropy=q);if(!x){var w=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);w.image.width=a;w.image.height=b;w.image.getContext("2d").drawImage(this,0,0,a,b)}else w.image=this;w.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=t}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,
|
|
|
-map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?h="MeshPhongMaterial":"basic"===k&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,i,h,j,q){var w=f.toLowerCase().endsWith(".dds"),v=b+"/"+f;if(w){var y=THREE.ImageUtils.loadCompressedTexture(v);a[e]=y}else y=document.createElement("canvas"),a[e]=new THREE.Texture(y);a[e].sourceFile=f;i&&(a[e].repeat.set(i[0],i[1]),1!==i[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==i[1]&&(a[e].wrapT=THREE.RepeatWrapping));h&&a[e].offset.set(h[0],h[1]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
|
|
|
+void 0!==f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));q&&(a[e].anisotropy=q);if(!w){var z=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);z.image.width=a;z.image.height=b;z.image.getContext("2d").drawImage(this,0,0,a,b)}else z.image=this;z.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=v}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,
|
|
|
+map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
|
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
|
|
|
-a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(h=THREE.ShaderLib.normalmap,k=THREE.UniformsUtils.clone(h.uniforms),k.tNormal.value=i.normalMap,a.mapNormalFactor&&k.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(k.tDiffuse.value=i.map,k.enableDiffuse.value=!0),i.specularMap&&(k.tSpecular.value=i.specularMap,k.enableSpecular.value=!0),i.lightMap&&(k.tAO.value=i.lightMap,k.enableAO.value=!0),k.uDiffuseColor.value.setHex(i.color),
|
|
|
-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)};
|
|
|
+a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(h=THREE.ShaderLib.normalmap,j=THREE.UniformsUtils.clone(h.uniforms),j.tNormal.value=i.normalMap,a.mapNormalFactor&&j.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(j.tDiffuse.value=i.map,j.enableDiffuse.value=!0),i.specularMap&&(j.tSpecular.value=i.specularMap,j.enableSpecular.value=!0),i.lightMap&&(j.tAO.value=i.lightMap,j.enableAO.value=!0),j.uDiffuseColor.value.setHex(i.color),
|
|
|
+j.uSpecularColor.value.setHex(i.specular),j.uAmbientColor.value.setHex(i.ambient),j.uShininess.value=i.shininess,void 0!==i.opacity&&(j.uOpacity.value=i.opacity),h=new THREE.ShaderMaterial({fragmentShader:h.fragmentShader,vertexShader:h.vertexShader,uniforms:j,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,n,m,s,r,p,q,x,t,v,w=a.faces;r=a.vertices;var E=a.normals,J=a.colors,A=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&A++;for(f=0;f<A;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=w.length;i<k;){r=w[i++];l=r&1;h=r&2;f=r&4;g=r&8;m=r&16;n=r&32;p=r&64;r&=128;l?(q=new THREE.Face4,
|
|
|
-q.a=w[i++],q.b=w[i++],q.c=w[i++],q.d=w[i++],l=4):(q=new THREE.Face3,q.a=w[i++],q.b=w[i++],q.c=w[i++],l=3);h&&(h=w[i++],q.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<A;f++)x=a.uvs[f],s=w[i++],v=x[2*s],s=x[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(v,s);if(g)for(f=0;f<A;f++){x=a.uvs[f];t=[];for(g=0;g<l;g++)s=w[i++],v=x[2*s],s=x[2*s+1],t[g]=new THREE.Vector2(v,s);d.faceVertexUvs[f][h]=t}m&&(m=3*w[i++],g=new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],q.normal=g);if(n)for(f=0;f<l;f++)m=3*w[i++],g=
|
|
|
-new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],q.vertexNormals.push(g);p&&(n=w[i++],n=new THREE.Color(J[n]),q.color=n);if(r)for(f=0;f<l;f++)n=w[i++],n=new THREE.Color(J[n]),q.vertexColors.push(n);d.faces.push(q)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)w=a.skinWeights[i],E=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(w,E,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)w=a.skinIndices[i],E=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(w,E,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=[];J=d.morphTargets[i].vertices;A=a.morphTargets[i].vertices;w=0;for(E=A.length;w<E;w+=3)r=new THREE.Vector3,r.x=A[w]*e,r.y=A[w+1]*e,r.z=A[w+2]*e,J.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=
|
|
|
-[];E=d.morphColors[i].colors;J=a.morphColors[i].colors;e=0;for(w=J.length;e<w;e+=3)A=new THREE.Color(16755200),A.setRGB(J[e],J[e+1],J[e+2]),E.push(A)}}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.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,j,k,n,m,s,u,p,q,w,v,y,z=a.faces;u=a.vertices;var r=a.normals,E=a.colors,D=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&D++;for(f=0;f<D;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(j=u.length;i<j;)k=new THREE.Vector3,k.x=u[i++]*e,k.y=u[i++]*e,k.z=u[i++]*e,d.vertices.push(k);i=0;for(j=z.length;i<j;){u=z[i++];k=u&1;h=u&2;f=u&4;g=u&8;m=u&16;n=u&32;p=u&64;u&=128;k?(q=new THREE.Face4,
|
|
|
+q.a=z[i++],q.b=z[i++],q.c=z[i++],q.d=z[i++],k=4):(q=new THREE.Face3,q.a=z[i++],q.b=z[i++],q.c=z[i++],k=3);h&&(h=z[i++],q.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<D;f++)w=a.uvs[f],s=z[i++],y=w[2*s],s=w[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(y,s);if(g)for(f=0;f<D;f++){w=a.uvs[f];v=[];for(g=0;g<k;g++)s=z[i++],y=w[2*s],s=w[2*s+1],v[g]=new THREE.Vector2(y,s);d.faceVertexUvs[f][h]=v}m&&(m=3*z[i++],g=new THREE.Vector3,g.x=r[m++],g.y=r[m++],g.z=r[m],q.normal=g);if(n)for(f=0;f<k;f++)m=3*z[i++],g=
|
|
|
+new THREE.Vector3,g.x=r[m++],g.y=r[m++],g.z=r[m],q.vertexNormals.push(g);p&&(n=z[i++],n=new THREE.Color(E[n]),q.color=n);if(u)for(f=0;f<k;f++)n=z[i++],n=new THREE.Color(E[n]),q.vertexColors.push(n);d.faces.push(q)}if(a.skinWeights){i=0;for(j=a.skinWeights.length;i<j;i+=2)z=a.skinWeights[i],r=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(z,r,0,0))}if(a.skinIndices){i=0;for(j=a.skinIndices.length;i<j;i+=2)z=a.skinIndices[i],r=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(z,r,0,0))}d.bones=
|
|
|
+a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(j=a.morphTargets.length;i<j;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];E=d.morphTargets[i].vertices;D=a.morphTargets[i].vertices;z=0;for(r=D.length;z<r;z+=3)u=new THREE.Vector3,u.x=D[z]*e,u.y=D[z+1]*e,u.z=D[z+2]*e,E.push(u)}}if(void 0!==a.morphColors){i=0;for(j=a.morphColors.length;i<j;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
|
|
|
+[];r=d.morphColors[i].colors;E=a.morphColors[i].colors;e=0;for(z=E.length;e<z;e+=3)D=new THREE.Color(16755200),D.setRGB(E[e],E[e+1],E[e+2]),r.push(D)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
|
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,I.objects)}function f(a,b){var c,e,g,i,k,n,p;for(p in b)if(void 0===z.objects[p]){var q=b[p],w=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=z.materials[q.material];q.loading=
|
|
|
-!0;e=l.hierarchyHandlerMap[q.type].loaderObject;e.options?e.load(d(q.url,I.urlBaseType),h(p,a,s,q)):e.load(d(q.url,I.urlBaseType),h(p,a,s,q),g)}}else if(void 0!==q.geometry){if(m=z.geometries[q.geometry]){w=!1;s=z.materials[q.material];w=s instanceof THREE.ShaderMaterial;g=q.position;i=q.rotation;k=q.scale;c=q.matrix;n=q.quaternion;q.material||(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(z.face_materials[q.geometry]));
|
|
|
-if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)w=w||s.materials[e]instanceof THREE.ShaderMaterial;w&&m.computeTangents();q.skin?w=new THREE.SkinnedMesh(m,s):q.morph?(w=new THREE.MorphAnimMesh(m,s),void 0!==q.duration&&(w.duration=q.duration),void 0!==q.time&&(w.time=q.time),void 0!==q.mirroredLoop&&(w.mirroredLoop=q.mirroredLoop),s.morphNormals&&m.computeMorphNormals()):w=new THREE.Mesh(m,s);w.name=p;c?(w.matrixAutoUpdate=!1,w.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])):(w.position.set(g[0],g[1],g[2]),n?(w.quaternion.set(n[0],n[1],n[2],n[3]),w.useQuaternion=!0):w.rotation.set(i[0],i[1],i[2]),w.scale.set(k[0],k[1],k[2]));w.visible=q.visible;w.castShadow=q.castShadow;w.receiveShadow=q.receiveShadow;a.add(w);z.objects[p]=w}}else"DirectionalLight"===q.type||"PointLight"===q.type||"AmbientLight"===q.type?(t=void 0!==q.color?q.color:16777215,v=void 0!==q.intensity?q.intensity:1,"DirectionalLight"===q.type?(g=q.direction,
|
|
|
-x=new THREE.DirectionalLight(t,v),x.position.set(g[0],g[1],g[2]),q.target&&(G.push({object:x,targetName:q.target}),x.target=null)):"PointLight"===q.type?(g=q.position,e=q.distance,x=new THREE.PointLight(t,v,e),x.position.set(g[0],g[1],g[2])):"AmbientLight"===q.type&&(x=new THREE.AmbientLight(t)),a.add(x),x.name=p,z.lights[p]=x,z.objects[p]=x):"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,z.cameras[p]=r,z.objects[p]=r):(g=q.position,i=q.rotation,k=q.scale,n=q.quaternion,w=new THREE.Object3D,w.name=p,w.position.set(g[0],g[1],g[2]),n?(w.quaternion.set(n[0],n[1],n[2],n[3]),w.useQuaternion=!0):w.rotation.set(i[0],i[1],i[2]),w.scale.set(k[0],k[1],k[2]),w.visible=void 0!==q.visible?q.visible:!1,a.add(w),z.objects[p]=w,z.empties[p]=w);if(w){if(void 0!==
|
|
|
-q.properties)for(var B in q.properties)w.properties[B]=q.properties[B];if(void 0!==q.groups)for(e=0;e<q.groups.length;e++)g=q.groups[e],void 0===z.groups[g]&&(z.groups[g]=[]),z.groups[g].push(p);void 0!==q.children&&f(w,q.children)}}}function g(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c;e();w-=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,m=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(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});var n=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=n});b.add(f);f.name=a;z.objects[a]=f;e();w-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:J,totalTextures:A,loadedModels:J-w,loadedTextures:A-E},z);l.onLoadProgress();if(0===
|
|
|
-w&&0===E){for(var a=0;a<G.length;a++){var c=G[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,z.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(z)}}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),m,s,r,p,q,x,t,v,w,E,J,A,z,G=[],I=a,F;for(F in this.geometryHandlerMap)a=this.geometryHandlerMap[F].loaderClass,this.geometryHandlerMap[F].loaderObject=new a;for(F in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[F].loaderClass,
|
|
|
-this.hierarchyHandlerMap[F].loaderObject=new a;E=w=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(I.transform&&(F=I.transform.position,a=I.transform.rotation,c=I.transform.scale,F&&z.scene.position.set(F[0],F[1],F[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),F||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();F=function(a){return function(){E-=a;k();l.onLoadComplete()}};
|
|
|
-for(var V in I.fogs)a=I.fogs[V],"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]),z.fogs[V]=p;for(var B in I.geometries)p=I.geometries[B],p.type in this.geometryHandlerMap&&(w+=1,l.onLoadStart());for(var T in I.objects)p=I.objects[T],p.type&&p.type in this.hierarchyHandlerMap&&(w+=1,l.onLoadStart());J=w;for(B in I.geometries)if(p=I.geometries[B],"cube"===p.type)m=new THREE.CubeGeometry(p.width,p.height,p.depth,
|
|
|
-p.widthSegments,p.heightSegments,p.depthSegments),z.geometries[B]=m;else if("plane"===p.type)m=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),z.geometries[B]=m;else if("sphere"===p.type)m=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),z.geometries[B]=m;else if("cylinder"===p.type)m=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),z.geometries[B]=m;else if("torus"===p.type)m=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,
|
|
|
-p.segmentsT),z.geometries[B]=m;else if("icosahedron"===p.type)m=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),z.geometries[B]=m;else if(p.type in this.geometryHandlerMap){T={};for(q in p)"type"!==q&&"url"!==q&&(T[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,I.urlBaseType),g(B),T)}else"embedded"===p.type&&(T=I.embeds[p.id],T.metadata=I.metadata,T&&this.geometryHandlerMap.ascii.loaderObject.createModel(T,i(B),""));for(var C in I.textures)if(B=I.textures[C],B.url instanceof
|
|
|
-Array){E+=B.url.length;for(q=0;q<B.url.length;q++)l.onLoadStart()}else E+=1,l.onLoadStart();A=E;for(C in I.textures){B=I.textures[C];void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){T=B.url.length;p=[];for(q=0;q<T;q++)p[q]=d(B.url[q],I.urlBaseType);q=(q=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,F(T)):THREE.ImageUtils.loadTextureCube(p,B.mapping,F(T))}else q=B.url.toLowerCase().endsWith(".dds"),T=d(B.url,
|
|
|
-I.urlBaseType),p=F(1),q=q?THREE.ImageUtils.loadCompressedTexture(T,B.mapping,p):THREE.ImageUtils.loadTexture(T,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&&(T={repeat:THREE.RepeatWrapping,
|
|
|
-mirror:THREE.MirroredRepeatWrapping},void 0!==T[B.wrap[0]]&&(q.wrapS=T[B.wrap[0]]),void 0!==T[B.wrap[1]]&&(q.wrapT=T[B.wrap[1]]));z.textures[C]=q}var K,L;for(K in I.materials){C=I.materials[K];for(L in C.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?C.parameters[L]=z.textures[C.parameters[L]]:"shading"===L?C.parameters[L]="flat"===C.parameters[L]?THREE.FlatShading:THREE.SmoothShading:"side"===L?C.parameters[L]="double"==C.parameters[L]?THREE.DoubleSide:"back"==C.parameters[L]?
|
|
|
-THREE.BackSide:THREE.FrontSide:"blending"===L?C.parameters[L]=C.parameters[L]in THREE?THREE[C.parameters[L]]:THREE.NormalBlending:"combine"===L?C.parameters[L]=C.parameters[L]in THREE?THREE[C.parameters[L]]:THREE.MultiplyOperation:"vertexColors"===L?"face"==C.parameters[L]?C.parameters[L]=THREE.FaceColors:C.parameters[L]&&(C.parameters[L]=THREE.VertexColors):"wrapRGB"===L&&(F=C.parameters[L],C.parameters[L]=new THREE.Vector3(F[0],F[1],F[2]));void 0!==C.parameters.opacity&&1>C.parameters.opacity&&
|
|
|
-(C.parameters.transparent=!0);C.parameters.normalMap?(F=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(F.uniforms),q=C.parameters.color,T=C.parameters.specular,p=C.parameters.ambient,V=C.parameters.shininess,B.tNormal.value=z.textures[C.parameters.normalMap],C.parameters.normalScale&&B.uNormalScale.value.set(C.parameters.normalScale[0],C.parameters.normalScale[1]),C.parameters.map&&(B.tDiffuse.value=C.parameters.map,B.enableDiffuse.value=!0),C.parameters.envMap&&(B.tCube.value=C.parameters.envMap,
|
|
|
-B.enableReflection.value=!0,B.uReflectivity.value=C.parameters.reflectivity),C.parameters.lightMap&&(B.tAO.value=C.parameters.lightMap,B.enableAO.value=!0),C.parameters.specularMap&&(B.tSpecular.value=z.textures[C.parameters.specularMap],B.enableSpecular.value=!0),C.parameters.displacementMap&&(B.tDisplacement.value=z.textures[C.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=C.parameters.displacementBias,B.uDisplacementScale.value=C.parameters.displacementScale),
|
|
|
-B.uDiffuseColor.value.setHex(q),B.uSpecularColor.value.setHex(T),B.uAmbientColor.value.setHex(p),B.uShininess.value=V,C.parameters.opacity&&(B.uOpacity.value=C.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:F.fragmentShader,vertexShader:F.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[C.type](C.parameters);z.materials[K]=s}for(K in I.materials)if(C=I.materials[K],C.parameters.materials){L=[];for(q=0;q<C.parameters.materials.length;q++)L.push(z.materials[C.parameters.materials[q]]);
|
|
|
-z.materials[K].materials=L}e();z.cameras&&I.defaults.camera&&(z.currentCamera=z.cameras[I.defaults.camera]);z.fogs&&I.defaults.fog&&(z.scene.fog=z.fogs[I.defaults.fog]);l.callbackSync(z);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.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(l.scene,F.objects)}function f(a,b){var c,e,g,i,j,n,p;for(p in b)if(void 0===l.objects[p]){var L=b[p],q=null;if(L.type&&L.type in k.hierarchyHandlerMap){if(void 0===L.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 r in L)r in e||(g[r]=L[r]);s=l.materials[L.material];L.loading=
|
|
|
+!0;e=k.hierarchyHandlerMap[L.type].loaderObject;e.options?e.load(d(L.url,F.urlBaseType),h(p,a,s,L)):e.load(d(L.url,F.urlBaseType),h(p,a,s,L),g)}}else if(void 0!==L.geometry){if(m=l.geometries[L.geometry]){q=!1;s=l.materials[L.material];q=s instanceof THREE.ShaderMaterial;g=L.position;i=L.rotation;j=L.scale;c=L.matrix;n=L.quaternion;L.material||(s=new THREE.MeshFaceMaterial(l.face_materials[L.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(l.face_materials[L.geometry]));
|
|
|
+if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)q=q||s.materials[e]instanceof THREE.ShaderMaterial;q&&m.computeTangents();L.skin?q=new THREE.SkinnedMesh(m,s):L.morph?(q=new THREE.MorphAnimMesh(m,s),void 0!==L.duration&&(q.duration=L.duration),void 0!==L.time&&(q.time=L.time),void 0!==L.mirroredLoop&&(q.mirroredLoop=L.mirroredLoop),s.morphNormals&&m.computeMorphNormals()):q=new THREE.Mesh(m,s);q.name=p;c?(q.matrixAutoUpdate=!1,q.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])):(q.position.set(g[0],g[1],g[2]),n?(q.quaternion.set(n[0],n[1],n[2],n[3]),q.useQuaternion=!0):q.rotation.set(i[0],i[1],i[2]),q.scale.set(j[0],j[1],j[2]));q.visible=L.visible;q.castShadow=L.castShadow;q.receiveShadow=L.receiveShadow;a.add(q);l.objects[p]=q}}else"DirectionalLight"===L.type||"PointLight"===L.type||"AmbientLight"===L.type?(v=void 0!==L.color?L.color:16777215,y=void 0!==L.intensity?L.intensity:1,"DirectionalLight"===L.type?(g=L.direction,
|
|
|
+w=new THREE.DirectionalLight(v,y),w.position.set(g[0],g[1],g[2]),L.target&&(H.push({object:w,targetName:L.target}),w.target=null)):"PointLight"===L.type?(g=L.position,e=L.distance,w=new THREE.PointLight(v,y,e),w.position.set(g[0],g[1],g[2])):"AmbientLight"===L.type&&(w=new THREE.AmbientLight(v)),a.add(w),w.name=p,l.lights[p]=w,l.objects[p]=w):"PerspectiveCamera"===L.type||"OrthographicCamera"===L.type?("PerspectiveCamera"===L.type?u=new THREE.PerspectiveCamera(L.fov,L.aspect,L.near,L.far):"OrthographicCamera"===
|
|
|
+L.type&&(u=new THREE.OrthographicCamera(L.left,L.right,L.top,L.bottom,L.near,L.far)),g=L.position,u.position.set(g[0],g[1],g[2]),a.add(u),u.name=p,l.cameras[p]=u,l.objects[p]=u):(g=L.position,i=L.rotation,j=L.scale,n=L.quaternion,q=new THREE.Object3D,q.name=p,q.position.set(g[0],g[1],g[2]),n?(q.quaternion.set(n[0],n[1],n[2],n[3]),q.useQuaternion=!0):q.rotation.set(i[0],i[1],i[2]),q.scale.set(j[0],j[1],j[2]),q.visible=void 0!==L.visible?L.visible:!1,a.add(q),l.objects[p]=q,l.empties[p]=q);if(q){if(void 0!==
|
|
|
+L.properties)for(var t in L.properties)q.properties[t]=L.properties[t];if(void 0!==L.groups)for(e=0;e<L.groups.length;e++)g=L.groups[e],void 0===l.groups[g]&&(l.groups[g]=[]),l.groups[g].push(p);void 0!==L.children&&f(q,L.children)}}}function g(a){return function(b,c){l.geometries[a]=b;l.face_materials[a]=c;e();z-=1;k.onLoadComplete();j()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,i=d.rotation,h=d.quaternion,m=d.scale;f.position.set(g[0],g[1],g[2]);
|
|
|
+h?(f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0):f.rotation.set(i[0],i[1],i[2]);f.scale.set(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});var n=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=n});b.add(f);f.name=a;l.objects[a]=f;e();z-=1;k.onLoadComplete();j()}}function i(a){return function(b,c){l.geometries[a]=b;l.face_materials[a]=c}}function j(){k.callbackProgress({totalModels:E,totalTextures:D,loadedModels:E-z,loadedTextures:D-r},l);k.onLoadProgress();if(0===
|
|
|
+z&&0===r){for(var a=0;a<H.length;a++){var c=H[a],d=l.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,l.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(l)}}var k=this,n=THREE.Loader.prototype.extractUrlBase(c),m,s,u,p,q,w,v,y,z,r,E,D,l,H=[],F=a,B;for(B in this.geometryHandlerMap)a=this.geometryHandlerMap[B].loaderClass,this.geometryHandlerMap[B].loaderObject=new a;for(B in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[B].loaderClass,
|
|
|
+this.hierarchyHandlerMap[B].loaderObject=new a;r=z=0;l={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(F.transform&&(B=F.transform.position,a=F.transform.rotation,c=F.transform.scale,B&&l.scene.position.set(B[0],B[1],B[2]),a&&l.scene.rotation.set(a[0],a[1],a[2]),c&&l.scene.scale.set(c[0],c[1],c[2]),B||a||c))l.scene.updateMatrix(),l.scene.updateMatrixWorld();B=function(a){return function(){r-=a;j();k.onLoadComplete()}};
|
|
|
+for(var N in F.fogs)a=F.fogs[N],"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]),l.fogs[N]=p;for(var A in F.geometries)p=F.geometries[A],p.type in this.geometryHandlerMap&&(z+=1,k.onLoadStart());for(var Q in F.objects)p=F.objects[Q],p.type&&p.type in this.hierarchyHandlerMap&&(z+=1,k.onLoadStart());E=z;for(A in F.geometries)if(p=F.geometries[A],"cube"===p.type)m=new THREE.CubeGeometry(p.width,p.height,p.depth,
|
|
|
+p.widthSegments,p.heightSegments,p.depthSegments),l.geometries[A]=m;else if("plane"===p.type)m=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),l.geometries[A]=m;else if("sphere"===p.type)m=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),l.geometries[A]=m;else if("cylinder"===p.type)m=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),l.geometries[A]=m;else if("torus"===p.type)m=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,
|
|
|
+p.segmentsT),l.geometries[A]=m;else if("icosahedron"===p.type)m=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),l.geometries[A]=m;else if(p.type in this.geometryHandlerMap){Q={};for(q in p)"type"!==q&&"url"!==q&&(Q[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,F.urlBaseType),g(A),Q)}else"embedded"===p.type&&(Q=F.embeds[p.id],Q.metadata=F.metadata,Q&&this.geometryHandlerMap.ascii.loaderObject.createModel(Q,i(A),""));for(var C in F.textures)if(A=F.textures[C],A.url instanceof
|
|
|
+Array){r+=A.url.length;for(q=0;q<A.url.length;q++)k.onLoadStart()}else r+=1,k.onLoadStart();D=r;for(C in F.textures){A=F.textures[C];void 0!==A.mapping&&void 0!==THREE[A.mapping]&&(A.mapping=new THREE[A.mapping]);if(A.url instanceof Array){Q=A.url.length;p=[];for(q=0;q<Q;q++)p[q]=d(A.url[q],F.urlBaseType);q=(q=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,A.mapping,B(Q)):THREE.ImageUtils.loadTextureCube(p,A.mapping,B(Q))}else q=A.url.toLowerCase().endsWith(".dds"),Q=d(A.url,
|
|
|
+F.urlBaseType),p=B(1),q=q?THREE.ImageUtils.loadCompressedTexture(Q,A.mapping,p):THREE.ImageUtils.loadTexture(Q,A.mapping,p),void 0!==THREE[A.minFilter]&&(q.minFilter=THREE[A.minFilter]),void 0!==THREE[A.magFilter]&&(q.magFilter=THREE[A.magFilter]),A.anisotropy&&(q.anisotropy=A.anisotropy),A.repeat&&(q.repeat.set(A.repeat[0],A.repeat[1]),1!==A.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==A.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),A.offset&&q.offset.set(A.offset[0],A.offset[1]),A.wrap&&(Q={repeat:THREE.RepeatWrapping,
|
|
|
+mirror:THREE.MirroredRepeatWrapping},void 0!==Q[A.wrap[0]]&&(q.wrapS=Q[A.wrap[0]]),void 0!==Q[A.wrap[1]]&&(q.wrapT=Q[A.wrap[1]]));l.textures[C]=q}var G,t;for(G in F.materials){C=F.materials[G];for(t in C.parameters)"envMap"===t||"map"===t||"lightMap"===t||"bumpMap"===t?C.parameters[t]=l.textures[C.parameters[t]]:"shading"===t?C.parameters[t]="flat"===C.parameters[t]?THREE.FlatShading:THREE.SmoothShading:"side"===t?C.parameters[t]="double"==C.parameters[t]?THREE.DoubleSide:"back"==C.parameters[t]?
|
|
|
+THREE.BackSide:THREE.FrontSide:"blending"===t?C.parameters[t]=C.parameters[t]in THREE?THREE[C.parameters[t]]:THREE.NormalBlending:"combine"===t?C.parameters[t]=C.parameters[t]in THREE?THREE[C.parameters[t]]:THREE.MultiplyOperation:"vertexColors"===t?"face"==C.parameters[t]?C.parameters[t]=THREE.FaceColors:C.parameters[t]&&(C.parameters[t]=THREE.VertexColors):"wrapRGB"===t&&(B=C.parameters[t],C.parameters[t]=new THREE.Vector3(B[0],B[1],B[2]));void 0!==C.parameters.opacity&&1>C.parameters.opacity&&
|
|
|
+(C.parameters.transparent=!0);C.parameters.normalMap?(B=THREE.ShaderLib.normalmap,A=THREE.UniformsUtils.clone(B.uniforms),q=C.parameters.color,Q=C.parameters.specular,p=C.parameters.ambient,N=C.parameters.shininess,A.tNormal.value=l.textures[C.parameters.normalMap],C.parameters.normalScale&&A.uNormalScale.value.set(C.parameters.normalScale[0],C.parameters.normalScale[1]),C.parameters.map&&(A.tDiffuse.value=C.parameters.map,A.enableDiffuse.value=!0),C.parameters.envMap&&(A.tCube.value=C.parameters.envMap,
|
|
|
+A.enableReflection.value=!0,A.uReflectivity.value=C.parameters.reflectivity),C.parameters.lightMap&&(A.tAO.value=C.parameters.lightMap,A.enableAO.value=!0),C.parameters.specularMap&&(A.tSpecular.value=l.textures[C.parameters.specularMap],A.enableSpecular.value=!0),C.parameters.displacementMap&&(A.tDisplacement.value=l.textures[C.parameters.displacementMap],A.enableDisplacement.value=!0,A.uDisplacementBias.value=C.parameters.displacementBias,A.uDisplacementScale.value=C.parameters.displacementScale),
|
|
|
+A.uDiffuseColor.value.setHex(q),A.uSpecularColor.value.setHex(Q),A.uAmbientColor.value.setHex(p),A.uShininess.value=N,C.parameters.opacity&&(A.uOpacity.value=C.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:B.fragmentShader,vertexShader:B.vertexShader,uniforms:A,lights:!0,fog:!0})):s=new THREE[C.type](C.parameters);l.materials[G]=s}for(G in F.materials)if(C=F.materials[G],C.parameters.materials){t=[];for(q=0;q<C.parameters.materials.length;q++)t.push(l.materials[C.parameters.materials[q]]);
|
|
|
+l.materials[G].materials=t}e();l.cameras&&F.defaults.camera&&(l.currentCamera=l.cameras[F.defaults.camera]);l.fogs&&F.defaults.fog&&(l.scene.fog=l.fogs[F.defaults.fog]);k.callbackSync(l);j()};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;
|
|
|
a.visible=this.visible;return a};THREE.Material.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.MaterialIdCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
@@ -241,7 +241,7 @@ THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;T
|
|
|
THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Texture=function(a,b,c,d,e,f,g,h,i){THREE.EventDispatcher.call(this);this.id=THREE.TextureIdCount++;this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;
|
|
|
this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.needsUpdate=!1;this.onUpdate=null};
|
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=
|
|
|
-this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,i,k,l){THREE.Texture.call(this,null,f,g,h,i,k,d,e,l);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,k,l){THREE.Texture.call(this,null,f,g,h,i,k,d,e,l);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Particle.prototype.clone=function(a){void 0===a&&(a=new THREE.Particle(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;this.geometry&&null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere();this.frustumCulled=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
+this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,i,j,k){THREE.Texture.call(this,null,f,g,h,i,j,d,e,k);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,j,k){THREE.Texture.call(this,null,f,g,h,i,j,d,e,k);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=Object.create(THREE.Object3D.prototype);THREE.Particle.prototype.clone=function(a){void 0===a&&(a=new THREE.Particle(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;this.geometry&&null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere();this.frustumCulled=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.ParticleSystem.prototype.clone=function(a){void 0===a&&(a=new THREE.ParticleSystem(this.geometry,this.material));a.sortParticles=this.sortParticles;THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.type));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random(),wireframe:!0});void 0!==this.geometry&&(null===this.geometry.boundingSphere&&this.geometry.computeBoundingSphere(),this.updateMorphTargets())};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Mesh.prototype.updateMorphTargets=function(){if(0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
|
|
@@ -261,37 +261,37 @@ 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){J!==a&&(J=v.globalAlpha=a)}function c(a){A!==a&&(a===THREE.NormalBlending?v.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?v.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(v.globalCompositeOperation="darker"),A=a)}function d(a){I!==a&&(I=v.lineWidth=a)}function e(a){F!==a&&(F=v.lineCap=a)}function f(a){V!==a&&(V=v.lineJoin=a)}function g(a){z!==a&&(z=v.strokeStyle=a)}function h(a){G!==a&&(G=v.fillStyle=a)}function i(a,
|
|
|
-b){if(B!==a||T!==b)v.setLineDash([a,b]),B=a,T=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},k=this,l,n,m,s=new THREE.Projector,r=void 0!==a.canvas?a.canvas:document.createElement("canvas"),p,q,x,t,v=r.getContext("2d"),w=new THREE.Color(0),E=0,J=1,A=0,z=null,G=null,I=null,F=null,V=null,B=null,T=0,C,K,L,W,X=new THREE.RenderableVertex,qa=new THREE.RenderableVertex,ga,H,ba,Ca,ja,oa,M,Na,wb,lb,xb,za,ca=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,Z=new THREE.Color,ha=new THREE.Color,
|
|
|
-sa=new THREE.Color,ka=new THREE.Color,Ia=new THREE.Color,db={},$a={},ua,Wa,Ta,Ua,nb,yb,Kb,gc,Bb,Cb,ob=new THREE.Box2,Qa=new THREE.Box2,Da=new THREE.Box2,zb=!1,pb=new THREE.Color,wc=new THREE.Color,Ra=new THREE.Color,ia=new THREE.Vector3,mb,Ab,j,Oa,ub,eb,Xa=16;mb=document.createElement("canvas");mb.width=mb.height=2;Ab=mb.getContext("2d");Ab.fillStyle="rgba(0,0,0,1)";Ab.fillRect(0,0,2,2);j=Ab.getImageData(0,0,2,2);Oa=j.data;ub=document.createElement("canvas");ub.width=ub.height=Xa;eb=ub.getContext("2d");
|
|
|
-eb.translate(-Xa/2,-Xa/2);eb.scale(Xa,Xa);Xa--;void 0===v.setLineDash&&(v.setLineDash=void 0!==v.mozDash?function(a){v.mozDash=null!==a[0]?a:null}:function(){});this.domElement=r;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b){p=
|
|
|
-a*this.devicePixelRatio;q=b*this.devicePixelRatio;x=Math.floor(p/2);t=Math.floor(q/2);r.width=p;r.height=q;r.style.width=a+"px";r.style.height=b+"px";ob.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));Qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t));J=1;A=0;V=F=I=G=z=null};this.setClearColor=function(a,b){w.copy(a);E=void 0!==b?b:1;Qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,t))};this.setClearColorHex=function(a,b){w.setHex(a);E=void 0!==b?b:1;Qa.set(new THREE.Vector2(-x,-t),new THREE.Vector2(x,
|
|
|
-t))};this.getMaxAnisotropy=function(){return 0};this.clear=function(){v.setTransform(1,0,0,-1,x,t);!1===Qa.empty()&&(Qa.intersect(ob),Qa.expandByScalar(2),1>E&&v.clearRect(Qa.min.x|0,Qa.min.y|0,Qa.max.x-Qa.min.x|0,Qa.max.y-Qa.min.y|0),0<E&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*w.r)+","+Math.floor(255*w.g)+","+Math.floor(255*w.b)+","+E+")"),v.fillRect(Qa.min.x|0,Qa.min.y|0,Qa.max.x-Qa.min.x|0,Qa.max.y-Qa.min.y|0)),Qa.makeEmpty())};this.render=function(a,p){function q(a,b,c){for(var d=
|
|
|
-0,e=m.length;d<e;d++){var f=m[d];Ia.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ia.getPositionFromMatrix(f.matrixWorld).normalize(),j=b.dot(g);0>=j||(j*=f.intensity,c.add(Ia.multiplyScalar(j)))}else f instanceof THREE.PointLight&&(g=ia.getPositionFromMatrix(f.matrixWorld),j=b.dot(ia.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(Ia.multiplyScalar(j)))))}}function r(a,d,e,f,g,j,h,i){k.info.render.vertices+=
|
|
|
-3;k.info.render.faces++;b(i.opacity);c(i.blending);ga=a.positionScreen.x;H=a.positionScreen.y;ba=d.positionScreen.x;Ca=d.positionScreen.y;ja=e.positionScreen.x;oa=e.positionScreen.y;z(ga,H,ba,Ca,ja,oa);(i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&null===i.map?(sa.copy(i.color),ka.copy(i.emissive),i.vertexColors===THREE.FaceColors&&sa.multiply(h.color),!0===zb?!1===i.wireframe&&i.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?(ma.copy(pb),na.copy(pb),Z.copy(pb),
|
|
|
-q(h.v1.positionWorld,h.vertexNormalsModel[0],ma),q(h.v2.positionWorld,h.vertexNormalsModel[1],na),q(h.v3.positionWorld,h.vertexNormalsModel[2],Z),ma.multiply(sa).add(ka),na.multiply(sa).add(ka),Z.multiply(sa).add(ka),ha.addColors(na,Z).multiplyScalar(0.5),Ta=F(ma,na,Z,ha),G(ga,H,ba,Ca,ja,oa,0,0,1,0,0,1,Ta)):(ca.copy(pb),q(h.centroidModel,h.normalModel,ca),ca.multiply(sa).add(ka),!0===i.wireframe?B(ca,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ca)):!0===i.wireframe?B(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&&(Ua=h.uvs[0],E(ga,H,ba,Ca,ja,oa,Ua[f].x,Ua[f].y,Ua[g].x,Ua[g].y,Ua[j].x,Ua[j].y,i.map)):null!==i.envMap?i.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ia.copy(h.vertexNormalsModelView[f]),nb=0.5*ia.x+0.5,yb=0.5*ia.y+0.5,ia.copy(h.vertexNormalsModelView[g]),Kb=0.5*
|
|
|
-ia.x+0.5,gc=0.5*ia.y+0.5,ia.copy(h.vertexNormalsModelView[j]),Bb=0.5*ia.x+0.5,Cb=0.5*ia.y+0.5,E(ga,H,ba,Ca,ja,oa,nb,yb,Kb,gc,Bb,Cb,i.envMap)):(ca.copy(i.color),i.vertexColors===THREE.FaceColors&&ca.multiply(h.color),!0===i.wireframe?B(ca,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ca)):i instanceof THREE.MeshDepthMaterial?(ua=p.near,Wa=p.far,g=1-J(a.positionScreen.z*a.positionScreen.w,ua,Wa),ma.setRGB(g,g,g),g=1-J(d.positionScreen.z*d.positionScreen.w,ua,Wa),na.setRGB(g,g,g),g=
|
|
|
-1-J(e.positionScreen.z*e.positionScreen.w,ua,Wa),Z.setRGB(g,g,g),ha.addColors(na,Z).multiplyScalar(0.5),Ta=F(ma,na,Z,ha),G(ga,H,ba,Ca,ja,oa,0,0,1,0,0,1,Ta)):i instanceof THREE.MeshNormalMaterial&&(i.shading==THREE.FlatShading?(d=h.normalModelView,ca.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===i.wireframe?B(ca,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):A(ca)):i.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[f],ma.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
-d=h.vertexNormalsModelView[g],na.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[j],Z.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ha.addColors(na,Z).multiplyScalar(0.5),Ta=F(ma,na,Z,ha),G(ga,H,ba,Ca,ja,oa,0,0,1,0,0,1,Ta)))}function z(a,b,c,d,e,f){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.closePath()}function w(a,b,c,d,e,f,g,j){v.beginPath();v.moveTo(a,b);v.lineTo(c,d);v.lineTo(e,f);v.lineTo(g,j);v.closePath()}function B(a,b,c,j){d(b);e(c);
|
|
|
-f(j);g(a.getStyle());v.stroke();Da.expandByScalar(2*b)}function A(a){h(a.getStyle());v.fill()}function E(a,b,c,d,e,f,g,j,i,xa,k,m,l){if(!(l instanceof THREE.DataTexture||void 0===l.image||0==l.image.width)){if(!0===l.needsUpdate){var n=l.wrapS==THREE.RepeatWrapping,fb=l.wrapT==THREE.RepeatWrapping;db[l.id]=v.createPattern(l.image,!0===n&&!0===fb?"repeat":!0===n&&!1===fb?"repeat-x":!1===n&&!0===fb?"repeat-y":"no-repeat");l.needsUpdate=!1}void 0===db[l.id]?h("rgba(0,0,0,1)"):h(db[l.id]);var n=l.offset.x/
|
|
|
-l.repeat.x,fb=l.offset.y/l.repeat.y,p=l.image.width*l.repeat.x,q=l.image.height*l.repeat.y,g=(g+n)*p,j=(1-j+fb)*q,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+n)*p-g,xa=(1-xa+fb)*q-j,k=(k+n)*p-g,m=(1-m+fb)*q-j,n=i*m-k*xa;0===n?(void 0===$a[l.id]&&(b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,b=b.getContext("2d"),b.drawImage(l.image,0,0),$a[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data),b=$a[l.id],g=4*(Math.floor(g)+Math.floor(j)*l.image.width),ca.setRGB(b[g]/255,
|
|
|
-b[g+1]/255,b[g+2]/255),A(ca)):(n=1/n,l=(m*c-xa*e)*n,xa=(m*d-xa*f)*n,c=(i*e-k*c)*n,d=(i*f-k*d)*n,a=a-l*g-c*j,g=b-xa*g-d*j,v.save(),v.transform(l,xa,c,d,a,g),v.fill(),v.restore())}}function G(a,b,c,d,e,f,g,j,h,i,xa,k,l){var n,m;n=l.width-1;m=l.height-1;g*=n;j*=m;c-=a;d-=b;e-=a;f-=b;h=h*n-g;i=i*m-j;xa=xa*n-g;k=k*m-j;m=1/(h*k-xa*i);n=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-xa*c)*m;d=(h*f-xa*d)*m;a=a-n*g-c*j;b=b-i*g-d*j;v.save();v.transform(n,i,c,d,a,b);v.clip();v.drawImage(l,0,0);v.restore()}function F(a,b,
|
|
|
-c,d){Oa[0]=255*a.r|0;Oa[1]=255*a.g|0;Oa[2]=255*a.b|0;Oa[4]=255*b.r|0;Oa[5]=255*b.g|0;Oa[6]=255*b.b|0;Oa[8]=255*c.r|0;Oa[9]=255*c.g|0;Oa[10]=255*c.b|0;Oa[12]=255*d.r|0;Oa[13]=255*d.g|0;Oa[14]=255*d.b|0;Ab.putImageData(j,0,0);eb.drawImage(mb,0,0);return ub}function J(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}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();v.setTransform(1,0,0,-1,x,t);k.info.render.vertices=0;k.info.render.faces=0;l=s.projectScene(a,p,this.sortObjects,this.sortElements);n=l.elements;m=l.lights;zb=0<m.length;if(!0===zb){pb.setRGB(0,0,0);wc.setRGB(0,0,0);Ra.setRGB(0,0,0);for(var T=0,V=m.length;T<V;T++){var N=m[T],Y=N.color;N instanceof THREE.AmbientLight?pb.add(Y):N instanceof THREE.DirectionalLight?wc.add(Y):N instanceof THREE.PointLight&&Ra.add(Y)}}T=0;for(V=n.length;T<V;T++){var da=n[T],N=da.material;
|
|
|
-if(!(void 0===N||!1===N.visible)){Da.makeEmpty();if(da instanceof THREE.RenderableParticle){C=da;C.x*=x;C.y*=t;var Y=C,xa=da;b(N.opacity);c(N.blending);var Db=void 0,fb=void 0,Eb=void 0,Fb=void 0,yc=da=void 0,md=void 0;N instanceof THREE.ParticleBasicMaterial?null===N.map?(Eb=xa.object.scale.x,Fb=xa.object.scale.y,Eb*=xa.scale.x*x,Fb*=xa.scale.y*t,Da.min.set(Y.x-Eb,Y.y-Fb),Da.max.set(Y.x+Eb,Y.y+Fb),!1!==ob.isIntersectionBox(Da)&&(h(N.color.getStyle()),v.save(),v.translate(Y.x,Y.y),v.rotate(-xa.rotation),
|
|
|
-v.scale(Eb,Fb),v.fillRect(-1,-1,2,2),v.restore())):(da=N.map.image,yc=da.width>>1,md=da.height>>1,Eb=xa.scale.x*x,Fb=xa.scale.y*t,Db=Eb*yc,fb=Fb*md,Da.min.set(Y.x-Db,Y.y-fb),Da.max.set(Y.x+Db,Y.y+fb),!1!==ob.isIntersectionBox(Da)&&(v.save(),v.translate(Y.x,Y.y),v.rotate(-xa.rotation),v.scale(Eb,-Fb),v.translate(-yc,-md),v.drawImage(da,0,0),v.restore())):N instanceof THREE.ParticleCanvasMaterial&&(Db=xa.scale.x*x,fb=xa.scale.y*t,Da.min.set(Y.x-Db,Y.y-fb),Da.max.set(Y.x+Db,Y.y+fb),!1!==ob.isIntersectionBox(Da)&&
|
|
|
-(g(N.color.getStyle()),h(N.color.getStyle()),v.save(),v.translate(Y.x,Y.y),v.rotate(-xa.rotation),v.scale(Db,fb),N.program(v),v.restore()))}else if(da instanceof THREE.RenderableLine)C=da.v1,K=da.v2,C.positionScreen.x*=x,C.positionScreen.y*=t,K.positionScreen.x*=x,K.positionScreen.y*=t,Da.setFromPoints([C.positionScreen,K.positionScreen]),!0===ob.isIntersectionBox(Da)&&(Y=C,xa=K,b(N.opacity),c(N.blending),v.beginPath(),v.moveTo(Y.positionScreen.x,Y.positionScreen.y),v.lineTo(xa.positionScreen.x,xa.positionScreen.y),
|
|
|
-N instanceof THREE.LineBasicMaterial?(d(N.linewidth),e(N.linecap),f(N.linejoin),g(N.color.getStyle()),i(null,null),v.stroke(),Da.expandByScalar(2*N.linewidth)):N instanceof THREE.LineDashedMaterial&&(d(N.linewidth),e(N.linecap),f(N.linejoin),g(N.color.getStyle()),i(N.dashSize,N.gapSize),v.stroke(),Da.expandByScalar(2*N.linewidth)));else if(da instanceof THREE.RenderableFace3){C=da.v1;K=da.v2;L=da.v3;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;
|
|
|
-if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;K.positionScreen.x*=x;K.positionScreen.y*=t;L.positionScreen.x*=x;L.positionScreen.y*=t;!0===N.overdraw&&(I(C.positionScreen,K.positionScreen),I(K.positionScreen,L.positionScreen),I(L.positionScreen,C.positionScreen));Da.setFromPoints([C.positionScreen,K.positionScreen,L.positionScreen]);r(C,K,L,0,1,2,da,N,a)}else if(da instanceof THREE.RenderableFace4){C=da.v1;K=da.v2;L=da.v3;W=da.v4;if(-1>C.positionScreen.z||
|
|
|
-1<C.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>W.positionScreen.z||1<W.positionScreen.z)continue;C.positionScreen.x*=x;C.positionScreen.y*=t;K.positionScreen.x*=x;K.positionScreen.y*=t;L.positionScreen.x*=x;L.positionScreen.y*=t;W.positionScreen.x*=x;W.positionScreen.y*=t;X.positionScreen.copy(K.positionScreen);qa.positionScreen.copy(W.positionScreen);!0===N.overdraw&&(I(C.positionScreen,K.positionScreen),
|
|
|
-I(K.positionScreen,W.positionScreen),I(W.positionScreen,C.positionScreen),I(L.positionScreen,X.positionScreen),I(L.positionScreen,qa.positionScreen));Da.setFromPoints([C.positionScreen,K.positionScreen,L.positionScreen,W.positionScreen]);Y=C;xa=K;Db=L;fb=W;Eb=X;Fb=qa;yc=a;k.info.render.vertices+=4;k.info.render.faces++;b(N.opacity);c(N.blending);void 0!==N.map&&null!==N.map||void 0!==N.envMap&&null!==N.envMap?(r(Y,xa,fb,0,1,3,da,N,yc),r(Eb,Db,Fb,1,2,3,da,N,yc)):(ga=Y.positionScreen.x,H=Y.positionScreen.y,
|
|
|
-ba=xa.positionScreen.x,Ca=xa.positionScreen.y,ja=Db.positionScreen.x,oa=Db.positionScreen.y,M=fb.positionScreen.x,Na=fb.positionScreen.y,wb=Eb.positionScreen.x,lb=Eb.positionScreen.y,xb=Fb.positionScreen.x,za=Fb.positionScreen.y,N instanceof THREE.MeshLambertMaterial||N instanceof THREE.MeshPhongMaterial?(sa.copy(N.color),ka.copy(N.emissive),N.vertexColors===THREE.FaceColors&&sa.multiply(da.color),!0===zb?!1===N.wireframe&&N.shading==THREE.SmoothShading&&4==da.vertexNormalsLength?(ma.copy(pb),na.copy(pb),
|
|
|
-Z.copy(pb),ha.copy(pb),q(da.v1.positionWorld,da.vertexNormalsModel[0],ma),q(da.v2.positionWorld,da.vertexNormalsModel[1],na),q(da.v4.positionWorld,da.vertexNormalsModel[3],Z),q(da.v3.positionWorld,da.vertexNormalsModel[2],ha),ma.multiply(sa).add(ka),na.multiply(sa).add(ka),Z.multiply(sa).add(ka),ha.multiply(sa).add(ka),Ta=F(ma,na,Z,ha),z(ga,H,ba,Ca,M,Na),G(ga,H,ba,Ca,M,Na,0,0,1,0,0,1,Ta),z(wb,lb,ja,oa,xb,za),G(wb,lb,ja,oa,xb,za,1,0,1,1,0,1,Ta)):(ca.copy(pb),q(da.centroidModel,da.normalModel,ca),ca.multiply(sa).add(ka),
|
|
|
-w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca)):(ca.addColors(sa,ka),w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca))):N instanceof THREE.MeshBasicMaterial?(ca.copy(N.color),N.vertexColors===THREE.FaceColors&&ca.multiply(da.color),w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca)):N instanceof THREE.MeshNormalMaterial?
|
|
|
-(Y=void 0,N.shading==THREE.FlatShading?(Y=da.normalModelView,ca.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),w(ga,H,ba,Ca,ja,oa,M,Na),!0===N.wireframe?B(ca,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):A(ca)):N.shading==THREE.SmoothShading&&(Y=da.vertexNormalsModelView[0],ma.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Y=da.vertexNormalsModelView[1],na.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Y=da.vertexNormalsModelView[3],Z.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
-Y=da.vertexNormalsModelView[2],ha.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Ta=F(ma,na,Z,ha),z(ga,H,ba,Ca,M,Na),G(ga,H,ba,Ca,M,Na,0,0,1,0,0,1,Ta),z(wb,lb,ja,oa,xb,za),G(wb,lb,ja,oa,xb,za,1,0,1,1,0,1,Ta))):N instanceof THREE.MeshDepthMaterial&&(ua=p.near,Wa=p.far,ma.r=ma.g=ma.b=1-J(Y.positionScreen.z*Y.positionScreen.w,ua,Wa),na.r=na.g=na.b=1-J(xa.positionScreen.z*xa.positionScreen.w,ua,Wa),Z.r=Z.g=Z.b=1-J(fb.positionScreen.z*fb.positionScreen.w,ua,Wa),ha.r=ha.g=ha.b=1-J(Db.positionScreen.z*
|
|
|
-Db.positionScreen.w,ua,Wa),Ta=F(ma,na,Z,ha),z(ga,H,ba,Ca,M,Na),G(ga,H,ba,Ca,M,Na,0,0,1,0,0,1,Ta),z(wb,lb,ja,oa,xb,za),G(wb,lb,ja,oa,xb,za,1,0,1,1,0,1,Ta)))}Qa.union(Da)}}v.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){E!==a&&(E=y.globalAlpha=a)}function c(a){D!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(y.globalCompositeOperation="darker"),D=a)}function d(a){F!==a&&(F=y.lineWidth=a)}function e(a){B!==a&&(B=y.lineCap=a)}function f(a){N!==a&&(N=y.lineJoin=a)}function g(a){l!==a&&(l=y.strokeStyle=a)}function h(a){H!==a&&(H=y.fillStyle=a)}function i(a,
|
|
|
+b){if(A!==a||Q!==b)y.setLineDash([a,b]),A=a,Q=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},j=this,k,n,m,s=new THREE.Projector,u=void 0!==a.canvas?a.canvas:document.createElement("canvas"),p,q,w,v,y=u.getContext("2d"),z=new THREE.Color(0),r=0,E=1,D=0,l=null,H=null,F=null,B=null,N=null,A=null,Q=0,C,G,t,I,M=new THREE.RenderableVertex,J=new THREE.RenderableVertex,x,K,S,aa,Y,V,L,ka,qa,ra,X,U,T=new THREE.Color,$=new THREE.Color,ba=new THREE.Color,P=new THREE.Color,Z=new THREE.Color,
|
|
|
+ca=new THREE.Color,da=new THREE.Color,fa=new THREE.Color,pa={},Aa={},ea,sa,la,ya,Ga,Ja,La,Ma,Na,Oa,Ha=new THREE.Box2,ia=new THREE.Box2,ma=new THREE.Box2,Ba=!1,oa=new THREE.Color,Ea=new THREE.Color,Ca=new THREE.Color,ga=new THREE.Vector3,xa,Da,Fa,na,za,ha,O=16;xa=document.createElement("canvas");xa.width=xa.height=2;Da=xa.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Fa=Da.getImageData(0,0,2,2);na=Fa.data;za=document.createElement("canvas");za.width=za.height=O;ha=za.getContext("2d");
|
|
|
+ha.translate(-O/2,-O/2);ha.scale(O,O);O--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});this.domElement=u;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b){p=a*this.devicePixelRatio;
|
|
|
+q=b*this.devicePixelRatio;w=Math.floor(p/2);v=Math.floor(q/2);u.width=p;u.height=q;u.style.width=a+"px";u.style.height=b+"px";Ha.set(new THREE.Vector2(-w,-v),new THREE.Vector2(w,v));ia.set(new THREE.Vector2(-w,-v),new THREE.Vector2(w,v));E=1;D=0;N=B=F=H=l=null};this.setClearColor=function(a,b){z.copy(a);r=void 0!==b?b:1;ia.set(new THREE.Vector2(-w,-v),new THREE.Vector2(w,v))};this.setClearColorHex=function(a,b){z.setHex(a);r=void 0!==b?b:1;ia.set(new THREE.Vector2(-w,-v),new THREE.Vector2(w,v))};
|
|
|
+this.getMaxAnisotropy=function(){return 0};this.clear=function(){y.setTransform(1,0,0,-1,w,v);!1===ia.empty()&&(ia.intersect(Ha),ia.expandByScalar(2),1>r&&y.clearRect(ia.min.x|0,ia.min.y|0,ia.max.x-ia.min.x|0,ia.max.y-ia.min.y|0),0<r&&(c(THREE.NormalBlending),b(1),h("rgba("+Math.floor(255*z.r)+","+Math.floor(255*z.g)+","+Math.floor(255*z.b)+","+r+")"),y.fillRect(ia.min.x|0,ia.min.y|0,ia.max.x-ia.min.x|0,ia.max.y-ia.min.y|0)),ia.makeEmpty())};this.render=function(a,l){function p(a,b,c){for(var d=0,
|
|
|
+e=m.length;d<e;d++){var f=m[d];fa.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ga.getPositionFromMatrix(f.matrixWorld).normalize(),i=b.dot(g);0>=i||(i*=f.intensity,c.add(fa.multiplyScalar(i)))}else f instanceof THREE.PointLight&&(g=ga.getPositionFromMatrix(f.matrixWorld),i=b.dot(ga.subVectors(g,a).normalize()),0>=i||(i*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=i&&(i*=f.intensity,c.add(fa.multiplyScalar(i)))))}}function q(a,d,e,f,g,i,h,k){j.info.render.vertices+=3;
|
|
|
+j.info.render.faces++;b(k.opacity);c(k.blending);x=a.positionScreen.x;K=a.positionScreen.y;S=d.positionScreen.x;aa=d.positionScreen.y;Y=e.positionScreen.x;V=e.positionScreen.y;r(x,K,S,aa,Y,V);(k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial)&&null===k.map?(ca.copy(k.color),da.copy(k.emissive),k.vertexColors===THREE.FaceColors&&ca.multiply(h.color),!0===Ba?!1===k.wireframe&&k.shading==THREE.SmoothShading&&3==h.vertexNormalsLength?($.copy(oa),ba.copy(oa),P.copy(oa),p(h.v1.positionWorld,
|
|
|
+h.vertexNormalsModel[0],$),p(h.v2.positionWorld,h.vertexNormalsModel[1],ba),p(h.v3.positionWorld,h.vertexNormalsModel[2],P),$.multiply(ca).add(da),ba.multiply(ca).add(da),P.multiply(ca).add(da),Z.addColors(ba,P).multiplyScalar(0.5),la=E($,ba,P,Z),D(x,K,S,aa,Y,V,0,0,1,0,0,1,la)):(T.copy(oa),p(h.centroidModel,h.normalModel,T),T.multiply(ca).add(da),!0===k.wireframe?z(T,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):A(T)):!0===k.wireframe?z(k.color,k.wireframeLinewidth,k.wireframeLinecap,
|
|
|
+k.wireframeLinejoin):A(k.color)):k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial?null!==k.map?k.map.mapping instanceof THREE.UVMapping&&(ya=h.uvs[0],B(x,K,S,aa,Y,V,ya[f].x,ya[f].y,ya[g].x,ya[g].y,ya[i].x,ya[i].y,k.map)):null!==k.envMap?k.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ga.copy(h.vertexNormalsModelView[f]),Ga=0.5*ga.x+0.5,Ja=0.5*ga.y+0.5,ga.copy(h.vertexNormalsModelView[g]),La=0.5*ga.x+0.5,Ma=0.5*ga.y+0.5,
|
|
|
+ga.copy(h.vertexNormalsModelView[i]),Na=0.5*ga.x+0.5,Oa=0.5*ga.y+0.5,B(x,K,S,aa,Y,V,Ga,Ja,La,Ma,Na,Oa,k.envMap)):(T.copy(k.color),k.vertexColors===THREE.FaceColors&&T.multiply(h.color),!0===k.wireframe?z(T,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):A(T)):k instanceof THREE.MeshDepthMaterial?(ea=l.near,sa=l.far,g=1-H(a.positionScreen.z*a.positionScreen.w,ea,sa),$.setRGB(g,g,g),g=1-H(d.positionScreen.z*d.positionScreen.w,ea,sa),ba.setRGB(g,g,g),g=1-H(e.positionScreen.z*e.positionScreen.w,
|
|
|
+ea,sa),P.setRGB(g,g,g),Z.addColors(ba,P).multiplyScalar(0.5),la=E($,ba,P,Z),D(x,K,S,aa,Y,V,0,0,1,0,0,1,la)):k instanceof THREE.MeshNormalMaterial&&(k.shading==THREE.FlatShading?(d=h.normalModelView,T.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===k.wireframe?z(T,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):A(T)):k.shading==THREE.SmoothShading&&(d=h.vertexNormalsModelView[f],$.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[g],ba.setRGB(d.x,
|
|
|
+d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=h.vertexNormalsModelView[i],P.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),Z.addColors(ba,P).multiplyScalar(0.5),la=E($,ba,P,Z),D(x,K,S,aa,Y,V,0,0,1,0,0,1,la)))}function r(a,b,c,d,e,f){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.closePath()}function u(a,b,c,d,e,f,g,i){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.lineTo(g,i);y.closePath()}function z(a,b,c,i){d(b);e(c);f(i);g(a.getStyle());y.stroke();ma.expandByScalar(2*
|
|
|
+b)}function A(a){h(a.getStyle());y.fill()}function B(a,b,c,d,e,f,g,i,j,k,l,P,m){if(!(m instanceof THREE.DataTexture||void 0===m.image||0==m.image.width)){if(!0===m.needsUpdate){var n=m.wrapS==THREE.RepeatWrapping,p=m.wrapT==THREE.RepeatWrapping;pa[m.id]=y.createPattern(m.image,!0===n&&!0===p?"repeat":!0===n&&!1===p?"repeat-x":!1===n&&!0===p?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===pa[m.id]?h("rgba(0,0,0,1)"):h(pa[m.id]);var n=m.offset.x/m.repeat.x,p=m.offset.y/m.repeat.y,s=m.image.width*
|
|
|
+m.repeat.x,L=m.image.height*m.repeat.y,g=(g+n)*s,i=(1-i+p)*L,c=c-a,d=d-b,e=e-a,f=f-b,j=(j+n)*s-g,k=(1-k+p)*L-i,l=(l+n)*s-g,P=(1-P+p)*L-i,n=j*P-l*k;0===n?(void 0===Aa[m.id]&&(b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),Aa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=Aa[m.id],g=4*(Math.floor(g)+Math.floor(i)*m.image.width),T.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),A(T)):(n=1/n,m=(P*c-k*e)*n,k=(P*d-k*
|
|
|
+f)*n,c=(j*e-l*c)*n,d=(j*f-l*d)*n,a=a-m*g-c*i,g=b-k*g-d*i,y.save(),y.transform(m,k,c,d,a,g),y.fill(),y.restore())}}function D(a,b,c,d,e,f,g,i,h,j,k,l,P){var m,n;m=P.width-1;n=P.height-1;g*=m;i*=n;c-=a;d-=b;e-=a;f-=b;h=h*m-g;j=j*n-i;k=k*m-g;l=l*n-i;n=1/(h*l-k*j);m=(l*c-j*e)*n;j=(l*d-j*f)*n;c=(h*e-k*c)*n;d=(h*f-k*d)*n;a=a-m*g-c*i;b=b-j*g-d*i;y.save();y.transform(m,j,c,d,a,b);y.clip();y.drawImage(P,0,0);y.restore()}function E(a,b,c,d){na[0]=255*a.r|0;na[1]=255*a.g|0;na[2]=255*a.b|0;na[4]=255*b.r|0;na[5]=
|
|
|
+255*b.g|0;na[6]=255*b.b|0;na[8]=255*c.r|0;na[9]=255*c.g|0;na[10]=255*c.b|0;na[12]=255*d.r|0;na[13]=255*d.g|0;na[14]=255*d.b|0;Da.putImageData(Fa,0,0);ha.drawImage(xa,0,0);return za}function H(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function F(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===l instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();
|
|
|
+y.setTransform(1,0,0,-1,w,v);j.info.render.vertices=0;j.info.render.faces=0;k=s.projectScene(a,l,this.sortObjects,this.sortElements);n=k.elements;m=k.lights;Ba=0<m.length;if(!0===Ba){oa.setRGB(0,0,0);Ea.setRGB(0,0,0);Ca.setRGB(0,0,0);for(var N=0,Q=m.length;N<Q;N++){var R=m[N],W=R.color;R instanceof THREE.AmbientLight?oa.add(W):R instanceof THREE.DirectionalLight?Ea.add(W):R instanceof THREE.PointLight&&Ca.add(W)}}N=0;for(Q=n.length;N<Q;N++){var O=n[N],R=O.material;if(!(void 0===R||!1===R.visible)){ma.makeEmpty();
|
|
|
+if(O instanceof THREE.RenderableParticle){C=O;C.x*=w;C.y*=v;var W=C,ja=O;b(R.opacity);c(R.blending);var ta=void 0,ua=void 0,va=void 0,wa=void 0,Ia=O=void 0,Ka=void 0;R instanceof THREE.ParticleBasicMaterial?null===R.map?(va=ja.object.scale.x,wa=ja.object.scale.y,va*=ja.scale.x*w,wa*=ja.scale.y*v,ma.min.set(W.x-va,W.y-wa),ma.max.set(W.x+va,W.y+wa),!1!==Ha.isIntersectionBox(ma)&&(h(R.color.getStyle()),y.save(),y.translate(W.x,W.y),y.rotate(-ja.rotation),y.scale(va,wa),y.fillRect(-1,-1,2,2),y.restore())):
|
|
|
+(O=R.map.image,Ia=O.width>>1,Ka=O.height>>1,va=ja.scale.x*w,wa=ja.scale.y*v,ta=va*Ia,ua=wa*Ka,ma.min.set(W.x-ta,W.y-ua),ma.max.set(W.x+ta,W.y+ua),!1!==Ha.isIntersectionBox(ma)&&(y.save(),y.translate(W.x,W.y),y.rotate(-ja.rotation),y.scale(va,-wa),y.translate(-Ia,-Ka),y.drawImage(O,0,0),y.restore())):R instanceof THREE.ParticleCanvasMaterial&&(ta=ja.scale.x*w,ua=ja.scale.y*v,ma.min.set(W.x-ta,W.y-ua),ma.max.set(W.x+ta,W.y+ua),!1!==Ha.isIntersectionBox(ma)&&(g(R.color.getStyle()),h(R.color.getStyle()),
|
|
|
+y.save(),y.translate(W.x,W.y),y.rotate(-ja.rotation),y.scale(ta,ua),R.program(y),y.restore()))}else if(O instanceof THREE.RenderableLine)C=O.v1,G=O.v2,C.positionScreen.x*=w,C.positionScreen.y*=v,G.positionScreen.x*=w,G.positionScreen.y*=v,ma.setFromPoints([C.positionScreen,G.positionScreen]),!0===Ha.isIntersectionBox(ma)&&(W=C,ja=G,b(R.opacity),c(R.blending),y.beginPath(),y.moveTo(W.positionScreen.x,W.positionScreen.y),y.lineTo(ja.positionScreen.x,ja.positionScreen.y),R instanceof THREE.LineBasicMaterial?
|
|
|
+(d(R.linewidth),e(R.linecap),f(R.linejoin),g(R.color.getStyle()),i(null,null),y.stroke(),ma.expandByScalar(2*R.linewidth)):R instanceof THREE.LineDashedMaterial&&(d(R.linewidth),e(R.linecap),f(R.linejoin),g(R.color.getStyle()),i(R.dashSize,R.gapSize),y.stroke(),ma.expandByScalar(2*R.linewidth)));else if(O instanceof THREE.RenderableFace3){C=O.v1;G=O.v2;t=O.v3;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;if(-1>t.positionScreen.z||1<
|
|
|
+t.positionScreen.z)continue;C.positionScreen.x*=w;C.positionScreen.y*=v;G.positionScreen.x*=w;G.positionScreen.y*=v;t.positionScreen.x*=w;t.positionScreen.y*=v;!0===R.overdraw&&(F(C.positionScreen,G.positionScreen),F(G.positionScreen,t.positionScreen),F(t.positionScreen,C.positionScreen));ma.setFromPoints([C.positionScreen,G.positionScreen,t.positionScreen]);q(C,G,t,0,1,2,O,R,a)}else if(O instanceof THREE.RenderableFace4){C=O.v1;G=O.v2;t=O.v3;I=O.v4;if(-1>C.positionScreen.z||1<C.positionScreen.z)continue;
|
|
|
+if(-1>G.positionScreen.z||1<G.positionScreen.z)continue;if(-1>t.positionScreen.z||1<t.positionScreen.z)continue;if(-1>I.positionScreen.z||1<I.positionScreen.z)continue;C.positionScreen.x*=w;C.positionScreen.y*=v;G.positionScreen.x*=w;G.positionScreen.y*=v;t.positionScreen.x*=w;t.positionScreen.y*=v;I.positionScreen.x*=w;I.positionScreen.y*=v;M.positionScreen.copy(G.positionScreen);J.positionScreen.copy(I.positionScreen);!0===R.overdraw&&(F(C.positionScreen,G.positionScreen),F(G.positionScreen,I.positionScreen),
|
|
|
+F(I.positionScreen,C.positionScreen),F(t.positionScreen,M.positionScreen),F(t.positionScreen,J.positionScreen));ma.setFromPoints([C.positionScreen,G.positionScreen,t.positionScreen,I.positionScreen]);W=C;ja=G;ta=t;ua=I;va=M;wa=J;Ia=a;j.info.render.vertices+=4;j.info.render.faces++;b(R.opacity);c(R.blending);void 0!==R.map&&null!==R.map||void 0!==R.envMap&&null!==R.envMap?(q(W,ja,ua,0,1,3,O,R,Ia),q(va,ta,wa,1,2,3,O,R,Ia)):(x=W.positionScreen.x,K=W.positionScreen.y,S=ja.positionScreen.x,aa=ja.positionScreen.y,
|
|
|
+Y=ta.positionScreen.x,V=ta.positionScreen.y,L=ua.positionScreen.x,ka=ua.positionScreen.y,qa=va.positionScreen.x,ra=va.positionScreen.y,X=wa.positionScreen.x,U=wa.positionScreen.y,R instanceof THREE.MeshLambertMaterial||R instanceof THREE.MeshPhongMaterial?(ca.copy(R.color),da.copy(R.emissive),R.vertexColors===THREE.FaceColors&&ca.multiply(O.color),!0===Ba?!1===R.wireframe&&R.shading==THREE.SmoothShading&&4==O.vertexNormalsLength?($.copy(oa),ba.copy(oa),P.copy(oa),Z.copy(oa),p(O.v1.positionWorld,O.vertexNormalsModel[0],
|
|
|
+$),p(O.v2.positionWorld,O.vertexNormalsModel[1],ba),p(O.v4.positionWorld,O.vertexNormalsModel[3],P),p(O.v3.positionWorld,O.vertexNormalsModel[2],Z),$.multiply(ca).add(da),ba.multiply(ca).add(da),P.multiply(ca).add(da),Z.multiply(ca).add(da),la=E($,ba,P,Z),r(x,K,S,aa,L,ka),D(x,K,S,aa,L,ka,0,0,1,0,0,1,la),r(qa,ra,Y,V,X,U),D(qa,ra,Y,V,X,U,1,0,1,1,0,1,la)):(T.copy(oa),p(O.centroidModel,O.normalModel,T),T.multiply(ca).add(da),u(x,K,S,aa,Y,V,L,ka),!0===R.wireframe?z(T,R.wireframeLinewidth,R.wireframeLinecap,
|
|
|
+R.wireframeLinejoin):A(T)):(T.addColors(ca,da),u(x,K,S,aa,Y,V,L,ka),!0===R.wireframe?z(T,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):A(T))):R instanceof THREE.MeshBasicMaterial?(T.copy(R.color),R.vertexColors===THREE.FaceColors&&T.multiply(O.color),u(x,K,S,aa,Y,V,L,ka),!0===R.wireframe?z(T,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):A(T)):R instanceof THREE.MeshNormalMaterial?(W=void 0,R.shading==THREE.FlatShading?(W=O.normalModelView,T.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
+u(x,K,S,aa,Y,V,L,ka),!0===R.wireframe?z(T,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):A(T)):R.shading==THREE.SmoothShading&&(W=O.vertexNormalsModelView[0],$.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),W=O.vertexNormalsModelView[1],ba.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),W=O.vertexNormalsModelView[3],P.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),W=O.vertexNormalsModelView[2],Z.setRGB(W.x,W.y,W.z).multiplyScalar(0.5).addScalar(0.5),la=E($,ba,
|
|
|
+P,Z),r(x,K,S,aa,L,ka),D(x,K,S,aa,L,ka,0,0,1,0,0,1,la),r(qa,ra,Y,V,X,U),D(qa,ra,Y,V,X,U,1,0,1,1,0,1,la))):R instanceof THREE.MeshDepthMaterial&&(ea=l.near,sa=l.far,$.r=$.g=$.b=1-H(W.positionScreen.z*W.positionScreen.w,ea,sa),ba.r=ba.g=ba.b=1-H(ja.positionScreen.z*ja.positionScreen.w,ea,sa),P.r=P.g=P.b=1-H(ua.positionScreen.z*ua.positionScreen.w,ea,sa),Z.r=Z.g=Z.b=1-H(ta.positionScreen.z*ta.positionScreen.w,ea,sa),la=E($,ba,P,Z),r(x,K,S,aa,L,ka),D(x,K,S,aa,L,ka,0,0,1,0,0,1,la),r(qa,ra,Y,V,X,U),D(qa,
|
|
|
+ra,Y,V,X,U,1,0,1,1,0,1,la)))}ia.union(ma)}}y.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -341,189 +341,193 @@ THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"v
|
|
|
THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
|
|
|
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
|
|
|
-depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a){if(a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer)}function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?
|
|
|
-g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,i=a.faces4,h=3*d.length+4*i.length,k=1*d.length+2*i.length,i=3*d.length+4*i.length,d=e(b,a),l=g(d),m=f(d),n=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*h);m&&(a.__normalArray=new Float32Array(3*h));c.hasTangents&&(a.__tangentArray=new Float32Array(4*h));n&&
|
|
|
-(a.__colorArray=new Float32Array(3*h));if(l){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*h);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*h)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*h),a.__skinWeightArray=new Float32Array(4*h));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*i);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(l=a.numMorphTargets;c<
|
|
|
-l;c++)a.__morphTargetsArrays.push(new Float32Array(3*h))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(l=a.numMorphNormals;c<l;c++)a.__morphNormalsArrays.push(new Float32Array(3*h))}a.__webglFaceCount=3*k;a.__webglLineCount=2*i;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in d.attributes){var k=d.attributes[p],c={},q;for(q in k)c[q]=k[q];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,i=1,"v2"===c.type?i=2:
|
|
|
-"v3"===c.type?i=3:"v4"===c.type?i=4:"c"===c.type&&(i=3),c.size=i,c.array=new Float32Array(h*i),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
|
|
|
-THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function 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,i=d.uv,h=d.color,d=d.tangent;a.elementsNeedUpdate&&
|
|
|
-void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.colorsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){Da[a]||(j.enableVertexAttribArray(a),Da[a]=!0)}function l(){for(var a in Da)Da[a]&&(j.disableVertexAttribArray(a),Da[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function m(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++)ma=
|
|
|
-lb=null,za=ca=sa=ha=Wa=ua=ka=-1,mb=!0,a[d].render(b,c,ob,Qa),ma=lb=null,za=ca=sa=ha=Wa=ua=ka=-1,mb=!0}function r(a,b,c,d,e,f,g,j){var i,h,k,l;b?(h=a.length-1,l=b=-1):(h=0,b=a.length,l=1);for(var m=h;m!==b;m+=l)if(i=a[m],i.render){h=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;g&&M.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);M.setDepthTest(i.depthTest);M.setDepthWrite(i.depthWrite);F(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}M.setMaterialFaces(i);k instanceof
|
|
|
-THREE.BufferGeometry?M.renderBufferDirect(d,e,f,i,k,h):M.renderBuffer(d,e,f,i,k,h)}}function p(a,b,c,d,e,f,g){for(var i,j,h=0,k=a.length;h<k;h++)if(i=a[h],j=i.object,j.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&M.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);M.setDepthTest(i.depthTest);M.setDepthWrite(i.depthWrite);F(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}M.renderImmediateObject(c,d,e,i,j)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
|
-function x(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function E(a,b,c,d,e){Z=0;d.needsUpdate&&(d.program&&da(d),M.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets));
|
|
|
-var f=!1,g=d.program,i=g.uniforms,h=d.uniforms;g!==lb&&(j.useProgram(g),lb=g,f=!0);d.id!==za&&(za=d.id,f=!0);if(f||a!==ma)j.uniformMatrix4fv(i.projectionMatrix,!1,a.projectionMatrix.elements),a!==ma&&(ma=a);if(d.skinning)if(xc&&e.useVertexTexture){if(null!==i.boneTexture){var k=J();j.uniform1i(i.boneTexture,k);M.setTexture(e.boneTexture,k)}}else null!==i.boneGlobalMatrices&&j.uniformMatrix4fv(i.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(h.fogColor.value=c.color,c instanceof THREE.Fog?
|
|
|
-(h.fogNear.value=c.near,h.fogFar.value=c.far):c instanceof THREE.FogExp2&&(h.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(mb){for(var l,m=k=0,n=0,p,q,s,r=Ab,t=r.directional.colors,v=r.directional.positions,x=r.point.colors,w=r.point.positions,B=r.point.distances,C=r.spot.colors,A=r.spot.positions,E=r.spot.distances,F=r.spot.directions,I=r.spot.anglesCos,K=r.spot.exponents,H=r.hemi.skyColors,N=r.hemi.groundColors,ca=r.hemi.positions,
|
|
|
-V=0,Y=0,na=0,ba=0,Na=0,ha=0,ja=0,ka=0,O=l=0,c=s=O=0,f=b.length;c<f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,s=l.distance,l instanceof THREE.AmbientLight?l.visible&&(M.gammaInput?(k+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(k+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(Na+=1,l.visible&&(ia.getPositionFromMatrix(l.matrixWorld),Ra.getPositionFromMatrix(l.target.matrixWorld),ia.sub(Ra),ia.normalize(),0===ia.x&&0===ia.y&&0===ia.z||(l=3*V,v[l]=ia.x,v[l+1]=ia.y,v[l+2]=ia.z,M.gammaInput?z(t,
|
|
|
-l,p,q*q):G(t,l,p,q),V+=1))):l instanceof THREE.PointLight?(ha+=1,l.visible&&(O=3*Y,M.gammaInput?z(x,O,p,q*q):G(x,O,p,q),Ra.getPositionFromMatrix(l.matrixWorld),w[O]=Ra.x,w[O+1]=Ra.y,w[O+2]=Ra.z,B[Y]=s,Y+=1)):l instanceof THREE.SpotLight?(ja+=1,l.visible&&(O=3*na,M.gammaInput?z(C,O,p,q*q):G(C,O,p,q),Ra.getPositionFromMatrix(l.matrixWorld),A[O]=Ra.x,A[O+1]=Ra.y,A[O+2]=Ra.z,E[na]=s,ia.copy(Ra),Ra.getPositionFromMatrix(l.target.matrixWorld),ia.sub(Ra),ia.normalize(),F[O]=ia.x,F[O+1]=ia.y,F[O+2]=ia.z,
|
|
|
-I[na]=Math.cos(l.angle),K[na]=l.exponent,na+=1)):l instanceof THREE.HemisphereLight&&(ka+=1,l.visible&&(ia.getPositionFromMatrix(l.matrixWorld),ia.normalize(),0===ia.x&&0===ia.y&&0===ia.z||(s=3*ba,ca[s]=ia.x,ca[s+1]=ia.y,ca[s+2]=ia.z,p=l.color,l=l.groundColor,M.gammaInput?(q*=q,z(H,s,p,q),z(N,s,l,q)):(G(H,s,p,q),G(N,s,l,q)),ba+=1))));c=3*V;for(f=Math.max(t.length,3*Na);c<f;c++)t[c]=0;c=3*Y;for(f=Math.max(x.length,3*ha);c<f;c++)x[c]=0;c=3*na;for(f=Math.max(C.length,3*ja);c<f;c++)C[c]=0;c=3*ba;for(f=
|
|
|
-Math.max(H.length,3*ka);c<f;c++)H[c]=0;c=3*ba;for(f=Math.max(N.length,3*ka);c<f;c++)N[c]=0;r.directional.length=V;r.point.length=Y;r.spot.length=na;r.hemi.length=ba;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=n;mb=!1}c=Ab;h.ambientLightColor.value=c.ambient;h.directionalLightColor.value=c.directional.colors;h.directionalLightDirection.value=c.directional.positions;h.pointLightColor.value=c.point.colors;h.pointLightPosition.value=c.point.positions;h.pointLightDistance.value=c.point.distances;h.spotLightColor.value=
|
|
|
-c.spot.colors;h.spotLightPosition.value=c.spot.positions;h.spotLightDistance.value=c.spot.distances;h.spotLightDirection.value=c.spot.directions;h.spotLightAngleCos.value=c.spot.anglesCos;h.spotLightExponent.value=c.spot.exponents;h.hemisphereLightSkyColor.value=c.hemi.skyColors;h.hemisphereLightGroundColor.value=c.hemi.groundColors;h.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){h.opacity.value=
|
|
|
-d.opacity;M.gammaInput?h.diffuse.value.copyGammaToLinear(d.color):h.diffuse.value=d.color;h.map.value=d.map;h.lightMap.value=d.lightMap;h.specularMap.value=d.specularMap;d.bumpMap&&(h.bumpMap.value=d.bumpMap,h.bumpScale.value=d.bumpScale);d.normalMap&&(h.normalMap.value=d.normalMap,h.normalScale.value.copy(d.normalScale));var X;d.map?X=d.map:d.specularMap?X=d.specularMap:d.normalMap?X=d.normalMap:d.bumpMap&&(X=d.bumpMap);void 0!==X&&(c=X.offset,X=X.repeat,h.offsetRepeat.value.set(c.x,c.y,X.x,X.y));
|
|
|
-h.envMap.value=d.envMap;h.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;h.reflectivity.value=d.reflectivity;h.refractionRatio.value=d.refractionRatio;h.combine.value=d.combine;h.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity,h.dashSize.value=d.dashSize,h.totalSize.value=
|
|
|
-d.dashSize+d.gapSize,h.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(h.psColor.value=d.color,h.opacity.value=d.opacity,h.size.value=d.size,h.scale.value=W.height/2,h.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(h.shininess.value=d.shininess,M.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive),h.specular.value.copyGammaToLinear(d.specular)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive,h.specular.value=d.specular),
|
|
|
-d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(M.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(h.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&
|
|
|
-h.shadowMatrix){c=X=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))h.shadowMap.value[X]=k.shadowMap,h.shadowMapSize.value[X]=k.shadowMapSize,h.shadowMatrix.value[X]=k.shadowMatrix,h.shadowDarkness.value[X]=k.shadowDarkness,h.shadowBias.value[X]=k.shadowBias,X++}b=d.uniformsList;h=0;for(X=b.length;h<X;h++)if(f=g.uniforms[b[h][1]])if(c=b[h][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,
|
|
|
-k);else if("v2"===m)j.uniform2f(f,k.x,k.y);else if("v3"===m)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===m)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===m)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===m)j.uniform1iv(f,k);else if("iv"===m)j.uniform3iv(f,k);else if("fv1"===m)j.uniform1fv(f,k);else if("fv"===m)j.uniform3fv(f,k);else if("v2v"===m){void 0===c._array&&(c._array=new Float32Array(2*k.length));m=0;for(n=k.length;m<n;m++)r=2*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y;j.uniform2fv(f,c._array)}else if("v3v"===
|
|
|
-m){void 0===c._array&&(c._array=new Float32Array(3*k.length));m=0;for(n=k.length;m<n;m++)r=3*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z;j.uniform3fv(f,c._array)}else if("v4v"===m){void 0===c._array&&(c._array=new Float32Array(4*k.length));m=0;for(n=k.length;m<n;m++)r=4*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z,c._array[r+3]=k[m].w;j.uniform4fv(f,c._array)}else if("m4"===m)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,
|
|
|
-!1,c._array);else if("m4v"===m){void 0===c._array&&(c._array=new Float32Array(16*k.length));m=0;for(n=k.length;m<n;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=J(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),M.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
-c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(m=0;6>m;m++)M.autoScaleCubemaps&&!f?(n=k,r=m,t=c.image[m],x=gd,t.width<=x&&t.height<=x||(w=Math.max(t.width,t.height),v=Math.floor(t.width*x/w),x=Math.floor(t.height*x/w),w=document.createElement("canvas"),w.width=v,w.height=x,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,x),t=w),n[r]=t):k[m]=c.image[m];m=k[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=L(c.format);
|
|
|
-t=L(c.type);T(j.TEXTURE_CUBE_MAP,c,n);for(m=0;6>m;m++)if(f){x=k[m].mipmaps;w=0;for(B=x.length;w<B;w++)v=x[w],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?
|
|
|
-(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):M.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=J();j.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)r=c.value[m],k=c._array[m],r&&M.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)Ra.getPositionFromMatrix(a.matrixWorld),j.uniform3f(i.cameraPosition,Ra.x,Ra.y,
|
|
|
-Ra.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&j.uniformMatrix4fv(i.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(i.modelViewMatrix,!1,e._modelViewMatrix.elements);i.normalMatrix&&j.uniformMatrix3fv(i.normalMatrix,!1,e._normalMatrix.elements);null!==i.modelMatrix&&j.uniformMatrix4fv(i.modelMatrix,!1,e.matrixWorld.elements);return g}function J(){var a=Z;a>=Mc&&console.warn("WebGLRenderer: trying to use "+
|
|
|
-a+" texture units while this GPU supports only "+Mc);Z+=1;return a}function A(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(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 I(a){a!==yb&&(j.lineWidth(a),yb=a)}function F(a,b,c){Ta!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ta=a);if(a&&
|
|
|
-(Ua!==b||nb!==c))j.polygonOffset(b,c),Ua=b,nb=c}function V(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(V(b)),null):c}function T(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(eb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,eb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Cc)),b.__oldAnisotropy=
|
|
|
-b.anisotropy}function C(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!==Xa){if(a===THREE.RGB_S3TC_DXT1_Format)return Xa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Xa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Xa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Xa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},W=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
-X=void 0!==a.precision?a.precision:"highp",qa=void 0!==a.alpha?a.alpha:!0,ga=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,H=void 0!==a.antialias?a.antialias:!1,ba=void 0!==a.stencil?a.stencil:!0,Ca=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ja=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),oa=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=W;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?
|
|
|
-window.devicePixelRatio:1;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=
|
|
|
-[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var M=this,Na=[],wb=0,lb=null,xb=null,za=-1,ca=null,ma=null,na=0,Z=0,ha=-1,sa=-1,ka=-1,Ia=-1,db=-1,$a=-1,ua=-1,Wa=-1,Ta=null,Ua=null,nb=null,yb=null,Kb=0,gc=0,Bb=0,Cb=0,ob=0,Qa=0,Da={},zb=new THREE.Frustum,pb=new THREE.Matrix4,wc=new THREE.Matrix4,Ra=new THREE.Vector3,ia=new THREE.Vector3,mb=!0,Ab={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
-colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Oa,ub,eb,Xa;try{if(!(j=W.getContext("experimental-webgl",{alpha:qa,premultipliedAlpha:ga,antialias:H,stencil:ba,preserveDrawingBuffer:Ca})))throw"Error creating WebGL context.";}catch(ed){console.error(ed)}Oa=j.getExtension("OES_texture_float");ub=j.getExtension("OES_standard_derivatives");eb=j.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
-j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Xa=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Oa||console.log("THREE.WebGLRenderer: Float textures not supported.");ub||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");eb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
-Xa||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(ja.r,ja.g,ja.b,oa);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=eb?j.getParameter(eb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,rc=0<fd,xc=rc&&Oa;Xa&&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 id=
|
|
|
-j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),hd=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 ld=0<jd.precision&&0<id.precision,Nc=0<kd.precision&&0<hd.precision;"highp"===X&&!ld&&(Nc?(X="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(X="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===X&&!Nc&&(X="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return rc};this.supportsFloatTextures=function(){return Oa};
|
|
|
-this.supportsStandardDerivatives=function(){return ub};this.supportsCompressedTextureS3TC=function(){return Xa};this.getMaxAnisotropy=function(){return Cc};this.getPrecision=function(){return X};this.setSize=function(a,b){W.width=a*this.devicePixelRatio;W.height=b*this.devicePixelRatio;W.style.width=a+"px";W.style.height=b+"px";this.setViewport(0,0,W.width,W.height)};this.setViewport=function(a,b,c,d){Kb=void 0!==a?a:0;gc=void 0!==b?b:0;Bb=void 0!==c?c:W.width;Cb=void 0!==d?d:W.height;j.viewport(Kb,
|
|
|
-gc,Bb,Cb)};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){ja.setHex(a);oa=b;j.clearColor(ja.r,ja.g,ja.b,oa)};this.setClearColor=function(a,b){ja.copy(a);oa=b;j.clearColor(ja.r,ja.g,ja.b,oa)};this.getClearColor=function(){return ja};this.getClearAlpha=function(){return oa};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){lb=null;za=ca=Wa=ua=ka=-1;mb=!0;sa=ha=-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&&
|
|
|
-j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);
|
|
|
-void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);
|
|
|
-M.info.memory.geometries--},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));M.info.memory.textures--},N=function(a){a=a.target;a.removeEventListener("dispose",N);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
-else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);M.info.memory.textures--},Y=function(a){a=a.target;a.removeEventListener("dispose",Y);da(a)},da=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);M.info.memory.programs--}}};this.renderBufferImmediate=
|
|
|
-function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,
|
|
|
-3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,m,l,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],m=n[p+5],h=n[p+6],k=n[p+7],l=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+m+l)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
|
|
|
-3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,
|
|
|
-0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=E(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0),c!==ca&&(ca=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 h=f[c].index;if(b){var i=e.attributes.position,m=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,4*h*m);m=e.attributes.normal;if(0<=
|
|
|
-a.normal&&m){var n=m.itemSize;j.bindBuffer(j.ARRAY_BUFFER,m.buffer);k(a.normal);j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,4*h*n)}m=e.attributes.uv;0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,4*h*n));m=e.attributes.color;0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,4*h*n));m=e.attributes.tangent;0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*h*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,d.buffer)}j.drawElements(j.TRIANGLES,f[c].count,j.UNSIGNED_SHORT,2*f[c].start);M.info.render.calls++;M.info.render.vertices+=f[c].count;M.info.render.faces+=f[c].count/3}}else b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.normal,0<=a.normal&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-m.buffer),k(a.normal),j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,0)),m=e.attributes.uv,0<=a.uv&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,0)),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),m=e.attributes.tangent,0<=a.tangent&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,
|
|
|
-!1,0,0))),j.drawArrays(j.TRIANGLES,0,i.numItems/3),M.info.render.calls++,M.info.render.vertices+=i.numItems/3,M.info.render.faces+=i.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,
|
|
|
-i.numItems/3),M.info.render.calls++,M.info.render.points+=i.numItems/3):f instanceof THREE.Line&&b&&(i=e.attributes.position,m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,m,j.FLOAT,!1,0,0),m=e.attributes.color,0<=a.color&&m&&(n=m.itemSize,j.bindBuffer(j.ARRAY_BUFFER,m.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),I(d.linewidth),j.drawArrays(j.LINE_STRIP,0,i.numItems/3),M.info.render.calls++,M.info.render.points+=i.numItems)};
|
|
|
-this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=E(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ca&&(ca=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 i=0;h=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=
|
|
|
-c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;var n,p=g.length;for(n=0;n<p;n++)i=g[n],0<i&&h.push([i,n]);h.length>d.numSupportedMorphTargets?(h.sort(m),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(m):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?
|
|
|
-(n=h[i][1],0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[n]):f.__webglMorphTargetInfluences[i]=0,i++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
|
|
|
-f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),k(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-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?(I(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)),M.info.render.calls++,M.info.render.vertices+=e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,I(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),M.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),
|
|
|
-M.info.render.calls++,M.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,k=a.fog;za=-1;mb=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
-pb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);zb.setFromMatrix(pb);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;M.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof
|
|
|
-THREE.ParticleSystem)||!g.frustumCulled||zb.intersectsObject(g))){A(g,b);var m=f,l=m.buffer,q=void 0,t=q=void 0,t=m.object.material;if(t instanceof THREE.MeshFaceMaterial)q=l.materialIndex,q=t.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);else if(q=t)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Ra.getPositionFromMatrix(g.matrixWorld),Ra.applyProjection(pb),
|
|
|
-f.z=Ra.z),f.id=g.id)}this.sortObjects&&h.sort(n);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(A(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),F(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,
|
|
|
-i,k,!0,d),p(a.__webglObjectsImmediate,"",b,i,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),r(a.__webglObjects,!0,"opaque",b,i,k,!1,d),p(a.__webglObjectsImmediate,"opaque",b,i,k,!1,d),r(a.__webglObjects,!1,"transparent",b,i,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,i,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),
|
|
|
-j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=E(a,b,c,d,e);ca=-1;M.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,zb):e.render(function(a){M.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=
|
|
|
-[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,n=void 0,l=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(l=b.geometry,p=b.material,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var s=
|
|
|
-l,z=void 0,C=void 0,B=void 0,A=void 0,E=void 0,F=void 0,G={},I=s.morphTargets.length,J=s.morphNormals.length,K=p instanceof THREE.MeshFaceMaterial;s.geometryGroups={};z=0;for(C=s.faces.length;z<C;z++)B=s.faces[z],A=K?B.materialIndex:0,void 0===G[A]&&(G[A]={hash:A,counter:0}),F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:I,numMorphNormals:J}),E=B instanceof THREE.Face3?3:4,65535<s.geometryGroups[F].vertices+
|
|
|
-E&&(G[A].counter+=1,F=G[A].hash+"_"+G[A].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:I,numMorphNormals:J})),B instanceof THREE.Face3?s.geometryGroups[F].faces3.push(z):s.geometryGroups[F].faces4.push(z),s.geometryGroups[F].vertices+=E;s.geometryGroupsList=[];var L=void 0;for(L in s.geometryGroups)s.geometryGroups[L].id=na++,s.geometryGroupsList.push(s.geometryGroups[L])}for(n in l.geometryGroups)if(r=l.geometryGroups[n],
|
|
|
-!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 N=void 0,ca=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];N=0;
|
|
|
-for(ca=H.numMorphTargets;N<ca;N++)H.__webglMorphTargetsBuffers.push(j.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];N=0;for(ca=H.numMorphNormals;N<ca;N++)H.__webglMorphNormalsBuffers.push(j.createBuffer())}M.info.memory.geometries++;d(r,b);l.verticesNeedUpdate=!0;l.morphTargetsNeedUpdate=!0;l.elementsNeedUpdate=!0;l.uvsNeedUpdate=!0;l.normalsNeedUpdate=!0;l.tangentsNeedUpdate=!0;l.colorsNeedUpdate=!0}}else l instanceof THREE.BufferGeometry&&h(l);else if(b instanceof THREE.Ribbon){if(l=
|
|
|
-b.geometry,!l.__webglVertexBuffer){var T=l;T.__webglVertexBuffer=j.createBuffer();T.__webglColorBuffer=j.createBuffer();T.__webglNormalBuffer=j.createBuffer();M.info.memory.geometries++;var V=l,W=b,Z=V.vertices.length;V.__vertexArray=new Float32Array(3*Z);V.__colorArray=new Float32Array(3*Z);V.__normalArray=new Float32Array(3*Z);V.__webglVertexCount=Z;c(V,W);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(l=b.geometry,!l.__webglVertexBuffer)if(l instanceof
|
|
|
-THREE.Geometry){var Y=l;Y.__webglVertexBuffer=j.createBuffer();Y.__webglColorBuffer=j.createBuffer();Y.__webglLineDistanceBuffer=j.createBuffer();M.info.memory.geometries++;var X=l,ma=b,ba=X.vertices.length;X.__vertexArray=new Float32Array(3*ba);X.__colorArray=new Float32Array(3*ba);X.__lineDistanceArray=new Float32Array(1*ba);X.__webglLineCount=ba;c(X,ma);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0;l.lineDistancesNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l)}else if(b instanceof THREE.ParticleSystem&&
|
|
|
-(l=b.geometry,!l.__webglVertexBuffer))if(l instanceof THREE.Geometry){var Na=l;Na.__webglVertexBuffer=j.createBuffer();Na.__webglColorBuffer=j.createBuffer();M.info.memory.geometries++;var ha=l,ja=b,ka=ha.vertices.length;ha.__vertexArray=new Float32Array(3*ka);ha.__colorArray=new Float32Array(3*ka);ha.__sortArray=[];ha.__webglParticleCount=ka;c(ha,ja);l.verticesNeedUpdate=!0;l.colorsNeedUpdate=!0}else l instanceof THREE.BufferGeometry&&h(l);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(l=b.geometry,
|
|
|
-l instanceof THREE.BufferGeometry)q(k.__webglObjects,l,b);else{if(l instanceof THREE.Geometry)for(n in l.geometryGroups)r=l.geometryGroups[n],q(k.__webglObjects,r,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(l=b.geometry,q(k.__webglObjects,l,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?k.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?k.__webglSprites.push(b):b instanceof THREE.LensFlare&&
|
|
|
-k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var da=a.__objectsRemoved[0],oa=a;da instanceof THREE.Mesh||da instanceof THREE.ParticleSystem||da instanceof THREE.Ribbon||da instanceof THREE.Line?v(oa.__webglObjects,da):da instanceof THREE.Sprite?w(oa.__webglSprites,da):da instanceof THREE.LensFlare?w(oa.__webglFlares,da):(da instanceof THREE.ImmediateRenderObject||da.immediateRenderCallback)&&v(oa.__webglObjectsImmediate,da);da.__webglActive=
|
|
|
-!1;a.__objectsRemoved.splice(0,1)}for(var sa=0,ua=a.__webglObjects.length;sa<ua;sa++){var ia=a.__webglObjects[sa].object,O=ia.geometry,wb=void 0,za=void 0,ga=void 0;if(ia 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 lb=0,Ca=O.geometryGroupsList.length;lb<Ca;lb++)if(wb=O.geometryGroupsList[lb],ga=e(ia,wb),O.buffersNeedUpdate&&d(wb,ia),za=ga.attributes&&x(ga),O.verticesNeedUpdate||O.morphTargetsNeedUpdate||O.elementsNeedUpdate||O.uvsNeedUpdate||O.normalsNeedUpdate||O.colorsNeedUpdate||O.tangentsNeedUpdate||za){var ta=wb,Ia=ia,qa=j.DYNAMIC_DRAW,xb=!O.dynamic,Da=ga;if(ta.__inittedArrays){var Qa=f(Da),Ta=Da.vertexColors?Da.vertexColors:!1,db=g(Da),Wa=Qa===THREE.SmoothShading,D=void 0,U=void 0,Oa=void 0,
|
|
|
-P=void 0,Xa=void 0,$a=void 0,Ua=void 0,mb=void 0,eb=void 0,nb=void 0,ob=void 0,Q=void 0,R=void 0,S=void 0,ra=void 0,Nb=void 0,Ob=void 0,Pb=void 0,ub=void 0,Qb=void 0,Rb=void 0,Sb=void 0,yb=void 0,Tb=void 0,Ub=void 0,Vb=void 0,zb=void 0,Wb=void 0,Xb=void 0,Yb=void 0,Ab=void 0,Zb=void 0,$b=void 0,ac=void 0,Kb=void 0,ya=void 0,gc=void 0,mc=void 0,Bb=void 0,Cb=void 0,ab=void 0,xc=void 0,Ya=void 0,Za=void 0,nc=void 0,hc=void 0,Pa=0,Va=0,ic=0,jc=0,Gb=0,ib=0,Ea=0,kb=0,Sa=0,aa=0,la=0,y=0,Aa=void 0,bb=ta.__vertexArray,
|
|
|
-Dc=ta.__uvArray,Ec=ta.__uv2Array,Hb=ta.__normalArray,Ja=ta.__tangentArray,cb=ta.__colorArray,Ka=ta.__skinIndexArray,La=ta.__skinWeightArray,rc=ta.__morphTargetsArrays,nd=ta.__morphNormalsArrays,od=ta.__webglCustomAttributesList,u=void 0,bc=ta.__faceArray,vb=ta.__lineArray,qb=Ia.geometry,Mc=qb.elementsNeedUpdate,Cc=qb.uvsNeedUpdate,Nc=qb.normalsNeedUpdate,Oc=qb.tangentsNeedUpdate,ed=qb.colorsNeedUpdate,fd=qb.morphTargetsNeedUpdate,sc=qb.vertices,va=ta.faces3,wa=ta.faces4,jb=qb.faces,pd=qb.faceVertexUvs[0],
|
|
|
-qd=qb.faceVertexUvs[1],tc=qb.skinIndices,oc=qb.skinWeights,pc=qb.morphTargets,Pc=qb.morphNormals;if(qb.verticesNeedUpdate){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Q=sc[P.a],R=sc[P.b],S=sc[P.c],bb[Va]=Q.x,bb[Va+1]=Q.y,bb[Va+2]=Q.z,bb[Va+3]=R.x,bb[Va+4]=R.y,bb[Va+5]=R.z,bb[Va+6]=S.x,bb[Va+7]=S.y,bb[Va+8]=S.z,Va+=9;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=sc[P.a],R=sc[P.b],S=sc[P.c],ra=sc[P.d],bb[Va]=Q.x,bb[Va+1]=Q.y,bb[Va+2]=Q.z,bb[Va+3]=R.x,bb[Va+4]=R.y,bb[Va+5]=R.z,bb[Va+6]=S.x,bb[Va+7]=S.y,bb[Va+
|
|
|
-8]=S.z,bb[Va+9]=ra.x,bb[Va+10]=ra.y,bb[Va+11]=ra.z,Va+=12;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,bb,qa)}if(fd){ab=0;for(xc=pc.length;ab<xc;ab++){D=la=0;for(U=va.length;D<U;D++)nc=va[D],P=jb[nc],Q=pc[ab].vertices[P.a],R=pc[ab].vertices[P.b],S=pc[ab].vertices[P.c],Ya=rc[ab],Ya[la]=Q.x,Ya[la+1]=Q.y,Ya[la+2]=Q.z,Ya[la+3]=R.x,Ya[la+4]=R.y,Ya[la+5]=R.z,Ya[la+6]=S.x,Ya[la+7]=S.y,Ya[la+8]=S.z,Da.morphNormals&&(Wa?(hc=Pc[ab].vertexNormals[nc],Qb=hc.a,Rb=hc.b,Sb=hc.c):
|
|
|
-Sb=Rb=Qb=Pc[ab].faceNormals[nc],Za=nd[ab],Za[la]=Qb.x,Za[la+1]=Qb.y,Za[la+2]=Qb.z,Za[la+3]=Rb.x,Za[la+4]=Rb.y,Za[la+5]=Rb.z,Za[la+6]=Sb.x,Za[la+7]=Sb.y,Za[la+8]=Sb.z),la+=9;D=0;for(U=wa.length;D<U;D++)nc=wa[D],P=jb[nc],Q=pc[ab].vertices[P.a],R=pc[ab].vertices[P.b],S=pc[ab].vertices[P.c],ra=pc[ab].vertices[P.d],Ya=rc[ab],Ya[la]=Q.x,Ya[la+1]=Q.y,Ya[la+2]=Q.z,Ya[la+3]=R.x,Ya[la+4]=R.y,Ya[la+5]=R.z,Ya[la+6]=S.x,Ya[la+7]=S.y,Ya[la+8]=S.z,Ya[la+9]=ra.x,Ya[la+10]=ra.y,Ya[la+11]=ra.z,Da.morphNormals&&(Wa?
|
|
|
-(hc=Pc[ab].vertexNormals[nc],Qb=hc.a,Rb=hc.b,Sb=hc.c,yb=hc.d):yb=Sb=Rb=Qb=Pc[ab].faceNormals[nc],Za=nd[ab],Za[la]=Qb.x,Za[la+1]=Qb.y,Za[la+2]=Qb.z,Za[la+3]=Rb.x,Za[la+4]=Rb.y,Za[la+5]=Rb.z,Za[la+6]=Sb.x,Za[la+7]=Sb.y,Za[la+8]=Sb.z,Za[la+9]=yb.x,Za[la+10]=yb.y,Za[la+11]=yb.z),la+=12;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglMorphTargetsBuffers[ab]);j.bufferData(j.ARRAY_BUFFER,rc[ab],qa);Da.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglMorphNormalsBuffers[ab]),j.bufferData(j.ARRAY_BUFFER,nd[ab],
|
|
|
-qa))}}if(oc.length){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Wb=oc[P.a],Xb=oc[P.b],Yb=oc[P.c],La[aa]=Wb.x,La[aa+1]=Wb.y,La[aa+2]=Wb.z,La[aa+3]=Wb.w,La[aa+4]=Xb.x,La[aa+5]=Xb.y,La[aa+6]=Xb.z,La[aa+7]=Xb.w,La[aa+8]=Yb.x,La[aa+9]=Yb.y,La[aa+10]=Yb.z,La[aa+11]=Yb.w,Zb=tc[P.a],$b=tc[P.b],ac=tc[P.c],Ka[aa]=Zb.x,Ka[aa+1]=Zb.y,Ka[aa+2]=Zb.z,Ka[aa+3]=Zb.w,Ka[aa+4]=$b.x,Ka[aa+5]=$b.y,Ka[aa+6]=$b.z,Ka[aa+7]=$b.w,Ka[aa+8]=ac.x,Ka[aa+9]=ac.y,Ka[aa+10]=ac.z,Ka[aa+11]=ac.w,aa+=12;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],
|
|
|
-Wb=oc[P.a],Xb=oc[P.b],Yb=oc[P.c],Ab=oc[P.d],La[aa]=Wb.x,La[aa+1]=Wb.y,La[aa+2]=Wb.z,La[aa+3]=Wb.w,La[aa+4]=Xb.x,La[aa+5]=Xb.y,La[aa+6]=Xb.z,La[aa+7]=Xb.w,La[aa+8]=Yb.x,La[aa+9]=Yb.y,La[aa+10]=Yb.z,La[aa+11]=Yb.w,La[aa+12]=Ab.x,La[aa+13]=Ab.y,La[aa+14]=Ab.z,La[aa+15]=Ab.w,Zb=tc[P.a],$b=tc[P.b],ac=tc[P.c],Kb=tc[P.d],Ka[aa]=Zb.x,Ka[aa+1]=Zb.y,Ka[aa+2]=Zb.z,Ka[aa+3]=Zb.w,Ka[aa+4]=$b.x,Ka[aa+5]=$b.y,Ka[aa+6]=$b.z,Ka[aa+7]=$b.w,Ka[aa+8]=ac.x,Ka[aa+9]=ac.y,Ka[aa+10]=ac.z,Ka[aa+11]=ac.w,Ka[aa+12]=Kb.x,Ka[aa+
|
|
|
-13]=Kb.y,Ka[aa+14]=Kb.z,Ka[aa+15]=Kb.w,aa+=16;0<aa&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ka,qa),j.bindBuffer(j.ARRAY_BUFFER,ta.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,La,qa))}if(ed&&Ta){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Ua=P.vertexColors,mb=P.color,3===Ua.length&&Ta===THREE.VertexColors?(Tb=Ua[0],Ub=Ua[1],Vb=Ua[2]):Vb=Ub=Tb=mb,cb[Sa]=Tb.r,cb[Sa+1]=Tb.g,cb[Sa+2]=Tb.b,cb[Sa+3]=Ub.r,cb[Sa+4]=Ub.g,cb[Sa+5]=Ub.b,cb[Sa+6]=Vb.r,cb[Sa+7]=
|
|
|
-Vb.g,cb[Sa+8]=Vb.b,Sa+=9;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Ua=P.vertexColors,mb=P.color,4===Ua.length&&Ta===THREE.VertexColors?(Tb=Ua[0],Ub=Ua[1],Vb=Ua[2],zb=Ua[3]):zb=Vb=Ub=Tb=mb,cb[Sa]=Tb.r,cb[Sa+1]=Tb.g,cb[Sa+2]=Tb.b,cb[Sa+3]=Ub.r,cb[Sa+4]=Ub.g,cb[Sa+5]=Ub.b,cb[Sa+6]=Vb.r,cb[Sa+7]=Vb.g,cb[Sa+8]=Vb.b,cb[Sa+9]=zb.r,cb[Sa+10]=zb.g,cb[Sa+11]=zb.b,Sa+=12;0<Sa&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,cb,qa))}if(Oc&&qb.hasTangents){D=0;for(U=va.length;D<U;D++)P=
|
|
|
-jb[va[D]],eb=P.vertexTangents,Nb=eb[0],Ob=eb[1],Pb=eb[2],Ja[Ea]=Nb.x,Ja[Ea+1]=Nb.y,Ja[Ea+2]=Nb.z,Ja[Ea+3]=Nb.w,Ja[Ea+4]=Ob.x,Ja[Ea+5]=Ob.y,Ja[Ea+6]=Ob.z,Ja[Ea+7]=Ob.w,Ja[Ea+8]=Pb.x,Ja[Ea+9]=Pb.y,Ja[Ea+10]=Pb.z,Ja[Ea+11]=Pb.w,Ea+=12;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],eb=P.vertexTangents,Nb=eb[0],Ob=eb[1],Pb=eb[2],ub=eb[3],Ja[Ea]=Nb.x,Ja[Ea+1]=Nb.y,Ja[Ea+2]=Nb.z,Ja[Ea+3]=Nb.w,Ja[Ea+4]=Ob.x,Ja[Ea+5]=Ob.y,Ja[Ea+6]=Ob.z,Ja[Ea+7]=Ob.w,Ja[Ea+8]=Pb.x,Ja[Ea+9]=Pb.y,Ja[Ea+10]=Pb.z,Ja[Ea+11]=Pb.w,Ja[Ea+
|
|
|
-12]=ub.x,Ja[Ea+13]=ub.y,Ja[Ea+14]=ub.z,Ja[Ea+15]=ub.w,Ea+=16;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ja,qa)}if(Nc&&Qa){D=0;for(U=va.length;D<U;D++)if(P=jb[va[D]],Xa=P.vertexNormals,$a=P.normal,3===Xa.length&&Wa)for(ya=0;3>ya;ya++)mc=Xa[ya],Hb[ib]=mc.x,Hb[ib+1]=mc.y,Hb[ib+2]=mc.z,ib+=3;else for(ya=0;3>ya;ya++)Hb[ib]=$a.x,Hb[ib+1]=$a.y,Hb[ib+2]=$a.z,ib+=3;D=0;for(U=wa.length;D<U;D++)if(P=jb[wa[D]],Xa=P.vertexNormals,$a=P.normal,4===Xa.length&&Wa)for(ya=0;4>ya;ya++)mc=
|
|
|
-Xa[ya],Hb[ib]=mc.x,Hb[ib+1]=mc.y,Hb[ib+2]=mc.z,ib+=3;else for(ya=0;4>ya;ya++)Hb[ib]=$a.x,Hb[ib+1]=$a.y,Hb[ib+2]=$a.z,ib+=3;j.bindBuffer(j.ARRAY_BUFFER,ta.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Hb,qa)}if(Cc&&pd&&db){D=0;for(U=va.length;D<U;D++)if(Oa=va[D],nb=pd[Oa],void 0!==nb)for(ya=0;3>ya;ya++)Bb=nb[ya],Dc[ic]=Bb.x,Dc[ic+1]=Bb.y,ic+=2;D=0;for(U=wa.length;D<U;D++)if(Oa=wa[D],nb=pd[Oa],void 0!==nb)for(ya=0;4>ya;ya++)Bb=nb[ya],Dc[ic]=Bb.x,Dc[ic+1]=Bb.y,ic+=2;0<ic&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-ta.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Dc,qa))}if(Cc&&qd&&db){D=0;for(U=va.length;D<U;D++)if(Oa=va[D],ob=qd[Oa],void 0!==ob)for(ya=0;3>ya;ya++)Cb=ob[ya],Ec[jc]=Cb.x,Ec[jc+1]=Cb.y,jc+=2;D=0;for(U=wa.length;D<U;D++)if(Oa=wa[D],ob=qd[Oa],void 0!==ob)for(ya=0;4>ya;ya++)Cb=ob[ya],Ec[jc]=Cb.x,Ec[jc+1]=Cb.y,jc+=2;0<jc&&(j.bindBuffer(j.ARRAY_BUFFER,ta.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Ec,qa))}if(Mc){D=0;for(U=va.length;D<U;D++)bc[Gb]=Pa,bc[Gb+1]=Pa+1,bc[Gb+2]=Pa+2,Gb+=3,vb[kb]=Pa,vb[kb+
|
|
|
-1]=Pa+1,vb[kb+2]=Pa,vb[kb+3]=Pa+2,vb[kb+4]=Pa+1,vb[kb+5]=Pa+2,kb+=6,Pa+=3;D=0;for(U=wa.length;D<U;D++)bc[Gb]=Pa,bc[Gb+1]=Pa+1,bc[Gb+2]=Pa+3,bc[Gb+3]=Pa+1,bc[Gb+4]=Pa+2,bc[Gb+5]=Pa+3,Gb+=6,vb[kb]=Pa,vb[kb+1]=Pa+1,vb[kb+2]=Pa,vb[kb+3]=Pa+3,vb[kb+4]=Pa+1,vb[kb+5]=Pa+2,vb[kb+6]=Pa+2,vb[kb+7]=Pa+3,kb+=8,Pa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ta.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,bc,qa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ta.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-vb,qa)}if(od){ya=0;for(gc=od.length;ya<gc;ya++)if(u=od[ya],u.__original.needsUpdate){y=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],y+=3;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],u.array[y]=u.value[P.a],u.array[y+1]=u.value[P.b],u.array[y+2]=u.value[P.c],u.array[y+3]=u.value[P.d],y+=4}else{if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)Aa=u.value[va[D]],u.array[y]=
|
|
|
-Aa,u.array[y+1]=Aa,u.array[y+2]=Aa,y+=3;D=0;for(U=wa.length;D<U;D++)Aa=u.value[wa[D]],u.array[y]=Aa,u.array[y+1]=Aa,u.array[y+2]=Aa,u.array[y+3]=Aa,y+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],ra=u.value[P.d],
|
|
|
-u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=ra.x,u.array[y+7]=ra.y,y+=8}else{if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)S=R=Q=Aa=u.value[va[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(U=wa.length;D<U;D++)ra=S=R=Q=Aa=u.value[wa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=ra.x,u.array[y+
|
|
|
-7]=ra.y,y+=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(U=va.length;D<U;D++)P=jb[va[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],y+=9;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],ra=u.value[P.d],
|
|
|
-u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=ra[$[0]],u.array[y+10]=ra[$[1]],u.array[y+11]=ra[$[2]],y+=12}else if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)S=R=Q=Aa=u.value[va[D]],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],
|
|
|
-u.array[y+8]=S[$[2]],y+=9;D=0;for(U=wa.length;D<U;D++)ra=S=R=Q=Aa=u.value[wa[D]],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=ra[$[0]],u.array[y+10]=ra[$[1]],u.array[y+11]=ra[$[2]],y+=12}else if("faceVertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)Aa=u.value[va[D]],Q=Aa[0],R=Aa[1],S=Aa[2],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=
|
|
|
-Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],y+=9;D=0;for(U=wa.length;D<U;D++)Aa=u.value[wa[D]],Q=Aa[0],R=Aa[1],S=Aa[2],ra=Aa[3],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=ra[$[0]],u.array[y+10]=ra[$[1]],u.array[y+11]=ra[$[2]],y+=12}}else if(4===u.size)if(void 0===
|
|
|
-u.boundTo||"vertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)P=jb[va[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(U=wa.length;D<U;D++)P=jb[wa[D]],Q=u.value[P.a],R=u.value[P.b],S=u.value[P.c],ra=u.value[P.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+
|
|
|
-4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=ra.x,u.array[y+13]=ra.y,u.array[y+14]=ra.z,u.array[y+15]=ra.w,y+=16}else if("faces"===u.boundTo){D=0;for(U=va.length;D<U;D++)S=R=Q=Aa=u.value[va[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;
|
|
|
-D=0;for(U=wa.length;D<U;D++)ra=S=R=Q=Aa=u.value[wa[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=ra.x,u.array[y+13]=ra.y,u.array[y+14]=ra.z,u.array[y+15]=ra.w,y+=16}else if("faceVertices"===u.boundTo){D=0;for(U=va.length;D<U;D++)Aa=u.value[va[D]],Q=Aa[0],R=Aa[1],S=Aa[2],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+
|
|
|
-3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(U=wa.length;D<U;D++)Aa=u.value[wa[D]],Q=Aa[0],R=Aa[1],S=Aa[2],ra=Aa[3],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=ra.x,u.array[y+13]=ra.y,u.array[y+14]=ra.z,u.array[y+
|
|
|
-15]=ra.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,qa)}}xb&&(delete ta.__inittedArrays,delete ta.__colorArray,delete ta.__normalArray,delete ta.__tangentArray,delete ta.__uvArray,delete ta.__uv2Array,delete ta.__faceArray,delete ta.__vertexArray,delete ta.__lineArray,delete ta.__skinIndexArray,delete ta.__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;ga.attributes&&t(ga)}else if(ia instanceof THREE.Ribbon){ga=e(ia,O);za=ga.attributes&&x(ga);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.normalsNeedUpdate||za){var Ib=O,Qc=j.DYNAMIC_DRAW,Fc=void 0,Gc=void 0,Hc=void 0,Rc=void 0,Ba=void 0,Sc=void 0,Tc=void 0,Uc=void 0,xd=void 0,gb=void 0,zc=void 0,Ga=void 0,rb=void 0,yd=Ib.vertices,zd=Ib.colors,Ad=Ib.normals,gd=yd.length,hd=zd.length,id=Ad.length,Vc=Ib.__vertexArray,Wc=Ib.__colorArray,Xc=Ib.__normalArray,
|
|
|
-jd=Ib.colorsNeedUpdate,kd=Ib.normalsNeedUpdate,rd=Ib.__webglCustomAttributesList;if(Ib.verticesNeedUpdate){for(Fc=0;Fc<gd;Fc++)Rc=yd[Fc],Ba=3*Fc,Vc[Ba]=Rc.x,Vc[Ba+1]=Rc.y,Vc[Ba+2]=Rc.z;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Vc,Qc)}if(jd){for(Gc=0;Gc<hd;Gc++)Sc=zd[Gc],Ba=3*Gc,Wc[Ba]=Sc.r,Wc[Ba+1]=Sc.g,Wc[Ba+2]=Sc.b;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Wc,Qc)}if(kd){for(Hc=0;Hc<id;Hc++)Tc=Ad[Hc],Ba=3*Hc,Xc[Ba]=Tc.x,Xc[Ba+
|
|
|
-1]=Tc.y,Xc[Ba+2]=Tc.z;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Xc,Qc)}if(rd){Uc=0;for(xd=rd.length;Uc<xd;Uc++)if(Ga=rd[Uc],Ga.needsUpdate&&(void 0===Ga.boundTo||"vertices"===Ga.boundTo)){Ba=0;zc=Ga.value.length;if(1===Ga.size)for(gb=0;gb<zc;gb++)Ga.array[gb]=Ga.value[gb];else if(2===Ga.size)for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.x,Ga.array[Ba+1]=rb.y,Ba+=2;else if(3===Ga.size)if("c"===Ga.type)for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.r,
|
|
|
-Ga.array[Ba+1]=rb.g,Ga.array[Ba+2]=rb.b,Ba+=3;else for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.x,Ga.array[Ba+1]=rb.y,Ga.array[Ba+2]=rb.z,Ba+=3;else if(4===Ga.size)for(gb=0;gb<zc;gb++)rb=Ga.value[gb],Ga.array[Ba]=rb.x,Ga.array[Ba+1]=rb.y,Ga.array[Ba+2]=rb.z,Ga.array[Ba+3]=rb.w,Ba+=4;j.bindBuffer(j.ARRAY_BUFFER,Ga.buffer);j.bufferData(j.ARRAY_BUFFER,Ga.array,Qc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.normalsNeedUpdate=!1;ga.attributes&&t(ga)}else if(ia 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{ga=e(ia,O);za=ga.attributes&&x(ga);if(O.verticesNeedUpdate||O.colorsNeedUpdate||O.lineDistancesNeedUpdate||za){var Jb=O,Yc=j.DYNAMIC_DRAW,Ic=void 0,Jc=void 0,Kc=void 0,Zc=void 0,Ma=void 0,$c=void 0,Bd=Jb.vertices,Cd=Jb.colors,Dd=Jb.lineDistances,ld=Bd.length,Jd=Cd.length,Kd=Dd.length,ad=Jb.__vertexArray,bd=Jb.__colorArray,Ed=Jb.__lineDistanceArray,Ld=Jb.colorsNeedUpdate,
|
|
|
-Md=Jb.lineDistancesNeedUpdate,sd=Jb.__webglCustomAttributesList,cd=void 0,Fd=void 0,hb=void 0,Ac=void 0,sb=void 0,Ha=void 0;if(Jb.verticesNeedUpdate){for(Ic=0;Ic<ld;Ic++)Zc=Bd[Ic],Ma=3*Ic,ad[Ma]=Zc.x,ad[Ma+1]=Zc.y,ad[Ma+2]=Zc.z;j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ad,Yc)}if(Ld){for(Jc=0;Jc<Jd;Jc++)$c=Cd[Jc],Ma=3*Jc,bd[Ma]=$c.r,bd[Ma+1]=$c.g,bd[Ma+2]=$c.b;j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,bd,Yc)}if(Md){for(Kc=0;Kc<
|
|
|
-Kd;Kc++)Ed[Kc]=Dd[Kc];j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Ed,Yc)}if(sd){cd=0;for(Fd=sd.length;cd<Fd;cd++)if(Ha=sd[cd],Ha.needsUpdate&&(void 0===Ha.boundTo||"vertices"===Ha.boundTo)){Ma=0;Ac=Ha.value.length;if(1===Ha.size)for(hb=0;hb<Ac;hb++)Ha.array[hb]=Ha.value[hb];else if(2===Ha.size)for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=sb.x,Ha.array[Ma+1]=sb.y,Ma+=2;else if(3===Ha.size)if("c"===Ha.type)for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=
|
|
|
-sb.r,Ha.array[Ma+1]=sb.g,Ha.array[Ma+2]=sb.b,Ma+=3;else for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=sb.x,Ha.array[Ma+1]=sb.y,Ha.array[Ma+2]=sb.z,Ma+=3;else if(4===Ha.size)for(hb=0;hb<Ac;hb++)sb=Ha.value[hb],Ha.array[Ma]=sb.x,Ha.array[Ma+1]=sb.y,Ha.array[Ma+2]=sb.z,Ha.array[Ma+3]=sb.w,Ma+=4;j.bindBuffer(j.ARRAY_BUFFER,Ha.buffer);j.bufferData(j.ARRAY_BUFFER,Ha.array,Yc)}}}O.verticesNeedUpdate=!1;O.colorsNeedUpdate=!1;O.lineDistancesNeedUpdate=!1;ga.attributes&&t(ga)}else if(ia 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{ga=e(ia,O);za=ga.attributes&&x(ga);if(O.verticesNeedUpdate||O.colorsNeedUpdate||ia.sortParticles||za){var cc=O,td=j.DYNAMIC_DRAW,Lc=ia,tb=void 0,dc=void 0,ec=void 0,fa=void 0,fc=void 0,qc=void 0,dd=cc.vertices,ud=dd.length,vd=cc.colors,Gd=vd.length,uc=cc.__vertexArray,vc=cc.__colorArray,kc=cc.__sortArray,Hd=cc.verticesNeedUpdate,Id=cc.colorsNeedUpdate,
|
|
|
-lc=cc.__webglCustomAttributesList,Lb=void 0,Bc=void 0,pa=void 0,Mb=void 0,Fa=void 0,ea=void 0;if(Lc.sortParticles){wc.copy(pb);wc.multiply(Lc.matrixWorld);for(tb=0;tb<ud;tb++)ec=dd[tb],Ra.copy(ec),Ra.applyProjection(wc),kc[tb]=[Ra.z,tb];kc.sort(m);for(tb=0;tb<ud;tb++)ec=dd[kc[tb][1]],fa=3*tb,uc[fa]=ec.x,uc[fa+1]=ec.y,uc[fa+2]=ec.z;for(dc=0;dc<Gd;dc++)fa=3*dc,qc=vd[kc[dc][1]],vc[fa]=qc.r,vc[fa+1]=qc.g,vc[fa+2]=qc.b;if(lc){Lb=0;for(Bc=lc.length;Lb<Bc;Lb++)if(ea=lc[Lb],void 0===ea.boundTo||"vertices"===
|
|
|
-ea.boundTo)if(fa=0,Mb=ea.value.length,1===ea.size)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],ea.array[pa]=ea.value[fc];else if(2===ea.size)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,fa+=2;else if(3===ea.size)if("c"===ea.type)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.r,ea.array[fa+1]=Fa.g,ea.array[fa+2]=Fa.b,fa+=3;else for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,fa+=3;else if(4===
|
|
|
-ea.size)for(pa=0;pa<Mb;pa++)fc=kc[pa][1],Fa=ea.value[fc],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,ea.array[fa+3]=Fa.w,fa+=4}}else{if(Hd)for(tb=0;tb<ud;tb++)ec=dd[tb],fa=3*tb,uc[fa]=ec.x,uc[fa+1]=ec.y,uc[fa+2]=ec.z;if(Id)for(dc=0;dc<Gd;dc++)qc=vd[dc],fa=3*dc,vc[fa]=qc.r,vc[fa+1]=qc.g,vc[fa+2]=qc.b;if(lc){Lb=0;for(Bc=lc.length;Lb<Bc;Lb++)if(ea=lc[Lb],ea.needsUpdate&&(void 0===ea.boundTo||"vertices"===ea.boundTo))if(Mb=ea.value.length,fa=0,1===ea.size)for(pa=0;pa<Mb;pa++)ea.array[pa]=
|
|
|
-ea.value[pa];else if(2===ea.size)for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,fa+=2;else if(3===ea.size)if("c"===ea.type)for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.r,ea.array[fa+1]=Fa.g,ea.array[fa+2]=Fa.b,fa+=3;else for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,fa+=3;else if(4===ea.size)for(pa=0;pa<Mb;pa++)Fa=ea.value[pa],ea.array[fa]=Fa.x,ea.array[fa+1]=Fa.y,ea.array[fa+2]=Fa.z,ea.array[fa+3]=Fa.w,fa+=4}}if(Hd||
|
|
|
-Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,cc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,uc,td);if(Id||Lc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,cc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,vc,td);if(lc){Lb=0;for(Bc=lc.length;Lb<Bc;Lb++)if(ea=lc[Lb],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;ga.attributes&&t(ga)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",
|
|
|
-Y);var i,k,m,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=
|
|
|
-p.vertexShader;a.fragmentShader=p.fragmentShader}var q,r,s;e=g=r=s=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&r++,q instanceof THREE.SpotLight&&s++,q instanceof THREE.HemisphereLight&&p++);e=g;f=r;g=s;h=p;p=q=0;for(s=b.length;p<s;p++)r=b[p],r.castShadow&&(r instanceof THREE.SpotLight&&q++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&q++);l=q;xc&&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:{r=a.fragmentShader;s=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:xc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,
|
|
|
-shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,x,d=[];n?d.push(n):(d.push(r),d.push(s));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(v=Na.length;t<v;t++)if(d=Na[t],d.code===n){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(x in q)d=q[x],!1!==d&&(d="#define "+x+" "+d,v.push(d));d=v.join("\n");x=j.createProgram();v=["precision "+X+" float;",d,rc?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,
|
|
|
-"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):
|
|
|
-"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":
|
|
|
-"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-t=["precision "+X+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
-c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=B("fragment",t+r);v=B("vertex",v+s);j.attachShader(x,v);j.attachShader(x,t);j.linkProgram(x);j.getProgramParameter(x,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(x,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
-j.getError()+"]");j.deleteShader(t);j.deleteShader(v);x.uniforms={};x.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(w in p)t.push(w);w=t;t=0;for(v=w.length;t<v;t++)p=w[t],x.uniforms[p]=j.getUniformLocation(x,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+
|
|
|
-w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],x.attributes[t]=j.getAttribLocation(x,t);x.id=wb++;Na.push({program:x,code:n,usedTimes:1});M.info.memory.programs=Na.length;k=x}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)x=b+k,0<=w[x]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)x=
|
|
|
-b+k,0<=w[x]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;ha!==
|
|
|
-b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ha=b);sa!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),sa=a)};this.setDepthTest=function(a){ua!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ua=a)};this.setDepthWrite=function(a){Wa!==a&&(j.depthMask(a),Wa=a)};this.setBlending=function(a,b,c,d){a!==ka&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
|
|
|
-j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ka=a);if(a===THREE.CustomBlending){if(b!==Ia&&(j.blendEquation(L(b)),Ia=b),c!==db||d!==$a)j.blendFunc(L(c),L(d)),db=c,$a=d}else $a=
|
|
|
-db=Ia=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Oc),a.__webglTexture=j.createTexture(),M.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=L(a.format),
|
|
|
-f=L(a.type);T(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,
|
|
|
-h,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",N);a.__webglTexture=
|
|
|
-j.createTexture();M.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);T(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);C(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),T(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):C(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=Bb,a=Cb,d=Kb,e=gc);b!==xb&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),xb=b);ob=c;Qa=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);
|
|
|
+depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a){if(a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)r.deleteBuffer(a.__webglCustomAttributesList[b].buffer)}function c(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function d(a){var b,c;for(b in a.attributes)c=a.attributes[b],c.buffer=r.createBuffer(),"index"===b?r.setStaticIndexBuffer(c.buffer,c.array):r.setStaticArrayBuffer(c.buffer,c.array)}function e(a,b){var c=a.attributes,
|
|
|
+d=c.index,e=c.position,f=c.normal,g=c.uv,i=c.color,c=c.tangent;a.elementsNeedUpdate&&void 0!==d&&r.setDynamicIndexBuffer(d.buffer,d.array);a.verticesNeedUpdate&&void 0!==e&&r.setDynamicArrayBuffer(e.buffer,e.array);a.normalsNeedUpdate&&void 0!==f&&r.setDynamicArrayBuffer(f.buffer,f.array);a.uvsNeedUpdate&&void 0!==g&&r.setDynamicArrayBuffer(g.buffer,g.array);a.colorsNeedUpdate&&void 0!==i&&r.setDynamicArrayBuffer(i.buffer,i.array);a.tangentsNeedUpdate&&void 0!==c&&r.setDynamicArrayBuffer(c.buffer,
|
|
|
+c.array);if(b)for(var h in a.attributes)delete a.attributes[h].array}function f(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function g(a,b){return b[0]-a[0]}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)C=N=null,A=Q=-1,K=!0,r.resetState(),a[d].render(b,c,r.getCurrentWidth(),r.getCurrentWidth()),C=N=null,A=Q=-1,K=!0,r.resetState()}function i(a,b,c,d,e,f,g,i){var h,j,k,l;b?(j=a.length-1,l=b=-1):(j=0,b=a.length,l=1);for(var m=j;m!==b;m+=l)if(h=a[m],h.render){j=h.object;k=h.buffer;if(i)h=i;
|
|
|
+else{h=h[c];if(!h)continue;g&&r.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);r.setDepthTest(h.depthTest);r.setDepthWrite(h.depthWrite);r.setPolygonOffset(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}r.setMaterialFaces(h);k instanceof THREE.BufferGeometry?B.renderBufferDirect(d,e,f,h,k,j):B.renderBuffer(d,e,f,h,k,j)}}function j(a,b,c,d,e,f,g){for(var i,h,j=0,k=a.length;j<k;j++)if(i=a[j],h=i.object,h.visible){if(g)i=g;else{i=i[b];if(!i)continue;f&&r.setBlending(i.blending,
|
|
|
+i.blendEquation,i.blendSrc,i.blendDst);r.setDepthTest(i.depthTest);r.setDepthWrite(i.depthWrite);r.setPolygonOffset(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}B.renderImmediateObject(c,d,e,i,h)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function s(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===
|
|
|
+b&&a.splice(c,1)}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function p(a,b,c,d,e){t=0;d.needsUpdate&&(d.program&&V(d),B.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets));var f=!1,g=d.program,i=g.uniforms,h=d.uniforms;g!==N&&(r.useProgram(g),N=g,f=!0);d.id!==A&&(A=d.id,f=!0);if(f||a!==C)r.uniformMatrix4fv(i.projectionMatrix,a.projectionMatrix.elements),a!==C&&(C=a);
|
|
|
+if(d.skinning)if(r.supportsBoneTextures&&e.useVertexTexture){if(null!==i.boneTexture){var j=q();r.uniform1i(i.boneTexture,j);r.setTexture(e.boneTexture,j)}}else null!==i.boneGlobalMatrices&&r.uniformMatrix4fv(i.boneGlobalMatrices,e.boneMatrices);if(f){c&&d.fog&&(h.fogColor.value=c.color,c instanceof THREE.Fog?(h.fogNear.value=c.near,h.fogFar.value=c.far):c instanceof THREE.FogExp2&&(h.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(K){for(var k,
|
|
|
+l=j=0,m=0,n,p,s,u=S,w=u.directional.colors,z=u.directional.positions,D=u.point.colors,E=u.point.positions,H=u.point.distances,F=u.spot.colors,G=u.spot.positions,I=u.spot.distances,M=u.spot.directions,Q=u.spot.anglesCos,Y=u.spot.exponents,aa=u.hemi.skyColors,Ba=u.hemi.groundColors,oa=u.hemi.positions,Ea=0,Ca=0,ga=0,xa=0,Da=0,Fa=0,na=0,za=0,ha=k=0,c=s=ha=0,f=b.length;c<f;c++)k=b[c],k.onlyShadow||(n=k.color,p=k.intensity,s=k.distance,k instanceof THREE.AmbientLight?k.visible&&(B.gammaInput?(j+=n.r*n.r,
|
|
|
+l+=n.g*n.g,m+=n.b*n.b):(j+=n.r,l+=n.g,m+=n.b)):k instanceof THREE.DirectionalLight?(Da+=1,k.visible&&(x.getPositionFromMatrix(k.matrixWorld),J.getPositionFromMatrix(k.target.matrixWorld),x.sub(J),x.normalize(),0===x.x&&0===x.y&&0===x.z||(k=3*Ea,z[k]=x.x,z[k+1]=x.y,z[k+2]=x.z,B.gammaInput?v(w,k,n,p*p):y(w,k,n,p),Ea+=1))):k instanceof THREE.PointLight?(Fa+=1,k.visible&&(ha=3*Ca,B.gammaInput?v(D,ha,n,p*p):y(D,ha,n,p),J.getPositionFromMatrix(k.matrixWorld),E[ha]=J.x,E[ha+1]=J.y,E[ha+2]=J.z,H[Ca]=s,Ca+=
|
|
|
+1)):k instanceof THREE.SpotLight?(na+=1,k.visible&&(ha=3*ga,B.gammaInput?v(F,ha,n,p*p):y(F,ha,n,p),J.getPositionFromMatrix(k.matrixWorld),G[ha]=J.x,G[ha+1]=J.y,G[ha+2]=J.z,I[ga]=s,x.copy(J),J.getPositionFromMatrix(k.target.matrixWorld),x.sub(J),x.normalize(),M[ha]=x.x,M[ha+1]=x.y,M[ha+2]=x.z,Q[ga]=Math.cos(k.angle),Y[ga]=k.exponent,ga+=1)):k instanceof THREE.HemisphereLight&&(za+=1,k.visible&&(x.getPositionFromMatrix(k.matrixWorld),x.normalize(),0===x.x&&0===x.y&&0===x.z||(s=3*xa,oa[s]=x.x,oa[s+1]=
|
|
|
+x.y,oa[s+2]=x.z,n=k.color,k=k.groundColor,B.gammaInput?(p*=p,v(aa,s,n,p),v(Ba,s,k,p)):(y(aa,s,n,p),y(Ba,s,k,p)),xa+=1))));c=3*Ea;for(f=Math.max(w.length,3*Da);c<f;c++)w[c]=0;c=3*Ca;for(f=Math.max(D.length,3*Fa);c<f;c++)D[c]=0;c=3*ga;for(f=Math.max(F.length,3*na);c<f;c++)F[c]=0;c=3*xa;for(f=Math.max(aa.length,3*za);c<f;c++)aa[c]=0;c=3*xa;for(f=Math.max(Ba.length,3*za);c<f;c++)Ba[c]=0;u.directional.length=Ea;u.point.length=Ca;u.spot.length=ga;u.hemi.length=xa;u.ambient[0]=j;u.ambient[1]=l;u.ambient[2]=
|
|
|
+m;K=!1}c=S;h.ambientLightColor.value=c.ambient;h.directionalLightColor.value=c.directional.colors;h.directionalLightDirection.value=c.directional.positions;h.pointLightColor.value=c.point.colors;h.pointLightPosition.value=c.point.positions;h.pointLightDistance.value=c.point.distances;h.spotLightColor.value=c.spot.colors;h.spotLightPosition.value=c.spot.positions;h.spotLightDistance.value=c.spot.distances;h.spotLightDirection.value=c.spot.directions;h.spotLightAngleCos.value=c.spot.anglesCos;h.spotLightExponent.value=
|
|
|
+c.spot.exponents;h.hemisphereLightSkyColor.value=c.hemi.skyColors;h.hemisphereLightGroundColor.value=c.hemi.groundColors;h.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){h.opacity.value=d.opacity;B.gammaInput?h.diffuse.value.copyGammaToLinear(d.color):h.diffuse.value=d.color;h.map.value=d.map;h.lightMap.value=d.lightMap;h.specularMap.value=d.specularMap;d.bumpMap&&(h.bumpMap.value=
|
|
|
+d.bumpMap,h.bumpScale.value=d.bumpScale);d.normalMap&&(h.normalMap.value=d.normalMap,h.normalScale.value.copy(d.normalScale));var O;d.map?O=d.map:d.specularMap?O=d.specularMap:d.normalMap?O=d.normalMap:d.bumpMap&&(O=d.bumpMap);void 0!==O&&(c=O.offset,O=O.repeat,h.offsetRepeat.value.set(c.x,c.y,O.x,O.y));h.envMap.value=d.envMap;h.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;h.reflectivity.value=d.reflectivity;h.refractionRatio.value=d.refractionRatio;h.combine.value=d.combine;
|
|
|
+h.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(h.diffuse.value=d.color,h.opacity.value=d.opacity,h.dashSize.value=d.dashSize,h.totalSize.value=d.dashSize+d.gapSize,h.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(h.psColor.value=d.color,h.opacity.value=d.opacity,h.size.value=d.size,h.scale.value=r.getDomElement().height/
|
|
|
+2,h.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(h.shininess.value=d.shininess,B.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive),h.specular.value.copyGammaToLinear(d.specular)):(h.ambient.value=d.ambient,h.emissive.value=d.emissive,h.specular.value=d.specular),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(B.gammaInput?(h.ambient.value.copyGammaToLinear(d.ambient),h.emissive.value.copyGammaToLinear(d.emissive)):
|
|
|
+(h.ambient.value=d.ambient,h.emissive.value=d.emissive),d.wrapAround&&h.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(h.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&h.shadowMatrix){c=O=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))h.shadowMap.value[O]=j.shadowMap,h.shadowMapSize.value[O]=
|
|
|
+j.shadowMapSize,h.shadowMatrix.value[O]=j.shadowMatrix,h.shadowDarkness.value[O]=j.shadowDarkness,h.shadowBias.value[O]=j.shadowBias,O++}b=d.uniformsList;c=0;for(f=b.length;c<f;c++)if(O=g.uniforms[b[c][1]])if(h=b[c][0],j=h.type,m=h.value,"i"===j)r.uniform1i(O,m);else if("f"===j)r.uniform1f(O,m);else if("v2"===j)r.uniform2f(O,m.x,m.y);else if("v3"===j)r.uniform3f(O,m.x,m.y,m.z);else if("v4"===j)r.uniform4f(O,m.x,m.y,m.z,m.w);else if("c"===j)r.uniform3f(O,m.r,m.g,m.b);else if("iv1"===j)r.uniform1iv(O,
|
|
|
+m);else if("iv"===j)r.uniform3iv(O,m);else if("fv1"===j)r.uniform1fv(O,m);else if("fv"===j)r.uniform3fv(O,m);else if("v2v"===j){void 0===h._array&&(h._array=new Float32Array(2*m.length));j=0;for(l=m.length;j<l;j++)u=2*j,h._array[u]=m[j].x,h._array[u+1]=m[j].y;r.uniform2fv(O,h._array)}else if("v3v"===j){void 0===h._array&&(h._array=new Float32Array(3*m.length));j=0;for(l=m.length;j<l;j++)u=3*j,h._array[u]=m[j].x,h._array[u+1]=m[j].y,h._array[u+2]=m[j].z;r.uniform3fv(O,h._array)}else if("v4v"===j){void 0===
|
|
|
+h._array&&(h._array=new Float32Array(4*m.length));j=0;for(l=m.length;j<l;j++)u=4*j,h._array[u]=m[j].x,h._array[u+1]=m[j].y,h._array[u+2]=m[j].z,h._array[u+3]=m[j].w;r.uniform4fv(O,h._array)}else if("m4"===j)void 0===h._array&&(h._array=new Float32Array(16)),m.flattenToArray(h._array),r.uniformMatrix4fv(O,h._array);else if("m4v"===j){void 0===h._array&&(h._array=new Float32Array(16*m.length));j=0;for(l=m.length;j<l;j++)m[j].flattenToArrayOffset(h._array,16*j);r.uniformMatrix4fv(O,h._array)}else if("t"===
|
|
|
+j)u=q(),r.uniform1i(O,u),m&&(m.image instanceof Array&&6===m.image.length?r.setCubeTexture(m,u):m instanceof THREE.WebGLRenderTargetCube?r.setCubeTextureDynamic(m,u):r.setTexture(m,u));else if("tv"===j){void 0===h._array&&(h._array=[]);j=0;for(l=h.value.length;j<l;j++)h._array[j]=q();r.uniform1iv(O,h._array);j=0;for(l=h.value.length;j<l;j++)m=h.value[j],u=h._array[j],m&&r.setTexture(m,u)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==i.cameraPosition)J.getPositionFromMatrix(a.matrixWorld),
|
|
|
+r.uniform3f(i.cameraPosition,J.x,J.y,J.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==i.viewMatrix&&r.uniformMatrix4fv(i.viewMatrix,a.matrixWorldInverse.elements)}r.uniformMatrix4fv(i.modelViewMatrix,e._modelViewMatrix.elements);i.normalMatrix&&r.uniformMatrix3fv(i.normalMatrix,e._normalMatrix.elements);null!==i.modelMatrix&&r.uniformMatrix4fv(i.modelMatrix,e.matrixWorld.elements);return g}function q(){var a=
|
|
|
+t;a>=r.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+r.maxTextures);t+=1;return a}function w(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function v(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function y(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},z={memory:{programs:0,
|
|
|
+geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}},r=new THREE.WebGLRenderer.LowLevelRenderer(a),E=new THREE.WebGLRenderer.MeshRenderer(r,z),D=new THREE.WebGLRenderer.ParticleRenderer(r,z),l=new THREE.WebGLRenderer.LineRenderer(r,z),H=new THREE.WebGLRenderer.RibbonRenderer(r,z),F=new THREE.WebGLRenderer.ShaderBuilder(r,z);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=z;var B=this,N=null,A=-1,Q=null,C=null,G=0,t=0,I=new THREE.Frustum,M=new THREE.Matrix4;new THREE.Matrix4;var J=new THREE.Vector3,x=new THREE.Vector3,K=
|
|
|
+!0,S={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:[]}};this.context=r.getContext();this.domElement=r.getDomElement();this.getPrecision=this.getPrecision=r.getPrecision;this.getContext=r.getContext;this.supportsVertexTextures=r.supportsVertexTextures;this.supportsFloatTextures=r.supportsFloatTextures;
|
|
|
+this.supportsStandardDerivatives=r.supportsStandardDerivatives;this.supportsCompressedTextureS3TC=r.supportsCompressedTextureS3TC;this.getMaxAnisotropy=r.getMaxAnisotropy;this.setSize=r.setSize;this.setViewport=r.setViewport;this.setScissor=r.setScissor;this.enableScissorTest=r.enableScissorTest;this.setDepthWrite=r.setDepthWrite;this.setDepthTest=r.setDepthTest;this.setRenderTarget=r.setRenderTarget;this.setBlending=r.setBlending;this.setTexture=r.setTexture;this.setMaterialFaces=r.setMaterialFaces;
|
|
|
+this.setFaceCulling=r.setFaceCulling;this.setClearColorHex=r.setClearColorHex;this.setClearColor=r.setClearColor;this.getClearColor=r.getClearColor;this.getClearAlpha=r.getClearAlpha;this.clear=r.clear;this.clearTarget=r.clearTarget;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){N=null;A=Q=-1;K=!0;r.resetState();this.shadowMapPlugin.update(a,b)};var aa=function(a){a=
|
|
|
+a.target;a.removeEventListener("dispose",aa);var c,d;a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&r.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&r.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&r.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&r.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&r.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&r.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&
|
|
|
+r.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&r.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&r.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&r.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&r.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var e in a.geometryGroups){var f=a.geometryGroups[e];if(void 0!==f.numMorphTargets){c=0;for(d=f.numMorphTargets;c<d;c++)r.deleteBuffer(f.__webglMorphTargetsBuffers[c])}if(void 0!==
|
|
|
+f.numMorphNormals){c=0;for(d=f.numMorphNormals;c<d;c++)r.deleteBuffer(f.__webglMorphNormalsBuffers[c])}b(f)}b(a);B.info.memory.geometries--},Y=function(a){a=a.target;a.removeEventListener("dispose",Y);V(a)},V=function(a){var b=a.program;void 0!==b&&(a.program=void 0,F.removeProgram(b))};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=r.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=r.createBuffer());a.hasUvs&&
|
|
|
+!a.__webglUvBuffer&&(a.__webglUvBuffer=r.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=r.createBuffer());a.hasPositions&&(r.setDynamicArrayBuffer(a.__webglVertexBuffer,a.positionArray),r.setFloatAttribute(b.attributes.position,a.__webglVertexBuffer,3,0));if(a.hasNormals){if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,j,k,l,m,n,p=3*a.count;for(n=0;n<p;n+=9)m=a.normalArray,d=m[n],e=m[n+1],f=m[n+2],g=m[n+3],i=m[n+4],k=m[n+5],h=m[n+6],j=m[n+7],l=m[n+8],d=(d+g+h)/3,e=(e+
|
|
|
+i+j)/3,f=(f+k+l)/3,m[n]=d,m[n+1]=e,m[n+2]=f,m[n+3]=d,m[n+4]=e,m[n+5]=f,m[n+6]=d,m[n+7]=e,m[n+8]=f}r.setDynamicArrayBuffer(a.__webglNormalBuffer,a.normalArray);r.setFloatAttribute(b.attributes.normal,a.__webglNormalBuffer,3,0)}a.hasUvs&&c.map&&(r.setDynamicArrayBuffer(a.__webglUvBuffer,a.uvArray),r.setFloatAttribute(b.attributes.uv,a.__webglUvBuffer,2,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(r.setDynamicArrayBuffer(a.__webglColorBuffer,a.colorArray),r.setFloatAttribute(b.attributes.color,
|
|
|
+a.__webglColorBuffer,3,0));r.drawTriangles(a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=p(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0),c!==Q&&(Q=c,b=!0),b&&r.disableAttributes(),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 h=f[c].index;if(b){var i=e.attributes.position,j=i.itemSize;r.setFloatAttribute(a.position,i.buffer,j,4*h*j);j=e.attributes.normal;if(0<=
|
|
|
+a.normal&&j){var k=j.itemSize;r.setFloatAttribute(a.normal,j.buffer,k,4*h*k)}j=e.attributes.uv;0<=a.uv&&j&&(k=j.itemSize,r.setFloatAttribute(a.uv,j.buffer,k,4*h*k));j=e.attributes.color;0<=a.color&&j&&(k=j.itemSize,r.setFloatAttribute(a.color,j.buffer,k,4*h*k));j=e.attributes.tangent;0<=a.tangent&&j&&(k=j.itemSize,r.setFloatAttribute(a.tangent,j.buffer,k,4*h*k))}r.drawTriangleElements(d.buffer,f[c].count,2*f[c].start);B.info.render.calls++;B.info.render.vertices+=f[c].count;B.info.render.faces+=f[c].count/
|
|
|
+3}}else b&&(i=e.attributes.position,j=i.itemSize,r.setFloatAttribute(a.position,i.buffer,j,0),j=e.attributes.normal,0<=a.normal&&j&&(k=j.itemSize,r.setFloatAttribute(a.normal,j.buffer,k,0)),j=e.attributes.uv,0<=a.uv&&j&&(k=j.itemSize,r.setFloatAttribute(a.uv,j.buffer,k,0)),j=e.attributes.color,0<=a.color&&j&&(k=j.itemSize,r.setFloatAttribute(a.color,j.buffer,k,0)),j=e.attributes.tangent,0<=a.tangent&&j&&(k=j.itemSize,r.setFloatAttribute(a.tangent,j.buffer,k,0))),r.drawTriangles(i.numItems/3),B.info.render.calls++,
|
|
|
+B.info.render.vertices+=i.numItems/3,B.info.render.faces+=i.numItems/3/3;else f instanceof THREE.ParticleSystem?b&&(i=e.attributes.position,j=i.itemSize,r.setFloatAttribute(a.position,i.buffer,j,0),j=e.attributes.color,0<=a.color&&j&&(k=j.itemSize,r.setFloatAttribute(a.color,j.buffer,k,0)),r.drawPoints(i.numItems/3),B.info.render.calls++,B.info.render.points+=i.numItems/3):f instanceof THREE.Line&&b&&(i=e.attributes.position,j=i.itemSize,r.setFloatAttribute(a.position,i.buffer,j,0),j=e.attributes.color,
|
|
|
+0<=a.color&&j&&(k=j.itemSize,r.setFloatAttribute(a.color,j.buffer,k,0)),r.setLineWidth(d.linewidth),r.drawLineStrip(i.numItems/3),B.info.render.calls++,B.info.render.points+=i.numItems)};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var h,c=p(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Q&&(Q=c,b=!0);b&&r.disableAttributes();if(!d.morphTargets&&0<=a.position)b&&r.setFloatAttribute(a.position,e.__webglVertexBuffer,3,0);else if(f.morphTargetBase){c=d.program.attributes;
|
|
|
+-1!==f.morphTargetBase&&0<=c.position?r.setFloatAttribute(c.position,e.__webglMorphTargetsBuffers[f.morphTargetBase],3,0):0<=c.position&&r.setFloatAttribute(c.position,e.__webglVertexBuffer,3,0);if(f.morphTargetForcedOrder.length){var i=0,j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<j.length;)0<=c["morphTarget"+i]&&r.setFloatAttribute(c["morphTarget"+i],e.__webglMorphTargetsBuffers[j[i]],3,0),0<=c["morphNormal"+i]&&d.morphNormals&&r.setFloatAttribute(c["morphNormal"+
|
|
|
+i],e.__webglMorphNormalsBuffers[j[i]],3,0),f.__webglMorphTargetInfluences[i]=h[j[i]],i++}else{j=[];h=f.morphTargetInfluences;var k,l=h.length;for(k=0;k<l;k++)i=h[k],0<i&&j.push([i,k]);j.length>d.numSupportedMorphTargets?(j.sort(g),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(g):0===j.length&&j.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)j[i]?(k=j[i][1],0<=c["morphTarget"+i]&&r.setFloatAttribute(c["morphTarget"+i],e.__webglMorphTargetsBuffers[k],3,0),0<=c["morphNormal"+
|
|
|
+i]&&d.morphNormals&&r.setFloatAttribute(c["morphNormal"+i],e.__webglMorphNormalsBuffers[k],3,0),f.__webglMorphTargetInfluences[i]=h[k]):f.__webglMorphTargetInfluences[i]=0,i++}null!==d.program.uniforms.morphTargetInfluences&&r.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){c=0;for(h=e.__webglCustomAttributesList.length;c<h;c++)b=e.__webglCustomAttributesList[c],0<=a[b.buffer.belongsToAttribute]&&r.setFloatAttribute(a[b.buffer.belongsToAttribute],
|
|
|
+b.buffer,b.size,0)}0<=a.color&&r.setFloatAttribute(a.color,e.__webglColorBuffer,3,0);0<=a.normal&&r.setFloatAttribute(a.normal,e.__webglNormalBuffer,3,0);0<=a.tangent&&r.setFloatAttribute(a.tangent,e.__webglTangentBuffer,4,0);0<=a.uv&&r.setFloatAttribute(a.uv,e.__webglUVBuffer,2,0);0<=a.uv2&&r.setFloatAttribute(a.uv2,e.__webglUV2Buffer,2,0);d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(r.setFloatAttribute(a.skinIndex,e.__webglSkinIndicesBuffer,4,0),r.setFloatAttribute(a.skinWeight,e.__webglSkinWeightsBuffer,
|
|
|
+4,0));0<=a.lineDistance&&r.setFloatAttribute(a.lineDistance,e.__webglLineDistanceBuffer,1,0)}f instanceof THREE.Mesh?(d.wireframe?(r.setLineWidth(d.wireframeLinewidth),r.drawLineElements(e.__webglLineBuffer,e.__webglLineCount,0)):r.drawTriangleElements(e.__webglFaceBuffer,e.__webglFaceCount,0),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(r.setLineWidth(d.linewidth),f.type===THREE.LineStrip?r.drawLineStrip(e.__webglLineCount):
|
|
|
+r.drawLines(e.__webglLineCount),B.info.render.calls++):f instanceof THREE.ParticleSystem?(r.drawPoints(e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(r.drawTriangleStrip(e.__webglVertexCount),B.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,g,k,l,m=a.__lights,n=a.fog;A=-1;K=!0;this.autoUpdateScene&&
|
|
|
+a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);I.setFromMatrix(M);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;r.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;d=0;for(e=
|
|
|
+l.length;d<e;d++)if(g=l[d],k=g.object,g.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||I.intersectsObject(k))){w(k,b);var p=g,s=p.buffer,q=void 0,u=q=void 0,u=p.object.material;if(u instanceof THREE.MeshFaceMaterial)q=s.materialIndex,q=u.materials[q],q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null);else if(q=u)q.transparent?(p.transparent=q,p.opaque=null):(p.opaque=q,p.transparent=null);g.render=!0;!0===this.sortObjects&&
|
|
|
+(null!==k.renderDepth?g.z=k.renderDepth:(J.getPositionFromMatrix(k.matrixWorld),J.applyProjection(M),g.z=J.z),g.id=k.id)}this.sortObjects&&l.sort(f);l=a.__webglObjectsImmediate;d=0;for(e=l.length;d<e;d++)g=l[d],k=g.object,k.visible&&(w(k,b),k=g.object.material,k.transparent?(g.transparent=k,g.opaque=null):(g.opaque=k,g.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,r.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),r.setDepthTest(d.depthTest),r.setDepthWrite(d.depthWrite),
|
|
|
+r.setPolygonOffset(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,m,n,!0,d),j(a.__webglObjectsImmediate,"",b,m,n,!1,d)):(d=null,r.setBlending(THREE.NoBlending),i(a.__webglObjects,!0,"opaque",b,m,n,!1,d),j(a.__webglObjectsImmediate,"opaque",b,m,n,!1,d),i(a.__webglObjects,!1,"transparent",b,m,n,!0,d),j(a.__webglObjectsImmediate,"transparent",b,m,n,!0,d));h(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&
|
|
|
+r.updateRenderTargetMipmap(c);r.setDepthTest(!0);r.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=p(a,b,c,d,e);Q=-1;r.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,r.getContext(),I):e.render(function(a){B.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],f=a,g=void 0,
|
|
|
+h=void 0,i=void 0,j=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",aa)),b instanceof THREE.Mesh)if(h=b.geometry,i=b.material,h instanceof THREE.Geometry){if(void 0===h.geometryGroups){var j=h,p=void 0,q=void 0,P=void 0,r=void 0,t=void 0,v=void 0,w={},x=j.morphTargets.length,y=j.morphNormals.length,i=i instanceof
|
|
|
+THREE.MeshFaceMaterial;j.geometryGroups={};p=0;for(q=j.faces.length;p<q;p++)P=j.faces[p],r=i?P.materialIndex:0,void 0===w[r]&&(w[r]={hash:r,counter:0}),v=w[r].hash+"_"+w[r].counter,void 0===j.geometryGroups[v]&&(j.geometryGroups[v]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:x,numMorphNormals:y}),t=P instanceof THREE.Face3?3:4,65535<j.geometryGroups[v].vertices+t&&(w[r].counter+=1,v=w[r].hash+"_"+w[r].counter,void 0===j.geometryGroups[v]&&(j.geometryGroups[v]={faces3:[],faces4:[],
|
|
|
+materialIndex:r,vertices:0,numMorphTargets:x,numMorphNormals:y})),P instanceof THREE.Face3?j.geometryGroups[v].faces3.push(p):j.geometryGroups[v].faces4.push(p),j.geometryGroups[v].vertices+=t;j.geometryGroupsList=[];p=void 0;for(p in j.geometryGroups)j.geometryGroups[p].id=G++,j.geometryGroupsList.push(j.geometryGroups[p])}for(g in h.geometryGroups)j=h.geometryGroups[g],j.__webglVertexBuffer||(E.createBuffers(j),E.initBuffers(j,b),h.verticesNeedUpdate=!0,h.morphTargetsNeedUpdate=!0,h.elementsNeedUpdate=
|
|
|
+!0,h.uvsNeedUpdate=!0,h.normalsNeedUpdate=!0,h.tangentsNeedUpdate=!0,h.colorsNeedUpdate=!0)}else h instanceof THREE.BufferGeometry&&d(h);else b instanceof THREE.Ribbon?(h=b.geometry,h.__webglVertexBuffer||(H.createBuffers(h),H.initBuffers(h,b),h.verticesNeedUpdate=!0,h.colorsNeedUpdate=!0,h.normalsNeedUpdate=!0)):b instanceof THREE.Line?(h=b.geometry,h.__webglVertexBuffer||(h instanceof THREE.Geometry?(l.createBuffers(h),l.initBuffers(h,b),h.verticesNeedUpdate=!0,h.colorsNeedUpdate=!0,h.lineDistancesNeedUpdate=
|
|
|
+!0):h instanceof THREE.BufferGeometry&&d(h))):b instanceof THREE.ParticleSystem&&(h=b.geometry,h.__webglVertexBuffer||(h instanceof THREE.Geometry?(D.createBuffers(h),D.initBuffers(h,b),h.verticesNeedUpdate=!0,h.colorsNeedUpdate=!0):h instanceof THREE.BufferGeometry&&d(h)));if(!b.__webglActive){if(b instanceof THREE.Mesh)if(h=b.geometry,h instanceof THREE.BufferGeometry)k(f.__webglObjects,h,b);else{if(h instanceof THREE.Geometry)for(g in h.geometryGroups)j=h.geometryGroups[g],k(f.__webglObjects,j,
|
|
|
+b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(h=b.geometry,k(f.__webglObjects,h,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?f.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?f.__webglSprites.push(b):b instanceof THREE.LensFlare&&f.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)b=a.__objectsRemoved[0],f=a,b instanceof THREE.Mesh||
|
|
|
+b instanceof THREE.ParticleSystem||b instanceof THREE.Ribbon||b instanceof THREE.Line?s(f.__webglObjects,b):b instanceof THREE.Sprite?u(f.__webglSprites,b):b instanceof THREE.LensFlare?u(f.__webglFlares,b):(b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback)&&s(f.__webglObjectsImmediate,b),b.__webglActive=!1,a.__objectsRemoved.splice(0,1);b=0;for(f=a.__webglObjects.length;b<f;b++)if(g=a.__webglObjects[b].object,h=g.geometry,q=p=j=void 0,g instanceof THREE.Mesh)if(h instanceof THREE.BufferGeometry)(h.verticesNeedUpdate||
|
|
|
+h.elementsNeedUpdate||h.uvsNeedUpdate||h.normalsNeedUpdate||h.colorsNeedUpdate||h.tangentsNeedUpdate)&&e(h,!h.dynamic),h.verticesNeedUpdate=!1,h.elementsNeedUpdate=!1,h.uvsNeedUpdate=!1,h.normalsNeedUpdate=!1,h.colorsNeedUpdate=!1,h.tangentsNeedUpdate=!1;else{P=0;for(r=h.geometryGroupsList.length;P<r;P++)j=h.geometryGroupsList[P],q=c(g,j),h.buffersNeedUpdate&&E.initBuffers(j,g),p=q.attributes&&n(q),(h.verticesNeedUpdate||h.morphTargetsNeedUpdate||h.elementsNeedUpdate||h.uvsNeedUpdate||h.normalsNeedUpdate||
|
|
|
+h.colorsNeedUpdate||h.tangentsNeedUpdate||p)&&E.setBuffers(j,g,!h.dynamic,q);h.verticesNeedUpdate=!1;h.morphTargetsNeedUpdate=!1;h.elementsNeedUpdate=!1;h.uvsNeedUpdate=!1;h.normalsNeedUpdate=!1;h.colorsNeedUpdate=!1;h.tangentsNeedUpdate=!1;h.buffersNeedUpdate=!1;q.attributes&&m(q)}else g instanceof THREE.Ribbon?(q=c(g,h),p=q.attributes&&n(q),(h.verticesNeedUpdate||h.colorsNeedUpdate||h.normalsNeedUpdate||p)&&H.setBuffers(h),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1,h.normalsNeedUpdate=!1,q.attributes&&
|
|
|
+m(q)):g instanceof THREE.Line?h instanceof THREE.BufferGeometry?((h.verticesNeedUpdate||h.colorsNeedUpdate)&&e(h,!h.dynamic),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1):(q=c(g,h),p=q.attributes&&n(q),(h.verticesNeedUpdate||h.colorsNeedUpdate||h.lineDistancesNeedUpdate||p)&&l.setBuffers(h),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1,h.lineDistancesNeedUpdate=!1,q.attributes&&m(q)):g instanceof THREE.ParticleSystem&&(h instanceof THREE.BufferGeometry?((h.verticesNeedUpdate||h.colorsNeedUpdate)&&
|
|
|
+e(h,!h.dynamic),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1):(q=c(g,h),p=q.attributes&&n(q),(h.verticesNeedUpdate||h.colorsNeedUpdate||g.sortParticles||p)&&D.setBuffers(h,g,M),h.verticesNeedUpdate=!1,h.colorsNeedUpdate=!1,q.attributes&&m(q)))};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Y);var i,j,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?
|
|
|
+k="lambert":a instanceof THREE.MeshPhongMaterial?k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.LineDashedMaterial?k="dashed":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");k&&(e=THREE.ShaderLib[k],a.uniforms=THREE.UniformsUtils.clone(e.uniforms),a.vertexShader=e.vertexShader,a.fragmentShader=e.fragmentShader);var l,m;e=m=f=g=h=0;for(j=b.length;e<j;e++)l=b[e],l.onlyShadow||(l instanceof THREE.DirectionalLight&&m++,l instanceof THREE.PointLight&&f++,l instanceof
|
|
|
+THREE.SpotLight&&g++,l instanceof THREE.HemisphereLight&&h++);e=m;var n=0;j=0;for(l=b.length;j<l;j++)m=b[j],m.castShadow&&(m instanceof THREE.SpotLight&&n++,m instanceof THREE.DirectionalLight&&!m.shadowCascade&&n++);b=n;r.supportsBoneTextures&&d&&d.useVertexTexture?j=1024:(j=Math.floor((r.maxVertexUniformVectors-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(j=Math.min(d.bones.length,j),j<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+
|
|
|
+j+" (try OpenGL instead of ANGLE)")));a.program=F.buildProgram(k,a.fragmentShader,a.vertexShader,a.uniforms,a.attributes,a.defines,{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:j,useVertexTexture:r.supportsBoneTextures&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,
|
|
|
+boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:b,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,gammaInput:this.gammaInput,gammaOutput:this.gammaOutput,physicallyBasedShading:this.physicallyBasedShading});d=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(c=0;c<this.maxMorphTargets;c++)k=b+c,0<=d[k]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(c=0;c<this.maxMorphNormals;c++)k=b+c,0<=d[k]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],
|
|
|
+i])};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderer.LowLevelRenderer=function(a){function b(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?l.NEAREST:l.LINEAR}function c(a,b,c,d){L=void 0!==a?a:0;ka=void 0!==b?b:0;qa=void 0!==c?c:s.width;ra=void 0!==d?d:s.height;l.viewport(L,ka,qa,ra)}function d(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)}function e(a){ba!=a&&(l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
+a),ba=a)}function f(a){ba!=a&&(l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),ba=a)}function g(a){t[a]||(l.enableVertexAttribArray(a),t[a]=!0)}function h(a,c,d){d?(l.texParameteri(a,l.TEXTURE_WRAP_S,k(c.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,k(c.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,k(c.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,k(c.minFilter))):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,
|
|
|
+b(c.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,b(c.minFilter)));if(B&&c.type!==THREE.FloatType&&(1<c.anisotropy||c.__oldAnisotropy))l.texParameterf(a,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(c.anisotropy,C)),c.__oldAnisotropy=c.anisotropy}function i(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?
|
|
|
+(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function j(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.__webglTexture=l.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=k(a.format),
|
|
|
+e=k(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);h(l.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=l.createFramebuffer();a.__webglRenderbuffer[f]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,j=l.TEXTURE_CUBE_MAP_POSITIVE_X+f;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[f]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,j,g.__webglTexture,
|
|
|
+0);i(a.__webglRenderbuffer[f],a)}c&&l.generateMipmap(l.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),h(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?
|
|
|
+a.depthBuffer&&!a.stencilBuffer?l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a.__webglRenderbuffer):i(a.__webglRenderbuffer,a),c&&l.generateMipmap(l.TEXTURE_2D);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
|
|
|
+a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=qa,a=ra,d=L,e=ka);b!==$&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),$=b);E=c;D=a}function k(a){if(a===THREE.RepeatWrapping)return l.REPEAT;if(a===THREE.ClampToEdgeWrapping)return l.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return l.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return l.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return l.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return l.NEAREST_MIPMAP_LINEAR;
|
|
|
+if(a===THREE.LinearFilter)return l.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return l.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return l.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return l.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return l.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return l.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return l.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return l.BYTE;if(a===THREE.ShortType)return l.SHORT;
|
|
|
+if(a===THREE.UnsignedShortType)return l.UNSIGNED_SHORT;if(a===THREE.IntType)return l.INT;if(a===THREE.UnsignedIntType)return l.UNSIGNED_INT;if(a===THREE.FloatType)return l.FLOAT;if(a===THREE.AlphaFormat)return l.ALPHA;if(a===THREE.RGBFormat)return l.RGB;if(a===THREE.RGBAFormat)return l.RGBA;if(a===THREE.LuminanceFormat)return l.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return l.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return l.FUNC_ADD;if(a===THREE.SubtractEquation)return l.FUNC_SUBTRACT;if(a===
|
|
|
+THREE.ReverseSubtractEquation)return l.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return l.ZERO;if(a===THREE.OneFactor)return l.ONE;if(a===THREE.SrcColorFactor)return l.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return l.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return l.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return l.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return l.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return l.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return l.DST_COLOR;
|
|
|
+if(a===THREE.OneMinusDstColorFactor)return l.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return l.SRC_ALPHA_SATURATE;if(void 0!==N){if(a===THREE.RGB_S3TC_DXT1_Format)return N.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return N.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return N.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return N.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}function n(a,b){var c;"fragment"===a?c=l.createShader(l.FRAGMENT_SHADER):
|
|
|
+"vertex"===a&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);return!l.getShaderParameter(c,l.COMPILE_STATUS)?(console.error(l.getShaderInfoLog(c)),console.error(m(b)),null):c}function m(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")}var a=a||{},s=void 0!==a.canvas?a.canvas:document.createElement("canvas"),u=void 0!==a.precision?a.precision:"highp",p=void 0!==a.alpha?a.alpha:!0,q=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:
|
|
|
+!0,w=void 0!==a.antialias?a.antialias:!1,v=void 0!==a.stencil?a.stencil:!0,y=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,z=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),r=void 0!==a.clearAlpha?a.clearAlpha:0;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;var E=0,D=0,l,H,F,B,N;try{if(!(l=s.getContext("experimental-webgl",{alpha:p,premultipliedAlpha:q,antialias:w,stencil:v,preserveDrawingBuffer:y})))throw"Error creating WebGL context.";
|
|
|
+}catch(A){console.error(A)}H=l.getExtension("OES_texture_float");F=l.getExtension("OES_standard_derivatives");B=l.getExtension("EXT_texture_filter_anisotropic")||l.getExtension("MOZ_EXT_texture_filter_anisotropic")||l.getExtension("WEBKIT_EXT_texture_filter_anisotropic");N=l.getExtension("WEBGL_compressed_texture_s3tc")||l.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||l.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");H||console.log("THREE.WebGLRenderer: Float textures not supported.");F||
|
|
|
+console.log("THREE.WebGLRenderer: Standard derivatives not supported.");B||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");N||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===l.getShaderPrecisionFormat&&(l.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);
|
|
|
+l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(z.r,z.g,z.b,r);l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS);a=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);l.getParameter(l.MAX_TEXTURE_SIZE);var Q=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),C=B?l.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,G=0<a,a=G&&H;N&&l.getParameter(l.COMPRESSED_TEXTURE_FORMATS);w=l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_FLOAT);p=l.getShaderPrecisionFormat(l.VERTEX_SHADER,
|
|
|
+l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_FLOAT);v=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_FLOAT);q=l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.MEDIUM_FLOAT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_FLOAT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.HIGH_INT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.MEDIUM_INT);l.getShaderPrecisionFormat(l.VERTEX_SHADER,l.LOW_INT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.HIGH_INT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,
|
|
|
+l.MEDIUM_INT);l.getShaderPrecisionFormat(l.FRAGMENT_SHADER,l.LOW_INT);w=0<w.precision&&0<v.precision;p=0<p.precision&&0<q.precision;"highp"===u&&!w&&(p?(u="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(u="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===u&&!p&&(u="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));var t={},I,M,J,x,K=-1,S=-1,aa=-1,Y=-1,V=-1,L=0,ka=0,qa=0,ra=0,X=null,U=null,T=null,$=null,
|
|
|
+ba;this.context=l;this.autoScaleCubemaps=!0;this.supportsBoneTextures=a;this.precision=u;this.maxVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS);this.getContext=function(){return l};this.getDomElement=function(){return s};this.getPrecision=function(){return u};this.getCurrentWidth=function(){return E};this.getCurrentHeight=function(){return D};this.supportsVertexTextures=function(){return G};this.supportsFloatTextures=function(){return H};this.supportsStandardDerivatives=function(){return F};
|
|
|
+this.supportsCompressedTextureS3TC=function(){return N};this.getMaxAnisotropy=function(){return C};this.setRenderTarget=j;this.setSize=function(a,b){s.width=a;s.height=b;c(0,0,s.width,s.height)};this.setViewport=c;this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){z.setHex(a);r=b;l.clearColor(z.r,z.g,z.b,r)};this.setClearColor=function(a,b){z.copy(a);r=b;l.clearColor(z.r,
|
|
|
+z.g,z.b,r)};this.getClearColor=function(){return z};this.getClearAlpha=function(){return r};this.clear=d;this.clearTarget=function(a,b,c,e){j(a);d(b,c,e)};this.deleteBuffer=function(a){l.deleteBuffer(a)};this.deleteTexture=function(a){l.deleteTexture(a)};this.deleteFramebuffer=function(a){l.deleteFramebuffer(a)};this.deleteRenderbuffer=function(a){l.deleteRenderbuffer(a)};this.deleteProgram=function(a){l.deleteProgram(a)};this.createBuffer=function(){return l.createBuffer()};this.setStaticArrayBuffer=
|
|
|
+function(a,b){e(a);l.bufferData(l.ARRAY_BUFFER,b,l.STATIC_DRAW)};this.setStaticIndexBuffer=function(a,b){f(a);l.bufferData(l.ELEMENT_ARRAY_BUFFER,b,l.STATIC_DRAW)};this.setDynamicArrayBuffer=function(a,b){e(a);l.bufferData(l.ARRAY_BUFFER,b,l.DYNAMIC_DRAW)};this.setDynamicIndexBuffer=function(a,b){f(a);l.bufferData(l.ELEMENT_ARRAY_BUFFER,b,l.DYNAMIC_DRAW)};this.drawTriangles=function(a){l.drawArrays(l.TRIANGLES,0,a)};this.drawTriangleStrip=function(a){l.drawArrays(l.TRIANGLE_STRIP,0,a)};this.drawLines=
|
|
|
+function(a){l.drawArrays(l.LINES,0,a)};this.drawLineStrip=function(a){l.drawArrays(l.LINE_STRIP,0,a)};this.drawPoints=function(a){l.drawArrays(l.POINTS,0,a)};this.drawTriangleElements=function(a,b,c){f(a);l.drawElements(l.TRIANGLES,b,l.UNSIGNED_SHORT,c)};this.drawLineElements=function(a,b,c){f(a);l.drawElements(l.LINES,b,l.UNSIGNED_SHORT,c)};this.bindArrayBuffer=e;this.bindElementArrayBuffer=f;this.enableAttribute=g;this.disableAttributes=function(){for(var a in t)t[a]&&(l.disableVertexAttribArray(a),
|
|
|
+t[a]=!1)};this.getAttribLocation=function(a,b){return l.getAttribLocation(a,b)};this.setFloatAttribute=function(a,b,c,d){e(b);g(a);l.vertexAttribPointer(a,c,l.FLOAT,!1,0,d)};this.getUniformLocation=function(a,b){return l.getUniformLocation(a,b)};this.uniform1i=function(a,b){l.uniform1i(a,b)};this.uniform1f=function(a,b){l.uniform1f(a,b)};this.uniform2f=function(a,b,c){l.uniform2f(a,b,c)};this.uniform3f=function(a,b,c,d){l.uniform3f(a,b,c,d)};this.uniform4f=function(a,b,c,d,e){l.uniform4f(a,b,c,d,
|
|
|
+e)};this.uniform1iv=function(a,b){l.uniform1iv(a,b)};this.uniform2iv=function(a,b){l.uniform2iv(a,b)};this.uniform3iv=function(a,b){l.uniform3iv(a,b)};this.uniform1fv=function(a,b){l.uniform1fv(a,b)};this.uniform2fv=function(a,b){l.uniform2fv(a,b)};this.uniform3fv=function(a,b){l.uniform3fv(a,b)};this.uniform4fv=function(a,b){l.uniform3fv(a,b)};this.uniformMatrix3fv=function(a,b){l.uniformMatrix3fv(a,!1,b)};this.uniformMatrix4fv=function(a,b){l.uniformMatrix4fv(a,!1,b)};this.useProgram=function(a){l.useProgram(a)};
|
|
|
+this.compileShader=function(a,b){var c=l.createProgram(),d=n("fragment",b),e=n("vertex",a);l.attachShader(c,e);l.attachShader(c,d);l.linkProgram(c);l.getProgramParameter(c,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(c,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");l.deleteShader(d);l.deleteShader(e);return c};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?l.disable(l.CULL_FACE):(b===THREE.FrontFaceDirectionCW?l.frontFace(l.CW):
|
|
|
+l.frontFace(l.CCW),a===THREE.CullFaceBack?l.cullFace(l.BACK):a===THREE.CullFaceFront?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;K!==b&&(b?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),K=b);S!==a&&(a?l.frontFace(l.CW):l.frontFace(l.CCW),S=a)};this.setPolygonOffset=function(a,b,c){X!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),X=a);if(a&&(U!==b||T!==c))l.polygonOffset(b,
|
|
|
+c),U=b,T=c};this.setBlending=function(a,b,c,d){a!==I&&(a===THREE.NoBlending?l.disable(l.BLEND):a===THREE.AdditiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):a===THREE.SubtractiveBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(l.enable(l.BLEND),l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):a===THREE.CustomBlending?l.enable(l.BLEND):(l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,
|
|
|
+l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),I=a);if(a===THREE.CustomBlending){if(b!==M&&(l.blendEquation(k(b)),M=b),c!==J||d!==x)l.blendFunc(k(c),k(d)),J=c,x=d}else x=J=M=null};this.setDepthTest=function(a){aa!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),aa=a)};this.setDepthWrite=function(a){Y!==a&&(l.depthMask(a),Y=a)};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.__webglTexture=l.createTexture());
|
|
|
+l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);l.pixelStorei(l.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=k(a.format),f=k(a.type);h(l.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var i=0,j=g.length;i<j;i++)c=g[i],l.texImage2D(l.TEXTURE_2D,i,e,c.width,c.height,
|
|
|
+0,e,f,c.data);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){i=0;for(j=g.length;i<j;i++)c=g[i],l.compressedTexImage2D(l.TEXTURE_2D,i,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){i=0;for(j=g.length;i<j;i++)c=g[i],l.texImage2D(l.TEXTURE_2D,i,e,e,f,c);a.generateMipmaps=!1}else l.texImage2D(l.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+
|
|
|
+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setCubeTexture=function(a,b){if(6===a.image.length)if(a.needsUpdate){a.image.__webglTextureCube||(a.image.__webglTextureCube=l.createTexture());l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_CUBE_MAP,a.image.__webglTextureCube);l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,a.flipY);for(var c=a instanceof THREE.CompressedTexture,d=[],e=0;6>e;e++)if(c)d[e]=a.image[e];else{var f=d,g=e,i;i=a.image[e];var j=Q;if(!(i.width<=j&&i.height<=j)){var m=Math.max(i.width,
|
|
|
+i.height),n=Math.floor(i.width*j/m),j=Math.floor(i.height*j/m),m=document.createElement("canvas");m.width=n;m.height=j;m.getContext("2d").drawImage(i,0,0,i.width,i.height,0,0,n,j);i=m}f[g]=i}e=d[0];f=0===(e.width&e.width-1)&&0===(e.height&e.height-1);g=k(a.format);i=k(a.type);h(l.TEXTURE_CUBE_MAP,a,f);for(e=0;6>e;e++)if(c)for(var j=d[e].mipmaps,m=0,p=j.length;m<p;m++)n=j[m],l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+e,m,g,n.width,n.height,0,n.data);else l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+e,0,g,g,i,d[e]);a.generateMipmaps&&f&&l.generateMipmap(l.TEXTURE_CUBE_MAP);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_CUBE_MAP,a.image.__webglTextureCube)};this.updateRenderTargetMipmap=function(a){a instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,a.__webglTexture),l.generateMipmap(l.TEXTURE_2D),
|
|
|
+l.bindTexture(l.TEXTURE_2D,null))};this.setCubeTextureDynamic=function(a,b){l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture)};this.paramThreeToGL=k;this.setLineWidth=function(a){a!==V&&(l.lineWidth(a),V=a)};this.resetState=function(){S=K=Y=aa=I=-1}};THREE.WebGLRenderer.ShaderBuilder=function(a,b){this.renderer=a;this.info=b;this.programs=[];this.programs_counter=0};
|
|
|
+THREE.WebGLRenderer.ShaderBuilder.prototype.buildProgram=function(a,b,c,d,e,f,g){var h=this.renderer,i,j,k=[];a?k.push(a):(k.push(b),k.push(c));for(j in f)k.push(j),k.push(f[j]);for(i in g)k.push(i),k.push(g[i]);a=k.join();i=0;for(j=this.programs.length;i<j;i++)if(k=this.programs[i],k.code===a)return k.usedTimes++,k.program;i="SHADOWMAP_TYPE_BASIC";g.shadowMapType===THREE.PCFShadowMap?i="SHADOWMAP_TYPE_PCF":g.shadowMapType===THREE.PCFSoftShadowMap&&(i="SHADOWMAP_TYPE_PCF_SOFT");j=this.generateDefines(f);
|
|
|
+f=["precision "+h.precision+" float;",j,h.supportsVertexTextures?"#define VERTEX_TEXTURES":"",g.gammaInput?"#define GAMMA_INPUT":"",g.gammaOutput?"#define GAMMA_OUTPUT":"",g.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+g.maxDirLights,"#define MAX_POINT_LIGHTS "+g.maxPointLights,"#define MAX_SPOT_LIGHTS "+g.maxSpotLights,"#define MAX_HEMI_LIGHTS "+g.maxHemiLights,"#define MAX_SHADOWS "+g.maxShadows,"#define MAX_BONES "+g.maxBones,g.map?"#define USE_MAP":"",
|
|
|
+g.envMap?"#define USE_ENVMAP":"",g.lightMap?"#define USE_LIGHTMAP":"",g.bumpMap?"#define USE_BUMPMAP":"",g.normalMap?"#define USE_NORMALMAP":"",g.specularMap?"#define USE_SPECULARMAP":"",g.vertexColors?"#define USE_COLOR":"",g.skinning?"#define USE_SKINNING":"",g.useVertexTexture?"#define BONE_TEXTURE":"",g.boneTextureWidth?"#define N_BONE_PIXEL_X "+g.boneTextureWidth.toFixed(1):"",g.boneTextureHeight?"#define N_BONE_PIXEL_Y "+g.boneTextureHeight.toFixed(1):"",g.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
+"",g.morphNormals?"#define USE_MORPHNORMALS":"",g.perPixel?"#define PHONG_PER_PIXEL":"",g.wrapAround?"#define WRAP_AROUND":"",g.doubleSided?"#define DOUBLE_SIDED":"",g.flipSided?"#define FLIP_SIDED":"",g.shadowMapEnabled?"#define USE_SHADOWMAP":"",g.shadowMapEnabled?"#define "+i:"",g.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",g.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",g.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+i=["precision "+h.precision+" float;",g.bumpMap||g.normalMap?"#extension GL_OES_standard_derivatives : enable":"",j,"#define MAX_DIR_LIGHTS "+g.maxDirLights,"#define MAX_POINT_LIGHTS "+g.maxPointLights,"#define MAX_SPOT_LIGHTS "+g.maxSpotLights,"#define MAX_HEMI_LIGHTS "+g.maxHemiLights,"#define MAX_SHADOWS "+g.maxShadows,g.alphaTest?"#define ALPHATEST "+g.alphaTest:"",g.gammaInput?"#define GAMMA_INPUT":"",g.gammaOutput?"#define GAMMA_OUTPUT":"",g.useFog&&g.fog?"#define USE_FOG":"",g.useFog&&g.fogExp?
|
|
|
+"#define FOG_EXP2":"",g.map?"#define USE_MAP":"",g.envMap?"#define USE_ENVMAP":"",g.lightMap?"#define USE_LIGHTMAP":"",g.bumpMap?"#define USE_BUMPMAP":"",g.normalMap?"#define USE_NORMALMAP":"",g.specularMap?"#define USE_SPECULARMAP":"",g.vertexColors?"#define USE_COLOR":"",g.metal?"#define METAL":"",g.perPixel?"#define PHONG_PER_PIXEL":"",g.wrapAround?"#define WRAP_AROUND":"",g.doubleSided?"#define DOUBLE_SIDED":"",g.flipSided?"#define FLIP_SIDED":"",g.shadowMapEnabled?"#define USE_SHADOWMAP":"",
|
|
|
+g.shadowMapEnabled?"#define "+i:"",g.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",g.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");b=h.compileShader(f+c,i+b);b.uniforms={};b.attributes={};var n,m,c="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");g.useVertexTexture?c.push("boneTexture"):c.push("boneGlobalMatrices");for(n in d)c.push(n);this.cacheUniformLocations(b,
|
|
|
+c);c="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(d=0;d<g.maxMorphTargets;d++)c.push("morphTarget"+d);for(d=0;d<g.maxMorphNormals;d++)c.push("morphNormal"+d);for(m in e)c.push(m);this.cacheAttributeLocations(b,c);b.id=this.programs_counter++;this.programs.push({program:b,code:a,usedTimes:1});this.info.memory.programs=this.programs.length;return b};
|
|
|
+THREE.WebGLRenderer.ShaderBuilder.prototype.generateDefines=function(a){var b,c=[],d;for(d in a)b=a[d],!1!==b&&(b="#define "+d+" "+b,c.push(b));return c.join("\n")};THREE.WebGLRenderer.ShaderBuilder.prototype.cacheUniformLocations=function(a,b){var c,d,e,f=this.renderer;c=0;for(d=b.length;c<d;c++)e=b[c],a.uniforms[e]=f.getUniformLocation(a,e)};
|
|
|
+THREE.WebGLRenderer.ShaderBuilder.prototype.cacheAttributeLocations=function(a,b){var c,d,e,f=this.renderer;c=0;for(d=b.length;c<d;c++)e=b[c],a.attributes[e]=f.getAttribLocation(a,e)};THREE.WebGLRenderer.ShaderBuilder.prototype.removeProgram=function(a){var b,c,d,e=!1,f=this.programs;b=0;for(c=f.length;b<c;b++)if(d=f[b],d.program===a){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];b=0;for(c=f.length;b<c;b++)d=f[b],d.program!==a&&e.push(d);this.renderer.deleteProgram(a);this.info.memory.programs--}};THREE.WebGLRenderer.Object3DRenderer=function(a,b){this.renderer=a;this.info=b};THREE.WebGLRenderer.Object3DRenderer.prototype.getBufferMaterial=function(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material};THREE.WebGLRenderer.Object3DRenderer.prototype.bufferGuessUVType=function(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1};
|
|
|
+THREE.WebGLRenderer.Object3DRenderer.prototype.bufferGuessNormalType=function(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:this.materialNeedsSmoothNormals(a)?THREE.SmoothShading:THREE.FlatShading};THREE.WebGLRenderer.Object3DRenderer.prototype.materialNeedsSmoothNormals=function(a){return a&&void 0!==a.shading&&a.shading===THREE.SmoothShading};
|
|
|
+THREE.WebGLRenderer.Object3DRenderer.prototype.bufferGuessVertexColorType=function(a){return a.vertexColors?a.vertexColors:!1};
|
|
|
+THREE.WebGLRenderer.Object3DRenderer.prototype.initCustomAttributes=function(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=this.renderer.createBuffer();f.buffer.belongsToAttribute=
|
|
|
+e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}};THREE.WebGLRenderer.Object3DRenderer.prototype.numericalSort=function(a,b){return b[0]-a[0]};THREE.WebGLRenderer.MeshRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.MeshRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);
|
|
|
+THREE.WebGLRenderer.MeshRenderer.prototype.createBuffers=function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglNormalBuffer=b.createBuffer();a.__webglTangentBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();a.__webglUVBuffer=b.createBuffer();a.__webglUV2Buffer=b.createBuffer();a.__webglSkinIndicesBuffer=b.createBuffer();a.__webglSkinWeightsBuffer=b.createBuffer();a.__webglFaceBuffer=b.createBuffer();a.__webglLineBuffer=b.createBuffer();var c,d;if(a.numMorphTargets){a.__webglMorphTargetsBuffers=
|
|
|
+[];c=0;for(d=a.numMorphTargets;c<d;c++)a.__webglMorphTargetsBuffers.push(b.createBuffer())}if(a.numMorphNormals){a.__webglMorphNormalsBuffers=[];c=0;for(d=a.numMorphNormals;c<d;c++)a.__webglMorphNormalsBuffers.push(b.createBuffer())}this.info.memory.geometries++};
|
|
|
+THREE.WebGLRenderer.MeshRenderer.prototype.initBuffers=function(a,b){var c=b.geometry,d=a.faces3,e=a.faces4,f=3*d.length+4*e.length,g=1*d.length+2*e.length,e=3*d.length+4*e.length,d=this.getBufferMaterial(b,a),h=this.bufferGuessUVType(d),i=this.bufferGuessNormalType(d),j=this.bufferGuessVertexColorType(d);a.__vertexArray=new Float32Array(3*f);i&&(a.__normalArray=new Float32Array(3*f));c.hasTangents&&(a.__tangentArray=new Float32Array(4*f));j&&(a.__colorArray=new Float32Array(3*f));if(h){if(0<c.faceUvs.length||
|
|
|
+0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*f);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*f)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*f),a.__skinWeightArray=new Float32Array(4*f));a.__faceArray=new Uint16Array(3*g);a.__lineArray=new Uint16Array(2*e);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(h=a.numMorphTargets;c<h;c++)a.__morphTargetsArrays.push(new Float32Array(3*f))}if(a.numMorphNormals){a.__morphNormalsArrays=
|
|
|
+[];c=0;for(h=a.numMorphNormals;c<h;c++)a.__morphNormalsArrays.push(new Float32Array(3*f))}a.__webglFaceCount=3*g;a.__webglLineCount=2*e;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var k in d.attributes){var g=d.attributes[k],c={},n;for(n in g)c[n]=g[n];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,e=1,"v2"===c.type?e=2:"v3"===c.type?e=3:"v4"===c.type?e=4:"c"===c.type&&(e=3),c.size=e,c.array=new Float32Array(f*e),c.buffer=
|
|
|
+this.renderer.createBuffer(),c.buffer.belongsToAttribute=k,g.needsUpdate=!0,c.__original=g;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0};
|
|
|
+THREE.WebGLRenderer.MeshRenderer.prototype.setBuffers=function(a,b,c,d){if(a.__inittedArrays){var e=this.renderer,f=this.bufferGuessNormalType(d),g=this.bufferGuessVertexColorType(d),h=this.bufferGuessUVType(d),i=f===THREE.SmoothShading,j,k,n,m,s,u,p,q,w,v,y,z,r,E,D,l,H,F,B,N,A,Q,C,G,t=N=A=F=0,I=0,M=n=B=0,J=s=y=0,x=0,J=a.__vertexArray,K=a.__uvArray,x=a.__uv2Array,S=a.__normalArray;m=a.__tangentArray;z=a.__colorArray;r=a.__skinIndexArray;E=a.__skinWeightArray;l=a.__morphTargetsArrays;H=a.__morphNormalsArrays;
|
|
|
+var aa=a.__webglCustomAttributesList,Y=a.__faceArray,V=a.__lineArray;p=b.geometry;var L=p.elementsNeedUpdate,ka=p.uvsNeedUpdate,qa=p.normalsNeedUpdate,ra=p.tangentsNeedUpdate;D=p.colorsNeedUpdate;Q=p.morphTargetsNeedUpdate;G=p.vertices;var X=a.faces3,U=a.faces4,T=p.faces,$=p.faceVertexUvs[0],ba=p.faceVertexUvs[1];u=p.skinIndices;var P=p.skinWeights,Z=p.morphTargets,ca=p.morphNormals;if(p.verticesNeedUpdate){b=0;for(j=X.length;b<j;b++)k=T[X[b]],q=G[k.a],w=G[k.b],v=G[k.c],J[A]=q.x,J[A+1]=q.y,J[A+2]=
|
|
|
+q.z,J[A+3]=w.x,J[A+4]=w.y,J[A+5]=w.z,J[A+6]=v.x,J[A+7]=v.y,J[A+8]=v.z,A+=9;b=0;for(j=U.length;b<j;b++)k=T[U[b]],q=G[k.a],w=G[k.b],v=G[k.c],k=G[k.d],J[A]=q.x,J[A+1]=q.y,J[A+2]=q.z,J[A+3]=w.x,J[A+4]=w.y,J[A+5]=w.z,J[A+6]=v.x,J[A+7]=v.y,J[A+8]=v.z,J[A+9]=k.x,J[A+10]=k.y,J[A+11]=k.z,A+=12;e.setDynamicArrayBuffer(a.__webglVertexBuffer,J)}if(Q){A=0;for(Q=Z.length;A<Q;A++){b=J=0;for(j=X.length;b<j;b++)G=X[b],k=T[G],q=Z[A].vertices[k.a],w=Z[A].vertices[k.b],v=Z[A].vertices[k.c],C=l[A],C[J]=q.x,C[J+1]=q.y,
|
|
|
+C[J+2]=q.z,C[J+3]=w.x,C[J+4]=w.y,C[J+5]=w.z,C[J+6]=v.x,C[J+7]=v.y,C[J+8]=v.z,d.morphNormals&&(i?(v=ca[A].vertexNormals[G],k=v.a,q=v.b,w=v.c):w=q=k=ca[A].faceNormals[G],G=H[A],G[J]=k.x,G[J+1]=k.y,G[J+2]=k.z,G[J+3]=q.x,G[J+4]=q.y,G[J+5]=q.z,G[J+6]=w.x,G[J+7]=w.y,G[J+8]=w.z),J+=9;b=0;for(j=U.length;b<j;b++)G=U[b],k=T[G],q=Z[A].vertices[k.a],w=Z[A].vertices[k.b],v=Z[A].vertices[k.c],k=Z[A].vertices[k.d],C=l[A],C[J]=q.x,C[J+1]=q.y,C[J+2]=q.z,C[J+3]=w.x,C[J+4]=w.y,C[J+5]=w.z,C[J+6]=v.x,C[J+7]=v.y,C[J+8]=
|
|
|
+v.z,C[J+9]=k.x,C[J+10]=k.y,C[J+11]=k.z,d.morphNormals&&(i?(v=ca[A].vertexNormals[G],k=v.a,q=v.b,w=v.c,v=v.d):v=w=q=k=ca[A].faceNormals[G],G=H[A],G[J]=k.x,G[J+1]=k.y,G[J+2]=k.z,G[J+3]=q.x,G[J+4]=q.y,G[J+5]=q.z,G[J+6]=w.x,G[J+7]=w.y,G[J+8]=w.z,G[J+9]=v.x,G[J+10]=v.y,G[J+11]=v.z),J+=12;this.renderer.setDynamicArrayBuffer(a.__webglMorphTargetsBuffers[A],l[A]);d.morphNormals&&this.renderer.setDynamicArrayBuffer(a.__webglMorphNormalsBuffers[A],H[A])}}if(P.length){b=0;for(j=X.length;b<j;b++)k=T[X[b]],d=
|
|
|
+P[k.a],l=P[k.b],H=P[k.c],E[s]=d.x,E[s+1]=d.y,E[s+2]=d.z,E[s+3]=d.w,E[s+4]=l.x,E[s+5]=l.y,E[s+6]=l.z,E[s+7]=l.w,E[s+8]=H.x,E[s+9]=H.y,E[s+10]=H.z,E[s+11]=H.w,d=u[k.a],l=u[k.b],H=u[k.c],r[s]=d.x,r[s+1]=d.y,r[s+2]=d.z,r[s+3]=d.w,r[s+4]=l.x,r[s+5]=l.y,r[s+6]=l.z,r[s+7]=l.w,r[s+8]=H.x,r[s+9]=H.y,r[s+10]=H.z,r[s+11]=H.w,s+=12;b=0;for(j=U.length;b<j;b++)k=T[U[b]],d=P[k.a],l=P[k.b],H=P[k.c],q=P[k.d],E[s]=d.x,E[s+1]=d.y,E[s+2]=d.z,E[s+3]=d.w,E[s+4]=l.x,E[s+5]=l.y,E[s+6]=l.z,E[s+7]=l.w,E[s+8]=H.x,E[s+9]=H.y,
|
|
|
+E[s+10]=H.z,E[s+11]=H.w,E[s+12]=q.x,E[s+13]=q.y,E[s+14]=q.z,E[s+15]=q.w,d=u[k.a],l=u[k.b],H=u[k.c],k=u[k.d],r[s]=d.x,r[s+1]=d.y,r[s+2]=d.z,r[s+3]=d.w,r[s+4]=l.x,r[s+5]=l.y,r[s+6]=l.z,r[s+7]=l.w,r[s+8]=H.x,r[s+9]=H.y,r[s+10]=H.z,r[s+11]=H.w,r[s+12]=k.x,r[s+13]=k.y,r[s+14]=k.z,r[s+15]=k.w,s+=16;0<s&&(e.setDynamicArrayBuffer(a.__webglSkinIndicesBuffer,r),e.setDynamicArrayBuffer(a.__webglSkinWeightsBuffer,E))}if(D&&g){b=0;for(j=X.length;b<j;b++)k=T[X[b]],s=k.vertexColors,u=k.color,3===s.length&&g===THREE.VertexColors?
|
|
|
+(r=s[0],E=s[1],D=s[2]):D=E=r=u,z[y]=r.r,z[y+1]=r.g,z[y+2]=r.b,z[y+3]=E.r,z[y+4]=E.g,z[y+5]=E.b,z[y+6]=D.r,z[y+7]=D.g,z[y+8]=D.b,y+=9;b=0;for(j=U.length;b<j;b++)k=T[U[b]],s=k.vertexColors,u=k.color,4===s.length&&g===THREE.VertexColors?(r=s[0],E=s[1],D=s[2],s=s[3]):s=D=E=r=u,z[y]=r.r,z[y+1]=r.g,z[y+2]=r.b,z[y+3]=E.r,z[y+4]=E.g,z[y+5]=E.b,z[y+6]=D.r,z[y+7]=D.g,z[y+8]=D.b,z[y+9]=s.r,z[y+10]=s.g,z[y+11]=s.b,y+=12;0<y&&e.setDynamicArrayBuffer(a.__webglColorBuffer,z)}if(ra&&p.hasTangents){b=0;for(j=X.length;b<
|
|
|
+j;b++)k=T[X[b]],p=k.vertexTangents,g=p[0],y=p[1],z=p[2],m[n]=g.x,m[n+1]=g.y,m[n+2]=g.z,m[n+3]=g.w,m[n+4]=y.x,m[n+5]=y.y,m[n+6]=y.z,m[n+7]=y.w,m[n+8]=z.x,m[n+9]=z.y,m[n+10]=z.z,m[n+11]=z.w,n+=12;b=0;for(j=U.length;b<j;b++)k=T[U[b]],p=k.vertexTangents,g=p[0],y=p[1],z=p[2],p=p[3],m[n]=g.x,m[n+1]=g.y,m[n+2]=g.z,m[n+3]=g.w,m[n+4]=y.x,m[n+5]=y.y,m[n+6]=y.z,m[n+7]=y.w,m[n+8]=z.x,m[n+9]=z.y,m[n+10]=z.z,m[n+11]=z.w,m[n+12]=p.x,m[n+13]=p.y,m[n+14]=p.z,m[n+15]=p.w,n+=16;e.setDynamicArrayBuffer(a.__webglTangentBuffer,
|
|
|
+m)}if(qa&&f){b=0;for(j=X.length;b<j;b++)if(k=T[X[b]],n=k.vertexNormals,m=k.normal,3===n.length&&i)for(f=0;3>f;f++)m=n[f],S[B]=m.x,S[B+1]=m.y,S[B+2]=m.z,B+=3;else for(f=0;3>f;f++)S[B]=m.x,S[B+1]=m.y,S[B+2]=m.z,B+=3;b=0;for(j=U.length;b<j;b++)if(k=T[U[b]],n=k.vertexNormals,m=k.normal,4===n.length&&i)for(f=0;4>f;f++)m=n[f],S[B]=m.x,S[B+1]=m.y,S[B+2]=m.z,B+=3;else for(f=0;4>f;f++)S[B]=m.x,S[B+1]=m.y,S[B+2]=m.z,B+=3;e.setDynamicArrayBuffer(a.__webglNormalBuffer,S)}if(ka&&$&&h){b=0;for(j=X.length;b<j;b++)if(i=
|
|
|
+X[b],i=$[i],void 0!==i)for(f=0;3>f;f++)B=i[f],K[N]=B.x,K[N+1]=B.y,N+=2;b=0;for(j=U.length;b<j;b++)if(i=U[b],i=$[i],void 0!==i)for(f=0;4>f;f++)B=i[f],K[N]=B.x,K[N+1]=B.y,N+=2;0<N&&e.setDynamicArrayBuffer(a.__webglUVBuffer,K)}if(ka&&ba&&h){b=0;for(j=X.length;b<j;b++)if(i=X[b],h=ba[i],void 0!==h)for(f=0;3>f;f++)N=h[f],x[t]=N.x,x[t+1]=N.y,t+=2;b=0;for(j=U.length;b<j;b++)if(i=U[b],h=ba[i],void 0!==h)for(f=0;4>f;f++)N=h[f],x[t]=N.x,x[t+1]=N.y,t+=2;0<t&&e.setDynamicArrayBuffer(a.__webglUV2Buffer,x)}if(L){b=
|
|
|
+0;for(j=X.length;b<j;b++)Y[I]=F,Y[I+1]=F+1,Y[I+2]=F+2,I+=3,V[M]=F,V[M+1]=F+1,V[M+2]=F,V[M+3]=F+2,V[M+4]=F+1,V[M+5]=F+2,M+=6,F+=3;b=0;for(j=U.length;b<j;b++)Y[I]=F,Y[I+1]=F+1,Y[I+2]=F+3,Y[I+3]=F+1,Y[I+4]=F+2,Y[I+5]=F+3,I+=6,V[M]=F,V[M+1]=F+1,V[M+2]=F,V[M+3]=F+3,V[M+4]=F+1,V[M+5]=F+2,V[M+6]=F+2,V[M+7]=F+3,M+=8,F+=4;e.setDynamicIndexBuffer(a.__webglFaceBuffer,Y);e.setDynamicIndexBuffer(a.__webglLineBuffer,V)}if(aa){f=0;for(F=aa.length;f<F;f++)if(t=aa[f],t.__original.needsUpdate){x=0;if(1===t.size)if(void 0===
|
|
|
+t.boundTo||"vertices"===t.boundTo){b=0;for(j=X.length;b<j;b++)k=T[X[b]],t.array[x]=t.value[k.a],t.array[x+1]=t.value[k.b],t.array[x+2]=t.value[k.c],x+=3;b=0;for(j=U.length;b<j;b++)k=T[U[b]],t.array[x]=t.value[k.a],t.array[x+1]=t.value[k.b],t.array[x+2]=t.value[k.c],t.array[x+3]=t.value[k.d],x+=4}else{if("faces"===t.boundTo){b=0;for(j=X.length;b<j;b++)M=t.value[X[b]],t.array[x]=M,t.array[x+1]=M,t.array[x+2]=M,x+=3;b=0;for(j=U.length;b<j;b++)M=t.value[U[b]],t.array[x]=M,t.array[x+1]=M,t.array[x+2]=
|
|
|
+M,t.array[x+3]=M,x+=4}}else if(2===t.size)if(void 0===t.boundTo||"vertices"===t.boundTo){b=0;for(j=X.length;b<j;b++)k=T[X[b]],q=t.value[k.a],w=t.value[k.b],v=t.value[k.c],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=w.x,t.array[x+3]=w.y,t.array[x+4]=v.x,t.array[x+5]=v.y,x+=6;b=0;for(j=U.length;b<j;b++)k=T[U[b]],q=t.value[k.a],w=t.value[k.b],v=t.value[k.c],k=t.value[k.d],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=w.x,t.array[x+3]=w.y,t.array[x+4]=v.x,t.array[x+5]=v.y,t.array[x+6]=k.x,t.array[x+7]=
|
|
|
+k.y,x+=8}else{if("faces"===t.boundTo){b=0;for(j=X.length;b<j;b++)v=w=q=M=t.value[X[b]],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=w.x,t.array[x+3]=w.y,t.array[x+4]=v.x,t.array[x+5]=v.y,x+=6;b=0;for(j=U.length;b<j;b++)k=v=w=q=M=t.value[U[b]],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=w.x,t.array[x+3]=w.y,t.array[x+4]=v.x,t.array[x+5]=v.y,t.array[x+6]=k.x,t.array[x+7]=k.y,x+=8}}else if(3===t.size)if(I="c"===t.type?["r","g","b"]:["x","y","z"],void 0===t.boundTo||"vertices"===t.boundTo){b=0;for(j=
|
|
|
+X.length;b<j;b++)k=T[X[b]],q=t.value[k.a],w=t.value[k.b],v=t.value[k.c],t.array[x]=q[I[0]],t.array[x+1]=q[I[1]],t.array[x+2]=q[I[2]],t.array[x+3]=w[I[0]],t.array[x+4]=w[I[1]],t.array[x+5]=w[I[2]],t.array[x+6]=v[I[0]],t.array[x+7]=v[I[1]],t.array[x+8]=v[I[2]],x+=9;b=0;for(j=U.length;b<j;b++)k=T[U[b]],q=t.value[k.a],w=t.value[k.b],v=t.value[k.c],k=t.value[k.d],t.array[x]=q[I[0]],t.array[x+1]=q[I[1]],t.array[x+2]=q[I[2]],t.array[x+3]=w[I[0]],t.array[x+4]=w[I[1]],t.array[x+5]=w[I[2]],t.array[x+6]=v[I[0]],
|
|
|
+t.array[x+7]=v[I[1]],t.array[x+8]=v[I[2]],t.array[x+9]=k[I[0]],t.array[x+10]=k[I[1]],t.array[x+11]=k[I[2]],x+=12}else if("faces"===t.boundTo){b=0;for(j=X.length;b<j;b++)v=w=q=M=t.value[X[b]],t.array[x]=q[I[0]],t.array[x+1]=q[I[1]],t.array[x+2]=q[I[2]],t.array[x+3]=w[I[0]],t.array[x+4]=w[I[1]],t.array[x+5]=w[I[2]],t.array[x+6]=v[I[0]],t.array[x+7]=v[I[1]],t.array[x+8]=v[I[2]],x+=9;b=0;for(j=U.length;b<j;b++)k=v=w=q=M=t.value[U[b]],t.array[x]=q[I[0]],t.array[x+1]=q[I[1]],t.array[x+2]=q[I[2]],t.array[x+
|
|
|
+3]=w[I[0]],t.array[x+4]=w[I[1]],t.array[x+5]=w[I[2]],t.array[x+6]=v[I[0]],t.array[x+7]=v[I[1]],t.array[x+8]=v[I[2]],t.array[x+9]=k[I[0]],t.array[x+10]=k[I[1]],t.array[x+11]=k[I[2]],x+=12}else{if("faceVertices"===t.boundTo){b=0;for(j=X.length;b<j;b++)M=t.value[X[b]],q=M[0],w=M[1],v=M[2],t.array[x]=q[I[0]],t.array[x+1]=q[I[1]],t.array[x+2]=q[I[2]],t.array[x+3]=w[I[0]],t.array[x+4]=w[I[1]],t.array[x+5]=w[I[2]],t.array[x+6]=v[I[0]],t.array[x+7]=v[I[1]],t.array[x+8]=v[I[2]],x+=9;b=0;for(j=U.length;b<j;b++)M=
|
|
|
+t.value[U[b]],q=M[0],w=M[1],v=M[2],k=M[3],t.array[x]=q[I[0]],t.array[x+1]=q[I[1]],t.array[x+2]=q[I[2]],t.array[x+3]=w[I[0]],t.array[x+4]=w[I[1]],t.array[x+5]=w[I[2]],t.array[x+6]=v[I[0]],t.array[x+7]=v[I[1]],t.array[x+8]=v[I[2]],t.array[x+9]=k[I[0]],t.array[x+10]=k[I[1]],t.array[x+11]=k[I[2]],x+=12}}else if(4===t.size)if(void 0===t.boundTo||"vertices"===t.boundTo){b=0;for(j=X.length;b<j;b++)k=T[X[b]],q=t.value[k.a],w=t.value[k.b],v=t.value[k.c],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=q.z,t.array[x+
|
|
|
+3]=q.w,t.array[x+4]=w.x,t.array[x+5]=w.y,t.array[x+6]=w.z,t.array[x+7]=w.w,t.array[x+8]=v.x,t.array[x+9]=v.y,t.array[x+10]=v.z,t.array[x+11]=v.w,x+=12;b=0;for(j=U.length;b<j;b++)k=T[U[b]],q=t.value[k.a],w=t.value[k.b],v=t.value[k.c],k=t.value[k.d],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=q.z,t.array[x+3]=q.w,t.array[x+4]=w.x,t.array[x+5]=w.y,t.array[x+6]=w.z,t.array[x+7]=w.w,t.array[x+8]=v.x,t.array[x+9]=v.y,t.array[x+10]=v.z,t.array[x+11]=v.w,t.array[x+12]=k.x,t.array[x+13]=k.y,t.array[x+14]=
|
|
|
+k.z,t.array[x+15]=k.w,x+=16}else if("faces"===t.boundTo){b=0;for(j=X.length;b<j;b++)v=w=q=M=t.value[X[b]],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=q.z,t.array[x+3]=q.w,t.array[x+4]=w.x,t.array[x+5]=w.y,t.array[x+6]=w.z,t.array[x+7]=w.w,t.array[x+8]=v.x,t.array[x+9]=v.y,t.array[x+10]=v.z,t.array[x+11]=v.w,x+=12;b=0;for(j=U.length;b<j;b++)k=v=w=q=M=t.value[U[b]],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=q.z,t.array[x+3]=q.w,t.array[x+4]=w.x,t.array[x+5]=w.y,t.array[x+6]=w.z,t.array[x+7]=w.w,
|
|
|
+t.array[x+8]=v.x,t.array[x+9]=v.y,t.array[x+10]=v.z,t.array[x+11]=v.w,t.array[x+12]=k.x,t.array[x+13]=k.y,t.array[x+14]=k.z,t.array[x+15]=k.w,x+=16}else if("faceVertices"===t.boundTo){b=0;for(j=X.length;b<j;b++)M=t.value[X[b]],q=M[0],w=M[1],v=M[2],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=q.z,t.array[x+3]=q.w,t.array[x+4]=w.x,t.array[x+5]=w.y,t.array[x+6]=w.z,t.array[x+7]=w.w,t.array[x+8]=v.x,t.array[x+9]=v.y,t.array[x+10]=v.z,t.array[x+11]=v.w,x+=12;b=0;for(j=U.length;b<j;b++)M=t.value[U[b]],
|
|
|
+q=M[0],w=M[1],v=M[2],k=M[3],t.array[x]=q.x,t.array[x+1]=q.y,t.array[x+2]=q.z,t.array[x+3]=q.w,t.array[x+4]=w.x,t.array[x+5]=w.y,t.array[x+6]=w.z,t.array[x+7]=w.w,t.array[x+8]=v.x,t.array[x+9]=v.y,t.array[x+10]=v.z,t.array[x+11]=v.w,t.array[x+12]=k.x,t.array[x+13]=k.y,t.array[x+14]=k.z,t.array[x+15]=k.w,x+=16}e.setDynamicArrayBuffer(t.buffer,t.array)}}c&&(delete a.__inittedArrays,delete a.__colorArray,delete a.__normalArray,delete a.__tangentArray,delete a.__uvArray,delete a.__uv2Array,delete a.__faceArray,
|
|
|
+delete a.__vertexArray,delete a.__lineArray,delete a.__skinIndexArray,delete a.__skinWeightArray)}};THREE.WebGLRenderer.ParticleRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.ParticleRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);THREE.WebGLRenderer.ParticleRenderer.prototype.createBuffers=function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();this.info.memory.geometries++};
|
|
|
+THREE.WebGLRenderer.ParticleRenderer.prototype.initBuffers=function(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c);a.__colorArray=new Float32Array(3*c);a.__sortArray=[];a.__webglParticleCount=c;this.initCustomAttributes(a,b)};
|
|
|
+THREE.WebGLRenderer.ParticleRenderer.prototype.setBuffers=function(a,b,c){var d=this.renderer,e,f,g,h;e=a.vertices;h=e.length;var i=a.colors,j=i.length,k=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,s=a.verticesNeedUpdate,u=a.colorsNeedUpdate,p=a.__webglCustomAttributesList;g=THREE.WebGLRenderer.ParticleRenderer._m1;var q=THREE.WebGLRenderer.ParticleRenderer._v1;if(b.sortParticles){g.multiplyMatrices(c,b.matrixWorld);for(c=0;c<h;c++)f=e[c],q.copy(f),q.applyProjection(g),m[c]=[q.z,c];m.sort(this.numericalSort);
|
|
|
+for(c=0;c<h;c++)f=e[m[c][1]],g=3*c,k[g]=f.x,k[g+1]=f.y,k[g+2]=f.z;for(e=0;e<j;e++)g=3*e,h=i[m[e][1]],n[g]=h.r,n[g+1]=h.g,n[g+2]=h.b;if(p){i=0;for(j=p.length;i<j;i++)if(c=p[i],void 0===c.boundTo||"vertices"===c.boundTo)if(g=0,h=c.value.length,1===c.size)for(e=0;e<h;e++)f=m[e][1],c.array[e]=c.value[f];else if(2===c.size)for(e=0;e<h;e++)f=m[e][1],f=c.value[f],c.array[g]=f.x,c.array[g+1]=f.y,g+=2;else if(3===c.size)if("c"===c.type)for(e=0;e<h;e++)f=m[e][1],f=c.value[f],c.array[g]=f.r,c.array[g+1]=f.g,
|
|
|
+c.array[g+2]=f.b,g+=3;else for(e=0;e<h;e++)f=m[e][1],f=c.value[f],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,g+=3;else if(4===c.size)for(e=0;e<h;e++)f=m[e][1],f=c.value[f],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,c.array[g+3]=f.w,g+=4}}else{if(s)for(c=0;c<h;c++)f=e[c],g=3*c,k[g]=f.x,k[g+1]=f.y,k[g+2]=f.z;if(u)for(e=0;e<j;e++)h=i[e],g=3*e,n[g]=h.r,n[g+1]=h.g,n[g+2]=h.b;if(p){i=0;for(j=p.length;i<j;i++)if(c=p[i],c.needsUpdate&&(void 0===c.boundTo||"vertices"===c.boundTo))if(h=c.value.length,
|
|
|
+g=0,1===c.size)for(e=0;e<h;e++)c.array[e]=c.value[e];else if(2===c.size)for(e=0;e<h;e++)f=c.value[e],c.array[g]=f.x,c.array[g+1]=f.y,g+=2;else if(3===c.size)if("c"===c.type)for(e=0;e<h;e++)f=c.value[e],c.array[g]=f.r,c.array[g+1]=f.g,c.array[g+2]=f.b,g+=3;else for(e=0;e<h;e++)f=c.value[e],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,g+=3;else if(4===c.size)for(e=0;e<h;e++)f=c.value[e],c.array[g]=f.x,c.array[g+1]=f.y,c.array[g+2]=f.z,c.array[g+3]=f.w,g+=4}}(s||b.sortParticles)&&d.setDynamicArrayBuffer(a.__webglVertexBuffer,
|
|
|
+k);(u||b.sortParticles)&&d.setDynamicArrayBuffer(a.__webglColorBuffer,n);if(p){i=0;for(j=p.length;i<j;i++)c=p[i],(c.needsUpdate||b.sortParticles)&&d.setDynamicArrayBuffer(c.buffer,c.array)}};THREE.WebGLRenderer.ParticleRenderer._m1=new THREE.Matrix4;THREE.WebGLRenderer.ParticleRenderer._v1=new THREE.Vector3;THREE.WebGLRenderer.LineRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.LineRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);THREE.WebGLRenderer.LineRenderer.prototype.createBuffers=function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();a.__webglLineDistanceBuffer=b.createBuffer();this.info.memory.geometries++};
|
|
|
+THREE.WebGLRenderer.LineRenderer.prototype.initBuffers=function(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c);a.__colorArray=new Float32Array(3*c);a.__lineDistanceArray=new Float32Array(1*c);a.__webglLineCount=c;this.initCustomAttributes(a,b)};
|
|
|
+THREE.WebGLRenderer.LineRenderer.prototype.setBuffers=function(a){var b=this.renderer,c,d,e,f=a.vertices,g=a.colors,h=a.lineDistances,i=f.length,j=g.length,k=h.length,n=a.__vertexArray,m=a.__colorArray,s=a.__lineDistanceArray,u=a.colorsNeedUpdate,p=a.lineDistancesNeedUpdate,q=a.__webglCustomAttributesList;if(a.verticesNeedUpdate){for(c=0;c<i;c++)e=f[c],d=3*c,n[d]=e.x,n[d+1]=e.y,n[d+2]=e.z;b.setDynamicArrayBuffer(a.__webglVertexBuffer,n)}if(u){for(c=0;c<j;c++)e=g[c],d=3*c,m[d]=e.r,m[d+1]=e.g,m[d+2]=
|
|
|
+e.b;b.setDynamicArrayBuffer(a.__webglColorBuffer,m)}if(p){for(d=0;d<k;d++)s[d]=h[d];b.setDynamicArrayBuffer(a.__webglLineDistanceBuffer,s)}if(q){a=0;for(h=q.length;a<h;a++)if(j=q[a],j.needsUpdate&&(void 0===j.boundTo||"vertices"===j.boundTo)){d=0;s=j.value.length;if(1===j.size)for(k=0;k<s;k++)j.array[k]=j.value[k];else if(2===j.size)for(k=0;k<s;k++)g=j.value[k],j.array[d]=g.x,j.array[d+1]=g.y,d+=2;else if(3===j.size)if("c"===j.type)for(k=0;k<s;k++)g=j.value[k],j.array[d]=g.r,j.array[d+1]=g.g,j.array[d+
|
|
|
+2]=g.b,d+=3;else for(k=0;k<s;k++)g=j.value[k],j.array[d]=g.x,j.array[d+1]=g.y,j.array[d+2]=g.z,d+=3;else if(4===j.size)for(k=0;k<s;k++)g=j.value[k],j.array[d]=g.x,j.array[d+1]=g.y,j.array[d+2]=g.z,j.array[d+3]=g.w,d+=4;b.setDynamicArrayBuffer(j.buffer,j.array)}}};THREE.WebGLRenderer.RibbonRenderer=function(a,b){THREE.WebGLRenderer.Object3DRenderer.call(this,a,b)};THREE.WebGLRenderer.RibbonRenderer.prototype=Object.create(THREE.WebGLRenderer.Object3DRenderer.prototype);THREE.WebGLRenderer.RibbonRenderer.prototype.createBuffers=function(a){var b=this.renderer;a.__webglVertexBuffer=b.createBuffer();a.__webglColorBuffer=b.createBuffer();a.__webglNormalBuffer=b.createBuffer();this.info.memory.geometries++};
|
|
|
+THREE.WebGLRenderer.RibbonRenderer.prototype.initBuffers=function(a,b){var c=a.vertices.length;a.__vertexArray=new Float32Array(3*c);a.__colorArray=new Float32Array(3*c);a.__normalArray=new Float32Array(3*c);a.__webglVertexCount=c;this.initCustomAttributes(a,b)};
|
|
|
+THREE.WebGLRenderer.RibbonRenderer.prototype.setBuffers=function(a){var b=this.renderer,c,d,e,f,g,h,i,j,k=a.vertices;d=a.colors;h=a.normals;var n=k.length;g=d.length;i=h.length;var m=a.__vertexArray,s=a.__colorArray;j=a.__normalArray;var u=a.colorsNeedUpdate,p=a.normalsNeedUpdate,q=a.__webglCustomAttributesList;if(a.verticesNeedUpdate){for(c=0;c<n;c++)e=k[c],f=3*c,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;b.setDynamicArrayBuffer(a.__webglVertexBuffer,m)}if(u){for(c=0;c<g;c++)e=d[c],f=3*c,s[f]=e.r,s[f+1]=e.g,
|
|
|
+s[f+2]=e.b;b.setDynamicArrayBuffer(a.__webglColorBuffer,s)}if(p){for(d=0;d<i;d++)g=h[d],f=3*d,j[f]=g.x,j[f+1]=g.y,j[f+2]=g.z;b.setDynamicArrayBuffer(a.__webglNormalBuffer,j)}if(q){a=0;for(h=q.length;a<h;a++)if(d=q[a],d.needsUpdate&&(void 0===d.boundTo||"vertices"===d.boundTo)){f=0;j=d.value.length;if(1===d.size)for(i=0;i<j;i++)d.array[i]=d.value[i];else if(2===d.size)for(i=0;i<j;i++)g=d.value[i],d.array[f]=g.x,d.array[f+1]=g.y,f+=2;else if(3===d.size)if("c"===d.type)for(i=0;i<j;i++)g=d.value[i],d.array[f]=
|
|
|
+g.r,d.array[f+1]=g.g,d.array[f+2]=g.b,f+=3;else for(i=0;i<j;i++)g=d.value[i],d.array[f]=g.x,d.array[f+1]=g.y,d.array[f+2]=g.z,f+=3;else if(4===d.size)for(i=0;i<j;i++)g=d.value[i],d.array[f]=g.x,d.array[f+1]=g.y,d.array[f+2]=g.z,d.array[f+3]=g.w,f+=4;b.setDynamicArrayBuffer(d.buffer,d.array)}}};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];
|
|
|
-this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,m=h.length;n<m;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(m=k.length;n<m;n++){var s=k[n],r,p,q=s.vertexNormals,x=s.vertexColors;s instanceof THREE.Face3?
|
|
|
-r=new THREE.Face3(s.a+e,s.b+e,s.c+e):s instanceof THREE.Face4&&(r=new THREE.Face4(s.a+e,s.b+e,s.c+e,s.d+e));r.normal.copy(s.normal);d&&r.normal.applyMatrix3(d).normalize();g=0;for(h=q.length;g<h;g++)p=q[g].clone(),d&&p.applyMatrix3(d).normalize(),r.vertexNormals.push(p);r.color.copy(s.color);g=0;for(h=x.length;g<h;g++)p=x[g],r.vertexColors.push(p.clone());r.materialIndex=s.materialIndex;r.centroid.copy(s.centroid);c&&r.centroid.applyMatrix4(c);i.push(r)}n=0;for(m=f.length;n<m;n++){c=f[n];d=[];g=0;
|
|
|
-for(h=c.length;g<h;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));l.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,g=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||g.push(f);a.faces=g},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.add(h);
|
|
|
+this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,k=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,m=h.length;n<m;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(m=j.length;n<m;n++){var s=j[n],u,p,q=s.vertexNormals,w=s.vertexColors;s instanceof THREE.Face3?
|
|
|
+u=new THREE.Face3(s.a+e,s.b+e,s.c+e):s instanceof THREE.Face4&&(u=new THREE.Face4(s.a+e,s.b+e,s.c+e,s.d+e));u.normal.copy(s.normal);d&&u.normal.applyMatrix3(d).normalize();g=0;for(h=q.length;g<h;g++)p=q[g].clone(),d&&p.applyMatrix3(d).normalize(),u.vertexNormals.push(p);u.color.copy(s.color);g=0;for(h=w.length;g<h;g++)p=w[g],u.vertexColors.push(p.clone());u.materialIndex=s.materialIndex;u.centroid.copy(s.centroid);c&&u.centroid.applyMatrix4(c);i.push(u)}n=0;for(m=f.length;n<m;n++){c=f[n];d=[];g=0;
|
|
|
+for(h=c.length;g<h;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));k.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,g=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||g.push(f);a.faces=g},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.add(h);
|
|
|
h.copy(c);h.multiplyScalar(f);g.add(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,
|
|
|
-e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],l,n,m,s;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(l=g[d.a],n=g[d.b],m=g[d.c],
|
|
|
-d._area=THREE.GeometryUtils.triangleArea(l,n,m)):d instanceof THREE.Face4&&(l=g[d.a],n=g[d.b],m=g[d.c],s=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(l,n,s),d._area2=THREE.GeometryUtils.triangleArea(n,m,s),d._area=d._area1+d._area2),i+=d._area,k[e]=i;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d=THREE.GeometryUtils.__v1,e=THREE.GeometryUtils.__v2;d.subVectors(b,a);e.subVectors(c,a);
|
|
|
+e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],k,n,m,s;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(k=g[d.a],n=g[d.b],m=g[d.c],
|
|
|
+d._area=THREE.GeometryUtils.triangleArea(k,n,m)):d instanceof THREE.Face4&&(k=g[d.a],n=g[d.b],m=g[d.c],s=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(k,n,s),d._area2=THREE.GeometryUtils.triangleArea(n,m,s),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d=THREE.GeometryUtils.__v1,e=THREE.GeometryUtils.__v2;d.subVectors(b,a);e.subVectors(c,a);
|
|
|
d.cross(e);return 0.5*d.length()},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].x&&(d[e].x-=Math.floor(d[e].x)),1!==d[e].y&&(d[e].y-=Math.floor(d[e].y))},triangulateQuads:function(a){var b,c,d,e,
|
|
|
-f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,l=d.d,n=new THREE.Face3,m=new THREE.Face3;n.color.copy(d.color);m.color.copy(d.color);n.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;n.a=e;n.b=i;n.c=l;m.a=i;m.b=k;m.c=l;4===d.vertexColors.length&&(n.vertexColors[0]=d.vertexColors[0].clone(),n.vertexColors[1]=d.vertexColors[1].clone(),
|
|
|
-n.vertexColors[2]=d.vertexColors[3].clone(),m.vertexColors[0]=d.vertexColors[1].clone(),m.vertexColors[1]=d.vertexColors[2].clone(),m.vertexColors[2]=d.vertexColors[3].clone());f.push(n,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],i=n[1],k=n[2],l=n[3],n=[n[0].clone(),i.clone(),l.clone()],i=[i.clone(),k.clone(),l.clone()],h[d].push(n,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=
|
|
|
+f=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,j=d.c,k=d.d,n=new THREE.Face3,m=new THREE.Face3;n.color.copy(d.color);m.color.copy(d.color);n.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;n.a=e;n.b=i;n.c=k;m.a=i;m.b=j;m.c=k;4===d.vertexColors.length&&(n.vertexColors[0]=d.vertexColors[0].clone(),n.vertexColors[1]=d.vertexColors[1].clone(),
|
|
|
+n.vertexColors[2]=d.vertexColors[3].clone(),m.vertexColors[0]=d.vertexColors[1].clone(),m.vertexColors[1]=d.vertexColors[2].clone(),m.vertexColors[2]=d.vertexColors[3].clone());f.push(n,m);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],i=n[1],j=n[2],k=n[3],n=[n[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(n,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=
|
|
|
a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;THREE.GeometryUtils.__v2=new THREE.Vector3;THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
|
!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};h.onerror=d;h.crossOrigin=
|
|
|
this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var g=0,h=a.length;g<h;++g){var i={};
|
|
|
-e[g]=i;var k=new XMLHttpRequest;k.onload=b(k,i);k.onerror=d;i=a[g];k.open("GET",i,!0);k.responseType="arraybuffer";k.send(null)}else k=new XMLHttpRequest,k.onload=function(){var a=THREE.ImageUtils.parseDDS(k.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},k.onerror=
|
|
|
-d,k.open("GET",a,!0),k.responseType="arraybuffer",k.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
|
|
|
+e[g]=i;var j=new XMLHttpRequest;j.onload=b(j,i);j.onerror=d;i=a[g];j.open("GET",i,!0);j.responseType="arraybuffer";j.send(null)}else j=new XMLHttpRequest,j.onload=function(){var a=THREE.ImageUtils.parseDDS(j.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},j.onerror=
|
|
|
+d,j.open("GET",a,!0),j.responseType="arraybuffer",j.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
|
|
|
d;var i=h[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.isCubemap=h[28]&512?!0:!1;d.width=h[4];d.height=h[3];for(var h=h[1]+4,f=d.width,g=d.height,i=d.isCubemap?
|
|
|
-6:1,k=0;k<i;k++){for(var l=0;l<d.mipmapCount;l++){var n=Math.max(4,f)/4*Math.max(4,g)/4*e,m={data:new Uint8Array(a,h,n),width:f,height:g};d.mipmaps.push(m);h+=n;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}f=d.width;g=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,
|
|
|
-0,d,e).data,i=g.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var n=0;n<e;n++){var m=0>n-1?0:n-1,s=n+1>e-1?e-1:n+1,r=0>l-1?0:l-1,p=l+1>d-1?d-1:l+1,q=[],x=[0,0,h[4*(n*d+l)]/255*b];q.push([-1,0,h[4*(n*d+r)]/255*b]);q.push([-1,-1,h[4*(m*d+r)]/255*b]);q.push([0,-1,h[4*(m*d+l)]/255*b]);q.push([1,-1,h[4*(m*d+p)]/255*b]);q.push([1,0,h[4*(n*d+p)]/255*b]);q.push([1,1,h[4*(s*d+p)]/255*b]);q.push([0,1,h[4*(s*d+l)]/255*b]);q.push([-1,1,h[4*(s*d+r)]/255*b]);m=[];r=q.length;for(s=0;s<r;s++){var p=q[s],t=q[(s+1)%
|
|
|
-r],p=[p[0]-x[0],p[1]-x[1],p[2]-x[2]],t=[t[0]-x[0],t[1]-x[1],t[2]-x[2]];m.push(c([p[1]*t[2]-p[2]*t[1],p[2]*t[0]-p[0]*t[2],p[0]*t[1]-p[1]*t[0]]))}q=[0,0,0];for(s=0;s<m.length;s++)q[0]+=m[s][0],q[1]+=m[s][1],q[2]+=m[s][2];q[0]/=m.length;q[1]/=m.length;q[2]/=m.length;x=4*(n*d+l);k[x]=255*((q[0]+1)/2)|0;k[x+1]=255*((q[1]+1)/2)|0;k[x+2]=255*q[2]|0;k[x+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
|
|
|
+6:1,j=0;j<i;j++){for(var k=0;k<d.mipmapCount;k++){var n=Math.max(4,f)/4*Math.max(4,g)/4*e,m={data:new Uint8Array(a,h,n),width:f,height:g};d.mipmaps.push(m);h+=n;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}f=d.width;g=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,
|
|
|
+0,d,e).data,i=g.createImageData(d,e),j=i.data,k=0;k<d;k++)for(var n=0;n<e;n++){var m=0>n-1?0:n-1,s=n+1>e-1?e-1:n+1,u=0>k-1?0:k-1,p=k+1>d-1?d-1:k+1,q=[],w=[0,0,h[4*(n*d+k)]/255*b];q.push([-1,0,h[4*(n*d+u)]/255*b]);q.push([-1,-1,h[4*(m*d+u)]/255*b]);q.push([0,-1,h[4*(m*d+k)]/255*b]);q.push([1,-1,h[4*(m*d+p)]/255*b]);q.push([1,0,h[4*(n*d+p)]/255*b]);q.push([1,1,h[4*(s*d+p)]/255*b]);q.push([0,1,h[4*(s*d+k)]/255*b]);q.push([-1,1,h[4*(s*d+u)]/255*b]);m=[];u=q.length;for(s=0;s<u;s++){var p=q[s],v=q[(s+1)%
|
|
|
+u],p=[p[0]-w[0],p[1]-w[1],p[2]-w[2]],v=[v[0]-w[0],v[1]-w[1],v[2]-w[2]];m.push(c([p[1]*v[2]-p[2]*v[1],p[2]*v[0]-p[0]*v[2],p[0]*v[1]-p[1]*v[0]]))}q=[0,0,0];for(s=0;s<m.length;s++)q[0]+=m[s][0],q[1]+=m[s][1],q[2]+=m[s][2];q[0]/=m.length;q[1]/=m.length;q[2]/=m.length;w=4*(n*d+k);j[w]=255*((q[0]+1)/2)|0;j[w+1]=255*((q[1]+1)/2)|0;j[w+2]=255*q[2]|0;j[w+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
|
|
|
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.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
-0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,l,n,m,s,r,p,q,x=b.glyphs[a]||b.glyphs["?"];if(x){if(x.o){b=x._cachedOutline||(x._cachedOutline=x.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
-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]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var t=g/h;THREE.Shape.Utils.b2(t,n,s,i);THREE.Shape.Utils.b2(t,m,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]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++)t=g/h,THREE.Shape.Utils.b3(t,n,s,p,i),THREE.Shape.Utils.b3(t,m,r,q,l)}}}return{offset:x.ha*c,path:e}}}};
|
|
|
+0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,k,n,m,s,u,p,q,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;e.lineTo(i,k);break;case "q":i=b[a++]*
|
|
|
+c+d;k=b[a++]*c;s=b[a++]*c+d;u=b[a++]*c;e.quadraticCurveTo(s,u,i,k);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var v=g/h;THREE.Shape.Utils.b2(v,n,s,i);THREE.Shape.Utils.b2(v,m,u,k)}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,s=b[a++]*c+d,u=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,k,s,u,p,q),g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++)v=g/h,THREE.Shape.Utils.b3(v,n,s,p,i),THREE.Shape.Utils.b3(v,m,u,q,k)}}}return{offset:w.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 n=2*e;for(k=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{var s=m=void 0,r=void 0,p=void 0,q=void 0,x=void 0,t=void 0,v=void 0,w=
|
|
|
-void 0,s=a[g[i]].x,r=a[g[i]].y,p=a[g[k]].x,q=a[g[k]].y,x=a[g[l]].x,t=a[g[l]].y;if(1E-10>(p-s)*(t-r)-(q-r)*(x-s))m=!1;else{var E=void 0,J=void 0,A=void 0,z=void 0,G=void 0,I=void 0,F=void 0,V=void 0,B=void 0,T=void 0,B=V=F=w=v=void 0,E=x-p,J=t-q,A=s-x,z=r-t,G=p-s,I=q-r;for(m=0;m<e;m++)if(!(m===i||m===k||m===l))if(v=a[g[m]].x,w=a[g[m]].y,F=v-s,V=w-r,B=v-p,T=w-q,v-=x,w-=t,B=E*T-J*B,F=G*V-I*F,V=A*w-z*v,0<=B&&0<=V&&0<=F){m=!1;break a}m=!0}}if(m){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--;n=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};
|
|
|
+(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,j,k;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var n=2*e;for(j=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var m;a:{var s=m=void 0,u=void 0,p=void 0,q=void 0,w=void 0,v=void 0,y=void 0,z=
|
|
|
+void 0,s=a[g[i]].x,u=a[g[i]].y,p=a[g[j]].x,q=a[g[j]].y,w=a[g[k]].x,v=a[g[k]].y;if(1E-10>(p-s)*(v-u)-(q-u)*(w-s))m=!1;else{var r=void 0,E=void 0,D=void 0,l=void 0,H=void 0,F=void 0,B=void 0,N=void 0,A=void 0,Q=void 0,A=N=B=z=y=void 0,r=w-p,E=v-q,D=s-w,l=u-v,H=p-s,F=q-u;for(m=0;m<e;m++)if(!(m===i||m===j||m===k))if(y=a[g[m]].x,z=a[g[m]].y,B=y-s,N=z-u,A=y-p,Q=z-q,y-=w,z-=v,A=r*Q-E*A,B=H*N-F*B,N=D*z-l*y,0<=A&&0<=N&&0<=B){m=!1;break a}m=!0}}if(m){f.push([a[g[i]],a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);
|
|
|
+i=j;for(k=j+1;k<e;i++,k++)g[i]=g[k];e--;n=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()};
|
|
|
THREE.Curve.prototype.getTangentAt=function(a){a=this.getUtoTmapping(a);return this.getTangent(a)};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};
|
|
@@ -542,7 +546,7 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]
|
|
|
d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
|
|
|
THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,k,l,n=a[0]instanceof THREE.Vector3;l=n?new THREE.Vector3:new THREE.Vector2;i=0;for(k=a.length;i<k;i++)h=a[i],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),n&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),l.add(h);a={minX:e,minY:f,maxX:b,maxY:c,centroid:l.divideScalar(k)};n&&(a.maxZ=d,a.minZ=g);return a};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,k,n=a[0]instanceof THREE.Vector3;k=n?new THREE.Vector3:new THREE.Vector2;i=0;for(j=a.length;i<j;i++)h=a[i],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),n&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),k.add(h);a={minX:e,minY:f,maxX:b,maxY:c,centroid:k.divideScalar(j)};n&&(a.maxZ=d,a.minZ=g);return a};
|
|
|
THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -554,40 +558,40 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,i,k,l,n,m,s,r,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];m=f[1];0<c.length?(g=c[c.length-1],s=g.x,
|
|
|
-r=g.y):(g=this.actions[d-1].args,s=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,s,n,h),p=THREE.Shape.Utils.b2(p,r,m,i),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];m=f[1];k=f[2];l=f[3];0<c.length?(g=c[c.length-1],s=g.x,r=g.y):(g=this.actions[d-1].args,s=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,s,n,k,h),p=THREE.Shape.Utils.b3(p,r,m,l,i),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
|
|
|
-this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];k=f[3];g=f[4];n=!!f[5];s=g-k;r=2*a;for(f=1;f<=r;f++)p=f/r,n||(p=1-p),p=k+p*s,g=h+m*Math.cos(p),p=i+m*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];l=f[3];k=f[4];g=f[5];n=!!f[6];s=g-k;r=2*a;for(f=1;f<=r;f++)p=f/r,n||
|
|
|
-(p=1-p),p=k+p*s,g=h+m*Math.cos(p),p=i+l*Math.sin(p),c.push(new THREE.Vector2(g,p))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,g,h,i,j,k,n,m,s,u,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];m=f[1];0<c.length?(g=c[c.length-1],s=g.x,
|
|
|
+u=g.y):(g=this.actions[d-1].args,s=g[g.length-2],u=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,s,n,h),p=THREE.Shape.Utils.b2(p,u,m,i),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];m=f[1];j=f[2];k=f[3];0<c.length?(g=c[c.length-1],s=g.x,u=g.y):(g=this.actions[d-1].args,s=g[g.length-2],u=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,s,n,j,h),p=THREE.Shape.Utils.b3(p,u,m,k,i),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
|
|
|
+this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];j=f[3];g=f[4];n=!!f[5];s=g-j;u=2*a;for(f=1;f<=u;f++)p=f/u,n||(p=1-p),p=j+p*s,g=h+m*Math.cos(p),p=i+m*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];k=f[3];j=f[4];g=f[5];n=!!f[6];s=g-j;u=2*a;for(f=1;f<=u;f++)p=f/u,n||
|
|
|
+(p=1-p),p=j+p*s,g=h+m*Math.cos(p),p=i+k*Math.sin(p),c.push(new THREE.Vector2(g,p))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
|
|
|
b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{a=0;for(b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,k,l,n,m,s,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];s=[];for(n=0;n<c.length;n++)l=c[n],l=m.distanceToSquared(l),s.push(l),l<f&&(f=l,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var p=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(p);var q=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);s=h;l=g;h+=1;g+=-1;0>
|
|
|
-h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;p=[k[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(p);q=[k[g],k[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);n+m>p+q&&(h=s,g=l,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:k.length-1);n=c.slice(0,h);m=c.slice(h);s=k.slice(g);l=k.slice(0,g);f=[k[g],k[f],c[h]];r.push([k[g],c[h],c[e]]);r.push(f);c=n.concat(s).concat(l).concat(m)}return{shape:c,
|
|
|
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,k={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,k,n,m,s,u=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];s=[];for(n=0;n<c.length;n++)k=c[n],k=m.distanceToSquared(k),s.push(k),k<f&&(f=k,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;var p=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(p);var q=[j[g],j[f],c[h]];m=THREE.FontUtils.Triangulate.area(q);s=h;k=g;h+=1;g+=-1;0>
|
|
|
+h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:j.length-1;p=[j[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(p);q=[j[g],j[f],c[h]];q=THREE.FontUtils.Triangulate.area(q);n+m>p+q&&(h=s,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:j.length-1);n=c.slice(0,h);m=c.slice(h);s=j.slice(g);k=j.slice(0,g);f=[j[g],j[f],c[h]];u.push([j[g],c[h],c[e]]);u.push(f);c=n.concat(s).concat(k).concat(m)}return{shape:c,
|
|
|
+isolatedPts:u,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=f;f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}f=0;for(g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++)if(0>a.hierarchy[c].keys[d].time&&
|
|
|
-(a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;
|
|
|
-for(d=0;d<a.hierarchy[c].keys.length;d++){var l={};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){l[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
+(a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;
|
|
|
+for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],
|
|
|
b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!1===this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD&&(e.useQuaternion=!0);e.matrixAutoUpdate=!0;void 0===e.animationCache&&(e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
|
|
|
THREE.Bone?e.skinMatrix:e.matrix);var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){!0===this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this)};
|
|
|
-THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,k,l;l=this.currentTime+=a*this.timeScale;k=this.currentTime%=this.data.length;parseInt(Math.min(k*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,m=this.hierarchy.length;n<m;n++){a=this.hierarchy[n];i=a.animationCache;for(var s=0;3>s;s++){c=b[s];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(k<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<
|
|
|
-k;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<k)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(k-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+
|
|
|
+THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,j,k;k=this.currentTime+=a*this.timeScale;j=this.currentTime%=this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,m=this.hierarchy.length;n<m;n++){a=this.hierarchy[n];i=a.animationCache;for(var s=0;3>s;s++){c=b[s];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=k){if(j<k)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<
|
|
|
+j;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<j)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(j-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+
|
|
|
(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),
|
|
|
this.target.set(d[0],d[1],d[2]),this.target.sub(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0))}else"rot"===c?THREE.Quaternion.slerp(e,f,a.quaternion,d):"scl"===c&&(c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d)}}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,j;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],j[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],j[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],j[2],e,c,g);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++)e=this.hierarchy[c],f=this.data.hierarchy[c],e.useQuaternion=!0,void 0===f.animationCache&&(f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
|
|
|
e.matrix),e=this.data.hierarchy[c].keys,e.length&&(f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;g<this.startTimeMs&&(g=this.currentTime=this.startTimeMs+g);e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=this.hierarchy[a];if(l.length){for(l=
|
|
|
-0;l<f.length;l++)g=f[l],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,n=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(l.length){this.JITCompile&&n&&(d instanceof
|
|
|
-THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix);b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;)b=c,c=l[b.index+1]}else if(!i)for(var m=l.length-1;c.time<g&&c.index!==m;)b=c,c=l[b.index+1];n.prevKey=b;n.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;g<this.startTimeMs&&(g=this.currentTime=this.startTimeMs+g);e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
|
|
|
+0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,n=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){this.JITCompile&&n&&(d instanceof
|
|
|
+THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix);b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var m=k.length-1;c.time<g&&c.index!==m;)b=c,c=k[b.index+1];n.prevKey=b;n.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
|
|
|
this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
|
1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,m=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
|
|
|
2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);
|
|
@@ -598,44 +602,44 @@ 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,x=h.widthSegments,t=h.heightSegments,v=e/2,w=f/2,E=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",t=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",x=h.depthSegments;var J=x+1,A=t+1,z=e/x,G=f/t,I=new THREE.Vector3;I[q]=0<g?1:-1;for(e=0;e<A;e++)for(f=0;f<J;f++){var F=new THREE.Vector3;F[a]=(f*z-v)*c;F[b]=(e*G-w)*d;F[q]=g;h.vertices.push(F)}for(e=
|
|
|
-0;e<t;e++)for(f=0;f<x;f++)a=new THREE.Face4(f+J*e+E,f+J*(e+1)+E,f+1+J*(e+1)+E,f+1+J*e+E),a.normal.copy(I),a.vertexNormals.push(I.clone(),I.clone(),I.clone(),I.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/x,1-e/t),new THREE.Vector2(f/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-(e+1)/t),new THREE.Vector2((f+1)/x,1-e/t)])}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 n=[],m=[],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);n.push(this.vertices.length-1);m.push(new THREE.Vector2(p,1-s))}k.push(n);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[k[0][h]].clone(),
|
|
|
-m=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),m=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.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],x=n.clone(),t=n.clone(),v=m.clone(),w=m.clone(),E=l[i][h].clone(),J=l[i+1][h].clone(),A=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(s,r,p,q,[x,t,v,w]));this.faceVertexUvs[0].push([E,J,A,z])}}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,x=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),E=l[0][h].clone(),J=l[0][h+1].clone(),A=new THREE.Vector2(J.u,0),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([E,J,A])}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,x=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,
|
|
|
--1,0),v=new THREE.Vector3(0,-1,0),E=l[i][h+1].clone(),J=l[i][h].clone(),A=new THREE.Vector2(J.u,1),this.faces.push(new THREE.Face3(s,r,p,[x,t,v])),this.faceVertexUvs[0].push([E,J,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+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,w=h.widthSegments,v=h.heightSegments,y=e/2,z=f/2,r=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",w=h.depthSegments;var E=w+1,D=v+1,l=e/w,H=f/v,F=new THREE.Vector3;F[q]=0<g?1:-1;for(e=0;e<D;e++)for(f=0;f<E;f++){var B=new THREE.Vector3;B[a]=(f*l-y)*c;B[b]=(e*H-z)*d;B[q]=g;h.vertices.push(B)}for(e=
|
|
|
+0;e<v;e++)for(f=0;f<w;f++)a=new THREE.Face4(f+E*e+r,f+E*(e+1)+r,f+1+E*(e+1)+r,f+1+E*e+r),a.normal.copy(F),a.vertexNormals.push(F.clone(),F.clone(),F.clone(),F.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/w,1-e/v),new THREE.Vector2(f/w,1-(e+1)/v),new THREE.Vector2((f+1)/w,1-(e+1)/v),new THREE.Vector2((f+1)/w,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,j=[],k=[];for(i=0;i<=e;i++){var n=[],m=[],s=i/e,u=s*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,q=new THREE.Vector3;q.x=u*Math.sin(2*p*Math.PI);q.y=-s*c+g;q.z=u*Math.cos(2*p*Math.PI);this.vertices.push(q);n.push(this.vertices.length-1);m.push(new THREE.Vector2(p,1-s))}j.push(n);k.push(m)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[j[0][h]].clone(),
|
|
|
+m=this.vertices[j[0][h+1]].clone()):(n=this.vertices[j[1][h]].clone(),m=this.vertices[j[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var s=j[i][h],u=j[i+1][h],p=j[i+1][h+1],q=j[i][h+1],w=n.clone(),v=n.clone(),y=m.clone(),z=m.clone(),r=k[i][h].clone(),E=k[i+1][h].clone(),D=k[i+1][h+1].clone(),l=k[i][h+1].clone();this.faces.push(new THREE.Face4(s,u,p,q,[w,v,y,z]));this.faceVertexUvs[0].push([r,E,D,l])}}if(!f&&0<
|
|
|
+a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=j[0][h],u=j[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),r=k[0][h].clone(),E=k[0][h+1].clone(),D=new THREE.Vector2(E.u,0),this.faces.push(new THREE.Face3(s,u,p,[w,v,y])),this.faceVertexUvs[0].push([r,E,D])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=j[i][h+1],u=j[i][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,
|
|
|
+-1,0),y=new THREE.Vector3(0,-1,0),r=k[i][h+1].clone(),E=k[i][h].clone(),D=new THREE.Vector2(E.u,1),this.faces.push(new THREE.Face3(s,u,p,[w,v,y])),this.faceVertexUvs[0].push([r,E,D])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(H=c.length;0<=--H;){e=H;f=H-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*l,
|
|
|
-g=0;g<h;g++){var i=X*g,k=X*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,x=e,w=f,m=m+V,i=i+V,n=n+V,k=k+V;F.faces.push(new THREE.Face4(m,i,n,k,null,null,t));m=v.generateSideWallUV(F,a,p,b,m,i,n,k,q,r,x,w);F.faceVertexUvs[0].push(m)}}}function f(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;F.faces.push(new THREE.Face3(c,d,e,null,null,x));c=f?v.generateBottomUV(F,a,b,c,d,e):v.generateTopUV(F,a,b,c,d,e);F.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,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,x=b.material,t=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,E,J,A;r&&(p=r.getSpacedPoints(s),q=!0,n=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,
|
|
|
-!1),E=new THREE.Vector3,J=new THREE.Vector3,A=new THREE.Vector3);n||(k=i=l=0);var z,G,I,F=this,V=this.vertices.length,m=a.extractPoints(m),B=m.shape,m=m.holes;if(r=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();G=0;for(I=m.length;G<I;G++)z=m[G],THREE.Shape.Utils.isClockWise(z)&&(m[G]=z.reverse());r=!1}var T=THREE.Shape.Utils.triangulateShape(B,m),r=B;G=0;for(I=m.length;G<I;G++)z=m[G],B=B.concat(z);var C,K,L,W,X=B.length,qa=T.length,ga=[],H=0,ba=r.length;C=ba-1;for(K=H+1;H<ba;H++,C++,K++)C===ba&&
|
|
|
-(C=0),K===ba&&(K=0),ga[H]=d(r[H],r[C],r[K]);var Ca=[],ja,oa=ga.concat();G=0;for(I=m.length;G<I;G++){z=m[G];ja=[];H=0;ba=z.length;C=ba-1;for(K=H+1;H<ba;H++,C++,K++)C===ba&&(C=0),K===ba&&(K=0),ja[H]=d(z[H],z[C],z[K]);Ca.push(ja);oa=oa.concat(ja)}for(C=0;C<l;C++){z=C/l;L=i*(1-z);K=k*Math.sin(z*Math.PI/2);H=0;for(ba=r.length;H<ba;H++)W=c(r[H],ga[H],K),f(W.x,W.y,-L);G=0;for(I=m.length;G<I;G++){z=m[G];ja=Ca[G];H=0;for(ba=z.length;H<ba;H++)W=c(z[H],ja[H],K),f(W.x,W.y,-L)}}K=k;for(H=0;H<X;H++)W=n?c(B[H],
|
|
|
-oa[H],K):B[H],q?(J.copy(w.normals[0]).multiplyScalar(W.x),E.copy(w.binormals[0]).multiplyScalar(W.y),A.copy(p[0]).add(J).add(E),f(A.x,A.y,A.z)):f(W.x,W.y,0);for(z=1;z<=s;z++)for(H=0;H<X;H++)W=n?c(B[H],oa[H],K):B[H],q?(J.copy(w.normals[z]).multiplyScalar(W.x),E.copy(w.binormals[z]).multiplyScalar(W.y),A.copy(p[z]).add(J).add(E),f(A.x,A.y,A.z)):f(W.x,W.y,h/s*z);for(C=l-1;0<=C;C--){z=C/l;L=i*(1-z);K=k*Math.sin(z*Math.PI/2);H=0;for(ba=r.length;H<ba;H++)W=c(r[H],ga[H],K),f(W.x,W.y,h+L);G=0;for(I=m.length;G<
|
|
|
-I;G++){z=m[G];ja=Ca[G];H=0;for(ba=z.length;H<ba;H++)W=c(z[H],ja[H],K),q?f(W.x,W.y+p[s-1].y,p[s-1].x+L):f(W.x,W.y,h+L)}}if(n){i=0*X;for(H=0;H<qa;H++)h=T[H],g(h[2]+i,h[1]+i,h[0]+i,!0);i=X*(s+2*l);for(H=0;H<qa;H++)h=T[H],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(H=0;H<qa;H++)h=T[H],g(h[2],h[1],h[0],!0);for(H=0;H<qa;H++)h=T[H],g(h[0]+X*s,h[1]+X*s,h[2]+X*s,!1)}h=0;e(r,h);h+=r.length;G=0;for(I=m.length;G<I;G++)z=m[G],e(z,h),h+=z.length};
|
|
|
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,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,n=a.vertices[h].x,m=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(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(m,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;
|
|
|
+h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(K=c.length;0<=--K;){e=K;f=K-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*k,
|
|
|
+g=0;g<h;g++){var i=M*g,j=M*(g+1),l=d+e+i,i=d+f+i,m=d+f+j,j=d+e+j,n=c,p=g,q=h,r=e,u=f,l=l+N,i=i+N,m=m+N,j=j+N;B.faces.push(new THREE.Face4(l,i,m,j,null,null,v));l=y.generateSideWallUV(B,a,n,b,l,i,m,j,p,q,r,u);B.faceVertexUvs[0].push(l)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=N;d+=N;e+=N;B.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?y.generateBottomUV(B,a,b,c,d,e):y.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:
|
|
|
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,u=b.extrudePath,p,q=!1,w=b.material,v=b.extrudeMaterial,y=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,z,r,E,D;u&&(p=u.getSpacedPoints(s),q=!0,n=!1,z=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(u,s,
|
|
|
+!1),r=new THREE.Vector3,E=new THREE.Vector3,D=new THREE.Vector3);n||(j=i=k=0);var l,H,F,B=this,N=this.vertices.length,m=a.extractPoints(m),A=m.shape,m=m.holes;if(u=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();H=0;for(F=m.length;H<F;H++)l=m[H],THREE.Shape.Utils.isClockWise(l)&&(m[H]=l.reverse());u=!1}var Q=THREE.Shape.Utils.triangulateShape(A,m),u=A;H=0;for(F=m.length;H<F;H++)l=m[H],A=A.concat(l);var C,G,t,I,M=A.length,J=Q.length,x=[],K=0,S=u.length;C=S-1;for(G=K+1;K<S;K++,C++,G++)C===S&&(C=0),
|
|
|
+G===S&&(G=0),x[K]=d(u[K],u[C],u[G]);var aa=[],Y,V=x.concat();H=0;for(F=m.length;H<F;H++){l=m[H];Y=[];K=0;S=l.length;C=S-1;for(G=K+1;K<S;K++,C++,G++)C===S&&(C=0),G===S&&(G=0),Y[K]=d(l[K],l[C],l[G]);aa.push(Y);V=V.concat(Y)}for(C=0;C<k;C++){l=C/k;t=i*(1-l);G=j*Math.sin(l*Math.PI/2);K=0;for(S=u.length;K<S;K++)I=c(u[K],x[K],G),f(I.x,I.y,-t);H=0;for(F=m.length;H<F;H++){l=m[H];Y=aa[H];K=0;for(S=l.length;K<S;K++)I=c(l[K],Y[K],G),f(I.x,I.y,-t)}}G=j;for(K=0;K<M;K++)I=n?c(A[K],V[K],G):A[K],q?(E.copy(z.normals[0]).multiplyScalar(I.x),
|
|
|
+r.copy(z.binormals[0]).multiplyScalar(I.y),D.copy(p[0]).add(E).add(r),f(D.x,D.y,D.z)):f(I.x,I.y,0);for(l=1;l<=s;l++)for(K=0;K<M;K++)I=n?c(A[K],V[K],G):A[K],q?(E.copy(z.normals[l]).multiplyScalar(I.x),r.copy(z.binormals[l]).multiplyScalar(I.y),D.copy(p[l]).add(E).add(r),f(D.x,D.y,D.z)):f(I.x,I.y,h/s*l);for(C=k-1;0<=C;C--){l=C/k;t=i*(1-l);G=j*Math.sin(l*Math.PI/2);K=0;for(S=u.length;K<S;K++)I=c(u[K],x[K],G),f(I.x,I.y,h+t);H=0;for(F=m.length;H<F;H++){l=m[H];Y=aa[H];K=0;for(S=l.length;K<S;K++)I=c(l[K],
|
|
|
+Y[K],G),q?f(I.x,I.y+p[s-1].y,p[s-1].x+t):f(I.x,I.y,h+t)}}if(n){i=0*M;for(K=0;K<J;K++)h=Q[K],g(h[2]+i,h[1]+i,h[0]+i,!0);i=M*(s+2*k);for(K=0;K<J;K++)h=Q[K],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(K=0;K<J;K++)h=Q[K],g(h[2],h[1],h[0],!0);for(K=0;K<J;K++)h=Q[K],g(h[0]+M*s,h[1]+M*s,h[2]+M*s,!1)}h=0;e(u,h);h+=u.length;H=0;for(F=m.length;H<F;H++)l=m[H],e(l,h),h+=l.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,j=a.vertices[g].x,
|
|
|
+k=a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[h].x,m=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(j,1-g),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(m,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};
|
|
|
-THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,k=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=k.length;e<f;e++)g=k[e],THREE.Shape.Utils.isClockWise(g)&&(k[e]=g.reverse())}var l=THREE.Shape.Utils.triangulateShape(i,k);e=0;for(f=k.length;e<f;e++)g=k[e],
|
|
|
-i=i.concat(g);k=i.length;f=l.length;for(e=0;e<k;e++)g=i[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+h,g=k[1]+h,k=k[2]+h,this.faces.push(new THREE.Face3(i,g,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,g,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var i=c+g*f*d,k=Math.cos(i),l=Math.sin(i),i=0,n=a.length;i<n;i++){var m=a[i],s=new THREE.Vector3;s.x=k*m.x-l*m.y;s.y=l*m.x+k*m.y;s.z=m.z;this.vertices.push(s)}c=a.length;g=0;for(h=b;g<h;g++){i=0;for(n=a.length-1;i<n;i++)d=b=i+c*g,l=b+c,k=b+1+c,this.faces.push(new THREE.Face4(d,l,k,b+1)),k=g*f,b=i*e,d=k+f,l=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(k,
|
|
|
-b),new THREE.Vector2(d,b),new THREE.Vector2(d,l),new THREE.Vector2(k,l)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var c=a/2,e=b/2,d=this.widthSegments,f=this.heightSegments,g=d+1,h=f+1,i=this.width/d,k=this.height/f,l=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-c,-(a*k-e),0));for(a=0;a<f;a++)for(b=0;b<d;b++)c=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),c.normal.copy(l),c.vertexNormals.push(l.clone(),l.clone(),
|
|
|
-l.clone(),l.clone()),this.faces.push(c),this.faceVertexUvs[0].push([new THREE.Vector2(b/d,1-a/f),new THREE.Vector2(b/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-a/f)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a||50;this.widthSegments=Math.max(3,Math.floor(b)||8);this.heightSegments=Math.max(2,Math.floor(c)||6);for(var d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,h=[],i=[],c=0;c<=this.heightSegments;c++){for(var k=[],l=[],b=0;b<=this.widthSegments;b++){var n=b/this.widthSegments,m=c/this.heightSegments,s=new THREE.Vector3;s.x=-this.radius*Math.cos(d+n*e)*Math.sin(f+m*g);s.y=this.radius*
|
|
|
-Math.cos(f+m*g);s.z=this.radius*Math.sin(d+n*e)*Math.sin(f+m*g);this.vertices.push(s);k.push(this.vertices.length-1);l.push(new THREE.Vector2(n,1-m))}h.push(k);i.push(l)}for(c=0;c<this.heightSegments;c++)for(b=0;b<this.widthSegments;b++){var d=h[c][b+1],e=h[c][b],f=h[c+1][b],g=h[c+1][b+1],k=this.vertices[d].clone().normalize(),l=this.vertices[e].clone().normalize(),n=this.vertices[f].clone().normalize(),m=this.vertices[g].clone().normalize(),s=i[c][b+1].clone(),r=i[c][b].clone(),p=i[c+1][b].clone(),
|
|
|
-q=i[c+1][b+1].clone();Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(d,f,g,[k,n,m])),this.faceVertexUvs[0].push([s,p,q])):Math.abs(this.vertices[f].y)===this.radius?(this.faces.push(new THREE.Face3(d,e,f,[k,l,n])),this.faceVertexUvs[0].push([s,r,p])):(this.faces.push(new THREE.Face4(d,e,f,g,[k,l,n,m])),this.faceVertexUvs[0].push([s,r,p,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};
|
|
|
+THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=j.length;e<f;e++)g=j[e],THREE.Shape.Utils.isClockWise(g)&&(j[e]=g.reverse())}var k=THREE.Shape.Utils.triangulateShape(i,j);e=0;for(f=j.length;e<f;e++)g=j[e],
|
|
|
+i=i.concat(g);j=i.length;f=k.length;for(e=0;e<j;e++)g=i[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)j=k[e],i=j[0]+h,g=j[1]+h,j=j[2]+h,this.faces.push(new THREE.Face3(i,g,j,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,g,j))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var i=c+g*f*d,j=Math.cos(i),k=Math.sin(i),i=0,n=a.length;i<n;i++){var m=a[i],s=new THREE.Vector3;s.x=j*m.x-k*m.y;s.y=k*m.x+j*m.y;s.z=m.z;this.vertices.push(s)}c=a.length;g=0;for(h=b;g<h;g++){i=0;for(n=a.length-1;i<n;i++)d=b=i+c*g,k=b+c,j=b+1+c,this.faces.push(new THREE.Face4(d,k,j,b+1)),j=g*f,b=i*e,d=j+f,k=b+e,this.faceVertexUvs[0].push([new THREE.Vector2(j,
|
|
|
+b),new THREE.Vector2(d,b),new THREE.Vector2(d,k),new THREE.Vector2(j,k)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var c=a/2,e=b/2,d=this.widthSegments,f=this.heightSegments,g=d+1,h=f+1,i=this.width/d,j=this.height/f,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-c,-(a*j-e),0));for(a=0;a<f;a++)for(b=0;b<d;b++)c=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),c.normal.copy(k),c.vertexNormals.push(k.clone(),k.clone(),
|
|
|
+k.clone(),k.clone()),this.faces.push(c),this.faceVertexUvs[0].push([new THREE.Vector2(b/d,1-a/f),new THREE.Vector2(b/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-(a+1)/f),new THREE.Vector2((b+1)/d,1-a/f)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a||50;this.widthSegments=Math.max(3,Math.floor(b)||8);this.heightSegments=Math.max(2,Math.floor(c)||6);for(var d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,h=[],i=[],c=0;c<=this.heightSegments;c++){for(var j=[],k=[],b=0;b<=this.widthSegments;b++){var n=b/this.widthSegments,m=c/this.heightSegments,s=new THREE.Vector3;s.x=-this.radius*Math.cos(d+n*e)*Math.sin(f+m*g);s.y=this.radius*
|
|
|
+Math.cos(f+m*g);s.z=this.radius*Math.sin(d+n*e)*Math.sin(f+m*g);this.vertices.push(s);j.push(this.vertices.length-1);k.push(new THREE.Vector2(n,1-m))}h.push(j);i.push(k)}for(c=0;c<this.heightSegments;c++)for(b=0;b<this.widthSegments;b++){var d=h[c][b+1],e=h[c][b],f=h[c+1][b],g=h[c+1][b+1],j=this.vertices[d].clone().normalize(),k=this.vertices[e].clone().normalize(),n=this.vertices[f].clone().normalize(),m=this.vertices[g].clone().normalize(),s=i[c][b+1].clone(),u=i[c][b].clone(),p=i[c+1][b].clone(),
|
|
|
+q=i[c+1][b+1].clone();Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(d,f,g,[j,n,m])),this.faceVertexUvs[0].push([s,p,q])):Math.abs(this.vertices[f].y)===this.radius?(this.faces.push(new THREE.Face3(d,e,f,[j,k,n])),this.faceVertexUvs[0].push([s,u,p])):(this.faces.push(new THREE.Face4(d,e,f,g,[j,k,n,m])),this.faceVertexUvs[0].push([s,u,p,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};
|
|
|
THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,g=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*
|
|
|
Math.cos(g))*Math.sin(f);h.z=this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(h.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[g]);i.normal.add(b[h]);
|
|
|
i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
|
Array(this.tubularSegments);for(b=0;b<this.tubularSegments;++b){var i=2*(a/this.radialSegments)*this.p*Math.PI,g=2*(b/this.tubularSegments)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.subVectors(i,f);d.addVectors(i,f);e.crossVectors(c,d);d.crossVectors(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,
|
|
|
-f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),k=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),l=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
|
|
|
-d,e,f));this.faceVertexUvs[0].push([g,i,k,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var g,h,e=this.segments+1,i,k,l,f=new THREE.Vector3,n,m,s,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);n=b.tangents;m=b.normals;s=b.binormals;this.tangents=n;this.normals=m;this.binormals=s;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);l=a.getPointAt(d);d=n[b];g=m[b];
|
|
|
-h=s[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,l,c,255)),this.debug.add(new THREE.ArrowHelper(g,l,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,l,c,65280)));for(d=0;d<this.radiusSegments;d++)i=2*(d/this.radiusSegments)*Math.PI,k=-this.radius*Math.cos(i),i=this.radius*Math.sin(i),f.copy(l),f.x+=k*g.x+i*h.x,f.y+=k*g.y+i*h.y,f.z+=k*g.z+i*h.z,this.grid[b][d]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++)e=this.closed?
|
|
|
+f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),j=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),k=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
|
|
|
+d,e,f));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||!1;f&&(this.debug=new THREE.Object3D);this.grid=[];var g,h,e=this.segments+1,i,j,k,f=new THREE.Vector3,n,m,s,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);n=b.tangents;m=b.normals;s=b.binormals;this.tangents=n;this.normals=m;this.binormals=s;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);k=a.getPointAt(d);d=n[b];g=m[b];
|
|
|
+h=s[b];this.debug&&(this.debug.add(new THREE.ArrowHelper(d,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,k,c,65280)));for(d=0;d<this.radiusSegments;d++)i=2*(d/this.radiusSegments)*Math.PI,j=-this.radius*Math.cos(i),i=this.radius*Math.sin(i),f.copy(k),f.x+=j*g.x+i*h.x,f.y+=j*g.y+i*h.y,f.z+=j*g.z+i*h.z,this.grid[b][d]=this.vertices.push(new THREE.Vector3(f.x,f.y,f.z))-1}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++)e=this.closed?
|
|
|
(b+1)%this.segments:b+1,f=(d+1)%this.radiusSegments,a=this.grid[b][d],c=this.grid[e][d],e=this.grid[e][f],f=this.grid[b][f],n=new THREE.Vector2(b/this.segments,d/this.radiusSegments),m=new THREE.Vector2((b+1)/this.segments,d/this.radiusSegments),s=new THREE.Vector2((b+1)/this.segments,(d+1)/this.radiusSegments),g=new THREE.Vector2(b/this.segments,(d+1)/this.radiusSegments),this.faces.push(new THREE.Face4(a,c,e,f)),this.faceVertexUvs[0].push([n,m,s,g]);this.computeCentroids();this.computeFaceNormals();
|
|
|
this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,l,n;this.tangents=e;this.normals=f;this.binormals=g;for(k=0;k<b;k++)l=k/(b-1),e[k]=a.getTangentAt(l),e[k].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);n=Math.abs(e[0].z);k<=a&&(a=k,d.set(1,0,0));l<=a&&(a=l,d.set(0,1,0));n<=a&&d.set(0,0,1);h.crossVectors(e[0],
|
|
|
-d).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(k=1;k<b;k++)f[k]=f[k-1].clone(),g[k]=g[k-1].clone(),h.crossVectors(e[k-1],e[k]),1E-4<h.length()&&(h.normalize(),d=Math.acos(e[k-1].dot(e[k])),f[k].applyMatrix4(i.makeRotationAxis(h,d))),g[k].crossVectors(e[k],f[k]);if(c){d=Math.acos(f[0].dot(f[b-1]));d/=b-1;0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d);for(k=1;k<b;k++)f[k].applyMatrix4(i.makeRotationAxis(e[k],d*k)),g[k].crossVectors(e[k],f[k])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]),d.centroid.add(a).add(b).add(c).divideScalar(3),d.normal=d.centroid.clone().normalize(),i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,
|
|
|
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,k,n;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++)k=j/(b-1),e[j]=a.getTangentAt(k),e[j].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);k=Math.abs(e[0].y);n=Math.abs(e[0].z);j<=a&&(a=j,d.set(1,0,0));k<=a&&(a=k,d.set(0,1,0));n<=a&&d.set(0,0,1);h.crossVectors(e[0],
|
|
|
+d).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(j=1;j<b;j++)f[j]=f[j-1].clone(),g[j]=g[j-1].clone(),h.crossVectors(e[j-1],e[j]),1E-4<h.length()&&(h.normalize(),d=Math.acos(e[j-1].dot(e[j])),f[j].applyMatrix4(i.makeRotationAxis(h,d))),g[j].crossVectors(e[j],f[j]);if(c){d=Math.acos(f[0].dot(f[b-1]));d/=b-1;0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d);for(j=1;j<b;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),g[j].crossVectors(e[j],f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]),d.centroid.add(a).add(b).add(c).divideScalar(3),d.normal=d.centroid.clone().normalize(),i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,
|
|
|
a,d),h(b.uv,b,d),h(c.uv,c,d)])):(d-=1,f(a,g(a,b),g(a,c),d),f(g(a,b),b,g(b,c),d),f(g(a,c),g(b,c),c,d),f(g(a,b),g(b,c),g(a,c),d))}function g(a,b){n[a.index]||(n[a.index]=[]);n[b.index]||(n[b.index]=[]);var c=n[a.index][b.index];void 0===c&&(n[a.index][b.index]=n[b.index][a.index]=c=e((new THREE.Vector3).addVectors(a,b).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a}THREE.Geometry.call(this);
|
|
|
-for(var c=c||1,d=d||0,i=this,k=0,l=a.length;k<l;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var n=[],a=this.vertices,k=0,l=b.length;k<l;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(l=this.vertices.length;k<l;k++)this.vertices[k].multiplyScalar(c);this.computeCentroids();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=void 0===d?!1:d,h,i,k,l,n=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++)k=i/b,k=a(k,l),e.push(k)}var m,s,r,p;for(h=0;h<c;h++)for(i=0;i<b;i++)a=h*n+i,e=h*n+i+1,l=(h+1)*n+i,k=(h+1)*n+i+1,m=new THREE.Vector2(i/b,h/c),s=new THREE.Vector2((i+1)/b,h/c),r=new THREE.Vector2(i/b,(h+1)/c),p=new THREE.Vector2((i+1)/b,(h+1)/c),d?(f.push(new THREE.Face3(a,e,l)),f.push(new THREE.Face3(e,
|
|
|
-k,l)),g.push([m,s,r]),g.push([s,p,r])):(f.push(new THREE.Face4(a,e,k,l)),g.push([m,s,p,r]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],h=0;h<c.length;){var i=c[h],k=f,l=a[i[0]],n;n=l;var m=a[i[1]],s=a[i[2]],r=new THREE.Vector3,p=new THREE.Vector3;r.subVectors(s,m);p.subVectors(n,m);r.cross(p);r.normalize();n=r;l=n.dot(l);
|
|
|
-if(n.dot(k)>=l){for(k=0;3>k;k++){l=[i[k],i[(k+1)%3]];n=!0;for(m=0;m<g.length;m++)if(g[m][0]===l[1]&&g[m][1]===l[0]){g[m]=g[g.length-1];g.pop();n=!1;break}n&&g.push(l)}c[h]=c[c.length-1];c.pop()}else h++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;3>h;h++)void 0===f[g[h]]&&(f[g[h]]=e++,this.vertices.push(a[g[h]])),g[h]=f[g[h]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)g=
|
|
|
+for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var n=[],a=this.vertices,j=0,k=b.length;j<k;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=void 0===d?!1:d,h,i,j,k,n=b+1;for(h=0;h<=c;h++){k=h/c;for(i=0;i<=b;i++)j=i/b,j=a(j,k),e.push(j)}var m,s,u,p;for(h=0;h<c;h++)for(i=0;i<b;i++)a=h*n+i,e=h*n+i+1,k=(h+1)*n+i,j=(h+1)*n+i+1,m=new THREE.Vector2(i/b,h/c),s=new THREE.Vector2((i+1)/b,h/c),u=new THREE.Vector2(i/b,(h+1)/c),p=new THREE.Vector2((i+1)/b,(h+1)/c),d?(f.push(new THREE.Face3(a,e,k)),f.push(new THREE.Face3(e,
|
|
|
+j,k)),g.push([m,s,u]),g.push([s,p,u])):(f.push(new THREE.Face4(a,e,j,k)),g.push([m,s,p,u]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],h=0;h<c.length;){var i=c[h],j=f,k=a[i[0]],n;n=k;var m=a[i[1]],s=a[i[2]],u=new THREE.Vector3,p=new THREE.Vector3;u.subVectors(s,m);p.subVectors(n,m);u.cross(p);u.normalize();n=u;k=n.dot(k);
|
|
|
+if(n.dot(j)>=k){for(j=0;3>j;j++){k=[i[j],i[(j+1)%3]];n=!0;for(m=0;m<g.length;m++)if(g[m][0]===k[1]&&g[m][1]===k[0]){g[m]=g[g.length-1];g.pop();n=!1;break}n&&g.push(k)}c[h]=c[c.length-1];c.pop()}else h++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;3>h;h++)void 0===f[g[h]]&&(f[g[h]]=e++,this.vertices.push(a[g[h]])),g[h]=f[g[h]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)g=
|
|
|
this.faces[d],this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a||1,0,0),new THREE.Vector3,new THREE.Vector3(0,a||1,0),new THREE.Vector3,new THREE.Vector3(0,0,a||1));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===c&&(c=20);void 0===d&&(d=16776960);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);b instanceof THREE.Vector3&&(this.position=
|
|
|
b);this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(a){var b=THREE.ArrowHelper.__v1.copy(a).normalize();0.999<b.y?this.rotation.set(0,0,0):-0.999>b.y?this.rotation.set(Math.PI,0,0):(a=THREE.ArrowHelper.__v2.set(b.z,0,-b.x).normalize(),b=Math.acos(b.y),a=THREE.ArrowHelper.__q1.setFromAxisAngle(a,b),this.rotation.setEulerFromQuaternion(a,this.eulerOrder))};
|
|
@@ -648,7 +652,7 @@ new THREE.Mesh(d,f);this.lightRays=new THREE.Line(e,g,THREE.LinePieces);this.add
|
|
|
!0,this.targetSphere.properties.gizmoSubject=a.target,this.targetSphere.properties.gizmoRoot=this.targetSphere,c=new THREE.LineDashedMaterial({color:c,dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1}),d=new THREE.Geometry,d.vertices.push(this.position.clone()),d.vertices.push(this.targetSphere.position.clone()),d.computeLineDistances(),this.targetLine=new THREE.Line(d,c),this.targetLine.properties.isGizmo=!0);this.properties.isGizmo=!0};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.DirectionalLightHelper.prototype.update=function(){this.direction.subVectors(this.light.target.position,this.light.position);var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);null!==this.targetSphere&&(this.targetSphere.material.color.copy(this.color),this.targetLine.material.color.copy(this.color),this.targetLine.geometry.vertices[0].copy(this.light.position),
|
|
|
this.targetLine.geometry.vertices[1].copy(this.light.target.position),this.targetLine.geometry.computeLineDistances(),this.targetLine.geometry.verticesNeedUpdate=!0)};THREE.HemisphereLightHelper=function(a,b,c){THREE.Object3D.call(this);this.light=a;this.position=a.position;var d=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(d);var e=this.color.getHex();this.groundColor=a.groundColor.clone();this.groundColor.multiplyScalar(d);for(var d=this.groundColor.getHex(),f=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0,0.5*Math.PI),g=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0.5*Math.PI,Math.PI),h=new THREE.MeshBasicMaterial({color:e,
|
|
|
-fog:!1}),i=new THREE.MeshBasicMaterial({color:d,fog:!1}),k=0,l=f.faces.length;k<l;k++)f.faces[k].materialIndex=0;k=0;for(l=g.faces.length;k<l;k++)g.faces[k].materialIndex=1;THREE.GeometryUtils.merge(f,g);this.lightSphere=new THREE.Mesh(f,new THREE.MeshFaceMaterial([h,i]));this.lightArrow=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,1.1*(b+c),0),c,e);this.lightArrow.rotation.x=Math.PI;this.lightArrowGround=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1.1*
|
|
|
+fog:!1}),i=new THREE.MeshBasicMaterial({color:d,fog:!1}),j=0,k=f.faces.length;j<k;j++)f.faces[j].materialIndex=0;j=0;for(k=g.faces.length;j<k;j++)g.faces[j].materialIndex=1;THREE.GeometryUtils.merge(f,g);this.lightSphere=new THREE.Mesh(f,new THREE.MeshFaceMaterial([h,i]));this.lightArrow=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,1.1*(b+c),0),c,e);this.lightArrow.rotation.x=Math.PI;this.lightArrowGround=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1.1*
|
|
|
(b+c),0),c,d);b=new THREE.Object3D;b.rotation.x=0.5*-Math.PI;b.add(this.lightSphere);b.add(this.lightArrow);b.add(this.lightArrowGround);this.add(b);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.properties.isGizmo=!0;this.target=new THREE.Vector3;this.lookAt(this.target)};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.HemisphereLightHelper.prototype.update=function(){var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.groundColor.copy(this.light.groundColor);this.groundColor.multiplyScalar(a);this.lightSphere.material.materials[0].color.copy(this.color);this.lightSphere.material.materials[1].color.copy(this.groundColor);this.lightArrow.setColor(this.color.getHex());this.lightArrowGround.setColor(this.groundColor.getHex());this.lookAt(this.target)};THREE.PointLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;var c=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(c);var d=this.color.getHex(),c=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.IcosahedronGeometry(1,2),g=new THREE.MeshBasicMaterial({color:d,fog:!1}),h=new THREE.LineBasicMaterial({color:d,fog:!1}),d=new THREE.MeshBasicMaterial({color:d,fog:!1,wireframe:!0,opacity:0.1,
|
|
|
transparent:!0});this.lightSphere=new THREE.Mesh(c,g);this.lightRays=new THREE.Line(e,h,THREE.LinePieces);this.lightDistance=new THREE.Mesh(f,d);c=a.distance;0===c?this.lightDistance.visible=!1:this.lightDistance.scale.set(c,c,c);this.add(this.lightSphere);this.add(this.lightRays);this.add(this.lightDistance);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.properties.isGizmo=!0};THREE.PointLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -666,38 +670,38 @@ THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=thi
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
|
|
|
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,i,k,l,n,m,s;this.init=function(r){b=r.context;c=r;d=r.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);r=0;e[r++]=-1;e[r++]=-1;
|
|
|
-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,n=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};s={};m.vertex=b.getAttribLocation(n,"position");m.uv=b.getAttribLocation(n,"uv");s.renderType=b.getUniformLocation(n,"renderType");s.map=b.getUniformLocation(n,"map");s.occlusionMap=b.getUniformLocation(n,"occlusionMap");s.opacity=
|
|
|
-b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,t=a.length;if(t){var v=new THREE.Vector3,w=f/e,E=0.5*e,J=0.5*f,A=16/f,z=new THREE.Vector2(A*w,A),G=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),F=s,A=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
|
|
|
-b.uniform1i(F.occlusionMap,0);b.uniform1i(F.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,B,T,C,K;for(V=0;V<t;V++)if(A=16/f,z.set(A*w,A),C=a[V],v.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),G.copy(v),I.x=G.x*E+E,
|
|
|
-I.y=G.y*J+J,l||0<I.x&&I.x<e&&0<I.y&&I.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,z.x,z.y);b.uniform3f(F.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,I.x-8,I.y-8,16,16,0);b.uniform1i(F.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);C.positionScreen.copy(G);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);B=0;for(T=C.lensFlares.length;B<T;B++)K=C.lensFlares[B],0.001<K.opacity&&0.001<K.scale&&(G.x=K.x,G.y=K.y,G.z=K.z,A=K.size*K.scale/f,z.x=A*w,z.y=A,b.uniform3f(F.screenPosition,G.x,G.y,G.z),b.uniform2f(F.scale,z.x,z.y),b.uniform1f(F.rotation,K.rotation),b.uniform1f(F.opacity,
|
|
|
-K.opacity),b.uniform3f(F.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,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var s,r,p,q,x,t,v,w,E,J=[];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=n.__lights.length;s<r;s++)if(p=n.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(x=0;x<p.shadowCascadeCount;x++){var A;if(p.shadowCascadeArray[x])A=p.shadowCascadeArray[x];else{E=p;v=x;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=E.shadowCameraNear;A.shadowCameraFar=E.shadowCameraFar;A.shadowCameraLeft=E.shadowCameraLeft;A.shadowCameraRight=E.shadowCameraRight;
|
|
|
-A.shadowCameraBottom=E.shadowCameraBottom;A.shadowCameraTop=E.shadowCameraTop;A.shadowCameraVisible=E.shadowCameraVisible;A.shadowDarkness=E.shadowDarkness;A.shadowBias=E.shadowCascadeBias[v];A.shadowMapWidth=E.shadowCascadeWidth[v];A.shadowMapHeight=E.shadowCascadeHeight[v];A.pointsWorld=[];A.pointsFrustum=[];w=A.pointsWorld;t=A.pointsFrustum;for(var z=0;8>z;z++)w[z]=new THREE.Vector3,t[z]=new THREE.Vector3;w=E.shadowCascadeNearZ[v];E=E.shadowCascadeFarZ[v];t[0].set(-1,-1,w);t[1].set(1,-1,w);t[2].set(-1,
|
|
|
-1,w);t[3].set(1,1,w);t[4].set(-1,-1,E);t[5].set(1,-1,E);t[6].set(-1,1,E);t[7].set(1,1,E);A.originalCamera=m;t=new THREE.Gyroscope;t.position=p.shadowCascadeOffset;t.add(A);t.add(A.target);m.add(t);p.shadowCascadeArray[x]=A;console.log("Created virtualLight",A)}v=p;w=x;E=v.shadowCascadeArray[w];E.position.copy(v.position);E.target.position.copy(v.target.position);E.lookAt(E.target);E.shadowCameraVisible=v.shadowCameraVisible;E.shadowDarkness=v.shadowDarkness;E.shadowBias=v.shadowCascadeBias[w];t=v.shadowCascadeNearZ[w];
|
|
|
-v=v.shadowCascadeFarZ[w];E=E.pointsFrustum;E[0].z=t;E[1].z=t;E[2].z=t;E[3].z=t;E[4].z=v;E[5].z=v;E[6].z=v;E[7].z=v;J[q]=A;q++}else J[q]=p,q++;s=0;for(r=J.length;s<r;s++){p=J[s];p.shadowMap||(x=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(x=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:x,magFilter:x,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,i,j,k,n,m,s;this.init=function(u){b=u.context;c=u;d=u.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);u=0;e[u++]=-1;e[u++]=-1;
|
|
|
+e[u++]=0;e[u++]=0;e[u++]=1;e[u++]=-1;e[u++]=1;e[u++]=0;e[u++]=1;e[u++]=1;e[u++]=1;e[u++]=1;e[u++]=-1;e[u++]=1;e[u++]=0;e[u++]=1;u=0;f[u++]=0;f[u++]=1;f[u++]=2;f[u++]=0;f[u++]=2;f[u++]=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();j=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,j);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)?(k=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(k=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};s={};m.vertex=b.getAttribLocation(n,"position");m.uv=b.getAttribLocation(n,"uv");s.renderType=b.getUniformLocation(n,"renderType");s.map=b.getUniformLocation(n,"map");s.occlusionMap=b.getUniformLocation(n,"occlusionMap");s.opacity=
|
|
|
+b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,v=a.length;if(v){var y=new THREE.Vector3,z=f/e,r=0.5*e,E=0.5*f,D=16/f,l=new THREE.Vector2(D*z,D),H=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),B=s,D=m;b.useProgram(n);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
|
|
|
+b.uniform1i(B.occlusionMap,0);b.uniform1i(B.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var N,A,Q,C,G;for(N=0;N<v;N++)if(D=16/f,l.set(D*z,D),C=a[N],y.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),y.applyMatrix4(d.matrixWorldInverse),y.applyProjection(d.projectionMatrix),H.copy(y),F.x=H.x*r+r,
|
|
|
+F.y=H.y*E+E,k||0<F.x&&F.x<e&&0<F.y&&F.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(B.renderType,0);b.uniform2f(B.scale,l.x,l.y);b.uniform3f(B.screenPosition,H.x,H.y,H.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(B.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);C.positionScreen.copy(H);C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares();b.uniform1i(B.renderType,2);b.enable(b.BLEND);A=0;for(Q=C.lensFlares.length;A<Q;A++)G=C.lensFlares[A],0.001<G.opacity&&0.001<G.scale&&(H.x=G.x,H.y=G.y,H.z=G.z,D=G.size*G.scale/f,l.x=D*z,l.y=D,b.uniform3f(B.screenPosition,H.x,H.y,H.z),b.uniform2f(B.scale,l.x,l.y),b.uniform1f(B.rotation,G.rotation),b.uniform1f(B.opacity,
|
|
|
+G.opacity),b.uniform3f(B.color,G.color.r,G.color.g,G.color.b),c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst),c.setTexture(G.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,j=new THREE.Vector3,k=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(n,m){var s,u,p,q,w,v,y,z,r,E=[];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(u=n.__lights.length;s<u;s++)if(p=n.__lights[s],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(w=0;w<p.shadowCascadeCount;w++){var D;if(p.shadowCascadeArray[w])D=p.shadowCascadeArray[w];else{r=p;y=w;D=new THREE.DirectionalLight;D.isVirtual=!0;D.onlyShadow=!0;D.castShadow=!0;D.shadowCameraNear=r.shadowCameraNear;D.shadowCameraFar=r.shadowCameraFar;D.shadowCameraLeft=r.shadowCameraLeft;D.shadowCameraRight=r.shadowCameraRight;
|
|
|
+D.shadowCameraBottom=r.shadowCameraBottom;D.shadowCameraTop=r.shadowCameraTop;D.shadowCameraVisible=r.shadowCameraVisible;D.shadowDarkness=r.shadowDarkness;D.shadowBias=r.shadowCascadeBias[y];D.shadowMapWidth=r.shadowCascadeWidth[y];D.shadowMapHeight=r.shadowCascadeHeight[y];D.pointsWorld=[];D.pointsFrustum=[];z=D.pointsWorld;v=D.pointsFrustum;for(var l=0;8>l;l++)z[l]=new THREE.Vector3,v[l]=new THREE.Vector3;z=r.shadowCascadeNearZ[y];r=r.shadowCascadeFarZ[y];v[0].set(-1,-1,z);v[1].set(1,-1,z);v[2].set(-1,
|
|
|
+1,z);v[3].set(1,1,z);v[4].set(-1,-1,r);v[5].set(1,-1,r);v[6].set(-1,1,r);v[7].set(1,1,r);D.originalCamera=m;v=new THREE.Gyroscope;v.position=p.shadowCascadeOffset;v.add(D);v.add(D.target);m.add(v);p.shadowCascadeArray[w]=D;console.log("Created virtualLight",D)}y=p;z=w;r=y.shadowCascadeArray[z];r.position.copy(y.position);r.target.position.copy(y.target.position);r.lookAt(r.target);r.shadowCameraVisible=y.shadowCameraVisible;r.shadowDarkness=y.shadowDarkness;r.shadowBias=y.shadowCascadeBias[z];v=y.shadowCascadeNearZ[z];
|
|
|
+y=y.shadowCascadeFarZ[z];r=r.pointsFrustum;r[0].z=v;r[1].z=v;r[2].z=v;r[3].z=v;r[4].z=y;r[5].z=y;r[6].z=y;r[7].z=y;E[q]=D;q++}else E[q]=p,q++;s=0;for(u=E.length;s<u;s++){p=E[s];p.shadowMap||(w=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(w=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:w,magFilter:w,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}n.add(p.shadowCamera);b.autoUpdateScene&&n.updateMatrixWorld()}p.shadowCameraVisible&&
|
|
|
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&A.originalCamera==m){x=m;q=p.shadowCamera;t=p.pointsFrustum;E=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=E[v],w.copy(t[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,x),w.applyMatrix4(q.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
-(k.z=w.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;t=p.shadowMatrix;x=p.shadowCamera;x.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);x.lookAt(l);x.updateMatrixWorld();x.matrixWorldInverse.getInverse(x.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiply(x.projectionMatrix);t.multiply(x.matrixWorldInverse);
|
|
|
-h.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();E=n.__webglObjects;p=0;for(q=E.length;p<q;p++)if(v=E[p],t=v.object,v.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||g.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),v.render=!0;p=0;for(q=E.length;p<q;p++)v=E[p],v.render&&(t=v.object,v=v.buffer,z=t.material instanceof THREE.MeshFaceMaterial?
|
|
|
-t.material.materials[0]:t.material,w=0<t.geometry.morphTargets.length&&z.morphTargets,z=t instanceof THREE.SkinnedMesh&&z.skinning,w=t.customDepthMaterial?t.customDepthMaterial:z?w?f:e:w?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(x,n.__lights,null,w,v,t):b.renderBuffer(x,n.__lights,null,w,v,t));E=n.__webglObjectsImmediate;p=0;for(q=E.length;p<q;p++)v=E[p],t=v.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(x,
|
|
|
-n.__lights,null,c,t))}s=b.getClearColor();r=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();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);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(s,p+a.fragmentShader);b.shaderSource(r,p+a.vertexShader);b.compileShader(s);b.compileShader(r);b.attachShader(m,s);b.attachShader(m,r);b.linkProgram(m);i=m;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
|
|
|
-"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 x=k,t=l,v=r/
|
|
|
-f,f=0.5*f,w=0.5*r;b.useProgram(i);b.enableVertexAttribArray(x.position);b.enableVertexAttribArray(x.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(x.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(x.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(t.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);var E=x=0,J=d.fog;J?(b.uniform3f(t.fogColor,J.color.r,J.color.g,J.color.b),
|
|
|
-J instanceof THREE.Fog?(b.uniform1f(t.fogNear,J.near),b.uniform1f(t.fogFar,J.far),b.uniform1i(t.fogType,1),E=x=1):J instanceof THREE.FogExp2&&(b.uniform1f(t.fogDensity,J.density),b.uniform1i(t.fogType,2),E=x=2)):(b.uniform1i(t.fogType,0),E=x=0);for(var A,z,G=[],J=0;J<q;J++)A=p[J],z=A.material,A.visible&&0!==z.opacity&&(z.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,A.matrixWorld),A.z=-A._modelViewMatrix.elements[14]));p.sort(a);for(J=0;J<q;J++)A=
|
|
|
-p[J],z=A.material,A.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(t.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(t.useScreenCoordinates,1),b.uniform3f(t.screenPosition,(A.position.x*c.devicePixelRatio-f)/f,(w-A.position.y*c.devicePixelRatio)/w,Math.max(0,Math.min(1,A.position.z))),G[0]=c.devicePixelRatio,G[1]=c.devicePixelRatio):(b.uniform1i(t.useScreenCoordinates,0),b.uniform1i(t.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(t.modelViewMatrix,
|
|
|
-!1,A._modelViewMatrix.elements),G[0]=1,G[1]=1),e=d.fog&&z.fog?E:0,x!==e&&(b.uniform1i(t.fogType,e),x=e),e=1/(z.scaleByViewport?r:1),G[0]*=e*v*A.scale.x,G[1]*=e*A.scale.y,b.uniform2f(t.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(t.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(t.alignment,z.alignment.x,z.alignment.y),b.uniform1f(t.opacity,z.opacity),b.uniform3f(t.color,z.color.r,z.color.g,z.color.b),b.uniform1f(t.rotation,A.rotation),b.uniform2fv(t.scale,G),c.setBlending(z.blending,z.blendEquation,
|
|
|
-z.blendSrc,z.blendDst),c.setDepthTest(z.depthTest),c.setDepthWrite(z.depthWrite),c.setTexture(z.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,n,m,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(n=p.length;l<n;l++)if(m=p[l],r=m.object,m.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||g.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),m.render=!0;var q;l=0;for(n=p.length;l<n;l++)if(m=p[l],m.render&&(r=m.object,m=m.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(q=
|
|
|
-r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),s=0<r.geometry.morphTargets.length&&q.morphTargets,q=r instanceof THREE.SkinnedMesh&&q.skinning,s=r.customDepthMaterial?r.customDepthMaterial:q?s?f:e:s?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,s,m,r):b.renderBuffer(k,i.__lights,null,s,m,r);p=i.__webglObjectsImmediate;l=0;for(n=p.length;l<n;l++)m=p[l],r=m.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
|
-r.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,r));l=b.getClearColor();n=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,n);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&D.originalCamera==m){w=m;q=p.shadowCamera;v=p.pointsFrustum;r=p.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(y=0;8>y;y++)z=r[y],z.copy(v[y]),THREE.ShadowMapPlugin.__projector.unprojectVector(z,w),z.applyMatrix4(q.matrixWorldInverse),z.x<i.x&&(i.x=z.x),z.x>j.x&&(j.x=z.x),z.y<i.y&&(i.y=z.y),z.y>j.y&&(j.y=z.y),z.z<i.z&&(i.z=z.z),z.z>j.z&&
|
|
|
+(j.z=z.z);q.left=i.x;q.right=j.x;q.top=j.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;v=p.shadowMatrix;w=p.shadowCamera;w.position.getPositionFromMatrix(p.matrixWorld);k.getPositionFromMatrix(p.target.matrixWorld);w.lookAt(k);w.updateMatrixWorld();w.matrixWorldInverse.getInverse(w.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(w.projectionMatrix);v.multiply(w.matrixWorldInverse);
|
|
|
+h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();r=n.__webglObjects;p=0;for(q=r.length;p<q;p++)if(y=r[p],v=y.object,y.render=!1,v.visible&&v.castShadow&&(!(v instanceof THREE.Mesh||v instanceof THREE.ParticleSystem)||!v.frustumCulled||g.intersectsObject(v)))v._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,v.matrixWorld),y.render=!0;p=0;for(q=r.length;p<q;p++)y=r[p],y.render&&(v=y.object,y=y.buffer,l=v.material instanceof THREE.MeshFaceMaterial?
|
|
|
+v.material.materials[0]:v.material,z=0<v.geometry.morphTargets.length&&l.morphTargets,l=v instanceof THREE.SkinnedMesh&&l.skinning,z=v.customDepthMaterial?v.customDepthMaterial:l?z?f:e:z?d:c,y instanceof THREE.BufferGeometry?b.renderBufferDirect(w,n.__lights,null,z,y,v):b.renderBuffer(w,n.__lights,null,z,y,v));r=n.__webglObjectsImmediate;p=0;for(q=r.length;p<q;p++)y=r[p],v=y.object,v.visible&&v.castShadow&&(v._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,v.matrixWorld),b.renderImmediateObject(w,
|
|
|
+n.__lights,null,c,v))}s=b.getClearColor();u=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,u);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,j,k;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();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);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),u=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(s,p+a.fragmentShader);b.shaderSource(u,p+a.vertexShader);b.compileShader(s);b.compileShader(u);b.attachShader(m,s);b.attachShader(m,u);b.linkProgram(m);i=m;j={};k={};j.position=b.getAttribLocation(i,"position");j.uv=b.getAttribLocation(i,
|
|
|
+"uv");k.uvOffset=b.getUniformLocation(i,"uvOffset");k.uvScale=b.getUniformLocation(i,"uvScale");k.rotation=b.getUniformLocation(i,"rotation");k.scale=b.getUniformLocation(i,"scale");k.alignment=b.getUniformLocation(i,"alignment");k.color=b.getUniformLocation(i,"color");k.map=b.getUniformLocation(i,"map");k.opacity=b.getUniformLocation(i,"opacity");k.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");k.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");k.screenPosition=b.getUniformLocation(i,
|
|
|
+"screenPosition");k.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");k.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");k.fogType=b.getUniformLocation(i,"fogType");k.fogDensity=b.getUniformLocation(i,"fogDensity");k.fogNear=b.getUniformLocation(i,"fogNear");k.fogFar=b.getUniformLocation(i,"fogFar");k.fogColor=b.getUniformLocation(i,"fogColor");k.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,u){var p=d.__webglSprites,q=p.length;if(q){var w=j,v=k,y=u/
|
|
|
+f,f=0.5*f,z=0.5*u;b.useProgram(i);b.enableVertexAttribArray(w.position);b.enableVertexAttribArray(w.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(w.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(w.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 r=w=0,E=d.fog;E?(b.uniform3f(v.fogColor,E.color.r,E.color.g,E.color.b),
|
|
|
+E instanceof THREE.Fog?(b.uniform1f(v.fogNear,E.near),b.uniform1f(v.fogFar,E.far),b.uniform1i(v.fogType,1),r=w=1):E instanceof THREE.FogExp2&&(b.uniform1f(v.fogDensity,E.density),b.uniform1i(v.fogType,2),r=w=2)):(b.uniform1i(v.fogType,0),r=w=0);for(var D,l,H=[],E=0;E<q;E++)D=p[E],l=D.material,D.visible&&0!==l.opacity&&(l.useScreenCoordinates?D.z=-D.position.z:(D._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,D.matrixWorld),D.z=-D._modelViewMatrix.elements[14]));p.sort(a);for(E=0;E<q;E++)D=
|
|
|
+p[E],l=D.material,D.visible&&0!==l.opacity&&(l.map&&l.map.image&&l.map.image.width)&&(b.uniform1f(v.alphaTest,l.alphaTest),!0===l.useScreenCoordinates?(b.uniform1i(v.useScreenCoordinates,1),b.uniform3f(v.screenPosition,(D.position.x*c.devicePixelRatio-f)/f,(z-D.position.y*c.devicePixelRatio)/z,Math.max(0,Math.min(1,D.position.z))),H[0]=c.devicePixelRatio,H[1]=c.devicePixelRatio):(b.uniform1i(v.useScreenCoordinates,0),b.uniform1i(v.sizeAttenuation,l.sizeAttenuation?1:0),b.uniformMatrix4fv(v.modelViewMatrix,
|
|
|
+!1,D._modelViewMatrix.elements),H[0]=1,H[1]=1),e=d.fog&&l.fog?r:0,w!==e&&(b.uniform1i(v.fogType,e),w=e),e=1/(l.scaleByViewport?u:1),H[0]*=e*y*D.scale.x,H[1]*=e*D.scale.y,b.uniform2f(v.uvScale,l.uvScale.x,l.uvScale.y),b.uniform2f(v.uvOffset,l.uvOffset.x,l.uvOffset.y),b.uniform2f(v.alignment,l.alignment.x,l.alignment.y),b.uniform1f(v.opacity,l.opacity),b.uniform3f(v.color,l.color.r,l.color.g,l.color.b),b.uniform1f(v.rotation,D.rotation),b.uniform2fv(v.scale,H),c.setBlending(l.blending,l.blendEquation,
|
|
|
+l.blendSrc,l.blendDst),c.setDepthTest(l.depthTest),c.setDepthWrite(l.depthWrite),c.setTexture(l.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,j){var k,n,m,s,u,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();j.matrixWorldInverse.getInverse(j.matrixWorld);h.multiplyMatrices(j.projectionMatrix,
|
|
|
+j.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;k=0;for(n=p.length;k<n;k++)if(m=p[k],u=m.object,m.render=!1,u.visible&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||g.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,u.matrixWorld),m.render=!0;var q;k=0;for(n=p.length;k<n;k++)if(m=p[k],m.render&&(u=m.object,m=m.buffer,!(u instanceof THREE.ParticleSystem)||u.customDepthMaterial))(q=
|
|
|
+u.material instanceof THREE.MeshFaceMaterial?u.material.materials[0]:u.material)&&b.setMaterialFaces(u.material),s=0<u.geometry.morphTargets.length&&q.morphTargets,q=u instanceof THREE.SkinnedMesh&&q.skinning,s=u.customDepthMaterial?u.customDepthMaterial:q?s?f:e:s?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(j,i.__lights,null,s,m,u):b.renderBuffer(j,i.__lights,null,s,m,u);p=i.__webglObjectsImmediate;k=0;for(n=p.length;k<n;k++)m=p[k],u=m.object,u.visible&&(u._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,
|
|
|
+u.matrixWorld),b.renderImmediateObject(j,i.__lights,null,c,u));k=b.getClearColor();n=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,n);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
|
|
|
fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}};
|