From 3a2118f06bea0b948807b9db91d3f7fad9fb95b4 Mon Sep 17 00:00:00 2001 From: Maxim Borodin Date: Tue, 3 Nov 2015 15:21:26 +0300 Subject: [PATCH] first commit --- .gitignore | 7 ++ .jscsrc | 29 ++++++ .jshintrc | 14 +++ .stylintrc | 49 ++++++++++ README.md | 18 ++++ bower.json | 6 ++ build/badbrowser.html | 1 + build/css/main.css | 2 + build/fonts/opensans-regular.woff2 | Bin 0 -> 15560 bytes build/js/main.js | 15 +++ example/data.json | 3 + example/index.html | 11 +++ gulpfile.js | 149 +++++++++++++++++++++++++++++ package.json | 54 +++++++++++ src/badbrowser.html | 10 ++ src/css/layout.styl | 3 + src/css/main.styl | 2 + src/css/variables/color.styl | 0 src/fonts/opensans-regular.woff2 | Bin 0 -> 15560 bytes src/js/Lang.js | 62 ++++++++++++ src/js/Lang/dictionary.js | 22 +++++ src/js/Tour.js | 4 + src/js/Tour/events.js | 15 +++ src/js/Tour/init.js | 10 ++ src/js/Tour/load.js | 23 +++++ src/js/Tour/log.js | 5 + src/js/Tour/query.js | 26 +++++ 27 files changed, 540 insertions(+) create mode 100644 .gitignore create mode 100644 .jscsrc create mode 100644 .jshintrc create mode 100644 .stylintrc create mode 100644 README.md create mode 100644 bower.json create mode 100644 build/badbrowser.html create mode 100644 build/css/main.css create mode 100644 build/fonts/opensans-regular.woff2 create mode 100644 build/js/main.js create mode 100644 example/data.json create mode 100644 example/index.html create mode 100644 gulpfile.js create mode 100644 package.json create mode 100644 src/badbrowser.html create mode 100644 src/css/layout.styl create mode 100644 src/css/main.styl create mode 100644 src/css/variables/color.styl create mode 100644 src/fonts/opensans-regular.woff2 create mode 100644 src/js/Lang.js create mode 100644 src/js/Lang/dictionary.js create mode 100644 src/js/Tour.js create mode 100644 src/js/Tour/events.js create mode 100644 src/js/Tour/init.js create mode 100644 src/js/Tour/load.js create mode 100644 src/js/Tour/log.js create mode 100644 src/js/Tour/query.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e8754d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +node_modules/ +bower_components/ +src/lib/ +build/**/*.map +Thumbs.db +npm-debug.log +.ftppass \ No newline at end of file diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..5a18a76 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,29 @@ +{ + "preset": "google", + "fileExtensions": [".js", "jscs"], + + "requireSemicolons": true, + "requireParenthesesAroundIIFE": true, + "maximumLineLength": 120, + "validateIndentation": 4, + "disallowTrailingComma": true, + "disallowUnusedParams": true, + + "disallowSpacesInsideObjectBrackets": null, + "disallowImplicitTypeConversion": ["string"], + + "safeContextKeyword": "_this", + + "jsDoc": { + "checkAnnotations": "closurecompiler", + "checkParamNames": true, + "requireParamTypes": true, + "checkRedundantParams": true, + "checkReturnTypes": true, + "checkRedundantReturns": true, + "requireReturnTypes": true, + "checkTypes": "capitalizedNativeCase", + "checkRedundantAccess": true, + "requireNewlineAfterDescription": true + } +} \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..cd7adcb --- /dev/null +++ b/.jshintrc @@ -0,0 +1,14 @@ +{ + "browser": true, + "node": true, + + "camelcase": true, + "strict": false, + "latedef": true, + "maxlen": 120, + "quotmark": "single", + "undef": true, + "unused": true, + + "eqnull": true +} \ No newline at end of file diff --git a/.stylintrc b/.stylintrc new file mode 100644 index 0000000..b278f33 --- /dev/null +++ b/.stylintrc @@ -0,0 +1,49 @@ +{ + "blocks": false, + "brackets": { + "expect": "never", + "error": "true" + }, + "colons": { + "expect": "never", + "error": "true" + }, + "colors": false, + "commaSpace": { + "expect": "always", + "error": "true" + }, + "commentSpace": { + "expect": "always", + "error": "true" + }, + "cssLiteral" : false, + "depthLimit": false, + "duplicates": true, + "efficient": false, + "extendPref": false, + "globalDupe": false, + "indentPref": false, + "leadingZero": false, + "none": false, + "noImportant": true, + "placeholders": false, + "prefixVarsWithDollar": { + "expect": "always", + "error": "true" + }, + "semicolons": { + "expect": "never", + "error": true + }, + "sortOrder": false, + "stackedProperties": { + "expect": "never", + "error": true + }, + "valid": true, + "zeroUnits": { + "expect": "never", + "error": "true" + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6d594a8 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +tour-player +=========== + +#### Getting started +```git clone https://github.com/Tour-360/tour-player.git && cd tour-player``` + +```npm install -g gulp bower ``` + +```npm install ``` + +#### Build +```gulp ``` + +#### Run server (browserSync) +```gulp serve ``` + +#### FTP Deploy +```gulp deploy``` \ No newline at end of file diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..fd9c200 --- /dev/null +++ b/bower.json @@ -0,0 +1,6 @@ +{ + "name": "tour-player", + "dependencies": { + "threejs": "latest" + } +} diff --git a/build/badbrowser.html b/build/badbrowser.html new file mode 100644 index 0000000..28b1241 --- /dev/null +++ b/build/badbrowser.html @@ -0,0 +1 @@ +Слишком старый браузер

Для отображения виртуального тура необходимо обновить браузер.

Обновить \ No newline at end of file diff --git a/build/css/main.css b/build/css/main.css new file mode 100644 index 0000000..866a02a --- /dev/null +++ b/build/css/main.css @@ -0,0 +1,2 @@ +body,html{margin:0;padding:0}/*# sourceMappingURL=main.css.map */ +/*# sourceMappingURL=main.css.map */ diff --git a/build/fonts/opensans-regular.woff2 b/build/fonts/opensans-regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..bcb25b0f02c39abb3e9134b983fa34b63f43e972 GIT binary patch literal 15560 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:e>0?1:+e}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.NeverDepth=0,THREE.AlwaysDepth=1,THREE.LessDepth=2,THREE.LessEqualDepth=3,THREE.EqualDepth=4,THREE.GreaterEqualDepth=5,THREE.GreaterDepth=6,THREE.NotEqualDepth=7,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.UVMapping=300,THREE.CubeReflectionMapping=301,THREE.CubeRefractionMapping=302,THREE.EquirectangularReflectionMapping=303,THREE.EquirectangularRefractionMapping=304,THREE.SphericalReflectionMapping=305,THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.HalfFloatType=1025,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGBEFormat=THREE.RGBAFormat,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.RGB_PVRTC_4BPPV1_Format=2100,THREE.RGB_PVRTC_2BPPV1_Format=2101,THREE.RGBA_PVRTC_4BPPV1_Format=2102,THREE.RGBA_PVRTC_2BPPV1_Format=2103,THREE.LoopOnce=2200,THREE.LoopRepeat=2201,THREE.LoopPingPong=2202,THREE.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},THREE.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},THREE.Color=function(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(e){return e instanceof THREE.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function e(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+6*(t-e)*(2/3-r):e}return function(t,r,i){if(t=THREE.Math.euclideanModulo(t,1),r=THREE.Math.clamp(r,0,1),i=THREE.Math.clamp(i,0,1),0===r)this.r=this.g=this.b=i;else{var n=.5>=i?i*(1+r):i+r-i*r,o=2*i-n;this.r=e(o,n,t+1/3),this.g=e(o,n,t),this.b=e(o,n,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,n=r[1],o=r[2];switch(n){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,h=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,h)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=r[1],u=c.length;if(3===u)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===u)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}if(e&&e.length>0){var c=THREE.ColorKeywords[e];void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,r,i=e||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),h=Math.min(n,o,a),c=(h+s)/2;if(h===s)t=0,r=0;else{var u=s-h;switch(r=.5>=c?u/(s+h):u/(2-s-h),s){case n:t=(o-a)/u+(a>o?6:0);break;case o:t=(a-n)/u+2;break;case a:t=(n-o)/u+4}t/=6}return i.h=t,i.s=r,i.l=c,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},THREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},THREE.Quaternion=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==i?i:1},THREE.Quaternion.prototype={constructor:THREE.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof THREE.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),i=Math.cos(e._y/2),n=Math.cos(e._z/2),o=Math.sin(e._x/2),a=Math.sin(e._y/2),s=Math.sin(e._z/2),h=e.order;return"XYZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"YXZ"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"ZXY"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n-o*a*s):"ZYX"===h?(this._x=o*i*n-r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n+o*a*s):"YZX"===h?(this._x=o*i*n+r*a*s,this._y=r*a*n+o*i*s,this._z=r*i*s-o*a*n,this._w=r*i*n-o*a*s):"XZY"===h&&(this._x=o*i*n-r*a*s,this._y=r*a*n-o*i*s,this._z=r*i*s+o*a*n,this._w=r*i*n+o*a*s),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],h=r[9],c=r[2],u=r[6],l=r[10],E=i+s+l;return E>0?(t=.5/Math.sqrt(E+1),this._w=.25/t,this._x=(u-h)*t,this._y=(o-c)*t,this._z=(a-n)*t):i>s&&i>l?(t=2*Math.sqrt(1+i-s-l),this._w=(u-h)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+c)/t):s>l?(t=2*Math.sqrt(1+s-i-l),this._w=(o-c)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(h+u)/t):(t=2*Math.sqrt(1+l-i-s),this._w=(a-n)/t,this._x=(o+c)/t,this._y=(h+u)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(i,n){return void 0===e&&(e=new THREE.Vector3),t=i.dot(n)+1,r>t?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,i=e._y,n=e._z,o=e._w,a=t._x,s=t._y,h=t._z,c=t._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*e._w+r*e._x+i*e._y+n*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=Math.acos(a),h=Math.sqrt(1-a*a);if(Math.abs(h)<.001)return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var c=Math.sin((1-t)*s)/h,u=Math.sin(t*s)/h;return this._w=o*c+this._w*u,this._x=r*c+this._x*u,this._y=i*c+this._y*u,this._z=n*c+this._z*u,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},THREE.Quaternion.slerp=function(e,t,r,i){return r.copy(e).slerp(t,i)},THREE.Vector2=function(e,t){this.x=e||0,this.y=t||0},THREE.Vector2.prototype={constructor:THREE.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new THREE.Vector2,t=new THREE.Vector2),e.set(r,r),t.set(i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.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(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*r-o*i+e.x,this.y=n*i+o*r+e.y,this}},THREE.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof THREE.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new THREE.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new THREE.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i+n[12],this.y=n[1]*t+n[5]*r+n[9]*i+n[13],this.z=n[2]*t+n[6]*r+n[10]*i+n[14],this},applyProjection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements,o=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*o,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*o,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*o,this},applyQuaternion:function(e){var t=this.x,r=this.y,i=this.z,n=e.x,o=e.y,a=e.z,s=e.w,h=s*t+o*i-a*r,c=s*r+a*t-n*i,u=s*i+n*r-o*t,l=-n*t-o*r-a*i;return this.x=h*s+l*-n+c*-a-u*-o,this.y=c*s+l*-o+u*-n-h*-a,this.z=u*s+l*-a+h*-o-c*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new THREE.Vector3,t=new THREE.Vector3),e.set(r,r,r),t.set(i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-r*e.z,this.z=r*e.y-i*e.x,this},crossVectors:function(e,t){var r=e.x,i=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new THREE.Vector3),e.copy(r).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new THREE.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(THREE.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i},setEulerFromRotationMatrix:function(e,t){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(e,t){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),r=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),i=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=r,this.z=i,this},setFromMatrixColumn:function(e,t){var r=4*e,i=t.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},THREE.Vector4=function(e,t,r,i){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==i?i:1},THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), +this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*n,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*n,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*n,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,i,n,o=.01,a=.1,s=e.elements,h=s[0],c=s[4],u=s[8],l=s[1],E=s[5],p=s[9],d=s[2],f=s[6],m=s[10];if(Math.abs(c-l)v&&T>g?o>T?(r=0,i=.707106781,n=.707106781):(r=Math.sqrt(T),i=y/r,n=R/r):v>g?o>v?(r=.707106781,i=0,n=.707106781):(i=Math.sqrt(v),r=y/i,n=H/i):o>g?(r=.707106781,i=.707106781,n=0):(n=Math.sqrt(g),r=R/n,i=H/n),this.set(r,i,n,t),this}var x=Math.sqrt((f-p)*(f-p)+(u-d)*(u-d)+(l-c)*(l-c));return Math.abs(x)<.001&&(x=1),this.x=(f-p)/x,this.y=(u-d)/x,this.z=(l-c)/x,this.w=Math.acos((h+E+m-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new THREE.Vector4,t=new THREE.Vector4),e.set(r,r,r,r),t.set(i,i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},THREE.Euler=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._order=i||THREE.Euler.DefaultOrder},THREE.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],THREE.Euler.DefaultOrder="XYZ",THREE.Euler.prototype={constructor:THREE.Euler,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var i=THREE.Math.clamp,n=e.elements,o=n[0],a=n[4],s=n[8],h=n[1],c=n[5],u=n[9],l=n[2],E=n[6],p=n[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(E,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(h,c)):(this._y=Math.atan2(-l,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(E,-1,1)),Math.abs(E)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(h,o))):"ZYX"===t?(this._y=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(E,p),this._z=Math.atan2(h,o)):(this._x=0,this._z=Math.atan2(-a,c))):"YZX"===t?(this._z=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-l,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(E,c),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,i),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new THREE.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new THREE.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},THREE.Line3=function(e,t){this.start=void 0!==e?e:new THREE.Vector3,this.end=void 0!==t?t:new THREE.Vector3},THREE.Line3.prototype={constructor:THREE.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new THREE.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new THREE.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var r=t||new THREE.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r,i){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var n=t.dot(t),o=t.dot(e),a=o/n;return i&&(a=THREE.Math.clamp(a,0,1)),a}}(),closestPointToPoint:function(e,t,r){var i=this.closestPointToPointParameter(e,t),n=r||new THREE.Vector3;return this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},THREE.Box2=function(e,t){this.min=void 0!==e?e:new THREE.Vector2(1/0,1/0),this.max=void 0!==t?t:new THREE.Vector2(-(1/0),-(1/0))},THREE.Box2.prototype={constructor:THREE.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new THREE.Vector2;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},empty:function(){return this.max.xthis.max.x||e.ythis.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y?!0:!1},getParameter:function(e,t){var r=t||new THREE.Vector2;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y?!1:!0},clampPoint:function(e,t){var r=t||new THREE.Vector2;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector2;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},THREE.Box3=function(e,t){this.min=void 0!==e?e:new THREE.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new THREE.Vector3(-(1/0),-(1/0),-(1/0))},THREE.Box3.prototype={constructor:THREE.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new THREE.Vector3;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),setFromObject:function(){var e=new THREE.Vector3;return function(t){var r=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var i=t.geometry;if(void 0!==i)if(i instanceof THREE.Geometry)for(var n=i.vertices,o=0,a=n.length;a>o;o++)e.copy(n[o]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e);else if(i instanceof THREE.BufferGeometry&&void 0!==i.attributes.position)for(var s=i.attributes.position.array,o=0,a=s.length;a>o;o+=3)e.set(s[o],s[o+1],s[o+2]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-(1/0),this},empty:function(){return this.max.xthis.max.x||e.ythis.max.y||e.zthis.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z?!0:!1},getParameter:function(e,t){var r=t||new THREE.Vector3;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z?!1:!0},clampPoint:function(e,t){var r=t||new THREE.Vector3;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new THREE.Vector3;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),getBoundingSphere:function(){var e=new THREE.Vector3;return function(t){var r=t||new THREE.Sphere;return r.center=this.center(),r.radius=.5*this.size(e).length(),r}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[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(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(e,t,r,i,n,o,a,s,h){var c=this.elements;return c[0]=e,c[3]=t,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,o=r;i>n;n+=3,o+=3)e.fromArray(t,o),e.applyMatrix3(this),e.toArray(t,o);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0,o=r;i>n;n++,o++)e.x=t.getX(o),e.y=t.getY(o),e.z=t.getZ(o),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],h=e[7],c=e[8];return t*o*c-t*a*h-r*n*c+r*a*s+i*n*h-i*o*s},getInverse:function(e,t){var r=e.elements,i=this.elements;i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4];var n=r[0]*i[0]+r[1]*i[3]+r[2]*i[6];if(0===n){var o="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(o);return console.warn(o),this.identity(),this}return this.multiplyScalar(1/n),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]}},THREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(e,t,r,i,n,o,a,s,h,c,u,l,E,p,d,f){var m=this.elements;return m[0]=e,m[4]=t,m[8]=r,m[12]=i,m[1]=n,m[5]=o,m[9]=a,m[13]=s,m[2]=h,m[6]=c,m[10]=u,m[14]=l,m[3]=E,m[7]=p,m[11]=d,m[15]=f,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){var i=this.elements;return e.set(i[0],i[1],i[2]),t.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new THREE.Vector3);var r=this.elements,i=t.elements,n=1/e.set(i[0],i[1],i[2]).length(),o=1/e.set(i[4],i[5],i[6]).length(),a=1/e.set(i[8],i[9],i[10]).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[4]=i[4]*o,r[5]=i[5]*o,r[6]=i[6]*o,r[8]=i[8]*a,r[9]=i[9]*a,r[10]=i[10]*a,this}}(),makeRotationFromEuler:function(e){e instanceof THREE.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,n=e.z,o=Math.cos(r),a=Math.sin(r),s=Math.cos(i),h=Math.sin(i),c=Math.cos(n),u=Math.sin(n);if("XYZ"===e.order){var l=o*c,E=o*u,p=a*c,d=a*u;t[0]=s*c,t[4]=-s*u,t[8]=h,t[1]=E+p*h,t[5]=l-d*h,t[9]=-a*s,t[2]=d-l*h,t[6]=p+E*h,t[10]=o*s}else if("YXZ"===e.order){var f=s*c,m=s*u,T=h*c,v=h*u;t[0]=f+v*a,t[4]=T*a-m,t[8]=o*h,t[1]=o*u,t[5]=o*c,t[9]=-a,t[2]=m*a-T,t[6]=v+f*a,t[10]=o*s}else if("ZXY"===e.order){var f=s*c,m=s*u,T=h*c,v=h*u;t[0]=f-v*a,t[4]=-o*u,t[8]=T+m*a,t[1]=m+T*a,t[5]=o*c,t[9]=v-f*a,t[2]=-o*h,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){var l=o*c,E=o*u,p=a*c,d=a*u;t[0]=s*c,t[4]=p*h-E,t[8]=l*h+d,t[1]=s*u,t[5]=d*h+l,t[9]=E*h-p,t[2]=-h,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var g=o*s,y=o*h,R=a*s,H=a*h;t[0]=s*c,t[4]=H-g*u,t[8]=R*u+y,t[1]=u,t[5]=o*c,t[9]=-a*c,t[2]=-h*c,t[6]=y*u+R,t[10]=g-H*u}else if("XZY"===e.order){var g=o*s,y=o*h,R=a*s,H=a*h;t[0]=s*c,t[4]=-u,t[8]=h*c,t[1]=g*u+H,t[5]=o*c,t[9]=y*u-R,t[2]=R*u-y,t[6]=a*c,t[10]=H*u+g}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z,o=e.w,a=r+r,s=i+i,h=n+n,c=r*a,u=r*s,l=r*h,E=i*s,p=i*h,d=n*h,f=o*a,m=o*s,T=o*h;return t[0]=1-(E+d),t[4]=u-T,t[8]=l+m,t[1]=u+T,t[5]=1-(c+d),t[9]=p-f,t[2]=l-m,t[6]=p+f,t[10]=1-(c+E),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,r;return function(i,n,o){void 0===e&&(e=new THREE.Vector3),void 0===t&&(t=new THREE.Vector3),void 0===r&&(r=new THREE.Vector3);var a=this.elements;return r.subVectors(i,n).normalize(),0===r.lengthSq()&&(r.z=1),e.crossVectors(o,r).normalize(),0===e.lengthSq()&&(r.x+=1e-4,e.crossVectors(o,r).normalize()),t.crossVectors(r,e),a[0]=e.x,a[4]=t.x,a[8]=r.x,a[1]=e.y,a[5]=t.y,a[9]=r.y,a[2]=e.z,a[6]=t.z,a[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var r=e.elements,i=t.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],u=r[5],l=r[9],E=r[13],p=r[2],d=r[6],f=r[10],m=r[14],T=r[3],v=r[7],g=r[11],y=r[15],R=i[0],H=i[4],x=i[8],b=i[12],w=i[1],M=i[5],S=i[9],_=i[13],A=i[2],C=i[6],L=i[10],P=i[14],D=i[3],k=i[7],V=i[11],F=i[15];return n[0]=o*R+a*w+s*A+h*D,n[4]=o*H+a*M+s*C+h*k,n[8]=o*x+a*S+s*L+h*V,n[12]=o*b+a*_+s*P+h*F,n[1]=c*R+u*w+l*A+E*D,n[5]=c*H+u*M+l*C+E*k,n[9]=c*x+u*S+l*L+E*V,n[13]=c*b+u*_+l*P+E*F,n[2]=p*R+d*w+f*A+m*D,n[6]=p*H+d*M+f*C+m*k,n[10]=p*x+d*S+f*L+m*V,n[14]=p*b+d*_+f*P+m*F,n[3]=T*R+v*w+g*A+y*D,n[7]=T*H+v*M+g*C+y*k,n[11]=T*x+v*S+g*L+y*V,n[15]=T*b+v*_+g*P+y*F,this},multiplyToArray:function(e,t,r){var i=this.elements;return this.multiplyMatrices(e,t),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,o=r;i>n;n+=3,o+=3)e.fromArray(t,o),e.applyMatrix4(this),e.toArray(t,o);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new THREE.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0,o=r;i>n;n++,o++)e.x=t.getX(o),e.y=t.getY(o),e.z=t.getZ(o),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},determinant:function(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],o=e[1],a=e[5],s=e[9],h=e[13],c=e[2],u=e[6],l=e[10],E=e[14],p=e[3],d=e[7],f=e[11],m=e[15];return p*(+n*s*u-i*h*u-n*a*l+r*h*l+i*a*E-r*s*E)+d*(+t*s*E-t*h*l+n*o*l-i*o*E+i*h*c-n*s*c)+f*(+t*h*u-t*a*E-n*o*u+r*o*E+n*a*c-r*h*c)+m*(-i*a*c-t*s*u+t*a*l+i*o*u-r*o*l+r*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},getPosition:function(){var e;return function(){void 0===e&&(e=new THREE.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,i=e.elements,n=i[0],o=i[4],a=i[8],s=i[12],h=i[1],c=i[5],u=i[9],l=i[13],E=i[2],p=i[6],d=i[10],f=i[14],m=i[3],T=i[7],v=i[11],g=i[15];r[0]=u*f*T-l*d*T+l*p*v-c*f*v-u*p*g+c*d*g,r[4]=s*d*T-a*f*T-s*p*v+o*f*v+a*p*g-o*d*g,r[8]=a*l*T-s*u*T+s*c*v-o*l*v-a*c*g+o*u*g,r[12]=s*u*p-a*l*p-s*c*d+o*l*d+a*c*f-o*u*f,r[1]=l*d*m-u*f*m-l*E*v+h*f*v+u*E*g-h*d*g,r[5]=a*f*m-s*d*m+s*E*v-n*f*v-a*E*g+n*d*g,r[9]=s*u*m-a*l*m-s*h*v+n*l*v+a*h*g-n*u*g,r[13]=a*l*E-s*u*E+s*h*d-n*l*d-a*h*f+n*u*f,r[2]=c*f*m-l*p*m+l*E*T-h*f*T-c*E*g+h*p*g,r[6]=s*p*m-o*f*m-s*E*T+n*f*T+o*E*g-n*p*g,r[10]=o*l*m-s*c*m+s*h*T-n*l*T-o*h*g+n*c*g,r[14]=s*c*E-o*l*E-s*h*p+n*l*p+o*h*f-n*c*f,r[3]=u*p*m-c*d*m-u*E*T+h*d*T+c*E*v-h*p*v,r[7]=o*d*m-a*p*m+a*E*T-n*d*T-o*E*v+n*p*v,r[11]=a*c*m-o*u*m-a*h*T+n*u*T+o*h*v-n*c*v,r[15]=o*u*E-a*c*E+a*h*p-n*u*p-o*h*d+n*c*d;var y=n*r[0]+h*r[4]+E*r[8]+m*r[12];if(0===y){var R="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(R);return console.warn(R),this.identity(),this}return this.multiplyScalar(1/y),this},translate:function(e){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(e){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(e){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(e){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(e,t){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,o=e.x,a=e.y,s=e.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e,t;return function(r,i,n){void 0===e&&(e=new THREE.Vector3),void 0===t&&(t=new THREE.Matrix4);var o=this.elements,a=e.set(o[0],o[1],o[2]).length(),s=e.set(o[4],o[5],o[6]).length(),h=e.set(o[8],o[9],o[10]).length(),c=this.determinant();0>c&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],t.elements.set(this.elements);var u=1/a,l=1/s,E=1/h;return t.elements[0]*=u,t.elements[1]*=u,t.elements[2]*=u,t.elements[4]*=l,t.elements[5]*=l,t.elements[6]*=l,t.elements[8]*=E,t.elements[9]*=E,t.elements[10]*=E,i.setFromRotationMatrix(t),n.x=a,n.y=s,n.z=h,this}}(),makeFrustum:function(e,t,r,i,n,o){var a=this.elements,s=2*n/(t-e),h=2*n/(i-r),c=(t+e)/(t-e),u=(i+r)/(i-r),l=-(o+n)/(o-n),E=-2*o*n/(o-n);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=h,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=l,a[14]=E,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,r,i){var n=r*Math.tan(THREE.Math.degToRad(.5*e)),o=-n,a=o*t,s=n*t;return this.makeFrustum(a,s,o,n,r,i)},makeOrthographic:function(e,t,r,i,n,o){var a=this.elements,s=t-e,h=r-i,c=o-n,u=(t+e)/s,l=(r+i)/h,E=(o+n)/c;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-l,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-E,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,i=0;16>i;i++)if(t[i]!==r[i])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}},THREE.Ray=function(e,t){this.origin=void 0!==e?e:new THREE.Vector3,this.direction=void 0!==t?t:new THREE.Vector3},THREE.Ray.prototype={constructor:THREE.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var r=t||new THREE.Vector3;return r.copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new THREE.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new THREE.Vector3;r.subVectors(e,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new THREE.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3;return function(i,n,o,a){e.copy(i).add(n).multiplyScalar(.5),t.copy(n).sub(i).normalize(),r.copy(this.origin).sub(e);var s,h,c,u,l=.5*i.distanceTo(n),E=-this.direction.dot(t),p=r.dot(this.direction),d=-r.dot(t),f=r.lengthSq(),m=Math.abs(1-E*E);if(m>0)if(s=E*d-p,h=E*p-d,u=l*m,s>=0)if(h>=-u)if(u>=h){var T=1/m;s*=T,h*=T,c=s*(s+E*h+2*p)+h*(E*s+h+2*d)+f}else h=l,s=Math.max(0,-(E*h+p)),c=-s*s+h*(h+2*d)+f;else h=-l,s=Math.max(0,-(E*h+p)),c=-s*s+h*(h+2*d)+f;else-u>=h?(s=Math.max(0,-(-E*l+p)),h=s>0?-l:Math.min(Math.max(-l,-d),l),c=-s*s+h*(h+2*d)+f):u>=h?(s=0,h=Math.min(Math.max(-l,-d),l),c=h*(h+2*d)+f):(s=Math.max(0,-(E*l+p)),h=s>0?l:Math.min(Math.max(-l,-d),l),c=-s*s+h*(h+2*d)+f);else h=E>0?-l:l,s=Math.max(0,-(E*h+p)),c=-s*s+h*(h+2*d)+f;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(h).add(e),c}}(),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},intersectSphere:function(){var e=new THREE.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),n=e.dot(e)-i*i,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=i-a,h=i+a;return 0>s&&0>h?null:0>s?this.at(h,r):this.at(s,r)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var r=e.normal.dot(this.direction);return 0>r*t?!0:!1},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t; +return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},isIntersectionBox:function(){var e=new THREE.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(e,t){var r,i,n,o,a,s,h=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,l=this.origin;return h>=0?(r=(e.min.x-l.x)*h,i=(e.max.x-l.x)*h):(r=(e.max.x-l.x)*h,i=(e.min.x-l.x)*h),c>=0?(n=(e.min.y-l.y)*c,o=(e.max.y-l.y)*c):(n=(e.max.y-l.y)*c,o=(e.min.y-l.y)*c),r>o||n>i?null:((n>r||r!==r)&&(r=n),(i>o||i!==i)&&(i=o),u>=0?(a=(e.min.z-l.z)*u,s=(e.max.z-l.z)*u):(a=(e.max.z-l.z)*u,s=(e.min.z-l.z)*u),r>s||a>i?null:((a>r||r!==r)&&(r=a),(i>s||i!==i)&&(i=s),0>i?null:this.at(r>=0?r:i,t)))},intersectTriangle:function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,i=new THREE.Vector3;return function(n,o,a,s,h){t.subVectors(o,n),r.subVectors(a,n),i.crossVectors(t,r);var c,u=this.direction.dot(i);if(u>0){if(s)return null;c=1}else{if(!(0>u))return null;c=-1,u=-u}e.subVectors(this.origin,n);var l=c*this.direction.dot(r.crossVectors(e,r));if(0>l)return null;var E=c*this.direction.dot(t.cross(e));if(0>E)return null;if(l+E>u)return null;var p=-c*e.dot(i);return 0>p?null:this.at(p/u,h)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},THREE.Sphere=function(e,t){this.center=void 0!==e?e:new THREE.Vector3,this.radius=void 0!==t?t:0},THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new THREE.Box3;return function(t,r){var i=this.center;void 0!==r?i.copy(r):e.setFromPoints(t).center(i);for(var n=0,o=0,a=t.length;a>o;o++)n=Math.max(n,i.distanceToSquared(t[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),i=t||new THREE.Vector3;return i.copy(e),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new THREE.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},THREE.Frustum=function(e,t,r,i,n,o){this.planes=[void 0!==e?e:new THREE.Plane,void 0!==t?t:new THREE.Plane,void 0!==r?r:new THREE.Plane,void 0!==i?i:new THREE.Plane,void 0!==n?n:new THREE.Plane,void 0!==o?o:new THREE.Plane]},THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(e,t,r,i,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],h=r[5],c=r[6],u=r[7],l=r[8],E=r[9],p=r[10],d=r[11],f=r[12],m=r[13],T=r[14],v=r[15];return t[0].setComponents(a-i,u-s,d-l,v-f).normalize(),t[1].setComponents(a+i,u+s,d+l,v+f).normalize(),t[2].setComponents(a+n,u+h,d+E,v+m).normalize(),t[3].setComponents(a-n,u-h,d-E,v-m).normalize(),t[4].setComponents(a-o,u-c,d-p,v-T).normalize(),t[5].setComponents(a+o,u+c,d+p,v+T).normalize(),this},intersectsObject:function(){var e=new THREE.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;6>n;n++){var o=t[n].distanceToPoint(r);if(i>o)return!1}return!0},intersectsBox:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){var o=i[n];e.x=o.normal.x>0?r.min.x:r.max.x,t.x=o.normal.x>0?r.max.x:r.min.x,e.y=o.normal.y>0?r.min.y:r.max.y,t.y=o.normal.y>0?r.max.y:r.min.y,e.z=o.normal.z>0?r.min.z:r.max.z,t.z=o.normal.z>0?r.max.z:r.min.z;var a=o.distanceToPoint(e),s=o.distanceToPoint(t);if(0>a&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}},THREE.Plane=function(e,t){this.normal=void 0!==e?e:new THREE.Vector3(1,0,0),this.constant=void 0!==t?t:0},THREE.Plane.prototype={constructor:THREE.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r,i,n){var o=e.subVectors(n,i).cross(t.subVectors(r,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e),i=t||new THREE.Vector3;return i.copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&r>0||0>r&&t>0},intersectLine:function(){var e=new THREE.Vector3;return function(t,r){var i=r||new THREE.Vector3,n=t.delta(e),o=this.normal.dot(n);if(0===o)return 0===this.distanceToPoint(t.start)?i.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/o;return 0>a||a>1?void 0:i.copy(n).multiplyScalar(a).add(t.start)}}(),coplanarPoint:function(e){var t=e||new THREE.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),a=e.copy(this.normal).applyMatrix3(o),s=this.coplanarPoint(t);return s.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},THREE.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),e=15&i,i>>=4,r[n]=t[19===n?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},THREE.Spline=function(e){function t(e,t,r,i,n,o,a){var s=.5*(r-e),h=.5*(i-t);return(2*(t-r)+s+h)*a+(-3*(t-r)-2*s-h)*o+s*n+t}this.points=e;var r,i,n,o,a,s,h,c,u,l=[],E={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;tthis.points.length-2?this.points.length-1:i+1,l[3]=i>this.points.length-3?this.points.length-1:i+2,s=this.points[l[0]],h=this.points[l[1]],c=this.points[l[2]],u=this.points[l[3]],o=n*n,a=n*o,E.x=t(s.x,h.x,c.x,u.x,n,o,a),E.y=t(s.y,h.y,c.y,u.y,n,o,a),E.z=t(s.z,h.z,c.z,u.z,n,o,a),E},this.getControlPointsArray=function(){var e,t,r=this.points.length,i=[];for(e=0;r>e;e++)t=this.points[e],i[e]=[t.x,t.y,t.z];return i},this.getLength=function(e){var t,r,i,n,o=0,a=0,s=0,h=new THREE.Vector3,c=new THREE.Vector3,u=[],l=0;for(u[0]=0,e||(e=100),i=this.points.length*e,h.copy(this.points[0]),t=1;i>t;t++)r=t/i,n=this.getPoint(r),c.copy(n),l+=c.distanceTo(h),h.copy(n),o=(this.points.length-1)*r,a=Math.floor(o),a!==s&&(u[a]=l,s=a);return u[u.length]=l,{chunks:u,total:l}},this.reparametrizeByArcLength=function(e){var t,r,i,n,o,a,s,h,c=[],u=new THREE.Vector3,l=this.getLength();for(c.push(u.copy(this.points[0]).clone()),t=1;tr;r++)i=n+r*(1/s)*(o-n),h=this.getPoint(i),c.push(u.copy(h).clone());c.push(u.copy(this.points[t]).clone())}this.points=c}},THREE.Triangle=function(e,t,r){this.a=void 0!==e?e:new THREE.Vector3,this.b=void 0!==t?t:new THREE.Vector3,this.c=void 0!==r?r:new THREE.Vector3},THREE.Triangle.normal=function(){var e=new THREE.Vector3;return function(t,r,i,n){var o=n||new THREE.Vector3;o.subVectors(i,r),e.subVectors(t,r),o.cross(e);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),THREE.Triangle.barycoordFromPoint=function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3;return function(i,n,o,a,s){e.subVectors(a,n),t.subVectors(o,n),r.subVectors(i,n);var h=e.dot(e),c=e.dot(t),u=e.dot(r),l=t.dot(t),E=t.dot(r),p=h*l-c*c,d=s||new THREE.Vector3;if(0===p)return d.set(-2,-1,-1);var f=1/p,m=(l*u-c*E)*f,T=(h*E-c*u)*f;return d.set(1-m-T,T,m)}}(),THREE.Triangle.containsPoint=function(){var e=new THREE.Vector3;return function(t,r,i,n){var o=THREE.Triangle.barycoordFromPoint(t,r,i,n,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new THREE.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return THREE.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new THREE.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return THREE.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return THREE.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},THREE.Channels=function(){this.mask=1},THREE.Channels.prototype={constructor:THREE.Channels,set:function(e){this.mask=1<o;o++)i[o]=r[o];for(var o=0;n>o;o++)i[o].call(this,e)}}}},function(e){function t(e,t){return e.distance-t.distance}function r(e,t,i,n){if(e.visible!==!1&&(e.raycast(t,i),n===!0))for(var o=e.children,a=0,s=o.length;s>a;a++)r(o[a],t,i,!0)}e.Raycaster=function(t,r,i,n){this.ray=new e.Ray(t,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,i){var n=[];return r(e,this,n,i),n.sort(t),n},intersectObjects:function(e,i){var n=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=e.length;a>o;o++)r(e[o],this,n,i);return n.sort(t),n}}}(THREE),THREE.Object3D=function(){function e(){n.setFromEuler(i,!1)}function t(){i.setFromQuaternion(n,void 0,!1)}Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.channels=new THREE.Channels,this.children=[],this.up=THREE.Object3D.DefaultUp.clone();var r=new THREE.Vector3,i=new THREE.Euler,n=new THREE.Quaternion,o=new THREE.Vector3(1,1,1);i.onChange(e),n.onChange(t),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:i},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new THREE.Matrix4},normalMatrix:{value:new THREE.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixAutoUpdate=THREE.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0),THREE.Object3D.DefaultMatrixAutoUpdate=!0,THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set eulerOrder(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e},get useQuaternion(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set renderDepth(e){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new THREE.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new THREE.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},translateX:function(){var e=new THREE.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new THREE.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new THREE.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new THREE.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new THREE.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t1)for(var t=0;tr;r++){var n=this.children[r],o=n.getObjectByProperty(e,t);if(void 0!==o)return o}return void 0},getWorldPosition:function(e){var t=e||new THREE.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(r){var i=r||new THREE.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,i,t),i}}(),getWorldRotation:function(){var e=new THREE.Quaternion;return function(t){var r=t||new THREE.Euler;return this.getWorldQuaternion(e),r.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new THREE.Vector3,t=new THREE.Quaternion;return function(r){var i=r||new THREE.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,i),i}}(),getWorldDirection:function(){var e=new THREE.Quaternion;return function(t){var r=t||new THREE.Vector3;return this.getWorldQuaternion(e),r.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;r>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e,i={};r&&(e={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var n={};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),n.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),n.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),n.material=this.material.uuid),this.children.length>0){n.children=[];for(var o=0;o0&&(i.geometries=a),s.length>0&&(i.materials=s),h.length>0&&(i.textures=h),c.length>0&&(i.images=c)}return i.object=n,i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.rotationAutoUpdate=e.rotationAutoUpdate,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var r=0;rt;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,r=e.vertexColors.length;r>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},THREE.Face4=function(e,t,r,i,n,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new THREE.Face3(e,t,r,n,o,a)},THREE.BufferAttribute=function(e,t){this.uuid=THREE.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.array.length/this.itemSize},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;n>i;i++)this.array[e+i]=t.array[r+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new THREE.Color),t[r++]=o.r,t[r++]=o.g,t[r++]=o.b}return this},copyIndicesArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];t[r++]=o.a,t[r++]=o.b,t[r++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new THREE.Vector2),t[r++]=o.x,t[r++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new THREE.Vector3),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new THREE.Vector4),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z,t[r++]=o.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},THREE.Int8Attribute=function(e,t){return new THREE.BufferAttribute(new Int8Array(e),t)},THREE.Uint8Attribute=function(e,t){return new THREE.BufferAttribute(new Uint8Array(e),t)},THREE.Uint8ClampedAttribute=function(e,t){return new THREE.BufferAttribute(new Uint8ClampedArray(e),t)},THREE.Int16Attribute=function(e,t){return new THREE.BufferAttribute(new Int16Array(e),t)},THREE.Uint16Attribute=function(e,t){return new THREE.BufferAttribute(new Uint16Array(e),t)},THREE.Int32Attribute=function(e,t){return new THREE.BufferAttribute(new Int32Array(e),t)},THREE.Uint32Attribute=function(e,t){return new THREE.BufferAttribute(new Uint32Array(e),t)},THREE.Float32Attribute=function(e,t){return new THREE.BufferAttribute(new Float32Array(e),t)},THREE.Float64Attribute=function(e,t){return new THREE.BufferAttribute(new Float64Array(e),t)},THREE.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new THREE.BufferAttribute(e,t).setDynamic(!0)},THREE.InstancedBufferAttribute=function(e,t,r){THREE.BufferAttribute.call(this,e,t),this.meshPerAttribute=r||1},THREE.InstancedBufferAttribute.prototype=Object.create(THREE.BufferAttribute.prototype),THREE.InstancedBufferAttribute.prototype.constructor=THREE.InstancedBufferAttribute,THREE.InstancedBufferAttribute.prototype.copy=function(e){return THREE.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},THREE.InterleavedBuffer=function(e,t){this.uuid=THREE.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},THREE.InterleavedBuffer.prototype={constructor:THREE.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;n>i;i++)this.array[e+i]=t.array[r+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},THREE.InstancedInterleavedBuffer=function(e,t,r){THREE.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=r||1},THREE.InstancedInterleavedBuffer.prototype=Object.create(THREE.InterleavedBuffer.prototype),THREE.InstancedInterleavedBuffer.prototype.constructor=THREE.InstancedInterleavedBuffer,THREE.InstancedInterleavedBuffer.prototype.copy=function(e){return THREE.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},THREE.InterleavedBufferAttribute=function(e,t,r){this.uuid=THREE.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=r},THREE.InterleavedBufferAttribute.prototype={constructor:THREE.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.array.length/this.data.stride},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}},THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]], +this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(e){for(var t=(new THREE.Matrix3).getNormalMatrix(e),r=0,i=this.vertices.length;i>r;r++){var n=this.vertices[r];n.applyMatrix4(e)}for(var r=0,i=this.faces.length;i>r;r++){var o=this.faces[r];o.normal.applyMatrix3(t).normalize();for(var a=0,s=o.vertexNormals.length;s>a;a++)o.vertexNormals[a].applyMatrix3(t).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},rotateX:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new THREE.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,i){var n=void 0!==a?[u[e].clone(),u[t].clone(),u[i].clone()]:[],o=void 0!==s?[r.colors[e].clone(),r.colors[t].clone(),r.colors[i].clone()]:[],p=new THREE.Face3(e,t,i,n,o);r.faces.push(p),void 0!==h&&r.faceVertexUvs[0].push([l[e].clone(),l[t].clone(),l[i].clone()]),void 0!==c&&r.faceVertexUvs[1].push([E[e].clone(),E[t].clone(),E[i].clone()])}var r=this,i=null!==e.index?e.index.array:void 0,n=e.attributes,o=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,h=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var u=[],l=[],E=[],p=0,d=0,f=0;p0)for(var p=0;pd;d+=3)t(i[d],i[d+1],i[d+2]);else for(var p=0;pr;r++){var n=this.faces[r],o=this.vertices[n.a],a=this.vertices[n.b],s=this.vertices[n.c];e.subVectors(s,a),t.subVectors(o,a),e.cross(t),e.normalize(),n.normal.copy(e)}},computeVertexNormals:function(e){var t,r,i,n,o,a;for(a=new Array(this.vertices.length),t=0,r=this.vertices.length;r>t;t++)a[t]=new THREE.Vector3;if(e){var s,h,c,u=new THREE.Vector3,l=new THREE.Vector3;for(i=0,n=this.faces.length;n>i;i++)o=this.faces[i],s=this.vertices[o.a],h=this.vertices[o.b],c=this.vertices[o.c],u.subVectors(c,h),l.subVectors(s,h),u.cross(l),a[o.a].add(u),a[o.b].add(u),a[o.c].add(u)}else for(i=0,n=this.faces.length;n>i;i++)o=this.faces[i],a[o.a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(t=0,r=this.vertices.length;r>t;t++)a[t].normalize();for(i=0,n=this.faces.length;n>i;i++){o=this.faces[i];var E=o.vertexNormals;3===E.length?(E[0].copy(a[o.a]),E[1].copy(a[o.b]),E[2].copy(a[o.c])):(E[0]=a[o.a].clone(),E[1]=a[o.b].clone(),E[2]=a[o.c].clone())}},computeMorphNormals:function(){var e,t,r,i,n;for(r=0,i=this.faces.length;i>r;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;t>e;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var o=new THREE.Geometry;for(o.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var a,s,h=this.morphNormals[e].faceNormals,c=this.morphNormals[e].vertexNormals;for(r=0,i=this.faces.length;i>r;r++)a=new THREE.Vector3,s={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},h.push(a),c.push(s)}var u=this.morphNormals[e];o.vertices=this.morphTargets[e].vertices,o.computeFaceNormals(),o.computeVertexNormals();var a,s;for(r=0,i=this.faces.length;i>r;r++)n=this.faces[r],a=u.faceNormals[r],s=u.vertexNormals[r],a.copy(n.normal),s.a.copy(n.vertexNormals[0]),s.b.copy(n.vertexNormals[1]),s.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;i>r;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,i=t.length;i>r;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e instanceof THREE.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var i,n=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,h=e.faces,c=this.faceVertexUvs[0],u=e.faceVertexUvs[0];void 0===r&&(r=0),void 0!==t&&(i=(new THREE.Matrix3).getNormalMatrix(t));for(var l=0,E=a.length;E>l;l++){var p=a[l],d=p.clone();void 0!==t&&d.applyMatrix4(t),o.push(d)}for(l=0,E=h.length;E>l;l++){var f,m,T,v=h[l],g=v.vertexNormals,y=v.vertexColors;f=new THREE.Face3(v.a+n,v.b+n,v.c+n),f.normal.copy(v.normal),void 0!==i&&f.normal.applyMatrix3(i).normalize();for(var R=0,H=g.length;H>R;R++)m=g[R].clone(),void 0!==i&&m.applyMatrix3(i).normalize(),f.vertexNormals.push(m);f.color.copy(v.color);for(var R=0,H=y.length;H>R;R++)T=y[R],f.vertexColors.push(T.clone());f.materialIndex=v.materialIndex+r,s.push(f)}for(l=0,E=u.length;E>l;l++){var x=u[l],b=[];if(void 0!==x){for(var R=0,H=x.length;H>R;R++)b.push(x[R].clone());c.push(b)}}},mergeMesh:function(e){return e instanceof THREE.Mesh==!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,i,n,o,a,s,h={},c=[],u=[],l=4,E=Math.pow(10,l);for(r=0,i=this.vertices.length;i>r;r++)e=this.vertices[r],t=Math.round(e.x*E)+"_"+Math.round(e.y*E)+"_"+Math.round(e.z*E),void 0===h[t]?(h[t]=r,c.push(this.vertices[r]),u[r]=c.length-1):u[r]=u[h[t]];var p=[];for(r=0,i=this.faces.length;i>r;r++){n=this.faces[r],n.a=u[n.a],n.b=u[n.b],n.c=u[n.c],o=[n.a,n.b,n.c];for(var d=-1,f=0;3>f;f++)if(o[f]===o[(f+1)%3]){d=f,p.push(r);break}}for(r=p.length-1;r>=0;r--){var m=p[r];for(this.faces.splice(m,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(m,1)}var T=this.vertices.length-c.length;return this.vertices=c,T},sortFacesByMaterialIndex:function(){function e(e,t){return e.materialIndex-t.materialIndex}for(var t=this.faces,r=t.length,i=0;r>i;i++)t[i]._id=i;t.sort(e);var n,o,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===r&&(n=[]),s&&s.length===r&&(o=[]);for(var i=0;r>i;i++){var h=t[i]._id;n&&n.push(a[h]),o&&o.push(s[h])}n&&(this.faceVertexUvs[0]=n),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){function e(e,t,r){return r?e|1<0,H=T.vertexNormals.length>0,x=1!==T.color.r||1!==T.color.g||1!==T.color.b,b=T.vertexColors.length>0,w=0;if(w=e(w,0,0),w=e(w,1,v),w=e(w,2,g),w=e(w,3,y),w=e(w,4,R),w=e(w,5,H),w=e(w,6,x),w=e(w,7,b),u.push(w),u.push(T.a,T.b,T.c),y){var M=this.faceVertexUvs[0][h];u.push(i(M[0]),i(M[1]),i(M[2]))}if(R&&u.push(t(T.normal)),H){var S=T.vertexNormals;u.push(t(S[0]),t(S[1]),t(S[2]))}if(x&&u.push(r(T.color)),b){var _=T.vertexColors;u.push(r(_[0]),r(_[1]),r(_[2]))}}return n.data={},n.data.vertices=s,n.data.normals=l,p.length>0&&(n.data.colors=p),f.length>0&&(n.data.uvs=[f]),n.data.faces=u,n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,r=0,i=t.length;i>r;r++)this.vertices.push(t[r].clone());for(var n=e.faces,r=0,i=n.length;i>r;r++)this.faces.push(n[r].clone());for(var r=0,i=e.faceVertexUvs.length;i>r;r++){var o=e.faceVertexUvs[r];void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var a=0,s=o.length;s>a;a++){for(var h=o[a],c=[],u=0,l=h.length;l>u;u++){var E=h[u];c.push(E.clone())}this.faceVertexUvs[r].push(c)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),THREE.GeometryIdCount=0,THREE.DirectGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1},THREE.DirectGeometry.prototype={constructor:THREE.DirectGeometry,computeBoundingBox:THREE.Geometry.prototype.computeBoundingBox,computeBoundingSphere:THREE.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){for(var t,r,i=[],n=e.faces,o=0;o0,o=i[1]&&i[1].length>0,a=e.morphTargets,s=a.length;if(s>0){for(var h=[],c=0;s>c;c++)h[c]=[];this.morphTargets.position=h}var u=e.morphNormals,l=u.length;if(l>0){for(var E=[],c=0;l>c;c++)E[c]=[];this.morphTargets.normal=E}for(var p=e.skinIndices,d=e.skinWeights,f=p.length===r.length,m=d.length===r.length,c=0;cx;x++){var b=a[x].vertices;h[x].push(b[T.a],b[T.b],b[T.c])}for(var x=0;l>x;x++){var w=u[x].vertexNormals[c];E[x].push(w.a,w.b,w.c)}f&&this.skinIndices.push(p[T.a],p[T.b],p[T.c]),m&&this.skinWeights.push(d[T.a],d[T.b],d[T.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype),THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t){return t instanceof THREE.BufferAttribute==!1&&t instanceof THREE.InterleavedBufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new THREE.BufferAttribute(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):void(this.attributes[e]=t)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){delete this.attributes[e]},get drawcalls(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups},get offsets(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups},addDrawCall:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var i=(new THREE.Matrix3).getNormalMatrix(e);i.applyToVector3Array(r.array),r.needsUpdate=!0}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new THREE.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new THREE.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new THREE.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof THREE.Points||e instanceof THREE.Line){var r=new THREE.Float32Attribute(3*t.vertices.length,3),i=new THREE.Float32Attribute(3*t.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var n=new THREE.Float32Attribute(t.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof THREE.Mesh&&t instanceof THREE.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof THREE.Mesh){var r=t.__directGeometry;if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}if(t.verticesNeedUpdate===!0){var i=this.attributes.position;void 0!==i&&(i.copyVector3sArray(t.vertices),i.needsUpdate=!0),t.verticesNeedUpdate=!1}if(t.normalsNeedUpdate===!0){var i=this.attributes.normal;void 0!==i&&(i.copyVector3sArray(t.normals),i.needsUpdate=!0),t.normalsNeedUpdate=!1}if(t.colorsNeedUpdate===!0){var i=this.attributes.color;void 0!==i&&(i.copyColorsArray(t.colors),i.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){var i=this.attributes.uv;void 0!==i&&(i.copyVector2sArray(t.uvs),i.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){var i=this.attributes.lineDistance;void 0!==i&&(i.copyArray(t.lineDistances),i.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new THREE.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new THREE.BufferAttribute(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var r=new Float32Array(3*e.normals.length);this.addAttribute("normal",new THREE.BufferAttribute(r,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new THREE.BufferAttribute(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new THREE.BufferAttribute(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new THREE.BufferAttribute(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var a=e.vertices.length>65535?Uint32Array:Uint16Array,s=new a(3*e.indices.length);this.setIndex(new THREE.BufferAttribute(s,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var h in e.morphTargets){for(var c=[],u=e.morphTargets[h],l=0,E=u.length;E>l;l++){var p=u[l],d=new THREE.Float32Attribute(3*p.length,3);c.push(d.copyVector3sArray(p))}this.morphAttributes[h]=c}if(e.skinIndices.length>0){var f=new THREE.Float32Attribute(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new THREE.Float32Attribute(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){var e=new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.attributes.position.array;if(t){var r=this.boundingBox;r.makeEmpty();for(var i=0,n=t.length;n>i;i+=3)e.fromArray(t,i),r.expandByPoint(e)}(void 0===t||0===t.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}}(),computeBoundingSphere:function(){var e=new THREE.Box3,t=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var r=this.attributes.position.array;if(r){e.makeEmpty();for(var i=this.boundingSphere.center,n=0,o=r.length;o>n;n+=3)t.fromArray(r,n),e.expandByPoint(t);e.center(i);for(var a=0,n=0,o=r.length;o>n;n+=3)t.fromArray(r,n),a=Math.max(a,i.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,r=this.groups;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(i.length),3));else for(var n=t.normal.array,o=0,a=n.length;a>o;o++)n[o]=0;var s,h,c,n=t.normal.array,u=new THREE.Vector3,l=new THREE.Vector3,E=new THREE.Vector3,p=new THREE.Vector3,d=new THREE.Vector3;if(e){var f=e.array;0===r.length&&this.addGroup(0,f.length);for(var m=0,T=r.length;T>m;++m)for(var v=r[m],g=v.start,y=v.count,o=g,a=g+y;a>o;o+=3)s=3*f[o+0],h=3*f[o+1],c=3*f[o+2],u.fromArray(i,s),l.fromArray(i,h),E.fromArray(i,c),p.subVectors(E,l),d.subVectors(u,l),p.cross(d),n[s]+=p.x,n[s+1]+=p.y,n[s+2]+=p.z,n[h]+=p.x,n[h+1]+=p.y,n[h+2]+=p.z,n[c]+=p.x,n[c+1]+=p.y,n[c+2]+=p.z}else for(var o=0,a=i.length;a>o;o+=9)u.fromArray(i,o),l.fromArray(i,o+3),E.fromArray(i,o+6),p.subVectors(E,l),d.subVectors(u,l),p.cross(d),n[o]=p.x,n[o+1]=p.y,n[o+2]=p.z,n[o+3]=p.x,n[o+4]=p.y,n[o+5]=p.z,n[o+6]=p.x,n[o+7]=p.y,n[o+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(e){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},merge:function(e,t){if(e instanceof THREE.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var r=this.attributes;for(var i in r)if(void 0!==e.attributes[i])for(var n=r[i],o=n.array,a=e.attributes[i],s=a.array,h=a.itemSize,c=0,u=h*t;co;o+=3)e=n[o],t=n[o+1],r=n[o+2],i=1/Math.sqrt(e*e+t*t+r*r),n[o]*=i,n[o+1]*=i,n[o+2]*=i},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};var i=this.index;if(null!==i){var n=Array.prototype.slice.call(i.array);e.data.index={type:i.array.constructor.name,array:n}}var o=this.attributes;for(var r in o){var a=o[r],n=Array.prototype.slice.call(a.array);e.data.attributes[r]={itemSize:a.itemSize,type:a.array.constructor.name,array:n}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var h=this.boundingSphere;return null!==h&&(e.data.boundingSphere={center:h.center.toArray(),radius:h.radius}),e},clone:function(){return(new this.constructor).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var h=o[a];this.addGroup(h.start,h.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),THREE.BufferGeometry.MaxIndex=65535,THREE.InstancedBufferGeometry=function(){THREE.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},THREE.InstancedBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.InstancedBufferGeometry.prototype.constructor=THREE.InstancedBufferGeometry,THREE.InstancedBufferGeometry.prototype.addGroup=function(e,t,r){this.groups.push({start:e,count:t,instances:r})},THREE.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var h=o[a];this.addGroup(h.start,h.count,h.instances)}return this},THREE.EventDispatcher.prototype.apply(THREE.InstancedBufferGeometry.prototype),THREE.AnimationAction=function(e,t,r,i,n){if(void 0===e)throw new Error("clip is null");this.clip=e,this.localRoot=null,this.startTime=t||0,this.timeScale=r||1,this.weight=i||1,this.loop=n||THREE.LoopRepeat,this.loopCount=0,this.enabled=!0,this.actionTime=-this.startTime,this.clipTime=0,this.propertyBindings=[]},THREE.AnimationAction.prototype={constructor:THREE.AnimationAction,setLocalRoot:function(e){return this.localRoot=e,this},updateTime:function(e){var t=this.clipTime,r=this.loopCount,i=(this.actionTime,this.clip.duration);if(this.actionTime=this.actionTime+e,this.loop===THREE.LoopOnce)return this.loopCount=0,this.clipTime=Math.min(Math.max(this.actionTime,0),i),this.clipTime!==t&&(this.clipTime===i?this.mixer.dispatchEvent({type:"finished",action:this,direction:1}):0===this.clipTime&&this.mixer.dispatchEvent({type:"finished",action:this,direction:-1})),this.clipTime;this.loopCount=Math.floor(this.actionTime/i);var n=this.actionTime-this.loopCount*i;return n%=i,this.loop==THREE.LoopPingPong&&1===Math.abs(this.loopCount%2)&&(n=i-n),this.clipTime=n,this.loopCount!==r&&this.mixer.dispatchEvent({type:"loop",action:this,loopDelta:this.loopCount-this.loopCount}),this.clipTime},syncWith:function(e){return this.actionTime=e.actionTime,this.timeScale=e.timeScale,this},warpToDuration:function(e){return this.timeScale=this.clip.duration/e,this},init:function(e){return this.clipTime=e-this.startTime,this},update:function(e){this.updateTime(e);var t=this.clip.getAt(this.clipTime);return t},getTimeScaleAt:function(e){return this.timeScale.getAt?this.timeScale.getAt(e):this.timeScale},getWeightAt:function(e){return this.weight.getAt?this.weight.getAt(e):this.weight}},THREE.AnimationClip=function(e,t,r){if(this.name=e,this.tracks=r,this.duration=void 0!==t?t:-1,this.duration<0)for(var i=0;io;o++){var a=[];a.push({time:(o+i-1)%i,value:0}),a.push({time:o,value:1}),a.push({time:(o+1)%i,value:0}),a.sort(THREE.KeyframeTrack.keyComparer),0===a[0].time&&a.push({time:i,value:a[0].value}),n.push(new THREE.NumberKeyframeTrack(".morphTargetInfluences["+t[o].name+"]",a).scale(1/r))}return new THREE.AnimationClip(e,-1,n)},THREE.AnimationClip.findByName=function(e,t){for(var r=0;rn;n++){var a=e[n],s=a.name.match(i);if(s&&s.length>1){var h=s[1],c=r[h];c||(r[h]=c=[]),c.push(a)}}var u=[];for(var h in r)u.push(THREE.AnimationClip.CreateFromMorphTargetSequence(h,r[h],t));return u},THREE.AnimationClip.parse=function(e){for(var t=[],r=0;r0?new i(e,o):null},n=[],o=e.name||"default",a=e.length||-1,s=e.fps||30,h=e.hierarchy||[],c=0;cr?e:t},lerp_boolean_immediate:function(e,t,r){return e},lerp_string:function(e,t,r){return.5>r?e:t},lerp_string_immediate:function(e,t,r){return e},getLerpFunc:function(e,t){if(void 0===e||null===e)throw new Error("examplarValue is null");var r=typeof e;switch(r){case"object":if(e.lerp)return THREE.AnimationUtils.lerp_object;if(e.slerp)return THREE.AnimationUtils.slerp_object;break;case"number":return THREE.AnimationUtils.lerp_number;case"boolean":return t?THREE.AnimationUtils.lerp_boolean:THREE.AnimationUtils.lerp_boolean_immediate;case"string":return t?THREE.AnimationUtils.lerp_string:THREE.AnimationUtils.lerp_string_immediate}}},THREE.KeyframeTrack=function(e,t){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keys in track named "+e);this.name=e,this.keys=t,this.lastIndex=0,this.validate(),this.optimize()},THREE.KeyframeTrack.prototype={constructor:THREE.KeyframeTrack,getAt:function(e){for(;this.lastIndex=this.keys[this.lastIndex].time;)this.lastIndex++;for(;this.lastIndex>0&&e=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 t=this.keys[this.lastIndex-1];if(this.setResult(t.value),t.constantToNext)return this.result;var r=this.keys[this.lastIndex],i=(e-t.time)/(r.time-t.time);return this.result=this.lerpValues(this.result,r.value,i),this.result},shift:function(e){if(0!==e)for(var t=0;t0&&this.keys[i]>=t;i++)n++;return r+n>0&&(this.keys=this.keys.splice(r,this.keys.length-n-r)),this},validate:function(){var e=null;if(0===this.keys.length)return void console.error(" track is empty, no keys",this);for(var t=0;tr.time)return void console.error(" key.time is less than previous key time, out of order keys",this,t,r,e);e=r}return this},optimize:function(){var e=[],t=this.keys[0];e.push(t);for(var r=(THREE.AnimationUtils.getEqualsFunc(t.value),1);r0&&(null===this.cumulativeValue&&(this.cumulativeValue=THREE.AnimationUtils.clone(e)),this.cumulativeWeight=t);else{var r=t/(this.cumulativeWeight+t);this.cumulativeValue=this.lerpValue(this.cumulativeValue,e,r),this.cumulativeWeight+=t}},unbind:function(){this.isBound&&(this.setValue(this.originalValue),this.setValue=null,this.getValue=null,this.lerpValue=null,this.equalsValue=null,this.triggerDirty=null,this.isBound=!1)},bind:function(){if(!this.isBound){var e=this.node;if(!e)return void console.error(" trying to update node for track: "+this.trackName+" but it wasn't found.");if(this.objectName){if("materials"===this.objectName){if(!e.material)return void console.error(" can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials}else if("bones"===this.objectName){if(!e.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var t=0;t0){if(this.cumulativeWeight<1){var e=1-this.cumulativeWeight,t=e/(this.cumulativeWeight+e);this.cumulativeValue=this.lerpValue(this.cumulativeValue,this.originalValue,t)}var r=this.setValue(this.cumulativeValue);r&&this.triggerDirty&&this.triggerDirty(),this.cumulativeValue=null,this.cumulativeWeight=0}}},THREE.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=t.exec(e);if(!r)throw new Error("cannot parse trackName at all: "+e);r.index===t.lastIndex&&t.lastIndex++;var i={directoryName:r[1],nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]};if(null===i.propertyName||0===i.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return i},THREE.PropertyBinding.findNode=function(e,t){function r(e){for(var r=0;rr?e:t},THREE.StringKeyframeTrack.prototype.compareValues=function(e,t){return e===t},THREE.StringKeyframeTrack.prototype.clone=function(){for(var e=[],t=0;tr?e:t},THREE.BooleanKeyframeTrack.prototype.compareValues=function(e,t){return e===t},THREE.BooleanKeyframeTrack.prototype.clone=function(){for(var e=[],t=0;tr;r+=2){var n=t[r],o=t[r+1];if(n.test(e))return o}return null}},THREE.XHRLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(e,t,r,i){var n=this,o=THREE.Cache.get(e);if(void 0!==o)return t&&setTimeout(function(){t(o)},0),o;var a=new XMLHttpRequest;return a.open("GET",e,!0),a.addEventListener("load",function(r){var i=r.target.response;THREE.Cache.add(e,i),t&&t(i),n.manager.itemEnd(e)},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),a.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.send(null),n.manager.itemStart(e),a},setResponseType:function(e){this.responseType=e},setCrossOrigin:function(e){this.crossOrigin=e},setWithCredentials:function(e){this.withCredentials=e}},THREE.ImageLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(e,t,r,i){var n=this,o=THREE.Cache.get(e);if(void 0!==o)return n.manager.itemStart(e),t?setTimeout(function(){t(o),n.manager.itemEnd(e)},0):n.manager.itemEnd(e),o;var a=document.createElement("img");return a.addEventListener("load",function(r){THREE.Cache.add(e,this),t&&t(this),n.manager.itemEnd(e)},!1),void 0!==r&&a.addEventListener("progress",function(e){r(e)},!1),a.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),n.manager.itemStart(e),a.src=e,a},setCrossOrigin:function(e){this.crossOrigin=e}},THREE.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.withCredentials=!1},THREE.JSONLoader.prototype={constructor:THREE.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(e,t,r,i){var n=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:THREE.Loader.prototype.extractUrlBase(e),a=new THREE.XHRLoader(this.manager);a.setCrossOrigin(this.crossOrigin),a.setWithCredentials(this.withCredentials),a.load(e,function(r){var i=JSON.parse(r),a=i.metadata;if(void 0!==a){if("object"===a.type)return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===a.type)return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}var s=n.parse(i,o);t(s.geometry,s.materials)})},setCrossOrigin:function(e){this.crossOrigin=e; +},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function r(t){function r(e,t){return e&1<i;i++)a.faceVertexUvs[i]=[]}for(s=0,h=P.length;h>s;)R=new THREE.Vector3,R.x=P[s++]*t,R.y=P[s++]*t,R.z=P[s++]*t,a.vertices.push(R);for(s=0,h=L.length;h>s;)if(p=L[s++],d=r(p,0),f=r(p,1),m=r(p,3),T=r(p,4),v=r(p,5),g=r(p,6),y=r(p,7),d){if(x=new THREE.Face3,x.a=L[s],x.b=L[s+1],x.c=L[s+3],b=new THREE.Face3,b.a=L[s+1],b.b=L[s+2],b.c=L[s+3],s+=4,f&&(E=L[s++],x.materialIndex=E,b.materialIndex=E),o=a.faces.length,m)for(i=0;V>i;i++)for(S=e.uvs[i],a.faceVertexUvs[i][o]=[],a.faceVertexUvs[i][o+1]=[],n=0;4>n;n++)l=L[s++],A=S[2*l],C=S[2*l+1],_=new THREE.Vector2(A,C),2!==n&&a.faceVertexUvs[i][o].push(_),0!==n&&a.faceVertexUvs[i][o+1].push(_);if(T&&(u=3*L[s++],x.normal.set(D[u++],D[u++],D[u]),b.normal.copy(x.normal)),v)for(i=0;4>i;i++)u=3*L[s++],M=new THREE.Vector3(D[u++],D[u++],D[u]),2!==i&&x.vertexNormals.push(M),0!==i&&b.vertexNormals.push(M);if(g&&(c=L[s++],w=k[c],x.color.setHex(w),b.color.setHex(w)),y)for(i=0;4>i;i++)c=L[s++],w=k[c],2!==i&&x.vertexColors.push(new THREE.Color(w)),0!==i&&b.vertexColors.push(new THREE.Color(w));a.faces.push(x),a.faces.push(b)}else{if(H=new THREE.Face3,H.a=L[s++],H.b=L[s++],H.c=L[s++],f&&(E=L[s++],H.materialIndex=E),o=a.faces.length,m)for(i=0;V>i;i++)for(S=e.uvs[i],a.faceVertexUvs[i][o]=[],n=0;3>n;n++)l=L[s++],A=S[2*l],C=S[2*l+1],_=new THREE.Vector2(A,C),a.faceVertexUvs[i][o].push(_);if(T&&(u=3*L[s++],H.normal.set(D[u++],D[u++],D[u])),v)for(i=0;3>i;i++)u=3*L[s++],M=new THREE.Vector3(D[u++],D[u++],D[u]),H.vertexNormals.push(M);if(g&&(c=L[s++],H.color.setHex(k[c])),y)for(i=0;3>i;i++)c=L[s++],H.vertexColors.push(new THREE.Color(k[c]));a.faces.push(H)}}function i(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;i>r;r+=t){var n=e.skinWeights[r],o=t>1?e.skinWeights[r+1]:0,s=t>2?e.skinWeights[r+2]:0,h=t>3?e.skinWeights[r+3]:0;a.skinWeights.push(new THREE.Vector4(n,o,s,h))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;i>r;r+=t){var c=e.skinIndices[r],u=t>1?e.skinIndices[r+1]:0,l=t>2?e.skinIndices[r+2]:0,E=t>3?e.skinIndices[r+3]:0;a.skinIndices.push(new THREE.Vector4(c,u,l,E))}a.bones=e.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&console.warn("When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match.")}function n(t){if(void 0!==e.morphTargets)for(var r=0,i=e.morphTargets.length;i>r;r++){a.morphTargets[r]={},a.morphTargets[r].name=e.morphTargets[r].name,a.morphTargets[r].vertices=[];for(var n=a.morphTargets[r].vertices,o=e.morphTargets[r].vertices,s=0,h=o.length;h>s;s+=3){var c=new THREE.Vector3;c.x=o[s]*t,c.y=o[s+1]*t,c.z=o[s+2]*t,n.push(c)}}if(void 0!==e.morphColors&&e.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=a.faces,l=e.morphColors[0].colors,r=0,i=u.length;i>r;r++)u[r].color.fromArray(l,3*r)}}function o(){var t=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var i=0;i0&&(a.animations=t)}var a=new THREE.Geometry,s=void 0!==e.scale?1/e.scale:1;if(r(s),i(),n(s),o(),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:a};var h=THREE.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:a,materials:h}}},THREE.LoadingManager=function(e,t,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){a++,n===!1&&void 0!==i.onStart&&i.onStart(e,o,a),n=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)}},THREE.DefaultLoadingManager=new THREE.LoadingManager,THREE.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(e,t,r,i){var n=this,o=new THREE.XHRLoader(n.manager);o.setCrossOrigin(this.crossOrigin),o.load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new THREE.BufferGeometry,r=e.data.index;if(void 0!==r){var i=new self[r.type](r.array);t.setIndex(new THREE.BufferAttribute(i,1))}var n=e.data.attributes;for(var o in n){var a=n[o],i=new self[a.type](a.array);t.addAttribute(o,new THREE.BufferAttribute(i,a.itemSize))}var s=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==s)for(var h=0,c=s.length;h!==c;++h){var u=s[h];t.addGroup(u.start,u.count)}var l=e.data.boundingSphere;if(void 0!==l){var E=new THREE.Vector3;void 0!==l.center&&E.fromArray(l.center),t.boundingSphere=new THREE.Sphere(E,l.radius)}return t}},THREE.MaterialLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.textures={}},THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(e,t,r,i){var n=this,o=new THREE.XHRLoader(n.manager);o.setCrossOrigin(this.crossOrigin),o.load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new THREE[e.type];if(t.uuid=e.uuid,void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),e.normalScale&&(t.normalScale=new THREE.Vector2(e.normalScale,e.normalScale)),void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=THREE.MultiplyOperation),e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var r=0,i=e.materials.length;i>r;r++)t.materials.push(this.parse(e.materials[r]));return t}},THREE.ObjectLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.texturePath=""},THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(e,t,r,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this,o=new THREE.XHRLoader(n.manager);o.setCrossOrigin(this.crossOrigin),o.load(e,function(e){n.parse(JSON.parse(e),t)},r,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(a)}),n=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,n),a=this.parseObject(e.object,r,o);return e.animations&&(a.animations=this.parseAnimations(e.animations)),(void 0===e.images||0===e.images.length)&&void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new THREE.JSONLoader,i=new THREE.BufferGeometryLoader,n=0,o=e.length;o>n;n++){var a,s=e[n];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new THREE[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"CubeGeometry":a=new THREE.BoxGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleBufferGeometry":a=new THREE.CircleBufferGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CircleGeometry":a=new THREE.CircleGeometry(s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":a=new THREE.CylinderGeometry(s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":a=new THREE.SphereGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"SphereBufferGeometry":a=new THREE.SphereBufferGeometry(s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":a=new THREE.DodecahedronGeometry(s.radius,s.detail);break;case"IcosahedronGeometry":a=new THREE.IcosahedronGeometry(s.radius,s.detail);break;case"OctahedronGeometry":a=new THREE.OctahedronGeometry(s.radius,s.detail);break;case"TetrahedronGeometry":a=new THREE.TetrahedronGeometry(s.radius,s.detail);break;case"RingGeometry":a=new THREE.RingGeometry(s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":a=new THREE.TorusGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":a=new THREE.TorusKnotGeometry(s.radius,s.tube,s.radialSegments,s.tubularSegments,s.p,s.q,s.heightScale);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=r.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),t[s.uuid]=a}return t},parseMaterials:function(e,t){var r={};if(void 0!==e){var i=new THREE.MaterialLoader;i.setTextures(t);for(var n=0,o=e.length;o>n;n++){var a=i.parse(e[n]);r[a.uuid]=a}}return r},parseAnimations:function(e){for(var t=[],r=0;r0){var o=new THREE.LoadingManager(t),a=new THREE.ImageLoader(o);a.setCrossOrigin(this.crossOrigin);for(var s=0,h=e.length;h>s;s++){var c=e[s],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:i.texturePath+c.url;n[c.uuid]=r(u)}}return n},parseTextures:function(e,t){function r(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),THREE[e])}var i={};if(void 0!==e)for(var n=0,o=e.length;o>n;n++){var a=e[n];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new THREE.Texture(t[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.mapping&&(s.mapping=r(a.mapping)),void 0!==a.offset&&(s.offset=new THREE.Vector2(a.offset[0],a.offset[1])),void 0!==a.repeat&&(s.repeat=new THREE.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=r(a.minFilter)),void 0!==a.magFilter&&(s.magFilter=r(a.magFilter)),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),Array.isArray(a.wrap)&&(s.wrapS=r(a.wrap[0]),s.wrapT=r(a.wrap[1])),i[a.uuid]=s}return i},parseObject:function(){var e=new THREE.Matrix4;return function(t,r,i){function n(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),r[e]}function o(e){return void 0===e?void 0:(void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e])}var a;switch(t.type){case"Scene":a=new THREE.Scene;break;case"PerspectiveCamera":a=new THREE.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":a=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":a=new THREE.AmbientLight(t.color);break;case"DirectionalLight":a=new THREE.DirectionalLight(t.color,t.intensity);break;case"PointLight":a=new THREE.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":a=new THREE.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent,t.decay);break;case"HemisphereLight":a=new THREE.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":a=new THREE.Mesh(n(t.geometry),o(t.material));break;case"LOD":a=new THREE.LOD;break;case"Line":a=new THREE.Line(n(t.geometry),o(t.material),t.mode);break;case"PointCloud":case"Points":a=new THREE.Points(n(t.geometry),o(t.material));break;case"Sprite":a=new THREE.Sprite(o(t.material));break;case"Group":a=new THREE.Group;break;default:a=new THREE.Object3D}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.children)for(var s in t.children)a.add(this.parseObject(t.children[s],r,i));if("LOD"===t.type)for(var h=t.levels,c=0;cu;++u)c(u);else s.load(e,function(e){var r=n._parser(e,!0);if(r.isCubemap)for(var i=r.mipmaps.length/r.mipmapCount,s=0;i>s;s++){o[s]={mipmaps:[]};for(var h=0;h0&&(t.alphaTest=this.alphaTest),this.wireframe===!0&&(t.wireframe=this.wireframe),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),t},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.side=e.side,this.opacity=e.opacity,this.transparent=e.transparent,this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.overdraw=e.overdraw,this.visible=e.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})},get wrapAround(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set wrapAround(e){console.warn("THREE."+this.type+": .wrapAround has been removed.")},get wrapRGB(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new THREE.Color}},THREE.EventDispatcher.prototype.apply(THREE.Material.prototype),THREE.MaterialIdCount=0,THREE.LineBasicMaterial=function(e){THREE.Material.call(this),this.type="LineBasicMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=THREE.NoColors,this.fog=!0,this.setValues(e)},THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial,THREE.LineBasicMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.vertexColors=e.vertexColors,this.fog=e.fog,this},THREE.LineDashedMaterial=function(e){THREE.Material.call(this),this.type="LineDashedMaterial",this.color=new THREE.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(e)},THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineDashedMaterial.prototype.constructor=THREE.LineDashedMaterial,THREE.LineDashedMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this.vertexColors=e.vertexColors,this.fog=e.fog,this},THREE.MeshBasicMaterial=function(e){THREE.Material.call(this),this.type="MeshBasicMaterial",this.color=new THREE.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial,THREE.MeshBasicMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},THREE.MeshLambertMaterial=function(e){THREE.Material.call(this),this.type="MeshLambertMaterial",this.color=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.map=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial,THREE.MeshLambertMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.emissive.copy(e.emissive),this.map=e.map,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},THREE.MeshPhongMaterial=function(e){THREE.Material.call(this),this.type="MeshPhongMaterial",this.color=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.specular=new THREE.Color(1118481),this.shininess=30,this.metal=!1,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=THREE.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial,THREE.MeshPhongMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.emissive.copy(e.emissive),this.specular.copy(e.specular),this.shininess=e.shininess,this.metal=e.metal,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissiveMap=e.emissiveMap,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},THREE.MeshDepthMaterial=function(e){THREE.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial,THREE.MeshDepthMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},THREE.MeshNormalMaterial=function(e){THREE.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial,THREE.MeshNormalMaterial.prototype.copy=function(e){return THREE.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},THREE.MultiMaterial=function(e){this.uuid=THREE.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},THREE.MultiMaterial.prototype={constructor:THREE.MultiMaterial,toJSON:function(){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},t=0,r=this.materials.length;r>t;t++)e.materials.push(this.materials[t].toJSON());return e.visible=this.visible,e},clone:function(){for(var e=new this.constructor,t=0;t2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var i=this.image;void 0===i.uuid&&(i.uuid=THREE.Math.generateUUID()),void 0===e.images[i.uuid]&&(e.images[i.uuid]={uuid:i.uuid,url:t(i)}),r.image=i.uuid}return e.textures[this.uuid]=r,r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===THREE.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case THREE.RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case THREE.ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case THREE.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case THREE.RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case THREE.ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case THREE.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype),THREE.TextureIdCount=0,THREE.CanvasTexture=function(e,t,r,i,n,o,a,s,h){THREE.Texture.call(this,e,t,r,i,n,o,a,s,h),this.needsUpdate=!0},THREE.CanvasTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CanvasTexture.prototype.constructor=THREE.CanvasTexture,THREE.CubeTexture=function(e,t,r,i,n,o,a,s,h){t=void 0!==t?t:THREE.CubeReflectionMapping,THREE.Texture.call(this,e,t,r,i,n,o,a,s,h),this.images=e,this.flipY=!1},THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CubeTexture.prototype.constructor=THREE.CubeTexture,THREE.CubeTexture.prototype.copy=function(e){return THREE.Texture.prototype.copy.call(this,e),this.images=e.images,this},THREE.CompressedTexture=function(e,t,r,i,n,o,a,s,h,c,u){THREE.Texture.call(this,null,o,a,s,h,c,i,n,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CompressedTexture.prototype.constructor=THREE.CompressedTexture,THREE.DataTexture=function(e,t,r,i,n,o,a,s,h,c,u){THREE.Texture.call(this,null,o,a,s,h,c,i,n,u),this.image={data:e,width:t,height:r},this.magFilter=void 0!==h?h:THREE.NearestFilter,this.minFilter=void 0!==c?c:THREE.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DataTexture.prototype.constructor=THREE.DataTexture,THREE.VideoTexture=function(e,t,r,i,n,o,a,s,h){function c(){requestAnimationFrame(c),e.readyState===e.HAVE_ENOUGH_DATA&&(u.needsUpdate=!0)}THREE.Texture.call(this,e,t,r,i,n,o,a,s,h),this.generateMipmaps=!1;var u=this;c()},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(e,t){THREE.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new THREE.Geometry,this.material=void 0!==t?t: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 e=new THREE.Matrix4,t=new THREE.Ray;return function(r,i){function n(e,n){var a=t.distanceSqToPoint(e);if(c>a){var s=t.closestPointToPoint(e);s.applyMatrix4(o.matrixWorld);var h=r.ray.origin.distanceTo(s);if(hr.far)return;i.push({distance:h,distanceToRay:Math.sqrt(a),point:s.clone(),index:n,face:null,object:o})}}var o=this,a=o.geometry,s=r.params.Points.threshold;if(e.getInverse(this.matrixWorld),t.copy(r.ray).applyMatrix4(e),null===a.boundingBox||t.isIntersectionBox(a.boundingBox)!==!1){var h=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=h*h,u=new THREE.Vector3;if(a instanceof THREE.BufferGeometry){var l=a.index,E=a.attributes,p=E.position.array;if(null!==l)for(var d=l.array,f=0,m=d.length;m>f;f++){var T=d[f];u.fromArray(p,3*T),n(u,T)}else for(var f=0,v=p.length/3;v>f;f++)u.fromArray(p,3*f),n(u,f)}else for(var g=a.vertices,f=0,v=g.length;v>f;f++)n(g[f],f)}}}(),THREE.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new THREE.Points(e,t)},THREE.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new THREE.Points(e,t)},THREE.Line=function(e,t,r){return 1===r?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new THREE.LineSegments(e,t)):(THREE.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new THREE.Geometry,void(this.material=void 0!==t?t:new THREE.LineBasicMaterial({color:16777215*Math.random()})))},THREE.Line.prototype=Object.create(THREE.Object3D.prototype),THREE.Line.prototype.constructor=THREE.Line,THREE.Line.prototype.raycast=function(){var e=new THREE.Matrix4,t=new THREE.Ray,r=new THREE.Sphere;return function(i,n){var o=i.linePrecision,a=o*o,s=this.geometry;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.isIntersectionSphere(r)!==!1){e.getInverse(this.matrixWorld),t.copy(i.ray).applyMatrix4(e);var h=new THREE.Vector3,c=new THREE.Vector3,u=new THREE.Vector3,l=new THREE.Vector3,E=this instanceof THREE.LineSegments?2:1;if(s instanceof THREE.BufferGeometry){var p=s.index,d=s.attributes;if(null!==p)for(var f=p.array,m=d.position.array,T=0,v=f.length-1;v>T;T+=E){var g=f[T],y=f[T+1];h.fromArray(m,3*g),c.fromArray(m,3*y);var R=t.distanceSqToSegment(h,c,l,u);if(!(R>a)){l.applyMatrix4(this.matrixWorld);var H=i.ray.origin.distanceTo(l);Hi.far||n.push({distance:H,point:u.clone().applyMatrix4(this.matrixWorld),index:T,face:null,faceIndex:null,object:this})}}else for(var m=d.position.array,T=0,v=m.length/3-1;v>T;T+=E){h.fromArray(m,3*T),c.fromArray(m,3*T+3);var R=t.distanceSqToSegment(h,c,l,u);if(!(R>a)){l.applyMatrix4(this.matrixWorld);var H=i.ray.origin.distanceTo(l);Hi.far||n.push({distance:H,point:u.clone().applyMatrix4(this.matrixWorld),index:T,face:null,faceIndex:null,object:this})}}}else if(s instanceof THREE.Geometry)for(var x=s.vertices,b=x.length,T=0;b-1>T;T+=E){var R=t.distanceSqToSegment(x[T],x[T+1],l,u);if(!(R>a)){l.applyMatrix4(this.matrixWorld);var H=i.ray.origin.distanceTo(l);Hi.far||n.push({distance:H,point:u.clone().applyMatrix4(this.matrixWorld),index:T,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(e,t){THREE.Line.call(this,e,t),this.type="LineSegments"},THREE.LineSegments.prototype=Object.create(THREE.Line.prototype),THREE.LineSegments.prototype.constructor=THREE.LineSegments,THREE.Mesh=function(e,t){THREE.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new THREE.Geometry,this.material=void 0!==t?t: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&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},THREE.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){function e(e,t,r,i,n,o,a){return THREE.Triangle.barycoordFromPoint(e,t,r,i,f),n.multiplyScalar(f.x),o.multiplyScalar(f.y),a.multiplyScalar(f.z),n.add(o).add(a),n.clone()}function t(e,t,r,i,n,o,a){var s,h=e.material;if(s=h.side===THREE.BackSide?r.intersectTriangle(o,n,i,!0,a):r.intersectTriangle(i,n,o,h.side!==THREE.DoubleSide,a),null===s)return null;T.copy(a),T.applyMatrix4(e.matrixWorld);var c=t.ray.origin.distanceTo(T);return ct.far?null:{distance:c,point:T.clone(),object:e}}function r(r,i,n,o,c,u,l,f){a.fromArray(o,3*u),s.fromArray(o,3*l),h.fromArray(o,3*f);var T=t(r,i,n,a,s,h,m);return T&&(c&&(E.fromArray(c,2*u),p.fromArray(c,2*l),d.fromArray(c,2*f),T.uv=e(m,a,s,h,E,p,d)),T.face=new THREE.Face3(u,l,f,THREE.Triangle.normal(a,s,h)),T.faceIndex=u),T}var i=new THREE.Matrix4,n=new THREE.Ray,o=new THREE.Sphere,a=new THREE.Vector3,s=new THREE.Vector3,h=new THREE.Vector3,c=new THREE.Vector3,u=new THREE.Vector3,l=new THREE.Vector3,E=new THREE.Vector2,p=new THREE.Vector2,d=new THREE.Vector2,f=new THREE.Vector3,m=new THREE.Vector3,T=new THREE.Vector3;return function(f,T){var v=this.geometry,g=this.material;if(void 0!==g){null===v.boundingSphere&&v.computeBoundingSphere();var y=this.matrixWorld;if(o.copy(v.boundingSphere),o.applyMatrix4(y),f.ray.isIntersectionSphere(o)!==!1&&(i.getInverse(y),n.copy(f.ray).applyMatrix4(i),null===v.boundingBox||n.isIntersectionBox(v.boundingBox)!==!1)){var R,H;if(v instanceof THREE.BufferGeometry){var x,b,w,M=v.index,S=v.attributes,_=S.position.array;if(void 0!==S.uv&&(R=S.uv.array),null!==M)for(var A=M.array,C=0,L=A.length;L>C;C+=3)x=A[C],b=A[C+1],w=A[C+2],H=r(this,f,n,_,R,x,b,w),H&&(H.faceIndex=Math.floor(C/3),T.push(H));else for(var C=0,L=_.length;L>C;C+=9)x=C/3,b=x+1,w=x+2,H=r(this,f,n,_,R,x,b,w),H&&(H.index=x,T.push(H))}else if(v instanceof THREE.Geometry){var P,D,k,V=g instanceof THREE.MeshFaceMaterial,F=V===!0?g.materials:null,U=v.vertices,O=v.faces,B=v.faceVertexUvs[0];B.length>0&&(R=B);for(var G=0,N=O.length;N>G;G++){var I=O[G],z=V===!0?F[I.materialIndex]:g;if(void 0!==z){if(P=U[I.a],D=U[I.b],k=U[I.c],z.morphTargets===!0){var j=v.morphTargets,W=this.morphTargetInfluences;a.set(0,0,0),s.set(0,0,0),h.set(0,0,0);for(var X=0,q=j.length;q>X;X++){var Y=W[X];if(0!==Y){var K=j[X].vertices;a.addScaledVector(c.subVectors(K[I.a],P),Y),s.addScaledVector(u.subVectors(K[I.b],D),Y),h.addScaledVector(l.subVectors(K[I.c],k),Y)}}a.add(P),s.add(D),h.add(k),P=a,D=s,k=h}if(H=t(this,f,n,P,D,k,m)){if(R){var Q=R[G];E.copy(Q[0]),p.copy(Q[1]),d.copy(Q[2]),H.uv=e(m,P,D,k,E,p,d)}H.face=I,H.faceIndex=G,T.push(H)}}}}}}}}(),THREE.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},THREE.Bone=function(e){THREE.Object3D.call(this),this.type="Bone",this.skin=e},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Bone.prototype.constructor=THREE.Bone,THREE.Bone.prototype.copy=function(e){return THREE.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},THREE.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new THREE.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var i=Math.sqrt(4*this.bones.length);i=THREE.Math.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,o=this.bones.length;o>n;n++)this.boneInverses.push(new THREE.Matrix4)}},THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var r=new THREE.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},THREE.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},THREE.Skeleton.prototype.update=function(){var e=new THREE.Matrix4;return function(){for(var t=0,r=this.bones.length;r>t;t++){var i=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(i,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),THREE.Skeleton.prototype.clone=function(){return new THREE.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},THREE.SkinnedMesh=function(e,t,r){THREE.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new THREE.Matrix4,this.bindMatrixInverse=new THREE.Matrix4;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var n,o,a=0,s=this.geometry.bones.length;s>a;++a)o=this.geometry.bones[a],n=new THREE.Bone(this),i.push(n),n.name=o.name,n.position.fromArray(o.pos),n.quaternion.fromArray(o.rotq),void 0!==o.scl&&n.scale.fromArray(o.scl);for(var a=0,s=this.geometry.bones.length;s>a;++a)o=this.geometry.bones[a],-1!==o.parent&&null!==o.parent?i[o.parent].add(i[a]):this.add(i[a])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new THREE.Skeleton(i,void 0,r),this.matrixWorld)},THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh,THREE.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},THREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var e=0;er&&!(e1){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);i[0].object.visible=!0;for(var o=1,a=i.length;a>o&&n>=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;a>o;o++)i[o].object.visible=!1}}}(),THREE.LOD.prototype.copy=function(e){THREE.Object3D.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,i=t.length;i>r;r++){var n=t[r];this.addLevel(n.object.clone(),n.distance)}return this},THREE.LOD.prototype.toJSON=function(e){var t=THREE.Object3D.prototype.toJSON.call(this,e);t.object.levels=[];for(var r=this.levels,i=0,n=r.length;n>i;i++){var o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t},THREE.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new THREE.BufferGeometry;return i.setIndex(new THREE.BufferAttribute(e,1)),i.addAttribute("position",new THREE.BufferAttribute(t,3)),i.addAttribute("uv",new THREE.BufferAttribute(r,2)),function(e){THREE.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==e?e:new THREE.SpriteMaterial}}(),THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype),THREE.Sprite.prototype.constructor=THREE.Sprite,THREE.Sprite.prototype.raycast=function(){var e=new THREE.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceSqToPoint(e),n=this.scale.x*this.scale.y;i>n||r.push({distance:Math.sqrt(i),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(e,t,r,i,n){THREE.Object3D.call(this),this.lensFlares=[],this.positionScreen=new THREE.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,i,n)},THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare.prototype.constructor=THREE.LensFlare,THREE.LensFlare.prototype.add=function(e,t,r,i,n,o){void 0===t&&(t=-1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===n&&(n=new THREE.Color(16777215)),void 0===i&&(i=THREE.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:n,blending:i})},THREE.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;r>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},THREE.LensFlare.prototype.copy=function(e){THREE.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,r=e.lensFlares.length;r>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},THREE.Scene=function(){THREE.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},THREE.Scene.prototype=Object.create(THREE.Object3D.prototype),THREE.Scene.prototype.constructor=THREE.Scene,THREE.Scene.prototype.copy=function(e){return THREE.Object3D.prototype.copy.call(this,e),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},THREE.Fog=function(e,t,r){this.name="",this.color=new THREE.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3},THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)},THREE.FogExp2=function(e,t){this.name="",this.color=new THREE.Color(e),this.density=void 0!==t?t:25e-5},THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)},THREE.ShaderChunk={},THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n uniform sampler2D alphaMap;\n\n#endif\n",THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",THREE.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\n totalAmbientLight *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n",THREE.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n\n#endif",THREE.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",THREE.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif\n",THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n diffuseColor.rgb *= vColor;\n\n#endif",THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif\n",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n vColor.xyz = color.xyz;\n\n#endif",THREE.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\n\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\n return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n float distance = dot( planeNormal, point - pointOnPlane );\n\n return - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n return sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\n if ( decayExponent > 0.0 ) {\n\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n }\n\n return 1.0;\n\n}\n\nvec3 F_Schlick( in vec3 specularColor, in float dotLH ) {\n\n\n float fresnel = exp2( ( -5.55437 * dotLH - 6.98316 ) * dotLH );\n\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n\n}\n\nfloat G_BlinnPhong_Implicit( /* in float dotNL, in float dotNV */ ) {\n\n\n return 0.25;\n\n}\n\nfloat D_BlinnPhong( in float shininess, in float dotNH ) {\n\n\n return ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( in vec3 specularColor, in float shininess, in vec3 normal, in vec3 lightDir, in vec3 viewDir ) {\n\n vec3 halfDir = normalize( lightDir + viewDir );\n\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotLH = saturate( dot( lightDir, halfDir ) );\n\n vec3 F = F_Schlick( specularColor, dotLH );\n\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n float D = D_BlinnPhong( shininess, dotNH );\n\n return F * G * D;\n\n}\n\nvec3 inputToLinear( in vec3 a ) {\n\n #ifdef GAMMA_INPUT\n\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\n #else\n\n return a;\n\n #endif\n\n}\n\nvec3 linearToOutput( in vec3 a ) {\n\n #ifdef GAMMA_OUTPUT\n\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\n #else\n\n return a;\n\n #endif\n\n}\n",THREE.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\n objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",THREE.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\n transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n\n#endif\n",THREE.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n\n#endif\n",THREE.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n emissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\n totalEmissiveLight *= emissiveColor.rgb;\n\n#endif\n",THREE.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\n uniform sampler2D emissiveMap;\n\n#endif\n",THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n #else\n\n vec3 reflectVec = vReflect;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n\n envColor.xyz = inputToLinear( envColor.xyz );\n\n #ifdef ENVMAP_BLENDING_MULTIPLY\n\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_MIX )\n\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_ADD )\n\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n #endif\n\n#endif\n",THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n",THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n",THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vReflect = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n#endif\n", +THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n #else\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n #endif\n\n #ifdef FOG_EXP2\n\n float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n #else\n\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n #endif\n \n outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n uniform vec3 fogColor;\n\n #ifdef FOG_EXP2\n\n uniform float fogDensity;\n\n #else\n\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n#endif",THREE.ShaderChunk.hemilight_fragment="#if MAX_HEMI_LIGHTS > 0\n\n for ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lightDir = hemisphereLightDirection[ i ];\n\n float dotProduct = dot( normal, lightDir );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 lightColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n totalAmbientLight += lightColor;\n\n }\n\n#endif\n\n",THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n totalAmbientLight += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n\n#endif",THREE.ShaderChunk.lights_lambert_pars_vertex="#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n",THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = vec3( 0.0 );\n\n#endif\n\nvec3 normal = normalize( transformedNormal );\n\n#if MAX_POINT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec3 lightColor = pointLightColor[ i ];\n\n vec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\n float dotProduct = dot( normal, lightDir );\n\n vLightFront += lightColor * attenuation * saturate( dotProduct );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n #endif\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec3 lightColor = spotLightColor[ i ];\n\n vec3 lightPosition = spotLightPosition[ i ];\n vec3 lVector = lightPosition - mvPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n attenuation *= spotEffect;\n\n\n float dotProduct = dot( normal, lightDir );\n\n vLightFront += lightColor * attenuation * saturate( dotProduct );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n #endif\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 lightColor = directionalLightColor[ i ];\n\n vec3 lightDir = directionalLightDirection[ i ];\n\n\n float dotProduct = dot( normal, lightDir );\n\n vLightFront += lightColor * saturate( dotProduct );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += lightColor * saturate( - dotProduct );\n\n #endif\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lightDir = hemisphereLightDirection[ i ];\n\n\n float dotProduct = dot( normal, lightDir );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n #ifdef DOUBLE_SIDED\n\n float hemiDiffuseWeightBack = - 0.5 * dotProduct + 0.5;\n\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n #endif\n\n }\n\n#endif\n",THREE.ShaderChunk.lights_phong_fragment="vec3 viewDir = normalize( vViewPosition );\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec3 lightColor = pointLightColor[ i ];\n\n vec3 lightPosition = pointLightPosition[ i ];\n vec3 lVector = lightPosition + vViewPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\n float cosineTerm = saturate( dot( normal, lightDir ) );\n\n totalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n\n vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n totalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec3 lightColor = spotLightColor[ i ];\n\n vec3 lightPosition = spotLightPosition[ i ];\n vec3 lVector = lightPosition + vViewPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n attenuation *= spotEffect;\n\n\n float cosineTerm = saturate( dot( normal, lightDir ) );\n\n totalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n\n vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n totalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 lightColor = directionalLightColor[ i ];\n\n vec3 lightDir = directionalLightDirection[ i ];\n\n\n float cosineTerm = saturate( dot( normal, lightDir ) );\n\n totalDiffuseLight += lightColor * cosineTerm;\n\n\n vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n totalSpecularLight += brdf * specularStrength * lightColor * cosineTerm;\n\n }\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\n#endif\n",THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif\n",THREE.ShaderChunk.linear_to_gamma_fragment="\n outgoingLight = linearToOutput( outgoingLight );\n",THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n uniform float logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n uniform float logDepthBufFC;\n\n#endif",THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n #endif\n\n#endif",THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n texelColor.xyz = inputToLinear( texelColor.xyz );\n\n diffuseColor *= texelColor;\n\n#endif\n",THREE.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif",THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n\n#endif\n",THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n#endif\n",THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n #ifndef USE_MORPHNORMALS\n\n uniform float morphTargetInfluences[ 8 ];\n\n #else\n\n uniform float morphTargetInfluences[ 4 ];\n\n #endif\n\n#endif",THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n #ifndef USE_MORPHNORMALS\n\n transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n #endif\n\n#endif\n",THREE.ShaderChunk.normal_phong_fragment="#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n #ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n #endif\n\n#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n",THREE.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\n vec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n for ( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n float texelSizeY = 1.0 / shadowMapSize[ i ].y;\n\n float shadow = 0.0;\n\n#if defined( POINT_LIGHT_SHADOWS )\n\n bool isPointLight = shadowDarkness[ i ] < 0.0;\n\n if ( isPointLight ) {\n\n float realShadowDarkness = abs( shadowDarkness[ i ] );\n\n vec3 lightToPosition = vShadowCoord[ i ].xyz;\n\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n vec3 bd3D = normalize( lightToPosition );\n float dp = length( lightToPosition );\n\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n\n #if defined( SHADOWMAP_TYPE_PCF )\n const float Dr = 1.25;\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n const float Dr = 2.25;\n #endif\n\n float os = Dr * 2.0 * texelSizeY;\n\n const vec3 Gsd = vec3( - 1, 0, 1 );\n\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n shadow *= realShadowDarkness * ( 1.0 / 21.0 );\n\n #else \n vec3 bd3D = normalize( lightToPosition );\n float dp = length( lightToPosition );\n\n adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n shadow *= realShadowDarkness;\n\n #endif\n\n } else {\n\n#endif \n float texelSizeX = 1.0 / shadowMapSize[ i ].x;\n\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n\n /*\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n if ( fDepth < shadowCoord.z )\n shadow += 1.0;\n }\n shadow /= 9.0;\n */\n\n shadowCoord.z += shadowBias[ i ];\n\n const float ShadowDelta = 1.0 / 9.0;\n\n float xPixelOffset = texelSizeX;\n float yPixelOffset = texelSizeY;\n\n float dx0 = - 1.25 * xPixelOffset;\n float dy0 = - 1.25 * yPixelOffset;\n float dx1 = 1.25 * xPixelOffset;\n float dy1 = 1.25 * yPixelOffset;\n\n float fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n shadow *= shadowDarkness[ i ];\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\n shadowCoord.z += shadowBias[ i ];\n\n float xPixelOffset = texelSizeX;\n float yPixelOffset = texelSizeY;\n\n float dx0 = - 1.0 * xPixelOffset;\n float dy0 = - 1.0 * yPixelOffset;\n float dx1 = 1.0 * xPixelOffset;\n float dy1 = 1.0 * yPixelOffset;\n\n mat3 shadowKernel;\n mat3 depthKernel;\n\n depthKernel[ 0 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n depthKernel[ 0 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n depthKernel[ 0 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n depthKernel[ 1 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n depthKernel[ 1 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n depthKernel[ 1 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n depthKernel[ 2 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n depthKernel[ 2 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n depthKernel[ 2 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n vec3 shadowZ = vec3( shadowCoord.z );\n shadowKernel[ 0 ] = vec3( lessThan( depthKernel[ 0 ], shadowZ ) );\n shadowKernel[ 0 ] *= vec3( 0.25 );\n\n shadowKernel[ 1 ] = vec3( lessThan( depthKernel[ 1 ], shadowZ ) );\n shadowKernel[ 1 ] *= vec3( 0.25 );\n\n shadowKernel[ 2 ] = vec3( lessThan( depthKernel[ 2 ], shadowZ ) );\n shadowKernel[ 2 ] *= vec3( 0.25 );\n\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[ i ].xy );\n\n shadowKernel[ 0 ] = mix( shadowKernel[ 1 ], shadowKernel[ 0 ], fractionalCoord.x );\n shadowKernel[ 1 ] = mix( shadowKernel[ 2 ], shadowKernel[ 1 ], fractionalCoord.x );\n\n vec4 shadowValues;\n shadowValues.x = mix( shadowKernel[ 0 ][ 1 ], shadowKernel[ 0 ][ 0 ], fractionalCoord.y );\n shadowValues.y = mix( shadowKernel[ 0 ][ 2 ], shadowKernel[ 0 ][ 1 ], fractionalCoord.y );\n shadowValues.z = mix( shadowKernel[ 1 ][ 1 ], shadowKernel[ 1 ][ 0 ], fractionalCoord.y );\n shadowValues.w = mix( shadowKernel[ 1 ][ 2 ], shadowKernel[ 1 ][ 1 ], fractionalCoord.y );\n\n shadow = dot( shadowValues, vec4( 1.0 ) ) * shadowDarkness[ i ];\n\n #else \n shadowCoord.z += shadowBias[ i ];\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n shadow = shadowDarkness[ i ];\n\n #endif\n\n }\n\n#ifdef SHADOWMAP_DEBUG\n\n if ( inFrustum ) {\n\n if ( i == 0 ) {\n\n outgoingLight *= vec3( 1.0, 0.5, 0.0 );\n\n } else if ( i == 1 ) {\n\n outgoingLight *= vec3( 0.0, 1.0, 0.8 );\n\n } else {\n\n outgoingLight *= vec3( 0.0, 0.5, 1.0 );\n\n }\n\n }\n\n#endif\n\n#if defined( POINT_LIGHT_SHADOWS )\n\n }\n\n#endif\n\n shadowMask = shadowMask * vec3( 1.0 - shadow );\n\n }\n\n#endif\n",THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform float shadowBias[ MAX_SHADOWS ];\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n float unpackDepth( const in vec4 rgba_depth ) {\n\n const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n float depth = dot( rgba_depth, bit_shift );\n return depth;\n\n }\n\n #if defined(POINT_LIGHT_SHADOWS)\n\n\n void adjustShadowValue1K( const float testDepth, const vec4 textureData, const float bias, inout float shadowValue ) {\n\n const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n if ( testDepth >= dot( textureData, bitSh ) * 1000.0 + bias )\n shadowValue += 1.0;\n\n }\n\n\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\n vec3 absV = abs( v );\n\n\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n\n\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\n\n vec2 planar = v.xy;\n\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n\n if ( absV.z >= almostOne ) {\n\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n\n } else if ( absV.x >= almostOne ) {\n\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n\n } else if ( absV.y >= almostOne ) {\n\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n\n }\n\n\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n }\n\n #endif\n\n#endif\n",THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n#endif",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n for ( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif",THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n\n #ifdef BONE_TEXTURE\n\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n\n mat4 getBoneMatrix( const in float i ) {\n\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n\n y = dy * ( y + 0.5 );\n\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n mat4 bone = mat4( v1, v2, v3, v4 );\n\n return bone;\n\n }\n\n #else\n\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n mat4 getBoneMatrix( const in float i ) {\n\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n\n }\n\n #endif\n\n#endif\n",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n\n#endif\n",THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n",THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n\n#else\n\n specularStrength = 1.0;\n\n#endif",THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n uniform sampler2D specularMap;\n\n#endif",THREE.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n varying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n attribute vec2 uv2;\n varying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n vUv2 = uv2;\n\n#endif",THREE.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n varying vec2 vUv;\n\n#endif",THREE.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n\n#endif\n",THREE.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n #ifdef USE_SKINNING\n\n vec4 worldPosition = modelMatrix * skinned;\n\n #else\n\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n #endif\n\n#endif\n",THREE.UniformsUtils={merge:function(e){for(var t={},r=0;r dashSize ) {"," discard;"," }"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment," outgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.fog_fragment," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].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;","uniform float mFar;","uniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," float depth = gl_FragDepthEXT / gl_FragCoord.w;"," #else"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," #endif"," float color = 1.0 - smoothstep( mNear, mFar, depth );"," gl_FragColor = vec4( vec3( color ), opacity );","}"].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() {"," vNormal = 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;","varying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_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() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_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() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_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 ) {"," const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );"," res -= res.xxyz * bit_mask;"," return res;","}","void main() {",THREE.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );"," #else"," gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );"," #endif","}"].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;","}"].join("\n"),fragmentShader:["uniform vec3 lightPos;","varying vec4 vWorldPosition;",THREE.ShaderChunk.common,"vec4 pack1K ( float depth ) {"," depth /= 1000.0;"," const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = fract( depth * bitSh );"," res -= res.xxyz * bitMsk;"," return res; ","}","float unpack1K ( vec4 color ) {"," const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );"," return dot( color, bitSh ) * 1000.0;","}","void main () {"," gl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );","}"].join("\n")}},THREE.WebGLRenderer=function(e){function t(e,t,r,i){oe===!0&&(e*=i,t*=i,r*=i),Oe.clearColor(e,t,r,i)}function r(){ze.init(),Oe.viewport(be,we,Me,Se),t(se.r,se.g,se.b,he)}function i(){ve=null,He=null,Re="",ye=-1,ke=!0,ze.reset()}function n(e){e.preventDefault(),i(),r(),je.clear()}function o(e){var t=e.target;t.removeEventListener("dispose",o),h(t),Fe.textures--}function a(e){var t=e.target;t.removeEventListener("dispose",a),c(t),Fe.textures--}function s(e){var t=e.target;t.removeEventListener("dispose",s),u(t)}function h(e){var t=je.get(e);if(e.image&&t.__image__webglTextureCube)Oe.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;Oe.deleteTexture(t.__webglTexture)}je["delete"](e)}function c(e){var t=je.get(e),r=je.get(e.texture);if(e&&void 0!==r.__webglTexture){if(Oe.deleteTexture(r.__webglTexture),e instanceof THREE.WebGLRenderTargetCube)for(var i=0;6>i;i++)Oe.deleteFramebuffer(t.__webglFramebuffer[i]),Oe.deleteRenderbuffer(t.__webglRenderbuffer[i]);else Oe.deleteFramebuffer(t.__webglFramebuffer),Oe.deleteRenderbuffer(t.__webglRenderbuffer);je["delete"](e.texture),je["delete"](e)}}function u(e){l(e),je["delete"](e)}function l(e){var t=je.get(e).program;e.program=void 0,void 0!==t&&Xe.releaseProgram(t)}function E(e,t,r,i){var n;if(r instanceof THREE.InstancedBufferGeometry&&(n=Ne.get("ANGLE_instanced_arrays"),null===n))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===i&&(i=0),ze.initAttributes();var o=r.attributes,a=t.getAttributes(),s=e.defaultAttributeValues;for(var h in a){var c=a[h];if(c>=0){var u=o[h];if(void 0!==u){var l=u.itemSize,E=We.getAttributeBuffer(u);if(u instanceof THREE.InterleavedBufferAttribute){var p=u.data,d=p.stride,f=u.offset;p instanceof THREE.InstancedInterleavedBuffer?(ze.enableAttributeAndDivisor(c,p.meshPerAttribute,n),void 0===r.maxInstancedCount&&(r.maxInstancedCount=p.meshPerAttribute*p.count)):ze.enableAttribute(c),Oe.bindBuffer(Oe.ARRAY_BUFFER,E),Oe.vertexAttribPointer(c,l,Oe.FLOAT,!1,d*p.array.BYTES_PER_ELEMENT,(i*d+f)*p.array.BYTES_PER_ELEMENT)}else u instanceof THREE.InstancedBufferAttribute?(ze.enableAttributeAndDivisor(c,u.meshPerAttribute,n),void 0===r.maxInstancedCount&&(r.maxInstancedCount=u.meshPerAttribute*u.count)):ze.enableAttribute(c),Oe.bindBuffer(Oe.ARRAY_BUFFER,E),Oe.vertexAttribPointer(c,l,Oe.FLOAT,!1,0,i*l*4)}else if(void 0!==s){var m=s[h];if(void 0!==m)switch(m.length){case 2:Oe.vertexAttrib2fv(c,m);break;case 3:Oe.vertexAttrib3fv(c,m);break;case 4:Oe.vertexAttrib4fv(c,m);break;default:Oe.vertexAttrib1fv(c,m)}}}}ze.disableUnusedAttributes()}function p(e,t){return t[0]-e[0]}function d(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function f(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function m(e,t,r,i,n){var o,a;r.transparent?(o=Ee,a=++pe):(o=ue,a=++le);var s=o[a];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=r,s.z=Pe.z,s.group=n):(s={id:e.id,object:e,geometry:t,material:r,z:Pe.z,group:n},o.push(s))}function T(e,t){if(e.visible!==!1){if(0!==(e.channels.mask&t.channels.mask))if(e instanceof THREE.Light)ce.push(e);else if(e instanceof THREE.Sprite)fe.push(e);else if(e instanceof THREE.LensFlare)me.push(e);else if(e instanceof THREE.ImmediateRenderObject)Te.sortObjects===!0&&(Pe.setFromMatrixPosition(e.matrixWorld),Pe.applyProjection(Le)),m(e,null,e.material,Pe.z,null);else if((e instanceof THREE.Mesh||e instanceof THREE.Line||e instanceof THREE.Points)&&(e instanceof THREE.SkinnedMesh&&e.skeleton.update(),e.frustumCulled===!1||Ce.intersectsObject(e)===!0)){var r=e.material;if(r.visible===!0){Te.sortObjects===!0&&(Pe.setFromMatrixPosition(e.matrixWorld),Pe.applyProjection(Le));var i=We.update(e);if(r instanceof THREE.MeshFaceMaterial)for(var n=i.groups,o=r.materials,a=0,s=n.length;s>a;a++){var h=n[a],c=o[h.materialIndex];c.visible===!0&&m(e,i,c,Pe.z,h)}else m(e,i,r,Pe.z,null)}}for(var u=e.children,a=0,s=u.length;s>a;a++)T(u[a],t)}}function v(e,t,r,i,n){for(var o=0,a=e.length;a>o;o++){var s=e[o],h=s.object,c=s.geometry,u=void 0===n?s.material:n,l=s.group;if(h.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,h.matrixWorld),h.normalMatrix.getNormalMatrix(h.modelViewMatrix),h instanceof THREE.ImmediateRenderObject){y(u);var E=H(t,r,i,u,h);Re="",h.render(function(e){Te.renderBufferImmediate(e,E,u)})}else Te.renderBufferDirect(t,r,i,c,u,h,l)}}function g(e,t,r,i){var n=je.get(e),o=Xe.getParameters(e,t,r,i),a=Xe.getProgramCode(e,o),h=n.program,c=!0;if(void 0===h)e.addEventListener("dispose",s);else if(h.code!==a)l(e);else{if(void 0!==o.shaderID)return;c=!1}if(c){if(o.shaderID){var u=THREE.ShaderLib[o.shaderID];n.__webglShader={name:e.type,uniforms:THREE.UniformsUtils.clone(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}}else n.__webglShader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.__webglShader=n.__webglShader,h=Xe.acquireProgram(e,o,a),n.program=h,e.program=h}var E=h.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var p=0;p=0&&e.numSupportedMorphTargets++}if(e.morphNormals)for(e.numSupportedMorphNormals=0,p=0;p=0&&e.numSupportedMorphNormals++;n.uniformsList=[];var d=n.program.getUniforms();for(var f in n.__webglShader.uniforms){var m=d[f];m&&n.uniformsList.push([n.__webglShader.uniforms[f],m])}}function y(e){R(e),e.transparent===!0?ze.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):ze.setBlending(THREE.NoBlending),ze.setDepthFunc(e.depthFunc),ze.setDepthTest(e.depthTest),ze.setDepthWrite(e.depthWrite),ze.setColorWrite(e.colorWrite),ze.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function R(e){e.side!==THREE.DoubleSide?ze.enable(Oe.CULL_FACE):ze.disable(Oe.CULL_FACE),ze.setFlipSided(e.side===THREE.BackSide)}function H(e,t,r,i,n){xe=0;var o=je.get(i);(i.needsUpdate||!o.program)&&(g(i,t,r,n),i.needsUpdate=!1);var a=!1,s=!1,h=!1,c=o.program,u=c.getUniforms(),l=o.__webglShader.uniforms;if(c.id!==ve&&(Oe.useProgram(c.program),ve=c.id,a=!0,s=!0,h=!0),i.id!==ye&&(-1===ye&&(h=!0),ye=i.id,s=!0),(a||e!==He)&&(Oe.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements),Ie.logarithmicDepthBuffer&&Oe.uniform1f(u.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==He&&(He=e),(i instanceof THREE.ShaderMaterial||i instanceof THREE.MeshPhongMaterial||i.envMap)&&void 0!==u.cameraPosition&&(Pe.setFromMatrixPosition(e.matrixWorld),Oe.uniform3f(u.cameraPosition,Pe.x,Pe.y,Pe.z)),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshBasicMaterial||i instanceof THREE.ShaderMaterial||i.skinning)&&void 0!==u.viewMatrix&&Oe.uniformMatrix4fv(u.viewMatrix,!1,e.matrixWorldInverse.elements)),i.skinning)if(n.bindMatrix&&void 0!==u.bindMatrix&&Oe.uniformMatrix4fv(u.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&void 0!==u.bindMatrixInverse&&Oe.uniformMatrix4fv(u.bindMatrixInverse,!1,n.bindMatrixInverse.elements),Ie.floatVertexTextures&&n.skeleton&&n.skeleton.useVertexTexture){if(void 0!==u.boneTexture){var E=D();Oe.uniform1i(u.boneTexture,E),Te.setTexture(n.skeleton.boneTexture,E)}void 0!==u.boneTextureWidth&&Oe.uniform1i(u.boneTextureWidth,n.skeleton.boneTextureWidth),void 0!==u.boneTextureHeight&&Oe.uniform1i(u.boneTextureHeight,n.skeleton.boneTextureHeight)}else n.skeleton&&n.skeleton.boneMatrices&&void 0!==u.boneGlobalMatrices&&Oe.uniformMatrix4fv(u.boneGlobalMatrices,!1,n.skeleton.boneMatrices);return s&&(r&&i.fog&&S(l,r),(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights)&&(ke&&(h=!0,F(t,e),ke=!1),h?(A(l,Ve),C(l,!0)):C(l,!1)),(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial)&&x(l,i),i instanceof THREE.LineBasicMaterial?b(l,i):i instanceof THREE.LineDashedMaterial?(b(l,i),w(l,i)):i instanceof THREE.PointsMaterial?M(l,i):i instanceof THREE.MeshPhongMaterial?_(l,i):i instanceof THREE.MeshDepthMaterial?(l.mNear.value=e.near,l.mFar.value=e.far,l.opacity.value=i.opacity):i instanceof THREE.MeshNormalMaterial&&(l.opacity.value=i.opacity),n.receiveShadow&&!i._shadowPass&&L(l,t,e),k(o.uniformsList)),P(u,n),void 0!==u.modelMatrix&&Oe.uniformMatrix4fv(u.modelMatrix,!1,n.matrixWorld.elements),c}function x(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&(e.emissive.value=t.emissive),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var r;if(t.map?r=t.map:t.specularMap?r=t.specularMap:t.displacementMap?r=t.displacementMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.alphaMap?r=t.alphaMap:t.emissiveMap&&(r=t.emissiveMap),void 0!==r){r instanceof THREE.WebGLRenderTarget&&(r=r.texture);var i=r.offset,n=r.repeat;e.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function b(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function w(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function M(e,t){if(e.psColor.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size,e.scale.value=Q.height/2,e.map.value=t.map,null!==t.map){var r=t.map.offset,i=t.map.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}}function S(e,t){e.fogColor.value=t.color,t instanceof THREE.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof THREE.FogExp2&&(e.fogDensity.value=t.density)}function _(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function A(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.pointLightDecay.value=t.point.decays,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.spotLightDecay.value=t.spot.decays,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}function C(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLightColor.needsUpdate=t,e.directionalLightDirection.needsUpdate=t,e.pointLightColor.needsUpdate=t,e.pointLightPosition.needsUpdate=t,e.pointLightDistance.needsUpdate=t,e.pointLightDecay.needsUpdate=t,e.spotLightColor.needsUpdate=t,e.spotLightPosition.needsUpdate=t,e.spotLightDistance.needsUpdate=t,e.spotLightDirection.needsUpdate=t,e.spotLightAngleCos.needsUpdate=t,e.spotLightExponent.needsUpdate=t,e.spotLightDecay.needsUpdate=t,e.hemisphereLightSkyColor.needsUpdate=t,e.hemisphereLightGroundColor.needsUpdate=t,e.hemisphereLightDirection.needsUpdate=t}function L(e,t,r){if(e.shadowMatrix)for(var i=0,n=0,o=t.length;o>n;n++){var a=t[n];if(a.castShadow===!0&&(a instanceof THREE.PointLight||a instanceof THREE.SpotLight||a instanceof THREE.DirectionalLight)){var s=a.shadow;a instanceof THREE.PointLight?(Pe.setFromMatrixPosition(a.matrixWorld).negate(),s.matrix.identity().setPosition(Pe),e.shadowDarkness.value[i]=-s.darkness):e.shadowDarkness.value[i]=s.darkness,e.shadowMatrix.value[i]=s.matrix,e.shadowMap.value[i]=s.map,e.shadowMapSize.value[i]=s.mapSize,e.shadowBias.value[i]=s.bias,i++}}}function P(e,t){Oe.uniformMatrix4fv(e.modelViewMatrix,!1,t.modelViewMatrix.elements),e.normalMatrix&&Oe.uniformMatrix3fv(e.normalMatrix,!1,t.normalMatrix.elements)}function D(){var e=xe;return e>=Ie.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Ie.maxTextures),xe+=1,e}function k(e){for(var t,r,i=0,n=e.length;n>i;i++){var o=e[i][0];if(o.needsUpdate!==!1){var a=o.type,s=o.value,h=e[i][1];switch(a){case"1i":Oe.uniform1i(h,s);break;case"1f":Oe.uniform1f(h,s);break;case"2f":Oe.uniform2f(h,s[0],s[1]);break;case"3f":Oe.uniform3f(h,s[0],s[1],s[2]);break;case"4f":Oe.uniform4f(h,s[0],s[1],s[2],s[3]);break;case"1iv":Oe.uniform1iv(h,s);break;case"3iv":Oe.uniform3iv(h,s);break;case"1fv":Oe.uniform1fv(h,s);break;case"2fv":Oe.uniform2fv(h,s);break;case"3fv":Oe.uniform3fv(h,s);break;case"4fv":Oe.uniform4fv(h,s);break;case"Matrix3fv":Oe.uniformMatrix3fv(h,!1,s);break;case"Matrix4fv":Oe.uniformMatrix4fv(h,!1,s);break;case"i":Oe.uniform1i(h,s);break;case"f":Oe.uniform1f(h,s);break;case"v2":Oe.uniform2f(h,s.x,s.y);break;case"v3":Oe.uniform3f(h,s.x,s.y,s.z);break;case"v4":Oe.uniform4f(h,s.x,s.y,s.z,s.w);break;case"c":Oe.uniform3f(h,s.r,s.g,s.b);break;case"iv1":Oe.uniform1iv(h,s);break;case"iv":Oe.uniform3iv(h,s);break;case"fv1":Oe.uniform1fv(h,s);break;case"fv":Oe.uniform3fv(h,s);break;case"v2v":void 0===o._array&&(o._array=new Float32Array(2*s.length));for(var c=0,u=0,l=s.length;l>c;c++,u+=2)o._array[u+0]=s[c].x,o._array[u+1]=s[c].y;Oe.uniform2fv(h,o._array);break;case"v3v":void 0===o._array&&(o._array=new Float32Array(3*s.length));for(var c=0,E=0,l=s.length;l>c;c++,E+=3)o._array[E+0]=s[c].x,o._array[E+1]=s[c].y,o._array[E+2]=s[c].z;Oe.uniform3fv(h,o._array);break;case"v4v":void 0===o._array&&(o._array=new Float32Array(4*s.length));for(var c=0,p=0,l=s.length;l>c;c++,p+=4)o._array[p+0]=s[c].x,o._array[p+1]=s[c].y,o._array[p+2]=s[c].z,o._array[p+3]=s[c].w;Oe.uniform4fv(h,o._array);break;case"m3":Oe.uniformMatrix3fv(h,!1,s.elements);break;case"m3v":void 0===o._array&&(o._array=new Float32Array(9*s.length));for(var c=0,l=s.length;l>c;c++)s[c].flattenToArrayOffset(o._array,9*c);Oe.uniformMatrix3fv(h,!1,o._array);break;case"m4":Oe.uniformMatrix4fv(h,!1,s.elements);break;case"m4v":void 0===o._array&&(o._array=new Float32Array(16*s.length));for(var c=0,l=s.length;l>c;c++)s[c].flattenToArrayOffset(o._array,16*c);Oe.uniformMatrix4fv(h,!1,o._array);break;case"t":if(t=s,r=D(),Oe.uniform1i(h,r),!t)continue;t instanceof THREE.CubeTexture||Array.isArray(t.image)&&6===t.image.length?z(t,r):t instanceof THREE.WebGLRenderTargetCube?j(t.texture,r):t instanceof THREE.WebGLRenderTarget?Te.setTexture(t.texture,r):Te.setTexture(t,r);break;case"tv":void 0===o._array&&(o._array=[]);for(var c=0,l=o.value.length;l>c;c++)o._array[c]=D();Oe.uniform1iv(h,o._array);for(var c=0,l=o.value.length;l>c;c++)t=o.value[c],r=o._array[c],t&&(t instanceof THREE.CubeTexture||t.image instanceof Array&&6===t.image.length?z(t,r):t instanceof THREE.WebGLRenderTarget?Te.setTexture(t.texture,r):t instanceof THREE.WebGLRenderTargetCube?j(t.texture,r):Te.setTexture(t,r));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}function V(e,t,r,i){e[t+0]=r.r*i,e[t+1]=r.g*i,e[t+2]=r.b*i}function F(e,t){var r,i,n,o,a,s,h,c,u=0,l=0,E=0,p=Ve,d=t.matrixWorldInverse,f=p.directional.colors,m=p.directional.positions,T=p.point.colors,v=p.point.positions,g=p.point.distances,y=p.point.decays,R=p.spot.colors,H=p.spot.positions,x=p.spot.distances,b=p.spot.directions,w=p.spot.anglesCos,M=p.spot.exponents,S=p.spot.decays,_=p.hemi.skyColors,A=p.hemi.groundColors,C=p.hemi.positions,L=0,P=0,D=0,k=0,F=0,U=0,O=0,B=0,G=0,N=0,I=0,z=0; +for(r=0,i=e.length;i>r;r++)if(n=e[r],o=n.color,h=n.intensity,c=n.distance,n instanceof THREE.AmbientLight){if(!n.visible)continue;u+=o.r,l+=o.g,E+=o.b}else if(n instanceof THREE.DirectionalLight){if(F+=1,!n.visible)continue;De.setFromMatrixPosition(n.matrixWorld),Pe.setFromMatrixPosition(n.target.matrixWorld),De.sub(Pe),De.transformDirection(d),G=3*L,m[G+0]=De.x,m[G+1]=De.y,m[G+2]=De.z,V(f,G,o,h),L+=1}else if(n instanceof THREE.PointLight){if(U+=1,!n.visible)continue;N=3*P,V(T,N,o,h),Pe.setFromMatrixPosition(n.matrixWorld),Pe.applyMatrix4(d),v[N+0]=Pe.x,v[N+1]=Pe.y,v[N+2]=Pe.z,g[P]=c,y[P]=0===n.distance?0:n.decay,P+=1}else if(n instanceof THREE.SpotLight){if(O+=1,!n.visible)continue;I=3*D,V(R,I,o,h),De.setFromMatrixPosition(n.matrixWorld),Pe.copy(De).applyMatrix4(d),H[I+0]=Pe.x,H[I+1]=Pe.y,H[I+2]=Pe.z,x[D]=c,Pe.setFromMatrixPosition(n.target.matrixWorld),De.sub(Pe),De.transformDirection(d),b[I+0]=De.x,b[I+1]=De.y,b[I+2]=De.z,w[D]=Math.cos(n.angle),M[D]=n.exponent,S[D]=0===n.distance?0:n.decay,D+=1}else if(n instanceof THREE.HemisphereLight){if(B+=1,!n.visible)continue;De.setFromMatrixPosition(n.matrixWorld),De.transformDirection(d),z=3*k,C[z+0]=De.x,C[z+1]=De.y,C[z+2]=De.z,a=n.color,s=n.groundColor,V(_,z,a,h),V(A,z,s,h),k+=1}for(r=3*L,i=Math.max(f.length,3*F);i>r;r++)f[r]=0;for(r=3*P,i=Math.max(T.length,3*U);i>r;r++)T[r]=0;for(r=3*D,i=Math.max(R.length,3*O);i>r;r++)R[r]=0;for(r=3*k,i=Math.max(_.length,3*B);i>r;r++)_[r]=0;for(r=3*k,i=Math.max(A.length,3*B);i>r;r++)A[r]=0;p.directional.length=L,p.point.length=P,p.spot.length=D,p.hemi.length=k,p.ambient[0]=u,p.ambient[1]=l,p.ambient[2]=E}function U(e,t,r){var i;if(r?(Oe.texParameteri(e,Oe.TEXTURE_WRAP_S,K(t.wrapS)),Oe.texParameteri(e,Oe.TEXTURE_WRAP_T,K(t.wrapT)),Oe.texParameteri(e,Oe.TEXTURE_MAG_FILTER,K(t.magFilter)),Oe.texParameteri(e,Oe.TEXTURE_MIN_FILTER,K(t.minFilter))):(Oe.texParameteri(e,Oe.TEXTURE_WRAP_S,Oe.CLAMP_TO_EDGE),Oe.texParameteri(e,Oe.TEXTURE_WRAP_T,Oe.CLAMP_TO_EDGE),(t.wrapS!==THREE.ClampToEdgeWrapping||t.wrapT!==THREE.ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),Oe.texParameteri(e,Oe.TEXTURE_MAG_FILTER,Y(t.magFilter)),Oe.texParameteri(e,Oe.TEXTURE_MIN_FILTER,Y(t.minFilter)),t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),i=Ne.get("EXT_texture_filter_anisotropic")){if(t.type===THREE.FloatType&&null===Ne.get("OES_texture_float_linear"))return;if(t.type===THREE.HalfFloatType&&null===Ne.get("OES_texture_half_float_linear"))return;(t.anisotropy>1||je.get(t).__currentAnisotropy)&&(Oe.texParameterf(e,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,Te.getMaxAnisotropy())),je.get(t).__currentAnisotropy=t.anisotropy)}}function O(e,t,r){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",o),e.__webglTexture=Oe.createTexture(),Fe.textures++),ze.activeTexture(Oe.TEXTURE0+r),ze.bindTexture(Oe.TEXTURE_2D,e.__webglTexture),Oe.pixelStorei(Oe.UNPACK_FLIP_Y_WEBGL,t.flipY),Oe.pixelStorei(Oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Oe.pixelStorei(Oe.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=B(t.image,Ie.maxTextureSize),N(t)&&G(t.image)===!1&&(t.image=I(t.image));var i=t.image,n=G(i),a=K(t.format),s=K(t.type);U(Oe.TEXTURE_2D,t,n);var h,c=t.mipmaps;if(t instanceof THREE.DataTexture)if(c.length>0&&n){for(var u=0,l=c.length;l>u;u++)h=c[u],ze.texImage2D(Oe.TEXTURE_2D,u,a,h.width,h.height,0,a,s,h.data);t.generateMipmaps=!1}else ze.texImage2D(Oe.TEXTURE_2D,0,a,i.width,i.height,0,a,s,i.data);else if(t instanceof THREE.CompressedTexture)for(var u=0,l=c.length;l>u;u++)h=c[u],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?ze.getCompressedTextureFormats().indexOf(a)>-1?ze.compressedTexImage2D(Oe.TEXTURE_2D,u,a,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ze.texImage2D(Oe.TEXTURE_2D,u,a,h.width,h.height,0,a,s,h.data);else if(c.length>0&&n){for(var u=0,l=c.length;l>u;u++)h=c[u],ze.texImage2D(Oe.TEXTURE_2D,u,a,a,s,h);t.generateMipmaps=!1}else ze.texImage2D(Oe.TEXTURE_2D,0,a,a,s,t.image);t.generateMipmaps&&n&&Oe.generateMipmap(Oe.TEXTURE_2D),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function B(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),i=document.createElement("canvas");i.width=Math.floor(e.width*r),i.height=Math.floor(e.height*r);var n=i.getContext("2d");return n.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function G(e){return THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height)}function N(e){return e.wrapS!==THREE.ClampToEdgeWrapping||e.wrapT!==THREE.ClampToEdgeWrapping?!0:e.minFilter!==THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter?!0:!1}function I(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElement("canvas");t.width=THREE.Math.nearestPowerOfTwo(e.width),t.height=THREE.Math.nearestPowerOfTwo(e.height);var r=t.getContext("2d");return r.drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}function z(e,t){var r=je.get(e);if(6===e.image.length)if(e.version>0&&r.__version!==e.version){r.__image__webglTextureCube||(e.addEventListener("dispose",o),r.__image__webglTextureCube=Oe.createTexture(),Fe.textures++),ze.activeTexture(Oe.TEXTURE0+t),ze.bindTexture(Oe.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),Oe.pixelStorei(Oe.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var i=e instanceof THREE.CompressedTexture,n=e.image[0]instanceof THREE.DataTexture,a=[],s=0;6>s;s++)!Te.autoScaleCubemaps||i||n?a[s]=n?e.image[s].image:e.image[s]:a[s]=B(e.image[s],Ie.maxCubemapSize);var h=a[0],c=G(h),u=K(e.format),l=K(e.type);U(Oe.TEXTURE_CUBE_MAP,e,c);for(var s=0;6>s;s++)if(i)for(var E,p=a[s].mipmaps,d=0,f=p.length;f>d;d++)E=p[d],e.format!==THREE.RGBAFormat&&e.format!==THREE.RGBFormat?ze.getCompressedTextureFormats().indexOf(u)>-1?ze.compressedTexImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,u,E.width,E.height,0,E.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):ze.texImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+s,d,u,E.width,E.height,0,u,l,E.data);else n?ze.texImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,u,a[s].width,a[s].height,0,u,l,a[s].data):ze.texImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,u,u,l,a[s]);e.generateMipmaps&&c&&Oe.generateMipmap(Oe.TEXTURE_CUBE_MAP),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else ze.activeTexture(Oe.TEXTURE0+t),ze.bindTexture(Oe.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function j(e,t){ze.activeTexture(Oe.TEXTURE0+t),ze.bindTexture(Oe.TEXTURE_CUBE_MAP,je.get(e).__webglTexture)}function W(e,t,r){Oe.bindFramebuffer(Oe.FRAMEBUFFER,e),Oe.framebufferTexture2D(Oe.FRAMEBUFFER,Oe.COLOR_ATTACHMENT0,r,je.get(t.texture).__webglTexture,0)}function X(e,t){Oe.bindRenderbuffer(Oe.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Oe.renderbufferStorage(Oe.RENDERBUFFER,Oe.DEPTH_COMPONENT16,t.width,t.height),Oe.framebufferRenderbuffer(Oe.FRAMEBUFFER,Oe.DEPTH_ATTACHMENT,Oe.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Oe.renderbufferStorage(Oe.RENDERBUFFER,Oe.DEPTH_STENCIL,t.width,t.height),Oe.framebufferRenderbuffer(Oe.FRAMEBUFFER,Oe.DEPTH_STENCIL_ATTACHMENT,Oe.RENDERBUFFER,e)):Oe.renderbufferStorage(Oe.RENDERBUFFER,Oe.RGBA4,t.width,t.height)}function q(e){var t=e instanceof THREE.WebGLRenderTargetCube?Oe.TEXTURE_CUBE_MAP:Oe.TEXTURE_2D,r=je.get(e.texture).__webglTexture;ze.bindTexture(t,r),Oe.generateMipmap(t),ze.bindTexture(t,null)}function Y(e){return e===THREE.NearestFilter||e===THREE.NearestMipMapNearestFilter||e===THREE.NearestMipMapLinearFilter?Oe.NEAREST:Oe.LINEAR}function K(e){var t;if(e===THREE.RepeatWrapping)return Oe.REPEAT;if(e===THREE.ClampToEdgeWrapping)return Oe.CLAMP_TO_EDGE;if(e===THREE.MirroredRepeatWrapping)return Oe.MIRRORED_REPEAT;if(e===THREE.NearestFilter)return Oe.NEAREST;if(e===THREE.NearestMipMapNearestFilter)return Oe.NEAREST_MIPMAP_NEAREST;if(e===THREE.NearestMipMapLinearFilter)return Oe.NEAREST_MIPMAP_LINEAR;if(e===THREE.LinearFilter)return Oe.LINEAR;if(e===THREE.LinearMipMapNearestFilter)return Oe.LINEAR_MIPMAP_NEAREST;if(e===THREE.LinearMipMapLinearFilter)return Oe.LINEAR_MIPMAP_LINEAR;if(e===THREE.UnsignedByteType)return Oe.UNSIGNED_BYTE;if(e===THREE.UnsignedShort4444Type)return Oe.UNSIGNED_SHORT_4_4_4_4;if(e===THREE.UnsignedShort5551Type)return Oe.UNSIGNED_SHORT_5_5_5_1;if(e===THREE.UnsignedShort565Type)return Oe.UNSIGNED_SHORT_5_6_5;if(e===THREE.ByteType)return Oe.BYTE;if(e===THREE.ShortType)return Oe.SHORT;if(e===THREE.UnsignedShortType)return Oe.UNSIGNED_SHORT;if(e===THREE.IntType)return Oe.INT;if(e===THREE.UnsignedIntType)return Oe.UNSIGNED_INT;if(e===THREE.FloatType)return Oe.FLOAT;if(t=Ne.get("OES_texture_half_float"),null!==t&&e===THREE.HalfFloatType)return t.HALF_FLOAT_OES;if(e===THREE.AlphaFormat)return Oe.ALPHA;if(e===THREE.RGBFormat)return Oe.RGB;if(e===THREE.RGBAFormat)return Oe.RGBA;if(e===THREE.LuminanceFormat)return Oe.LUMINANCE;if(e===THREE.LuminanceAlphaFormat)return Oe.LUMINANCE_ALPHA;if(e===THREE.AddEquation)return Oe.FUNC_ADD;if(e===THREE.SubtractEquation)return Oe.FUNC_SUBTRACT;if(e===THREE.ReverseSubtractEquation)return Oe.FUNC_REVERSE_SUBTRACT;if(e===THREE.ZeroFactor)return Oe.ZERO;if(e===THREE.OneFactor)return Oe.ONE;if(e===THREE.SrcColorFactor)return Oe.SRC_COLOR;if(e===THREE.OneMinusSrcColorFactor)return Oe.ONE_MINUS_SRC_COLOR;if(e===THREE.SrcAlphaFactor)return Oe.SRC_ALPHA;if(e===THREE.OneMinusSrcAlphaFactor)return Oe.ONE_MINUS_SRC_ALPHA;if(e===THREE.DstAlphaFactor)return Oe.DST_ALPHA;if(e===THREE.OneMinusDstAlphaFactor)return Oe.ONE_MINUS_DST_ALPHA;if(e===THREE.DstColorFactor)return Oe.DST_COLOR;if(e===THREE.OneMinusDstColorFactor)return Oe.ONE_MINUS_DST_COLOR;if(e===THREE.SrcAlphaSaturateFactor)return Oe.SRC_ALPHA_SATURATE;if(t=Ne.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===THREE.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===THREE.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===THREE.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===THREE.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=Ne.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===THREE.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===THREE.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===THREE.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===THREE.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=Ne.get("EXT_blend_minmax"),null!==t){if(e===THREE.MinEquation)return t.MIN_EXT;if(e===THREE.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION),e=e||{};var Q=void 0!==e.canvas?e.canvas:document.createElement("canvas"),Z=void 0!==e.context?e.context:null,J=Q.width,$=Q.height,ee=1,te=void 0!==e.alpha?e.alpha:!1,re=void 0!==e.depth?e.depth:!0,ie=void 0!==e.stencil?e.stencil:!0,ne=void 0!==e.antialias?e.antialias:!1,oe=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,ae=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,se=new THREE.Color(0),he=0,ce=[],ue=[],le=-1,Ee=[],pe=-1,de=new Float32Array(8),fe=[],me=[];this.domElement=Q,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var Te=this,ve=null,ge=null,ye=-1,Re="",He=null,xe=0,be=0,we=0,Me=Q.width,Se=Q.height,_e=0,Ae=0,Ce=new THREE.Frustum,Le=new THREE.Matrix4,Pe=new THREE.Vector3,De=new THREE.Vector3,ke=!0,Ve={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},Fe={geometries:0,textures:0},Ue={calls:0,vertices:0,faces:0,points:0};this.info={render:Ue,memory:Fe,programs:null};var Oe;try{var Be={alpha:te,depth:re,stencil:ie,antialias:ne,premultipliedAlpha:oe,preserveDrawingBuffer:ae};if(Oe=Z||Q.getContext("webgl",Be)||Q.getContext("experimental-webgl",Be),null===Oe)throw null!==Q.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";Q.addEventListener("webglcontextlost",n,!1)}catch(Ge){console.error("THREE.WebGLRenderer: "+Ge)}var Ne=new THREE.WebGLExtensions(Oe);Ne.get("OES_texture_float"),Ne.get("OES_texture_float_linear"),Ne.get("OES_texture_half_float"),Ne.get("OES_texture_half_float_linear"),Ne.get("OES_standard_derivatives"),Ne.get("ANGLE_instanced_arrays"),Ne.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var Ie=new THREE.WebGLCapabilities(Oe,Ne,e),ze=new THREE.WebGLState(Oe,Ne,K),je=new THREE.WebGLProperties,We=new THREE.WebGLObjects(Oe,je,this.info),Xe=new THREE.WebGLPrograms(this,Ie);this.info.programs=Xe.programs;var qe=new THREE.WebGLBufferRenderer(Oe,Ne,Ue),Ye=new THREE.WebGLIndexedBufferRenderer(Oe,Ne,Ue);r(),this.context=Oe,this.capabilities=Ie,this.extensions=Ne,this.state=ze;var Ke=new THREE.WebGLShadowMap(this,ce,We);this.shadowMap=Ke;var Qe=new THREE.SpritePlugin(this,fe),Ze=new THREE.LensFlarePlugin(this,me);this.getContext=function(){return Oe},this.getContextAttributes=function(){return Oe.getContextAttributes()},this.forceContextLoss=function(){Ne.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=Ne.get("EXT_texture_filter_anisotropic");return e=null!==t?Oe.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return Ie.precision},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(e){void 0!==e&&(ee=e)},this.getSize=function(){return{width:J,height:$}},this.setSize=function(e,t,r){J=e,$=t,Q.width=e*ee,Q.height=t*ee,r!==!1&&(Q.style.width=e+"px",Q.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,i){be=e*ee,we=t*ee,Me=r*ee,Se=i*ee,Oe.viewport(be,we,Me,Se)},this.getViewport=function(e){e.x=be/ee,e.y=we/ee,e.z=Me/ee,e.w=Se/ee},this.setScissor=function(e,t,r,i){Oe.scissor(e*ee,t*ee,r*ee,i*ee)},this.enableScissorTest=function(e){ze.setScissorTest(e)},this.getClearColor=function(){return se},this.setClearColor=function(e,r){se.set(e),he=void 0!==r?r:1,t(se.r,se.g,se.b,he)},this.getClearAlpha=function(){return he},this.setClearAlpha=function(e){he=e,t(se.r,se.g,se.b,he)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=Oe.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=Oe.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=Oe.STENCIL_BUFFER_BIT),Oe.clear(i)},this.clearColor=function(){Oe.clear(Oe.COLOR_BUFFER_BIT)},this.clearDepth=function(){Oe.clear(Oe.DEPTH_BUFFER_BIT)},this.clearStencil=function(){Oe.clear(Oe.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,r,i){this.setRenderTarget(e),this.clear(t,r,i)},this.resetGLState=i,this.dispose=function(){Q.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(e,t,r){ze.initAttributes();var i=je.get(e);e.hasPositions&&!i.position&&(i.position=Oe.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=Oe.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=Oe.createBuffer()),e.hasColors&&!i.color&&(i.color=Oe.createBuffer());var n=t.getAttributes();if(e.hasPositions&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.position),Oe.bufferData(Oe.ARRAY_BUFFER,e.positionArray,Oe.DYNAMIC_DRAW),ze.enableAttribute(n.position),Oe.vertexAttribPointer(n.position,3,Oe.FLOAT,!1,0,0)),e.hasNormals){if(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&r.shading===THREE.FlatShading)for(var o=0,a=3*e.count;a>o;o+=9){var s=e.normalArray,h=(s[o+0]+s[o+3]+s[o+6])/3,c=(s[o+1]+s[o+4]+s[o+7])/3,u=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=h,s[o+1]=c,s[o+2]=u,s[o+3]=h,s[o+4]=c,s[o+5]=u,s[o+6]=h,s[o+7]=c,s[o+8]=u}Oe.bufferData(Oe.ARRAY_BUFFER,e.normalArray,Oe.DYNAMIC_DRAW),ze.enableAttribute(n.normal),Oe.vertexAttribPointer(n.normal,3,Oe.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.uv),Oe.bufferData(Oe.ARRAY_BUFFER,e.uvArray,Oe.DYNAMIC_DRAW),ze.enableAttribute(n.uv),Oe.vertexAttribPointer(n.uv,2,Oe.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==THREE.NoColors&&(Oe.bindBuffer(Oe.ARRAY_BUFFER,i.color),Oe.bufferData(Oe.ARRAY_BUFFER,e.colorArray,Oe.DYNAMIC_DRAW),ze.enableAttribute(n.color),Oe.vertexAttribPointer(n.color,3,Oe.FLOAT,!1,0,0)),ze.disableUnusedAttributes(),Oe.drawArrays(Oe.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,r,i,n,o,a){y(n);var s=H(e,t,r,n,o),h=!1,c=i.id+"_"+s.id+"_"+n.wireframe;c!==Re&&(Re=c,h=!0);var u=o.morphTargetInfluences;if(void 0!==u){for(var l=[],d=0,f=u.length;f>d;d++){var m=u[d];l.push([m,d])}l.sort(p),l.length>8&&(l.length=8);for(var T=i.morphAttributes,d=0,f=l.length;f>d;d++){var m=l[d];if(de[d]=m[0],0!==m[0]){var v=m[1];n.morphTargets===!0&&T.position&&i.addAttribute("morphTarget"+d,T.position[v]),n.morphNormals===!0&&T.normal&&i.addAttribute("morphNormal"+d,T.normal[v])}else n.morphTargets===!0&&i.removeAttribute("morphTarget"+d),n.morphNormals===!0&&i.removeAttribute("morphNormal"+d)}var g=s.getUniforms();null!==g.morphTargetInfluences&&Oe.uniform1fv(g.morphTargetInfluences,de),h=!0}var v=i.index,R=i.attributes.position;n.wireframe===!0&&(v=We.getWireframeAttribute(i));var x;null!==v?(x=Ye,x.setIndex(v)):x=qe,h&&(E(n,s,i),null!==v&&Oe.bindBuffer(Oe.ELEMENT_ARRAY_BUFFER,We.getAttributeBuffer(v)));var b=0,w=1/0;null!==v?w=v.count:void 0!==R&&(w=R.count);var M=i.drawRange.start,S=i.drawRange.count,_=null!==a?a.start:0,A=null!==a?a.count:1/0,C=Math.max(b,M,_),L=Math.min(b+w,M+S,_+A)-1,P=Math.max(0,L-C+1);if(o instanceof THREE.Mesh)n.wireframe===!0?(ze.setLineWidth(n.wireframeLinewidth*ee),x.setMode(Oe.LINES)):x.setMode(Oe.TRIANGLES),i instanceof THREE.InstancedBufferGeometry&&i.maxInstancedCount>0?x.renderInstances(i):x.render(C,P);else if(o instanceof THREE.Line){var D=n.linewidth;void 0===D&&(D=1),ze.setLineWidth(D*ee),o instanceof THREE.LineSegments?x.setMode(Oe.LINES):x.setMode(Oe.LINE_STRIP),x.render(C,P)}else o instanceof THREE.Points&&(x.setMode(Oe.POINTS),x.render(C,P))},this.render=function(e,t,r,i){if(t instanceof THREE.Camera==!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var n=e.fog;if(Re="",ye=-1,He=null,ke=!0,e.autoUpdate===!0&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),Le.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Ce.setFromMatrix(Le),ce.length=0,le=-1,pe=-1,fe.length=0,me.length=0,T(e,t),ue.length=le+1,Ee.length=pe+1,Te.sortObjects===!0&&(ue.sort(d),Ee.sort(f)),Ke.render(e),Ue.calls=0,Ue.vertices=0,Ue.faces=0,Ue.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial){var o=e.overrideMaterial;v(ue,t,ce,n,o),v(Ee,t,ce,n,o)}else ze.setBlending(THREE.NoBlending),v(ue,t,ce,n),v(Ee,t,ce,n);if(Qe.render(e,t),Ze.render(e,t,_e,Ae),r){var a=r.texture,s=G(r);a.generateMipmaps&&s&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&q(r)}ze.setDepthTest(!0),ze.setDepthWrite(!0),ze.setColorWrite(!0)},this.setFaceCulling=function(e,t){e===THREE.CullFaceNone?ze.disable(Oe.CULL_FACE):(t===THREE.FrontFaceDirectionCW?Oe.frontFace(Oe.CW):Oe.frontFace(Oe.CCW),e===THREE.CullFaceBack?Oe.cullFace(Oe.BACK):e===THREE.CullFaceFront?Oe.cullFace(Oe.FRONT):Oe.cullFace(Oe.FRONT_AND_BACK),ze.enable(Oe.CULL_FACE))},this.setTexture=function(e,t){var r=je.get(e);if(e.version>0&&r.__version!==e.version){var i=e.image;return void 0===i?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e):i.complete===!1?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e):void O(r,e,t)}ze.activeTexture(Oe.TEXTURE0+t),ze.bindTexture(Oe.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(e){var t=e instanceof THREE.WebGLRenderTargetCube;if(e&&void 0===je.get(e).__webglFramebuffer){var r=je.get(e),i=je.get(e.texture);void 0===e.depthBuffer&&(e.depthBuffer=!0),void 0===e.stencilBuffer&&(e.stencilBuffer=!0),e.addEventListener("dispose",a),i.__webglTexture=Oe.createTexture(),Fe.textures++;var n=G(e),o=K(e.texture.format),s=K(e.texture.type);if(t){r.__webglFramebuffer=[],r.__webglRenderbuffer=[],ze.bindTexture(Oe.TEXTURE_CUBE_MAP,i.__webglTexture),U(Oe.TEXTURE_CUBE_MAP,e.texture,n);for(var h=0;6>h;h++)r.__webglFramebuffer[h]=Oe.createFramebuffer(),r.__webglRenderbuffer[h]=Oe.createRenderbuffer(),ze.texImage2D(Oe.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,o,e.width,e.height,0,o,s,null),W(r.__webglFramebuffer[h],e,Oe.TEXTURE_CUBE_MAP_POSITIVE_X+h),X(r.__webglRenderbuffer[h],e);e.texture.generateMipmaps&&n&&Oe.generateMipmap(Oe.TEXTURE_CUBE_MAP)}else r.__webglFramebuffer=Oe.createFramebuffer(),e.shareDepthFrom?r.__webglRenderbuffer=e.shareDepthFrom.__webglRenderbuffer:r.__webglRenderbuffer=Oe.createRenderbuffer(),ze.bindTexture(Oe.TEXTURE_2D,i.__webglTexture),U(Oe.TEXTURE_2D,e.texture,n),ze.texImage2D(Oe.TEXTURE_2D,0,o,e.width,e.height,0,o,s,null),W(r.__webglFramebuffer,e,Oe.TEXTURE_2D),e.shareDepthFrom?e.depthBuffer&&!e.stencilBuffer?Oe.framebufferRenderbuffer(Oe.FRAMEBUFFER,Oe.DEPTH_ATTACHMENT,Oe.RENDERBUFFER,r.__webglRenderbuffer):e.depthBuffer&&e.stencilBuffer&&Oe.framebufferRenderbuffer(Oe.FRAMEBUFFER,Oe.DEPTH_STENCIL_ATTACHMENT,Oe.RENDERBUFFER,r.__webglRenderbuffer):X(r.__webglRenderbuffer,e),e.texture.generateMipmaps&&n&&Oe.generateMipmap(Oe.TEXTURE_2D);t?ze.bindTexture(Oe.TEXTURE_CUBE_MAP,null):ze.bindTexture(Oe.TEXTURE_2D,null),Oe.bindRenderbuffer(Oe.RENDERBUFFER,null),Oe.bindFramebuffer(Oe.FRAMEBUFFER,null)}var c,u,l,E,p;if(e){var r=je.get(e);c=t?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,u=e.width,l=e.height,E=0,p=0}else c=null,u=Me,l=Se,E=be,p=we;if(c!==ge&&(Oe.bindFramebuffer(Oe.FRAMEBUFFER,c),Oe.viewport(E,p,u,l),ge=c),t){var i=je.get(e.texture);Oe.framebufferTexture2D(Oe.FRAMEBUFFER,Oe.COLOR_ATTACHMENT0,Oe.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,i.__webglTexture,0)}_e=u,Ae=l},this.readRenderTargetPixels=function(e,t,r,i,n,o){if(e instanceof THREE.WebGLRenderTarget==!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=je.get(e).__webglFramebuffer;if(a){var s=!1;a!==ge&&(Oe.bindFramebuffer(Oe.FRAMEBUFFER,a),s=!0);try{var h=e.texture;if(h.format!==THREE.RGBAFormat&&K(h.format)!==Oe.getParameter(Oe.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h.type===THREE.UnsignedByteType||K(h.type)===Oe.getParameter(Oe.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===THREE.FloatType&&Ne.get("WEBGL_color_buffer_float")||h.type===THREE.HalfFloatType&&Ne.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Oe.checkFramebufferStatus(Oe.FRAMEBUFFER)===Oe.FRAMEBUFFER_COMPLETE?Oe.readPixels(t,r,i,n,K(h.format),K(h.type),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Oe.bindFramebuffer(Oe.FRAMEBUFFER,ge)}}},this.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),Ne.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),Ne.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),Ne.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),Ne.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),Ne.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),Ne.get("EXT_blend_minmax")},this.supportsVertexTextures=function(){return Ie.vertexTextures},this.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),Ne.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 Ke.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),Ke.enabled=e}},shadowMapType:{get:function(){return Ke.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),Ke.type=e}},shadowMapCullFace:{get:function(){return Ke.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),Ke.cullFace=e}},shadowMapDebug:{get:function(){return Ke.debug},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug."),Ke.debug=e}}})},THREE.WebGLRenderTarget=function(e,t,r){this.uuid=THREE.Math.generateUUID(),this.width=e,this.height=t,r=r||{},void 0===r.minFilter&&(r.minFilter=THREE.LinearFilter),this.texture=new THREE.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy),this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0,this.shareDepthFrom=void 0!==r.shareDepthFrom?r.shareDepthFrom:null},THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,get wrapS(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set wrapS(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e},get wrapT(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set wrapT(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e},get magFilter(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set magFilter(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e},get minFilter(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set minFilter(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e},get anisotropy(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set anisotropy(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e},get offset(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set offset(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e},get repeat(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set repeat(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e},get format(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set format(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e},get type(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set type(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e},get generateMipmaps(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set generateMipmaps(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e},setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose())},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.shareDepthFrom=e.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube=function(e,t,r){THREE.WebGLRenderTarget.call(this,e,t,r),this.activeCubeFace=0},THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube,THREE.WebGLBufferRenderer=function(e,t,r){function i(e){a=e}function n(t,i){e.drawArrays(a,t,i),r.calls++,r.vertices+=i,a===e.TRIANGLES&&(r.faces+=i/3)}function o(e){var r=t.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var i=e.attributes.position;i instanceof THREE.InterleavedBufferAttribute?r.drawArraysInstancedANGLE(a,0,i.data.count,e.maxInstancedCount):r.drawArraysInstancedANGLE(a,0,i.count,e.maxInstancedCount)}var a;this.setMode=i,this.render=n,this.renderInstances=o},THREE.WebGLIndexedBufferRenderer=function(e,t,r){function i(e){s=e}function n(r){r.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(h=e.UNSIGNED_INT,c=4):(h=e.UNSIGNED_SHORT,c=2)}function o(t,i){e.drawElements(s,i,h,t*c),r.calls++,r.vertices+=i,s===e.TRIANGLES&&(r.faces+=i/3)}function a(e){var r=t.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var i=e.index;r.drawElementsInstancedANGLE(s,i.array.length,h,0,e.maxInstancedCount)}var s,h,c;this.setMode=i,this.setIndex=n,this.render=o,this.renderInstances=a},THREE.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); +break;default:i=e.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=i,i}},THREE.WebGLCapabilities=function(e,t,r){function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer?r.logarithmicDepthBuffer:!1,this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubemapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=e.getParameter(e.MAX_VARYING_VECTORS),this.maxFragmentUniforms=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=this.maxVertexTextures>0,this.floatFragmentTextures=!!t.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;var n=i(this.precision);n!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",n,"instead."),this.precision=n),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!t.get("EXT_frag_depth"))},THREE.WebGLGeometries=function(e,t,r){function i(e){var t=e.geometry;if(void 0!==c[t.id])return c[t.id];t.addEventListener("dispose",n);var i;return t instanceof THREE.BufferGeometry?i=t:t instanceof THREE.Geometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new THREE.BufferGeometry).setFromObject(e)),i=t._bufferGeometry),c[t.id]=i,r.memory.geometries++,i}function n(e){var i=e.target,o=c[i.id];s(o.attributes),i.removeEventListener("dispose",n),delete c[i.id];var h=t.get(i);h.wireframe&&a(h.wireframe),r.memory.geometries--}function o(e){return e instanceof THREE.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function a(t){var r=o(t);void 0!==r&&(e.deleteBuffer(r),h(t))}function s(e){for(var t in e)a(e[t])}function h(e){e instanceof THREE.InterleavedBufferAttribute?t["delete"](e.data):t["delete"](e)}var c={};this.get=i},THREE.WebGLObjects=function(e,t,r){function i(t){var r=u.get(t);t.geometry instanceof THREE.Geometry&&r.updateFromObject(t);var i=r.index,o=r.attributes;null!==i&&n(i,e.ELEMENT_ARRAY_BUFFER);for(var a in o)n(o[a],e.ARRAY_BUFFER);var s=r.morphAttributes;for(var a in s)for(var h=s[a],c=0,l=h.length;l>c;c++)n(h[c],e.ARRAY_BUFFER);return r}function n(e,r){var i=e instanceof THREE.InterleavedBufferAttribute?e.data:e,n=t.get(i);void 0===n.__webglBuffer?o(n,i,r):n.version!==i.version&&a(n,i,r)}function o(t,r,i){t.__webglBuffer=e.createBuffer(),e.bindBuffer(i,t.__webglBuffer);var n=r.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW;e.bufferData(i,r.array,n),t.version=r.version}function a(t,r,i){e.bindBuffer(i,t.__webglBuffer),r.dynamic===!1||-1===r.updateRange.count?e.bufferSubData(i,0,r.array):0===r.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(i,r.updateRange.offset*r.array.BYTES_PER_ELEMENT,r.array.subarray(r.updateRange.offset,r.updateRange.offset+r.updateRange.count)),r.updateRange.count=0),t.version=r.version}function s(e){return e instanceof THREE.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function h(r){var i=t.get(r);if(void 0!==i.wireframe)return i.wireframe;var o=[],a=r.index,s=r.attributes,h=s.position;if(null!==a)for(var u={},l=a.array,E=0,p=l.length;p>E;E+=3){var d=l[E+0],f=l[E+1],m=l[E+2];c(u,d,f)&&o.push(d,f),c(u,f,m)&&o.push(f,m),c(u,m,d)&&o.push(m,d)}else for(var l=s.position.array,E=0,p=l.length/3-1;p>E;E+=3){var d=E+0,f=E+1,m=E+2;o.push(d,f,f,m,m,d)}var T=h.count>65535?Uint32Array:Uint16Array,v=new THREE.BufferAttribute(new T(o),1);return n(v,e.ELEMENT_ARRAY_BUFFER),i.wireframe=v,v}function c(e,t,r){if(t>r){var i=t;t=r,r=i}var n=e[t];return void 0===n?(e[t]=[r],!0):-1===n.indexOf(r)?(n.push(r),!0):!1}var u=new THREE.WebGLGeometries(e,t,r);this.getAttributeBuffer=s,this.getWireframeAttribute=h,this.update=i},THREE.WebGLProgram=function(){function e(e){var t=[];for(var r in e){var i=e[r];i!==!1&&t.push("#define "+r+" "+i)}return t.join("\n")}function t(e,t,r){for(var i={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),o=0;n>o;o++){var a=e.getActiveUniform(t,o),s=a.name,h=e.getUniformLocation(t,s),c=s.lastIndexOf("[0]");-1!==c&&c===s.length-3&&(i[s.substr(0,c)]=h),i[s]=h}return i}function r(e,t,r){for(var i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),o=0;n>o;o++){var a=e.getActiveAttrib(t,o),s=a.name;i[s]=e.getAttribLocation(t,s)}return i}function i(e){return""!==e}var n=0;return function(o,a,s,h){var c=o.context,u=s.defines,l=s.__webglShader.vertexShader,E=s.__webglShader.fragmentShader,p="SHADOWMAP_TYPE_BASIC";h.shadowMapType===THREE.PCFShadowMap?p="SHADOWMAP_TYPE_PCF":h.shadowMapType===THREE.PCFSoftShadowMap&&(p="SHADOWMAP_TYPE_PCF_SOFT");var d="ENVMAP_TYPE_CUBE",f="ENVMAP_MODE_REFLECTION",m="ENVMAP_BLENDING_MULTIPLY";if(h.envMap){switch(s.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:d="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:d="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:d="ENVMAP_TYPE_SPHERE"}switch(s.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:f="ENVMAP_MODE_REFRACTION"}switch(s.combine){case THREE.MultiplyOperation:m="ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:m="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:m="ENVMAP_BLENDING_ADD"}}var T,v,g=o.gammaFactor>0?o.gammaFactor:1,y=e(u),R=c.createProgram();s instanceof THREE.RawShaderMaterial?(T="",v=""):(T=["precision "+h.precision+" float;","precision "+h.precision+" int;","#define SHADER_NAME "+s.__webglShader.name,y,h.supportsVertexTextures?"#define VERTEX_TEXTURES":"",o.gammaInput?"#define GAMMA_INPUT":"",o.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+g,"#define MAX_DIR_LIGHTS "+h.maxDirLights,"#define MAX_POINT_LIGHTS "+h.maxPointLights,"#define MAX_SPOT_LIGHTS "+h.maxSpotLights,"#define MAX_HEMI_LIGHTS "+h.maxHemiLights,"#define MAX_SHADOWS "+h.maxShadows,"#define MAX_BONES "+h.maxBones,h.map?"#define USE_MAP":"",h.envMap?"#define USE_ENVMAP":"",h.envMap?"#define "+f:"",h.lightMap?"#define USE_LIGHTMAP":"",h.aoMap?"#define USE_AOMAP":"",h.emissiveMap?"#define USE_EMISSIVEMAP":"",h.bumpMap?"#define USE_BUMPMAP":"",h.normalMap?"#define USE_NORMALMAP":"",h.displacementMap&&h.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",h.specularMap?"#define USE_SPECULARMAP":"",h.alphaMap?"#define USE_ALPHAMAP":"",h.vertexColors?"#define USE_COLOR":"",h.flatShading?"#define FLAT_SHADED":"",h.skinning?"#define USE_SKINNING":"",h.useVertexTexture?"#define BONE_TEXTURE":"",h.morphTargets?"#define USE_MORPHTARGETS":"",h.morphNormals&&h.flatShading===!1?"#define USE_MORPHNORMALS":"",h.doubleSided?"#define DOUBLE_SIDED":"",h.flipSided?"#define FLIP_SIDED":"",h.shadowMapEnabled?"#define USE_SHADOWMAP":"",h.shadowMapEnabled?"#define "+p:"",h.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",h.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",h.sizeAttenuation?"#define USE_SIZEATTENUATION":"",h.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",h.logarithmicDepthBuffer&&o.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(i).join("\n"),v=[h.bumpMap||h.normalMap||h.flatShading||s.derivatives?"#extension GL_OES_standard_derivatives : enable":"",h.logarithmicDepthBuffer&&o.extensions.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"","precision "+h.precision+" float;","precision "+h.precision+" int;","#define SHADER_NAME "+s.__webglShader.name,y,"#define MAX_DIR_LIGHTS "+h.maxDirLights,"#define MAX_POINT_LIGHTS "+h.maxPointLights,"#define MAX_SPOT_LIGHTS "+h.maxSpotLights,"#define MAX_HEMI_LIGHTS "+h.maxHemiLights,"#define MAX_SHADOWS "+h.maxShadows,h.alphaTest?"#define ALPHATEST "+h.alphaTest:"",o.gammaInput?"#define GAMMA_INPUT":"",o.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+g,h.useFog&&h.fog?"#define USE_FOG":"",h.useFog&&h.fogExp?"#define FOG_EXP2":"",h.map?"#define USE_MAP":"",h.envMap?"#define USE_ENVMAP":"",h.envMap?"#define "+d:"",h.envMap?"#define "+f:"",h.envMap?"#define "+m:"",h.lightMap?"#define USE_LIGHTMAP":"",h.aoMap?"#define USE_AOMAP":"",h.emissiveMap?"#define USE_EMISSIVEMAP":"",h.bumpMap?"#define USE_BUMPMAP":"",h.normalMap?"#define USE_NORMALMAP":"",h.specularMap?"#define USE_SPECULARMAP":"",h.alphaMap?"#define USE_ALPHAMAP":"",h.vertexColors?"#define USE_COLOR":"",h.flatShading?"#define FLAT_SHADED":"",h.metal?"#define METAL":"",h.doubleSided?"#define DOUBLE_SIDED":"",h.flipSided?"#define FLIP_SIDED":"",h.shadowMapEnabled?"#define USE_SHADOWMAP":"",h.shadowMapEnabled?"#define "+p:"",h.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",h.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",h.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",h.logarithmicDepthBuffer&&o.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(i).join("\n"));var H=T+l,x=v+E,b=THREE.WebGLShader(c,c.VERTEX_SHADER,H),w=THREE.WebGLShader(c,c.FRAGMENT_SHADER,x);c.attachShader(R,b),c.attachShader(R,w),void 0!==s.index0AttributeName?c.bindAttribLocation(R,0,s.index0AttributeName):h.morphTargets===!0&&c.bindAttribLocation(R,0,"position"),c.linkProgram(R);var M=c.getProgramInfoLog(R),S=c.getShaderInfoLog(b),_=c.getShaderInfoLog(w),A=!0,C=!0;c.getProgramParameter(R,c.LINK_STATUS)===!1?(A=!1,console.error("THREE.WebGLProgram: shader error: ",c.getError(),"gl.VALIDATE_STATUS",c.getProgramParameter(R,c.VALIDATE_STATUS),"gl.getProgramInfoLog",M,S,_)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):(""===S||""===_)&&(C=!1),C&&(this.diagnostics={runnable:A,material:s,programLog:M,vertexShader:{log:S,prefix:T},fragmentShader:{log:_,prefix:v}}),c.deleteShader(b),c.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=t(c,R)),L};var P;return this.getAttributes=function(){return void 0===P&&(P=r(c,R)),P},this.destroy=function(){c.deleteProgram(R),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=n++,this.code=a,this.usedTimes=1,this.program=R,this.vertexShader=b,this.fragmentShader=w,this}}(),THREE.WebGLPrograms=function(e,t){function r(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var r=t.maxVertexUniforms,i=Math.floor((r-20)/4),n=i;return void 0!==e&&e instanceof THREE.SkinnedMesh&&(n=Math.min(e.skeleton.bones.length,n),no;o++){var s=e[o];s.visible!==!1&&(s instanceof THREE.DirectionalLight&&t++,s instanceof THREE.PointLight&&r++,s instanceof THREE.SpotLight&&i++,s instanceof THREE.HemisphereLight&&n++)}return{directional:t,point:r,spot:i,hemi:n}}function n(e){for(var t=0,r=0,i=0,n=e.length;n>i;i++){var o=e[i];o.castShadow&&((o instanceof THREE.SpotLight||o instanceof THREE.DirectionalLight)&&t++,o instanceof THREE.PointLight&&(t++,r++))}return{maxShadows:t,pointLightShadows:r}}var o=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},s=["precision","supportsVertexTextures","map","envMap","envMapMode","lightMap","aoMap","emissiveMap","bumpMap","normalMap","displacementMap","specularMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","maxDirLights","maxPointLights","maxSpotLights","maxHemiLights","maxShadows","shadowMapEnabled","pointLightShadows","shadowMapType","shadowMapDebug","alphaTest","metal","doubleSided","flipSided"];this.getParameters=function(o,s,h,c){var u=a[o.type],l=i(s),E=n(s),p=r(c),d=e.getPrecision();null!==o.precision&&(d=t.getMaxPrecision(o.precision),d!==o.precision&&console.warn("THREE.WebGLRenderer.initMaterial:",o.precision,"not supported, using",d,"instead."));var f={shaderID:u,precision:d,supportsVertexTextures:t.vertexTextures,map:!!o.map,envMap:!!o.envMap,envMapMode:o.envMap&&o.envMap.mapping,lightMap:!!o.lightMap,aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,displacementMap:!!o.displacementMap,specularMap:!!o.specularMap,alphaMap:!!o.alphaMap,combine:o.combine,vertexColors:o.vertexColors,fog:h,useFog:o.fog,fogExp:h instanceof THREE.FogExp2,flatShading:o.shading===THREE.FlatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:o.skinning,maxBones:p,useVertexTexture:t.floatVertexTextures&&c&&c.skeleton&&c.skeleton.useVertexTexture,morphTargets:o.morphTargets,morphNormals:o.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,maxDirLights:l.directional,maxPointLights:l.point,maxSpotLights:l.spot,maxHemiLights:l.hemi,maxShadows:E.maxShadows,pointLightShadows:E.pointLightShadows,shadowMapEnabled:e.shadowMap.enabled&&c.receiveShadow&&E.maxShadows>0,shadowMapType:e.shadowMap.type,shadowMapDebug:e.shadowMap.debug,alphaTest:o.alphaTest,metal:o.metal,doubleSided:o.side===THREE.DoubleSide,flipSided:o.side===THREE.BackSide};return f},this.getProgramCode=function(e,t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(var n=0;na;a++){var h=o[a];if(h.code===i){n=h,++n.usedTimes;break}}return void 0===n&&(n=new THREE.WebGLProgram(e,i,t,r),o.push(n)),n},this.releaseProgram=function(e){if(0===--e.usedTimes){var t=o.indexOf(e);o[t]=o[o.length-1],o.pop(),e.destroy()}},this.programs=o},THREE.WebGLProperties=function(){var e={};this.get=function(t){var r=t.uuid,i=e[r];return void 0===i&&(i={},e[r]=i),i},this["delete"]=function(t){delete e[t.uuid]},this.clear=function(){e={}}},THREE.WebGLShader=function(){function e(e){for(var t=e.split("\n"),r=0;r0&&t.morphTargets,c=e instanceof THREE.SkinnedMesh&&t.skinning,u=0;h&&(u|=E),c&&(u|=p),o=a[u]}return o.visible=t.visible,o.wireframe=t.wireframe,o.wireframeLinewidth=t.wireframeLinewidth,r&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function n(e,t){if(e.visible!==!1){if((e instanceof THREE.Mesh||e instanceof THREE.Line||e instanceof THREE.Points)&&e.castShadow&&(e.frustumCulled===!1||s.intersectsObject(e)===!0)){var r=e.material;r.visible===!0&&(e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld),l.push(e))}for(var i=e.children,o=0,a=i.length;a>o;o++)n(i[o],t)}}for(var o=e.context,a=e.state,s=new THREE.Frustum,h=new THREE.Matrix4,c=(new THREE.Vector3,new THREE.Vector3,new THREE.Vector3),u=new THREE.Vector3,l=[],E=1,p=2,d=(E|p)+1,f=new Array(d),m=new Array(d),T=[new THREE.Vector3(1,0,0),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1,0)],v=[new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1)],g=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],y=new THREE.Vector4,R=THREE.ShaderLib.depthRGBA,H=THREE.UniformsUtils.clone(R.uniforms),x=THREE.ShaderLib.distanceRGBA,b=THREE.UniformsUtils.clone(x.uniforms),w=0;w!==d;++w){var M=0!==(w&E),S=0!==(w&p),_=new THREE.ShaderMaterial({uniforms:H,vertexShader:R.vertexShader,fragmentShader:R.fragmentShader,morphTargets:M,skinning:S});_._shadowPass=!0,f[w]=_;var A=new THREE.ShaderMaterial({uniforms:b,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,morphTargets:M,skinning:S});A._shadowPass=!0,m[w]=A}var C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=THREE.PCFShadowMap,this.cullFace=THREE.CullFaceFront,this.render=function(E){var p,d;if(C.enabled!==!1&&(C.autoUpdate!==!1||C.needsUpdate!==!1)){o.clearColor(1,1,1,1),a.disable(o.BLEND),a.enable(o.CULL_FACE),o.frontFace(o.CCW),o.cullFace(C.cullFace===THREE.CullFaceFront?o.FRONT:o.BACK),a.setDepthTest(!0),e.getViewport(y);for(var f=0,m=t.length;m>f;f++){var R=t[f];if(R.castShadow===!0){var H=R.shadow,x=H.camera,b=H.mapSize;if(R instanceof THREE.PointLight){p=6,d=!0;var w=b.x/4,M=b.y/2;g[0].set(2*w,M,w,M),g[1].set(0,M,w,M),g[2].set(3*w,M,w,M),g[3].set(w,M,w,M),g[4].set(3*w,0,w,M),g[5].set(w,0,w,M)}else p=1,d=!1;if(null===H.map){var S=THREE.LinearFilter;C.type===THREE.PCFSoftShadowMap&&(S=THREE.NearestFilter);var _={minFilter:S,magFilter:S,format:THREE.RGBAFormat};H.map=new THREE.WebGLRenderTarget(b.x,b.y,_),H.matrix=new THREE.Matrix4,R instanceof THREE.SpotLight&&(x.aspect=b.x/b.y),x.updateProjectionMatrix()}var A=H.map,L=H.matrix;u.setFromMatrixPosition(R.matrixWorld),x.position.copy(u),e.setRenderTarget(A),e.clear();for(var P=0;p>P;P++){if(d){c.copy(x.position),c.add(T[P]),x.up.copy(v[P]),x.lookAt(c);var D=g[P];e.setViewport(D.x,D.y,D.z,D.w)}else c.setFromMatrixPosition(R.target.matrixWorld),x.lookAt(c);x.updateMatrixWorld(),x.matrixWorldInverse.getInverse(x.matrixWorld),L.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),L.multiply(x.projectionMatrix),L.multiply(x.matrixWorldInverse),h.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse),s.setFromMatrix(h),l.length=0,n(E,x);for(var k=0,V=l.length;V>k;k++){var F=l[k],U=r.update(F),O=F.material;if(O instanceof THREE.MeshFaceMaterial)for(var B=U.groups,G=O.materials,N=0,I=B.length;I>N;N++){var z=B[N],j=G[z.materialIndex];if(j.visible===!0){var W=i(F,j,d,u);e.renderBufferDirect(x,t,null,U,W,F,z)}}else{var W=i(F,O,d,u);e.renderBufferDirect(x,t,null,U,W,F,null)}}}e.resetGLState()}}e.setViewport(y.x,y.y,y.z,y.w);var X=e.getClearColor(),q=e.getClearAlpha();e.setClearColor(X,q),a.enable(o.BLEND),C.cullFace===THREE.CullFaceFront&&o.cullFace(o.BACK),e.resetGLState(),C.needsUpdate=!1}}},THREE.WebGLState=function(e,t,r){var i=this,n=new Uint8Array(16),o=new Uint8Array(16),a=new Uint8Array(16),s={},h=null,c=null,u=null,l=null,E=null,p=null,d=null,f=null,m=null,T=null,v=null,g=null,y=null,R=null,H=null,x=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),b=void 0,w={};this.init=function(){e.clearColor(0,0,0,1),e.clearDepth(1),e.clearStencil(0),this.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.frontFace(e.CCW),e.cullFace(e.BACK),this.enable(e.CULL_FACE),this.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var e=0,t=n.length;t>e;e++)n[e]=0},this.enableAttribute=function(r){if(n[r]=1,0===o[r]&&(e.enableVertexAttribArray(r),o[r]=1),0!==a[r]){var i=t.get("ANGLE_instanced_arrays");i.vertexAttribDivisorANGLE(r,0),a[r]=0}},this.enableAttributeAndDivisor=function(t,r,i){n[t]=1,0===o[t]&&(e.enableVertexAttribArray(t),o[t]=1),a[t]!==r&&(i.vertexAttribDivisorANGLE(t,r),a[t]=r)},this.disableUnusedAttributes=function(){for(var t=0,r=o.length;r>t;t++)o[t]!==n[t]&&(e.disableVertexAttribArray(t),o[t]=0)},this.enable=function(t){s[t]!==!0&&(e.enable(t),s[t]=!0)},this.disable=function(t){s[t]!==!1&&(e.disable(t),s[t]=!1)},this.getCompressedTextureFormats=function(){if(null===h&&(h=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")))for(var r=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),i=0;i0;var r;r=c?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},a=i(r),s={vertex:E.getAttribLocation(a,"position"),uv:E.getAttribLocation(a,"uv")},h={renderType:E.getUniformLocation(a,"renderType"),map:E.getUniformLocation(a,"map"),occlusionMap:E.getUniformLocation(a,"occlusionMap"),opacity:E.getUniformLocation(a,"opacity"),color:E.getUniformLocation(a,"color"),scale:E.getUniformLocation(a,"scale"),rotation:E.getUniformLocation(a,"rotation"),screenPosition:E.getUniformLocation(a,"screenPosition")}}function i(t){var r=E.createProgram(),i=E.createShader(E.FRAGMENT_SHADER),n=E.createShader(E.VERTEX_SHADER),o="precision "+e.getPrecision()+" float;\n";return E.shaderSource(i,o+t.fragmentShader),E.shaderSource(n,o+t.vertexShader),E.compileShader(i),E.compileShader(n),E.attachShader(r,i),E.attachShader(r,n),E.linkProgram(r),r}var n,o,a,s,h,c,u,l,E=e.context,p=e.state;this.render=function(i,d,f,m){if(0!==t.length){var T=new THREE.Vector3,v=m/f,g=.5*f,y=.5*m,R=16/m,H=new THREE.Vector2(R*v,R),x=new THREE.Vector3(1,1,0),b=new THREE.Vector2(1,1);void 0===a&&r(),E.useProgram(a),p.initAttributes(),p.enableAttribute(s.vertex),p.enableAttribute(s.uv),p.disableUnusedAttributes(),E.uniform1i(h.occlusionMap,0),E.uniform1i(h.map,1),E.bindBuffer(E.ARRAY_BUFFER,n),E.vertexAttribPointer(s.vertex,2,E.FLOAT,!1,16,0),E.vertexAttribPointer(s.uv,2,E.FLOAT,!1,16,8),E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,o),p.disable(E.CULL_FACE),E.depthMask(!1);for(var w=0,M=t.length;M>w;w++){R=16/m,H.set(R*v,R);var S=t[w];if(T.set(S.matrixWorld.elements[12],S.matrixWorld.elements[13],S.matrixWorld.elements[14]),T.applyMatrix4(d.matrixWorldInverse),T.applyProjection(d.projectionMatrix),x.copy(T),b.x=x.x*g+g,b.y=x.y*y+y,c||b.x>0&&b.x0&&b.y_;_++){var C=S.lensFlares[_];C.opacity>.001&&C.scale>.001&&(x.x=C.x,x.y=C.y,x.z=C.z,R=C.size*C.scale/m,H.x=R*v,H.y=R,E.uniform3f(h.screenPosition,x.x,x.y,x.z),E.uniform2f(h.scale,H.x,H.y),E.uniform1f(h.rotation,C.rotation),E.uniform1f(h.opacity,C.opacity),E.uniform3f(h.color,C.color.r,C.color.g,C.color.b),p.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),e.setTexture(C.texture,1),E.drawElements(E.TRIANGLES,6,E.UNSIGNED_SHORT,0))}}}p.enable(E.CULL_FACE),p.enable(E.DEPTH_TEST),E.depthMask(!0),e.resetGLState(); +}}},THREE.SpritePlugin=function(e,t){function r(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);o=l.createBuffer(),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,o),l.bufferData(l.ARRAY_BUFFER,e,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.bufferData(l.ELEMENT_ARRAY_BUFFER,t,l.STATIC_DRAW),s=i(),h={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},c={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var r=document.createElement("canvas");r.width=8,r.height=8;var n=r.getContext("2d");n.fillStyle="white",n.fillRect(0,0,8,8),u=new THREE.Texture(r),u.needsUpdate=!0}function i(){var t=l.createProgram(),r=l.createShader(l.VERTEX_SHADER),i=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(r,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(r),l.compileShader(i),l.attachShader(t,r),l.attachShader(t,i),l.linkProgram(t),t}function n(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var o,a,s,h,c,u,l=e.context,E=e.state,p=new THREE.Vector3,d=new THREE.Quaternion,f=new THREE.Vector3;this.render=function(i,m){if(0!==t.length){void 0===s&&r(),l.useProgram(s),E.initAttributes(),E.enableAttribute(h.position),E.enableAttribute(h.uv),E.disableUnusedAttributes(),E.disable(l.CULL_FACE),E.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,o),l.vertexAttribPointer(h.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(h.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.uniformMatrix4fv(c.projectionMatrix,!1,m.projectionMatrix.elements),E.activeTexture(l.TEXTURE0),l.uniform1i(c.map,0);var T=0,v=0,g=i.fog;g?(l.uniform3f(c.fogColor,g.color.r,g.color.g,g.color.b),g instanceof THREE.Fog?(l.uniform1f(c.fogNear,g.near),l.uniform1f(c.fogFar,g.far),l.uniform1i(c.fogType,1),T=1,v=1):g instanceof THREE.FogExp2&&(l.uniform1f(c.fogDensity,g.density),l.uniform1i(c.fogType,2),T=2,v=2)):(l.uniform1i(c.fogType,0),T=0,v=0);for(var y=0,R=t.length;R>y;y++){var H=t[y];H.modelViewMatrix.multiplyMatrices(m.matrixWorldInverse,H.matrixWorld),H.z=-H.modelViewMatrix.elements[14]}t.sort(n);for(var x=[],y=0,R=t.length;R>y;y++){var H=t[y],b=H.material;l.uniform1f(c.alphaTest,b.alphaTest),l.uniformMatrix4fv(c.modelViewMatrix,!1,H.modelViewMatrix.elements),H.matrixWorld.decompose(p,d,f),x[0]=f.x,x[1]=f.y;var w=0;i.fog&&b.fog&&(w=v),T!==w&&(l.uniform1i(c.fogType,w),T=w),null!==b.map?(l.uniform2f(c.uvOffset,b.map.offset.x,b.map.offset.y),l.uniform2f(c.uvScale,b.map.repeat.x,b.map.repeat.y)):(l.uniform2f(c.uvOffset,0,0),l.uniform2f(c.uvScale,1,1)),l.uniform1f(c.opacity,b.opacity),l.uniform3f(c.color,b.color.r,b.color.g,b.color.b),l.uniform1f(c.rotation,b.rotation),l.uniform2fv(c.scale,x),E.setBlending(b.blending,b.blendEquation,b.blendSrc,b.blendDst),E.setDepthTest(b.depthTest),E.setDepthWrite(b.depthWrite),b.map&&b.map.image&&b.map.image.width?e.setTexture(b.map,0):e.setTexture(u,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0)}E.enable(l.CULL_FACE),e.resetGLState()}}},THREE.CurveUtils={tangentQuadraticBezier:function(e,t,r,i){return 2*(1-e)*(r-t)+2*e*(i-r)},tangentCubicBezier:function(e,t,r,i,n){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*i*(1-e)-3*e*e*i+3*e*e*n},tangentSpline:function(e,t,r,i,n){var o=6*e*e-6*e,a=3*e*e-4*e+1,s=-6*e*e+6*e,h=3*e*e-2*e;return o+a+s+h},interpolate:function(e,t,r,i,n){var o=.5*(r-e),a=.5*(i-t),s=n*n,h=n*s;return(2*t-2*r+o+a)*h+(-3*t+3*r-2*o-a)*s+o*n+t}},THREE.GeometryUtils={merge:function(e,t,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;t instanceof THREE.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,i){console.warn("THREE.ImageUtils.loadTexture is being deprecated. Use THREE.TextureLoader() instead.");var n=new THREE.TextureLoader;n.setCrossOrigin(this.crossOrigin);var o=n.load(e,r,void 0,i);return t&&(o.mapping=t),o},loadTextureCube:function(e,t,r,i){console.warn("THREE.ImageUtils.loadTextureCube is being deprecated. Use THREE.CubeTextureLoader() instead.");var n=new THREE.CubeTextureLoader;n.setCrossOrigin(this.crossOrigin);var o=n.load(e,r,void 0,i);return t&&(o.mapping=t),o},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},THREE.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new THREE.Group,i=0,n=t.length;n>i;i++)r.add(new THREE.Mesh(e,t[i]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var i=new THREE.Matrix4;i.getInverse(r.matrixWorld),e.applyMatrix(i),t.remove(e),r.add(e)}},THREE.ShapeUtils={area:function(e){for(var t=e.length,r=0,i=t-1,n=0;t>n;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r},triangulate:function(){function e(e,t,r,i,n,o){var a,s,h,c,u,l,E,p,d;if(s=e[o[t]].x,h=e[o[t]].y,c=e[o[r]].x,u=e[o[r]].y,l=e[o[i]].x,E=e[o[i]].y,Number.EPSILON>(c-s)*(E-h)-(u-h)*(l-s))return!1;var f,m,T,v,g,y,R,H,x,b,w,M,S,_,A;for(f=l-c,m=E-u,T=s-l,v=h-E,g=c-s,y=u-h,a=0;n>a;a++)if(p=e[o[a]].x,d=e[o[a]].y,!(p===s&&d===h||p===c&&d===u||p===l&&d===E)&&(R=p-s,H=d-h,x=p-c,b=d-u,w=p-l,M=d-E,A=f*b-m*x,S=g*H-y*R,_=T*M-v*w,A>=-Number.EPSILON&&_>=-Number.EPSILON&&S>=-Number.EPSILON))return!1;return!0}return function(t,r){var i=t.length;if(3>i)return null;var n,o,a,s=[],h=[],c=[];if(THREE.ShapeUtils.area(t)>0)for(o=0;i>o;o++)h[o]=o;else for(o=0;i>o;o++)h[o]=i-1-o;var u=i,l=2*u;for(o=u-1;u>2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),r?c:s;if(n=o,n>=u&&(n=0),o=n+1,o>=u&&(o=0),a=o+1,a>=u&&(a=0),e(t,n,o,a,u,h)){var E,p,d,f,m;for(E=h[n],p=h[o],d=h[a],s.push([t[E],t[p],t[d]]),c.push([h[n],h[o],h[a]]),f=o,m=o+1;u>m;f++,m++)h[f]=h[m];u--,l=2*u}}return r?c:s}}(),triangulateShape:function(e,t){function r(e,t,r){return e.x!==t.x?e.xNumber.EPSILON){var d;if(E>0){if(0>p||p>E)return[];if(d=c*u-h*l,0>d||d>E)return[]}else{if(p>0||E>p)return[];if(d=c*u-h*l,d>0||E>d)return[]}if(0===d)return!o||0!==p&&p!==E?[e]:[];if(d===E)return!o||0!==p&&p!==E?[t]:[];if(0===p)return[i];if(p===E)return[n];var f=d/E;return[{x:e.x+f*a,y:e.y+f*s}]}if(0!==p||c*u!==h*l)return[];var m=0===a&&0===s,T=0===h&&0===c;if(m&&T)return e.x!==i.x||e.y!==i.y?[]:[e];if(m)return r(i,n,e)?[e]:[];if(T)return r(e,t,i)?[i]:[];var v,g,y,R,H,x,b,w;return 0!==a?(e.x=y?b>R?[]:R===b?o?[]:[H]:w>=R?[H,g]:[H,x]:y>w?[]:y===w?o?[]:[v]:w>=R?[v,g]:[v,x]}function n(e,t,r,i){var n=t.x-e.x,o=t.y-e.y,a=r.x-e.x,s=r.y-e.y,h=i.x-e.x,c=i.y-e.y,u=n*s-o*a,l=n*c-o*h;if(Math.abs(u)>Number.EPSILON){var E=h*s-c*a;return u>0?l>=0&&E>=0:l>=0||E>=0}return l>0}function o(e,t){function r(e,t){var r=v.length-1,i=e-1;0>i&&(i=r);var o=e+1;o>r&&(o=0);var a=n(v[e],v[i],v[o],s[t]);if(!a)return!1;var h=s.length-1,c=t-1;0>c&&(c=h);var u=t+1;return u>h&&(u=0),a=n(s[t],s[c],s[u],v[e]),a?!0:!1}function o(e,t){var r,n,o;for(r=0;r0)return!0;return!1}function a(e,r){var n,o,a,s,h;for(n=0;n0)return!0;return!1}for(var s,h,c,u,l,E,p,d,f,m,T,v=e.concat(),g=[],y=[],R=0,H=t.length;H>R;R++)g.push(R);for(var x=0,b=2*g.length;g.length>0;){if(b--,0>b){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(c=x;c=0)break;y[p]=!0}if(h>=0)break}}return v}for(var a,s,h,c,u,l,E={},p=e.concat(),d=0,f=t.length;f>d;d++)Array.prototype.push.apply(p,t[d]);for(a=0,s=p.length;s>a;a++)u=p[a].x+":"+p[a].y,void 0!==E[u]&&console.warn("THREE.Shape: Duplicate point",u),E[u]=a;var m=o(e,t),T=THREE.ShapeUtils.triangulate(m,!1);for(a=0,s=T.length;s>a;a++)for(c=T[a],h=0;3>h;h++)u=c[h].x+":"+c[h].y,l=E[u],void 0!==l&&(c[h]=l);return T.concat()},isClockWise:function(e){return THREE.ShapeUtils.area(e)<0},b2:function(){function e(e,t){var r=1-e;return r*r*t}function t(e,t){return 2*(1-e)*e*t}function r(e,t){return e*e*t}return function(i,n,o,a){return e(i,n)+t(i,o)+r(i,a)}}(),b3:function(){function e(e,t){var r=1-e;return r*r*r*t}function t(e,t){var r=1-e;return 3*r*r*e*t}function r(e,t){var r=1-e;return 3*r*e*e*t}function i(e,t){return e*e*e*t}return function(n,o,a,s,h){return e(n,o)+t(n,a)+r(n,s)+i(n,h)}}()},THREE.Audio=function(e){THREE.Object3D.call(this),this.type="Audio",this.context=e.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(e){var t=this,r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(e){t.context.decodeAudioData(this.response,function(e){t.source.buffer=e,t.autoplay&&t.play()})},r.send(),this},THREE.Audio.prototype.play=function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,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(e){this.isPlaying===!0?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},THREE.Audio.prototype.getFilter=function(){return this.filter},THREE.Audio.prototype.setPlaybackRate=function(e){this.playbackRate=e,this.isPlaying===!0&&(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(e){this.source.loop=e},THREE.Audio.prototype.getLoop=function(){return this.source.loop},THREE.Audio.prototype.setRefDistance=function(e){this.panner.refDistance=e},THREE.Audio.prototype.getRefDistance=function(){return this.panner.refDistance},THREE.Audio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},THREE.Audio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},THREE.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},THREE.Audio.prototype.getVolume=function(){return this.gain.gain.value},THREE.Audio.prototype.updateMatrixWorld=function(){var e=new THREE.Vector3;return function(t){THREE.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.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 e=new THREE.Vector3,t=new THREE.Quaternion,r=new THREE.Vector3,i=new THREE.Vector3;return function(n){THREE.Object3D.prototype.updateMatrixWorld.call(this,n);var o=this.context.listener,a=this.up;this.matrixWorld.decompose(e,t,r),i.set(0,0,-1).applyQuaternion(t),o.setPosition(e.x,e.y,e.z),o.setOrientation(i.x,i.y,i.z,a.x,a.y,a.z)}}(),THREE.Curve=function(){},THREE.Curve.prototype={constructor:THREE.Curve,getPoint:function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},getPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPoint(t/e));return r},getSpacedPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPointAt(t/e));return r},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;e>=r;r++)t=this.getPoint(r/e),o+=t.distanceTo(n),i.push(o),n=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r,i=this.getLengths(),n=0,o=i.length;r=t?t:e*i[o-1];for(var a,s=0,h=o-1;h>=s;)if(n=Math.floor(s+(h-s)/2),a=i[n]-r,0>a)s=n+1;else{if(!(a>0)){h=n;break}h=n-1}if(n=h,i[n]===r){var c=n/(o-1);return c}var u=i[n],l=i[n+1],E=l-u,p=(r-u)/E,c=(n+p)/(o-1);return c},getTangent:function(e){var t=1e-4,r=e-t,i=e+t;0>r&&(r=0),i>1&&(i=1);var n=this.getPoint(r),o=this.getPoint(i),a=o.clone().sub(n);return a.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)}},THREE.Curve.Utils=THREE.CurveUtils,THREE.Curve.create=function(e,t){return e.prototype=Object.create(THREE.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},THREE.CurvePath=function(){this.curves=[],this.autoClose=!1},THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype),THREE.CurvePath.prototype.constructor=THREE.CurvePath,THREE.CurvePath.prototype.add=function(e){this.curves.push(e)},THREE.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new THREE.LineCurve(t,e))},THREE.CurvePath.prototype.getPoint=function(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),i=0;i=t){var n=r[i]-t,o=this.curves[i],a=1-n/o.getLength();return o.getPointAt(a)}i++}return null},THREE.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,i=this.curves.length;i>r;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e},THREE.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e,!0);return this.createGeometry(t)},THREE.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e,!0);return this.createGeometry(t)},THREE.CurvePath.prototype.createGeometry=function(e){for(var t=new THREE.Geometry,r=0,i=e.length;i>r;r++){var n=e[r];t.vertices.push(new THREE.Vector3(n.x,n.y,n.z||0))}return t},THREE.Path=function(e){THREE.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},THREE.Path.prototype=Object.create(THREE.CurvePath.prototype),THREE.Path.prototype.constructor=THREE.Path,THREE.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;r>t;t++)this.lineTo(e[t].x,e[t].y)},THREE.Path.prototype.moveTo=function(e,t){this.actions.push({action:"moveTo",args:[e,t]})},THREE.Path.prototype.lineTo=function(e,t){var r=this.actions[this.actions.length-1].args,i=r[r.length-2],n=r[r.length-1],o=new THREE.LineCurve(new THREE.Vector2(i,n),new THREE.Vector2(e,t));this.curves.push(o),this.actions.push({action:"lineTo",args:[e,t]})},THREE.Path.prototype.quadraticCurveTo=function(e,t,r,i){var n=this.actions[this.actions.length-1].args,o=n[n.length-2],a=n[n.length-1],s=new THREE.QuadraticBezierCurve(new THREE.Vector2(o,a),new THREE.Vector2(e,t),new THREE.Vector2(r,i));this.curves.push(s),this.actions.push({action:"quadraticCurveTo",args:[e,t,r,i]})},THREE.Path.prototype.bezierCurveTo=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],h=a[a.length-1],c=new THREE.CubicBezierCurve(new THREE.Vector2(s,h),new THREE.Vector2(e,t),new THREE.Vector2(r,i),new THREE.Vector2(n,o));this.curves.push(c),this.actions.push({action:"bezierCurveTo",args:[e,t,r,i,n,o]})},THREE.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,i=r[r.length-2],n=r[r.length-1],o=[new THREE.Vector2(i,n)];Array.prototype.push.apply(o,e);var a=new THREE.SplineCurve(o);this.curves.push(a),this.actions.push({action:"splineThru",args:t})},THREE.Path.prototype.arc=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],h=a[a.length-1];this.absarc(e+s,t+h,r,i,n,o)},THREE.Path.prototype.absarc=function(e,t,r,i,n,o){this.absellipse(e,t,r,r,i,n,o)},THREE.Path.prototype.ellipse=function(e,t,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args,c=h[h.length-2],u=h[h.length-1];this.absellipse(e+c,t+u,r,i,n,o,a,s)},THREE.Path.prototype.absellipse=function(e,t,r,i,n,o,a,s){var h=[e,t,r,i,n,o,a,s||0],c=new THREE.EllipseCurve(e,t,r,i,n,o,a,s);this.curves.push(c);var u=c.getPoint(1);h.push(u.x),h.push(u.y),this.actions.push({action:"ellipse",args:h})},THREE.Path.prototype.getSpacedPoints=function(e,t){e||(e=40);for(var r=[],i=0;e>i;i++)r.push(this.getPoint(i/e));return r},THREE.Path.prototype.getPoints=function(e,t){e=e||12;for(var r,i,n,o,a,s,h,c,u,l,E,p=THREE.ShapeUtils.b2,d=THREE.ShapeUtils.b3,f=[],m=0,T=this.actions.length;T>m;m++){var v=this.actions[m],g=v.action,y=v.args;switch(g){case"moveTo":f.push(new THREE.Vector2(y[0],y[1]));break;case"lineTo":f.push(new THREE.Vector2(y[0],y[1]));break;case"quadraticCurveTo":r=y[2],i=y[3],a=y[0],s=y[1],f.length>0?(u=f[f.length-1],h=u.x,c=u.y):(u=this.actions[m-1].args,h=u[u.length-2],c=u[u.length-1]);for(var R=1;e>=R;R++){var H=R/e;l=p(H,h,a,r),E=p(H,c,s,i),f.push(new THREE.Vector2(l,E))}break;case"bezierCurveTo":r=y[4],i=y[5],a=y[0],s=y[1],n=y[2],o=y[3],f.length>0?(u=f[f.length-1],h=u.x,c=u.y):(u=this.actions[m-1].args,h=u[u.length-2],c=u[u.length-1]);for(var R=1;e>=R;R++){var H=R/e;l=d(H,h,a,n,r),E=d(H,c,s,o,i),f.push(new THREE.Vector2(l,E))}break;case"splineThru":u=this.actions[m-1].args;var x=new THREE.Vector2(u[u.length-2],u[u.length-1]),b=[x],w=e*y[0].length;b=b.concat(y[0]);for(var M=new THREE.SplineCurve(b),R=1;w>=R;R++)f.push(M.getPointAt(R/w));break;case"arc":for(var S,_=y[0],A=y[1],C=y[2],L=y[3],P=y[4],D=!!y[5],k=P-L,V=2*e,R=1;V>=R;R++){var H=R/V;D||(H=1-H),S=L+H*k,l=_+C*Math.cos(S),E=A+C*Math.sin(S),f.push(new THREE.Vector2(l,E))}break;case"ellipse":var S,F,U,_=y[0],A=y[1],O=y[2],B=y[3],L=y[4],P=y[5],D=!!y[6],G=y[7],k=P-L,V=2*e;0!==G&&(F=Math.cos(G),U=Math.sin(G));for(var R=1;V>=R;R++){var H=R/V;if(D||(H=1-H),S=L+H*k,l=_+O*Math.cos(S),E=A+B*Math.sin(S),0!==G){var N=l,I=E;l=(N-_)*F-(I-A)*U+_,E=(N-_)*U+(I-A)*F+A}f.push(new THREE.Vector2(l,E))}}}var z=f[f.length-1];return Math.abs(z.x-f[0].x)i;i++){var o=e[i],a=o.args,s=o.action;"moveTo"===s&&0!==r.actions.length&&(t.push(r),r=new THREE.Path),r[s].apply(r,a)}return 0!==r.actions.length&&t.push(r),t}function i(e){for(var t=[],r=0,i=e.length;i>r;r++){var n=e[r],o=new THREE.Shape;o.actions=n.actions,o.curves=n.curves,t.push(o)}return t}function n(e,t){for(var r=t.length,i=!1,n=r-1,o=0;r>o;n=o++){var a=t[n],s=t[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=t[o],h=-h,s=t[n],c=-c),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var u=c*(e.x-a.x)-h*(e.y-a.y);if(0===u)return!0;if(0>u)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var o=THREE.ShapeUtils.isClockWise,a=r(this.actions);if(0===a.length)return[];if(t===!0)return i(a);var s,h,c,u=[];if(1===a.length)return h=a[0],c=new THREE.Shape,c.actions=h.actions,c.curves=h.curves,u.push(c),u;var l=!o(a[0].getPoints());l=e?!l:l;var E,p=[],d=[],f=[],m=0;d[m]=void 0,f[m]=[];for(var T=0,v=a.length;v>T;T++)h=a[T],E=h.getPoints(),s=o(E),s=e?!s:s,s?(!l&&d[m]&&m++,d[m]={s:new THREE.Shape,p:E},d[m].s.actions=h.actions,d[m].s.curves=h.curves,l&&m++,f[m]=[]):f[m].push({h:h,p:E[0]});if(!d[0])return i(a);if(d.length>1){for(var g=!1,y=[],R=0,H=d.length;H>R;R++)p[R]=[];for(var R=0,H=d.length;H>R;R++)for(var x=f[R],b=0;b0&&(g||(f=p))}for(var _,T=0,A=d.length;A>T;T++){c=d[T].s,u.push(c),_=f[T];for(var C=0,L=_.length;L>C;C++)c.holes.push(_[C].h)}return u},THREE.Shape=function(){THREE.Path.apply(this,arguments),this.holes=[]},THREE.Shape.prototype=Object.create(THREE.Path.prototype),THREE.Shape.prototype.constructor=THREE.Shape,THREE.Shape.prototype.extrude=function(e){return new THREE.ExtrudeGeometry(this,e)},THREE.Shape.prototype.makeGeometry=function(e){return new THREE.ShapeGeometry(this,e)},THREE.Shape.prototype.getPointsHoles=function(e){for(var t=[],r=0,i=this.holes.length;i>r;r++)t[r]=this.holes[r].getPoints(e);return t},THREE.Shape.prototype.extractAllPoints=function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},THREE.Shape.prototype.extractPoints=function(e){return this.extractAllPoints(e)},THREE.Shape.Utils=THREE.ShapeUtils,THREE.LineCurve=function(e,t){this.v1=e,this.v2=t},THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.LineCurve.prototype.constructor=THREE.LineCurve,THREE.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},THREE.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},THREE.LineCurve.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},THREE.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve,THREE.QuadraticBezierCurve.prototype.getPoint=function(e){var t=THREE.ShapeUtils.b2;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},THREE.QuadraticBezierCurve.prototype.getTangent=function(e){var t=THREE.CurveUtils.tangentQuadraticBezier;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()},THREE.CubicBezierCurve=function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve,THREE.CubicBezierCurve.prototype.getPoint=function(e){var t=THREE.ShapeUtils.b3;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},THREE.CubicBezierCurve.prototype.getTangent=function(e){var t=THREE.CurveUtils.tangentCubicBezier;return new THREE.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},THREE.SplineCurve=function(e){this.points=void 0==e?[]:e},THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.SplineCurve.prototype.constructor=THREE.SplineCurve,THREE.SplineCurve.prototype.getPoint=function(e){var t=this.points,r=(t.length-1)*e,i=Math.floor(r),n=r-i,o=t[0===i?i:i-1],a=t[i],s=t[i>t.length-2?t.length-1:i+1],h=t[i>t.length-3?t.length-1:i+2],c=THREE.CurveUtils.interpolate;return new THREE.Vector2(c(o.x,a.x,s.x,h.x,n),c(o.y,a.y,s.y,h.y,n))},THREE.EllipseCurve=function(e,t,r,i,n,o,a,s){this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype),THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve,THREE.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI);var r;r=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var i=this.aX+this.xRadius*Math.cos(r),n=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var o=Math.cos(this.aRotation),a=Math.sin(this.aRotation),s=i,h=n;i=(s-this.aX)*o-(h-this.aY)*a+this.aX,n=(s-this.aX)*a+(h-this.aY)*o+this.aY}return new THREE.Vector2(i,n)},THREE.ArcCurve=function(e,t,r,i,n,o){THREE.EllipseCurve.call(this,e,t,r,r,i,n,o)},THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype),THREE.ArcCurve.prototype.constructor=THREE.ArcCurve,THREE.LineCurve3=THREE.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new THREE.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),THREE.QuadraticBezierCurve3=THREE.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=THREE.ShapeUtils.b2;return new THREE.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),THREE.CubicBezierCurve3=THREE.Curve.create(function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},function(e){var t=THREE.ShapeUtils.b3;return new THREE.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),THREE.SplineCurve3=THREE.Curve.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-1)*e,i=Math.floor(r),n=r-i,o=t[0==i?i:i-1],a=t[i],s=t[i>t.length-2?t.length-1:i+1],h=t[i>t.length-3?t.length-1:i+2],c=THREE.CurveUtils.interpolate;return new THREE.Vector3(c(o.x,a.x,s.x,h.x,n),c(o.y,a.y,s.y,h.y,n),c(o.z,a.z,s.z,h.z,n))}),THREE.CatmullRomCurve3=function(){function e(){}var t=new THREE.Vector3,r=new e,i=new e,n=new e;return e.prototype.init=function(e,t,r,i){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-i,this.c3=2*e-2*t+r+i},e.prototype.initNonuniformCatmullRom=function(e,t,r,i,n,o,a){var s=(t-e)/n-(r-e)/(n+o)+(r-t)/o,h=(r-t)/o-(i-t)/(o+a)+(i-r)/a;s*=o,h*=o,this.init(t,r,s,h)},e.prototype.initCatmullRom=function(e,t,r,i,n){this.init(t,r,n*(r-e),n*(i-t))},e.prototype.calc=function(e){var t=e*e,r=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*r},THREE.Curve.create(function(e){this.points=e||[]},function(e){var o,a,s,h,c=this.points;h=c.length,2>h&&console.log("duh, you need at least 2 points"),o=(h-1)*e,a=Math.floor(o),s=o-a,0===s&&a===h-1&&(a=h-2,s=1);var u,l,E,p;if(0===a?(t.subVectors(c[0],c[1]).add(c[0]),u=t):u=c[a-1],l=c[a],E=c[a+1],h>a+2?p=c[a+2]:(t.subVectors(c[h-1],c[h-2]).add(c[h-2]),p=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var d="chordal"===this.type?.5:.25,f=Math.pow(u.distanceToSquared(l),d),m=Math.pow(l.distanceToSquared(E),d),T=Math.pow(E.distanceToSquared(p),d);1e-4>m&&(m=1),1e-4>f&&(f=m),1e-4>T&&(T=m),r.initNonuniformCatmullRom(u.x,l.x,E.x,p.x,f,m,T),i.initNonuniformCatmullRom(u.y,l.y,E.y,p.y,f,m,T),n.initNonuniformCatmullRom(u.z,l.z,E.z,p.z,f,m,T)}else if("catmullrom"===this.type){var v=void 0!==this.tension?this.tension:.5;r.initCatmullRom(u.x,l.x,E.x,p.x,v),i.initCatmullRom(u.y,l.y,E.y,p.y,v),n.initCatmullRom(u.z,l.z,E.z,p.z,v)}var g=new THREE.Vector3(r.calc(s),i.calc(s),n.calc(s));return g})}(),THREE.ClosedSplineCurve3=THREE.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-0)*e,i=Math.floor(r),n=r-i;i+=i>0?0:(Math.floor(Math.abs(i)/t.length)+1)*t.length;var o=t[(i-1)%t.length],a=t[i%t.length],s=t[(i+1)%t.length],h=t[(i+2)%t.length],c=THREE.CurveUtils.interpolate;return new THREE.Vector3(c(o.x,a.x,s.x,h.x,n),c(o.y,a.y,s.y,h.y,n),c(o.z,a.z,s.z,h.z,n))}),THREE.BoxGeometry=function(e,t,r,i,n,o){function a(e,t,r,i,n,o,a,h){var c,u,l,E=s.widthSegments,p=s.heightSegments,d=n/2,f=o/2,m=s.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?c="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(c="y",p=s.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(c="x",E=s.depthSegments);var T=E+1,v=p+1,g=n/E,y=o/p,R=new THREE.Vector3;for(R[c]=a>0?1:-1,l=0;v>l;l++)for(u=0;T>u;u++){var H=new THREE.Vector3;H[e]=(u*g-d)*r,H[t]=(l*y-f)*i,H[c]=a,s.vertices.push(H)}for(l=0;p>l;l++)for(u=0;E>u;u++){var x=u+T*l,b=u+T*(l+1),w=u+1+T*(l+1),M=u+1+T*l,S=new THREE.Vector2(u/E,1-l/p),_=new THREE.Vector2(u/E,1-(l+1)/p),A=new THREE.Vector2((u+1)/E,1-(l+1)/p),C=new THREE.Vector2((u+1)/E,1-l/p),L=new THREE.Face3(x+m,b+m,M+m);L.normal.copy(R),L.vertexNormals.push(R.clone(),R.clone(),R.clone()), +L.materialIndex=h,s.faces.push(L),s.faceVertexUvs[0].push([S,_,C]),L=new THREE.Face3(b+m,w+m,M+m),L.normal.copy(R),L.vertexNormals.push(R.clone(),R.clone(),R.clone()),L.materialIndex=h,s.faces.push(L),s.faceVertexUvs[0].push([_.clone(),A,C.clone()])}}THREE.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:n,depthSegments:o},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=o||1;var s=this,h=e/2,c=t/2,u=r/2;a("z","y",-1,-1,r,t,h,0),a("z","y",1,-1,r,t,-h,1),a("x","z",1,1,e,r,c,2),a("x","z",1,-1,e,r,-c,3),a("x","y",1,-1,e,t,u,4),a("x","y",-1,-1,e,t,-u,5),this.mergeVertices()},THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry,THREE.BoxGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.BoxGeometry(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)},THREE.CubeGeometry=THREE.BoxGeometry,THREE.CircleGeometry=function(e,t,r,i){THREE.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},this.fromBufferGeometry(new THREE.CircleBufferGeometry(e,t,r,i))},THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry,THREE.CircleGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.CircleGeometry(e.radius,e.segments,e.thetaStart,e.thetaLength)},THREE.CircleBufferGeometry=function(e,t,r,i){THREE.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=t+2,o=new Float32Array(3*n),a=new Float32Array(3*n),s=new Float32Array(2*n);a[2]=1,s[0]=.5,s[1]=.5;for(var h=0,c=3,u=2;t>=h;h++,c+=3,u+=2){var l=r+h/t*i;o[c]=e*Math.cos(l),o[c+1]=e*Math.sin(l),a[c+2]=1,s[u]=(o[c]/e+1)/2,s[u+1]=(o[c+1]/e+1)/2}for(var E=[],c=1;t>=c;c++)E.push(c,c+1,0);this.setIndex(new THREE.BufferAttribute(new Uint16Array(E),1)),this.addAttribute("position",new THREE.BufferAttribute(o,3)),this.addAttribute("normal",new THREE.BufferAttribute(a,3)),this.addAttribute("uv",new THREE.BufferAttribute(s,2)),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,e)},THREE.CircleBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.CircleBufferGeometry.prototype.constructor=THREE.CircleBufferGeometry,THREE.CircleBufferGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.CircleBufferGeometry(e.radius,e.segments,e.thetaStart,e.thetaLength)},THREE.CylinderGeometry=function(e,t,r,i,n,o,a,s){THREE.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:n,openEnded:o,thetaStart:a,thetaLength:s},e=void 0!==e?e:20,t=void 0!==t?t:20,r=void 0!==r?r:100,i=i||8,n=n||1,o=void 0!==o?o:!1,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var h,c,u=r/2,l=[],E=[];for(c=0;n>=c;c++){var p=[],d=[],f=c/n,m=f*(t-e)+e;for(h=0;i>=h;h++){var T=h/i,v=new THREE.Vector3;v.x=m*Math.sin(T*s+a),v.y=-f*r+u,v.z=m*Math.cos(T*s+a),this.vertices.push(v),p.push(this.vertices.length-1),d.push(new THREE.Vector2(T,1-f))}l.push(p),E.push(d)}var g,y,R=(t-e)/r;for(h=0;i>h;h++)for(0!==e?(g=this.vertices[l[0][h]].clone(),y=this.vertices[l[0][h+1]].clone()):(g=this.vertices[l[1][h]].clone(),y=this.vertices[l[1][h+1]].clone()),g.setY(Math.sqrt(g.x*g.x+g.z*g.z)*R).normalize(),y.setY(Math.sqrt(y.x*y.x+y.z*y.z)*R).normalize(),c=0;n>c;c++){var H=l[c][h],x=l[c+1][h],b=l[c+1][h+1],w=l[c][h+1],M=g.clone(),S=g.clone(),_=y.clone(),A=y.clone(),C=E[c][h].clone(),L=E[c+1][h].clone(),P=E[c+1][h+1].clone(),D=E[c][h+1].clone();this.faces.push(new THREE.Face3(H,x,w,[M,S,A])),this.faceVertexUvs[0].push([C,L,D]),this.faces.push(new THREE.Face3(x,b,w,[S.clone(),_,A.clone()])),this.faceVertexUvs[0].push([L.clone(),P,D.clone()])}if(o===!1&&e>0)for(this.vertices.push(new THREE.Vector3(0,u,0)),h=0;i>h;h++){var H=l[0][h],x=l[0][h+1],b=this.vertices.length-1,M=new THREE.Vector3(0,1,0),S=new THREE.Vector3(0,1,0),_=new THREE.Vector3(0,1,0),C=E[0][h].clone(),L=E[0][h+1].clone(),P=new THREE.Vector2(L.x,0);this.faces.push(new THREE.Face3(H,x,b,[M,S,_],void 0,1)),this.faceVertexUvs[0].push([C,L,P])}if(o===!1&&t>0)for(this.vertices.push(new THREE.Vector3(0,-u,0)),h=0;i>h;h++){var H=l[n][h+1],x=l[n][h],b=this.vertices.length-1,M=new THREE.Vector3(0,-1,0),S=new THREE.Vector3(0,-1,0),_=new THREE.Vector3(0,-1,0),C=E[n][h+1].clone(),L=E[n][h].clone(),P=new THREE.Vector2(L.x,1);this.faces.push(new THREE.Face3(H,x,b,[M,S,_],void 0,2)),this.faceVertexUvs[0].push([C,L,P])}this.computeFaceNormals()},THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry,THREE.CylinderGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)},THREE.EdgesGeometry=function(e,t){function r(e,t){return e-t}THREE.BufferGeometry.call(this),t=void 0!==t?t:1;var i,n=Math.cos(THREE.Math.degToRad(t)),o=[0,0],a={},s=["a","b","c"];e instanceof THREE.BufferGeometry?(i=new THREE.Geometry,i.fromBufferGeometry(e)):i=e.clone(),i.mergeVertices(),i.computeFaceNormals();for(var h=i.vertices,c=i.faces,u=0,l=c.length;l>u;u++)for(var E=c[u],p=0;3>p;p++){o[0]=E[s[p]],o[1]=E[s[(p+1)%3]],o.sort(r);var d=o.toString();void 0===a[d]?a[d]={vert1:o[0],vert2:o[1],face1:u,face2:void 0}:a[d].face2=u}var f=[];for(var d in a){var m=a[d];if(void 0===m.face2||c[m.face1].normal.dot(c[m.face2].normal)<=n){var T=h[m.vert1];f.push(T.x),f.push(T.y),f.push(T.z),T=h[m.vert2],f.push(T.x),f.push(T.y),f.push(T.z)}}this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(f),3))},THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry,THREE.ExtrudeGeometry=function(e,t){return"undefined"==typeof e?void(e=[]):(THREE.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())},THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry,THREE.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,i=0;r>i;i++){var n=e[i];this.addShape(n,t)}},THREE.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function i(e,t,r){var i,n,o=1,a=e.x-t.x,s=e.y-t.y,h=r.x-e.x,c=r.y-e.y,u=a*a+s*s,l=a*c-s*h;if(Math.abs(l)>Number.EPSILON){var E=Math.sqrt(u),p=Math.sqrt(h*h+c*c),d=t.x-s/E,f=t.y+a/E,m=r.x-c/p,T=r.y+h/p,v=((m-d)*c-(T-f)*h)/(a*c-s*h);i=d+a*v-e.x,n=f+s*v-e.y;var g=i*i+n*n;if(2>=g)return new THREE.Vector2(i,n);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?h>Number.EPSILON&&(y=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(i=-s,n=a,o=Math.sqrt(u)):(i=a,n=s,o=Math.sqrt(u/2))}return new THREE.Vector2(i/o,n/o)}function n(){if(g){var e=0,t=I*e;for(W=0;z>W;W++)N=k[W],h(N[2]+t,N[1]+t,N[0]+t);for(e=R+2*v,t=I*e,W=0;z>W;W++)N=k[W],h(N[0]+t,N[1]+t,N[2]+t)}else{for(W=0;z>W;W++)N=k[W],h(N[2],N[1],N[0]);for(W=0;z>W;W++)N=k[W],h(N[0]+I*R,N[1]+I*R,N[2]+I*R)}}function o(){var e=0;for(a(V,e),e+=V.length,M=0,S=P.length;S>M;M++)w=P[M],a(w,e),e+=w.length}function a(e,t){var r,i;for(W=e.length;--W>=0;){r=W,i=W-1,0>i&&(i=e.length-1);var n=0,o=R+2*v;for(n=0;o>n;n++){var a=I*n,s=I*(n+1),h=t+r+a,u=t+i+a,l=t+i+s,E=t+r+s;c(h,u,l,E,e,n,o,r,i)}}}function s(e,t,r){_.vertices.push(new THREE.Vector3(e,t,r))}function h(e,t,r){e+=A,t+=A,r+=A,_.faces.push(new THREE.Face3(e,t,r,null,null,0));var i=b.generateTopUV(_,e,t,r);_.faceVertexUvs[0].push(i)}function c(e,t,r,i,n,o,a,s,h){e+=A,t+=A,r+=A,i+=A,_.faces.push(new THREE.Face3(e,t,i,null,null,1)),_.faces.push(new THREE.Face3(t,r,i,null,null,1));var c=b.generateSideWallUV(_,e,t,r,i);_.faceVertexUvs[0].push([c[0],c[1],c[3]]),_.faceVertexUvs[0].push([c[1],c[2],c[3]])}var u,l,E,p,d,f=void 0!==t.amount?t.amount:100,m=void 0!==t.bevelThickness?t.bevelThickness:6,T=void 0!==t.bevelSize?t.bevelSize:m-2,v=void 0!==t.bevelSegments?t.bevelSegments:3,g=void 0!==t.bevelEnabled?t.bevelEnabled:!0,y=void 0!==t.curveSegments?t.curveSegments:12,R=void 0!==t.steps?t.steps:1,H=t.extrudePath,x=!1,b=void 0!==t.UVGenerator?t.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator;H&&(u=H.getSpacedPoints(R),x=!0,g=!1,l=void 0!==t.frames?t.frames:new THREE.TubeGeometry.FrenetFrames(H,R,!1),E=new THREE.Vector3,p=new THREE.Vector3,d=new THREE.Vector3),g||(v=0,m=0,T=0);var w,M,S,_=this,A=this.vertices.length,C=e.extractPoints(y),L=C.shape,P=C.holes,D=!THREE.ShapeUtils.isClockWise(L);if(D){for(L=L.reverse(),M=0,S=P.length;S>M;M++)w=P[M],THREE.ShapeUtils.isClockWise(w)&&(P[M]=w.reverse());D=!1}var k=THREE.ShapeUtils.triangulateShape(L,P),V=L;for(M=0,S=P.length;S>M;M++)w=P[M],L=L.concat(w);for(var F,U,O,B,G,N,I=L.length,z=k.length,j=[],W=0,X=V.length,q=X-1,Y=W+1;X>W;W++,q++,Y++)q===X&&(q=0),Y===X&&(Y=0),j[W]=i(V[W],V[q],V[Y]);var K,Q=[],Z=j.concat();for(M=0,S=P.length;S>M;M++){for(w=P[M],K=[],W=0,X=w.length,q=X-1,Y=W+1;X>W;W++,q++,Y++)q===X&&(q=0),Y===X&&(Y=0),K[W]=i(w[W],w[q],w[Y]);Q.push(K),Z=Z.concat(K)}for(F=0;v>F;F++){for(O=F/v,B=m*(1-O),U=T*Math.sin(O*Math.PI/2),W=0,X=V.length;X>W;W++)G=r(V[W],j[W],U),s(G.x,G.y,-B);for(M=0,S=P.length;S>M;M++)for(w=P[M],K=Q[M],W=0,X=w.length;X>W;W++)G=r(w[W],K[W],U),s(G.x,G.y,-B)}for(U=T,W=0;I>W;W++)G=g?r(L[W],Z[W],U):L[W],x?(p.copy(l.normals[0]).multiplyScalar(G.x),E.copy(l.binormals[0]).multiplyScalar(G.y),d.copy(u[0]).add(p).add(E),s(d.x,d.y,d.z)):s(G.x,G.y,0);var J;for(J=1;R>=J;J++)for(W=0;I>W;W++)G=g?r(L[W],Z[W],U):L[W],x?(p.copy(l.normals[J]).multiplyScalar(G.x),E.copy(l.binormals[J]).multiplyScalar(G.y),d.copy(u[J]).add(p).add(E),s(d.x,d.y,d.z)):s(G.x,G.y,f/R*J);for(F=v-1;F>=0;F--){for(O=F/v,B=m*(1-O),U=T*Math.sin(O*Math.PI/2),W=0,X=V.length;X>W;W++)G=r(V[W],j[W],U),s(G.x,G.y,f+B);for(M=0,S=P.length;S>M;M++)for(w=P[M],K=Q[M],W=0,X=w.length;X>W;W++)G=r(w[W],K[W],U),x?s(G.x,G.y+u[R-1].y,u[R-1].x+B):s(G.x,G.y,f+B)}n(),o()},THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,i){var n=e.vertices,o=n[t],a=n[r],s=n[i];return[new THREE.Vector2(o.x,o.y),new THREE.Vector2(a.x,a.y),new THREE.Vector2(s.x,s.y)]},generateSideWallUV:function(e,t,r,i,n){var o=e.vertices,a=o[t],s=o[r],h=o[i],c=o[n];return Math.abs(a.y-s.y)<.01?[new THREE.Vector2(a.x,1-a.z),new THREE.Vector2(s.x,1-s.z),new THREE.Vector2(h.x,1-h.z),new THREE.Vector2(c.x,1-c.z)]:[new THREE.Vector2(a.y,1-a.z),new THREE.Vector2(s.y,1-s.z),new THREE.Vector2(h.y,1-h.z),new THREE.Vector2(c.y,1-c.z)]}},THREE.ShapeGeometry=function(e,t){THREE.Geometry.call(this),this.type="ShapeGeometry",Array.isArray(e)===!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry,THREE.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,i=e.length;i>r;r++)this.addShape(e[r],t);return this},THREE.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,i,n,o=void 0!==t.curveSegments?t.curveSegments:12,a=t.material,s=void 0===t.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,h=this.vertices.length,c=e.extractPoints(o),u=c.shape,l=c.holes,E=!THREE.ShapeUtils.isClockWise(u);if(E){for(u=u.reverse(),r=0,i=l.length;i>r;r++)n=l[r],THREE.ShapeUtils.isClockWise(n)&&(l[r]=n.reverse());E=!1}var p=THREE.ShapeUtils.triangulateShape(u,l);for(r=0,i=l.length;i>r;r++)n=l[r],u=u.concat(n);var d,f,m=u.length,T=p.length;for(r=0;m>r;r++)d=u[r],this.vertices.push(new THREE.Vector3(d.x,d.y,0));for(r=0;T>r;r++){f=p[r];var v=f[0]+h,g=f[1]+h,y=f[2]+h;this.faces.push(new THREE.Face3(v,g,y,null,null,a)),this.faceVertexUvs[0].push(s.generateTopUV(this,v,g,y))}},THREE.LatheGeometry=function(e,t,r,i){THREE.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=t||12,r=r||0,i=i||2*Math.PI;for(var n=1/(e.length-1),o=1/t,a=0,s=t;s>=a;a++)for(var h=r+a*o*i,c=Math.cos(h),u=Math.sin(h),l=0,E=e.length;E>l;l++){var p=e[l],d=new THREE.Vector3;d.x=c*p.x-u*p.y,d.y=u*p.x+c*p.y,d.z=p.z,this.vertices.push(d)}for(var f=e.length,a=0,s=t;s>a;a++)for(var l=0,E=e.length-1;E>l;l++){var m=l+f*a,T=m,v=m+f,c=m+1+f,g=m+1,y=a*o,R=l*n,H=y+o,x=R+n;this.faces.push(new THREE.Face3(T,v,g)),this.faceVertexUvs[0].push([new THREE.Vector2(y,R),new THREE.Vector2(H,R),new THREE.Vector2(y,x)]),this.faces.push(new THREE.Face3(v,c,g)),this.faceVertexUvs[0].push([new THREE.Vector2(H,R),new THREE.Vector2(H,x),new THREE.Vector2(y,x)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry,THREE.PlaneGeometry=function(e,t,r,i){THREE.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new THREE.PlaneBufferGeometry(e,t,r,i))},THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry,THREE.PlaneGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.PlaneGeometry(e.width,e.height,e.widthSegments,e.heightSegments)},THREE.PlaneBufferGeometry=function(e,t,r,i){THREE.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};for(var n=e/2,o=t/2,a=Math.floor(r)||1,s=Math.floor(i)||1,h=a+1,c=s+1,u=e/a,l=t/s,E=new Float32Array(h*c*3),p=new Float32Array(h*c*3),d=new Float32Array(h*c*2),f=0,m=0,T=0;c>T;T++)for(var v=T*l-o,g=0;h>g;g++){var y=g*u-n;E[f]=y,E[f+1]=-v,p[f+2]=1,d[m]=g/a,d[m+1]=1-T/s,f+=3,m+=2}f=0;for(var R=new(E.length/3>65535?Uint32Array:Uint16Array)(a*s*6),T=0;s>T;T++)for(var g=0;a>g;g++){var H=g+h*T,x=g+h*(T+1),b=g+1+h*(T+1),w=g+1+h*T;R[f]=H,R[f+1]=x,R[f+2]=w,R[f+3]=x,R[f+4]=b,R[f+5]=w,f+=6}this.setIndex(new THREE.BufferAttribute(R,1)),this.addAttribute("position",new THREE.BufferAttribute(E,3)),this.addAttribute("normal",new THREE.BufferAttribute(p,3)),this.addAttribute("uv",new THREE.BufferAttribute(d,2))},THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry,THREE.PlaneBufferGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.PlaneBufferGeometry(e.width,e.height,e.widthSegments,e.heightSegments)},THREE.RingGeometry=function(e,t,r,i,n,o){THREE.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:o},e=e||0,t=t||50,n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8,i=void 0!==i?Math.max(1,i):8;var a,s,h=[],c=e,u=(t-e)/i;for(a=0;i+1>a;a++){for(s=0;r+1>s;s++){var l=new THREE.Vector3,E=n+s/r*o;l.x=c*Math.cos(E),l.y=c*Math.sin(E),this.vertices.push(l),h.push(new THREE.Vector2((l.x/t+1)/2,(l.y/t+1)/2))}c+=u}var p=new THREE.Vector3(0,0,1);for(a=0;i>a;a++){var d=a*(r+1);for(s=0;r>s;s++){var E=s+d,f=E,m=E+r+1,T=E+r+2;this.faces.push(new THREE.Face3(f,m,T,[p.clone(),p.clone(),p.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[m].clone(),h[T].clone()]),f=E,m=E+r+2,T=E+1,this.faces.push(new THREE.Face3(f,m,T,[p.clone(),p.clone(),p.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[m].clone(),h[T].clone()])}}this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)},THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.RingGeometry.prototype.constructor=THREE.RingGeometry,THREE.RingGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.RingGeometry(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)},THREE.SphereGeometry=function(e,t,r,i,n,o,a){THREE.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new THREE.SphereBufferGeometry(e,t,r,i,n,o,a))},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry,THREE.SphereGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.SphereGeometry(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)},THREE.SphereBufferGeometry=function(e,t,r,i,n,o,a){THREE.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:o,thetaLength:a},e=e||50,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;for(var s=o+a,h=(t+1)*(r+1),c=new THREE.BufferAttribute(new Float32Array(3*h),3),u=new THREE.BufferAttribute(new Float32Array(3*h),3),l=new THREE.BufferAttribute(new Float32Array(2*h),2),E=0,p=[],d=new THREE.Vector3,f=0;r>=f;f++){for(var m=[],T=f/r,v=0;t>=v;v++){var g=v/t,y=-e*Math.cos(i+g*n)*Math.sin(o+T*a),R=e*Math.cos(o+T*a),H=e*Math.sin(i+g*n)*Math.sin(o+T*a);d.set(y,R,H).normalize(),c.setXYZ(E,y,R,H),u.setXYZ(E,d.x,d.y,d.z),l.setXY(E,g,1-T),m.push(E),E++}p.push(m)}for(var x=[],f=0;r>f;f++)for(var v=0;t>v;v++){var b=p[f][v+1],w=p[f][v],M=p[f+1][v],S=p[f+1][v+1];(0!==f||o>0)&&x.push(b,w,S),(f!==r-1||s65535?THREE.Uint32Attribute:THREE.Uint16Attribute)(x,1)),this.addAttribute("position",c),this.addAttribute("normal",u),this.addAttribute("uv",l),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,e)},THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry,THREE.SphereBufferGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.SphereBufferGeometry(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)},THREE.TorusGeometry=function(e,t,r,i,n){THREE.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n},e=e||100,t=t||40,r=r||8,i=i||6,n=n||2*Math.PI;for(var o=new THREE.Vector3,a=[],s=[],h=0;r>=h;h++)for(var c=0;i>=c;c++){var u=c/i*n,l=h/r*Math.PI*2;o.x=e*Math.cos(u),o.y=e*Math.sin(u);var E=new THREE.Vector3;E.x=(e+t*Math.cos(l))*Math.cos(u),E.y=(e+t*Math.cos(l))*Math.sin(u),E.z=t*Math.sin(l),this.vertices.push(E),a.push(new THREE.Vector2(c/i,h/r)),s.push(E.clone().sub(o).normalize())}for(var h=1;r>=h;h++)for(var c=1;i>=c;c++){var p=(i+1)*h+c-1,d=(i+1)*(h-1)+c-1,f=(i+1)*(h-1)+c,m=(i+1)*h+c,T=new THREE.Face3(p,d,m,[s[p].clone(),s[d].clone(),s[m].clone()]);this.faces.push(T),this.faceVertexUvs[0].push([a[p].clone(),a[d].clone(),a[m].clone()]),T=new THREE.Face3(d,f,m,[s[d].clone(),s[f].clone(),s[m].clone()]),this.faces.push(T),this.faceVertexUvs[0].push([a[d].clone(),a[f].clone(),a[m].clone()])}this.computeFaceNormals()},THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry,THREE.TorusGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.TorusGeometry(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)},THREE.TorusKnotGeometry=function(e,t,r,i,n,o,a){function s(e,t,r,i,n){var o=Math.cos(e),a=Math.sin(e),s=t/r*e,h=Math.cos(s),c=i*(2+h)*.5*o,u=i*(2+h)*a*.5,l=n*i*Math.sin(s)*.5;return new THREE.Vector3(c,u,l)}THREE.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,p:n,q:o,heightScale:a},e=e||100,t=t||40,r=r||64,i=i||8,n=n||2,o=o||3,a=a||1;for(var h=new Array(r),c=new THREE.Vector3,u=new THREE.Vector3,l=new THREE.Vector3,E=0;r>E;++E){h[E]=new Array(i);var p=E/r*2*n*Math.PI,d=s(p,o,n,e,a),f=s(p+.01,o,n,e,a);c.subVectors(f,d),u.addVectors(f,d),l.crossVectors(c,u),u.crossVectors(l,c),l.normalize(),u.normalize();for(var m=0;i>m;++m){var T=m/i*2*Math.PI,v=-t*Math.cos(T),g=t*Math.sin(T),y=new THREE.Vector3;y.x=d.x+v*u.x+g*l.x,y.y=d.y+v*u.y+g*l.y,y.z=d.z+v*u.z+g*l.z,h[E][m]=this.vertices.push(y)-1}}for(var E=0;r>E;++E)for(var m=0;i>m;++m){var R=(E+1)%r,H=(m+1)%i,x=h[E][m],b=h[R][m],w=h[R][H],M=h[E][H],S=new THREE.Vector2(E/r,m/i),_=new THREE.Vector2((E+1)/r,m/i),A=new THREE.Vector2((E+1)/r,(m+1)/i),C=new THREE.Vector2(E/r,(m+1)/i);this.faces.push(new THREE.Face3(x,b,M)),this.faceVertexUvs[0].push([S,_,C]),this.faces.push(new THREE.Face3(b,w,M)),this.faceVertexUvs[0].push([_.clone(),A,C.clone()])}this.computeFaceNormals(),this.computeVertexNormals()},THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry,THREE.TorusKnotGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.TorusKnotGeometry(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.p,e.q,e.heightScale)},THREE.TubeGeometry=function(e,t,r,i,n,o){function a(e,t,r){return A.vertices.push(new THREE.Vector3(e,t,r))-1}THREE.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:i,closed:n,taper:o},t=t||64,r=r||1,i=i||8,n=n||!1,o=o||THREE.TubeGeometry.NoTaper;var s,h,c,u,l,E,p,d,f,m,T,v,g,y,R,H,x,b,w,M,S,_=[],A=this,C=t+1,L=new THREE.Vector3,P=new THREE.TubeGeometry.FrenetFrames(e,t,n),D=P.tangents,k=P.normals,V=P.binormals;for(this.tangents=D,this.normals=k,this.binormals=V,m=0;C>m;m++)for(_[m]=[],u=m/(C-1),f=e.getPointAt(u),s=D[m],h=k[m],c=V[m],E=r*o(u),T=0;i>T;T++)l=T/i*2*Math.PI,p=-E*Math.cos(l),d=E*Math.sin(l),L.copy(f),L.x+=p*h.x+d*c.x,L.y+=p*h.y+d*c.y,L.z+=p*h.z+d*c.z,_[m][T]=a(L.x,L.y,L.z);for(m=0;t>m;m++)for(T=0;i>T;T++)v=n?(m+1)%t:m+1,g=(T+1)%i,y=_[m][T],R=_[v][T],H=_[v][g],x=_[m][g],b=new THREE.Vector2(m/t,T/i),w=new THREE.Vector2((m+1)/t,T/i),M=new THREE.Vector2((m+1)/t,(T+1)/i),S=new THREE.Vector2(m/t,(T+1)/i),this.faces.push(new THREE.Face3(y,R,x)),this.faceVertexUvs[0].push([b,w,S]),this.faces.push(new THREE.Face3(R,H,x)),this.faceVertexUvs[0].push([w.clone(),M,S.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry,THREE.TubeGeometry.prototype.clone=function(){return new this.constructor(this.parameters.path,this.parameters.segments,this.parameters.radius,this.parameters.radialSegments,this.parameters.closed,this.parameters.taper)},THREE.TubeGeometry.NoTaper=function(e){return 1},THREE.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},THREE.TubeGeometry.FrenetFrames=function(e,t,r){function i(){p[0]=new THREE.Vector3,d[0]=new THREE.Vector3,o=Number.MAX_VALUE,a=Math.abs(E[0].x),s=Math.abs(E[0].y),h=Math.abs(E[0].z),o>=a&&(o=a,l.set(1,0,0)),o>=s&&(o=s,l.set(0,1,0)),o>=h&&l.set(0,0,1),f.crossVectors(E[0],l).normalize(),p[0].crossVectors(E[0],f),d[0].crossVectors(E[0],p[0])}var n,o,a,s,h,c,u,l=new THREE.Vector3,E=[],p=[],d=[],f=new THREE.Vector3,m=new THREE.Matrix4,T=t+1;for(this.tangents=E,this.normals=p,this.binormals=d,c=0;T>c;c++)u=c/(T-1),E[c]=e.getTangentAt(u),E[c].normalize();for(i(),c=1;T>c;c++)p[c]=p[c-1].clone(),d[c]=d[c-1].clone(),f.crossVectors(E[c-1],E[c]),f.length()>Number.EPSILON&&(f.normalize(),n=Math.acos(THREE.Math.clamp(E[c-1].dot(E[c]),-1,1)),p[c].applyMatrix4(m.makeRotationAxis(f,n))),d[c].crossVectors(E[c],p[c]);if(r)for(n=Math.acos(THREE.Math.clamp(p[0].dot(p[T-1]),-1,1)),n/=T-1,E[0].dot(f.crossVectors(p[0],p[T-1]))>0&&(n=-n),c=1;T>c;c++)p[c].applyMatrix4(m.makeRotationAxis(E[c],n*c)),d[c].crossVectors(E[c],p[c])},THREE.PolyhedronGeometry=function(e,t,r,i){function n(e){var t=e.normalize().clone();t.index=u.vertices.push(t)-1;var r=s(e)/2/Math.PI+.5,i=h(e)/Math.PI+.5;return t.uv=new THREE.Vector2(r,1-i),t}function o(e,t,r,i){var n=new THREE.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()],void 0,i);u.faces.push(n),g.copy(e).add(t).add(r).divideScalar(3);var o=s(g);u.faceVertexUvs[0].push([c(e.uv,e,o),c(t.uv,t,o),c(r.uv,r,o)])}function a(e,t){for(var r=Math.pow(2,t),i=n(u.vertices[e.a]),a=n(u.vertices[e.b]),s=n(u.vertices[e.c]),h=[],c=e.materialIndex,l=0;r>=l;l++){h[l]=[];for(var E=n(i.clone().lerp(s,l/r)),p=n(a.clone().lerp(s,l/r)),d=r-l,f=0;d>=f;f++)0===f&&l===r?h[l][f]=E:h[l][f]=n(E.clone().lerp(p,f/d))}for(var l=0;r>l;l++)for(var f=0;2*(r-l)-1>f;f++){var m=Math.floor(f/2);f%2===0?o(h[l][m+1],h[l+1][m],h[l][m],c):o(h[l][m+1],h[l+1][m+1],h[l+1][m],c)}}function s(e){return Math.atan2(e.z,-e.x)}function h(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function c(e,t,r){return 0>r&&1===e.x&&(e=new THREE.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new THREE.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}THREE.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:i},r=r||1,i=i||0;for(var u=this,l=0,E=e.length;E>l;l+=3)n(new THREE.Vector3(e[l],e[l+1],e[l+2]));for(var p=this.vertices,d=[],l=0,f=0,E=t.length;E>l;l+=3,f++){var m=p[t[l]],T=p[t[l+1]],v=p[t[l+2]];d[f]=new THREE.Face3(m.index,T.index,v.index,[m.clone(),T.clone(),v.clone()],void 0,f)}for(var g=new THREE.Vector3,l=0,E=d.length;E>l;l++)a(d[l],i);for(var l=0,E=this.faceVertexUvs[0].length;E>l;l++){var y=this.faceVertexUvs[0][l],R=y[0].x,H=y[1].x,x=y[2].x,b=Math.max(R,H,x),w=Math.min(R,H,x);b>.9&&.1>w&&(.2>R&&(y[0].x+=1),.2>H&&(y[1].x+=1),.2>x&&(y[2].x+=1))}for(var l=0,E=this.vertices.length;E>l;l++)this.vertices[l].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,r)},THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry,THREE.PolyhedronGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.PolyhedronGeometry(e.vertices,e.indices,e.radius,e.detail)},THREE.DodecahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,i=1/r,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];THREE.PolyhedronGeometry.call(this,n,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}},THREE.DodecahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry,THREE.DodecahedronGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.DodecahedronGeometry(e.radius,e.detail)},THREE.IcosahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],n=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];THREE.PolyhedronGeometry.call(this,i,n,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},THREE.IcosahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry,THREE.IcosahedronGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.IcosahedronGeometry(e.radius,e.detail)},THREE.OctahedronGeometry=function(e,t){var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];THREE.PolyhedronGeometry.call(this,r,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},THREE.OctahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry,THREE.OctahedronGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.OctahedronGeometry(e.radius,e.detail)},THREE.TetrahedronGeometry=function(e,t){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];THREE.PolyhedronGeometry.call(this,r,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},THREE.TetrahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype),THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry,THREE.TetrahedronGeometry.prototype.clone=function(){var e=this.parameters;return new THREE.TetrahedronGeometry(e.radius,e.detail)},THREE.ParametricGeometry=function(e,t,r){THREE.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var i,n,o,a,s,h=this.vertices,c=this.faces,u=this.faceVertexUvs[0],l=t+1;for(i=0;r>=i;i++)for(s=i/r,n=0;t>=n;n++)a=n/t,o=e(a,s),h.push(o);var E,p,d,f,m,T,v,g;for(i=0;r>i;i++)for(n=0;t>n;n++)E=i*l+n,p=i*l+n+1,d=(i+1)*l+n+1,f=(i+1)*l+n,m=new THREE.Vector2(n/t,i/r),T=new THREE.Vector2((n+1)/t,i/r),v=new THREE.Vector2((n+1)/t,(i+1)/r),g=new THREE.Vector2(n/t,(i+1)/r),c.push(new THREE.Face3(E,p,f)),u.push([m,T,g]),c.push(new THREE.Face3(p,d,f)),u.push([T.clone(),v,g.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry,THREE.WireframeGeometry=function(e){function t(e,t){return e-t}THREE.BufferGeometry.call(this);var r=[0,0],i={},n=["a","b","c"];if(e instanceof THREE.Geometry){for(var o=e.vertices,a=e.faces,s=0,h=new Uint32Array(6*a.length),c=0,u=a.length;u>c;c++)for(var l=a[c],E=0;3>E;E++){r[0]=l[n[E]],r[1]=l[n[(E+1)%3]],r.sort(t);var p=r.toString();void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(var d=new Float32Array(2*s*3),c=0,u=s;u>c;c++)for(var E=0;2>E;E++){var f=o[h[2*c+E]],m=6*c+3*E;d[m+0]=f.x,d[m+1]=f.y,d[m+2]=f.z}this.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(e instanceof THREE.BufferGeometry)if(null!==e.index){var T=e.index.array,o=e.attributes.position,v=e.drawcalls,s=0;0===v.length&&e.addGroup(0,T.length);for(var h=new Uint32Array(2*T.length),g=0,y=v.length;y>g;++g)for(var R=v[g],H=R.start,x=R.count,c=H,b=H+x;b>c;c+=3)for(var E=0;3>E;E++){r[0]=T[c+E],r[1]=T[c+(E+1)%3],r.sort(t);var p=r.toString();void 0===i[p]&&(h[2*s]=r[0],h[2*s+1]=r[1],i[p]=!0,s++)}for(var d=new Float32Array(2*s*3),c=0,u=s;u>c;c++)for(var E=0;2>E;E++){var m=6*c+3*E,w=h[2*c+E];d[m+0]=o.getX(w),d[m+1]=o.getY(w),d[m+2]=o.getZ(w)}this.addAttribute("position",new THREE.BufferAttribute(d,3))}else{for(var o=e.attributes.position.array,s=o.length/3,M=s/3,d=new Float32Array(2*s*3),c=0,u=M;u>c;c++)for(var E=0;3>E;E++){var m=18*c+6*E,S=9*c+3*E;d[m+0]=o[S],d[m+1]=o[S+1],d[m+2]=o[S+2];var w=9*c+3*((E+1)%3);d[m+3]=o[w],d[m+4]=o[w+1],d[m+5]=o[w+2]}this.addAttribute("position",new THREE.BufferAttribute(d,3))}},THREE.WireframeGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.WireframeGeometry.prototype.constructor=THREE.WireframeGeometry,THREE.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),i=new THREE.BufferGeometry;i.addAttribute("position",new THREE.BufferAttribute(t,3)),i.addAttribute("color",new THREE.BufferAttribute(r,3));var n=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.LineSegments.call(this,i,n)},THREE.AxisHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.AxisHelper.prototype.constructor=THREE.AxisHelper,THREE.ArrowHelper=function(){var e=new THREE.Geometry; +e.vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0));var t=new THREE.CylinderGeometry(0,.5,1,5,1);return t.translate(0,-.5,0),function(r,i,n,o,a,s){THREE.Object3D.call(this),void 0===o&&(o=16776960),void 0===n&&(n=1),void 0===a&&(a=.2*n),void 0===s&&(s=.2*a),this.position.copy(i),n>a&&(this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line)),this.cone=new THREE.Mesh(t,new THREE.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(n,a,s)}}(),THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper,THREE.ArrowHelper.prototype.setDirection=function(){var e,t=new THREE.Vector3;return function(r){r.y>.99999?this.quaternion.set(0,0,0,1):r.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),THREE.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),e>t&&(this.line.scale.set(1,e-t,1),this.line.updateMatrix()),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},THREE.ArrowHelper.prototype.setColor=function(e){void 0!==this.line&&this.line.material.color.set(e),this.cone.material.color.set(e)},THREE.BoxHelper=function(e){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new THREE.BufferGeometry;i.setIndex(new THREE.BufferAttribute(t,1)),i.addAttribute("position",new THREE.BufferAttribute(r,3)),THREE.LineSegments.call(this,i,new THREE.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},THREE.BoxHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.BoxHelper.prototype.constructor=THREE.BoxHelper,THREE.BoxHelper.prototype.update=function(){var e=new THREE.Box3;return function(t){if(e.setFromObject(t),!e.empty()){var r=e.min,i=e.max,n=this.geometry.attributes.position,o=n.array;o[0]=i.x,o[1]=i.y,o[2]=i.z,o[3]=r.x,o[4]=i.y,o[5]=i.z,o[6]=r.x,o[7]=r.y,o[8]=i.z,o[9]=i.x,o[10]=r.y,o[11]=i.z,o[12]=i.x,o[13]=i.y,o[14]=r.z,o[15]=r.x,o[16]=i.y,o[17]=r.z,o[18]=r.x,o[19]=r.y,o[20]=r.z,o[21]=i.x,o[22]=r.y,o[23]=r.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),THREE.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,this.box=new THREE.Box3,THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:r,wireframe:!0}))},THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype),THREE.BoundingBoxHelper.prototype.constructor=THREE.BoundingBoxHelper,THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},THREE.CameraHelper=function(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){i.vertices.push(new THREE.Vector3),i.colors.push(new THREE.Color(t)),void 0===o[e]&&(o[e]=[]),o[e].push(i.vertices.length-1)}var i=new THREE.Geometry,n=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),o={},a=16755200,s=16711680,h=43775,c=16777215,u=3355443;t("n1","n2",a),t("n2","n4",a),t("n4","n3",a),t("n3","n1",a),t("f1","f2",a),t("f2","f4",a),t("f4","f3",a),t("f3","f1",a),t("n1","f1",a),t("n2","f2",a),t("n3","f3",a),t("n4","f4",a),t("p","n1",s),t("p","n2",s),t("p","n3",s),t("p","n4",s),t("u1","u2",h),t("u2","u3",h),t("u3","u1",h),t("c","t",c),t("p","c",u),t("cn1","cn2",u),t("cn3","cn4",u),t("cf1","cf2",u),t("cf3","cf4",u),THREE.LineSegments.call(this,i,n),this.camera=e,this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},THREE.CameraHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.CameraHelper.prototype.constructor=THREE.CameraHelper,THREE.CameraHelper.prototype.update=function(){function e(e,o,a,s){i.set(o,a,s).unproject(n);var h=r[e];if(void 0!==h)for(var c=0,u=h.length;u>c;c++)t.vertices[h[c]].copy(i)}var t,r,i=new THREE.Vector3,n=new THREE.Camera;return function(){t=this.geometry,r=this.pointMap;var i=1,o=1;n.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-i,-o,-1),e("n2",i,-o,-1),e("n3",-i,o,-1),e("n4",i,o,-1),e("f1",-i,-o,1),e("f2",i,-o,1),e("f3",-i,o,1),e("f4",i,o,1),e("u1",.7*i,1.1*o,-1),e("u2",.7*-i,1.1*o,-1),e("u3",0,2*o,-1),e("cf1",-i,0,1),e("cf2",i,0,1),e("cf3",0,-o,1),e("cf4",0,o,1),e("cn1",-i,0,-1),e("cn2",i,0,-1),e("cn3",0,-o,-1),e("cn4",0,o,-1),t.verticesNeedUpdate=!0}}(),THREE.DirectionalLightHelper=function(e,t){THREE.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new THREE.Geometry;r.vertices.push(new THREE.Vector3(-t,t,0),new THREE.Vector3(t,t,0),new THREE.Vector3(t,-t,0),new THREE.Vector3(-t,-t,0),new THREE.Vector3(-t,t,0));var i=new THREE.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new THREE.Line(r,i),this.add(this.lightPlane),r=new THREE.Geometry,r.vertices.push(new THREE.Vector3,new THREE.Vector3),i=new THREE.LineBasicMaterial({fog:!1}),i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new THREE.Line(r,i),this.add(this.targetLine),this.update()},THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.DirectionalLightHelper.prototype.constructor=THREE.DirectionalLightHelper,THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},THREE.DirectionalLightHelper.prototype.update=function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(t,e),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),THREE.EdgesHelper=function(e,t,r){var i=void 0!==t?t:16777215;THREE.LineSegments.call(this,new THREE.EdgesGeometry(e.geometry,r),new THREE.LineBasicMaterial({color:i})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},THREE.EdgesHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper,THREE.FaceNormalsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1;var n=void 0!==r?r:16776960,o=void 0!==i?i:1,a=0,s=this.object.geometry;s instanceof THREE.Geometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var h=new THREE.BufferGeometry,c=new THREE.Float32Attribute(2*a*3,3);h.addAttribute("position",c),THREE.LineSegments.call(this,h,new THREE.LineBasicMaterial({color:n,linewidth:o})),this.matrixAutoUpdate=!1,this.update()},THREE.FaceNormalsHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper,THREE.FaceNormalsHelper.prototype.update=function(){var e=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,h=0,c=0,u=s.length;u>c;c++){var l=s[c],E=l.normal;e.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),t.copy(E).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),n.setXYZ(h,e.x,e.y,e.z),h+=1,n.setXYZ(h,t.x,t.y,t.z),h+=1}return n.needsUpdate=!0,this}}(),THREE.GridHelper=function(e,t){var r=new THREE.Geometry,i=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924),this.color2=new THREE.Color(8947848);for(var n=-e;e>=n;n+=t){r.vertices.push(new THREE.Vector3(-e,0,n),new THREE.Vector3(e,0,n),new THREE.Vector3(n,0,-e),new THREE.Vector3(n,0,e));var o=0===n?this.color1:this.color2;r.colors.push(o,o,o,o)}THREE.LineSegments.call(this,r,i)},THREE.GridHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.GridHelper.prototype.constructor=THREE.GridHelper,THREE.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},THREE.HemisphereLightHelper=function(e,t){THREE.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new THREE.Color,new THREE.Color];var r=new THREE.SphereGeometry(t,4,2);r.rotateX(-Math.PI/2);for(var i=0,n=8;n>i;i++)r.faces[i].color=this.colors[4>i?0:1];var o=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(r,o),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 e=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(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),THREE.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new THREE.SphereGeometry(t,4,2),i=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),THREE.Mesh.call(this,r,i),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(e){this.bones=this.getBoneList(e);for(var t=new THREE.Geometry,r=0;ru;u++)for(var E=h[u],p=0,d=E.vertexNormals.length;d>p;p++){var f=s[E[i[p]]],m=E.vertexNormals[p];e.copy(f).applyMatrix4(n),t.copy(m).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),o.setXYZ(c,e.x,e.y,e.z),c+=1,o.setXYZ(c,t.x,t.y,t.z),c+=1}else if(a instanceof THREE.BufferGeometry)for(var T=a.attributes.position,v=a.attributes.normal,c=0,p=0,d=T.count;d>p;p++)e.set(T.getX(p),T.getY(p),T.getZ(p)).applyMatrix4(n),t.set(v.getX(p),v.getY(p),v.getZ(p)),t.applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),o.setXYZ(c,e.x,e.y,e.z),c+=1,o.setXYZ(c,t.x,t.y,t.z),c+=1;return o.needsUpdate=!0,this}}(),THREE.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215;THREE.LineSegments.call(this,new THREE.WireframeGeometry(e.geometry),new THREE.LineBasicMaterial({color:r})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},THREE.WireframeHelper.prototype=Object.create(THREE.LineSegments.prototype),THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper,THREE.ImmediateRenderObject=function(e){THREE.Object3D.call(this),this.material=e,this.render=function(e){}},THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype),THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject,THREE.MorphBlendMesh=function(e,t){THREE.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,i="__default",n=0,o=r-1,a=r/1;this.createAnimation(i,n,o,a),this.setAnimationWeight(i,1)},THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh,THREE.MorphBlendMesh.prototype.createAnimation=function(e,t,r,i){var n={start:t,end:r,length:r-t+1,fps:i,duration:(r-t)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=n,this.animationsList.push(n)},THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,r=/([a-z]+)_?(\d+)/,i={},n=this.geometry,o=0,a=n.morphTargets.length;a>o;o++){var s=n.morphTargets[o],h=s.name.match(r);if(h&&h.length>1){var c=h[1];i[c]||(i[c]={start:1/0,end:-(1/0)});var u=i[c];ou.end&&(u.end=o),t||(t=c)}}for(var c in i){var u=i[c];this.createAnimation(c,u.start,u.end,e)}this.firstAnimation=t},THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},THREE.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},THREE.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},THREE.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},THREE.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},THREE.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,r=this.animationsMap[e];return r&&(t=r.time),t},THREE.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,r=this.animationsMap[e];return r&&(t=r.duration),t},THREE.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},THREE.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},THREE.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;r>t;t++){var i=this.animationsList[t];if(i.active){var n=i.duration/i.length;i.time+=i.direction*e,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var o=i.start+THREE.Math.clamp(Math.floor(i.time/n),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o);var s=i.time%n/n;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*a,this.morphTargetInfluences[i.lastFrame]=(1-s)*a):this.morphTargetInfluences[i.currentFrame]=a}}}; +//# sourceMappingURL=main.js.map diff --git a/example/data.json b/example/data.json new file mode 100644 index 0000000..2376af2 --- /dev/null +++ b/example/data.json @@ -0,0 +1,3 @@ +{ + "name": "Test" +} \ No newline at end of file diff --git a/example/index.html b/example/index.html new file mode 100644 index 0000000..05da31f --- /dev/null +++ b/example/index.html @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..825f3a8 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,149 @@ +'use strict'; + +var gulp = require('gulp'); +var del = require('del'); +var autoprefixer = require('gulp-autoprefixer'); +var cache = require('gulp-cache'); +var concat = require('gulp-concat'); +var imagemin = require('gulp-imagemin'); +var jscs = require('gulp-jscs'); +var jshint = require('gulp-jshint'); +var minifyHTML = require('gulp-minify-html'); +var size = require('gulp-size'); +var sourcemaps = require('gulp-sourcemaps'); +var sftp = require('gulp-sftp'); +var stylint = require('gulp-stylint'); +var stylus = require('gulp-stylus'); +var uglify = require('gulp-uglify'); +var mainBowerFiles = require('main-bower-files'); + +var browserSync = require('browser-sync').create(); + +// Удаляет все содержимое папки build и src/lib +gulp.task('clean', function() { + return del.sync(['build/**', 'src/lib/**']); +}); + +// Очищает кэш файлов +gulp.task('clear', function(done) { + return cache.clearAll(done); +}); + +// Конкатинирует и минифицирует JavaScript, создает sourseMap +gulp.task('scripts', function() { + return gulp.src(['src/js/**/*.js', 'src/lib/**/*.js']) + .pipe(sourcemaps.init()) + .pipe(concat('main.js')) + .pipe(uglify({ + preserveComments: 'some', + outSourceMap: true + })) + .pipe(sourcemaps.write('.')) + .pipe(gulp.dest('build/js')) + .pipe(size({title: 'scripts'})); +}); + +// Конкатинирует и минифицирует CSS, STYLUS, создает sourseMap +gulp.task('styles', function() { + return gulp.src(['src/css/main.styl']) + .pipe(sourcemaps.init()) + .pipe(stylus({compress: true})) + .pipe(autoprefixer({browsers: ['last 5 versions']})) + .pipe(sourcemaps.write('.')) + .pipe(gulp.dest('build/css')) + .pipe(size({title: 'styles'})); +}); + +// Копирует шрифты +gulp.task('fonts', function() { + return gulp.src(['src/fonts/**']) + .pipe(gulp.dest('build/fonts')) + .pipe(size({title: 'fonts'})); +}); + +// Сжимает изображения (gif, jpg, png, svg) без потерь +gulp.task('images', function() { + return gulp.src(['src/img/**/*']) + .pipe(cache(imagemin({ + progressive: true, + interlaced: true + }))) + .pipe(gulp.dest('build/img')) + .pipe(size({title: 'images'})); +}); + +// Копирует и минифицирует все html страницы +gulp.task('html', function() { + return gulp.src(['src/*.html']) + .pipe(minifyHTML()) + .pipe(gulp.dest('build')) + .pipe(size({title: 'html'})); +}); + +// Копирует все файлы из корня, кроме html +gulp.task('copy', function() { + return gulp.src(['src/*', '!src/*.html']) + .pipe(gulp.dest('build')) + .pipe(size({title: 'copy'})); +}); + +//Копирует главные файлы из bower_components/ в src/lib/ +gulp.task('mainBowerFiles', function() { + return gulp.src(mainBowerFiles()) + .pipe(gulp.dest('src/lib')); +}); + +// Проверка всех JS файлов в папке src/js +gulp.task('jslint', function() { + return gulp.src('src/js/**/*.js') + .pipe(jshint()) + .pipe(jshint.reporter('default', { verbose: true })); +}); + +// Проверка стиля javascript +gulp.task('jscs', function() { + return gulp.src('src/js/**/*.js') + .pipe(jscs()) + .pipe(jscs.reporter()); +}); + +// Проверка всех stylus файлов в папке src/css +gulp.task('stylint', function() { + return gulp.src('src/css/**/*.styl') + .pipe(stylint()) + .pipe(stylint.reporter()) + .pipe(stylint.reporter('fail')); +}); + +// Запускает локальный http сервер, следит за изменениями +gulp.task('serve', ['build'], function() { + browserSync.init({ + notify: false, + server: './', + startPath: '/example/' + }); + + gulp.watch(['example/*'], [browserSync.reload]); + gulp.watch(['src/*.html'], ['html', browserSync.reload]); + gulp.watch(['src/*', '!src/*.html'], ['copy', browserSync.reload]); + gulp.watch(['src/js/**/*.js', 'src/lib/*.js'], ['scripts', browserSync.reload]); + gulp.watch(['src/css/**/*.{css,styl}', 'src/lib/*.css'], ['styles', browserSync.reload]); + gulp.watch(['src/fonts/**'], ['fonts', browserSync.reload]); + gulp.watch(['src/img/**/*'], ['images', browserSync.reload]); +}); + +//Публикация на сайте tour-360.ru по FTP +gulp.task('deploy', function() { + return gulp.src(['build/**/*', '!build/**/*.map']) + .pipe(sftp({ + host: 'tour-360.ru', + auth: 'admin', + remotePath: 'public_html/tour-player/v2.0' + })); +}); + +gulp.task('lint', ['jslint', 'jscs','stylint']); +gulp.task('build', ['clean', 'clear', 'mainBowerFiles'], function() { + gulp.run(['copy', 'html', 'images', 'fonts', 'scripts', 'styles']); +}); +gulp.task('default', ['build']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..42a859a --- /dev/null +++ b/package.json @@ -0,0 +1,54 @@ +{ + "name": "tour-player", + "version": "0.6.0", + "description": "", + "repository": {}, + "scripts": { + "postinstall": "bower i && gulp build && gulp serve" + }, + "repository": { + "type": "git", + "url": "https://github.com/Tour-360/tour-player" + }, + "keywords": [ + "tour", + "virtual", + "player", + "360", + "HTML5", + "raw" + ], + "author": "Maxim Borodin (http://maximborodin.ru)", + "contributors": [ + { + "name" : "Maxim Borodin", + "email" : "borodinmk@gmail.com", + "url" : "http://maximborodin.ru" + },{ + "name" : "Denis Borodin", + "email" : "borodindk@gmail.com", + "url" : "http://denisborodin.ru" + } + ], + "license": "MIT", + "devDependencies": { + "bower": "^1.5.3", + "browser-sync": "^2.9.0", + "del": "^2.0.2", + "gulp": "^3.9.0", + "gulp-autoprefixer": "^3.0.2", + "gulp-cache": "^0.3.0", + "gulp-concat": "^2.6.0", + "gulp-imagemin": "^2.3.0", + "gulp-jscs": "^3.0.1", + "gulp-jshint": "^1.11.2", + "gulp-minify-html": "^1.0.4", + "gulp-sftp": "^0.1.5", + "gulp-size": "^1.0.0", + "gulp-sourcemaps": "^1.5.2", + "gulp-stylint": "^3.0.0", + "gulp-stylus": "^2.1.0", + "gulp-uglify": "^1.4.1", + "main-bower-files": "^2.9.0" + } +} diff --git a/src/badbrowser.html b/src/badbrowser.html new file mode 100644 index 0000000..e93172b --- /dev/null +++ b/src/badbrowser.html @@ -0,0 +1,10 @@ + + + + Слишком старый браузер + + +

Для отображения виртуального тура необходимо обновить браузер.

+ Обновить + + \ No newline at end of file diff --git a/src/css/layout.styl b/src/css/layout.styl new file mode 100644 index 0000000..30a6124 --- /dev/null +++ b/src/css/layout.styl @@ -0,0 +1,3 @@ +body, html + margin 0 + padding 0 \ No newline at end of file diff --git a/src/css/main.styl b/src/css/main.styl new file mode 100644 index 0000000..beaba6f --- /dev/null +++ b/src/css/main.styl @@ -0,0 +1,2 @@ +@import "variables/*.styl" +@import "layout.styl" \ No newline at end of file diff --git a/src/css/variables/color.styl b/src/css/variables/color.styl new file mode 100644 index 0000000..e69de29 diff --git a/src/fonts/opensans-regular.woff2 b/src/fonts/opensans-regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..bcb25b0f02c39abb3e9134b983fa34b63f43e972 GIT binary patch literal 15560 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, + * или navigator.language + * или navigator.userLanguage (EI) + * или на русский "ru" + * + * @param {String} language ISO 639-1 Код языка + * @return {String} Возвращает ISO 639-1 код установленного языка + */ +Lang.setLanguage = function(language) { + this.language = ( + language || + document.documentElement.lang || + navigator.language || + navigator.userLanguage || + this.default + ).split('-')[0]; + + return this.language; +}; + +/** + * Преобразует Языковой объект во вразу установленного языка. + * Если фразы нужного языка нет, то возвращает враузу языка по умолчанию. + * Если передан не объект, то возвращает его без преобразований. + * + * @param {Object} value Языковой объект + * или строка + * @return {String} Фразу установленного языка + */ +Lang.translate = function(value) { + if (typeof value === 'object') { + return value[this.language] || value[this.default]; + } else { + return value; + } +}; + +/** + * Возвращает фразу по ключу из словаря + * + * @param {String} key Ключ фразы в словаре + * @return {String} Фраза из словаря + */ +Lang.get = function(key) { + if (Lang.dictionary[key]) { + return this.translate(this.dictionary[key]); + } else { + return '[' + key + ']'; + } +}; diff --git a/src/js/Lang/dictionary.js b/src/js/Lang/dictionary.js new file mode 100644 index 0000000..aa17cc7 --- /dev/null +++ b/src/js/Lang/dictionary.js @@ -0,0 +1,22 @@ +/* globals Lang */ + +/** + * Словарь фраз на нескольких языхах + * коды языков ISO 639-1 + * + * @type {Object} + */ +Lang.dictionary = { + 'accept': { + 'en': 'accept', + 'ru': 'принять', + 'uk': 'приймати', + 'de': 'akzeptieren' + }, + 'reject': { + 'en': 'reject', + 'ru': 'отклонить', + 'uk': 'реест', + 'de': 'reest' + } +}; diff --git a/src/js/Tour.js b/src/js/Tour.js new file mode 100644 index 0000000..3898892 --- /dev/null +++ b/src/js/Tour.js @@ -0,0 +1,4 @@ +var Tour = {}; + +// Версия плеера +Tour.version = [0, 6, 0]; diff --git a/src/js/Tour/events.js b/src/js/Tour/events.js new file mode 100644 index 0000000..c02e12f --- /dev/null +++ b/src/js/Tour/events.js @@ -0,0 +1,15 @@ +/* globals Tour*/ +Tour.events = {}; + +Tour.emmit = function(name, obj) { + if (name in Tour.events) { + Tour.events[name](obj); + } +}; + +Tour.on = function(name, callback) { + if (!(name in Tour.events)) { + Tour.events[name] = []; + } + Tour.events[name] = callback; +}; diff --git a/src/js/Tour/init.js b/src/js/Tour/init.js new file mode 100644 index 0000000..0e625a6 --- /dev/null +++ b/src/js/Tour/init.js @@ -0,0 +1,10 @@ +/* globals Tour, Lang*/ + +Tour.init = function() { + console.info('Tour-player', 'v' + Tour.version.join('.'), 'by http://Tour-360.ru'); + Lang.setLanguage(); + Tour.query.get(); + Tour.load(Tour.queries.data); +}; + +document.addEventListener('DOMContentLoaded', Tour.init); diff --git a/src/js/Tour/load.js b/src/js/Tour/load.js new file mode 100644 index 0000000..1e28182 --- /dev/null +++ b/src/js/Tour/load.js @@ -0,0 +1,23 @@ +/* globals Tour */ + +Tour.load = function(url) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url || 'data.json', true); + xhr.onreadystatechange = function() { + if (xhr.readyState != 4) { + return; + } + if (xhr.status != 200) { + Tour.log('Tour load Error'); + } else { + try { + Tour.data = JSON.parse(xhr.responseText); + Tour.emmit('load', Tour.data); + } catch (e) { + Tour.log('JSON Error'); + } + return true; + } + }; + xhr.send(); +}; diff --git a/src/js/Tour/log.js b/src/js/Tour/log.js new file mode 100644 index 0000000..980cd11 --- /dev/null +++ b/src/js/Tour/log.js @@ -0,0 +1,5 @@ +/* globals Tour */ + +Tour.log = function() { + console.log(Array.prototype.slice.call(arguments).join(' ')); +}; diff --git a/src/js/Tour/query.js b/src/js/Tour/query.js new file mode 100644 index 0000000..814330b --- /dev/null +++ b/src/js/Tour/query.js @@ -0,0 +1,26 @@ +/* globals Tour */ + +Tour.query = {}; + +// Объект запросов из location.search +Tour.queries = {}; + +/** + * Парсит location.search + * + * @return {Object} Объект запросов + */ +Tour.query.get = function() { + var search = location.search.slice(1).split('&'); + + for (var i = 0; i < search.length; i++) { + var querie = search[i].split('='); + Tour.queries[querie[0]] = querie[1]; + } + + return Tour.queries; +}; + +Tour.query.set = function() { + +};