|
@@ -26,14 +26,14 @@ 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=Mat
|
|
|
-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},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)},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);this.onChangeCallback();return this},
|
|
|
multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .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,g=a._w,f=b._x,h=b._y,k=b._z,n=b._w;this._x=c*n+g*f+d*k-e*h;this._y=d*n+g*h+e*f-c*k;this._z=e*n+g*k+c*h-d*f;this._w=g*n-c*f-d*h-e*k;this.onChangeCallback();return this},multiplyVector3:function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");
|
|
|
return a.applyQuaternion(this)},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,g=this._w,f=g*a._w+c*a._x+d*a._y+e*a._z;0>f?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,f=-f):this.copy(a);if(1<=f)return this._w=g,this._x=c,this._y=d,this._z=e,this;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(.001>Math.abs(k))return this._w=.5*(g+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;f=Math.sin((1-b)*h)/k;h=
|
|
|
-Math.sin(b*h)/k;this._w=g*f+this._w*h;this._x=c*f+this._x*h;this._y=d*f+this._y*h;this._z=e*f+this._z*h;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(){return[this._x,this._y,this._z,this._w]},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){},
|
|
|
-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};
|
|
|
+Math.sin(b*h)/k;this._w=g*f+this._w*h;this._x=c*f+this._x*h;this._y=d*f+this._y*h;this._z=e*f+this._z*h;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=
|
|
|
+a;return this},onChangeCallback:function(){},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.Vector2.prototype={constructor:THREE.Vector2,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!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},
|
|
|
subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):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);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);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);return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector2,b=new THREE.Vector2);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},
|
|
|
roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=
|
|
|
-this.x-a.x;a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(){return[this.x,this.y]},clone:function(){return new THREE.Vector2(this.x,this.y)}};
|
|
|
+this.x-a.x;a=this.y-a.y;return b*b+a*a},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;return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},clone:function(){return new THREE.Vector2(this.x,this.y)}};
|
|
|
THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
|
|
|
THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=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;case 2:return this.z;default:throw Error("index is out of range: "+
|
|
|
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("THREE.Vector3: .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("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
|
|
@@ -50,7 +50,7 @@ projectOnVector:function(){var a,b;return function(c){void 0===a&&(a=new THREE.V
|
|
|
return Math.acos(THREE.Math.clamp(a,-1,1))},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},setEulerFromRotationMatrix:function(a,b){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(a,b){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},
|
|
|
getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(a,
|
|
|
b)},setFromMatrixPosition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setFromMatrixScale: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},setFromMatrixColumn:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===
|
|
|
-this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},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};
|
|
|
+this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},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};
|
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=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;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("THREE.Vector4: .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("THREE.Vector4: .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=
|
|
@@ -60,8 +60,8 @@ b=d/c,d=k/c):.01>n?(c=b=.707106781,d=0):(d=Math.sqrt(n),b=g/d,c=k/d);this.set(b,
|
|
|
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},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector4,b=new THREE.Vector4);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);
|
|
|
return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);
|
|
|
return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},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},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},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.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ";
|
|
|
+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},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=
|
|
|
+this.z;a[b+3]=this.w;return a},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ";
|
|
|
THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this},copy:function(a){this._x=
|
|
|
a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b){var c=THREE.Math.clamp,d=a.elements,e=d[0],g=d[4],f=d[8],h=d[1],k=d[5],n=d[9],p=d[2],l=d[6],d=d[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(-n,d),this._z=Math.atan2(-g,e)):(this._x=Math.atan2(l,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(f,d),this._z=Math.atan2(h,k)):(this._y=
|
|
|
Math.atan2(-p,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-p,d),this._z=Math.atan2(-g,k)):(this._y=0,this._z=Math.atan2(h,e))):"ZYX"===b?(this._y=Math.asin(-c(p,-1,1)),.99999>Math.abs(p)?(this._x=Math.atan2(l,d),this._z=Math.atan2(h,e)):(this._x=0,this._z=Math.atan2(-g,k))):"YZX"===b?(this._z=Math.asin(c(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-n,k),this._y=Math.atan2(-p,e)):(this._x=0,this._y=Math.atan2(f,d))):"XZY"===b?(this._z=Math.asin(-c(g,
|
|
@@ -98,8 +98,8 @@ console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotati
|
|
|
b[10]=g*f):"ZXY"===a.order?(a=f*h,k=f*e,n=d*h,p=d*e,b[0]=a-p*c,b[4]=-g*e,b[8]=n+k*c,b[1]=k+n*c,b[5]=g*h,b[9]=p-a*c,b[2]=-g*d,b[6]=c,b[10]=g*f):"ZYX"===a.order?(a=g*h,k=g*e,n=c*h,p=c*e,b[0]=f*h,b[4]=n*d-k,b[8]=a*d+p,b[1]=f*e,b[5]=p*d+a,b[9]=k*d-n,b[2]=-d,b[6]=c*f,b[10]=g*f):"YZX"===a.order?(a=g*f,k=g*d,n=c*f,p=c*d,b[0]=f*h,b[4]=p-a*e,b[8]=n*e+k,b[1]=e,b[5]=g*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+n,b[10]=a-p*e):"XZY"===a.order&&(a=g*f,k=g*d,n=c*f,p=c*d,b[0]=f*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=g*h,b[9]=k*
|
|
|
e-n,b[2]=n*e-k,b[6]=c*h,b[10]=p*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,g=a.w,f=c+c,h=d+d,k=e+e;a=c*f;var n=c*h,c=c*k,p=d*h,d=d*k,e=e*k,f=g*f,h=g*h,g=g*k;b[0]=1-(p+e);b[4]=n-g;b[8]=c+h;b[1]=n+g;b[5]=1-
|
|
|
(a+e);b[9]=d-f;b[2]=c-h;b[6]=d+f;b[10]=1-(a+p);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,g){var f=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(g,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(g,c).normalize());b.crossVectors(c,a);f[0]=a.x;f[4]=b.x;f[8]=c.x;f[1]=a.y;f[5]=b.y;f[9]=c.y;f[2]=a.z;f[6]=b.z;f[10]=c.z;return this}}(),
|
|
|
-multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .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,g=c[0],f=c[4],h=c[8],k=c[12],n=c[1],p=c[5],l=c[9],r=c[13],q=c[2],t=c[6],s=c[10],v=c[14],w=c[3],u=c[7],A=c[11],c=c[15],x=d[0],G=d[4],E=d[8],B=d[12],y=d[1],C=d[5],Q=d[9],F=d[13],K=d[2],M=d[6],W=d[10],T=d[14],P=d[3],
|
|
|
-I=d[7],R=d[11],d=d[15];e[0]=g*x+f*y+h*K+k*P;e[4]=g*G+f*C+h*M+k*I;e[8]=g*E+f*Q+h*W+k*R;e[12]=g*B+f*F+h*T+k*d;e[1]=n*x+p*y+l*K+r*P;e[5]=n*G+p*C+l*M+r*I;e[9]=n*E+p*Q+l*W+r*R;e[13]=n*B+p*F+l*T+r*d;e[2]=q*x+t*y+s*K+v*P;e[6]=q*G+t*C+s*M+v*I;e[10]=q*E+t*Q+s*W+v*R;e[14]=q*B+t*F+s*T+v*d;e[3]=w*x+u*y+A*K+c*P;e[7]=w*G+u*C+A*M+c*I;e[11]=w*E+u*Q+A*W+c*R;e[15]=w*B+u*F+A*T+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]=
|
|
|
+multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .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,g=c[0],f=c[4],h=c[8],k=c[12],n=c[1],p=c[5],l=c[9],r=c[13],q=c[2],t=c[6],s=c[10],v=c[14],w=c[3],u=c[7],A=c[11],c=c[15],x=d[0],G=d[4],E=d[8],B=d[12],y=d[1],C=d[5],P=d[9],F=d[13],K=d[2],M=d[6],W=d[10],T=d[14],Q=d[3],
|
|
|
+I=d[7],R=d[11],d=d[15];e[0]=g*x+f*y+h*K+k*Q;e[4]=g*G+f*C+h*M+k*I;e[8]=g*E+f*P+h*W+k*R;e[12]=g*B+f*F+h*T+k*d;e[1]=n*x+p*y+l*K+r*Q;e[5]=n*G+p*C+l*M+r*I;e[9]=n*E+p*P+l*W+r*R;e[13]=n*B+p*F+l*T+r*d;e[2]=q*x+t*y+s*K+v*Q;e[6]=q*G+t*C+s*M+v*I;e[10]=q*E+t*P+s*W+v*R;e[14]=q*B+t*F+s*T+v*d;e[3]=w*x+u*y+A*K+c*Q;e[7]=w*G+u*C+A*M+c*I;e[11]=w*E+u*P+A*W+c*R;e[15]=w*B+u*F+A*T+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("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function(){var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=
|
|
|
b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix4(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=
|
|
@@ -190,10 +190,10 @@ b||0===b.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0);
|
|
|
if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,g=c.length;e<g;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(b);a.center(d);for(var f=0,e=0,g=c.length;e<g;e+=3)b.set(c[e],c[e+1],c[e+2]),f=Math.max(f,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(f);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=
|
|
|
this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,g,f,h,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,l=new THREE.Vector3,r=new THREE.Vector3;if(a.index)for(var q=a.index.array,t=0<this.offsets.length?this.offsets:[{start:0,count:q.length,index:0}],s=0,v=t.length;s<v;++s){e=t[s].start;g=t[s].count;
|
|
|
for(var w=t[s].index,d=e,e=e+g;d<e;d+=3)g=3*(w+q[d]),f=3*(w+q[d+1]),h=3*(w+q[d+2]),k.fromArray(b,g),n.fromArray(b,f),p.fromArray(b,h),l.subVectors(p,n),r.subVectors(k,n),l.cross(r),c[g]+=l.x,c[g+1]+=l.y,c[g+2]+=l.z,c[f]+=l.x,c[f+1]+=l.y,c[f+2]+=l.z,c[h]+=l.x,c[h+1]+=l.y,c[h+2]+=l.z}else for(d=0,e=b.length;d<e;d+=9)k.fromArray(b,d),n.fromArray(b,d+3),p.fromArray(b,d+6),l.subVectors(p,n),r.subVectors(k,n),l.cross(r),c[d]=l.x,c[d+1]=l.y,c[d+2]=l.z,c[d+3]=l.x,c[d+4]=l.y,c[d+5]=l.z,c[d+6]=l.x,c[d+7]=l.y,
|
|
|
-c[d+8]=l.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){l.fromArray(d,3*a);r.fromArray(d,3*b);q.fromArray(d,3*c);t.fromArray(g,2*a);s.fromArray(g,2*b);v.fromArray(g,2*c);w=r.x-l.x;u=q.x-l.x;A=r.y-l.y;x=q.y-l.y;G=r.z-l.z;E=q.z-l.z;B=s.x-t.x;y=v.x-t.x;C=s.y-t.y;Q=v.y-t.y;F=1/(B*Q-y*C);K.set((Q*w-C*u)*F,(Q*A-C*x)*F,(Q*G-C*E)*F);M.set((B*u-y*w)*F,(B*x-y*A)*F,(B*E-y*G)*F);k[a].add(K);k[b].add(K);k[c].add(K);n[a].add(M);n[b].add(M);n[c].add(M)}function b(a){Aa.fromArray(e,
|
|
|
+c[d+8]=l.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){l.fromArray(d,3*a);r.fromArray(d,3*b);q.fromArray(d,3*c);t.fromArray(g,2*a);s.fromArray(g,2*b);v.fromArray(g,2*c);w=r.x-l.x;u=q.x-l.x;A=r.y-l.y;x=q.y-l.y;G=r.z-l.z;E=q.z-l.z;B=s.x-t.x;y=v.x-t.x;C=s.y-t.y;P=v.y-t.y;F=1/(B*P-y*C);K.set((P*w-C*u)*F,(P*A-C*x)*F,(P*G-C*E)*F);M.set((B*u-y*w)*F,(B*x-y*A)*F,(B*E-y*G)*F);k[a].add(K);k[b].add(K);k[c].add(K);n[a].add(M);n[b].add(M);n[c].add(M)}function b(a){Aa.fromArray(e,
|
|
|
3*a);O.copy(Aa);ia=k[a];ba.copy(ia);ba.sub(Aa.multiplyScalar(Aa.dot(ia))).normalize();ga.crossVectors(O,ia);Pa=ga.dot(n[a]);Ma=0>Pa?-1:1;h[4*a]=ba.x;h[4*a+1]=ba.y;h[4*a+2]=ba.z;h[4*a+3]=Ma}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,
|
|
|
-e=this.attributes.normal.array,g=this.attributes.uv.array,f=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*f),4));for(var h=this.attributes.tangent.array,k=[],n=[],p=0;p<f;p++)k[p]=new THREE.Vector3,n[p]=new THREE.Vector3;var l=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector2,s=new THREE.Vector2,v=new THREE.Vector2,w,u,A,x,G,E,B,y,C,Q,F,K=new THREE.Vector3,M=new THREE.Vector3,W,T,P,I,R;0===this.drawcalls.length&&
|
|
|
-this.addDrawCall(0,c.length,0);var ka=this.drawcalls,p=0;for(T=ka.length;p<T;++p){W=ka[p].start;P=ka[p].count;var X=ka[p].index,f=W;for(W+=P;f<W;f+=3)P=X+c[f],I=X+c[f+1],R=X+c[f+2],a(P,I,R)}var ba=new THREE.Vector3,ga=new THREE.Vector3,Aa=new THREE.Vector3,O=new THREE.Vector3,Ma,ia,Pa,p=0;for(T=ka.length;p<T;++p)for(W=ka[p].start,P=ka[p].count,X=ka[p].index,f=W,W+=P;f<W;f+=3)P=X+c[f],I=X+c[f+1],R=X+c[f+2],b(P),b(I),b(R)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;
|
|
|
+e=this.attributes.normal.array,g=this.attributes.uv.array,f=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*f),4));for(var h=this.attributes.tangent.array,k=[],n=[],p=0;p<f;p++)k[p]=new THREE.Vector3,n[p]=new THREE.Vector3;var l=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector2,s=new THREE.Vector2,v=new THREE.Vector2,w,u,A,x,G,E,B,y,C,P,F,K=new THREE.Vector3,M=new THREE.Vector3,W,T,Q,I,R;0===this.drawcalls.length&&
|
|
|
+this.addDrawCall(0,c.length,0);var ka=this.drawcalls,p=0;for(T=ka.length;p<T;++p){W=ka[p].start;Q=ka[p].count;var X=ka[p].index,f=W;for(W+=Q;f<W;f+=3)Q=X+c[f],I=X+c[f+1],R=X+c[f+2],a(Q,I,R)}var ba=new THREE.Vector3,ga=new THREE.Vector3,Aa=new THREE.Vector3,O=new THREE.Vector3,Ma,ia,Pa,p=0;for(T=ka.length;p<T;++p)for(W=ka[p].start,Q=ka[p].count,X=ka[p].index,f=W,W+=Q;f<W;f+=3)Q=X+c[f],I=X+c[f+1],R=X+c[f+2],b(Q),b(I),b(R)}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;
|
|
|
for(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),g=0,f=0,h=[{start:0,count:0,index:0}],k=h[0],n=0,p=0,l=new Int32Array(6),r=new Int32Array(c.length),q=new Int32Array(c.length),t=0;t<c.length;t++)r[t]=-1,q[t]=-1;for(c=0;c<d;c++){for(var s=p=0;3>s;s++)t=a[3*c+s],-1==r[t]?(l[2*s]=t,l[2*s+1]=-1,p++):r[t]<k.index?(l[2*s]=t,l[2*s+1]=-1,n++):(l[2*s]=t,l[2*s+1]=r[t]);if(f+p>k.index+b)for(k={start:g,count:0,index:f},h.push(k),p=0;6>p;p+=2)s=l[p+1],-1<s&&s<k.index&&(l[p+1]=
|
|
|
-1);for(p=0;6>p;p+=2)t=l[p],s=l[p+1],-1===s&&(s=f++),r[t]=s,q[s]=t,e[g++]=s-k.index,k.count++}this.reorderBuffers(e,q,f);return this.offsets=h},merge:function(){console.log("BufferGeometry.merge(): TODO")},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,g=a.length;e<g;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},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!=e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize*
|
|
|
c));for(var g=0;g<c;g++){var f=b[g];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,n=d[e],p=0;p<k;p++)n[g*k+p]=h[f*k+p]}this.attributes.index.array=a;for(e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function(){var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes,
|
|
@@ -439,7 +439,7 @@ a[0]}function l(a,e){if(!1!==e.visible){e instanceof THREE.Light&&Za.push(e);if(
|
|
|
f.__webglVertexBuffer){f.__webglVertexBuffer=m.createBuffer();f.__webglColorBuffer=m.createBuffer();f.__webglLineDistanceBuffer=m.createBuffer();H.info.memory.geometries++;var g=f.vertices.length;f.__vertexArray=new Float32Array(3*g);f.__colorArray=new Float32Array(3*g);f.__lineDistanceArray=new Float32Array(1*g);f.__webglLineCount=g;b(e);f.verticesNeedUpdate=!0;f.colorsNeedUpdate=!0;f.lineDistancesNeedUpdate=!0}}else if(e instanceof THREE.PointCloud&&void 0===f.__webglVertexBuffer){f.__webglVertexBuffer=
|
|
|
m.createBuffer();f.__webglColorBuffer=m.createBuffer();H.info.memory.geometries++;var h=f.vertices.length;f.__vertexArray=new Float32Array(3*h);f.__colorArray=new Float32Array(3*h);f.__sortArray=[];f.__webglParticleCount=h;b(e);f.verticesNeedUpdate=!0;f.colorsNeedUpdate=!0}if(void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof THREE.Mesh)if(f instanceof THREE.BufferGeometry)w($a,f,e);else{if(f instanceof THREE.Geometry)for(var k=sb[f.id],n=0,r=k.length;n<r;n++)w($a,k[n],e)}else e instanceof
|
|
|
THREE.Line||e instanceof THREE.PointCloud?w($a,f,e):(e instanceof THREE.ImmediateRenderObject||e.immediateRenderCallback)&&lb.push({id:null,object:e,opaque:null,transparent:null,z:0});var t=$a[e.id];if(t&&(!1===e.frustumCulled||!0===Bc.intersectsObject(e))){var q=e.geometry,s,x;if(q instanceof THREE.BufferGeometry)for(var y=q.attributes,B=q.attributesKeys,G=0,C=B.length;G<C;G++){var E=B[G],F=y[E];void 0===F.buffer&&(F.buffer=m.createBuffer(),F.needsUpdate=!0);if(!0===F.needsUpdate){var K="index"===
|
|
|
-E?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER;m.bindBuffer(K,F.buffer);m.bufferData(K,F.array,m.STATIC_DRAW);F.needsUpdate=!1}}else if(e instanceof THREE.Mesh){!0===q.groupsNeedUpdate&&v(a,e,q);for(var Q=sb[q.id],R=0,M=Q.length;R<M;R++){var P=Q[R];x=d(e,P);!0===q.groupsNeedUpdate&&c(P,e);s=x.attributes&&u(x);if(q.verticesNeedUpdate||q.morphTargetsNeedUpdate||q.elementsNeedUpdate||q.uvsNeedUpdate||q.normalsNeedUpdate||q.colorsNeedUpdate||q.tangentsNeedUpdate||s){var I=P,O=e,sa=m.DYNAMIC_DRAW,T=!q.dynamic,
|
|
|
+E?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER;m.bindBuffer(K,F.buffer);m.bufferData(K,F.array,m.STATIC_DRAW);F.needsUpdate=!1}}else if(e instanceof THREE.Mesh){!0===q.groupsNeedUpdate&&v(a,e,q);for(var P=sb[q.id],R=0,M=P.length;R<M;R++){var Q=P[R];x=d(e,Q);!0===q.groupsNeedUpdate&&c(Q,e);s=x.attributes&&u(x);if(q.verticesNeedUpdate||q.morphTargetsNeedUpdate||q.elementsNeedUpdate||q.uvsNeedUpdate||q.normalsNeedUpdate||q.colorsNeedUpdate||q.tangentsNeedUpdate||s){var I=Q,O=e,sa=m.DYNAMIC_DRAW,T=!q.dynamic,
|
|
|
X=x;if(I.__inittedArrays){var W=X&&void 0!==X.shading&&X.shading===THREE.SmoothShading,L=void 0,Y=void 0,ka=void 0,da=void 0,ba=void 0,db=void 0,ga=void 0,qb=void 0,ta=void 0,za=void 0,ia=void 0,aa=void 0,$=void 0,Z=void 0,Ab=void 0,qa=void 0,J=void 0,Aa=void 0,oa=void 0,kc=void 0,la=void 0,Pa=void 0,Ga=void 0,lc=void 0,Ca=void 0,mc=void 0,nc=void 0,Ha=void 0,oc=void 0,Ba=void 0,wa=void 0,Eb=void 0,Ma=void 0,Bb=void 0,Na=void 0,Yb=void 0,Ya=void 0,ab=void 0,Lb=void 0,Sb=void 0,fb=0,gb=0,ub=0,vb=0,
|
|
|
Fb=0,Sa=0,Da=0,Qa=0,Ka=0,ma=0,ua=0,D=0,Ia=void 0,Ra=I.__vertexArray,wb=I.__uvArray,hb=I.__uv2Array,Ta=I.__normalArray,ra=I.__tangentArray,La=I.__colorArray,Ua=I.__skinIndexArray,Va=I.__skinWeightArray,Gb=I.__morphTargetsArrays,Hc=I.__morphNormalsArrays,eb=I.__webglCustomAttributesList,z=void 0,Tb=I.__faceArray,Ja=I.__lineArray,xa=O.geometry,bb=xa.elementsNeedUpdate,Ic=xa.uvsNeedUpdate,gc=xa.normalsNeedUpdate,ea=xa.tangentsNeedUpdate,Db=xa.colorsNeedUpdate,S=xa.morphTargetsNeedUpdate,fa=xa.vertices,
|
|
|
N=I.faces3,ya=xa.faces,va=xa.faceVertexUvs[0],Jc=xa.faceVertexUvs[1],Cc=xa.skinIndices,Ub=xa.skinWeights,mb=xa.morphTargets,Ea=xa.morphNormals;if(xa.verticesNeedUpdate){L=0;for(Y=N.length;L<Y;L++)da=ya[N[L]],aa=fa[da.a],$=fa[da.b],Z=fa[da.c],Ra[gb]=aa.x,Ra[gb+1]=aa.y,Ra[gb+2]=aa.z,Ra[gb+3]=$.x,Ra[gb+4]=$.y,Ra[gb+5]=$.z,Ra[gb+6]=Z.x,Ra[gb+7]=Z.y,Ra[gb+8]=Z.z,gb+=9;m.bindBuffer(m.ARRAY_BUFFER,I.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Ra,sa)}if(S)for(Na=0,Yb=mb.length;Na<Yb;Na++){L=ua=0;for(Y=
|
|
@@ -474,8 +474,8 @@ f.__webglSkinWeightsBuffer=m.createBuffer();f.__webglFaceBuffer=m.createBuffer()
|
|
|
!0;d.uvsNeedUpdate=!0;d.normalsNeedUpdate=!0;d.tangentsNeedUpdate=!0;f=d.colorsNeedUpdate=!0}else f=!1;(f||void 0===b.__webglActive)&&w($a,h,b)}b.__webglActive=!0}function w(a,b,c){var d=c.id;a[d]=a[d]||[];a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function u(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function A(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function x(a,b,c,d,e){var f,g,h,k;Lb=0;if(d.needsUpdate){d.program&&sc(d);d.addEventListener("dispose",
|
|
|
zc);var l;d instanceof THREE.MeshDepthMaterial?l="depth":d instanceof THREE.MeshNormalMaterial?l="normal":d instanceof THREE.MeshBasicMaterial?l="basic":d instanceof THREE.MeshLambertMaterial?l="lambert":d instanceof THREE.MeshPhongMaterial?l="phong":d instanceof THREE.LineBasicMaterial?l="basic":d instanceof THREE.LineDashedMaterial?l="dashed":d instanceof THREE.PointCloudMaterial&&(l="particle_basic");if(l){var n=THREE.ShaderLib[l];d.__webglShader={uniforms:THREE.UniformsUtils.clone(n.uniforms),
|
|
|
vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,q=0,r=0,t=0,s=0,u=b.length;s<u;s++){var w=b[s];w.onlyShadow||!1===w.visible||(w instanceof THREE.DirectionalLight&&p++,w instanceof THREE.PointLight&&q++,w instanceof THREE.SpotLight&&r++,w instanceof THREE.HemisphereLight&&t++)}f=p;g=q;h=r;k=t;for(var v,x=0,A=0,B=b.length;A<B;A++){var F=b[A];F.castShadow&&(F instanceof THREE.SpotLight&&
|
|
|
-x++,F instanceof THREE.DirectionalLight&&!F.shadowCascade&&x++)}v=x;var Q;if(tc&&e&&e.skeleton&&e.skeleton.useVertexTexture)Q=1024;else{var P=m.getParameter(m.MAX_VERTEX_UNIFORM_VECTORS),sa=Math.floor((P-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(sa=Math.min(e.skeleton.bones.length,sa),sa<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+sa+" (try OpenGL instead of ANGLE)"));Q=sa}var O={precision:X,supportsVertexTextures:fc,
|
|
|
-map:!!d.map,envMap:!!d.envMap,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:Pa,skinning:d.skinning,maxBones:Q,useVertexTexture:tc&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:H.maxMorphTargets,maxMorphNormals:H.maxMorphNormals,
|
|
|
+x++,F instanceof THREE.DirectionalLight&&!F.shadowCascade&&x++)}v=x;var P;if(tc&&e&&e.skeleton&&e.skeleton.useVertexTexture)P=1024;else{var Q=m.getParameter(m.MAX_VERTEX_UNIFORM_VECTORS),sa=Math.floor((Q-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(sa=Math.min(e.skeleton.bones.length,sa),sa<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+sa+" (try OpenGL instead of ANGLE)"));P=sa}var O={precision:X,supportsVertexTextures:fc,
|
|
|
+map:!!d.map,envMap:!!d.envMap,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:Pa,skinning:d.skinning,maxBones:P,useVertexTexture:tc&&e&&e.skeleton&&e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:H.maxMorphTargets,maxMorphNormals:H.maxMorphNormals,
|
|
|
maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:v,shadowMapEnabled:H.shadowMapEnabled&&e.receiveShadow&&0<v,shadowMapType:H.shadowMapType,shadowMapDebug:H.shadowMapDebug,shadowMapCascade:H.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side===THREE.BackSide},T=[];l?T.push(l):(T.push(d.fragmentShader),T.push(d.vertexShader));if(void 0!==d.defines)for(var W in d.defines)T.push(W),T.push(d.defines[W]);
|
|
|
for(W in O)T.push(W),T.push(O[W]);for(var L=T.join(),Y,ka=0,da=qb.length;ka<da;ka++){var ba=qb[ka];if(ba.code===L){Y=ba;Y.usedTimes++;break}}void 0===Y&&(Y=new THREE.WebGLProgram(H,L,d,O),qb.push(Y),H.info.memory.programs=qb.length);d.program=Y;var Za=Y.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var $a,db="morphTarget",ga=0;ga<H.maxMorphTargets;ga++)$a=db+ga,0<=Za[$a]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,db="morphNormal",ga=0;ga<H.maxMorphNormals;ga++)$a=
|
|
|
db+ga,0<=Za[$a]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var lb in d.__webglShader.uniforms){var ta=d.program.uniforms[lb];ta&&d.uniformsList.push([d.__webglShader.uniforms[lb],ta])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets));var aa=!1,$=!1,Z=!1,pb=d.program,qa=pb.uniforms,J=d.__webglShader.uniforms;pb.id!==Ab&&(m.useProgram(pb.program),Ab=pb.id,Z=$=aa=!0);d.id!==Bb&&(-1===Bb&&(Z=!0),Bb=d.id,$=!0);
|
|
@@ -503,11 +503,11 @@ va.flipY);for(var Qb=va instanceof THREE.CompressedTexture,Ub=va.image[0]instanc
|
|
|
va.needsUpdate=!1;if(va.onUpdate)va.onUpdate()}else m.activeTexture(m.TEXTURE0+Ob),m.bindTexture(m.TEXTURE_CUBE_MAP,va.image.__webglTextureCube)}else if(Ja instanceof THREE.WebGLRenderTargetCube){var $b=Ja;m.activeTexture(m.TEXTURE0+xa);m.bindTexture(m.TEXTURE_CUBE_MAP,$b.__webglTexture)}else H.setTexture(Ja,xa);break;case "tv":void 0===ea._array&&(ea._array=[]);N=0;for(ya=ea.value.length;N<ya;N++)ea._array[N]=E();m.uniform1iv(fa,ea._array);N=0;for(ya=ea.value.length;N<ya;N++)Ja=ea.value[N],xa=ea._array[N],
|
|
|
Ja&&H.setTexture(Ja,xa);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Db)}}}}m.uniformMatrix4fv(qa.modelViewMatrix,!1,e._modelViewMatrix.elements);qa.normalMatrix&&m.uniformMatrix3fv(qa.normalMatrix,!1,e._normalMatrix.elements);null!==qa.modelMatrix&&m.uniformMatrix4fv(qa.modelMatrix,!1,e.matrixWorld.elements);return pb}function G(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=
|
|
|
b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function E(){var a=Lb;a>=Lc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+
|
|
|
-Lc);Lb+=1;return a}function B(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function y(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 C(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function Q(a){a!==Mc&&(m.lineWidth(a),Mc=a)}function F(a,b,c){Nc!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),Nc=a);!a||Oc===b&&Pc===c||(m.polygonOffset(b,c),Oc=b,Pc=c)}function K(a,b,c){c?
|
|
|
-(m.texParameteri(a,m.TEXTURE_WRAP_S,I(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,I(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,I(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,I(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,P(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,P(b.minFilter)));(c=ta.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1<b.anisotropy||
|
|
|
+Lc);Lb+=1;return a}function B(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)}function y(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 C(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function P(a){a!==Mc&&(m.lineWidth(a),Mc=a)}function F(a,b,c){Nc!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),Nc=a);!a||Oc===b&&Pc===c||(m.polygonOffset(b,c),Oc=b,Pc=c)}function K(a,b,c){c?
|
|
|
+(m.texParameteri(a,m.TEXTURE_WRAP_S,I(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,I(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,I(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,I(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,Q(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,Q(b.minFilter)));(c=ta.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1<b.anisotropy||
|
|
|
b.__oldAnisotropy)&&(m.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,H.getMaxAnisotropy())),b.__oldAnisotropy=b.anisotropy)}function M(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.log("THREE.WebGLRenderer:",a,"is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height+
|
|
|
".");return d}return a}function W(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,
|
|
|
-b.height)}function T(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function I(a){var b;if(a===THREE.RepeatWrapping)return m.REPEAT;
|
|
|
+b.height)}function T(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function Q(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function I(a){var b;if(a===THREE.RepeatWrapping)return m.REPEAT;
|
|
|
if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;
|
|
|
if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;
|
|
|
if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===
|
|
@@ -536,7 +536,7 @@ m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),f(b.attributes.posit
|
|
|
7]=e,s[u+8]=k}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);f(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglUvBuffer),m.bufferData(m.ARRAY_BUFFER,a.uvArray,m.DYNAMIC_DRAW),f(b.attributes.uv),m.vertexAttribPointer(b.attributes.uv,2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),
|
|
|
f(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));h();m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,h){if(!1!==d.visible)if(a=x(a,b,c,d,h),b=!1,c=16777215*f.id+2*a.id+(d.wireframe?1:0),c!==Ga&&(Ga=c,b=!0),b&&g(),h instanceof THREE.Mesh)if(h=!0===d.wireframe?m.LINES:m.TRIANGLES,c=f.attributes.index){var k,l;c.array instanceof Uint32Array&&ta.get("OES_element_index_uint")?(k=m.UNSIGNED_INT,l=4):(k=m.UNSIGNED_SHORT,l=2);var n=
|
|
|
f.offsets;if(0===n.length)b&&(e(d,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,c.buffer)),m.drawElements(h,c.array.length,k,0),H.info.render.calls++,H.info.render.vertices+=c.array.length,H.info.render.faces+=c.array.length/3;else{b=!0;for(var p=0,q=n.length;p<q;p++){var r=n[p].index;b&&(e(d,a,f,r),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,c.buffer));m.drawElements(h,n[p].count,k,n[p].start*l);H.info.render.calls++;H.info.render.vertices+=n[p].count;H.info.render.faces+=n[p].count/3}}}else b&&e(d,a,f,0),
|
|
|
-d=f.attributes.position,m.drawArrays(h,0,d.array.length/3),H.info.render.calls++,H.info.render.vertices+=d.array.length/3,H.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)b&&e(d,a,f,0),d=f.attributes.position,m.drawArrays(m.POINTS,0,d.array.length/3),H.info.render.calls++,H.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,Q(d.linewidth),c=f.attributes.index)if(c.array instanceof Uint32Array?(k=m.UNSIGNED_INT,
|
|
|
+d=f.attributes.position,m.drawArrays(h,0,d.array.length/3),H.info.render.calls++,H.info.render.vertices+=d.array.length/3,H.info.render.faces+=d.array.length/9;else if(h instanceof THREE.PointCloud)b&&e(d,a,f,0),d=f.attributes.position,m.drawArrays(m.POINTS,0,d.array.length/3),H.info.render.calls++,H.info.render.points+=d.array.length/3;else if(h instanceof THREE.Line)if(h=h.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,P(d.linewidth),c=f.attributes.index)if(c.array instanceof Uint32Array?(k=m.UNSIGNED_INT,
|
|
|
l=4):(k=m.UNSIGNED_SHORT,l=2),n=f.offsets,0===n.length)b&&(e(d,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,c.buffer)),m.drawElements(h,c.array.length,k,0),H.info.render.calls++,H.info.render.vertices+=c.array.length;else for(1<n.length&&(b=!0),p=0,q=n.length;p<q;p++)r=n[p].index,b&&(e(d,a,f,r),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,c.buffer)),m.drawElements(h,n[p].count,k,n[p].start*l),H.info.render.calls++,H.info.render.vertices+=n[p].count;else b&&e(d,a,f,0),d=f.attributes.position,m.drawArrays(h,0,
|
|
|
d.array.length/3),H.info.render.calls++,H.info.render.points+=d.array.length/3};this.renderBuffer=function(a,b,c,d,e,k){if(!1!==d.visible){c=x(a,b,c,d,k);b=c.attributes;a=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Ga&&(Ga=c,a=!0);a&&g();if(!d.morphTargets&&0<=b.position)a&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),f(b.position),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));else if(k.morphTargetBase){c=d.program.attributes;-1!==k.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
e.__webglMorphTargetsBuffers[k.morphTargetBase]),f(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),f(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var l=0,n=k.morphTargetForcedOrder,q=k.morphTargetInfluences;l<d.numSupportedMorphTargets&&l<n.length;)0<=c["morphTarget"+l]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n[l]]),f(c["morphTarget"+l]),m.vertexAttribPointer(c["morphTarget"+
|
|
@@ -545,8 +545,8 @@ l],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(m.bindBuffer(m.ARR
|
|
|
m.uniform1fv(d.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c=0,q=e.__webglCustomAttributesList.length;c<q;c++)n=e.__webglCustomAttributesList[c],0<=b[n.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,n.buffer),f(b[n.buffer.belongsToAttribute]),m.vertexAttribPointer(b[n.buffer.belongsToAttribute],n.size,m.FLOAT,!1,0,0));0<=b.color&&(0<k.geometry.colors.length||0<k.geometry.faces.length?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglColorBuffer),
|
|
|
f(b.color),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&m.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglNormalBuffer),f(b.normal),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));0<=b.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),f(b.tangent),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));0<=b.uv&&(k.geometry.faceVertexUvs[0]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUVBuffer),f(b.uv),
|
|
|
m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(k.geometry.faceVertexUvs[1]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUV2Buffer),f(b.uv2),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),f(b.skinIndex),m.vertexAttribPointer(b.skinIndex,
|
|
|
-4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),f(b.skinWeight),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));0<=b.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),f(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?(Q(d.wireframeLinewidth),a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,
|
|
|
-e.__webglLineCount,k,0)):(a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,k,0)),H.info.render.calls++,H.info.render.vertices+=e.__webglFaceCount,H.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,Q(d.linewidth),m.drawArrays(k,0,e.__webglLineCount),H.info.render.calls++):k instanceof THREE.PointCloud&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),H.info.render.calls++,H.info.render.points+=
|
|
|
+4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),f(b.skinWeight),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));0<=b.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),f(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}h();k instanceof THREE.Mesh?(k=e.__typeArray===Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?(P(d.wireframeLinewidth),a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,
|
|
|
+e.__webglLineCount,k,0)):(a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,k,0)),H.info.render.calls++,H.info.render.vertices+=e.__webglFaceCount,H.info.render.faces+=e.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,P(d.linewidth),m.drawArrays(k,0,e.__webglLineCount),H.info.render.calls++):k instanceof THREE.PointCloud&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),H.info.render.calls++,H.info.render.points+=
|
|
|
e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;Bb=Ga=-1;Yb=null;gc=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()});b.matrixWorldInverse.getInverse(b.matrixWorld);xc.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Bc.setFromMatrix(xc);
|
|
|
Za.length=0;Kb.length=0;pb.length=0;l(a,a);!0===H.sortObjects&&(Kb.sort(k),pb.sort(n));r(this.renderPluginsPre,a,b);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;H.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var f=lb.length;d<f;d++){var g=lb[d],h=g.object;h.visible&&(B(h,b),s(g))}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),q(Kb,b,Za,e,!0,d),q(pb,b,Za,e,!0,d),t(lb,"",b,Za,e,!1,d)):(d=null,this.setBlending(THREE.NoBlending),q(Kb,b,Za,e,!1,d),t(lb,"opaque",b,Za,e,!1,d),q(pb,b,Za,e,!0,d),t(lb,"transparent",b,Za,e,!0,d));r(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&T(c);this.setDepthTest(!0);this.setDepthWrite(!0)}};
|
|
@@ -592,7 +592,7 @@ break;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d
|
|
|
r,t,v,p)}return{offset:w.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",g=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=g;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(g=c.length;e<g;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],k,n,p;if(0<b(a))for(n=0;n<e;n++)f[n]=n;else for(n=0;n<e;n++)f[n]=e-1-n;var l=2*e;for(n=e-1;2<e;){if(0>=l--){console.log("Warning, unable to triangulate polygon!");break}k=n;e<=k&&(k=0);n=k+1;e<=n&&(n=0);p=n+1;e<=p&&(p=0);var r;a:{var q=r=void 0,t=void 0,s=void 0,v=void 0,w=void 0,u=void 0,A=void 0,x=void 0,
|
|
|
-q=a[f[k]].x,t=a[f[k]].y,s=a[f[n]].x,v=a[f[n]].y,w=a[f[p]].x,u=a[f[p]].y;if(1E-10>(s-q)*(u-t)-(v-t)*(w-q))r=!1;else{var G=void 0,E=void 0,B=void 0,y=void 0,C=void 0,Q=void 0,F=void 0,K=void 0,M=void 0,W=void 0,M=K=F=x=A=void 0,G=w-s,E=u-v,B=q-w,y=t-u,C=s-q,Q=v-t;for(r=0;r<e;r++)if(A=a[f[r]].x,x=a[f[r]].y,!(A===q&&x===t||A===s&&x===v||A===w&&x===u)&&(F=A-q,K=x-t,M=A-s,W=x-v,A-=w,x-=u,M=G*W-E*M,F=C*K-Q*F,K=B*x-y*A,-1E-10<=M&&-1E-10<=K&&-1E-10<=F)){r=!1;break a}r=!0}}if(r){g.push([a[f[k]],a[f[n]],a[f[p]]]);
|
|
|
+q=a[f[k]].x,t=a[f[k]].y,s=a[f[n]].x,v=a[f[n]].y,w=a[f[p]].x,u=a[f[p]].y;if(1E-10>(s-q)*(u-t)-(v-t)*(w-q))r=!1;else{var G=void 0,E=void 0,B=void 0,y=void 0,C=void 0,P=void 0,F=void 0,K=void 0,M=void 0,W=void 0,M=K=F=x=A=void 0,G=w-s,E=u-v,B=q-w,y=t-u,C=s-q,P=v-t;for(r=0;r<e;r++)if(A=a[f[r]].x,x=a[f[r]].y,!(A===q&&x===t||A===s&&x===v||A===w&&x===u)&&(F=A-q,K=x-t,M=A-s,W=x-v,A-=w,x-=u,M=G*W-E*M,F=C*K-P*F,K=B*x-y*A,-1E-10<=M&&-1E-10<=K&&-1E-10<=F)){r=!1;break a}r=!0}}if(r){g.push([a[f[k]],a[f[n]],a[f[p]]]);
|
|
|
h.push([f[k],f[n],f[p]]);k=n;for(p=n+1;p<e;k++,p++)f[k]=f[p];e--;l=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;
|
|
|
THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain)};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.source.connect(b.panner);b.source.start(0)})};c.send();return this};THREE.Audio.prototype.setLoop=function(a){this.source.loop=a};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};
|
|
@@ -632,8 +632,8 @@ THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this
|
|
|
THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,n=a.x-d.x,p=a.y-d.y,B=h*k-g*l,y=h*n-g*p;if(1E-10<Math.abs(B)){if(0<B){if(0>y||y>B)return[];k=l*n-k*p;if(0>k||k>B)return[]}else{if(0<y||y<B)return[];k=l*n-k*p;if(0<k||k<B)return[]}if(0==k)return!f||0!=y&&y!=B?[a]:[];if(k==B)return!f||0!=y&&y!=B?[b]:[];if(0==y)return[d];
|
|
|
if(y==B)return[e];f=k/B;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=y||l*n!=k*p)return[];h=0==g&&0==h;k=0==k&&0==l;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,B=d.x,l=e,d=e.x):(b=e,B=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,B=d.y,l=e,d=e.y):(b=e,B=e.y,l=d,d=d.y));return k<=B?a<B?[]:a==B?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]:
|
|
|
[g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var g,f,h,k,n,p={};h=a.concat();g=0;for(f=b.length;g<f;g++)Array.prototype.push.apply(h,b[g]);g=0;for(f=h.length;g<f;g++)n=h[g].x+":"+h[g].y,void 0!==p[n]&&console.log("Duplicate point",n),p[n]=g;g=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;
|
|
|
-d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,p,E,B,y,C=[],Q,F,K,M=0;for(n=b.length;M<n;M++)l.push(M);Q=0;for(var W=2*l.length;0<l.length;){W--;if(0>W){console.log("Infinite Loop! Holes left:"+
|
|
|
-l.length+", Probably Hole outside Shape!");break}for(p=Q;p<h.length;p++){E=h[p];n=-1;for(M=0;M<l.length;M++)if(B=l[M],y=E.x+":"+E.y+":"+B,void 0===C[y]){k=b[B];for(F=0;F<k.length;F++)if(B=k[F],c(p,F)&&!f(E,B)&&!g(E,B)){n=F;l.splice(M,1);Q=h.slice(0,p+1);B=h.slice(p);F=k.slice(n);K=k.slice(0,n+1);h=Q.concat(F).concat(K).concat(B);Q=p;break}if(0<=n)break;C[y]=!0}if(0<=n)break}}return h}(a,b);var l=THREE.FontUtils.Triangulate(g,!1);g=0;for(f=l.length;g<f;g++)for(k=l[g],h=0;3>h;h++)n=k[h].x+":"+k[h].y,
|
|
|
+d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,p,E,B,y,C=[],P,F,K,M=0;for(n=b.length;M<n;M++)l.push(M);P=0;for(var W=2*l.length;0<l.length;){W--;if(0>W){console.log("Infinite Loop! Holes left:"+
|
|
|
+l.length+", Probably Hole outside Shape!");break}for(p=P;p<h.length;p++){E=h[p];n=-1;for(M=0;M<l.length;M++)if(B=l[M],y=E.x+":"+E.y+":"+B,void 0===C[y]){k=b[B];for(F=0;F<k.length;F++)if(B=k[F],c(p,F)&&!f(E,B)&&!g(E,B)){n=F;l.splice(M,1);P=h.slice(0,p+1);B=h.slice(p);F=k.slice(n);K=k.slice(0,n+1);h=P.concat(F).concat(K).concat(B);P=p;break}if(0<=n)break;C[y]=!0}if(0<=n)break}}return h}(a,b);var l=THREE.FontUtils.Triangulate(g,!1);g=0;for(f=l.length;g<f;g++)for(k=l[g],h=0;3>h;h++)n=k[h].x+":"+k[h].y,
|
|
|
n=p[n],void 0!==n&&(k[h]=n);return l.concat()},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,
|
|
|
b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};
|
|
|
THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};
|
|
@@ -672,8 +672,8 @@ g;d.nextKey=f}f.time>=this.currentTime?g.interpolate(f,this.currentTime):g.inter
|
|
|
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.MorphAnimation=function(a){this.mesh=a;this.frames=a.morphTargetInfluences.length;this.currentTime=0;this.duration=1E3;this.loop=!0;this.isPlaying=!1};
|
|
|
THREE.MorphAnimation.prototype={play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(){var a=0,b=0;return function(c){if(!1!==this.isPlaying){this.currentTime+=c;!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);c=this.duration/this.frames;var d=Math.floor(this.currentTime/c);d!=b&&(this.mesh.morphTargetInfluences[a]=0,this.mesh.morphTargetInfluences[b]=1,this.mesh.morphTargetInfluences[d]=
|
|
|
0,a=b,b=d);this.mesh.morphTargetInfluences[d]=this.currentTime%c/c;this.mesh.morphTargetInfluences[a]=1-this.mesh.morphTargetInfluences[d]}}}()};
|
|
|
-THREE.BoxGeometry=function(a,b,c,d,e,g){function f(a,b,c,d,e,f,g,s){var v,w=h.widthSegments,u=h.heightSegments,A=e/2,x=f/2,G=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var E=w+1,B=u+1,y=e/w,C=f/u,Q=new THREE.Vector3;Q[v]=0<g?1:-1;for(e=0;e<B;e++)for(f=0;f<E;f++){var F=new THREE.Vector3;F[a]=(f*y-A)*c;F[b]=(e*C-x)*d;F[v]=g;h.vertices.push(F)}for(e=
|
|
|
-0;e<u;e++)for(f=0;f<w;f++)x=f+E*e,a=f+E*(e+1),b=f+1+E*(e+1),c=f+1+E*e,d=new THREE.Vector2(f/w,1-e/u),g=new THREE.Vector2(f/w,1-(e+1)/u),v=new THREE.Vector2((f+1)/w,1-(e+1)/u),A=new THREE.Vector2((f+1)/w,1-e/u),x=new THREE.Face3(x+G,a+G,c+G),x.normal.copy(Q),x.vertexNormals.push(Q.clone(),Q.clone(),Q.clone()),x.materialIndex=s,h.faces.push(x),h.faceVertexUvs[0].push([d,g,A]),x=new THREE.Face3(a+G,b+G,c+G),x.normal.copy(Q),x.vertexNormals.push(Q.clone(),Q.clone(),Q.clone()),x.materialIndex=s,h.faces.push(x),
|
|
|
+THREE.BoxGeometry=function(a,b,c,d,e,g){function f(a,b,c,d,e,f,g,s){var v,w=h.widthSegments,u=h.heightSegments,A=e/2,x=f/2,G=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var E=w+1,B=u+1,y=e/w,C=f/u,P=new THREE.Vector3;P[v]=0<g?1:-1;for(e=0;e<B;e++)for(f=0;f<E;f++){var F=new THREE.Vector3;F[a]=(f*y-A)*c;F[b]=(e*C-x)*d;F[v]=g;h.vertices.push(F)}for(e=
|
|
|
+0;e<u;e++)for(f=0;f<w;f++)x=f+E*e,a=f+E*(e+1),b=f+1+E*(e+1),c=f+1+E*e,d=new THREE.Vector2(f/w,1-e/u),g=new THREE.Vector2(f/w,1-(e+1)/u),v=new THREE.Vector2((f+1)/w,1-(e+1)/u),A=new THREE.Vector2((f+1)/w,1-e/u),x=new THREE.Face3(x+G,a+G,c+G),x.normal.copy(P),x.vertexNormals.push(P.clone(),P.clone(),P.clone()),x.materialIndex=s,h.faces.push(x),h.faceVertexUvs[0].push([d,g,A]),x=new THREE.Face3(a+G,b+G,c+G),x.normal.copy(P),x.vertexNormals.push(P.clone(),P.clone(),P.clone()),x.materialIndex=s,h.faces.push(x),
|
|
|
h.faceVertexUvs[0].push([g.clone(),v,A.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:g};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=g||1;var h=this;d=a/2;e=b/2;g=c/2;f("z","y",-1,-1,c,b,d,0);f("z","y",1,-1,c,b,-d,1);f("x","z",1,1,a,c,e,2);f("x","z",1,-1,a,c,-e,3);f("x","y",1,-1,a,b,g,4);f("x","y",-1,-1,a,b,-g,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e,g=[];e=new THREE.Vector3;var f=new THREE.Vector2(.5,.5);this.vertices.push(e);g.push(f);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);g.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,
|
|
|
0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([g[e].clone(),g[e+1].clone(),f.clone()]);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,g){console.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry.");return new THREE.BoxGeometry(a,b,c,d,e,g)};
|
|
@@ -685,11 +685,11 @@ THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call
|
|
|
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=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=!0):-1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)==
|
|
|
Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(c,d){var e,f;for(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);for(var g=0,h=q+2*p,g=0;g<h;g++){var k=ba*g,l=ba*(g+1),n=d+e+k,k=d+f+k,s=d+f+l,l=d+e+l,r=c,t=g,v=h,w=e,x=f,n=n+K,k=k+K,s=s+K,l=l+K;F.faces.push(new THREE.Face3(n,k,l,null,null,u));F.faces.push(new THREE.Face3(k,s,l,null,null,u));n=A.generateSideWallUV(F,a,r,b,n,k,s,l,t,v,w,x);F.faceVertexUvs[0].push([n[0],n[1],n[3]]);
|
|
|
F.faceVertexUvs[0].push([n[1],n[2],n[3]])}}}function g(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function f(c,d,e,f){c+=K;d+=K;e+=K;F.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?A.generateBottomUV(F,a,b,c,d,e):A.generateTopUV(F,a,b,c,d,e);F.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,n=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,l=void 0!==b.bevelEnabled?b.bevelEnabled:!0,r=void 0!==
|
|
|
-b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,t=b.extrudePath,s,v=!1,w=b.material,u=b.extrudeMaterial,A=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,x,G,E,B;t&&(s=t.getSpacedPoints(q),v=!0,l=!1,x=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,q,!1),G=new THREE.Vector3,E=new THREE.Vector3,B=new THREE.Vector3);l||(n=k=p=0);var y,C,Q,F=this,K=this.vertices.length,t=a.extractPoints(r),r=t.shape,M=t.holes;if(t=!THREE.Shape.Utils.isClockWise(r)){r=
|
|
|
-r.reverse();C=0;for(Q=M.length;C<Q;C++)y=M[C],THREE.Shape.Utils.isClockWise(y)&&(M[C]=y.reverse());t=!1}var W=THREE.Shape.Utils.triangulateShape(r,M),T=r;C=0;for(Q=M.length;C<Q;C++)y=M[C],r=r.concat(y);var P,I,R,ka,X,ba=r.length,ga,Aa=W.length,t=[],O=0;R=T.length;P=R-1;for(I=O+1;O<R;O++,P++,I++)P===R&&(P=0),I===R&&(I=0),t[O]=d(T[O],T[P],T[I]);var Ma=[],ia,Pa=t.concat();C=0;for(Q=M.length;C<Q;C++){y=M[C];ia=[];O=0;R=y.length;P=R-1;for(I=O+1;O<R;O++,P++,I++)P===R&&(P=0),I===R&&(I=0),ia[O]=d(y[O],y[P],
|
|
|
-y[I]);Ma.push(ia);Pa=Pa.concat(ia)}for(P=0;P<p;P++){R=P/p;ka=k*(1-R);I=n*Math.sin(R*Math.PI/2);O=0;for(R=T.length;O<R;O++)X=c(T[O],t[O],I),g(X.x,X.y,-ka);C=0;for(Q=M.length;C<Q;C++)for(y=M[C],ia=Ma[C],O=0,R=y.length;O<R;O++)X=c(y[O],ia[O],I),g(X.x,X.y,-ka)}I=n;for(O=0;O<ba;O++)X=l?c(r[O],Pa[O],I):r[O],v?(E.copy(x.normals[0]).multiplyScalar(X.x),G.copy(x.binormals[0]).multiplyScalar(X.y),B.copy(s[0]).add(E).add(G),g(B.x,B.y,B.z)):g(X.x,X.y,0);for(R=1;R<=q;R++)for(O=0;O<ba;O++)X=l?c(r[O],Pa[O],I):r[O],
|
|
|
-v?(E.copy(x.normals[R]).multiplyScalar(X.x),G.copy(x.binormals[R]).multiplyScalar(X.y),B.copy(s[R]).add(E).add(G),g(B.x,B.y,B.z)):g(X.x,X.y,h/q*R);for(P=p-1;0<=P;P--){R=P/p;ka=k*(1-R);I=n*Math.sin(R*Math.PI/2);O=0;for(R=T.length;O<R;O++)X=c(T[O],t[O],I),g(X.x,X.y,h+ka);C=0;for(Q=M.length;C<Q;C++)for(y=M[C],ia=Ma[C],O=0,R=y.length;O<R;O++)X=c(y[O],ia[O],I),v?g(X.x,X.y+s[q-1].y,s[q-1].x+ka):g(X.x,X.y,h+ka)}(function(){if(l){var a;a=0*ba;for(O=0;O<Aa;O++)ga=W[O],f(ga[2]+a,ga[1]+a,ga[0]+a,!0);a=q+2*p;
|
|
|
-a*=ba;for(O=0;O<Aa;O++)ga=W[O],f(ga[0]+a,ga[1]+a,ga[2]+a,!1)}else{for(O=0;O<Aa;O++)ga=W[O],f(ga[2],ga[1],ga[0],!0);for(O=0;O<Aa;O++)ga=W[O],f(ga[0]+ba*q,ga[1]+ba*q,ga[2]+ba*q,!1)}})();(function(){var a=0;e(T,a);a+=T.length;C=0;for(Q=M.length;C<Q;C++)y=M[C],e(y,a),a+=y.length})()};
|
|
|
+b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,t=b.extrudePath,s,v=!1,w=b.material,u=b.extrudeMaterial,A=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,x,G,E,B;t&&(s=t.getSpacedPoints(q),v=!0,l=!1,x=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,q,!1),G=new THREE.Vector3,E=new THREE.Vector3,B=new THREE.Vector3);l||(n=k=p=0);var y,C,P,F=this,K=this.vertices.length,t=a.extractPoints(r),r=t.shape,M=t.holes;if(t=!THREE.Shape.Utils.isClockWise(r)){r=
|
|
|
+r.reverse();C=0;for(P=M.length;C<P;C++)y=M[C],THREE.Shape.Utils.isClockWise(y)&&(M[C]=y.reverse());t=!1}var W=THREE.Shape.Utils.triangulateShape(r,M),T=r;C=0;for(P=M.length;C<P;C++)y=M[C],r=r.concat(y);var Q,I,R,ka,X,ba=r.length,ga,Aa=W.length,t=[],O=0;R=T.length;Q=R-1;for(I=O+1;O<R;O++,Q++,I++)Q===R&&(Q=0),I===R&&(I=0),t[O]=d(T[O],T[Q],T[I]);var Ma=[],ia,Pa=t.concat();C=0;for(P=M.length;C<P;C++){y=M[C];ia=[];O=0;R=y.length;Q=R-1;for(I=O+1;O<R;O++,Q++,I++)Q===R&&(Q=0),I===R&&(I=0),ia[O]=d(y[O],y[Q],
|
|
|
+y[I]);Ma.push(ia);Pa=Pa.concat(ia)}for(Q=0;Q<p;Q++){R=Q/p;ka=k*(1-R);I=n*Math.sin(R*Math.PI/2);O=0;for(R=T.length;O<R;O++)X=c(T[O],t[O],I),g(X.x,X.y,-ka);C=0;for(P=M.length;C<P;C++)for(y=M[C],ia=Ma[C],O=0,R=y.length;O<R;O++)X=c(y[O],ia[O],I),g(X.x,X.y,-ka)}I=n;for(O=0;O<ba;O++)X=l?c(r[O],Pa[O],I):r[O],v?(E.copy(x.normals[0]).multiplyScalar(X.x),G.copy(x.binormals[0]).multiplyScalar(X.y),B.copy(s[0]).add(E).add(G),g(B.x,B.y,B.z)):g(X.x,X.y,0);for(R=1;R<=q;R++)for(O=0;O<ba;O++)X=l?c(r[O],Pa[O],I):r[O],
|
|
|
+v?(E.copy(x.normals[R]).multiplyScalar(X.x),G.copy(x.binormals[R]).multiplyScalar(X.y),B.copy(s[R]).add(E).add(G),g(B.x,B.y,B.z)):g(X.x,X.y,h/q*R);for(Q=p-1;0<=Q;Q--){R=Q/p;ka=k*(1-R);I=n*Math.sin(R*Math.PI/2);O=0;for(R=T.length;O<R;O++)X=c(T[O],t[O],I),g(X.x,X.y,h+ka);C=0;for(P=M.length;C<P;C++)for(y=M[C],ia=Ma[C],O=0,R=y.length;O<R;O++)X=c(y[O],ia[O],I),v?g(X.x,X.y+s[q-1].y,s[q-1].x+ka):g(X.x,X.y,h+ka)}(function(){if(l){var a;a=0*ba;for(O=0;O<Aa;O++)ga=W[O],f(ga[2]+a,ga[1]+a,ga[0]+a,!0);a=q+2*p;
|
|
|
+a*=ba;for(O=0;O<Aa;O++)ga=W[O],f(ga[0]+a,ga[1]+a,ga[2]+a,!1)}else{for(O=0;O<Aa;O++)ga=W[O],f(ga[2],ga[1],ga[0],!0);for(O=0;O<Aa;O++)ga=W[O],f(ga[0]+ba*q,ga[1]+ba*q,ga[2]+ba*q,!1)}})();(function(){var a=0;e(T,a);a+=T.length;C=0;for(P=M.length;C<P;C++)y=M[C],e(y,a),a+=y.length})()};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,g){b=a.vertices[d];e=a.vertices[e];a=a.vertices[g];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(e.x,e.y),new THREE.Vector2(a.x,a.y)]},generateBottomUV:function(a,b,c,d,e,g){return this.generateTopUV(a,b,c,d,e,g)},generateSideWallUV:function(a,b,c,d,e,g,f,h,k,n,p,l){b=a.vertices[e];g=a.vertices[g];f=a.vertices[f];a=a.vertices[h];return.01>Math.abs(b.y-g.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(g.x,1-g.z),new THREE.Vector2(f.x,
|
|
|
1-f.z),new THREE.Vector2(a.x,1-a.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(g.y,1-g.z),new THREE.Vector2(f.y,1-f.z),new THREE.Vector2(a.y,1-a.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===a instanceof Array&&(a=[a]);this.addShapeList(a,b);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};
|
|
@@ -787,17 +787,17 @@ THREE.LensFlarePlugin=function(){var a,b,c,d,e,g,f,h,k,n;function p(a,b){var c=l
|
|
|
1,-1,1,0,1]);var E=new Uint16Array([0,1,2,0,2,3]);s=l.createBuffer();v=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,s);l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v);l.bufferData(l.ELEMENT_ARRAY_BUFFER,E,l.STATIC_DRAW);A=l.createTexture();x=l.createTexture();l.bindTexture(l.TEXTURE_2D,A);l.texImage2D(l.TEXTURE_2D,0,l.RGB,16,16,0,l.RGB,l.UNSIGNED_BYTE,null);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,
|
|
|
l.CLAMP_TO_EDGE);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST);l.bindTexture(l.TEXTURE_2D,x);l.texImage2D(l.TEXTURE_2D,0,l.RGBA,16,16,0,l.RGBA,l.UNSIGNED_BYTE,null);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST);l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST);w=(u=0<l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?
|
|
|
p(THREE.ShaderFlares.lensFlare,q):p(THREE.ShaderFlares.lensFlareVertexTexture,q);k=l.getAttribLocation(w,"position");n=l.getAttribLocation(w,"uv");a=l.getUniformLocation(w,"renderType");b=l.getUniformLocation(w,"map");c=l.getUniformLocation(w,"occlusionMap");d=l.getUniformLocation(w,"opacity");e=l.getUniformLocation(w,"color");g=l.getUniformLocation(w,"scale");f=l.getUniformLocation(w,"rotation");h=l.getUniformLocation(w,"screenPosition")};this.render=function(p,q,B,y){t.length=0;p.traverseVisible(function(a){a instanceof
|
|
|
-THREE.LensFlare&&t.push(a)});if(0!==t.length){p=new THREE.Vector3;var C=y/B,Q=.5*B,F=.5*y,K=16/y,M=new THREE.Vector2(K*C,K),W=new THREE.Vector3(1,1,0),T=new THREE.Vector2(1,1);l.useProgram(w);l.enableVertexAttribArray(k);l.enableVertexAttribArray(n);l.uniform1i(c,0);l.uniform1i(b,1);l.bindBuffer(l.ARRAY_BUFFER,s);l.vertexAttribPointer(k,2,l.FLOAT,!1,16,0);l.vertexAttribPointer(n,2,l.FLOAT,!1,16,8);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v);l.disable(l.CULL_FACE);l.depthMask(!1);for(var P=0,I=t.length;P<
|
|
|
-I;P++){K=16/y;M.set(K*C,K);var R=t[P];p.set(R.matrixWorld.elements[12],R.matrixWorld.elements[13],R.matrixWorld.elements[14]);p.applyMatrix4(q.matrixWorldInverse);p.applyProjection(q.projectionMatrix);W.copy(p);T.x=W.x*Q+Q;T.y=W.y*F+F;if(u||0<T.x&&T.x<B&&0<T.y&&T.y<y){l.activeTexture(l.TEXTURE1);l.bindTexture(l.TEXTURE_2D,A);l.copyTexImage2D(l.TEXTURE_2D,0,l.RGB,T.x-8,T.y-8,16,16,0);l.uniform1i(a,0);l.uniform2f(g,M.x,M.y);l.uniform3f(h,W.x,W.y,W.z);l.disable(l.BLEND);l.enable(l.DEPTH_TEST);l.drawElements(l.TRIANGLES,
|
|
|
+THREE.LensFlare&&t.push(a)});if(0!==t.length){p=new THREE.Vector3;var C=y/B,P=.5*B,F=.5*y,K=16/y,M=new THREE.Vector2(K*C,K),W=new THREE.Vector3(1,1,0),T=new THREE.Vector2(1,1);l.useProgram(w);l.enableVertexAttribArray(k);l.enableVertexAttribArray(n);l.uniform1i(c,0);l.uniform1i(b,1);l.bindBuffer(l.ARRAY_BUFFER,s);l.vertexAttribPointer(k,2,l.FLOAT,!1,16,0);l.vertexAttribPointer(n,2,l.FLOAT,!1,16,8);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v);l.disable(l.CULL_FACE);l.depthMask(!1);for(var Q=0,I=t.length;Q<
|
|
|
+I;Q++){K=16/y;M.set(K*C,K);var R=t[Q];p.set(R.matrixWorld.elements[12],R.matrixWorld.elements[13],R.matrixWorld.elements[14]);p.applyMatrix4(q.matrixWorldInverse);p.applyProjection(q.projectionMatrix);W.copy(p);T.x=W.x*P+P;T.y=W.y*F+F;if(u||0<T.x&&T.x<B&&0<T.y&&T.y<y){l.activeTexture(l.TEXTURE1);l.bindTexture(l.TEXTURE_2D,A);l.copyTexImage2D(l.TEXTURE_2D,0,l.RGB,T.x-8,T.y-8,16,16,0);l.uniform1i(a,0);l.uniform2f(g,M.x,M.y);l.uniform3f(h,W.x,W.y,W.z);l.disable(l.BLEND);l.enable(l.DEPTH_TEST);l.drawElements(l.TRIANGLES,
|
|
|
6,l.UNSIGNED_SHORT,0);l.activeTexture(l.TEXTURE0);l.bindTexture(l.TEXTURE_2D,x);l.copyTexImage2D(l.TEXTURE_2D,0,l.RGBA,T.x-8,T.y-8,16,16,0);l.uniform1i(a,1);l.disable(l.DEPTH_TEST);l.activeTexture(l.TEXTURE1);l.bindTexture(l.TEXTURE_2D,A);l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0);R.positionScreen.copy(W);R.customUpdateCallback?R.customUpdateCallback(R):R.updateLensFlares();l.uniform1i(a,2);l.enable(l.BLEND);for(var ka=0,X=R.lensFlares.length;ka<X;ka++){var ba=R.lensFlares[ka];.001<ba.opacity&&
|
|
|
.001<ba.scale&&(W.x=ba.x,W.y=ba.y,W.z=ba.z,K=ba.size*ba.scale/y,M.x=K*C,M.y=K,l.uniform3f(h,W.x,W.y,W.z),l.uniform2f(g,M.x,M.y),l.uniform1f(f,ba.rotation),l.uniform1f(d,ba.opacity),l.uniform3f(e,ba.color.r,ba.color.g,ba.color.b),r.setBlending(ba.blending,ba.blendEquation,ba.blendSrc,ba.blendDst),r.setTexture(ba.texture,1),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0))}}}l.enable(l.CULL_FACE);l.enable(l.DEPTH_TEST);l.depthMask(!0);r.resetGLState()}}};
|
|
|
THREE.ShadowMapPlugin=function(){function a(b,c,d){if(c.visible){var f=e[c.id];if(f&&c.castShadow&&(!1===c.frustumCulled||!0===p.intersectsObject(c)))for(var g=0,h=f.length;g<h;g++){var k=f[g];c._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,c.matrixWorld);s.push(k)}g=0;for(h=c.children.length;g<h;g++)a(b,c.children[g],d)}}var b,c,d,e,g,f,h,k,n,p=new THREE.Frustum,l=new THREE.Matrix4,r=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector3,s=[];this.init=function(a,l,p,q){b=a.context;c=
|
|
|
a;d=l;e=p;g=q;a=THREE.ShaderLib.depthRGBA;l=THREE.UniformsUtils.clone(a.uniforms);f=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l});h=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,morphTargets:!0});k=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,skinning:!0});n=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,
|
|
|
-uniforms:l,morphTargets:!0,skinning:!0});f._shadowPass=!0;h._shadowPass=!0;k._shadowPass=!0;n._shadowPass=!0};this.render=function(a,b){!1!==c.shadowMapEnabled&&!1!==c.shadowMapAutoUpdate&&this.update(a,b)};this.update=function(e,w){var u,A,x,G,E,B,y,C,Q=[];G=0;b.clearColor(1,1,1,1);b.disable(b.BLEND);b.enable(b.CULL_FACE);b.frontFace(b.CCW);c.shadowMapCullFace===THREE.CullFaceFront?b.cullFace(b.FRONT):b.cullFace(b.BACK);c.setDepthTest(!0);u=0;for(A=d.length;u<A;u++)if(x=d[u],x.castShadow)if(x instanceof
|
|
|
+uniforms:l,morphTargets:!0,skinning:!0});f._shadowPass=!0;h._shadowPass=!0;k._shadowPass=!0;n._shadowPass=!0};this.render=function(a,b){!1!==c.shadowMapEnabled&&!1!==c.shadowMapAutoUpdate&&this.update(a,b)};this.update=function(e,w){var u,A,x,G,E,B,y,C,P=[];G=0;b.clearColor(1,1,1,1);b.disable(b.BLEND);b.enable(b.CULL_FACE);b.frontFace(b.CCW);c.shadowMapCullFace===THREE.CullFaceFront?b.cullFace(b.FRONT):b.cullFace(b.BACK);c.setDepthTest(!0);u=0;for(A=d.length;u<A;u++)if(x=d[u],x.castShadow)if(x instanceof
|
|
|
THREE.DirectionalLight&&x.shadowCascade)for(E=0;E<x.shadowCascadeCount;E++){var F;if(x.shadowCascadeArray[E])F=x.shadowCascadeArray[E];else{y=x;var K=E;F=new THREE.DirectionalLight;F.isVirtual=!0;F.onlyShadow=!0;F.castShadow=!0;F.shadowCameraNear=y.shadowCameraNear;F.shadowCameraFar=y.shadowCameraFar;F.shadowCameraLeft=y.shadowCameraLeft;F.shadowCameraRight=y.shadowCameraRight;F.shadowCameraBottom=y.shadowCameraBottom;F.shadowCameraTop=y.shadowCameraTop;F.shadowCameraVisible=y.shadowCameraVisible;
|
|
|
F.shadowDarkness=y.shadowDarkness;F.shadowBias=y.shadowCascadeBias[K];F.shadowMapWidth=y.shadowCascadeWidth[K];F.shadowMapHeight=y.shadowCascadeHeight[K];F.pointsWorld=[];F.pointsFrustum=[];C=F.pointsWorld;B=F.pointsFrustum;for(var M=0;8>M;M++)C[M]=new THREE.Vector3,B[M]=new THREE.Vector3;C=y.shadowCascadeNearZ[K];y=y.shadowCascadeFarZ[K];B[0].set(-1,-1,C);B[1].set(1,-1,C);B[2].set(-1,1,C);B[3].set(1,1,C);B[4].set(-1,-1,y);B[5].set(1,-1,y);B[6].set(-1,1,y);B[7].set(1,1,y);F.originalCamera=w;B=new THREE.Gyroscope;
|
|
|
B.position.copy(x.shadowCascadeOffset);B.add(F);B.add(F.target);w.add(B);x.shadowCascadeArray[E]=F;console.log("Created virtualLight",F)}K=x;C=E;y=K.shadowCascadeArray[C];y.position.copy(K.position);y.target.position.copy(K.target.position);y.lookAt(y.target);y.shadowCameraVisible=K.shadowCameraVisible;y.shadowDarkness=K.shadowDarkness;y.shadowBias=K.shadowCascadeBias[C];B=K.shadowCascadeNearZ[C];K=K.shadowCascadeFarZ[C];y=y.pointsFrustum;y[0].z=B;y[1].z=B;y[2].z=B;y[3].z=B;y[4].z=K;y[5].z=K;y[6].z=
|
|
|
-K;y[7].z=K;Q[G]=F;G++}else Q[G]=x,G++;u=0;for(A=Q.length;u<A;u++){x=Q[u];x.shadowMap||(E=THREE.LinearFilter,c.shadowMapType===THREE.PCFSoftShadowMap&&(E=THREE.NearestFilter),x.shadowMap=new THREE.WebGLRenderTarget(x.shadowMapWidth,x.shadowMapHeight,{minFilter:E,magFilter:E,format:THREE.RGBAFormat}),x.shadowMapSize=new THREE.Vector2(x.shadowMapWidth,x.shadowMapHeight),x.shadowMatrix=new THREE.Matrix4);if(!x.shadowCamera){if(x instanceof THREE.SpotLight)x.shadowCamera=new THREE.PerspectiveCamera(x.shadowCameraFov,
|
|
|
+K;y[7].z=K;P[G]=F;G++}else P[G]=x,G++;u=0;for(A=P.length;u<A;u++){x=P[u];x.shadowMap||(E=THREE.LinearFilter,c.shadowMapType===THREE.PCFSoftShadowMap&&(E=THREE.NearestFilter),x.shadowMap=new THREE.WebGLRenderTarget(x.shadowMapWidth,x.shadowMapHeight,{minFilter:E,magFilter:E,format:THREE.RGBAFormat}),x.shadowMapSize=new THREE.Vector2(x.shadowMapWidth,x.shadowMapHeight),x.shadowMatrix=new THREE.Matrix4);if(!x.shadowCamera){if(x instanceof THREE.SpotLight)x.shadowCamera=new THREE.PerspectiveCamera(x.shadowCameraFov,
|
|
|
x.shadowMapWidth/x.shadowMapHeight,x.shadowCameraNear,x.shadowCameraFar);else if(x instanceof THREE.DirectionalLight)x.shadowCamera=new THREE.OrthographicCamera(x.shadowCameraLeft,x.shadowCameraRight,x.shadowCameraTop,x.shadowCameraBottom,x.shadowCameraNear,x.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}e.add(x.shadowCamera);!0===e.autoUpdate&&e.updateMatrixWorld()}x.shadowCameraVisible&&!x.cameraHelper&&(x.cameraHelper=new THREE.CameraHelper(x.shadowCamera),x.shadowCamera.add(x.cameraHelper));
|
|
|
if(x.isVirtual&&F.originalCamera==w){E=w;G=x.shadowCamera;B=x.pointsFrustum;y=x.pointsWorld;r.set(Infinity,Infinity,Infinity);q.set(-Infinity,-Infinity,-Infinity);for(K=0;8>K;K++)C=y[K],C.copy(B[K]),C.unproject(E),C.applyMatrix4(G.matrixWorldInverse),C.x<r.x&&(r.x=C.x),C.x>q.x&&(q.x=C.x),C.y<r.y&&(r.y=C.y),C.y>q.y&&(q.y=C.y),C.z<r.z&&(r.z=C.z),C.z>q.z&&(q.z=C.z);G.left=r.x;G.right=q.x;G.top=q.y;G.bottom=r.y;G.updateProjectionMatrix()}G=x.shadowMap;B=x.shadowMatrix;E=x.shadowCamera;E.position.setFromMatrixPosition(x.matrixWorld);
|
|
|
t.setFromMatrixPosition(x.target.matrixWorld);E.lookAt(t);E.updateMatrixWorld();E.matrixWorldInverse.getInverse(E.matrixWorld);x.cameraHelper&&(x.cameraHelper.visible=x.shadowCameraVisible);x.shadowCameraVisible&&x.cameraHelper.update();B.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);B.multiply(E.projectionMatrix);B.multiply(E.matrixWorldInverse);l.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse);p.setFromMatrix(l);c.setRenderTarget(G);c.clear();s.length=0;a(e,e,E);x=0;for(G=s.length;x<G;x++)y=
|
|
@@ -807,11 +807,11 @@ THREE.SpritePlugin=function(){var a,b,c,d,e,g,f,h,k,n,p,l,r,q,t,s,v;function w(a
|
|
|
var G=u.createShader(u.VERTEX_SHADER),F=u.createShader(u.FRAGMENT_SHADER);u.shaderSource(G,["precision "+A.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
|
|
|
u.shaderSource(F,["precision "+A.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
|
|
|
u.compileShader(G);u.compileShader(F);u.attachShader(w,G);u.attachShader(w,F);u.linkProgram(w);y=w;s=u.getAttribLocation(y,"position");v=u.getAttribLocation(y,"uv");a=u.getUniformLocation(y,"uvOffset");b=u.getUniformLocation(y,"uvScale");c=u.getUniformLocation(y,"rotation");d=u.getUniformLocation(y,"scale");e=u.getUniformLocation(y,"color");g=u.getUniformLocation(y,"map");f=u.getUniformLocation(y,"opacity");h=u.getUniformLocation(y,"modelViewMatrix");k=u.getUniformLocation(y,"projectionMatrix");n=
|
|
|
-u.getUniformLocation(y,"fogType");p=u.getUniformLocation(y,"fogDensity");l=u.getUniformLocation(y,"fogNear");r=u.getUniformLocation(y,"fogFar");q=u.getUniformLocation(y,"fogColor");t=u.getUniformLocation(y,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;G=w.getContext("2d");G.fillStyle="white";G.fillRect(0,0,8,8);x=new THREE.Texture(w);x.needsUpdate=!0};this.render=function(C,Q,F,K){G.length=0;C.traverseVisible(function(a){a instanceof THREE.Sprite&&G.push(a)});if(0!==G.length){u.useProgram(y);
|
|
|
-u.enableVertexAttribArray(s);u.enableVertexAttribArray(v);u.disable(u.CULL_FACE);u.enable(u.BLEND);u.bindBuffer(u.ARRAY_BUFFER,E);u.vertexAttribPointer(s,2,u.FLOAT,!1,16,0);u.vertexAttribPointer(v,2,u.FLOAT,!1,16,8);u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,B);u.uniformMatrix4fv(k,!1,Q.projectionMatrix.elements);u.activeTexture(u.TEXTURE0);u.uniform1i(g,0);K=F=0;var M=C.fog;M?(u.uniform3f(q,M.color.r,M.color.g,M.color.b),M instanceof THREE.Fog?(u.uniform1f(l,M.near),u.uniform1f(r,M.far),u.uniform1i(n,1),
|
|
|
-K=F=1):M instanceof THREE.FogExp2&&(u.uniform1f(p,M.density),u.uniform1i(n,2),K=F=2)):(u.uniform1i(n,0),K=F=0);for(var M=0,W=G.length;M<W;M++){var T=G[M],P=T.material;T._modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,T.matrixWorld);T.z=-T._modelViewMatrix.elements[14]}G.sort(w);Q=[];M=0;for(W=G.length;M<W;M++)T=G[M],P=T.material,u.uniform1f(t,P.alphaTest),u.uniformMatrix4fv(h,!1,T._modelViewMatrix.elements),Q[0]=T.scale.x,Q[1]=T.scale.y,T=0,C.fog&&P.fog&&(T=K),F!==T&&(u.uniform1i(n,T),F=T),
|
|
|
-null!==P.map?(u.uniform2f(a,P.map.offset.x,P.map.offset.y),u.uniform2f(b,P.map.repeat.x,P.map.repeat.y)):(u.uniform2f(a,0,0),u.uniform2f(b,1,1)),u.uniform1f(f,P.opacity),u.uniform3f(e,P.color.r,P.color.g,P.color.b),u.uniform1f(c,P.rotation),u.uniform2fv(d,Q),A.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),A.setDepthTest(P.depthTest),A.setDepthWrite(P.depthWrite),P.map&&P.map.image&&P.map.image.width?A.setTexture(P.map,0):A.setTexture(x,0),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,
|
|
|
-0);u.enable(u.CULL_FACE);A.resetGLState()}}};
|
|
|
+u.getUniformLocation(y,"fogType");p=u.getUniformLocation(y,"fogDensity");l=u.getUniformLocation(y,"fogNear");r=u.getUniformLocation(y,"fogFar");q=u.getUniformLocation(y,"fogColor");t=u.getUniformLocation(y,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;G=w.getContext("2d");G.fillStyle="white";G.fillRect(0,0,8,8);x=new THREE.Texture(w);x.needsUpdate=!0};this.render=function(C,P,F,K){G.length=0;C.traverseVisible(function(a){a instanceof THREE.Sprite&&G.push(a)});if(0!==G.length){u.useProgram(y);
|
|
|
+u.enableVertexAttribArray(s);u.enableVertexAttribArray(v);u.disable(u.CULL_FACE);u.enable(u.BLEND);u.bindBuffer(u.ARRAY_BUFFER,E);u.vertexAttribPointer(s,2,u.FLOAT,!1,16,0);u.vertexAttribPointer(v,2,u.FLOAT,!1,16,8);u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,B);u.uniformMatrix4fv(k,!1,P.projectionMatrix.elements);u.activeTexture(u.TEXTURE0);u.uniform1i(g,0);K=F=0;var M=C.fog;M?(u.uniform3f(q,M.color.r,M.color.g,M.color.b),M instanceof THREE.Fog?(u.uniform1f(l,M.near),u.uniform1f(r,M.far),u.uniform1i(n,1),
|
|
|
+K=F=1):M instanceof THREE.FogExp2&&(u.uniform1f(p,M.density),u.uniform1i(n,2),K=F=2)):(u.uniform1i(n,0),K=F=0);for(var M=0,W=G.length;M<W;M++){var T=G[M];T._modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);T.z=null===T.renderDepth?-T._modelViewMatrix.elements[14]:T.renderDepth}G.sort(w);P=[];M=0;for(W=G.length;M<W;M++){var T=G[M],Q=T.material;u.uniform1f(t,Q.alphaTest);u.uniformMatrix4fv(h,!1,T._modelViewMatrix.elements);P[0]=T.scale.x;P[1]=T.scale.y;T=0;C.fog&&Q.fog&&(T=K);F!==
|
|
|
+T&&(u.uniform1i(n,T),F=T);null!==Q.map?(u.uniform2f(a,Q.map.offset.x,Q.map.offset.y),u.uniform2f(b,Q.map.repeat.x,Q.map.repeat.y)):(u.uniform2f(a,0,0),u.uniform2f(b,1,1));u.uniform1f(f,Q.opacity);u.uniform3f(e,Q.color.r,Q.color.g,Q.color.b);u.uniform1f(c,Q.rotation);u.uniform2fv(d,P);A.setBlending(Q.blending,Q.blendEquation,Q.blendSrc,Q.blendDst);A.setDepthTest(Q.depthTest);A.setDepthWrite(Q.depthWrite);Q.map&&Q.map.image&&Q.map.image.width?A.setTexture(Q.map,0):A.setTexture(x,0);u.drawElements(u.TRIANGLES,
|
|
|
+6,u.UNSIGNED_SHORT,0)}u.enable(u.CULL_FACE);A.resetGLState()}}};
|
|
|
THREE.DepthPassPlugin=function(){function a(b,c,d){if(c.visible){var f=e[c.id];if(f&&(!1===c.frustumCulled||!0===p.intersectsObject(c)))for(var g=0,h=f.length;g<h;g++){var k=f[g];c._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,c.matrixWorld);r.push(k)}g=0;for(h=c.children.length;g<h;g++)a(b,c.children[g],d)}}this.enabled=!1;this.renderTarget=null;var b,c,d,e,g,f,h,k,n,p=new THREE.Frustum,l=new THREE.Matrix4,r=[];this.init=function(a,l,p,r){b=a.context;c=a;d=l;e=p;g=r;a=THREE.ShaderLib.depthRGBA;
|
|
|
l=THREE.UniformsUtils.clone(a.uniforms);f=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l});h=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,morphTargets:!0});k=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,skinning:!0});n=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:l,morphTargets:!0,skinning:!0});f._shadowPass=
|
|
|
!0;h._shadowPass=!0;k._shadowPass=!0;n._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(e,t){var s,v,w,u,A;b.clearColor(1,1,1,1);b.disable(b.BLEND);c.setDepthTest(!0);!0===e.autoUpdate&&e.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);l.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);p.setFromMatrix(l);c.setRenderTarget(this.renderTarget);c.clear();r.length=0;a(e,e,t);var x;s=0;for(v=r.length;s<v;s++)w=r[s],A=w.object,w=w.buffer,
|