From a09b0bd8f9d4fa22be1caae1c4ae1532c04e1895 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Tue, 14 Oct 2014 14:31:45 +0200 Subject: [PATCH] Updated builds. --- build/three.js | 197 +++++++---------- build/three.min.js | 515 +++++++++++++++++++++++---------------------- 2 files changed, 329 insertions(+), 383 deletions(-) diff --git a/build/three.js b/build/three.js index 30ea03b02b..b9830fce47 100644 --- a/build/three.js +++ b/build/three.js @@ -1062,12 +1062,14 @@ THREE.Quaternion.prototype = { }, - fromArray: function ( array ) { + fromArray: function ( array, offset ) { - this._x = array[ 0 ]; - this._y = array[ 1 ]; - this._z = array[ 2 ]; - this._w = array[ 3 ]; + if ( offset === undefined ) offset = 0; + + this._x = array[ offset ]; + this._y = array[ offset + 1 ]; + this._z = array[ offset + 2 ]; + this._w = array[ offset + 3 ]; this.onChangeCallback(); @@ -1484,10 +1486,12 @@ THREE.Vector2.prototype = { }, - fromArray: function ( array ) { + fromArray: function ( array, offset ) { - this.x = array[ 0 ]; - this.y = array[ 1 ]; + if ( offset === undefined ) offset = 0; + + this.x = array[ offset ]; + this.y = array[ offset + 1 ]; return this; @@ -2295,11 +2299,13 @@ THREE.Vector3.prototype = { }, - fromArray: function ( array ) { + fromArray: function ( array, offset ) { + + if ( offset === undefined ) offset = 0; - this.x = array[ 0 ]; - this.y = array[ 1 ]; - this.z = array[ 2 ]; + this.x = array[ offset ]; + this.y = array[ offset + 1 ]; + this.z = array[ offset + 2 ]; return this; @@ -2944,12 +2950,14 @@ THREE.Vector4.prototype = { }, - fromArray: function ( array ) { + fromArray: function ( array, offset ) { + + if ( offset === undefined ) offset = 0; - this.x = array[ 0 ]; - this.y = array[ 1 ]; - this.z = array[ 2 ]; - this.w = array[ 3 ]; + this.x = array[ offset ]; + this.y = array[ offset + 1 ]; + this.z = array[ offset + 2 ]; + this.w = array[ offset + 3 ]; return this; @@ -8630,7 +8638,7 @@ THREE.BufferGeometry.prototype = { var normals = attributes.normal.array; - var vA, vB, vC, x, y, z, + var vA, vB, vC, pA = new THREE.Vector3(), pB = new THREE.Vector3(), @@ -8659,20 +8667,9 @@ THREE.BufferGeometry.prototype = { vB = ( index + indices[ i + 1 ] ) * 3; vC = ( index + indices[ i + 2 ] ) * 3; - x = positions[ vA ]; - y = positions[ vA + 1 ]; - z = positions[ vA + 2 ]; - pA.set( x, y, z ); - - x = positions[ vB ]; - y = positions[ vB + 1 ]; - z = positions[ vB + 2 ]; - pB.set( x, y, z ); - - x = positions[ vC ]; - y = positions[ vC + 1 ]; - z = positions[ vC + 2 ]; - pC.set( x, y, z ); + pA.fromArray( positions, vA ); + pB.fromArray( positions, vB ); + pC.fromArray( positions, vC ); cb.subVectors( pC, pB ); ab.subVectors( pA, pB ); @@ -8700,20 +8697,9 @@ THREE.BufferGeometry.prototype = { for ( var i = 0, il = positions.length; i < il; i += 9 ) { - x = positions[ i ]; - y = positions[ i + 1 ]; - z = positions[ i + 2 ]; - pA.set( x, y, z ); - - x = positions[ i + 3 ]; - y = positions[ i + 4 ]; - z = positions[ i + 5 ]; - pB.set( x, y, z ); - - x = positions[ i + 6 ]; - y = positions[ i + 7 ]; - z = positions[ i + 8 ]; - pC.set( x, y, z ); + pA.fromArray( positions, i ); + pB.fromArray( positions, i + 3 ); + pC.fromArray( positions, i + 6 ); cb.subVectors( pC, pB ); ab.subVectors( pA, pB ); @@ -8782,13 +8768,13 @@ THREE.BufferGeometry.prototype = { } - var xA, yA, zA, - xB, yB, zB, - xC, yC, zC, + var vA = new THREE.Vector3(), + vB = new THREE.Vector3(), + vC = new THREE.Vector3(), - uA, vA, - uB, vB, - uC, vC, + uvA = new THREE.Vector2(), + uvB = new THREE.Vector2(), + uvC = new THREE.Vector2(), x1, x2, y1, y2, z1, z2, s1, s2, t1, t2, r; @@ -8797,41 +8783,28 @@ THREE.BufferGeometry.prototype = { function handleTriangle( a, b, c ) { - xA = positions[ a * 3 ]; - yA = positions[ a * 3 + 1 ]; - zA = positions[ a * 3 + 2 ]; - - xB = positions[ b * 3 ]; - yB = positions[ b * 3 + 1 ]; - zB = positions[ b * 3 + 2 ]; - - xC = positions[ c * 3 ]; - yC = positions[ c * 3 + 1 ]; - zC = positions[ c * 3 + 2 ]; - - uA = uvs[ a * 2 ]; - vA = uvs[ a * 2 + 1 ]; + vA.fromArray( positions, a * 3 ); + vB.fromArray( positions, b * 3 ); + vC.fromArray( positions, c * 3 ); - uB = uvs[ b * 2 ]; - vB = uvs[ b * 2 + 1 ]; + uvA.fromArray( uvs, a * 2 ); + uvB.fromArray( uvs, b * 2 ); + uvC.fromArray( uvs, c * 2 ); - uC = uvs[ c * 2 ]; - vC = uvs[ c * 2 + 1 ]; - - x1 = xB - xA; - x2 = xC - xA; + x1 = vB.x - vA.x; + x2 = vC.x - vA.x; - y1 = yB - yA; - y2 = yC - yA; + y1 = vB.y - vA.y; + y2 = vC.y - vA.y; - z1 = zB - zA; - z2 = zC - zA; + z1 = vB.z - vA.z; + z2 = vC.z - vA.z; - s1 = uB - uA; - s2 = uC - uA; + s1 = uvB.x - uvA.x; + s2 = uvC.x - uvA.x; - t1 = vB - vA; - t2 = vC - vA; + t1 = uvB.y - uvA.y; + t2 = uvC.y - uvA.y; r = 1.0 / ( s1 * t2 - s2 * t1 ); @@ -8893,10 +8866,7 @@ THREE.BufferGeometry.prototype = { function handleVertex( v ) { - n.x = normals[ v * 3 ]; - n.y = normals[ v * 3 + 1 ]; - n.z = normals[ v * 3 + 2 ]; - + n.fromArray( normals, v * 3 ); n2.copy( n ); t = tan1[ v ]; @@ -12281,10 +12251,15 @@ THREE.BufferGeometryLoader.prototype = { if ( boundingSphere !== undefined ) { - geometry.boundingSphere = new THREE.Sphere( - new THREE.Vector3().fromArray( boundingSphere.center !== undefined ? boundingSphere.center : [ 0, 0, 0 ] ), - boundingSphere.radius - ); + var center = new THREE.Vector3(); + + if ( boundingSphere.center !== undefined ) { + + center.fromArray( boundingSphere.center ); + + } + + geometry.boundingSphere = new THREE.Sphere( center, boundingSphere.radius ); } @@ -14459,11 +14434,7 @@ THREE.PointCloud.prototype.raycast = ( function () { var a = index + indices[ i ]; - position.set( - positions[ a * 3 ], - positions[ a * 3 + 1 ], - positions[ a * 3 + 2 ] - ); + position.fromArray( positions, a * 3 ); testPoint( position, a ); @@ -14765,22 +14736,9 @@ THREE.Mesh.prototype.raycast = ( function () { b = index + indices[ i + 1 ]; c = index + indices[ i + 2 ]; - vA.set( - positions[ a * 3 ], - positions[ a * 3 + 1 ], - positions[ a * 3 + 2 ] - ); - vB.set( - positions[ b * 3 ], - positions[ b * 3 + 1 ], - positions[ b * 3 + 2 ] - ); - vC.set( - positions[ c * 3 ], - positions[ c * 3 + 1 ], - positions[ c * 3 + 2 ] - ); - + vA.fromArray( positions, a * 3 ); + vB.fromArray( positions, b * 3 ); + vC.fromArray( positions, c * 3 ); if ( material.side === THREE.BackSide ) { @@ -14824,22 +14782,9 @@ THREE.Mesh.prototype.raycast = ( function () { b = i + 1; c = i + 2; - vA.set( - positions[ j ], - positions[ j + 1 ], - positions[ j + 2 ] - ); - vB.set( - positions[ j + 3 ], - positions[ j + 4 ], - positions[ j + 5 ] - ); - vC.set( - positions[ j + 6 ], - positions[ j + 7 ], - positions[ j + 8 ] - ); - + vA.fromArray( positions, j ); + vB.fromArray( positions, j + 3 ); + vC.fromArray( positions, j + 6 ); if ( material.side === THREE.BackSide ) { diff --git a/build/three.min.js b/build/three.min.js index d59d9f020a..b7a727530d 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -26,14 +26,15 @@ 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){this._x=a[0];this._y=a[1];this._z=a[2];this._w=a[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(){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}; 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.xb.x&&(this.x=b.x);this.yb.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){this.x=a[0];this.y=a[1];return this},toArray:function(){return[this.x,this.y]},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}; +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)}}; +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."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y= @@ -49,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){this.x=a[0];this.y=a[1];this.z=a[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(){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}; 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= @@ -59,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.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);this.wb.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){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[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(){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"; 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, @@ -91,21 +92,21 @@ a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:funct c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4]; a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]]},clone:function(){return(new THREE.Matrix3).fromArray(this.elements)}}; THREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqToSegment:function(a,b,c,d){var e=a.clone().add(b).multiplyScalar(.5),g=b.clone().sub(a).normalize(),f=.5*a.distanceTo(b),h= -this.origin.clone().sub(e);a=-this.direction.dot(g);b=h.dot(this.direction);var k=-h.dot(g),n=h.lengthSq(),p=Math.abs(1-a*a),l,t;0<=p?(h=a*k-b,l=a*b-k,t=f*p,0<=h?l>=-t?l<=t?(f=1/p,h*=f,l*=f,a=h*(h+a*l+2*b)+l*(a*h+l+2*k)+n):(l=f,h=Math.max(0,-(a*l+b)),a=-h*h+l*(l+2*k)+n):(l=-f,h=Math.max(0,-(a*l+b)),a=-h*h+l*(l+2*k)+n):l<=-t?(h=Math.max(0,-(-a*f+b)),l=0=-r?l<=r?(f=1/p,h*=f,l*=f,a=h*(h+a*l+2*b)+l*(a*h+l+2*k)+n):(l=f,h=Math.max(0,-(a*l+b)),a=-h*h+l*(l+2*k)+n):(l=-f,h=Math.max(0,-(a*l+b)),a=-h*h+l*(l+2*k)+n):l<=-r?(h=Math.max(0,-(-a*f+b)),l=0g)return null;g=Math.sqrt(g-e);e=d-g; d+=g;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function(){var a=new THREE.Vector3; return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,d,e,g,f;d=1/this.direction.x;g=1/this.direction.y;f=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=g?(e=(a.min.y-h.y)*g,g*=a.max.y-h.y):(e=(a.max.y-h.y)*g,g*=a.min.y-h.y);if(c>g||e>d)return null;if(e>c||c!==c)c=e;if(gf||e>d)return null;if(e>c||c!== @@ -125,8 +126,8 @@ THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.c this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius); return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}}; THREE.Frustum=function(a,b,c,d,e,g){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==g?g:new THREE.Plane]}; -THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,g){var f=this.planes;f[0].copy(a);f[1].copy(b);f[2].copy(c);f[3].copy(d);f[4].copy(e);f[5].copy(g);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],g=c[3],f=c[4],h=c[5],k=c[6],n=c[7],p=c[8],l=c[9],t=c[10],q=c[11],s=c[12],r=c[13],v=c[14],c=c[15];b[0].setComponents(g-a,n-f,q-p,c-s).normalize();b[1].setComponents(g+ -a,n+f,q+p,c+s).normalize();b[2].setComponents(g+d,n+h,q+l,c+r).normalize();b[3].setComponents(g-d,n-h,q-l,c-r).normalize();b[4].setComponents(g-e,n-k,q-t,c-v).normalize();b[5].setComponents(g+e,n+k,q+t,c+v).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, +THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,g){var f=this.planes;f[0].copy(a);f[1].copy(b);f[2].copy(c);f[3].copy(d);f[4].copy(e);f[5].copy(g);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],g=c[3],f=c[4],h=c[5],k=c[6],n=c[7],p=c[8],l=c[9],r=c[10],q=c[11],t=c[12],s=c[13],v=c[14],c=c[15];b[0].setComponents(g-a,n-f,q-p,c-t).normalize();b[1].setComponents(g+ +a,n+f,q+p,c+t).normalize();b[2].setComponents(g+d,n+h,q+l,c+s).normalize();b[3].setComponents(g-d,n-h,q-l,c-s).normalize();b[4].setComponents(g-e,n-k,q-r,c-v).normalize();b[5].setComponents(g+e,n+k,q+r,c+v).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes, c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var g=d[e];a.x=0f&&0>g)return!1}return!0}}(), containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d, @@ -137,8 +138,8 @@ a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}} THREE.Math={generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d;return function(){for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a= 180/Math.PI;return function(b){return b*a}}(),isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a}}; -THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,k,n,p,l,t;this.initFromArray=function(a){this.points=[];for(var b=0;bthis.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:g+ -2;n=this.points[c[0]];p=this.points[c[1]];l=this.points[c[2]];t=this.points[c[3]];h=f*f;k=f*h;d.x=b(n.x,p.x,l.x,t.x,f,h,k);d.y=b(n.y,p.y,l.y,t.y,f,h,k);d.z=b(n.z,p.z,l.z,t.z,f,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;athis.points.length-2?this.points.length-1:g+1;c[3]=g>this.points.length-3?this.points.length-1:g+ +2;n=this.points[c[0]];p=this.points[c[1]];l=this.points[c[2]];r=this.points[c[3]];h=f*f;k=f*h;d.x=b(n.x,p.x,l.x,r.x,f,h,k);d.y=b(n.y,p.y,l.y,r.y,f,h,k);d.z=b(n.z,p.z,l.z,r.z,f,h,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;aRa?-1:1;h[4*a]=Ea.x;h[4*a+1]=Ea.y;h[4*a+2]=Ea.z;h[4*a+3]=ob}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;pr;r++)s=a[3*c+r],-1==t[s]?(l[2*r]=s,l[2*r+1]=-1,p++):t[s]k.index+b)for(k={start:g,count:0,index:f},h.push(k),p=0;6> -p;p+=2)r=l[p+1],-1p;p+=2)s=l[p],r=l[p+1],-1===r&&(r=f++),t[s]=r,q[r]=s,e[g++]=r-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;ePa?-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;ps;s++)t=a[3*c+s],-1==r[t]?(l[2*s]=t,l[2*s+1]=-1,p++):r[t]k.index+b)for(k={start:g,count:0,index:f},h.push(k),p=0;6>p;p+=2)s=l[p+1],-1p;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;ed?-1:1,e.vertexTangents[c]=new THREE.Vector4(x.x,x.y,x.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;cd?-1:1,e.vertexTangents[c]=new THREE.Vector4(x.x,x.y,x.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;cd;d++)if(e[d]==e[(d+1)%3]){a.push(g);break}for(g=a.length-1;0<=g;g--)for(e=a[g],this.faces.splice(e,1),c=0,f=this.faceVertexUvs.length;ca.opacity)h.transparent=a.transparent;void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"=== a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorAmbient&&(h.ambient=e(a.colorAmbient));a.colorEmissive&&(h.emissive=e(a.colorEmissive));a.transparency&&(h.opacity=a.transparency);a.specularCoef&&(h.shininess=a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap, a.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&d(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapAlpha&& @@ -259,16 +260,16 @@ THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)}; THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState===g.DONE)if(200===g.status||0===g.status){if(g.responseText){var h=JSON.parse(g.responseText);if(void 0!==h.metadata&&"scene"===h.metadata.type){console.error('THREE.JSONLoader: "'+b+'" seems to be a Scene. Use THREE.SceneLoader instead.');return}h=a.parse(h,d);c(h.geometry,h.materials)}else console.error('THREE.JSONLoader: "'+b+'" seems to be unreachable or the file is empty.'); a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load \""+b+'" ('+g.status+")");else g.readyState===g.LOADING?e&&(0===f&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):g.readyState===g.HEADERS_RECEIVED&&void 0!==e&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.withCredentials=this.withCredentials;g.send(null)}; -THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,f,h,k,n,p,l,t,q,s,r,v,w,u=a.faces;p=a.vertices;var A=a.normals,x=a.colors,F=0;if(void 0!==a.uvs){for(d=0;df;f++)t=u[k++],w=v[2*t],t=v[2*t+1],w=new THREE.Vector2(w,t),2!==f&&c.faceVertexUvs[d][h].push(w),0!==f&&c.faceVertexUvs[d][h+1].push(w);l&&(l=3*u[k++],q.normal.set(A[l++],A[l++],A[l]),r.normal.copy(q.normal));if(s)for(d=0;4>d;d++)l=3*u[k++],s=new THREE.Vector3(A[l++], -A[l++],A[l]),2!==d&&q.vertexNormals.push(s),0!==d&&r.vertexNormals.push(s);p&&(p=u[k++],p=x[p],q.color.setHex(p),r.color.setHex(p));if(b)for(d=0;4>d;d++)p=u[k++],p=x[p],2!==d&&q.vertexColors.push(new THREE.Color(p)),0!==d&&r.vertexColors.push(new THREE.Color(p));c.faces.push(q);c.faces.push(r)}else{q=new THREE.Face3;q.a=u[k++];q.b=u[k++];q.c=u[k++];h&&(h=u[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;df;f++)t=u[k++],w=v[2*t],t=v[2*t+1], -w=new THREE.Vector2(w,t),c.faceVertexUvs[d][h].push(w);l&&(l=3*u[k++],q.normal.set(A[l++],A[l++],A[l]));if(s)for(d=0;3>d;d++)l=3*u[k++],s=new THREE.Vector3(A[l++],A[l++],A[l]),q.vertexNormals.push(s);p&&(p=u[k++],q.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=u[k++],q.vertexColors.push(new THREE.Color(x[p]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,f=a.skinWeights.length;df;f++)r=u[k++],w=v[2*r],r=v[2*r+1],w=new THREE.Vector2(w,r),2!==f&&c.faceVertexUvs[d][h].push(w),0!==f&&c.faceVertexUvs[d][h+1].push(w);l&&(l=3*u[k++],q.normal.set(A[l++],A[l++],A[l]),s.normal.copy(q.normal));if(t)for(d=0;4>d;d++)l=3*u[k++],t=new THREE.Vector3(A[l++], +A[l++],A[l]),2!==d&&q.vertexNormals.push(t),0!==d&&s.vertexNormals.push(t);p&&(p=u[k++],p=x[p],q.color.setHex(p),s.color.setHex(p));if(b)for(d=0;4>d;d++)p=u[k++],p=x[p],2!==d&&q.vertexColors.push(new THREE.Color(p)),0!==d&&s.vertexColors.push(new THREE.Color(p));c.faces.push(q);c.faces.push(s)}else{q=new THREE.Face3;q.a=u[k++];q.b=u[k++];q.c=u[k++];h&&(h=u[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;df;f++)r=u[k++],w=v[2*r],r=v[2*r+1], +w=new THREE.Vector2(w,r),c.faceVertexUvs[d][h].push(w);l&&(l=3*u[k++],q.normal.set(A[l++],A[l++],A[l]));if(t)for(d=0;3>d;d++)l=3*u[k++],t=new THREE.Vector3(A[l++],A[l++],A[l]),q.vertexNormals.push(t);p&&(p=u[k++],q.color.setHex(x[p]));if(b)for(d=0;3>d;d++)p=u[k++],q.vertexColors.push(new THREE.Color(x[p]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,f=a.skinWeights.length;dg)){var t=b.origin.distanceTo(n);td.far||e.push({distance:t,point:k.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}();THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.type));THREE.Object3D.prototype.clone.call(this,a);return a}; +1:2,l=0;lg)){var r=b.origin.distanceTo(n);rd.far||e.push({distance:r,point:k.clone().applyMatrix4(this.matrixWorld),face:null,faceIndex:null,object:this})}}}();THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.type));THREE.Object3D.prototype.clone.call(this,a);return a}; THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype); THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0f.far||h.push({distance:E,point:F,face:new THREE.Face3(p,l,t,THREE.Triangle.normal(d,e,g)),faceIndex:null,object:this})}}}else for(r=p.position.array,s=k=0,x=r.length;kf.far||h.push({distance:E,point:F,face:new THREE.Face3(p,l,t,THREE.Triangle.normal(d,e,g)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(s=this.material instanceof THREE.MeshFaceMaterial,r=!0===s?this.material.materials:null,q=f.precision,v=k.vertices,w=0,u=k.faces.length;wf.far||h.push({distance:E,point:F,face:A,faceIndex:w,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype); +this.material;if(void 0!==n){var p=k.attributes,l,r,q=f.precision;if(void 0!==p.index){var t=p.index.array,s=p.position.array,v=k.offsets;0===v.length&&(v=[{start:0,count:t.length,index:0}]);for(var w=0,u=v.length;wf.far||h.push({distance:E,point:G,face:new THREE.Face3(p,l,r,THREE.Triangle.normal(d,e,g)),faceIndex:null,object:this})}}}else for(s=p.position.array,t=k=0,x=s.length;k +f.far||h.push({distance:E,point:G,face:new THREE.Face3(p,l,r,THREE.Triangle.normal(d,e,g)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(t=this.material instanceof THREE.MeshFaceMaterial,s=!0===t?this.material.materials:null,q=f.precision,v=k.vertices,w=0,u=k.faces.length;wf.far||h.push({distance:E,point:G,face:A,faceIndex:w,object:this}))}}}();THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype); THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256Ca;Ca++)Gb=ca[Ca],Xa[Wa]=Gb.x,Xa[Wa+1]=Gb.y,Xa[Wa+2]=Gb.z,Wa+=3;else for(Ca=0;3>Ca;Ca++)Xa[Wa]=ta.x,Xa[Wa+1]=ta.y,Xa[Wa+2]=ta.z,Wa+=3;m.bindBuffer(m.ARRAY_BUFFER,S.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,Xa,T)}if(Ic&&wa){K=0;for(Z=M.length;KCa;Ca++)xb=Ba[Ca],Ab[yb]=xb.x,Ab[yb+1]=xb.y,yb+=2;0Ca;Ca++)Rb=xa[Ca],kb[zb]=Rb.x,kb[zb+1]=Rb.y,zb+=2;0h&&(f[u].counter+=1,k=f[u].hash+"_"+f[u].counter,k in q||(p={id:rc++, -faces3:[],materialIndex:u,vertices:0,numMorphTargets:l,numMorphNormals:n},q[k]=p,s.push(p)));q[k].faces3.push(t);q[k].vertices+=3}a[g]=s;d.groupsNeedUpdate=!1}a=Fb[d.id];g=0;for(e=a.length;gBa;Ba++)Eb=ba[Ba],Ta[Sa]=Eb.x,Ta[Sa+1]=Eb.y,Ta[Sa+2]=Eb.z,Sa+=3;else for(Ba=0;3>Ba;Ba++)Ta[Sa]=db.x,Ta[Sa+1]=db.y,Ta[Sa+2]=db.z,Sa+=3;m.bindBuffer(m.ARRAY_BUFFER,I.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,Ta,sa)}if(Ic&&va){L=0;for(Y=N.length;LBa;Ba++)Ma=za[Ba],wb[ub]=Ma.x,wb[ub+1]=Ma.y,ub+=2;0Ba;Ba++)Bb=ia[Ba],hb[vb]=Bb.x,hb[vb+1]=Bb.y,vb+=2;0h&&(f[u].counter+=1,k=f[u].hash+"_"+f[u].counter,k in q||(p={id:rc++, +faces3:[],materialIndex:u,vertices:0,numMorphTargets:l,numMorphNormals:n},q[k]=p,r.push(p)));q[k].faces3.push(t);q[k].vertices+=3}a[g]=r;d.groupsNeedUpdate=!1}a=sb[d.id];g=0;for(e=a.length;gGa;Ga++)pb[Ga]=!H.autoScaleCubemaps||Ob||Ub?Ub?wa.image[Ga].image:wa.image[Ga]:N(wa.image[Ga],Uc);var na=pb[0],bc=THREE.Math.isPowerOfTwo(na.width)&&THREE.Math.isPowerOfTwo(na.height),gb=T(wa.format),Jb=T(wa.type);L(m.TEXTURE_CUBE_MAP,wa,bc);for(Ga=0;6>Ga;Ga++)if(Ob)for(var lb,cc=pb[Ga].mipmaps,ha=0,Zb=cc.length;ha=Lc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ -Lc);Mb+=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 D(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 G(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 L(a,b,c){c? -(m.texParameteri(a,m.TEXTURE_WRAP_S,T(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,T(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(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=sa.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&(1b||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 X(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 U(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 T(a){var b;if(a===THREE.RepeatWrapping)return m.REPEAT; +(J.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&J.shadowMatrix)for(var Gb=0,tb=0,Pb=b.length;tbEa;Ea++)mb[Ea]=!H.autoScaleCubemaps||Qb||Ub?Ub?va.image[Ea].image:va.image[Ea]:M(va.image[Ea],Uc);var na=mb[0],ac=THREE.Math.isPowerOfTwo(na.width)&&THREE.Math.isPowerOfTwo(na.height),cb=I(va.format),Hb=I(va.type);K(m.TEXTURE_CUBE_MAP,va,ac);for(Ea=0;6>Ea;Ea++)if(Qb)for(var ib,bc=mb[Ea].mipmaps,ha=0,Zb=bc.length;ha=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&&(1b||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; if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE; if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB; if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a=== -THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;b=sa.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT; -if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=sa.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; -if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=sa.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var O=void 0!==a.canvas?a.canvas:document.createElement("canvas"),ta=void 0!==a.context?a.context:null,Y=void 0!==a.precision?a.precision:"highp",ca=void 0!==a.alpha?a.alpha:!1,ia=void 0!==a.depth?a.depth:!0,xa=void 0!==a.stencil? -a.stencil:!0,I=void 0!==a.antialias?a.antialias:!1,ua=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ja=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Oa=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,S=new THREE.Color(0),Ja=0,Ea=[],db={},Ia=[],bb=[],ob=[];this.domElement=O;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortObjects=this.autoClearStencil=this.autoClearDepth= -this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var H=this,Ra=[],wb=null,ac= -null,xb=-1,Na=null,Yb=null,Mb=0,Nb=-1,vb=-1,Ob=-1,Pb=-1,sb=-1,Qb=-1,Zb=-1,$b=-1,Nc=null,Oc=null,Pc=null,Mc=null,mb=0,nb=0,Eb=O.width,lc=O.height,pc=0,qc=0,tb=new Uint8Array(16),hb=new Uint8Array(16),Bc=new THREE.Frustum,xc=new THREE.Matrix4,Dc=new THREE.Matrix4,Ta=new THREE.Vector3,Ba=new THREE.Vector3,hc=!0,Ac={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[], -exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},m;try{var Qc={alpha:ca,depth:ia,stencil:xa,antialias:I,premultipliedAlpha:ua,preserveDrawingBuffer:ja};m=ta||O.getContext("webgl",Qc)||O.getContext("experimental-webgl",Qc);if(null===m)throw"Error creating WebGL context.";}catch(Vc){console.error(Vc)}void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var sa=new THREE.WebGLExtensions(m);sa.get("OES_texture_float"); -sa.get("OES_texture_float_linear");sa.get("OES_standard_derivatives");Oa&&sa.get("EXT_frag_depth");m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.viewport(mb,nb,Eb,lc);m.clearColor(S.r,S.g,S.b,Ja);this.context=m;var Lc=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),Wc=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS), -Xc=m.getParameter(m.MAX_TEXTURE_SIZE),Uc=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),gc=0b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}H.info.memory.textures--},zc=function(a){a=a.target;a.removeEventListener("dispose",zc);sc(a)},Sc=function(a){for(var b="__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "), -c=0,d=b.length;cd.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals? -n.sort(p):0===n.length&&n.push([0,0]);for(q=0;qd.numSupportedMorphTargets?(n.sort(p),n.length=d.numSupportedMorphTargets):n.length>d.numSupportedMorphNormals? +n.sort(p):0===n.length&&n.push([0,0]);for(q=0;qf;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER, -m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);X(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),L(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0, -d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):X(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER, -null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Eb,a=lc,d=mb,e=nb);b!==ac&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),ac=b);pc=c;qc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)}; +THREE.Math.isPowerOfTwo(a.height),d=I(a.format),e=I(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);K(m.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER, +m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);W(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),K(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0, +d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):W(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER, +null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Rb,a=$b,d=jb,e=kb);b!==Cb&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),Cb=b);pc=c;qc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)}; THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format: THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null}; THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){this.width=a;this.height=b},clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps; @@ -567,31 +568,31 @@ a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchE THREE.WebGLExtensions=function(a){var b={};this.get=function(c){if(void 0!==b[c])return b[c];var d;switch(c){case "OES_texture_float":d=a.getExtension("OES_texture_float");break;case "OES_texture_float_linear":d=a.getExtension("OES_texture_float_linear");break;case "OES_standard_derivatives":d=a.getExtension("OES_standard_derivatives");break;case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case "OES_element_index_uint":d=a.getExtension("OES_element_index_uint");break;case "EXT_blend_minmax":d=a.getExtension("EXT_blend_minmax");break; case "EXT_frag_depth":d=a.getExtension("EXT_frag_depth")}null===d&&console.log("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}}; -THREE.WebGLProgram=function(){var a=0;return function(b,c,d,e){var g=b.context,f=d.defines,h=d.__webglShader.uniforms,k=d.attributes,n=d.__webglShader.vertexShader,p=d.__webglShader.fragmentShader,l=d.index0AttributeName;void 0===l&&!0===e.morphTargets&&(l="position");var t="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");var q,s;q=[];for(var r in f)s=f[r],!1!==s&&(s="#define "+r+" "+s,q.push(s)); +THREE.WebGLProgram=function(){var a=0;return function(b,c,d,e){var g=b.context,f=d.defines,h=d.__webglShader.uniforms,k=d.attributes,n=d.__webglShader.vertexShader,p=d.__webglShader.fragmentShader,l=d.index0AttributeName;void 0===l&&!0===e.morphTargets&&(l="position");var r="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?r="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(r="SHADOWMAP_TYPE_PCF_SOFT");var q,t;q=[];for(var s in f)t=f[s],!1!==t&&(t="#define "+s+" "+t,q.push(t)); q=q.join("\n");f=g.createProgram();d instanceof THREE.RawShaderMaterial?b=d="":(d=["precision "+e.precision+" float;","precision "+e.precision+" int;",q,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+ e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.useVertexTexture?"#define BONE_TEXTURE":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals?"#define USE_MORPHNORMALS":"",e.wrapAround?"#define WRAP_AROUND": -"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+t:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\n\tattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\n\tattribute vec3 morphTarget0;\n\tattribute vec3 morphTarget1;\n\tattribute vec3 morphTarget2;\n\tattribute vec3 morphTarget3;\n\t#ifdef USE_MORPHNORMALS\n\t\tattribute vec3 morphNormal0;\n\t\tattribute vec3 morphNormal1;\n\t\tattribute vec3 morphNormal2;\n\t\tattribute vec3 morphNormal3;\n\t#else\n\t\tattribute vec3 morphTarget4;\n\t\tattribute vec3 morphTarget5;\n\t\tattribute vec3 morphTarget6;\n\t\tattribute vec3 morphTarget7;\n\t#endif\n#endif\n#ifdef USE_SKINNING\n\tattribute vec4 skinIndex;\n\tattribute vec4 skinWeight;\n#endif\n"].join("\n"), +"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+r:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\n\tattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\n\tattribute vec3 morphTarget0;\n\tattribute vec3 morphTarget1;\n\tattribute vec3 morphTarget2;\n\tattribute vec3 morphTarget3;\n\t#ifdef USE_MORPHNORMALS\n\t\tattribute vec3 morphNormal0;\n\t\tattribute vec3 morphNormal1;\n\t\tattribute vec3 morphNormal2;\n\t\tattribute vec3 morphNormal3;\n\t#else\n\t\tattribute vec3 morphTarget4;\n\t\tattribute vec3 morphTarget5;\n\t\tattribute vec3 morphTarget6;\n\t\tattribute vec3 morphTarget7;\n\t#endif\n#endif\n#ifdef USE_SKINNING\n\tattribute vec4 skinIndex;\n\tattribute vec4 skinWeight;\n#endif\n"].join("\n"), b=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap||e.normalMap?"#extension GL_OES_standard_derivatives : enable":"",q,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"",e.useFog&&e.fog?"#define USE_FOG": "",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.metal?"#define METAL":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP": -"",e.shadowMapEnabled?"#define "+t:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"));n=new THREE.WebGLShader(g,g.VERTEX_SHADER,d+n);p=new THREE.WebGLShader(g,g.FRAGMENT_SHADER,b+p);g.attachShader(f,n);g.attachShader(f,p);void 0!==l&&g.bindAttribLocation(f,0,l);g.linkProgram(f);!1===g.getProgramParameter(f,g.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."), +"",e.shadowMapEnabled?"#define "+r:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"));n=new THREE.WebGLShader(g,g.VERTEX_SHADER,d+n);p=new THREE.WebGLShader(g,g.FRAGMENT_SHADER,b+p);g.attachShader(f,n);g.attachShader(f,p);void 0!==l&&g.bindAttribLocation(f,0,l);g.linkProgram(f);!1===g.getProgramParameter(f,g.LINK_STATUS)&&(console.error("THREE.WebGLProgram: Could not initialise shader."), console.error("gl.VALIDATE_STATUS",g.getProgramParameter(f,g.VALIDATE_STATUS)),console.error("gl.getError()",g.getError()));""!==g.getProgramInfoLog(f)&&console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",g.getProgramInfoLog(f));g.deleteShader(n);g.deleteShader(p);l="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences bindMatrix bindMatrixInverse".split(" ");e.useVertexTexture?(l.push("boneTexture"),l.push("boneTextureWidth"),l.push("boneTextureHeight")): -l.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&l.push("logDepthBufFC");for(var v in h)l.push(v);h=l;v={};l=0;for(b=h.length;ll-1?0:l-1,q=l+1>e-1?e-1:l+1,s=0>p-1?0:p-1,r=p+1>d-1?d-1:p+1,v=[],w=[0,0,h[4*(l*d+p)]/255*b];v.push([-1,0,h[4*(l*d+s)]/255*b]);v.push([-1,-1,h[4*(t*d+s)]/255*b]);v.push([0,-1,h[4*(t*d+p)]/255*b]);v.push([1,-1,h[4*(t*d+r)]/255*b]);v.push([1,0,h[4*(l*d+r)]/255*b]);v.push([1,1,h[4*(q*d+r)]/255*b]);v.push([0,1,h[4*(q*d+p)]/255* -b]);v.push([-1,1,h[4*(q*d+s)]/255*b]);t=[];s=v.length;for(q=0;ql-1?0:l-1,q=l+1>e-1?e-1:l+1,t=0>p-1?0:p-1,s=p+1>d-1?d-1:p+1,v=[],w=[0,0,h[4*(l*d+p)]/255*b];v.push([-1,0,h[4*(l*d+t)]/255*b]);v.push([-1,-1,h[4*(r*d+t)]/255*b]);v.push([0,-1,h[4*(r*d+p)]/255*b]);v.push([1,-1,h[4*(r*d+s)]/255*b]);v.push([1,0,h[4*(l*d+s)]/255*b]);v.push([1,1,h[4*(q*d+s)]/255*b]);v.push([0,1,h[4*(q*d+p)]/255* +b]);v.push([-1,1,h[4*(q*d+t)]/255*b]);r=[];t=v.length;for(q=0;qe)return null;var g=[],f=[],h=[],k,n,p;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 t;a:{var q=t=void 0,s=void 0,r=void 0,v=void 0,w=void 0,u=void 0,A=void 0,x=void 0, -q=a[f[k]].x,s=a[f[k]].y,r=a[f[n]].x,v=a[f[n]].y,w=a[f[p]].x,u=a[f[p]].y;if(1E-10>(r-q)*(u-s)-(v-s)*(w-q))t=!1;else{var F=void 0,E=void 0,B=void 0,y=void 0,D=void 0,Q=void 0,G=void 0,L=void 0,N=void 0,X=void 0,N=L=G=x=A=void 0,F=w-r,E=u-v,B=q-w,y=s-u,D=r-q,Q=v-s;for(t=0;te)return null;var g=[],f=[],h=[],k,n,p;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;rMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; +THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,g,f,h,k,n,p,l,r,q,t,s;d=0;for(e=this.actions.length;dMath.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;cl&&(g=b[f],k=-k,h=b[e],l=-l),!(a.yh.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<= h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;by||y>B)return[];k=l*n-k*p;if(0>k||k>B)return[]}else{if(0d?[]: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-10f&&(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;cX){console.log("Infinite Loop! Holes left:"+ -l.length+", Probably Hole outside Shape!");break}for(p=Q;ph;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;cW){console.log("Infinite Loop! Holes left:"+ +l.length+", Probably Hole outside Shape!");break}for(p=Q;ph;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)}; @@ -655,12 +656,12 @@ THREE.Animation.prototype.play=function(a,b){this.currentTime=void 0!==a?a:0;thi THREE.Animation.prototype.reset=function(){for(var a=0,b=this.hierarchy.length;ad;d++){for(var e=this.keyTypes[d],g=this.data.hierarchy[a].keys[0],f=this.getNextKeyWith(e,a,1);f.timeg.index;)g=f,f=this.getNextKeyWith(e,a,f.index+1);c.prevKey[e]=g;c.nextKey[e]=f}}}; THREE.Animation.prototype.resetBlendWeights=function(){for(var a=0,b=this.hierarchy.length;aa.length-2?l:l+1;c[3]=l>a.length-3?l:l+2;l=a[c[0]];q=a[c[1]];s=a[c[2]];r=a[c[3]];c=e*e;t=e*c;d[0]=g(l[0],q[0],s[0],r[0],e,c,t);d[1]=g(l[1],q[1],s[1],r[1],e,c,t);d[2]=g(l[2],q[2],s[2],r[2],e,c,t);return d},g=function(a,b,c,d,e,g,t){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*t+ -(-3*(b-c)-2*a-d)*g+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(this.currentTime>f||0>this.currentTime)if(this.loop)this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset();else{this.stop();return}f=0;for(var g=this.hierarchy.length;fl;l++){var t=this.keyTypes[l],q=n.prevKey[t],s=n.nextKey[t]; -if(0this.timeScale&&q.time>=this.currentTime){q=this.data.hierarchy[f].keys[0];for(s=this.getNextKeyWith(t,f,1);s.timeq.index;)q=s,s=this.getNextKeyWith(t,f,s.index+1);n.prevKey[t]=q;n.nextKey[t]=s}k.matrixAutoUpdate=!0;k.matrixWorldNeedsUpdate=!0;var r=(this.currentTime-q.time)/(s.time-q.time),v=q[t],w=s[t];0>r&&(r=0);1a.length-2?l:l+1;c[3]=l>a.length-3?l:l+2;l=a[c[0]];q=a[c[1]];t=a[c[2]];s=a[c[3]];c=e*e;r=e*c;d[0]=g(l[0],q[0],t[0],s[0],e,c,r);d[1]=g(l[1],q[1],t[1],s[1],e,c,r);d[2]=g(l[2],q[2],t[2],s[2],e,c,r);return d},g=function(a,b,c,d,e,g,r){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*r+ +(-3*(b-c)-2*a-d)*g+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(this.currentTime>f||0>this.currentTime)if(this.loop)this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset();else{this.stop();return}f=0;for(var g=this.hierarchy.length;fl;l++){var r=this.keyTypes[l],q=n.prevKey[r],t=n.nextKey[r]; +if(0this.timeScale&&q.time>=this.currentTime){q=this.data.hierarchy[f].keys[0];for(t=this.getNextKeyWith(r,f,1);t.timeq.index;)q=t,t=this.getNextKeyWith(r,f,t.index+1);n.prevKey[r]=q;n.nextKey[r]=t}k.matrixAutoUpdate=!0;k.matrixWorldNeedsUpdate=!0;var s=(this.currentTime-q.time)/(t.time-q.time),v=q[r],w=t[r];0>s&&(s=0);1=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,r){var v,w=h.widthSegments,u=h.heightSegments,A=e/2,x=f/2,F=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",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,D=f/u,Q=new THREE.Vector3;Q[v]=0=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10d?-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(I=c.length;0<=--I;){e=I;f=I-1;0>f&&(f=c.length-1);for(var g=0,h=q+2*p,g=0;gf&&(f=c.length-1);for(var g=0,h=q+2*p,g=0;gMath.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;cc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5, -a.y));return a.clone()}THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,n=0,p=a.length;nq&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>l&&(b[2].x+=1));n=0;for(p=this.vertices.length;nc&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5, +a.y));return a.clone()}THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,n=0,p=a.length;nq&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>l&&(b[2].x+=1));n=0;for(p=this.vertices.length;nc.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}(); @@ -746,8 +747,8 @@ THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light= c=new THREE.Geometry;c.vertices.push(new THREE.Vector3,new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update()};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype); THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()}; THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}(); -THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},g=function(a,b){return a-b},f=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var n=k.vertices,k=k.faces,p=0,l=0,t=k.length;ls;s++){d[0]=q[f[s]];d[1]=q[f[(s+1)%3]];d.sort(g);var r=d.toString();void 0===e[r]?(e[r]={vert1:d[0],vert2:d[1],face1:l,face2:void 0},p++):e[r].face2=l}h.addAttribute("position",new THREE.BufferAttribute(new Float32Array(6* -p),3));d=h.attributes.position.array;g=0;for(r in e)if(f=e[r],void 0===f.face2||.9999>k[f.face1].normal.dot(k[f.face2].normal))p=n[f.vert1],d[g++]=p.x,d[g++]=p.y,d[g++]=p.z,p=n[f.vert2],d[g++]=p.x,d[g++]=p.y,d[g++]=p.z;THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype); +THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},g=function(a,b){return a-b},f=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var n=k.vertices,k=k.faces,p=0,l=0,r=k.length;lt;t++){d[0]=q[f[t]];d[1]=q[f[(t+1)%3]];d.sort(g);var s=d.toString();void 0===e[s]?(e[s]={vert1:d[0],vert2:d[1],face1:l,face2:void 0},p++):e[s].face2=l}h.addAttribute("position",new THREE.BufferAttribute(new Float32Array(6* +p),3));d=h.attributes.position.array;g=0;for(s in e)if(f=e[s],void 0===f.face2||.9999>k[f.face1].normal.dot(k[f.face2].normal))p=n[f.vert1],d[g++]=p.x,d[g++]=p.y,d[g++]=p.z,p=n[f.vert2],d[g++]=p.x,d[g++]=p.y,d[g++]=p.z;THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype); THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;cr;r++){d[0]=s[f[r]];d[1]=s[f[(r+1)%3]];d.sort(g);var v=d.toString();void 0===e[v]&&(l[2*p]=d[0],l[2*p+1]=d[1],e[v]=!0,p++)}d=new Float32Array(6*p);t=0;for(q=p;tr;r++)p= -k[l[2*t+r]],f=6*t+3*r,d[f+0]=p.x,d[f+1]=p.y,d[f+2]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,q=a.geometry.attributes.index.array,n=a.geometry.offsets,p=0,l=new Uint32Array(2*q.length),s=0,w=n.length;sr;r++)d[0]=f+q[t+r],d[1]=f+q[t+(r+1)%3],d.sort(g),v=d.toString(), -void 0===e[v]&&(l[2*p]=d[0],l[2*p+1]=d[1],e[v]=!0,p++);d=new Float32Array(6*p);t=0;for(q=p;tr;r++)f=6*t+3*r,p=3*l[2*t+r],d[f+0]=k[p],d[f+1]=k[p+1],d[f+2]=k[p+2]}else for(k=a.geometry.attributes.position.array,p=k.length/3,l=p/3,d=new Float32Array(6*p),t=0,q=l;tr;r++)f=18*t+6*r,l=9*t+3*r,d[f+0]=k[l],d[f+1]=k[l+1],d[f+2]=k[l+2],p=9*t+(r+1)%3*3,d[f+3]=k[p],d[f+4]=k[p+1],d[f+5]=k[p+2];h.addAttribute("position",new THREE.BufferAttribute(d,3))}THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}), +THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},g=function(a,b){return a-b},f=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,n=a.geometry.faces,p=0,l=new Uint32Array(6*n.length),r=0,q=n.length;rs;s++){d[0]=t[f[s]];d[1]=t[f[(s+1)%3]];d.sort(g);var v=d.toString();void 0===e[v]&&(l[2*p]=d[0],l[2*p+1]=d[1],e[v]=!0,p++)}d=new Float32Array(6*p);r=0;for(q=p;rs;s++)p= +k[l[2*r+s]],f=6*r+3*s,d[f+0]=p.x,d[f+1]=p.y,d[f+2]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,q=a.geometry.attributes.index.array,n=a.geometry.offsets,p=0,l=new Uint32Array(2*q.length),t=0,w=n.length;ts;s++)d[0]=f+q[r+s],d[1]=f+q[r+(s+1)%3],d.sort(g),v=d.toString(), +void 0===e[v]&&(l[2*p]=d[0],l[2*p+1]=d[1],e[v]=!0,p++);d=new Float32Array(6*p);r=0;for(q=p;rs;s++)f=6*r+3*s,p=3*l[2*r+s],d[f+0]=k[p],d[f+1]=k[p+1],d[f+2]=k[p+2]}else for(k=a.geometry.attributes.position.array,p=k.length/3,l=p/3,d=new Float32Array(6*p),r=0,q=l;rs;s++)f=18*r+6*s,l=9*r+3*s,d[f+0]=k[l],d[f+1]=k[l+1],d[f+2]=k[l+2],p=9*r+(s+1)%3*3,d[f+3]=k[p],d[f+4]=k[p+1],d[f+5]=k[p+2];h.addAttribute("position",new THREE.BufferAttribute(d,3))}THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}), THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)}; THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare.prototype.add=function(a,b,c,d,e,g){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===g&&(g=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:e,blending:d})}; THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;ad.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var g=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),f=d.weight; g!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*f,this.morphTargetInfluences[g]=0,d.lastFrame=d.currentFrame,d.currentFrame=g);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*f;this.morphTargetInfluences[d.lastFrame]=(1-e)*f}}}; -THREE.LensFlarePlugin=function(){var a,b,c,d,e,g,f,h,k,n;function p(a,b){var c=l.createProgram(),d=l.createShader(l.FRAGMENT_SHADER),e=l.createShader(l.VERTEX_SHADER),f="precision "+b+" float;\n";l.shaderSource(d,f+a.fragmentShader);l.shaderSource(e,f+a.vertexShader);l.compileShader(d);l.compileShader(e);l.attachShader(c,d);l.attachShader(c,e);l.linkProgram(c);return c}var l,t,q,s=[],r,v,w,u,A,x;this.init=function(s){l=s.context;t=s;q=s.getPrecision();s=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1, -1,-1,1,0,1]);var E=new Uint16Array([0,1,2,0,2,3]);r=l.createBuffer();v=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,r);l.bufferData(l.ARRAY_BUFFER,s,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, +THREE.LensFlarePlugin=function(){var a,b,c,d,e,g,f,h,k,n;function p(a,b){var c=l.createProgram(),d=l.createShader(l.FRAGMENT_SHADER),e=l.createShader(l.VERTEX_SHADER),f="precision "+b+" float;\n";l.shaderSource(d,f+a.fragmentShader);l.shaderSource(e,f+a.vertexShader);l.compileShader(d);l.compileShader(e);l.attachShader(c,d);l.attachShader(c,e);l.linkProgram(c);return c}var l,r,q,t=[],s,v,w,u,A,x;this.init=function(t){l=t.context;r=t;q=t.getPrecision();t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1, +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=0N;N++)D[N]=new THREE.Vector3,B[N]=new THREE.Vector3;D=y.shadowCascadeNearZ[L];y=y.shadowCascadeFarZ[L];B[0].set(-1,-1,D);B[1].set(1,-1,D);B[2].set(-1,1,D);B[3].set(1,1,D);B[4].set(-1,-1,y);B[5].set(1,-1,y);B[6].set(-1,1,y);B[7].set(1,1,y);G.originalCamera=w;B=new THREE.Gyroscope; -B.position.copy(x.shadowCascadeOffset);B.add(G);B.add(G.target);w.add(B);x.shadowCascadeArray[E]=G;console.log("Created virtualLight",G)}L=x;D=E;y=L.shadowCascadeArray[D];y.position.copy(L.position);y.target.position.copy(L.target.position);y.lookAt(y.target);y.shadowCameraVisible=L.shadowCameraVisible;y.shadowDarkness=L.shadowDarkness;y.shadowBias=L.shadowCascadeBias[D];B=L.shadowCascadeNearZ[D];L=L.shadowCascadeFarZ[D];y=y.pointsFrustum;y[0].z=B;y[1].z=B;y[2].z=B;y[3].z=B;y[4].z=L;y[5].z=L;y[6].z= -L;y[7].z=L;Q[F]=G;F++}else Q[F]=x,F++;u=0;for(A=Q.length;uM;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;uL;L++)D=y[L],D.copy(B[L]),D.unproject(E),D.applyMatrix4(F.matrixWorldInverse),D.xq.x&&(q.x=D.x),D.yq.y&&(q.y=D.y),D.zq.z&&(q.z=D.z);F.left=t.x;F.right=q.x;F.top=q.y;F.bottom=t.y;F.updateProjectionMatrix()}F=x.shadowMap;B=x.shadowMatrix;E=x.shadowCamera;E.position.setFromMatrixPosition(x.matrixWorld); -s.setFromMatrixPosition(x.target.matrixWorld);E.lookAt(s);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(F);c.clear();r.length=0;a(e,e,E);x=0;for(F=r.length;xK;K++)C=y[K],C.copy(B[K]),C.unproject(E),C.applyMatrix4(G.matrixWorldInverse),C.xq.x&&(q.x=C.x),C.yq.y&&(q.y=C.y),C.zq.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 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(F);u.compileShader(G);u.attachShader(w,F);u.attachShader(w,G);u.linkProgram(w);y=w;r=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");t=u.getUniformLocation(y,"fogFar");q=u.getUniformLocation(y,"fogColor");s=u.getUniformLocation(y,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;F=w.getContext("2d");F.fillStyle="white";F.fillRect(0,0,8,8);x=new THREE.Texture(w);x.needsUpdate=!0};this.render=function(D,Q,G,L){F.length=0;D.traverseVisible(function(a){a instanceof THREE.Sprite&&F.push(a)});if(0!==F.length){u.useProgram(y); -u.enableVertexAttribArray(r);u.enableVertexAttribArray(v);u.disable(u.CULL_FACE);u.enable(u.BLEND);u.bindBuffer(u.ARRAY_BUFFER,E);u.vertexAttribPointer(r,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);L=G=0;var N=D.fog;N?(u.uniform3f(q,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(u.uniform1f(l,N.near),u.uniform1f(t,N.far),u.uniform1i(n,1), -L=G=1):N instanceof THREE.FogExp2&&(u.uniform1f(p,N.density),u.uniform1i(n,2),L=G=2)):(u.uniform1i(n,0),L=G=0);for(var N=0,X=F.length;N 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