// threejs.org/license 'use strict';var three={revision:"73"};"function"===typeof define&&define.amd?define("three",three):"undefined"!==typeof exports&&"undefined"!==typeof module&&(module.exports=three); void 0!==self.requestanimationframe&&void 0!==self.cancelanimationframe||function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;ca?-1:0>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setrgb:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},sethsl:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b, c,d){b=three.math.euclideanmodulo(b,1);c=three.math.clamp(c,0,1);d=three.math.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setstyle:function(a){function b(b){void 0!==b&&1>parsefloat(b)&&console.warn("three.color: alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= math.min(255,parseint(c[1],10))/255,this.g=math.min(255,parseint(c[2],10))/255,this.b=math.min(255,parseint(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=math.min(100,parseint(c[1],10))/100,this.g=math.min(100,parseint(c[2],10))/100,this.b=math.min(100,parseint(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parsefloat(c[1])/ 360,e=parseint(c[2],10)/100,g=parseint(c[3],10)/100;b(c[5]);return this.sethsl(d,e,g)}}}else if(c=/^\#([a-fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseint(c.charat(0)+c.charat(0),16)/255,this.g=parseint(c.charat(1)+c.charat(1),16)/255,this.b=parseint(c.charat(2)+c.charat(2),16)/255,this;if(6===d)return this.r=parseint(c.charat(0)+c.charat(1),16)/255,this.g=parseint(c.charat(2)+c.charat(3),16)/255,this.b=parseint(c.charat(4)+c.charat(5),16)/255,this}a&&0=h?l/(e+g): l/(2-e-g);switch(e){case b:f=(c-d)/l+(cg&&c>b?(c=2*math.sqrt(1+c-g-b),this._w=(l-f)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):g>b?(c=2*math.sqrt(1+g-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y= .25*c,this._z=(f+l)/c):(c=2*math.sqrt(1+b-c-g),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(f+l)/c,this._z=.25*c);this.onchangecallback();return this},setfromunitvectors:function(){var a,b;return function(c,d){void 0===a&&(a=new three.vector3);b=c.dot(d)+1;1e-6>b?(b=0,math.abs(c.x)>math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossvectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*= -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,l=b._z,k=b._w;this._x=c*k+g*f+d*l-e*h;this._y=d*k+g*h+e*f-c*l;this._z=e*k+g*l+c*h-d*f;this._w=g*k-c*f-d*h-e*l;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),l=math.sqrt(1-f*f);if(.001>math.abs(l))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)/l;h= math.sin(b*h)/l;this._w=g*f+this._w*h;this._x=c*f+this._x*h;this._y=d*f+this._y*h;this._z=e*f+this._z*h;this.onchangecallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromarray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onchangecallback();return this},toarray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onchange:function(a){this.onchangecallback= a;return this},onchangecallback:function(){}};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,get width(){return this.x},set width(a){this.x=a},get height(){return this.y},set height(a){this.y=a},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);}},clone:function(){return new this.constructor(this.x,this.y)},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},addscalar:function(a){this.x+=a;this.y+=a;return this},addvectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addscaledvector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;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},subscalar:function(a){this.x-=a;this.y-=a;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){isfinite(a)?(this.x*=a,this.y*=a):this.y=this.x=0;return this},divide:function(a){this.x/=a.x; this.y/=a.y;return this},dividescalar:function(a){return this.multiplyscalar(1/a)},min:function(a){this.x=math.min(this.x,a.x);this.y=math.min(this.y,a.y);return this},max:function(a){this.x=math.max(this.x,a.x);this.y=math.max(this.y,a.y);return this},clamp:function(a,b){this.x=math.max(a.x,math.min(b.x,this.x));this.y=math.max(a.y,math.min(b.y,this.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)}}(),clamplength:function(a,b){var c=this.length();this.multiplyscalar(math.max(a,math.min(b,c))/c);return this},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)},lengthmanhattan:function(){return math.abs(this.x)+math.abs(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){return this.multiplyscalar(a/ this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpvectors:function(a,b,c){this.subvectors(b,a).multiplyscalar(c).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromarray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toarray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromattribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemsize+c;this.x=a.array[b];this.y= a.array[b+1];return this},rotatearound:function(a,b){var c=math.cos(b),d=math.sin(b),e=this.x-a.x,g=this.y-a.y;this.x=e*c-g*d+a.x;this.y=e*d+g*c+a.y;return this}};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);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},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},addscaledvector:function(a, b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;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},subscalar:function(a){this.x-=a;this.y-=a;this.z-=a;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){isfinite(a)?(this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},multiplyvectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyeuler:function(){var a;return function(b){!1===b instanceof three.euler&&console.error("three.vector3: .applyeuler() now expects a euler rotation rather than a vector3 and order.");void 0===a&&(a=new three.quaternion);this.applyquaternion(a.setfromeuler(b)); return this}}(),applyaxisangle:function(){var a;return function(b,c){void 0===a&&(a=new three.quaternion);this.applyquaternion(a.setfromaxisangle(b,c));return this}}(),applymatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applymatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14]; return this},applyprojection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyquaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,g=a.y,f=a.z;a=a.w;var h=a*b+g*d-f*c,l=a*c+f*b-e*d,k=a*d+e*c-g*b,b=-e*b-g*c-f*d;this.x=h*a+b*-e+l*-f-k*-g;this.y=l*a+b*-g+k*-e-h*-f;this.z=k*a+b*-f+h*-g-l*-e;return this},project:function(){var a; return function(b){void 0===a&&(a=new three.matrix4);a.multiplymatrices(b.projectionmatrix,a.getinverse(b.matrixworld));return this.applyprojection(a)}}(),unproject:function(){var a;return function(b){void 0===a&&(a=new three.matrix4);a.multiplymatrices(b.matrixworld,a.getinverse(b.projectionmatrix));return this.applyprojection(a)}}(),transformdirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;this.normalize(); return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},dividescalar:function(a){return this.multiplyscalar(1/a)},min:function(a){this.x=math.min(this.x,a.x);this.y=math.min(this.y,a.y);this.z=math.min(this.z,a.z);return this},max:function(a){this.x=math.max(this.x,a.x);this.y=math.max(this.y,a.y);this.z=math.max(this.z,a.z);return this},clamp:function(a,b){this.x=math.max(a.x,math.min(b.x,this.x));this.y=math.max(a.y,math.min(b.y,this.y));this.z=math.max(a.z,math.min(b.z, this.z));return this},clampscalar:function(){var a,b;return function(c,d){void 0===a&&(a=new three.vector3,b=new three.vector3);a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),clamplength:function(a,b){var c=this.length();this.multiplyscalar(math.max(a,math.min(b,c))/c);return this},floor:function(){this.x=math.floor(this.x);this.y=math.floor(this.y);this.z=math.floor(this.z);return this},ceil:function(){this.x=math.ceil(this.x);this.y=math.ceil(this.y);this.z=math.ceil(this.z);return this}, round:function(){this.x=math.round(this.x);this.y=math.round(this.y);this.z=math.round(this.z);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);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthsq:function(){return this.x*this.x+this.y*this.y+this.z*this.z}, length:function(){return math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthmanhattan:function(){return math.abs(this.x)+math.abs(this.y)+math.abs(this.z)},normalize:function(){return this.dividescalar(this.length())},setlength:function(a){return this.multiplyscalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpvectors:function(a,b,c){this.subvectors(b,a).multiplyscalar(c).add(a);return this},cross:function(a,b){if(void 0!== b)return console.warn("three.vector3: .cross() now only accepts one argument. use .crossvectors( a, b ) instead."),this.crossvectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossvectors:function(a,b){var c=a.x,d=a.y,e=a.z,g=b.x,f=b.y,h=b.z;this.x=d*h-e*f;this.y=e*g-c*h;this.z=c*f-d*g;return this},projectonvector:function(){var a,b;return function(c){void 0===a&&(a=new three.vector3);a.copy(c).normalize();b=this.dot(a);return this.copy(a).multiplyscalar(b)}}(), projectonplane:function(){var a;return function(b){void 0===a&&(a=new three.vector3);a.copy(this).projectonvector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0===a&&(a=new three.vector3);return this.sub(a.copy(b).multiplyscalar(2*this.dot(b)))}}(),angleto:function(a){a=this.dot(a)/(this.length()*a.length());return math.acos(three.math.clamp(a,-1,1))},distanceto:function(a){return math.sqrt(this.distancetosquared(a))},distancetosquared:function(a){var b=this.x-a.x,c= this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},seteulerfromrotationmatrix:function(a,b){console.error("three.vector3: .seteulerfromrotationmatrix() has been removed. use euler.setfromrotationmatrix() instead.")},seteulerfromquaternion:function(a,b){console.error("three.vector3: .seteulerfromquaternion() has been removed. use euler.setfromquaternion() instead.")},getpositionfrommatrix:function(a){console.warn("three.vector3: .getpositionfrommatrix() has been renamed to .setfrommatrixposition().");return this.setfrommatrixposition(a)}, getscalefrommatrix:function(a){console.warn("three.vector3: .getscalefrommatrix() has been renamed to .setfrommatrixscale().");return this.setfrommatrixscale(a)},getcolumnfrommatrix:function(a,b){console.warn("three.vector3: .getcolumnfrommatrix() has been renamed to .setfrommatrixcolumn().");return this.setfrommatrixcolumn(a,b)},setfrommatrixposition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setfrommatrixscale:function(a){var b=this.set(a.elements[0], a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length();a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},setfrommatrixcolumn:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromarray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toarray:function(a,b){void 0=== a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromattribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemsize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];return this}};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);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},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},addscaledvector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;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},subscalar:function(a){this.x-= a;this.y-=a;this.z-=a;this.w-=a;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){isfinite(a)?(this.x*=a,this.y*=a,this.z*=a,this.w*=a):this.w=this.z=this.y=this.x=0;return this},applymatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this}, dividescalar:function(a){return this.multiplyscalar(1/a)},setaxisanglefromquaternion:function(a){this.w=2*math.acos(a.w);var b=math.sqrt(1-a.w*a.w);1e-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setaxisanglefromrotationmatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var g=a[8],f=a[1],h=a[5],l=a[9];c=a[2];b=a[6];var k=a[10];if(.01>math.abs(d-f)&&.01>math.abs(g-c)&&.01>math.abs(l-b)){if(.1>math.abs(d+f)&&.1>math.abs(g+c)&&.1>math.abs(l+b)&&.1>math.abs(e+ h+k-3))return this.set(1,0,0,0),this;a=math.pi;e=(e+1)/2;h=(h+1)/2;k=(k+1)/2;d=(d+f)/4;g=(g+c)/4;l=(l+b)/4;e>h&&e>k?.01>e?(b=0,d=c=.707106781):(b=math.sqrt(e),c=d/b,d=g/b):h>k?.01>h?(b=.707106781,c=0,d=.707106781):(c=math.sqrt(h),b=d/c,d=l/c):.01>k?(c=b=.707106781,d=0):(d=math.sqrt(k),b=g/d,c=l/d);this.set(b,c,d,a);return this}a=math.sqrt((b-l)*(b-l)+(g-c)*(g-c)+(f-d)*(f-d));.001>math.abs(a)&&(a=1);this.x=(b-l)/a;this.y=(g-c)/a;this.z=(f-d)/a;this.w=math.acos((e+h+k-1)/2);return this},min:function(a){this.x= math.min(this.x,a.x);this.y=math.min(this.y,a.y);this.z=math.min(this.z,a.z);this.w=math.min(this.w,a.w);return this},max:function(a){this.x=math.max(this.x,a.x);this.y=math.max(this.y,a.y);this.z=math.max(this.z,a.z);this.w=math.max(this.w,a.w);return this},clamp:function(a,b){this.x=math.max(a.x,math.min(b.x,this.x));this.y=math.max(a.y,math.min(b.y,this.y));this.z=math.max(a.z,math.min(b.z,this.z));this.w=math.max(a.w,math.min(b.w,this.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){return this.multiplyscalar(a/this.length())},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},lerpvectors:function(a,b,c){this.subvectors(b,a).multiplyscalar(c).add(a);return this},equals:function(a){return a.x=== this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromarray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toarray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromattribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemsize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w=a.array[b+3];return this}}; 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,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},clone:function(){return new this.constructor(this._x, this._y,this._z,this._order)},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,c){var d=three.math.clamp,e=a.elements;a=e[0];var g=e[4],f=e[8],h=e[1],l=e[5],k=e[9],m=e[2],p=e[6],e=e[10];b=b||this._order;"xyz"===b?(this._y=math.asin(d(f,-1,1)),.99999>math.abs(f)?(this._x=math.atan2(-k,e),this._z=math.atan2(-g,a)):(this._x=math.atan2(p,l),this._z=0)):"yxz"===b?(this._x=math.asin(-d(k,-1,1)),.99999>math.abs(k)? (this._y=math.atan2(f,e),this._z=math.atan2(h,l)):(this._y=math.atan2(-m,a),this._z=0)):"zxy"===b?(this._x=math.asin(d(p,-1,1)),.99999>math.abs(p)?(this._y=math.atan2(-m,e),this._z=math.atan2(-g,l)):(this._y=0,this._z=math.atan2(h,a))):"zyx"===b?(this._y=math.asin(-d(m,-1,1)),.99999>math.abs(m)?(this._x=math.atan2(p,e),this._z=math.atan2(h,a)):(this._x=0,this._z=math.atan2(-g,l))):"yzx"===b?(this._z=math.asin(d(h,-1,1)),.99999>math.abs(h)?(this._x=math.atan2(-k,l),this._y=math.atan2(-m,a)):(this._x= 0,this._y=math.atan2(f,e))):"xzy"===b?(this._z=math.asin(-d(g,-1,1)),.99999>math.abs(g)?(this._x=math.atan2(p,l),this._y=math.atan2(f,a)):(this._x=math.atan2(-k,e),this._y=0)):console.warn("three.euler: .setfromrotationmatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onchangecallback();return this},setfromquaternion:function(){var a;return function(b,c,d){void 0===a&&(a=new three.matrix4);a.makerotationfromquaternion(b);this.setfromrotationmatrix(a,c,d);return this}}(),setfromvector3:function(a, b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new three.quaternion;return function(b){a.setfromeuler(this);this.setfromquaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromarray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onchangecallback();return this},toarray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+ 3]=this._order;return a},tovector3:function(a){return a?a.set(this._x,this._y,this._z):new three.vector3(this._x,this._y,this._z)},onchange:function(a){this.onchangecallback=a;return this},onchangecallback:function(){}};three.line3=function(a,b){this.start=void 0!==a?a:new three.vector3;this.end=void 0!==b?b:new three.vector3}; three.line3.prototype={constructor:three.line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new three.vector3).addvectors(this.start,this.end).multiplyscalar(.5)},delta:function(a){return(a||new three.vector3).subvectors(this.end,this.start)},distancesq:function(){return this.start.distancetosquared(this.end)},distance:function(){return this.start.distanceto(this.end)}, at:function(a,b){var c=b||new three.vector3;return this.delta(c).multiplyscalar(a).add(this.start)},closestpointtopointparameter:function(){var a=new three.vector3,b=new three.vector3;return function(c,d){a.subvectors(c,this.start);b.subvectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=three.math.clamp(e,0,1));return e}}(),closestpointtopoint:function(a,b,c){a=this.closestpointtopointparameter(a,b);c=c||new three.vector3;return this.delta(c).multiplyscalar(a).add(this.start)},applymatrix4:function(a){this.start.applymatrix4(a); this.end.applymatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}};three.box2=function(a,b){this.min=void 0!==a?a:new three.vector2(infinity,infinity);this.max=void 0!==b?b:new three.vector2(-infinity,-infinity)}; three.box2.prototype={constructor:three.box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setfrompoints:function(a){this.makeempty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y?!1:!0},containsbox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getparameter:function(a,b){return(b||new three.vector2).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isintersectionbox:function(a){return a.max.xthis.max.x||a.max.y this.max.y?!1:!0},clamppoint:function(a,b){return(b||new three.vector2).copy(a).clamp(this.min,this.max)},distancetopoint:function(){var a=new three.vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& a.max.equals(this.max)}};three.box3=function(a,b){this.min=void 0!==a?a:new three.vector3(infinity,infinity,infinity);this.max=void 0!==b?b:new three.vector3(-infinity,-infinity,-infinity)}; three.box3.prototype={constructor:three.box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setfrompoints:function(a){this.makeempty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsbox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getparameter:function(a,b){return(b||new three.vector3).set((a.x-this.min.x)/(this.max.x- this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isintersectionbox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},clamppoint:function(a,b){return(b||new three.vector3).copy(a).clamp(this.min,this.max)},distancetopoint:function(){var a=new three.vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getboundingsphere:function(){var a= new three.vector3;return function(b){b=b||new three.sphere;b.center=this.center();b.radius=.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applymatrix4:function(){var a=[new three.vector3,new three.vector3,new three.vector3,new three.vector3,new three.vector3,new three.vector3,new three.vector3,new three.vector3];return function(b){a[0].set(this.min.x,this.min.y, this.min.z).applymatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applymatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applymatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applymatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applymatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applymatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applymatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applymatrix4(b);this.makeempty();this.setfrompoints(a);return this}}(),translate:function(a){this.min.add(a); this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};three.matrix3=function(){this.elements=new float32array([1,0,0,0,1,0,0,0,1]);0this.determinant()&&(f=-f);c.x=g[12];c.y=g[13];c.z=g[14];b.elements.set(this.elements);c=1/f;var g=1/h,k=1/l;b.elements[0]*=c;b.elements[1]*= c;b.elements[2]*=c;b.elements[4]*=g;b.elements[5]*=g;b.elements[6]*=g;b.elements[8]*=k;b.elements[9]*=k;b.elements[10]*=k;d.setfromrotationmatrix(b);e.x=f;e.y=h;e.z=l;return this}}(),makefrustum:function(a,b,c,d,e,g){var f=this.elements;f[0]=2*e/(b-a);f[4]=0;f[8]=(b+a)/(b-a);f[12]=0;f[1]=0;f[5]=2*e/(d-c);f[9]=(d+c)/(d-c);f[13]=0;f[2]=0;f[6]=0;f[10]=-(g+e)/(g-e);f[14]=-2*g*e/(g-e);f[3]=0;f[7]=0;f[11]=-1;f[15]=0;return this},makeperspective:function(a,b,c,d){a=c*math.tan(three.math.degtorad(.5*a)); var e=-a;return this.makefrustum(e*b,a*b,e,a,c,d)},makeorthographic:function(a,b,c,d,e,g){var f=this.elements,h=b-a,l=c-d,k=g-e;f[0]=2/h;f[4]=0;f[8]=0;f[12]=-((b+a)/h);f[1]=0;f[5]=2/l;f[9]=0;f[13]=-((c+d)/l);f[2]=0;f[6]=0;f[10]=-2/k;f[14]=-((g+e)/k);f[3]=0;f[7]=0;f[11]=0;f[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},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],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]}};three.ray=function(a,b){this.origin=void 0!==a?a:new three.vector3;this.direction=void 0!==b?b:new three.vector3}; three.ray.prototype={constructor:three.ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new three.vector3).copy(this.direction).multiplyscalar(a).add(this.origin)},recast:function(){var a=new three.vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestpointtopoint:function(a, b){var c=b||new three.vector3;c.subvectors(a,this.origin);var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyscalar(d).add(this.origin)},distancetopoint:function(a){return math.sqrt(this.distancesqtopoint(a))},distancesqtopoint: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.distancetosquared(b);a.copy(this.direction).multiplyscalar(c).add(this.origin);return a.distancetosquared(b)}}(), distancesqtosegment:function(){var a=new three.vector3,b=new three.vector3,c=new three.vector3;return function(d,e,g,f){a.copy(d).add(e).multiplyscalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceto(e),l=-this.direction.dot(b),k=c.dot(this.direction),m=-c.dot(b),p=c.lengthsq(),n=math.abs(1-l*l),q;0=-q?e<=q?(h=1/n,d*=h,e*=h,l=d*(d+l*e+2*k)+e*(l*d+e+2*m)+p):(e=h,d=math.max(0,-(l*e+k)),l=-d*d+e*(e+2*m)+p):(e=-h,d=math.max(0,-(l*e+k)), l=-d*d+e*(e+2*m)+p):e<=-q?(d=math.max(0,-(-l*h+k)),e=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!==c)c=e;if(fd?null:this.at(0<=c?c:d,b)},intersecttriangle:function(){var a=new three.vector3,b=new three.vector3,c=new three.vector3,d=new three.vector3;return function(e,g,f,h,l){b.subvectors(g,e);c.subvectors(f,e);d.crossvectors(b,c);g=this.direction.dot(d);if(0g)h=-1, g=-g;else return null;a.subvectors(this.origin,e);e=h*this.direction.dot(c.crossvectors(a,c));if(0>e)return null;f=h*this.direction.dot(b.cross(a));if(0>f||e+f>g)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/g,l)}}(),applymatrix4:function(a){this.direction.add(this.origin).applymatrix4(a);this.origin.applymatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}}; three.sphere=function(a,b){this.center=void 0!==a?a:new three.vector3;this.radius=void 0!==b?b:0}; three.sphere.prototype={constructor:three.sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setfrompoints:function(){var a=new three.box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setfrompoints(b).center(d);for(var e=0,g=0,f=b.length;g=this.radius},containspoint:function(a){return a.distancetosquared(this.center)<=this.radius*this.radius},distancetopoint:function(a){return a.distanceto(this.center)-this.radius},intersectssphere:function(a){var b=this.radius+a.radius;return a.center.distancetosquared(this.center)<=b*b},clamppoint:function(a,b){var c=this.center.distancetosquared(a),d=b||new three.vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyscalar(this.radius).add(this.center)); return d},getboundingbox:function(a){a=a||new three.box3;a.set(this.center,this.center);a.expandbyscalar(this.radius);return a},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}}; 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},clone:function(){return(new this.constructor).copy(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],l=c[6],k=c[7],m=c[8],p=c[9],n=c[10],q=c[11],s=c[12],t=c[13],v=c[14], c=c[15];b[0].setcomponents(g-a,k-f,q-m,c-s).normalize();b[1].setcomponents(g+a,k+f,q+m,c+s).normalize();b[2].setcomponents(g+d,k+h,q+p,c+t).normalize();b[3].setcomponents(g-d,k-h,q-p,c-t).normalize();b[4].setcomponents(g-e,k-l,q-n,c-v).normalize();b[5].setcomponents(g+e,k+l,q+n,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}};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, c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyscalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distancetopoint:function(a){return this.normal.dot(a)+this.constant},distancetosphere:function(a){return this.distancetopoint(a.center)-a.radius},projectpoint:function(a, b){return this.orthopoint(a,b).sub(a).negate()},orthopoint:function(a,b){var c=this.distancetopoint(a);return(b||new three.vector3).copy(this.normal).multiplyscalar(c)},isintersectionline:function(a){var b=this.distancetopoint(a.start);a=this.distancetopoint(a.end);return 0>b&&0a&&0g||1e;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 math.max(b,math.min(c,a))},euclideanmodulo:function(a,b){return(a%b+b)%b},maplinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a, b,c){if(a<=b)return 0;if(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},nearestpoweroftwo:function(a){return math.pow(2,math.round(math.log(a)/math.ln2))},nextpoweroftwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return 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,l,k,m,p,n;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;k=this.points[c[0]];m=this.points[c[1]];p=this.points[c[2]];n=this.points[c[3]];h=f*f;l=f*h;d.x=b(k.x,m.x,p.x,n.x,f,h,l);d.y=b(k.y,m.y,p.y,n.y,f,h,l);d.z=b(k.z,m.z,p.z,n.z,f,h,l);return d};this.getcontrolpointsarray=function(){var a,b,c=this.points.length,d=[];for(a=0;a=b.x+b.y}}(); three.triangle.prototype={constructor:three.triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setfrompointsandindices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new three.vector3,b=new three.vector3;return function(){a.subvectors(this.c,this.b);b.subvectors(this.a, this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new three.vector3).addvectors(this.a,this.b).add(this.c).multiplyscalar(1/3)},normal:function(a){return three.triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new three.plane).setfromcoplanarpoints(this.a,this.b,this.c)},barycoordfrompoint:function(a,b){return three.triangle.barycoordfrompoint(a,this.a,this.b,this.c,b)},containspoint:function(a){return three.triangle.containspoint(a,this.a,this.b,this.c)}, equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}};three.channels=function(){this.mask=1};three.channels.prototype={constructor:three.channels,set:function(a){this.mask=1<d;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;cthis.duration)for(a=0;a=e.referencecount&&(e.unbind(),delete this.propertybindingmap[d])}return this},findactionbyname:function(a){for(var b=0;b=c.weight)&&c.enabled)for(var g=0;gc?a:b},lerp_boolean_immediate:function(a,b,c){return a},lerp_string:function(a,b,c){return.5>c?a:b},lerp_string_immediate:function(a,b,c){return a},getlerpfunc:function(a,b){if(void 0===a||null===a)throw error("examplarvalue is null");switch(typeof a){case "object":if(a.lerp)return three.animationutils.lerp_object;if(a.slerp)return three.animationutils.slerp_object;break;case "number":return three.animationutils.lerp_number;case "boolean":return b?three.animationutils.lerp_boolean:three.animationutils.lerp_boolean_immediate; case "string":return b?three.animationutils.lerp_string:three.animationutils.lerp_string_immediate}}};three.keyframetrack=function(a,b){if(void 0===a)throw error("track name is undefined");if(void 0===b||0===b.length)throw error("no keys in track named "+a);this.name=a;this.keys=b;this.lastindex=0;this.validate();this.optimize()}; three.keyframetrack.prototype={constructor:three.keyframetrack,getat:function(a){for(;this.lastindex=this.keys[this.lastindex].time;)this.lastindex++;for(;0=this.keys.length)return this.setresult(this.keys[this.keys.length-1].value),this.result;if(0===this.lastindex)return this.setresult(this.keys[0].value),this.result;var b=this.keys[this.lastindex-1];this.setresult(b.value);if(b.constanttonext)return this.result; var c=this.keys[this.lastindex];return this.result=this.lerpvalues(this.result,c.value,(a-b.time)/(c.time-b.time))},shift:function(a){if(0!==a)for(var b=0;b=b)e++;else break;0c.time){console.error(" key.time is less than previous key time, out of order keys", this,b,c,a);return}a=c}return this}},optimize:function(){var a=[],b=this.keys[0];a.push(b);three.animationutils.getequalsfunc(b.value);for(var c=1;cthis.cumulativeweight){var a= 1-this.cumulativeweight;this.cumulativevalue=this.lerpvalue(this.cumulativevalue,this.originalvalue,a/(this.cumulativeweight+a))}this.setvalue(this.cumulativevalue)&&this.triggerdirty&&this.triggerdirty();this.cumulativevalue=null;this.cumulativeweight=0}}}; three.propertybinding.parsetrackname=function(a){var b=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,c=b.exec(a);if(!c)throw error("cannot parse trackname at all: "+a);c.index===b.lastindex&&b.lastindex++;b={directoryname:c[1],nodename:c[3],objectname:c[5],objectindex:c[7],propertyname:c[9],propertyindex:c[11]};if(null===b.propertyname||0===b.propertyname.length)throw error("can not parse propertyname from trackname: "+a);return b}; three.propertybinding.findnode=function(a,b){function c(a){for(var c=0;cc?a:b};three.stringkeyframetrack.prototype.comparevalues=function(a,b){return a===b};three.stringkeyframetrack.prototype.clone=function(){for(var a=[],b=0;bc?a:b};three.booleankeyframetrack.prototype.comparevalues=function(a,b){return a===b};three.booleankeyframetrack.prototype.clone=function(){for(var a=[],b=0;bl.opacity&&(l.transparent=!0);c.settextures(h);return c.parse(l)}}()};three.loader.handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;cf;f++)n=w[l++],u=v[2*n],n=v[2*n+1],u=new three.vector2(u,n),2!==f&&c.facevertexuvs[d][h].push(u),0!==f&&c.facevertexuvs[d][h+1].push(u);p&&(p=3*w[l++],q.normal.set(d[p++],d[p++],d[p]),t.normal.copy(q.normal));if(s)for(d=0;4>d;d++)p=3*w[l++],s=new three.vector3(d[p++],d[p++],d[p]),2!==d&&q.vertexnormals.push(s),0!==d&&t.vertexnormals.push(s); m&&(m=w[l++],m=x[m],q.color.sethex(m),t.color.sethex(m));if(b)for(d=0;4>d;d++)m=w[l++],m=x[m],2!==d&&q.vertexcolors.push(new three.color(m)),0!==d&&t.vertexcolors.push(new three.color(m));c.faces.push(q);c.faces.push(t)}else{q=new three.face3;q.a=w[l++];q.b=w[l++];q.c=w[l++];h&&(h=w[l++],q.materialindex=h);h=c.faces.length;if(d)for(d=0;df;f++)n=w[l++],u=v[2*n],n=v[2*n+1],u=new three.vector2(u,n),c.facevertexuvs[d][h].push(u);p&&(p=3*w[l++],q.normal.set(d[p++], d[p++],d[p]));if(s)for(d=0;3>d;d++)p=3*w[l++],s=new three.vector3(d[p++],d[p++],d[p]),q.vertexnormals.push(s);m&&(m=w[l++],q.color.sethex(x[m]));if(b)for(d=0;3>d;d++)m=w[l++],q.vertexcolors.push(new three.color(x[m]));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;dthis.opacity&&(b.opacity=this.opacity);!0===this.transparent&&(b.transparent=this.transparent);0a.x||1a.x?0:1;break;case three.mirroredrepeatwrapping:1===math.abs(math.floor(a.x)%2)?a.x=math.ceil(a.x)-a.x:a.x-=math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case three.mirroredrepeatwrapping:1===math.abs(math.floor(a.y)% 2)?a.y=math.ceil(a.y)-a.y:a.y-=math.floor(a.y)}this.flipy&&(a.y=1-a.y)}}};three.eventdispatcher.prototype.apply(three.texture.prototype);three.textureidcount=0;three.canvastexture=function(a,b,c,d,e,g,f,h,l){three.texture.call(this,a,b,c,d,e,g,f,h,l);this.needsupdate=!0};three.canvastexture.prototype=object.create(three.texture.prototype);three.canvastexture.prototype.constructor=three.canvastexture; three.cubetexture=function(a,b,c,d,e,g,f,h,l){b=void 0!==b?b:three.cubereflectionmapping;three.texture.call(this,a,b,c,d,e,g,f,h,l);this.images=a;this.flipy=!1};three.cubetexture.prototype=object.create(three.texture.prototype);three.cubetexture.prototype.constructor=three.cubetexture;three.cubetexture.prototype.copy=function(a){three.texture.prototype.copy.call(this,a);this.images=a.images;return this}; three.compressedtexture=function(a,b,c,d,e,g,f,h,l,k,m){three.texture.call(this,null,g,f,h,l,k,d,e,m);this.image={width:b,height:c};this.mipmaps=a;this.generatemipmaps=this.flipy=!1};three.compressedtexture.prototype=object.create(three.texture.prototype);three.compressedtexture.prototype.constructor=three.compressedtexture; three.datatexture=function(a,b,c,d,e,g,f,h,l,k,m){three.texture.call(this,null,g,f,h,l,k,d,e,m);this.image={data:a,width:b,height:c};this.magfilter=void 0!==l?l:three.nearestfilter;this.minfilter=void 0!==k?k:three.nearestfilter;this.generatemipmaps=this.flipy=!1};three.datatexture.prototype=object.create(three.texture.prototype);three.datatexture.prototype.constructor=three.datatexture; three.videotexture=function(a,b,c,d,e,g,f,h,l){function k(){requestanimationframe(k);a.readystate===a.have_enough_data&&(m.needsupdate=!0)}three.texture.call(this,a,b,c,d,e,g,f,h,l);this.generatemipmaps=!1;var m=this;k()};three.videotexture.prototype=object.create(three.texture.prototype);three.videotexture.prototype.constructor=three.videotexture;three.group=function(){three.object3d.call(this);this.type="group"};three.group.prototype=object.create(three.object3d.prototype); three.group.prototype.constructor=three.group;three.points=function(a,b){three.object3d.call(this);this.type="points";this.geometry=void 0!==a?a:new three.geometry;this.material=void 0!==b?b:new three.pointsmaterial({color:16777215*math.random()})};three.points.prototype=object.create(three.object3d.prototype);three.points.prototype.constructor=three.points; three.points.prototype.raycast=function(){var a=new three.matrix4,b=new three.ray;return function(c,d){function e(a,e){var f=b.distancesqtopoint(a);if(fc.far||d.push({distance:k,distancetoray:math.sqrt(f),point:h.clone(),index:e,face:null,object:g})}}var g=this,f=g.geometry,h=c.params.points.threshold;a.getinverse(this.matrixworld);b.copy(c.ray).applymatrix4(a);if(null===f.boundingbox||!1!== b.isintersectionbox(f.boundingbox)){var h=h/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,h=new three.vector3;if(f instanceof three.buffergeometry){var k=f.index,f=f.attributes.position.array;if(null!==k)for(var m=k.array,k=0,p=m.length;kg||(m.applymatrix4(this.matrixworld),t=d.ray.origin.distanceto(m),td.far||e.push({distance:t,point:k.clone().applymatrix4(this.matrixworld),index:n,face:null,faceindex:null,object:this}))}else for(q=q.position.array,n=0,s=q.length/3-1;ng||(m.applymatrix4(this.matrixworld),t=d.ray.origin.distanceto(m),td.far||e.push({distance:t,point:k.clone().applymatrix4(this.matrixworld),index:n,face:null,faceindex:null,object:this}))}else if(f instanceof three.geometry)for(h=f.vertices,l=h.length,n=0;ng||(m.applymatrix4(this.matrixworld),t=d.ray.origin.distanceto(m),td.far||e.push({distance:t,point:k.clone().applymatrix4(this.matrixworld), index:n,face:null,faceindex:null,object:this}))}}}();three.line.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};three.linestrip=0;three.linepieces=1;three.linesegments=function(a,b){three.line.call(this,a,b);this.type="linesegments"};three.linesegments.prototype=object.create(three.line.prototype);three.linesegments.prototype.constructor=three.linesegments; 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.constructor=three.mesh; three.mesh.prototype.updatemorphtargets=function(){if(void 0!==this.geometry.morphtargets&&0b.far?null:{distance:c,point:u.clone(), object:a}}function c(c,d,e,g,k,m,p,u){f.fromarray(g,3*m);h.fromarray(g,3*p);l.fromarray(g,3*u);if(c=b(c,d,e,f,h,l,v))k&&(n.fromarray(k,2*m),q.fromarray(k,2*p),s.fromarray(k,2*u),c.uv=a(v,f,h,l,n,q,s)),c.face=new three.face3(m,p,u,three.triangle.normal(f,h,l)),c.faceindex=m;return c}var d=new three.matrix4,e=new three.ray,g=new three.sphere,f=new three.vector3,h=new three.vector3,l=new three.vector3,k=new three.vector3,m=new three.vector3,p=new three.vector3,n=new three.vector2,q=new three.vector2, s=new three.vector2,t=new three.vector3,v=new three.vector3,u=new three.vector3;return function(u,t){var x=this.geometry,b=this.material;if(void 0!==b){null===x.boundingsphere&&x.computeboundingsphere();var y=this.matrixworld;g.copy(x.boundingsphere);g.applymatrix4(y);if(!1!==u.ray.isintersectionsphere(g)&&(d.getinverse(y),e.copy(u.ray).applymatrix4(d),null===x.boundingbox||!1!==e.isintersectionbox(x.boundingbox))){var z,a;if(x instanceof three.buffergeometry){var j,f,b=x.index,y=x.attributes,x=y.position.array; void 0!==y.uv&&(z=y.uv.array);if(null!==b)for(var y=b.array,c=0,n=y.length;c=d[e].distance)d[e-1].object.visible=!1,d[e].object.visible=!0;else break;for(;ethis.scale.x*this.scale.y||c.push({distance:math.sqrt(d),point:this.position,face:null,object:this})}}();three.sprite.prototype.clone=function(){return(new this.constructor(this.material)).copy(this)};three.particle=three.sprite; 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.constructor=three.lensflare; 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:0,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;a dashsize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoinglight = vec3( 0.0 );\n\tvec4 diffusecolor = vec4( diffuse, opacity );", three.shaderchunk.logdepthbuf_fragment,three.shaderchunk.color_fragment,"\toutgoinglight = diffusecolor.rgb;",three.shaderchunk.fog_fragment,"\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n}"].join("\n")},depth:{uniforms:{mnear:{type:"f",value:1},mfar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexshader:[three.shaderchunk.common,three.shaderchunk.morphtarget_pars_vertex,three.shaderchunk.logdepthbuf_pars_vertex,"void main() {",three.shaderchunk.begin_vertex,three.shaderchunk.morphtarget_vertex, three.shaderchunk.project_vertex,three.shaderchunk.logdepthbuf_vertex,"}"].join("\n"),fragmentshader:["uniform float mnear;\nuniform float mfar;\nuniform float opacity;",three.shaderchunk.common,three.shaderchunk.logdepthbuf_pars_fragment,"void main() {",three.shaderchunk.logdepthbuf_fragment,"\t#ifdef use_logdepthbuf_ext\n\t\tfloat depth = gl_fragdepthext / gl_fragcoord.w;\n\t#else\n\t\tfloat depth = gl_fragcoord.z / gl_fragcoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mnear, mfar, depth );\n\tgl_fragcolor = vec4( vec3( color ), opacity );\n}"].join("\n")}, normal:{uniforms:{opacity:{type:"f",value:1}},vertexshader:["varying vec3 vnormal;",three.shaderchunk.common,three.shaderchunk.morphtarget_pars_vertex,three.shaderchunk.logdepthbuf_pars_vertex,"void main() {\n\tvnormal = normalize( normalmatrix * normal );",three.shaderchunk.begin_vertex,three.shaderchunk.morphtarget_vertex,three.shaderchunk.project_vertex,three.shaderchunk.logdepthbuf_vertex,"}"].join("\n"),fragmentshader:["uniform float opacity;\nvarying vec3 vnormal;",three.shaderchunk.common, three.shaderchunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_fragcolor = vec4( 0.5 * normalize( vnormal ) + 0.5, opacity );",three.shaderchunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tcube:{type:"t",value:null},tflip:{type:"f",value:-1}},vertexshader:["varying vec3 vworldposition;",three.shaderchunk.common,three.shaderchunk.logdepthbuf_pars_vertex,"void main() {\n\tvworldposition = transformdirection( position, modelmatrix );\n\tgl_position = projectionmatrix * modelviewmatrix * vec4( position, 1.0 );", three.shaderchunk.logdepthbuf_vertex,"}"].join("\n"),fragmentshader:["uniform samplercube tcube;\nuniform float tflip;\nvarying vec3 vworldposition;",three.shaderchunk.common,three.shaderchunk.logdepthbuf_pars_fragment,"void main() {\n\tgl_fragcolor = texturecube( tcube, vec3( tflip * vworldposition.x, vworldposition.yz ) );",three.shaderchunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tequirect:{type:"t",value:null},tflip:{type:"f",value:-1}},vertexshader:["varying vec3 vworldposition;", three.shaderchunk.common,three.shaderchunk.logdepthbuf_pars_vertex,"void main() {\n\tvworldposition = transformdirection( position, modelmatrix );\n\tgl_position = projectionmatrix * modelviewmatrix * vec4( position, 1.0 );",three.shaderchunk.logdepthbuf_vertex,"}"].join("\n"),fragmentshader:["uniform sampler2d tequirect;\nuniform float tflip;\nvarying vec3 vworldposition;",three.shaderchunk.common,three.shaderchunk.logdepthbuf_pars_fragment,"void main() {\nvec3 direction = normalize( vworldposition );\nvec2 sampleuv;\nsampleuv.y = saturate( tflip * direction.y * -0.5 + 0.5 );\nsampleuv.x = atan( direction.z, direction.x ) * reciprocal_pi2 + 0.5;\ngl_fragcolor = texture2d( tequirect, sampleuv );", three.shaderchunk.logdepthbuf_fragment,"}"].join("\n")},depthrgba:{uniforms:{},vertexshader:[three.shaderchunk.common,three.shaderchunk.morphtarget_pars_vertex,three.shaderchunk.skinning_pars_vertex,three.shaderchunk.logdepthbuf_pars_vertex,"void main() {",three.shaderchunk.skinbase_vertex,three.shaderchunk.begin_vertex,three.shaderchunk.morphtarget_vertex,three.shaderchunk.skinning_vertex,three.shaderchunk.project_vertex,three.shaderchunk.logdepthbuf_vertex,"}"].join("\n"),fragmentshader:[three.shaderchunk.common, three.shaderchunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",three.shaderchunk.logdepthbuf_fragment,"\t#ifdef use_logdepthbuf_ext\n\t\tgl_fragdata[ 0 ] = pack_depth( gl_fragdepthext );\n\t#else\n\t\tgl_fragdata[ 0 ] = pack_depth( gl_fragcoord.z );\n\t#endif\n}"].join("\n")}, distancergba:{uniforms:{lightpos:{type:"v3",value:new three.vector3(0,0,0)}},vertexshader:["varying vec4 vworldposition;",three.shaderchunk.common,three.shaderchunk.morphtarget_pars_vertex,three.shaderchunk.skinning_pars_vertex,"void main() {",three.shaderchunk.skinbase_vertex,three.shaderchunk.begin_vertex,three.shaderchunk.morphtarget_vertex,three.shaderchunk.skinning_vertex,three.shaderchunk.project_vertex,three.shaderchunk.worldpos_vertex,"vworldposition = worldposition;\n}"].join("\n"),fragmentshader:["uniform vec3 lightpos;\nvarying vec4 vworldposition;", three.shaderchunk.common,"vec4 pack1k ( float depth ) {\n depth /= 1000.0;\n const vec4 bitsh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitmsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = fract( depth * bitsh );\n\tres -= res.xxyz * bitmsk;\n\treturn res; \n}\nfloat unpack1k ( vec4 color ) {\n\tconst vec4 bitsh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitsh ) * 1000.0;\n}\nvoid main () {\n\tgl_fragcolor = pack1k( length( vworldposition.xyz - lightpos.xyz ) );\n}"].join("\n")}}; three.webglrenderer=function(a){function b(a,b,c,d){!0===g&&(a*=d,b*=d,c*=d);r.clearcolor(a,b,c,d)}function c(){i.init();r.viewport(na,oa,pa,qa);b(u.r,u.g,u.b,x)}function d(){ra=aa=null;sa="";ta=-1;wa=!0;i.reset()}function e(a){a.preventdefault();d();c();w.clear()}function g(a){a=a.target;a.removeeventlistener("dispose",g);a:{var b=w.get(a);if(a.image&&b.__image__webgltexturecube)r.deletetexture(b.__image__webgltexturecube);else{if(void 0===b.__webglinit)break a;r.deletetexture(b.__webgltexture)}w.delete(a)}la.textures--} function f(a){a=a.target;a.removeeventlistener("dispose",f);var b=w.get(a),c=w.get(a.texture);if(a&&void 0!==c.__webgltexture){r.deletetexture(c.__webgltexture);if(a instanceof three.webglrendertargetcube)for(c=0;6>c;c++)r.deleteframebuffer(b.__webglframebuffer[c]),r.deleterenderbuffer(b.__webglrenderbuffer[c]);else r.deleteframebuffer(b.__webglframebuffer),r.deleterenderbuffer(b.__webglrenderbuffer);w.delete(a.texture);w.delete(a)}la.textures--}function h(a){a=a.target;a.removeeventlistener("dispose", h);l(a);w.delete(a)}function l(a){var b=w.get(a).program;a.program=void 0;void 0!==b&&ua.releaseprogram(b)}function k(a,b){return b[0]-a[0]}function m(a,b){return a.object.renderorder!==b.object.renderorder?a.object.renderorder-b.object.renderorder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return a.object.renderorder!==b.object.renderorder?a.object.renderorder-b.object.renderorder:a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b,c,d,e){var f;c.transparent? (d=z,f=++fa):(d=ca,f=++ga);f=d[f];void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=v.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:v.z,group:e},d.push(f))}function q(a,b){if(!1!==a.visible){if(0!==(a.channels.mask&b.channels.mask))if(a instanceof three.light)da.push(a);else if(a instanceof three.sprite)ea.push(a);else if(a instanceof three.lensflare)ja.push(a);else if(a instanceof three.immediaterenderobject)!0===aa.sortobjects&&(v.setfrommatrixposition(a.matrixworld),v.applyprojection(xa)), n(a,null,a.material,v.z,null);else if(a instanceof three.mesh||a instanceof three.line||a instanceof three.points)if(a instanceof three.skinnedmesh&&a.skeleton.update(),!1===a.frustumculled||!0===ba.intersectsobject(a)){var c=a.material;if(!0===c.visible){!0===aa.sortobjects&&(v.setfrommatrixposition(a.matrixworld),v.applyprojection(xa));var d=va.update(a);if(c instanceof three.meshfacematerial)for(var e=d.groups,f=c.materials,c=0,g=e.length;c=ha.maxtextures&&console.warn("webglrenderer: trying to use "+a+" texture units while this gpu supports only "+ha.maxtextures);ya+=1;return a}function d(a,b,c,d){a[b+0]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function x(a,b,c){c?(r.texparameteri(a,r.texture_wrap_s,n(b.wraps)),r.texparameteri(a,r.texture_wrap_t,n(b.wrapt)),r.texparameteri(a,r.texture_mag_filter, n(b.magfilter)),r.texparameteri(a,r.texture_min_filter,n(b.minfilter))):(r.texparameteri(a,r.texture_wrap_s,r.clamp_to_edge),r.texparameteri(a,r.texture_wrap_t,r.clamp_to_edge),b.wraps===three.clamptoedgewrapping&&b.wrapt===three.clamptoedgewrapping||console.warn("three.webglrenderer: texture is not power of two. texture.wraps and texture.wrapt should be set to three.clamptoedgewrapping.",b),r.texparameteri(a,r.texture_mag_filter,c(b.magfilter)),r.texparameteri(a,r.texture_min_filter,c(b.minfilter)), b.minfilter!==three.nearestfilter&&b.minfilter!==three.linearfilter&&console.warn("three.webglrenderer: texture is not power of two. texture.minfilter should be set to three.nearestfilter or three.linearfilter.",b));!(c=s.get("ext_texture_filter_anisotropic"))||b.type===three.floattype&&null===s.get("oes_texture_float_linear")||b.type===three.halffloattype&&null===s.get("oes_texture_half_float_linear")||!(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.warn("three.webglrenderer: image is too big ("+a.width+"x"+a.height+"). resized to "+d.width+"x"+d.height,a);return d}return a}function y(a){return three.math.ispoweroftwo(a.width)&& three.math.ispoweroftwo(a.height)}function z(a,b){var c=w.get(a);if(6===a.image.length)if(0h;h++)f[h]=!aa.autoscalecubemaps|| d||e?e?a.image[h].image:a.image[h]:b(a.image[h],ha.maxcubemapsize);var k=y(f[0]),l=n(a.format),n=n(a.type);x(r.texture_cube_map,a,k);for(h=0;6>h;h++)if(d)for(var m,q=f[h].mipmaps,p=0,s=q.length;pd;d++)c.__webglframebuffer[d]=r.createframebuffer(),c.__webglrenderbuffer[d]=r.createrenderbuffer(),i.teximage2d(r.texture_cube_map_positive_x+d,0,g,a.width,a.height,0,g,h,null),j(c.__webglframebuffer[d],a,r.texture_cube_map_positive_x+d),f(c.__webglrenderbuffer[d],a);a.texture.generatemipmaps&&e&&r.generatemipmap(r.texture_cube_map)}else c.__webglframebuffer=r.createframebuffer(),c.__webglrenderbuffer=a.sharedepthfrom?a.sharedepthfrom.__webglrenderbuffer: r.createrenderbuffer(),i.bindtexture(r.texture_2d,d.__webgltexture),x(r.texture_2d,a.texture,e),i.teximage2d(r.texture_2d,0,g,a.width,a.height,0,g,h,null),j(c.__webglframebuffer,a,r.texture_2d),a.sharedepthfrom?a.depthbuffer&&!a.stencilbuffer?r.framebufferrenderbuffer(r.framebuffer,r.depth_attachment,r.renderbuffer,c.__webglrenderbuffer):a.depthbuffer&&a.stencilbuffer&&r.framebufferrenderbuffer(r.framebuffer,r.depth_stencil_attachment,r.renderbuffer,c.__webglrenderbuffer):f(c.__webglrenderbuffer, a),a.texture.generatemipmaps&&e&&r.generatemipmap(r.texture_2d);b?i.bindtexture(r.texture_cube_map,null):i.bindtexture(r.texture_2d,null);r.bindrenderbuffer(r.renderbuffer,null);r.bindframebuffer(r.framebuffer,null)}a?(c=w.get(a),d=b?c.__webglframebuffer[a.activecubeface]:c.__webglframebuffer,c=a.width,e=a.height,h=g=0):(d=null,c=pa,e=qa,g=na,h=oa);d!==za&&(r.bindframebuffer(r.framebuffer,d),r.viewport(g,h,c,e),za=d);b&&(d=w.get(a.texture),r.framebuffertexture2d(r.framebuffer,r.color_attachment0, r.texture_cube_map_positive_x+a.activecubeface,d.__webgltexture,0));da=c;ea=e};this.readrendertargetpixels=function(a,b,c,d,e,f){if(!1===a instanceof three.webglrendertarget)console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not three.webglrendertarget.");else{var g=w.get(a).__webglframebuffer;if(g){var h=!1;g!==za&&(r.bindframebuffer(r.framebuffer,g),h=!0);try{var k=a.texture;k.format!==three.rgbaformat&&n(k.format)!==r.getparameter(r.implementation_color_read_format)?console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not in rgba or implementation defined format."): k.type===three.unsignedbytetype||n(k.type)===r.getparameter(r.implementation_color_read_type)||k.type===three.floattype&&s.get("webgl_color_buffer_float")||k.type===three.halffloattype&&s.get("ext_color_buffer_half_float")?r.checkframebufferstatus(r.framebuffer)===r.framebuffer_complete?r.readpixels(b,c,d,e,n(k.format),n(k.type),f):console.error("three.webglrenderer.readrendertargetpixels: readpixels from rendertarget failed. framebuffer not complete."):console.error("three.webglrenderer.readrendertargetpixels: rendertarget is not in unsignedbytetype or implementation defined type.")}finally{h&& r.bindframebuffer(r.framebuffer,za)}}}};this.supportsfloattextures=function(){console.warn("three.webglrenderer: .supportsfloattextures() is now .extensions.get( 'oes_texture_float' ).");return s.get("oes_texture_float")};this.supportshalffloattextures=function(){console.warn("three.webglrenderer: .supportshalffloattextures() is now .extensions.get( 'oes_texture_half_float' ).");return s.get("oes_texture_half_float")};this.supportsstandardderivatives=function(){console.warn("three.webglrenderer: .supportsstandardderivatives() is now .extensions.get( 'oes_standard_derivatives' )."); return s.get("oes_standard_derivatives")};this.supportscompressedtextures3tc=function(){console.warn("three.webglrenderer: .supportscompressedtextures3tc() is now .extensions.get( 'webgl_compressed_texture_s3tc' ).");return s.get("webgl_compressed_texture_s3tc")};this.supportscompressedtexturepvrtc=function(){console.warn("three.webglrenderer: .supportscompressedtexturepvrtc() is now .extensions.get( 'webgl_compressed_texture_pvrtc' ).");return s.get("webgl_compressed_texture_pvrtc")};this.supportsblendminmax= function(){console.warn("three.webglrenderer: .supportsblendminmax() is now .extensions.get( 'ext_blend_minmax' ).");return s.get("ext_blend_minmax")};this.supportsvertextextures=function(){return ha.vertextextures};this.supportsinstancedarrays=function(){console.warn("three.webglrenderer: .supportsinstancedarrays() is now .extensions.get( 'angle_instanced_arrays' ).");return s.get("angle_instanced_arrays")};this.initmaterial=function(){console.warn("three.webglrenderer: .initmaterial() has been removed.")}; this.addpreplugin=function(){console.warn("three.webglrenderer: .addpreplugin() has been removed.")};this.addpostplugin=function(){console.warn("three.webglrenderer: .addpostplugin() has been removed.")};this.updateshadowmap=function(){console.warn("three.webglrenderer: .updateshadowmap() has been removed.")};object.defineproperties(this,{shadowmapenabled:{get:function(){return $.enabled},set:function(a){console.warn("three.webglrenderer: .shadowmapenabled is now .shadowmap.enabled.");$.enabled=a}}, shadowmaptype:{get:function(){return $.type},set:function(a){console.warn("three.webglrenderer: .shadowmaptype is now .shadowmap.type.");$.type=a}},shadowmapcullface:{get:function(){return $.cullface},set:function(a){console.warn("three.webglrenderer: .shadowmapcullface is now .shadowmap.cullface.");$.cullface=a}},shadowmapdebug:{get:function(){return $.debug},set:function(a){console.warn("three.webglrenderer: .shadowmapdebug is now .shadowmap.debug.");$.debug=a}}})}; three.webglrendertarget=function(a,b,c){this.uuid=three.math.generateuuid();this.width=a;this.height=b;c=c||{};void 0===c.minfilter&&(c.minfilter=three.linearfilter);this.texture=new three.texture(void 0,void 0,c.wraps,c.wrapt,c.magfilter,c.minfilter,c.format,c.type,c.anisotropy);this.depthbuffer=void 0!==c.depthbuffer?c.depthbuffer:!0;this.stencilbuffer=void 0!==c.stencilbuffer?c.stencilbuffer:!0;this.sharedepthfrom=void 0!==c.sharedepthfrom?c.sharedepthfrom:null}; three.webglrendertarget.prototype={constructor:three.webglrendertarget,get wraps(){console.warn("three.webglrendertarget: .wraps is now .texture.wraps.");return this.texture.wraps},set wraps(a){console.warn("three.webglrendertarget: .wraps is now .texture.wraps.");this.texture.wraps=a},get wrapt(){console.warn("three.webglrendertarget: .wrapt is now .texture.wrapt.");return this.texture.wrapt},set wrapt(a){console.warn("three.webglrendertarget: .wrapt is now .texture.wrapt.");this.texture.wrapt=a}, get magfilter(){console.warn("three.webglrendertarget: .magfilter is now .texture.magfilter.");return this.texture.magfilter},set magfilter(a){console.warn("three.webglrendertarget: .magfilter is now .texture.magfilter.");this.texture.magfilter=a},get minfilter(){console.warn("three.webglrendertarget: .minfilter is now .texture.minfilter.");return this.texture.minfilter},set minfilter(a){console.warn("three.webglrendertarget: .minfilter is now .texture.minfilter.");this.texture.minfilter=a},get anisotropy(){console.warn("three.webglrendertarget: .anisotropy is now .texture.anisotropy."); return this.texture.anisotropy},set anisotropy(a){console.warn("three.webglrendertarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=a},get offset(){console.warn("three.webglrendertarget: .offset is now .texture.offset.");return this.texture.offset},set offset(a){console.warn("three.webglrendertarget: .offset is now .texture.offset.");this.texture.offset=a},get repeat(){console.warn("three.webglrendertarget: .repeat is now .texture.repeat.");return this.texture.repeat},set repeat(a){console.warn("three.webglrendertarget: .repeat is now .texture.repeat."); this.texture.repeat=a},get format(){console.warn("three.webglrendertarget: .format is now .texture.format.");return this.texture.format},set format(a){console.warn("three.webglrendertarget: .format is now .texture.format.");this.texture.format=a},get type(){console.warn("three.webglrendertarget: .type is now .texture.type.");return this.texture.type},set type(a){console.warn("three.webglrendertarget: .type is now .texture.type.");this.texture.type=a},get generatemipmaps(){console.warn("three.webglrendertarget: .generatemipmaps is now .texture.generatemipmaps."); return this.texture.generatemipmaps},set generatemipmaps(a){console.warn("three.webglrendertarget: .generatemipmaps is now .texture.generatemipmaps.");this.texture.generatemipmaps=a},setsize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose()},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.texture=a.texture.clone();this.depthbuffer=a.depthbuffer;this.stencilbuffer=a.stencilbuffer;this.sharedepthfrom= a.sharedepthfrom;return this},dispose:function(){this.dispatchevent({type:"dispose"})}};three.eventdispatcher.prototype.apply(three.webglrendertarget.prototype);three.webglrendertargetcube=function(a,b,c){three.webglrendertarget.call(this,a,b,c);this.activecubeface=0};three.webglrendertargetcube.prototype=object.create(three.webglrendertarget.prototype);three.webglrendertargetcube.prototype.constructor=three.webglrendertargetcube; three.webglbufferrenderer=function(a,b,c){var d;this.setmode=function(a){d=a};this.render=function(b,g){a.drawarrays(d,b,g);c.calls++;c.vertices+=g;d===a.triangles&&(c.faces+=g/3)};this.renderinstances=function(a){var c=b.get("angle_instanced_arrays");if(null===c)console.error("three.webglbufferrenderer: using three.instancedbuffergeometry but hardware does not support extension angle_instanced_arrays.");else{var f=a.attributes.position;f instanceof three.interleavedbufferattribute?c.drawarraysinstancedangle(d, 0,f.data.count,a.maxinstancedcount):c.drawarraysinstancedangle(d,0,f.count,a.maxinstancedcount)}}}; three.webglindexedbufferrenderer=function(a,b,c){var d,e,g;this.setmode=function(a){d=a};this.setindex=function(c){c.array instanceof uint32array&&b.get("oes_element_index_uint")?(e=a.unsigned_int,g=4):(e=a.unsigned_short,g=2)};this.render=function(b,h){a.drawelements(d,h,e,b*g);c.calls++;c.vertices+=h;d===a.triangles&&(c.faces+=h/3)};this.renderinstances=function(a){var c=b.get("angle_instanced_arrays");null===c?console.error("three.webglbufferrenderer: using three.instancedbuffergeometry but hardware does not support extension angle_instanced_arrays."): c.drawelementsinstancedangle(d,a.index.array.length,e,0,a.maxinstancedcount)}}; three.webglextensions=function(a){var b={};this.get=function(c){if(void 0!==b[c])return b[c];var d;switch(c){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;default:d=a.getextension(c)}null===d&&console.warn("three.webglrenderer: "+c+" extension not supported.");return b[c]=d}}; three.webglcapabilities=function(a,b,c){function d(b){if("highp"===b){if(0c){var d=b;b=c;c=d}d=a[b];return void 0===d?(a[b]=[c],!0):-1===d.indexof(c)?(d.push(c),!0):!1}var g=new three.webglgeometries(a,b,c);this.getattributebuffer=function(a){return a instanceof three.interleavedbufferattribute?b.get(a.data).__webglbuffer:b.get(a).__webglbuffer};this.getwireframeattribute= function(c){var g=b.get(c);if(void 0!==g.wireframe)return g.wireframe;var l=[],k=c.index,m=c.attributes;c=m.position;if(null!==k)for(var m={},k=k.array,p=0,n=k.length;p 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;\nfogfactor = 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")); x.compileshader(k);x.compileshader(e);x.attachshader(m,k);x.attachshader(m,e);x.linkprogram(m);a=m;u=x.getattriblocation(a,"position");w=x.getattriblocation(a,"uv");c=x.getuniformlocation(a,"uvoffset");d=x.getuniformlocation(a,"uvscale");e=x.getuniformlocation(a,"rotation");g=x.getuniformlocation(a,"scale");f=x.getuniformlocation(a,"color");h=x.getuniformlocation(a,"map");l=x.getuniformlocation(a,"opacity");k=x.getuniformlocation(a,"modelviewmatrix");m=x.getuniformlocation(a,"projectionmatrix");p= x.getuniformlocation(a,"fogtype");n=x.getuniformlocation(a,"fogdensity");q=x.getuniformlocation(a,"fognear");s=x.getuniformlocation(a,"fogfar");t=x.getuniformlocation(a,"fogcolor");v=x.getuniformlocation(a,"alphatest");m=document.createelement("canvas");m.width=8;m.height=8;k=m.getcontext("2d");k.fillstyle="white";k.fillrect(0,0,8,8);j=new three.texture(m);j.needsupdate=!0}x.useprogram(a);b.initattributes();b.enableattribute(u);b.enableattribute(w);b.disableunusedattributes();b.disable(x.cull_face); b.enable(x.blend);x.bindbuffer(x.array_buffer,y);x.vertexattribpointer(u,2,x.float,!1,16,0);x.vertexattribpointer(w,2,x.float,!1,16,8);x.bindbuffer(x.element_array_buffer,z);x.uniformmatrix4fv(m,!1,q.projectionmatrix.elements);b.activetexture(x.texture0);x.uniform1i(h,0);k=m=0;(e=l.fog)?(x.uniform3f(t,e.color.r,e.color.g,e.color.b),e instanceof three.fog?(x.uniform1f(q,e.near),x.uniform1f(s,e.far),x.uniform1i(p,1),k=m=1):e instanceof three.fogexp2&&(x.uniform1f(n,e.density),x.uniform1i(p,2),k=m=2)): (x.uniform1i(p,0),k=m=0);for(var e=0,o=b.length;ec)return null;var d=[],e=[],g=[],f,h,l;if(0=k--){console.warn("three.shapeutils: unable to triangulate polygon! in triangulate()");break}f=h;c<=f&&(f=0);h=f+1;c<=h&&(h=0);l=h+1;c<=l&&(l=0);var m;a:{var p= m=void 0,n=void 0,q=void 0,s=void 0,t=void 0,v=void 0,u=void 0,w=void 0,p=a[e[f]].x,n=a[e[f]].y,q=a[e[h]].x,s=a[e[h]].y,t=a[e[l]].x,v=a[e[l]].y;if(number.epsilon>(q-p)*(v-n)-(s-n)*(t-p))m=!1;else{var d=void 0,x=void 0,b=void 0,y=void 0,z=void 0,a=void 0,j=void 0,f=void 0,c=void 0,n=void 0,c=f=j=w=u=void 0,d=t-q,x=v-s,b=p-t,y=n-v,z=q-p,a=s-n;for(m=0;m=-number.epsilon&& f>=-number.epsilon&&j>=-number.epsilon)){m=!1;break a}m=!0}}if(m){d.push([a[e[f]],a[e[h]],a[e[l]]]);g.push([e[f],e[h],e[l]]);f=h;for(l=h+1;lnumber.epsilon){if(0a||a> z)return[];k=l*m-k*p;if(0>k||k>z)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 math.abs(a)>number.epsilon?(b=g*c-d*b,0f&&(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;cq){console.log("infinite loop! holes left:"+l.length+", probably hole outside shape!");break}for(p=f;ph;h++)k=l[h].x+":"+l[h].y,k=m[k],void 0!==k&&(l[h]=k);return p.concat()},isclockwise:function(a){return 0>three.shapeutils.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var g= 1-a,f=1-a;return g*g*g*b+3*f*f*a*c+3*(1-a)*a*a*d+a*a*a*e}}()};three.audio=function(a){three.object3d.call(this);this.type="audio";this.context=a.context;this.source=this.context.createbuffersource();this.source.onended=this.onended.bind(this);this.gain=this.context.creategain();this.gain.connect(this.context.destination);this.panner=this.context.createpanner();this.panner.connect(this.gain);this.autoplay=!1;this.starttime=0;this.playbackrate=1;this.isplaying=!1};three.audio.prototype=object.create(three.object3d.prototype); three.audio.prototype.constructor=three.audio;three.audio.prototype.load=function(a){var b=this,c=new xmlhttprequest;c.open("get",a,!0);c.responsetype="arraybuffer";c.onload=function(a){b.context.decodeaudiodata(this.response,function(a){b.source.buffer=a;b.autoplay&&b.play()})};c.send();return this}; three.audio.prototype.play=function(){if(!0===this.isplaying)console.warn("three.audio: audio is already playing.");else{var a=this.context.createbuffersource();a.buffer=this.source.buffer;a.loop=this.source.loop;a.onended=this.source.onended;a.start(0,this.starttime);a.playbackrate.value=this.playbackrate;this.isplaying=!0;this.source=a;this.connect()}};three.audio.prototype.pause=function(){this.source.stop();this.starttime=this.context.currenttime}; three.audio.prototype.stop=function(){this.source.stop();this.starttime=0};three.audio.prototype.connect=function(){void 0!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.panner)):this.source.connect(this.panner)};three.audio.prototype.disconnect=function(){void 0!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.panner)):this.source.disconnect(this.panner)}; three.audio.prototype.setfilter=function(a){!0===this.isplaying?(this.disconnect(),this.filter=a,this.connect()):this.filter=a};three.audio.prototype.getfilter=function(){return this.filter};three.audio.prototype.setplaybackrate=function(a){this.playbackrate=a;!0===this.isplaying&&(this.source.playbackrate.value=this.playbackrate)};three.audio.prototype.getplaybackrate=function(){return this.playbackrate};three.audio.prototype.onended=function(){this.isplaying=!1}; three.audio.prototype.setloop=function(a){this.source.loop=a};three.audio.prototype.getloop=function(){return this.source.loop};three.audio.prototype.setrefdistance=function(a){this.panner.refdistance=a};three.audio.prototype.getrefdistance=function(){return this.panner.refdistance};three.audio.prototype.setrollofffactor=function(a){this.panner.rollofffactor=a};three.audio.prototype.getrollofffactor=function(){return this.panner.rollofffactor}; three.audio.prototype.setvolume=function(a){this.gain.gain.value=a};three.audio.prototype.getvolume=function(){return this.gain.gain.value};three.audio.prototype.updatematrixworld=function(){var a=new three.vector3;return function(b){three.object3d.prototype.updatematrixworld.call(this,b);a.setfrommatrixposition(this.matrixworld);this.panner.setposition(a.x,a.y,a.z)}}();three.audiolistener=function(){three.object3d.call(this);this.type="audiolistener";this.context=new (window.audiocontext||window.webkitaudiocontext)}; three.audiolistener.prototype=object.create(three.object3d.prototype);three.audiolistener.prototype.constructor=three.audiolistener; three.audiolistener.prototype.updatematrixworld=function(){var a=new three.vector3,b=new three.quaternion,c=new three.vector3,d=new three.vector3;return function(e){three.object3d.prototype.updatematrixworld.call(this,e);e=this.context.listener;var g=this.up;this.matrixworld.decompose(a,b,c);d.set(0,0,-1).applyquaternion(b);e.setposition(a.x,a.y,a.z);e.setorientation(d.x,d.y,d.z,g.x,g.y,g.z)}}();three.curve=function(){}; three.curve.prototype={constructor:three.curve,getpoint:function(a){console.warn("three.curve: warning, getpoint() not implemented!");return null},getpointat:function(a){a=this.getutotmapping(a);return this.getpoint(a)},getpoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getpoint(b/a));return c},getspacedpoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getpointat(b/a));return c},getlength:function(){var a=this.getlengths();return a[a.length-1]},getlengths:function(a){a|| (a=this.__arclengthdivisions?this.__arclengthdivisions:200);if(this.cachearclengths&&this.cachearclengths.length===a+1&&!this.needsupdate)return this.cachearclengths;this.needsupdate=!1;var b=[],c,d=this.getpoint(0),e,g=0;b.push(0);for(e=1;e<=a;e++)c=this.getpoint(e/a),g+=c.distanceto(d),b.push(g),d=c;return this.cachearclengths=b},updatearclengths:function(){this.needsupdate=!0;this.getlengths()},getutotmapping:function(a,b){var c=this.getlengths(),d=0,e=c.length,g;g=b?b:a*c[e-1];for(var f=0,h=e- 1,l;f<=h;)if(d=math.floor(f+(h-f)/2),l=c[d]-g,0>l)f=d+1;else if(0b&&(b=0);1=b)return a=this.curves[d],b=1-(c[d]-b)/a.getlength(),a.getpointat(b);d++}return null};three.curvepath.prototype.getlength=function(){var a=this.getcurvelengths();return a[a.length-1]}; three.curvepath.prototype.getcurvelengths=function(){if(this.cachelengths&&this.cachelengths.length===this.curves.length)return this.cachelengths;for(var a=[],b=0,c=0,d=this.curves.length;cnumber.epsilon){if(0>l&&(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=three.shapeutils.isclockwise,g=function(a){for(var b=[],c=new three.path,d=0,e=a.length;db.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=three.curveutils.interpolate;return new three.vector2(c(d.x,e.x,g.x,b.x,a),c(d.y,e.y,g.y,b.y,a))};three.ellipsecurve=function(a,b,c,d,e,g,f,h){this.ax=a;this.ay=b;this.xradius=c;this.yradius=d;this.astartangle=e;this.aendangle=g;this.aclockwise=f;this.arotation=h||0};three.ellipsecurve.prototype=object.create(three.curve.prototype); three.ellipsecurve.prototype.constructor=three.ellipsecurve; three.ellipsecurve.prototype.getpoint=function(a){var b=this.aendangle-this.astartangle;0>b&&(b+=2*math.pi);b>2*math.pi&&(b-=2*math.pi);b=!0===this.aclockwise?this.aendangle+(1-a)*(2*math.pi-b):this.astartangle+a*b;a=this.ax+this.xradius*math.cos(b);var c=this.ay+this.yradius*math.sin(b);if(0!==this.arotation){var b=math.cos(this.arotation),d=math.sin(this.arotation),e=a;a=(e-this.ax)*b-(c-this.ay)*d+this.ax;c=(e-this.ax)*d+(c-this.ay)*b+this.ay}return new three.vector2(a,c)}; three.arccurve=function(a,b,c,d,e,g){three.ellipsecurve.call(this,a,b,c,c,d,e,g)};three.arccurve.prototype=object.create(three.ellipsecurve.prototype);three.arccurve.prototype.constructor=three.arccurve;three.linecurve3=three.curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new three.vector3;b.subvectors(this.v2,this.v1);b.multiplyscalar(a);b.add(this.v1);return b}); three.quadraticbeziercurve3=three.curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b=three.shapeutils.b2;return new three.vector3(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y),b(a,this.v0.z,this.v1.z,this.v2.z))}); three.cubicbeziercurve3=three.curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b=three.shapeutils.b3;return new three.vector3(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y),b(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}); three.splinecurve3=three.curve.create(function(a){console.warn("three.splinecurve3 will be deprecated. please use three.catmullromcurve3");this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],g=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=three.curveutils.interpolate;return new three.vector3(c(d.x,e.x,g.x,b.x,a),c(d.y,e.y,g.y,b.y,a),c(d.z,e.z,g.z,b.z,a))}); three.catmullromcurve3=function(){function a(){}var b=new three.vector3,c=new a,d=new a,e=new a;a.prototype.init=function(a,b,c,d){this.c0=a;this.c1=c;this.c2=-3*a+3*b-2*c-d;this.c3=2*a-2*b+c+d};a.prototype.initnonuniformcatmullrom=function(a,b,c,d,e,m,p){a=((b-a)/e-(c-a)/(e+m)+(c-b)/m)*m;d=((c-b)/m-(d-b)/(m+p)+(d-c)/p)*m;this.init(b,c,a,d)};a.prototype.initcatmullrom=function(a,b,c,d,e){this.init(b,c,e*(c-a),e*(d-b))};a.prototype.calc=function(a){var b=a*a;return this.c0+this.c1*a+this.c2*b+this.c3* b*a};return three.curve.create(function(a){this.points=a||[]},function(a){var f=this.points,h,l;l=f.length;2>l&&console.log("duh, you need at least 2 points");a*=l-1;h=math.floor(a);a-=h;0===a&&h===l-1&&(h=l-2,a=1);var k,m,p;0===h?(b.subvectors(f[0],f[1]).add(f[0]),k=b):k=f[h-1];m=f[h];p=f[h+1];h+2h&&(h=1);1e-4>l&&(l=h);1e-4>n&&(n=h);c.initnonuniformcatmullrom(k.x,m.x,p.x,f.x,l,h,n);d.initnonuniformcatmullrom(k.y,m.y,p.y,f.y,l,h,n);e.initnonuniformcatmullrom(k.z,m.z,p.z,f.z,l,h,n)}else"catmullrom"===this.type&&(l=void 0!==this.tension?this.tension:.5,c.initcatmullrom(k.x,m.x,p.x,f.x,l),d.initcatmullrom(k.y,m.y,p.y,f.y,l),e.initcatmullrom(k.z,m.z,p.z,f.z,l));return new three.vector3(c.calc(a),d.calc(a),e.calc(a))})}(); three.closedsplinecurve3=three.curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=math.floor(a);a-=c;var c=c+(0n;n++){e[0]=p[f[n]];e[1]=p[f[(n+1)%3]];e.sort(c);var q=e.tostring();void 0===g[q]?g[q]={vert1:e[0],vert2:e[1],face1:k, face2:void 0}:g[q].face2=k}e=[];for(q in g)if(f=g[q],void 0===f.face2||h[f.face1].normal.dot(h[f.face2].normal)<=d)k=l[f.vert1],e.push(k.x),e.push(k.y),e.push(k.z),k=l[f.vert2],e.push(k.x),e.push(k.y),e.push(k.z);this.addattribute("position",new three.bufferattribute(new float32array(e),3))};three.edgesgeometry.prototype=object.create(three.buffergeometry.prototype);three.edgesgeometry.prototype.constructor=three.edgesgeometry; three.extrudegeometry=function(a,b){"undefined"!==typeof a&&(three.geometry.call(this),this.type="extrudegeometry",a=array.isarray(a)?a:[a],this.addshapelist(a,b),this.computefacenormals())};three.extrudegeometry.prototype=object.create(three.geometry.prototype);three.extrudegeometry.prototype.constructor=three.extrudegeometry;three.extrudegeometry.prototype.addshapelist=function(a,b){for(var c=a.length,d=0;dnumber.epsilon){var k=math.sqrt(h),l=math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new three.vector2(c,a);d=math.sqrt(d/2)}else a=!1,d>number.epsilon? f>number.epsilon&&(a=!0):d<-number.epsilon?f<-number.epsilon&&(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(a,b){var c,d;for(g=a.length;0<=--g;){c=g;d=g-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*m,e=0;emath.abs(b.y-c.y)?[new three.vector2(b.x,1-b.z),new three.vector2(c.x,1-c.z),new three.vector2(d.x,1-d.z),new three.vector2(e.x,1-e.z)]:[new three.vector2(b.y,1-b.z),new three.vector2(c.y,1-c.z),new three.vector2(d.y, 1-d.z),new three.vector2(e.y,1-e.z)]}};three.shapegeometry=function(a,b){three.geometry.call(this);this.type="shapegeometry";!1===array.isarray(a)&&(a=[a]);this.addshapelist(a,b);this.computefacenormals()};three.shapegeometry.prototype=object.create(three.geometry.prototype);three.shapegeometry.prototype.constructor=three.shapegeometry;three.shapegeometry.prototype.addshapelist=function(a,b){for(var c=0,d=a.length;cnumber.epsilon&&(h.normalize(),d=math.acos(three.math.clamp(e[k-1].dot(e[k]),-1,1)),g[k].applymatrix4(l.makerotationaxis(h,d))),f[k].crossvectors(e[k],g[k]);if(c)for(d=math.acos(three.math.clamp(g[0].dot(g[b-1]),-1,1)),d/=b-1,0c&&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 l=this,k=0,m=a.length;kq&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>p&&(b[2].x+=1));k=0;for(m=this.vertices.length;kp;p++){c[0]=m[e[p]];c[1]=m[e[(p+1)%3]];c.sort(b);var n=c.tostring();void 0===d[n]&&(l[2*h]=c[0],l[2*h+1]=c[1],d[n]=!0,h++)}c=new float32array(6*h);a=0;for(k=h;ap;p++)d=g[l[2*a+p]],h=6*a+3*p,c[h+0]=d.x,c[h+1]=d.y, c[h+2]=d.z;this.addattribute("position",new three.bufferattribute(c,3))}else if(a instanceof three.buffergeometry){if(null!==a.index){k=a.index.array;g=a.attributes.position;e=a.drawcalls;h=0;0===e.length&&a.addgroup(0,k.length);l=new uint32array(2*k.length);f=0;for(m=e.length;fp;p++)c[0]=k[a+p],c[1]=k[a+(p+1)%3],c.sort(b),n=c.tostring(),void 0===d[n]&&(l[2*h]=c[0],l[2*h+1]=c[1],d[n]=!0,h++)}c=new float32array(6*h);a=0;for(k= h;ap;p++)h=6*a+3*p,d=l[2*a+p],c[h+0]=g.getx(d),c[h+1]=g.gety(d),c[h+2]=g.getz(d)}else for(g=a.attributes.position.array,h=g.length/3,l=h/3,c=new float32array(6*h),a=0,k=l;ap;p++)h=18*a+6*p,l=9*a+3*p,c[h+0]=g[l],c[h+1]=g[l+1],c[h+2]=g[l+2],d=9*a+(p+1)%3*3,c[h+3]=g[d],c[h+4]=g[d+1],c[h+5]=g[d+2];this.addattribute("position",new three.bufferattribute(c,3))}};three.wireframegeometry.prototype=object.create(three.buffergeometry.prototype); three.wireframegeometry.prototype.constructor=three.wireframegeometry;three.axishelper=function(a){a=a||1;var b=new float32array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new float32array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new three.buffergeometry;a.addattribute("position",new three.bufferattribute(b,3));a.addattribute("color",new three.bufferattribute(c,3));b=new three.linebasicmaterial({vertexcolors:three.vertexcolors});three.linesegments.call(this,a,b)};three.axishelper.prototype=object.create(three.linesegments.prototype); three.axishelper.prototype.constructor=three.axishelper; three.arrowhelper=function(){var a=new three.geometry;a.vertices.push(new three.vector3(0,0,0),new three.vector3(0,1,0));var b=new three.cylindergeometry(0,.5,1,5,1);b.translate(0,-.5,0);return function(c,d,e,g,f,h){three.object3d.call(this);void 0===g&&(g=16776960);void 0===e&&(e=1);void 0===f&&(f=.2*e);void 0===h&&(h=.2*f);this.position.copy(d);fc.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))}}(); three.arrowhelper.prototype.setlength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);bd;d++)c.faces[d].color=this.colors[4>d?0:1];d=new three.meshbasicmaterial({vertexcolors:three.facecolors,wireframe:!0});this.lightsphere=new three.mesh(c,d);this.add(this.lightsphere);this.update()}; three.hemispherelighthelper.prototype=object.create(three.object3d.prototype);three.hemispherelighthelper.prototype.constructor=three.hemispherelighthelper;three.hemispherelighthelper.prototype.dispose=function(){this.lightsphere.geometry.dispose();this.lightsphere.material.dispose()}; three.hemispherelighthelper.prototype.update=function(){var a=new three.vector3;return function(){this.colors[0].copy(this.light.color).multiplyscalar(this.light.intensity);this.colors[1].copy(this.light.groundcolor).multiplyscalar(this.light.intensity);this.lightsphere.lookat(a.setfrommatrixposition(this.light.matrixworld).negate());this.lightsphere.geometry.colorsneedupdate=!0}}(); three.pointlighthelper=function(a,b){this.light=a;this.light.updatematrixworld();var c=new three.spheregeometry(b,4,2),d=new three.meshbasicmaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyscalar(this.light.intensity);three.mesh.call(this,c,d);this.matrix=this.light.matrixworld;this.matrixautoupdate=!1};three.pointlighthelper.prototype=object.create(three.mesh.prototype);three.pointlighthelper.prototype.constructor=three.pointlighthelper; three.pointlighthelper.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};three.pointlighthelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyscalar(this.light.intensity)}; three.skeletonhelper=function(a){this.bones=this.getbonelist(a);for(var b=new three.geometry,c=0;ch.end&&(h.end=g);c||(c=l)}}for(l in d)h=d[l],this.createanimation(l,h.start,h.end,a);this.firstanimation=c}; three.morphblendmesh.prototype.setanimationdirectionforward=function(a){if(a=this.animationsmap[a])a.direction=1,a.directionbackwards=!1};three.morphblendmesh.prototype.setanimationdirectionbackward=function(a){if(a=this.animationsmap[a])a.direction=-1,a.directionbackwards=!0};three.morphblendmesh.prototype.setanimationfps=function(a,b){var c=this.animationsmap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)}; three.morphblendmesh.prototype.setanimationduration=function(a,b){var c=this.animationsmap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};three.morphblendmesh.prototype.setanimationweight=function(a,b){var c=this.animationsmap[a];c&&(c.weight=b)};three.morphblendmesh.prototype.setanimationtime=function(a,b){var c=this.animationsmap[a];c&&(c.time=b)};three.morphblendmesh.prototype.getanimationtime=function(a){var b=0;if(a=this.animationsmap[a])b=a.time;return b}; three.morphblendmesh.prototype.getanimationduration=function(a){var b=-1;if(a=this.animationsmap[a])b=a.duration;return b};three.morphblendmesh.prototype.playanimation=function(a){var b=this.animationsmap[a];b?(b.time=0,b.active=!0):console.warn("three.morphblendmesh: animation["+a+"] undefined in .playanimation()")};three.morphblendmesh.prototype.stopanimation=function(a){if(a=this.animationsmap[a])a.active=!1}; three.morphblendmesh.prototype.update=function(a){for(var b=0,c=this.animationslist.length;bd.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.start+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);d.currentframe!==d.lastframe?(this.morphtargetinfluences[d.currentframe]=e*f,this.morphtargetinfluences[d.lastframe]=(1-e)*f):this.morphtargetinfluences[d.currentframe]=f}}};