Skip to content

Instantly share code, notes, and snippets.

@enjalot
Last active April 2, 2016 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enjalot/6efce09b3cb9833c3aaf to your computer and use it in GitHub Desktop.
Save enjalot/6efce09b3cb9833c3aaf to your computer and use it in GitHub Desktop.
Quadtree Cube
license: gpl-3.0
height: 1060

This demonstrates finding the closest point to the mouse by searching a quadtree. As you descend into the quadtree, you track the closest point yet found and avoid searching cells that cannot contain closer points. Importantly, you must descend preferentially into closer cells so as to restrict the search more quickly.

Patrick Surry implemented a similar solution months earlier!

forked from mbostock's block: Quadtree Tree

forked from enjalot's block: Quadtree Cube

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.AFRAME=e()}}(function(){var t;return function i(e,t,r){function n(a,s){if(!t[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var l=t[a]={exports:{}};e[a][0].call(l.exports,function(t){var i=e[a][1][t];return n(i?i:t)},l,l.exports,i,e,t,r)}return t[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)n(r[a]);return n}({1:[function(e,t){"use strict";t.exports={createLink:function(e,t){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("link");r.href=e,r.rel="stylesheet";for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];r.setAttribute("data-"+n,o)}i.appendChild(r)},createStyle:function(e,t){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];r.setAttribute("data-"+n,o)}r.sheet?(r.innerHTML=e,r.sheet.cssText=e,i.appendChild(r)):r.styleSheet?(i.appendChild(r),r.styleSheet.cssText=e):(r.appendChild(document.createTextNode(e)),i.appendChild(r))}}},{}],2:[function(e,t){function i(){h=!1,a.length?c=a.concat(c):l=-1,c.length&&r()}function r(){if(!h){var e=setTimeout(i);h=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,h=!1,clearTimeout(e)}}function n(e,t){this.fun=e,this.array=t}function o(){}var a,s=t.exports={},c=[],h=!1,l=-1;s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];c.push(new n(e,t)),1!==c.length||h||setTimeout(r,0)},n.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=o,s.addListener=o,s.once=o,s.off=o,s.removeListener=o,s.removeAllListeners=o,s.emit=o,s.binding=function(){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],3:[function(e,t,i){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function n(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+i.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var n=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(n++,"%c"===e&&(o=n))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?i.storage.removeItem("debug"):i.storage.debug=e}catch(t){}}function s(){var e;try{e=i.storage.debug}catch(t){}return e}function c(){try{return window.localStorage}catch(e){}}i=t.exports=e("./debug"),i.log=o,i.formatArgs=n,i.save=a,i.load=s,i.useColors=r,i.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),i.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],i.formatters.j=function(e){return JSON.stringify(e)},i.enable(s())},{"./debug":4}],4:[function(e,t,i){function r(){return i.colors[l++%i.colors.length]}function n(e){function t(){}function n(){var e=n,t=+new Date,o=t-(h||t);e.diff=o,e.prev=h,e.curr=t,h=t,null==e.useColors&&(e.useColors=i.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=i.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var n=i.formatters[r];if("function"==typeof n){var o=a[s];t=n.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof i.formatArgs&&(a=i.formatArgs.apply(e,a));var c=n.log||i.log||console.log.bind(console);c.apply(e,a)}t.enabled=!1,n.enabled=!0;var o=i.enabled(e)?n:t;return o.namespace=e,o}function o(e){i.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,n=0;r>n;n++)t[n]&&(e=t[n].replace(/\*/g,".*?"),"-"===e[0]?i.skips.push(new RegExp("^"+e.substr(1)+"$")):i.names.push(new RegExp("^"+e+"$")))}function a(){i.enable("")}function s(e){var t,r;for(t=0,r=i.skips.length;r>t;t++)if(i.skips[t].test(e))return!1;for(t=0,r=i.names.length;r>t;t++)if(i.names[t].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}i=t.exports=n,i.coerce=c,i.disable=a,i.enable=o,i.enabled=s,i.humanize=e("ms"),i.names=[],i.skips=[],i.formatters={};var h,l=0},{ms:5}],5:[function(e,t){function i(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var i=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return i*l;case"days":case"day":case"d":return i*h;case"hours":case"hour":case"hrs":case"hr":case"h":return i*c;case"minutes":case"minute":case"mins":case"min":case"m":return i*s;case"seconds":case"second":case"secs":case"sec":case"s":return i*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i}}}}function r(e){return e>=h?Math.round(e/h)+"d":e>=c?Math.round(e/c)+"h":e>=s?Math.round(e/s)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function n(e){return o(e,h,"day")||o(e,c,"hour")||o(e,s,"minute")||o(e,a,"second")||e+" ms"}function o(e,t,i){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+i:Math.ceil(e/t)+" "+i+"s"}var a=1e3,s=60*a,c=60*s,h=24*c,l=365.25*h;t.exports=function(e,t){return t=t||{},"string"==typeof e?i(e):t["long"]?n(e):r(e)}},{}],6:[function(e,t){"use strict";function i(e){if(null===e||void 0===e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}function r(e,t,i){var r=t[i];if(void 0!==r&&null!==r){if(a.call(e,i)&&(void 0===e[i]||null===e[i]))throw new TypeError("Cannot convert undefined or null to object ("+i+")");e[i]=a.call(e,i)&&o(r)?n(Object(e[i]),t[i]):r}}function n(e,t){if(e===t)return e;t=Object(t);for(var i in t)a.call(t,i)&&r(e,t,i);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(t),o=0;o<n.length;o++)s.call(t,n[o])&&r(e,t,n[o]);return e}var o=e("is-obj"),a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;t.exports=function(e){e=i(e);for(var t=1;t<arguments.length;t++)n(e,arguments[t]);return e}},{"is-obj":7}],7:[function(e,t){"use strict";t.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},{}],8:[function(){!function(t,i,r,n){"use strict";function o(e,t){for(var i=0,r=e.length;r>i;i++)g(e[i],t)}function a(e){for(var t,i=0,r=e.length;r>i;i++)t=e[i],E(t,U[c(t)])}function s(e){return function(t){ne(t)&&(g(t,e),o(t.querySelectorAll(z),e))}}function c(e){var t=se.call(e,"is"),i=e.nodeName.toUpperCase(),r=G.call(V,t?N+t.toUpperCase():k+i);return t&&r>-1&&!h(i,t)?-1:r}function h(e,t){return-1<z.indexOf(e+'[is="'+t+'"]')}function l(e){var t=e.currentTarget,i=e.attrChange,r=e.attrName,n=e.target;ge&&(!n||n===t)&&t.attributeChangedCallback&&"style"!==r&&e.prevValue!==e.newValue&&t.attributeChangedCallback(r,i===e[L]?null:e.prevValue,i===e[P]?null:e.newValue)}function u(e){var t=s(e);return function(e){y.push(t,e.target)}}function d(e){ve&&(ve=!1,e.currentTarget.removeEventListener(O,d)),o((e.target||i).querySelectorAll(z),e.detail===T?T:S),re&&m()}function p(e,t){var i=this;ce.call(i,e,t),x.call(i,{target:i})}function f(e,t){ee(e,t),M?M.observe(e,ue):(me&&(e.setAttribute=p,e[A]=w(e),e.addEventListener(I,x)),e.addEventListener(D,l)),e.createdCallback&&ge&&(e.created=!0,e.createdCallback(),e.created=!1)}function m(){for(var e,t=0,i=oe.length;i>t;t++)e=oe[t],j.contains(e)||(i--,oe.splice(t--,1),g(e,T))}function v(e){throw new Error("A "+e+" type is already registered")}function g(e,t){var i,r=c(e);r>-1&&(_(e,U[r]),r=0,t!==S||e[S]?t===T&&!e[T]&&(e[S]=!1,e[T]=!0,r=1):(e[T]=!1,e[S]=!0,r=1,re&&G.call(oe,e)<0&&oe.push(e)),r&&(i=e[t+"Callback"])&&i.call(e))}if(!(n in i)){var y,x,b,w,M,_,E,A="__"+n+(1e5*Math.random()>>0),S="attached",T="detached",C="extends",L="ADDITION",R="MODIFICATION",P="REMOVAL",D="DOMAttrModified",O="DOMContentLoaded",I="DOMSubtreeModified",k="<",N="=",B=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,F=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],V=[],U=[],z="",j=i.documentElement,G=V.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},H=r.prototype,W=H.hasOwnProperty,q=H.isPrototypeOf,X=r.defineProperty,Y=r.getOwnPropertyDescriptor,Q=r.getOwnPropertyNames,K=r.getPrototypeOf,Z=r.setPrototypeOf,J=!!r.__proto__,$=r.create||function ye(e){return e?(ye.prototype=e,new ye):this},ee=Z||(J?function(e,t){return e.__proto__=t,e}:Q&&Y?function(){function e(e,t){for(var i,r=Q(t),n=0,o=r.length;o>n;n++)i=r[n],W.call(e,i)||X(e,i,Y(t,i))}return function(t,i){do e(t,i);while((i=K(i))&&!q.call(i,t));return t}}():function(e,t){for(var i in t)e[i]=t[i];return e}),te=t.MutationObserver||t.WebKitMutationObserver,ie=(t.HTMLElement||t.Element||t.Node).prototype,re=!q.call(ie,j),ne=re?function(e){return 1===e.nodeType}:function(e){return q.call(ie,e)},oe=re&&[],ae=ie.cloneNode,se=ie.getAttribute,ce=ie.setAttribute,he=ie.removeAttribute,le=i.createElement,ue=te&&{attributes:!0,characterData:!0,attributeOldValue:!0},de=te||function(){me=!1,j.removeEventListener(D,de)},pe=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,10)},fe=!1,me=!0,ve=!0,ge=!0;Z||J?(_=function(e,t){q.call(t,e)||f(e,t)},E=f):(_=function(e,t){e[A]||(e[A]=r(!0),f(e,t))},E=_),re?(me=!1,function(){var t=Y(ie,"addEventListener"),i=t.value,r=function(e){var t=new CustomEvent(D,{bubbles:!0});t.attrName=e,t.prevValue=se.call(this,e),t.newValue=null,t[P]=t.attrChange=2,he.call(this,e),this.dispatchEvent(t)},n=function(t,i){var r=this.hasAttribute(t),n=r&&se.call(this,t);e=new CustomEvent(D,{bubbles:!0}),ce.call(this,t,i),e.attrName=t,e.prevValue=r?n:null,e.newValue=i,r?e[R]=e.attrChange=1:e[L]=e.attrChange=0,this.dispatchEvent(e)},o=function(e){var t,i=e.currentTarget,r=i[A],n=e.propertyName;r.hasOwnProperty(n)&&(r=r[n],t=new CustomEvent(D,{bubbles:!0}),t.attrName=r.name,t.prevValue=r.value||null,t.newValue=r.value=i[n]||null,null==t.prevValue?t[L]=t.attrChange=0:t[R]=t.attrChange=1,i.dispatchEvent(t))};t.value=function(e,t,a){e===D&&this.attributeChangedCallback&&this.setAttribute!==n&&(this[A]={className:{name:"class",value:this.className}},this.setAttribute=n,this.removeAttribute=r,i.call(this,"propertychange",o)),i.call(this,e,t,a)},X(ie,"addEventListener",t)}()):te||(j.addEventListener(D,de),j.setAttribute(A,1),j.removeAttribute(A),me&&(x=function(e){var t,i,r,n=this;if(n===e.target){t=n[A],n[A]=i=w(n);for(r in i){if(!(r in t))return b(0,n,r,t[r],i[r],L);if(i[r]!==t[r])return b(1,n,r,t[r],i[r],R)}for(r in t)if(!(r in i))return b(2,n,r,t[r],i[r],P)}},b=function(e,t,i,r,n,o){var a={attrChange:e,currentTarget:t,attrName:i,prevValue:r,newValue:n};a[o]=e,l(a)},w=function(e){for(var t,i,r={},n=e.attributes,o=0,a=n.length;a>o;o++)t=n[o],i=t.name,"setAttribute"!==i&&(r[i]=t.value);return r})),i[n]=function(e,t){if(r=e.toUpperCase(),fe||(fe=!0,te?(M=function(e,t){function i(e,t){for(var i=0,r=e.length;r>i;t(e[i++]));}return new te(function(r){for(var n,o,a,s=0,c=r.length;c>s;s++)n=r[s],"childList"===n.type?(i(n.addedNodes,e),i(n.removedNodes,t)):(o=n.target,ge&&o.attributeChangedCallback&&"style"!==n.attributeName&&(a=se.call(o,n.attributeName),a!==n.oldValue&&o.attributeChangedCallback(n.attributeName,n.oldValue,a)))})}(s(S),s(T)),M.observe(i,{childList:!0,subtree:!0})):(y=[],pe(function g(){for(;y.length;)y.shift().call(null,y.shift());pe(g)}),i.addEventListener("DOMNodeInserted",u(S)),i.addEventListener("DOMNodeRemoved",u(T))),i.addEventListener(O,d),i.addEventListener("readystatechange",d),i.createElement=function(e,t){var r=le.apply(i,arguments),n=""+e,o=G.call(V,(t?N:k)+(t||n).toUpperCase()),a=o>-1;return t&&(r.setAttribute("is",t=t.toLowerCase()),a&&(a=h(n.toUpperCase(),t))),ge=!i.createElement.innerHTMLHelper,a&&E(r,U[o]),r},ie.cloneNode=function(e){var t=ae.call(this,!!e),i=c(t);return i>-1&&E(t,U[i]),e&&a(t.querySelectorAll(z)),t}),-2<G.call(V,N+r)+G.call(V,k+r)&&v(e),!B.test(r)||-1<G.call(F,r))throw new Error("The type "+e+" is invalid");var r,n,l=function(){return f?i.createElement(m,r):i.createElement(m)},p=t||H,f=W.call(p,C),m=f?t[C].toUpperCase():r;return f&&-1<G.call(V,k+m)&&v(m),n=V.push((f?N:k)+r)-1,z=z.concat(z.length?",":"",f?m+'[is="'+e.toLowerCase()+'"]':m),l.prototype=U[n]=W.call(p,"prototype")?p.prototype:$(ie),o(i.querySelectorAll(z),S),l}}}(window,document,Object,"registerElement")},{}],9:[function(e,t){"use strict";function i(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;t.exports=Object.assign||function(e){for(var t,o,a=i(e),s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var c in t)r.call(t,c)&&(a[c]=t[c]);if(Object.getOwnPropertySymbols){o=Object.getOwnPropertySymbols(t);for(var h=0;h<o.length;h++)n.call(t,o[h])&&(a[o[h]]=t[o[h]])}}return a}},{}],10:[function(e,t){(function(e){var i=e.performance||{},r=function(){for(var e=["now","webkitNow","msNow","mozNow","oNow"];e.length;){var t=e.shift();if(t in i)return i[t].bind(i)}var r=Date.now||function(){return(new Date).getTime()},n=(i.timing||{}).navigationStart||r();return function(){return r()-n}}();r.performanceNow=i.now,r.noConflict=function(){i.now=r.performanceNow},r.conflict=function(){i.now=r},r.conflict(),t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t){!function(e){function i(e,t){return function(){e.apply(t,arguments)}}function r(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],h(e,i(o,this),i(a,this))}function n(e){var t=this;return null===this._state?void this._deferreds.push(e):void u(function(){var i=t._state?e.onFulfilled:e.onRejected;if(null===i)return void(t._state?e.resolve:e.reject)(t._value);var r;try{r=i(t._value)}catch(n){return void e.reject(n)}e.resolve(r)})}function o(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var t=e.then;if("function"==typeof t)return void h(i(t,e),i(o,this),i(a,this))}this._state=!0,this._value=e,s.call(this)}catch(r){a.call(this,r)}}function a(e){this._state=!1,this._value=e,s.call(this)}function s(){for(var e=0,t=this._deferreds.length;t>e;e++)n.call(this,this._deferreds[e]);this._deferreds=null}function c(e,t,i,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=i,this.reject=r}function h(e,t,i){var r=!1;try{e(function(e){r||(r=!0,t(e))},function(e){r||(r=!0,i(e))})}catch(n){if(r)return;r=!0,i(n)}}var l=setTimeout,u="function"==typeof setImmediate&&setImmediate||function(e){l(e,1)},d=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};r.prototype["catch"]=function(e){return this.then(null,e)},r.prototype.then=function(e,t){var i=this;return new r(function(r,o){n.call(i,new c(e,t,r,o))})},r.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&d(arguments[0])?arguments[0]:arguments);return new r(function(t,i){function r(o,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(e){r(o,e)},i)}e[o]=a,0===--n&&t(e)}catch(c){i(c)}}if(0===e.length)return t([]);for(var n=e.length,o=0;o<e.length;o++)r(o,e[o])})},r.resolve=function(e){return e&&"object"==typeof e&&e.constructor===r?e:new r(function(t){t(e)})},r.reject=function(e){return new r(function(t,i){i(e)})},r.race=function(e){return new r(function(t,i){for(var r=0,n=e.length;n>r;r++)e[r].then(t,i)})},r._setImmediateFn=function(e){u=e},"undefined"!=typeof t&&t.exports?t.exports=r:e.Promise||(e.Promise=r)}(this)},{}],12:[function(e,t,i){"use strict";function r(e,t,i){function r(){s.id=o(r),a()-n>=e&&(t.call(i),n=a())}var n=a(),s=Object.create(null);return s.id=o(r),s}function n(e){o.cancel(e.id)}var o=e("raf"),a=e("time-now");i=t.exports=r,i.clear=n},{raf:13,"time-now":14}],13:[function(e,t,i){function r(e){var t=(new Date).getTime(),i=Math.max(0,16-(t-n)),r=setTimeout(e,i);return n=t,r}i=t.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||r;var n=(new Date).getTime(),o=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.clearTimeout;i.cancel=function(e){o.call(window,e)}},{}],14:[function(e,t){"use strict";t.exports=function(){var e=window&&window.performance;return e&&e.now?e.now.bind(e):function(){return(new Date).getTime()}}()},{}],15:[function(e,t){function i(e){var t=function(e){return e.trim()},i={};return r(e).map(t).filter(Boolean).forEach(function(e){var t=e.indexOf(":"),r=e.substr(0,t).trim(),n=e.substr(t+1).trim();i[r]=n}),i}function r(e){for(var t,i=[],r=0,n=";",o=/url\([^\)]+$/,a="";r<e.length;)t=e.indexOf(n,r),-1===t&&(t=e.length),a+=e.substring(r,t),o.test(a)?(a+=";",r=t+1):(i.push(a),a="",r=t+1);return i}function n(e){return Object.keys(e).map(function(t){return t+":"+e[t]}).join(";")}function o(e){return n(i(e))}t.exports.parse=i,t.exports.stringify=n,t.exports.normalize=o},{}],16:[function(){THREE.VRControls=function(e,t){function i(e){for(var i=0;i<e.length;i++)if("VRDisplay"in window&&e[i]instanceof VRDisplay||"PositionSensorVRDevice"in window&&e[i]instanceof PositionSensorVRDevice){r=e[i];break}r||t&&t("VR input not available.")}var r,n=this;navigator.getVRDisplays?navigator.getVRDisplays().then(i):navigator.getVRDevices&&navigator.getVRDevices().then(i),this.scale=1,this.update=function(){if(r)if(r.getPose){var t=r.getPose();null!==t.orientation&&e.quaternion.fromArray(t.orientation),null!==t.position&&e.position.fromArray(t.position).multiplyScalar(n.scale)}else{var i=r.getState();null!==i.orientation&&e.quaternion.copy(i.orientation),null!==i.position&&e.position.copy(i.position).multiplyScalar(n.scale)}},this.resetSensor=function(){r&&(void 0!==r.resetPose?r.resetPose():void 0!==r.resetSensor?r.resetSensor():void 0!==r.zeroSensor&&r.zeroSensor())},this.zeroSensor=function(){console.warn("THREE.VRControls: .zeroSensor() is now .resetSensor()."),this.resetSensor()},this.dispose=function(){r=null}}},{}],17:[function(){THREE.VREffect=function(e,t){function i(e){for(var i=0;i<e.length;i++){if("VRDisplay"in window&&e[i]instanceof VRDisplay){a=e[i],u=!1;break}if("HMDVRDevice"in window&&e[i]instanceof HMDVRDevice){a=e[i],u=!0;break}}void 0===a&&t&&t("HMD not available")}function r(e){var t=2/(e.leftTan+e.rightTan),i=(e.leftTan-e.rightTan)*t*.5,r=2/(e.upTan+e.downTan),n=(e.upTan-e.downTan)*r*.5;return{scale:[t,r],offset:[i,n]}}function n(e,t,i,n){t=void 0===t?!0:t,i=void 0===i?.01:i,n=void 0===n?1e4:n;var o=t?-1:1,a=new THREE.Matrix4,s=a.elements,c=r(e);return s[0]=c.scale[0],s[1]=0,s[2]=c.offset[0]*o,s[3]=0,s[4]=0,s[5]=c.scale[1],s[6]=-c.offset[1]*o,s[7]=0,s[8]=0,s[9]=0,s[10]=n/(i-n)*-o,s[11]=n*i/(i-n),s[12]=0,s[13]=0,s[14]=o,s[15]=0,a.transpose(),a}function o(e,t,i,r){var o=Math.PI/180,a={upTan:Math.tan(e.upDegrees*o),downTan:Math.tan(e.downDegrees*o),leftTan:Math.tan(e.leftDegrees*o),rightTan:Math.tan(e.rightDegrees*o)};return n(a,t,i,r)}var a,s,c,h,l,u=!1,d=new THREE.Vector3,p=new THREE.Vector3;navigator.getVRDisplays?navigator.getVRDisplays().then(i):navigator.getVRDevices&&navigator.getVRDevices().then(i),this.scale=1,this.setSize=function(t,i){e.setSize(t,i)};var f=!1,m=e.domElement,v=m.mozRequestFullScreen?"mozfullscreenchange":"webkitfullscreenchange";document.addEventListener(v,function(){a&&u&&(f=document.mozFullScreenElement||document.webkitFullscreenElement)},!1),window.addEventListener("vrdisplaypresentchange",function(){f=a&&a.isPresenting},!1),this.setFullScreen=function(e){return new Promise(function(t,i){return void 0===a?void i(new Error("No VR hardware found.")):f===e?void t():void(u?m.mozRequestFullScreen?(m.mozRequestFullScreen({vrDisplay:a}),t()):m.webkitRequestFullscreen?(m.webkitRequestFullscreen({vrDisplay:a}),t()):(console.error("No compatible requestFullscreen method found."),i(new Error("No compatible requestFullscreen method found."))):t(e?a.requestPresent({source:m}):a.exitPresent()))})},this.requestPresent=function(){return this.setFullScreen(!0)},this.exitPresent=function(){return this.setFullScreen(!1)};var g=new THREE.PerspectiveCamera;g.layers.enable(1);var y=new THREE.PerspectiveCamera;y.layers.enable(2),this.render=function(t,i){if(a&&f){var r=t.autoUpdate;r&&(t.updateMatrixWorld(),t.autoUpdate=!1);var n=a.getEyeParameters("left"),m=a.getEyeParameters("right");u?(d.copy(n.eyeTranslation),p.copy(m.eyeTranslation),h=n.recommendedFieldOfView,l=m.recommendedFieldOfView):(d.fromArray(n.offset),p.fromArray(m.offset),h=n.fieldOfView,l=m.fieldOfView),Array.isArray(t)&&(console.warn("THREE.VREffect.render() no longer supports arrays. Use object.layers instead."),t=t[0]);var v=e.getSize();return s={x:0,y:0,width:v.width/2,height:v.height},c={x:v.width/2,y:0,width:v.width/2,height:v.height},e.setScissorTest(!0),e.clear(),null===i.parent&&i.updateMatrixWorld(),g.projectionMatrix=o(h,!0,i.near,i.far),y.projectionMatrix=o(l,!0,i.near,i.far),i.matrixWorld.decompose(g.position,g.quaternion,g.scale),i.matrixWorld.decompose(y.position,y.quaternion,y.scale),g.translateX(d.x*this.scale),y.translateX(p.x*this.scale),e.setViewport(s.x,s.y,s.width,s.height),e.setScissor(s.x,s.y,s.width,s.height),e.render(t,g),e.setViewport(c.x,c.y,c.width,c.height),e.setScissor(c.x,c.y,c.width,c.height),e.render(t,y),e.setScissorTest(!1),r&&(t.autoUpdate=!0),void(u||a.submitFrame())}e.render(t,i)}}},{}],18:[function(){THREE.ColladaLoader=function(){function e(e,i,r,n){var o=0;if(document.implementation&&document.implementation.createDocument){var a=new XMLHttpRequest;a.onreadystatechange=function(){4===a.readyState?(0===a.status||200===a.status)&&(a.response?(Fe=i,t(a.response,void 0,e)):n?n():console.error("ColladaLoader: Empty or non-existing file ("+e+")")):3===a.readyState&&r&&(0===o&&(o=a.getResponseHeader("Content-Length")),r({total:o,loaded:a.responseText.length}))},a.open("GET",e,!0),a.send(null)}else alert("Don't know how to parse XML!")}function t(e,t,i){if(Ne=(new DOMParser).parseFromString(e,"text/xml"),t=t||Fe,void 0!==i){var c=i.split("/");c.pop(),Oe=(c.length<1?".":c.join("/"))+"/"}r(),be(),Ue=n("library_images image",S,"image"),He=n("library_materials material",q,"material"),We=n("library_effects effect",Z,"effect"),Ge=n("library_geometries geometry",N,"geometry"),qe=n("library_cameras camera",re,"camera"),Xe=n("library_lights light",oe,"light"),je=n("library_controllers controller",T,"controller"),ze=n("library_animations animation",$,"animation"),Pe=n("library_visual_scenes visual_scene",R,"visual_scene"),De=n("library_kinematics_models kinematics_model",se,"kinematics_model"),Ie=[],ke=[],Te=o(),Be=new THREE.Group;for(var h=0;h<Te.nodes.length;h++)Be.add(g(Te.nodes[h]));Be.scale.multiplyScalar(Ke),s(),Ce=a(),v();var l={scene:Be,morphs:Ie,skins:ke,animations:Le,kinematics:Re,dae:{images:Ue,materials:He,cameras:qe,lights:Xe,effects:We,geometries:Ge,controllers:je,animations:ze,visualScenes:Pe,visualScene:Te,scene:Te,kinematicsModels:De,kinematicsModel:Ce}};return t&&t(l),l}function i(e){Ye=e}function r(){var e=Ne.querySelectorAll("asset"),t=e[0];if(t&&t.childNodes)for(var i=0;i<t.childNodes.length;i++){var r=t.childNodes[i];switch(r.nodeName){case"unit":var n=r.getAttribute("meter");n&&(Ke=parseFloat(n));break;case"up_axis":Ze=r.textContent.charAt(0)}}}function n(e,t,i){for(var r=Ne.querySelectorAll(e),n={},o=0,a=r.length,s=0;a>s;s++){var c=r[s],h=(new t).parse(c);h.id&&0!==h.id.length||(h.id=i+o++),n[h.id]=h}return n}function o(){var e=Ne.querySelectorAll("scene instance_visual_scene")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return Pe[t.length>0?t:"visual_scene0"]}return null}function a(){var e=Ne.querySelectorAll("instance_kinematics_model")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return De[t.length>0?t:"kinematics_model0"]}return null}function s(){Le=[],c(Be)}function c(e){var t=Te.getChildById(e.colladaId,!0),i=null;if(t&&t.keys){i={fps:60,hierarchy:[{node:t,keys:t.keys,sids:t.sids}],node:e,name:"animation_"+e.name,length:0},Le.push(i);for(var r=0,n=t.keys.length;n>r;r++)i.length=Math.max(i.length,t.keys[r].time)}else i={hierarchy:[{keys:[],sids:[]}]};for(var r=0,n=e.children.length;n>r;r++)for(var o=c(e.children[r]),a=0,s=o.hierarchy.length;s>a;a++)i.hierarchy.push({keys:[],sids:[]});return i}function h(){var e,t=1e6,i=-t,r=0;for(var n in ze){var o=ze[n];e=e||o.id;for(var a=0;a<o.sampler.length;a++){var s=o.sampler[a];s.create(),t=Math.min(t,s.startTime),i=Math.max(i,s.endTime),r=Math.max(r,s.input.length)}}return{start:t,end:i,frames:r,ID:e}}function l(e,t){var i=t instanceof O?je[t.url]:t;if(!i||!i.morph)return void console.log("could not find morph controller!");for(var r=i.morph,n=0;n<r.targets.length;n++){var o=r.targets[n],a=Ge[o];if(a.mesh&&a.mesh.primitives&&a.mesh.primitives.length){var s=a.mesh.primitives[0].geometry;s.vertices.length===e.vertices.length&&e.morphTargets.push({name:"target_1",vertices:s.vertices})}}e.morphTargets.push({name:"target_Z",vertices:e.vertices})}function u(e,t,i,r){if(e.world=e.world||new THREE.Matrix4,e.localworld=e.localworld||new THREE.Matrix4,e.world.copy(e.matrix),e.localworld.copy(e.matrix),e.channels&&e.channels.length){var n=e.channels[0],o=n.sampler.output[i];o instanceof THREE.Matrix4&&(e.world.copy(o),e.localworld.copy(o),0===i&&e.matrix.copy(o))}r&&e.world.multiplyMatrices(r,e.world),t.push(e);for(var a=0;a<e.nodes.length;a++)u(e.nodes[a],t,i,e.world)}function d(e,t){for(var i=0;i<e.length;i++){var r=e[i],n=-1;if("JOINT"==r.type){for(var o=0;o<t.joints.length;o++)if(r.sid===t.joints[o]){n=o;break}if(n>=0){var a=t.invBindMatrices[n];r.invBindMatrix=a,r.skinningMatrix=new THREE.Matrix4,r.skinningMatrix.multiplyMatrices(r.world,a),r.animatrix=new THREE.Matrix4,r.animatrix.copy(r.localworld),r.weights=[];for(var o=0;o<t.weights.length;o++)for(var s=0;s<t.weights[o].length;s++){var c=t.weights[o][s];c.joint===n&&r.weights.push(c)}}else console.warn("ColladaLoader: Could not find joint '"+r.sid+"'."),r.skinningMatrix=new THREE.Matrix4,r.weights=[]}}}function p(e){var t=[],i=function(e,t,r){var n={};n.name=t.sid,n.parent=e,n.matrix=t.matrix;var o=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];n.matrix.decompose(o[0],o[1],o[2]),n.pos=[o[0].x,o[0].y,o[0].z],n.scl=[o[2].x,o[2].y,o[2].z],n.rotq=[o[1].x,o[1].y,o[1].z,o[1].w],r.push(n);for(var a in t.nodes)i(t.sid,t.nodes[a],r)};return i(-1,e,t),t}function f(e,t,i){var r=[];u(t,r,-1),d(r,i.skin);for(var n=new THREE.Vector3,o=[],a=0;a<e.vertices.length;a++)o.push(new THREE.Vector3);for(a=0;a<r.length;a++)if("JOINT"==r[a].type)for(var s=0;s<r[a].weights.length;s++){var c=r[a].weights[s],h=c.index,l=c.weight,p=e.vertices[h],f=o[h];n.x=p.x,n.y=p.y,n.z=p.z,n.applyMatrix4(r[a].skinningMatrix),f.x+=n.x*l,f.y+=n.y*l,f.z+=n.z*l}for(var a=0;a<e.vertices.length;a++)e.vertices[a]=o[a]}function m(e,t,i){var r=je[t.url];if(i=void 0!==i?i:40,!r||!r.skin)return void console.log("ColladaLoader: Could not find skin controller.");if(!t.skeleton||!t.skeleton.length)return void console.log("ColladaLoader: Could not find the skeleton for the skin. ");for(var n=h(),o=Te.getChildById(t.skeleton[0],!0)||Te.getChildBySid(t.skeleton[0],!0),a=p(o),s=r.skin.joints,c=[],l=0;l<s.length;l++)for(var m=0;m<a.length;m++)a[m].name===s[l]&&(c[l]=a[m]);for(var l=0;l<c.length;l++)for(var m=0;m<c.length;m++)c[l].parent===c[m].name&&(c[l].parent=m);{var l,m,v;new THREE.Vector3}for(l=0;l<e.vertices.length;l++)e.vertices[l].applyMatrix4(r.skin.bindShapeMatrix);for(var g=[],y=[],x=r.skin.weights,l=0;l<x.length;l++){var b=new THREE.Vector4(x[l][0]?x[l][0].joint:0,x[l][1]?x[l][1].joint:0,x[l][2]?x[l][2].joint:0,x[l][3]?x[l][3].joint:0),v=new THREE.Vector4(x[l][0]?x[l][0].weight:0,x[l][1]?x[l][1].weight:0,x[l][2]?x[l][2].weight:0,x[l][3]?x[l][3].weight:0);g.push(b),y.push(v)}e.skinIndices=g,e.skinWeights=y,e.bones=c;for(var w={name:n.ID,fps:30,length:n.frames/30,hierarchy:[]},m=0;m<c.length;m++)w.hierarchy.push({parent:c[m].parent,name:c[m].name,keys:[]});for(console.log("ColladaLoader:",n.ID+" has "+c.length+" bones."),f(e,o,r),i=0;i<n.frames;i++){var M=[];u(o,M,i),d(M,r.skin);for(var l=0;l<M.length;l++)for(var m=0;m<w.hierarchy.length;m++)if(w.hierarchy[m].name===M[l].sid){var _={};_.time=i/30,_.matrix=M[l].animatrix,0===i&&(M[l].matrix=_.matrix);var E=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];_.matrix.decompose(E[0],E[1],E[2]),_.pos=[E[0].x,E[0].y,E[0].z],_.scl=[E[2].x,E[2].y,E[2].z],_.rot=E[1],w.hierarchy[m].keys.push(_)}e.animation=w}}function v(){if(Ce&&0===Ce.joints.length)return void(Re=void 0);var e={},t=function(t,i){var r=i.getAttribute("id"),n=Te.getChildById(r,!0),o=Ce.joints[t];Be.traverse(function(i){i.colladaId==r&&(e[t]={node:i,transforms:n.transforms,joint:o,position:o.zeroPosition})})};Re={joints:Ce&&Ce.joints,getJointValue:function(t){var i=e[t];return i?i.position:void console.log("getJointValue: joint "+t+" doesn't exist")},setJointValue:function(t,i){var n=e[t];if(n){var o=n.joint;if(i>o.limits.max||i<o.limits.min)console.log("setJointValue: joint "+t+" value "+i+" outside of limits (min: "+o.limits.min+", max: "+o.limits.max+")");else if(o["static"])console.log("setJointValue: joint "+t+" is static");else{var a=n.node,s=o.axis,c=n.transforms,h=new THREE.Matrix4;for(r=0;r<c.length;r++){var l=c[r];if(l.sid&&-1!==l.sid.indexOf("joint"+t))switch(o.type){case"revolute":h.multiply(u.makeRotationAxis(s,THREE.Math.degToRad(i)));break;case"prismatic":h.multiply(u.makeTranslation(s.x*i,s.y*i,s.z*i));break;default:console.warn("setJointValue: unknown joint type: "+o.type)}else{var u=new THREE.Matrix4;switch(l.type){case"matrix":h.multiply(l.obj);break;case"translate":h.multiply(u.makeTranslation(l.obj.x,l.obj.y,l.obj.z));break;case"rotate":h.multiply(u.makeRotationAxis(l.obj,l.angle))}}}var d=h.elements,p=Array.prototype.slice.call(d),f=[p[0],p[4],p[8],p[12],p[1],p[5],p[9],p[13],p[2],p[6],p[10],p[14],p[3],p[7],p[11],p[15]];a.matrix.set.apply(a.matrix,f),a.matrix.decompose(a.position,a.quaternion,a.scale)}}else console.log("setJointValue: joint "+t+" doesn't exist")}};var i=Ne.querySelector("scene instance_kinematics_scene");if(i)for(var r=0;r<i.childNodes.length;r++){var n=i.childNodes[r];if(1==n.nodeType)switch(n.nodeName){case"bind_joint_axis":var o=n.getAttribute("target").split("/").pop(),a=n.querySelector("axis param").textContent,s=parseInt(a.split("joint").pop().split(".")[0]),c=Ne.querySelector('[sid="'+o+'"]');if(c){var h=c.parentElement;t(s,h)}}}}function g(e){var t,i,r,n,o=new THREE.Object3D,a=!1;for(r=0;r<e.controllers.length;r++){var s=je[e.controllers[r].url];switch(s.type){case"skin":if(Ge[s.skin.source]){var c=new k;c.url=s.skin.source,c.instance_material=e.controllers[r].instance_material,e.geometries.push(c),a=!0,t=e.controllers[r]}else if(je[s.skin.source]){var h=je[s.skin.source];if(i=h,h.morph&&Ge[h.morph.source]){var c=new k;c.url=h.morph.source,c.instance_material=e.controllers[r].instance_material,
e.geometries.push(c)}}break;case"morph":if(Ge[s.morph.source]){var c=new k;c.url=s.morph.source,c.instance_material=e.controllers[r].instance_material,e.geometries.push(c),i=e.controllers[r]}console.log("ColladaLoader: Morph-controller partially supported.")}}var u={};for(r=0;r<e.geometries.length;r++){var d,p=e.geometries[r],f=p.instance_material,v=Ge[p.url],y={},x=[],b=0;if(v){if(!v.mesh||!v.mesh.primitives)continue;if(0===o.name.length&&(o.name=v.id),f)for(n=0;n<f.length;n++){var w=f[n],M=He[w.target],_=M.instance_effect.url,E=We[_].shader,A=E.material;if(v.doubleSided){if(!(w.symbol in u)){var S=A.clone();S.side=THREE.DoubleSide,u[w.symbol]=S}A=u[w.symbol]}A.opacity=A.opacity?A.opacity:1,y[w.symbol]=b,x.push(A),d=A,d.name=null===M.name||""===M.name?M.id:M.name,b++}var T,C=d||new THREE.MeshLambertMaterial({color:14540253,side:v.doubleSided?THREE.DoubleSide:THREE.FrontSide}),L=v.mesh.geometry3js;b>1&&(C=new THREE.MultiMaterial(x)),void 0!==t?(m(L,t),L.morphTargets.length>0?(C.morphTargets=!0,C.skinning=!1):(C.morphTargets=!1,C.skinning=!0),T=new THREE.SkinnedMesh(L,C,!1),T.name="skin_"+ke.length,ke.push(T)):void 0!==i?(l(L,i),C.morphTargets=!0,T=new THREE.Mesh(L,C),T.name="morph_"+Ie.length,Ie.push(T)):T=L.isLineStrip===!0?new THREE.Line(L):new THREE.Mesh(L,C),o.add(T)}}for(r=0;r<e.cameras.length;r++){var R=e.cameras[r],P=qe[R.url],D=new THREE.PerspectiveCamera(P.yfov,parseFloat(P.aspect_ratio),parseFloat(P.znear),parseFloat(P.zfar));o.add(D)}for(r=0;r<e.lights.length;r++){var O=null,I=e.lights[r],N=Xe[I.url];if(N&&N.technique){var B=N.color.getHex(),F=N.intensity,V=N.distance,U=N.falloff_angle;switch(N.technique){case"directional":O=new THREE.DirectionalLight(B,F,V),O.position.set(0,0,1);break;case"point":O=new THREE.PointLight(B,F,V);break;case"spot":O=new THREE.SpotLight(B,F,V,U),O.position.set(0,0,1);break;case"ambient":O=new THREE.AmbientLight(B)}}O&&o.add(O)}if(o.name=e.name||e.id||"",o.colladaId=e.id||"",o.layer=e.layer||"",o.matrix=e.matrix,o.matrix.decompose(o.position,o.quaternion,o.scale),Qe.centerGeometry&&o.geometry){var z=o.geometry.center();z.multiply(o.scale),z.applyQuaternion(o.quaternion),o.position.sub(z)}for(r=0;r<e.nodes.length;r++)o.add(g(e.nodes[r],e));return o}function y(e){for(var t=Ne.querySelectorAll("library_nodes node"),i=0;i<t.length;i++){var r=t[i].attributes.getNamedItem("id");if(r&&r.value===e)return t[i]}return void 0}function x(e){var t=[],i=1e6,r=-1e6;for(var n in ze)for(var o=ze[n],a=0;a<o.channel.length;a++){var s=o.channel[a],c=o.sampler[a],n=s.target.split("/")[0];n==e.id&&(c.create(),s.sampler=c,i=Math.min(i,c.startTime),r=Math.max(r,c.endTime),t.push(s))}return t.length&&(e.startTime=i,e.endTime=r),t}function b(e){if(e.channels&&e.channels.length){for(var t=[],i=[],r=0,n=e.channels.length;n>r;r++){var o,a=e.channels[r],s=a.fullSid,c=a.sampler,h=c.input,l=e.getTransformBySid(a.sid);if(a.arrIndices){o=[];for(var u=0,d=a.arrIndices.length;d>u;u++)o[u]=Ae(a.arrIndices[u])}else o=Se(a.member);if(l){-1===i.indexOf(s)&&i.push(s);for(var u=0,d=h.length;d>u;u++){var p=h[u],f=c.getData(l.type,u,o),m=w(t,p);if(!m){m=new ie(p);var v=M(t,p);t.splice(-1===v?t.length:v,0,m)}m.addTarget(s,l,o,f)}}else console.log('Could not find transform "'+a.sid+'" in node '+e.id)}for(var r=0;r<i.length;r++)for(var g=i[r],u=0;u<t.length;u++){var m=t[u];m.hasTarget(g)||_(t,m,u,g)}e.keys=t,e.sids=i}}function w(e,t){for(var i=null,r=0,n=e.length;n>r&&null===i;r++){var o=e[r];if(o.time===t)i=o;else if(o.time>t)break}return i}function M(e,t){for(var i=-1,r=0,n=e.length;n>r&&-1===i;r++){var o=e[r];o.time>=t&&(i=r)}return i}function _(e,t,i,r){var n=A(e,r,i?i-1:0),o=E(e,r,i+1);if(n&&o){var a,s=(t.time-n.time)/(o.time-n.time),c=n.getTarget(r),h=o.getTarget(r).data,l=c.data;if("matrix"===c.type)a=l;else if(l.length){a=[];for(var u=0;u<l.length;++u)a[u]=l[u]+(h[u]-l[u])*s}else a=l+(h-l)*s;t.addTarget(r,c.transform,c.member,a)}}function E(e,t,i){for(;i<e.length;i++){var r=e[i];if(r.hasTarget(t))return r}return null}function A(e,t,i){for(i=i>=0?i:i+e.length;i>=0;i--){var r=e[i];if(r.hasTarget(t))return r}return null}function S(){this.id="",this.init_from=""}function T(){this.id="",this.name="",this.type="",this.skin=null,this.morph=null}function C(){this.method=null,this.source=null,this.targets=null,this.weights=null}function L(){this.source="",this.bindShapeMatrix=null,this.invBindMatrices=[],this.joints=[],this.weights=[]}function R(){this.id="",this.name="",this.nodes=[],this.scene=new THREE.Group}function P(){this.id="",this.name="",this.sid="",this.nodes=[],this.controllers=[],this.transforms=[],this.geometries=[],this.channels=[],this.matrix=new THREE.Matrix4}function D(){this.sid="",this.type="",this.data=[],this.obj=null}function O(){this.url="",this.skeleton=[],this.instance_material=[]}function I(){this.symbol="",this.target=""}function k(){this.url="",this.instance_material=[]}function N(){this.id="",this.mesh=null}function B(e){this.geometry=e.id,this.primitives=[],this.vertices=null,this.geometry3js=null}function F(){this.material="",this.count=0,this.inputs=[],this.vcount=null,this.p=[],this.geometry=new THREE.Geometry}function V(){F.call(this),this.vcount=[]}function U(){F.call(this),this.vcount=1}function z(){F.call(this),this.vcount=3}function j(){this.source="",this.count=0,this.stride=0,this.params=[]}function G(){this.input={}}function H(){this.semantic="",this.offset=0,this.source="",this.set=0}function W(e){this.id=e,this.type=null}function q(){this.id="",this.name="",this.instance_effect=null}function X(){this.color=new THREE.Color,this.color.setRGB(Math.random(),Math.random(),Math.random()),this.color.a=1,this.texture=null,this.texcoord=null,this.texOpts=null}function Y(e,t){this.type=e,this.effect=t,this.material=null}function Q(e){this.effect=e,this.init_from=null,this.format=null}function K(e){this.effect=e,this.source=null,this.wrap_s=null,this.wrap_t=null,this.minfilter=null,this.magfilter=null,this.mipfilter=null}function Z(){this.id="",this.name="",this.shader=null,this.surface={},this.sampler={}}function J(){this.url=""}function $(){this.id="",this.name="",this.source={},this.sampler=[],this.channel=[]}function ee(e){this.animation=e,this.source="",this.target="",this.fullSid=null,this.sid=null,this.dotSyntax=null,this.arrSyntax=null,this.arrIndices=null,this.member=null}function te(e){this.id="",this.animation=e,this.inputs=[],this.input=null,this.output=null,this.strideOut=null,this.interpolation=null,this.startTime=null,this.endTime=null,this.duration=0}function ie(e){this.targets=[],this.time=e}function re(){this.id="",this.name="",this.technique=""}function ne(){this.url=""}function oe(){this.id="",this.name="",this.technique=""}function ae(){this.url=""}function se(){this.id="",this.name="",this.joints=[],this.links=[]}function ce(){this.sid="",this.name="",this.axis=new THREE.Vector3,this.limits={min:0,max:0},this.type="",this["static"]=!1,this.zeroPosition=0,this.middlePosition=0}function he(){this.sid="",this.name="",this.transforms=[],this.attachments=[]}function le(){this.joint="",this.transforms=[],this.links=[]}function ue(e){var t=e.getAttribute("id");return void 0!=Ve[t]?Ve[t]:(Ve[t]=new W(t).parse(e),Ve[t])}function de(e){for(var t=me(e),i=[],r=0,n=t.length;n>r;r++)i.push("true"===t[r]||"1"===t[r]?!0:!1);return i}function pe(e){for(var t=me(e),i=[],r=0,n=t.length;n>r;r++)i.push(parseFloat(t[r]));return i}function fe(e){for(var t=me(e),i=[],r=0,n=t.length;n>r;r++)i.push(parseInt(t[r],10));return i}function me(e){return e.length>0?ve(e).split(/\s+/):[]}function ve(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function ge(e,t,i){return e.hasAttribute(t)?parseInt(e.getAttribute(t),10):i}function ye(e,t){var i=new THREE.ImageLoader;i.load(t,function(t){e.image=t,e.needsUpdate=!0})}function xe(e,t){e.doubleSided=!1;var i=t.querySelectorAll("extra double_sided")[0];i&&i&&1===parseInt(i.textContent,10)&&(e.doubleSided=!0)}function be(){if(Qe.convertUpAxis!==!0||Ze===Qe.upAxis)Je=null;else switch(Ze){case"X":Je="Y"===Qe.upAxis?"XtoY":"XtoZ";break;case"Y":Je="X"===Qe.upAxis?"YtoX":"YtoZ";break;case"Z":Je="X"===Qe.upAxis?"ZtoX":"ZtoY"}}function we(e,t){if(Qe.convertUpAxis===!0&&Ze!==Qe.upAxis)switch(Je){case"XtoY":var i=e[0];e[0]=t*e[1],e[1]=i;break;case"XtoZ":var i=e[2];e[2]=e[1],e[1]=e[0],e[0]=i;break;case"YtoX":var i=e[0];e[0]=e[1],e[1]=t*i;break;case"YtoZ":var i=e[1];e[1]=t*e[2],e[2]=i;break;case"ZtoX":var i=e[0];e[0]=e[1],e[1]=e[2],e[2]=i;break;case"ZtoY":var i=e[1];e[1]=e[2],e[2]=t*i}}function Me(e,t){if(Qe.convertUpAxis!==!0||Ze===Qe.upAxis)return t;switch(e){case"X":t="XtoY"===Je?-1*t:t;break;case"Y":t="YtoZ"===Je||"YtoX"===Je?-1*t:t;break;case"Z":t="ZtoY"===Je?-1*t:t}return t}function _e(e,t){var i=[e[t],e[t+1],e[t+2]];return we(i,-1),new THREE.Vector3(i[0],i[1],i[2])}function Ee(e){if(Qe.convertUpAxis){var t=[e[0],e[4],e[8]];we(t,-1),e[0]=t[0],e[4]=t[1],e[8]=t[2],t=[e[1],e[5],e[9]],we(t,-1),e[1]=t[0],e[5]=t[1],e[9]=t[2],t=[e[2],e[6],e[10]],we(t,-1),e[2]=t[0],e[6]=t[1],e[10]=t[2],t=[e[0],e[1],e[2]],we(t,-1),e[0]=t[0],e[1]=t[1],e[2]=t[2],t=[e[4],e[5],e[6]],we(t,-1),e[4]=t[0],e[5]=t[1],e[6]=t[2],t=[e[8],e[9],e[10]],we(t,-1),e[8]=t[0],e[9]=t[1],e[10]=t[2],t=[e[3],e[7],e[11]],we(t,-1),e[3]=t[0],e[7]=t[1],e[11]=t[2]}return(new THREE.Matrix4).set(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])}function Ae(e){if(e>-1&&3>e){var t=["X","Y","Z"],i={X:0,Y:1,Z:2};e=Se(t[e]),e=i[e]}return e}function Se(e){if(Qe.convertUpAxis)switch(e){case"X":switch(Je){case"XtoY":case"XtoZ":case"YtoX":e="Y";break;case"ZtoX":e="Z"}break;case"Y":switch(Je){case"XtoY":case"YtoX":case"ZtoX":e="X";break;case"XtoZ":case"YtoZ":case"ZtoY":e="Z"}break;case"Z":switch(Je){case"XtoZ":e="X";break;case"YtoZ":case"ZtoX":case"ZtoY":e="Y"}}return e}var Te,Ce,Le,Re,Pe,De,Oe,Ie,ke,Ne=null,Be=null,Fe=null,Ve={},Ue={},ze={},je={},Ge={},He={},We={},qe={},Xe={},Ye=THREE.SmoothShading,Qe={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y",defaultEnvMap:null},Ke=1,Ze="Y",Je=null;return S.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];"init_from"===i.nodeName&&(this.init_from=i.textContent)}return this},T.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.type="none";for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"skin":this.skin=(new L).parse(i),this.type=i.nodeName;break;case"morph":this.morph=(new C).parse(i),this.type=i.nodeName}}return this},C.prototype.parse=function(e){var t,i={},r=[];for(this.method=e.getAttribute("method"),this.source=e.getAttribute("source").replace(/^#/,""),t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(1==n.nodeType)switch(n.nodeName){case"source":var o=(new W).parse(n);i[o.id]=o;break;case"targets":r=this.parseInputs(n);break;default:console.log(n.nodeName)}}for(t=0;t<r.length;t++){var a=r[t],o=i[a.source];switch(a.semantic){case"MORPH_TARGET":this.targets=o.read();break;case"MORPH_WEIGHT":this.weights=o.read()}}return this},C.prototype.parseInputs=function(e){for(var t=[],i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];if(1==r.nodeType)switch(r.nodeName){case"input":t.push((new H).parse(r))}}return t},L.prototype.parse=function(e){var t,i,r={};this.source=e.getAttribute("source").replace(/^#/,""),this.invBindMatrices=[],this.joints=[],this.weights=[];for(var n=0;n<e.childNodes.length;n++){var o=e.childNodes[n];if(1==o.nodeType)switch(o.nodeName){case"bind_shape_matrix":var a=pe(o.textContent);this.bindShapeMatrix=Ee(a);break;case"source":var s=(new W).parse(o);r[s.id]=s;break;case"joints":t=o;break;case"vertex_weights":i=o;break;default:console.log(o.nodeName)}}return this.parseJoints(t,r),this.parseWeights(i,r),this},L.prototype.parseJoints=function(e,t){for(var i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];if(1==r.nodeType)switch(r.nodeName){case"input":var n=(new H).parse(r),o=t[n.source];"JOINT"===n.semantic?this.joints=o.read():"INV_BIND_MATRIX"===n.semantic&&(this.invBindMatrices=o.read())}}},L.prototype.parseWeights=function(e,t){for(var i,r,n=[],o=0;o<e.childNodes.length;o++){var a=e.childNodes[o];if(1==a.nodeType)switch(a.nodeName){case"input":n.push((new H).parse(a));break;case"v":i=fe(a.textContent);break;case"vcount":r=fe(a.textContent)}}for(var s=0,o=0;o<r.length;o++){for(var c=r[o],h=[],l=0;c>l;l++){for(var u={},d=0;d<n.length;d++){var p=n[d],f=i[s+p.offset];switch(p.semantic){case"JOINT":u.joint=f;break;case"WEIGHT":u.weight=t[p.source].data[f]}}h.push(u),s+=n.length}for(var l=0;l<h.length;l++)h[l].index=o;this.weights.push(h)}},R.prototype.getChildById=function(e,t){for(var i=0;i<this.nodes.length;i++){var r=this.nodes[i].getChildById(e,t);if(r)return r}return null},R.prototype.getChildBySid=function(e,t){for(var i=0;i<this.nodes.length;i++){var r=this.nodes[i].getChildBySid(e,t);if(r)return r}return null},R.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.nodes=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"node":this.nodes.push((new P).parse(i))}}return this},P.prototype.getChannelForTransform=function(e){for(var t=0;t<this.channels.length;t++){var i,r,n=this.channels[t],o=n.target.split("/"),a=(o.shift(),o.shift()),s=a.indexOf(".")>=0,c=a.indexOf("(")>=0;if(s)o=a.split("."),a=o.shift(),r=o.shift();else if(c){i=a.split("("),a=i.shift();for(var h=0;h<i.length;h++)i[h]=parseInt(i[h].replace(/\)/,""))}if(a===e)return n.info={sid:a,dotSyntax:s,arrSyntax:c,arrIndices:i},n}return null},P.prototype.getChildById=function(e,t){if(this.id===e)return this;if(t)for(var i=0;i<this.nodes.length;i++){var r=this.nodes[i].getChildById(e,t);if(r)return r}return null},P.prototype.getChildBySid=function(e,t){if(this.sid===e)return this;if(t)for(var i=0;i<this.nodes.length;i++){var r=this.nodes[i].getChildBySid(e,t);if(r)return r}return null},P.prototype.getTransformBySid=function(e){for(var t=0;t<this.transforms.length;t++)if(this.transforms[t].sid===e)return this.transforms[t];return null},P.prototype.parse=function(e){var t;this.id=e.getAttribute("id"),this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.type=e.getAttribute("type"),this.layer=e.getAttribute("layer"),this.type="JOINT"===this.type?this.type:"NODE",this.nodes=[],this.transforms=[],this.geometries=[],this.cameras=[],this.lights=[],this.controllers=[],this.matrix=new THREE.Matrix4;for(var i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];if(1==r.nodeType)switch(r.nodeName){case"node":this.nodes.push((new P).parse(r));break;case"instance_camera":this.cameras.push((new ne).parse(r));break;case"instance_controller":this.controllers.push((new O).parse(r));break;case"instance_geometry":this.geometries.push((new k).parse(r));break;case"instance_light":this.lights.push((new ae).parse(r));break;case"instance_node":t=r.getAttribute("url").replace(/^#/,"");var n=y(t);n&&this.nodes.push((new P).parse(n));break;case"rotate":case"translate":case"scale":case"matrix":case"lookat":case"skew":this.transforms.push((new D).parse(r));break;case"extra":break;default:console.log(r.nodeName)}}return this.channels=x(this),b(this),this.updateMatrix(),this},P.prototype.updateMatrix=function(){this.matrix.identity();for(var e=0;e<this.transforms.length;e++)this.transforms[e].apply(this.matrix)},D.prototype.parse=function(e){return this.sid=e.getAttribute("sid"),this.type=e.nodeName,this.data=pe(e.textContent),this.convert(),this},D.prototype.convert=function(){switch(this.type){case"matrix":this.obj=Ee(this.data);break;case"rotate":this.angle=THREE.Math.degToRad(this.data[3]);case"translate":we(this.data,-1),this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case"scale":we(this.data,1),this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}},D.prototype.apply=function(){var e=new THREE.Matrix4;return function(t){switch(this.type){case"matrix":t.multiply(this.obj);break;case"translate":t.multiply(e.makeTranslation(this.obj.x,this.obj.y,this.obj.z));break;case"rotate":t.multiply(e.makeRotationAxis(this.obj,this.angle));break;case"scale":t.scale(this.obj)}}}(),D.prototype.update=function(e,t){var i=["X","Y","Z","ANGLE"];switch(this.type){case"matrix":if(t)if(1===t.length)switch(t[0]){case 0:this.obj.n11=e[0],this.obj.n21=e[1],this.obj.n31=e[2],this.obj.n41=e[3];break;case 1:this.obj.n12=e[0],this.obj.n22=e[1],this.obj.n32=e[2],this.obj.n42=e[3];break;case 2:this.obj.n13=e[0],this.obj.n23=e[1],this.obj.n33=e[2],this.obj.n43=e[3];break;case 3:this.obj.n14=e[0],this.obj.n24=e[1],this.obj.n34=e[2],this.obj.n44=e[3]}else if(2===t.length){var r="n"+(t[0]+1)+(t[1]+1);this.obj[r]=e}else console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(e);break;case"translate":case"scale":switch("[object Array]"===Object.prototype.toString.call(t)&&(t=i[t[0]]),t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;default:this.obj.x=e[0],this.obj.y=e[1],this.obj.z=e[2]}break;case"rotate":switch("[object Array]"===Object.prototype.toString.call(t)&&(t=i[t[0]]),t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;case"ANGLE":this.angle=THREE.Math.degToRad(e);break;default:this.obj.x=e[0],this.obj.y=e[1],this.obj.z=e[2],this.angle=THREE.Math.degToRad(e[3])}}},O.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,""),this.skeleton=[],this.instance_material=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1===i.nodeType)switch(i.nodeName){case"skeleton":this.skeleton.push(i.textContent.replace(/^#/,""));break;case"bind_material":for(var r=i.querySelectorAll("instance_material"),n=0;n<r.length;n++){var o=r[n];this.instance_material.push((new I).parse(o))}break;case"extra":}}return this},I.prototype.parse=function(e){return this.symbol=e.getAttribute("symbol"),this.target=e.getAttribute("target").replace(/^#/,""),this},k.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,""),this.instance_material=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType&&"bind_material"===i.nodeName){for(var r=i.querySelectorAll("instance_material"),n=0;n<r.length;n++){var o=r[n];this.instance_material.push((new I).parse(o))}break}}return this},N.prototype.parse=function(e){this.id=e.getAttribute("id"),xe(this,e);for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"mesh":this.mesh=new B(this).parse(i);break;case"extra":}}return this},B.prototype.parse=function(e){this.primitives=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"source":ue(i);break;case"vertices":this.vertices=(new G).parse(i);break;case"linestrips":this.primitives.push((new U).parse(i));break;case"triangles":this.primitives.push((new z).parse(i));break;case"polygons":this.primitives.push((new F).parse(i));break;case"polylist":this.primitives.push((new V).parse(i))}}if(this.geometry3js=new THREE.Geometry,null===this.vertices)return this;for(var r=Ve[this.vertices.input.POSITION.source].data,t=0;t<r.length;t+=3)this.geometry3js.vertices.push(_e(r,t).clone());for(var t=0;t<this.primitives.length;t++){var n=this.primitives[t];n.setVertices(this.vertices),this.handlePrimitive(n,this.geometry3js)}return this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals),this},B.prototype.handlePrimitive=function(e,t){if(e instanceof U)return void(t.isLineStrip=!0);var i,r,n,o,a,s,c,h=e.p,l=e.inputs,u=0,d=3,p=0,f=[];for(i=0;i<l.length;i++){n=l[i];var m=n.offset+1;switch(p=m>p?m:p,n.semantic){case"TEXCOORD":f.push(n.set)}}for(var v=0;v<h.length;++v)for(var g=h[v],y=0;y<g.length;){var x=[],b=[],w=null,M=[];for(d=e.vcount?e.vcount.length?e.vcount[u++]:e.vcount:g.length/p,i=0;d>i;i++)for(r=0;r<l.length;r++)switch(n=l[r],s=Ve[n.source],o=g[y+i*p+n.offset],c=s.accessor.params.length,a=o*c,n.semantic){case"VERTEX":x.push(o);break;case"NORMAL":b.push(_e(s.data,a));break;case"TEXCOORD":w=w||{},void 0===w[n.set]&&(w[n.set]=[]),w[n.set].push(new THREE.Vector2(s.data[a],s.data[a+1]));break;case"COLOR":M.push((new THREE.Color).setRGB(s.data[a],s.data[a+1],s.data[a+2]))}if(0===b.length)if(n=this.vertices.input.NORMAL){s=Ve[n.source],c=s.accessor.params.length;for(var _=0,E=x.length;E>_;_++)b.push(_e(s.data,x[_]*c))}else t.calcNormals=!0;if(!w&&(w={},n=this.vertices.input.TEXCOORD)){f.push(n.set),s=Ve[n.source],c=s.accessor.params.length;for(var _=0,E=x.length;E>_;_++)a=x[_]*c,void 0===w[n.set]&&(w[n.set]=[]),w[n.set].push(new THREE.Vector2(s.data[a],1-s.data[a+1]))}if(0===M.length&&(n=this.vertices.input.COLOR)){s=Ve[n.source],c=s.accessor.params.length;for(var _=0,E=x.length;E>_;_++)a=x[_]*c,M.push((new THREE.Color).setRGB(s.data[a],s.data[a+1],s.data[a+2]))}var A,S,T=null,C=[];if(3===d)C.push(new THREE.Face3(x[0],x[1],x[2],b,M.length?M:new THREE.Color));else if(4===d)C.push(new THREE.Face3(x[0],x[1],x[3],b.length?[b[0].clone(),b[1].clone(),b[3].clone()]:[],M.length?[M[0],M[1],M[3]]:new THREE.Color)),C.push(new THREE.Face3(x[1],x[2],x[3],b.length?[b[1].clone(),b[2].clone(),b[3].clone()]:[],M.length?[M[1],M[2],M[3]]:new THREE.Color));else if(d>4&&Qe.subdivideFaces){var L=M.length?M:new THREE.Color;for(r=1;d-1>r;)C.push(new THREE.Face3(x[0],x[r],x[r+1],b.length?[b[0].clone(),b[r++].clone(),b[r].clone()]:[],L))}if(C.length)for(var _=0,E=C.length;E>_;_++)for(T=C[_],T.daeMaterial=e.material,t.faces.push(T),r=0;r<f.length;r++)A=w[f[r]],S=d>4?[A[0],A[_+1],A[_+2]]:4===d?0===_?[A[0],A[1],A[3]]:[A[1].clone(),A[2],A[3].clone()]:[A[0],A[1],A[2]],void 0===t.faceVertexUvs[r]&&(t.faceVertexUvs[r]=[]),t.faceVertexUvs[r].push(S);else console.log("dropped face with vcount "+d+" for geometry with id: "+t.id);y+=p*d}},F.prototype.setVertices=function(e){for(var t=0;t<this.inputs.length;t++)this.inputs[t].source===e.id&&(this.inputs[t].source=e.input.POSITION.source)},F.prototype.parse=function(e){this.material=e.getAttribute("material"),this.count=ge(e,"count",0);for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"input":this.inputs.push((new H).parse(e.childNodes[t]));break;case"vcount":this.vcount=fe(i.textContent);break;case"p":this.p.push(fe(i.textContent));break;case"ph":console.warn("polygon holes not yet supported!")}}return this},V.prototype=Object.create(F.prototype),V.prototype.constructor=V,U.prototype=Object.create(F.prototype),U.prototype.constructor=U,z.prototype=Object.create(F.prototype),z.prototype.constructor=z,j.prototype.parse=function(e){this.params=[],this.source=e.getAttribute("source"),this.count=ge(e,"count",0),this.stride=ge(e,"stride",0);for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if("param"===i.nodeName){var r={};r.name=i.getAttribute("name"),r.type=i.getAttribute("type"),this.params.push(r)}}return this},G.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++)if("input"===e.childNodes[t].nodeName){var i=(new H).parse(e.childNodes[t]);this.input[i.semantic]=i}return this},H.prototype.parse=function(e){return this.semantic=e.getAttribute("semantic"),this.source=e.getAttribute("source").replace(/^#/,""),this.set=ge(e,"set",-1),this.offset=ge(e,"offset",0),"TEXCOORD"===this.semantic&&this.set<0&&(this.set=0),this},W.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"bool_array":this.data=de(i.textContent),this.type=i.nodeName;break;case"float_array":this.data=pe(i.textContent),this.type=i.nodeName;break;case"int_array":this.data=fe(i.textContent),this.type=i.nodeName;break;case"IDREF_array":case"Name_array":this.data=me(i.textContent),this.type=i.nodeName;break;case"technique_common":for(var r=0;r<i.childNodes.length;r++)if("accessor"===i.childNodes[r].nodeName){this.accessor=(new j).parse(i.childNodes[r]);break}}}return this},W.prototype.read=function(){var e=[],t=this.accessor.params[0];switch(t.type){case"IDREF":case"Name":case"name":case"float":return this.data;case"float4x4":for(var i=0;i<this.data.length;i+=16){var r=this.data.slice(i,i+16),n=Ee(r);e.push(n)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+t.type+".")}return e},q.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++)if("instance_effect"===e.childNodes[t].nodeName){this.instance_effect=(new J).parse(e.childNodes[t]);break}return this},X.prototype.isColor=function(){return null===this.texture},X.prototype.isTexture=function(){return null!=this.texture},X.prototype.parse=function(e){"transparent"===e.nodeName&&(this.opaque=e.getAttribute("opaque"));for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"color":var r=pe(i.textContent);this.color=new THREE.Color,this.color.setRGB(r[0],r[1],r[2]),this.color.a=r[3];break;case"texture":this.texture=i.getAttribute("texture"),this.texcoord=i.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(i)}}return this},X.prototype.parseTexture=function(e){if(!e.childNodes)return this;e.childNodes[1]&&"extra"===e.childNodes[1].nodeName&&(e=e.childNodes[1],e.childNodes[1]&&"technique"===e.childNodes[1].nodeName&&(e=e.childNodes[1]));for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"offsetU":case"offsetV":case"repeatU":case"repeatV":this.texOpts[i.nodeName]=parseFloat(i.textContent);break;case"wrapU":case"wrapV":this.texOpts[i.nodeName]="TRUE"===i.textContent.toUpperCase()?1:parseInt(i.textContent);break;default:this.texOpts[i.nodeName]=i.textContent}}return this},Y.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"emission":case"diffuse":case"specular":case"transparent":this[i.nodeName]=(new X).parse(i);break;case"bump":var r=i.getAttribute("bumptype");r?"heightfield"===r.toLowerCase()?this.bump=(new X).parse(i):"normalmap"===r.toLowerCase()?this.normal=(new X).parse(i):(console.error("Shader.prototype.parse: Invalid value for attribute 'bumptype' ("+r+") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'"),this.bump=(new X).parse(i)):(console.warn("Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'"),this.bump=(new X).parse(i));break;case"shininess":case"reflectivity":case"index_of_refraction":case"transparency":var n=i.querySelectorAll("float");n.length>0&&(this[i.nodeName]=parseFloat(n[0].textContent))}}return this.create(),this},Y.prototype.create=function(){var e={},t=!1;if(void 0!==this.transparency&&void 0!==this.transparent){var i=(this.transparent,(this.transparent.color.r+this.transparent.color.g+this.transparent.color.b)/3*this.transparency);i>0&&(t=!0,e.transparent=!0,e.opacity=1-i)}var r={diffuse:"map",ambient:"lightMap",specular:"specularMap",emission:"emissionMap",bump:"bumpMap",normal:"normalMap"};for(var n in this)switch(n){case"ambient":case"emission":case"diffuse":case"specular":case"bump":case"normal":var o=this[n];if(o instanceof X)if(o.isTexture()){var a=o.texture,s=this.effect.sampler[a];if(void 0!==s&&void 0!==s.source){var c=this.effect.surface[s.source];if(void 0!==c){var h=Ue[c.init_from];if(h){var l,u=Oe+h.init_from,d=THREE.Loader.Handlers.get(u);null!==d?l=d.load(u):(l=new THREE.Texture,ye(l,u)),l.wrapS=o.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,l.wrapT=o.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,l.offset.x=o.texOpts.offsetU,l.offset.y=o.texOpts.offsetV,l.repeat.x=o.texOpts.repeatU,l.repeat.y=o.texOpts.repeatV,e[r[n]]=l,"emission"===n&&(e.emissive=16777215)}}}}else"diffuse"!==n&&t||("emission"===n?e.emissive=o.color.getHex():e[n]=o.color.getHex());break;case"shininess":e[n]=this[n];break;case"reflectivity":e[n]=this[n],e[n]>0&&(e.envMap=Qe.defaultEnvMap),e.combine=THREE.MixOperation;break;case"index_of_refraction":e.refractionRatio=this[n],1!==this[n]&&(e.envMap=Qe.defaultEnvMap);break;case"transparency":}switch(e.shading=Ye,e.side=this.effect.doubleSided?THREE.DoubleSide:THREE.FrontSide,void 0!==e.diffuse&&(e.color=e.diffuse,delete e.diffuse),this.type){case"constant":void 0!=e.emissive&&(e.color=e.emissive),this.material=new THREE.MeshBasicMaterial(e);break;case"phong":case"blinn":this.material=new THREE.MeshPhongMaterial(e);break;case"lambert":default:this.material=new THREE.MeshLambertMaterial(e)}return this.material},Q.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"init_from":this.init_from=i.textContent;break;case"format":this.format=i.textContent;break;default:console.log("unhandled Surface prop: "+i.nodeName)}}return this},K.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"source":this.source=i.textContent;break;case"minfilter":this.minfilter=i.textContent;break;case"magfilter":this.magfilter=i.textContent;break;case"mipfilter":this.mipfilter=i.textContent;break;case"wrap_s":this.wrap_s=i.textContent;break;case"wrap_t":this.wrap_t=i.textContent;break;default:console.log("unhandled Sampler2D prop: "+i.nodeName)}}return this},Z.prototype.create=function(){return null===this.shader?null:void 0},Z.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),xe(this,e),this.shader=null;for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(i))}}return this},Z.prototype.parseNewparam=function(e){for(var t=e.getAttribute("sid"),i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];if(1==r.nodeType)switch(r.nodeName){case"surface":this.surface[t]=new Q(this).parse(r);break;case"sampler2D":this.sampler[t]=new K(this).parse(r);break;case"extra":break;default:console.log(r.nodeName)}}},Z.prototype.parseProfileCOMMON=function(e){for(var t,i=0;i<e.childNodes.length;i++){var r=e.childNodes[i];if(1==r.nodeType)switch(r.nodeName){case"profile_COMMON":this.parseProfileCOMMON(r);break;case"technique":t=r;break;case"newparam":this.parseNewparam(r);break;case"image":var n=(new S).parse(r);Ue[n.id]=n;break;case"extra":break;default:console.log(r.nodeName)}}return t},Z.prototype.parseTechnique=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"constant":case"lambert":case"blinn":case"phong":this.shader=new Y(i.nodeName,this).parse(i);break;case"extra":this.parseExtra(i)}}},Z.prototype.parseExtra=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"technique":this.parseExtraTechnique(i)}}},Z.prototype.parseExtraTechnique=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"bump":this.shader.parse(e)}}},J.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},$.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.source={};for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"animation":var r=(new $).parse(i);for(var n in r.source)this.source[n]=r.source[n];for(var o=0;o<r.channel.length;o++)this.channel.push(r.channel[o]),this.sampler.push(r.sampler[o]);break;case"source":var n=(new W).parse(i);this.source[n.id]=n;break;case"sampler":this.sampler.push(new te(this).parse(i));break;case"channel":this.channel.push(new ee(this).parse(i))}}return this},ee.prototype.parse=function(e){this.source=e.getAttribute("source").replace(/^#/,""),this.target=e.getAttribute("target");
var t=this.target.split("/"),i=(t.shift(),t.shift()),r=i.indexOf(".")>=0,n=i.indexOf("(")>=0;if(r)t=i.split("."),this.sid=t.shift(),this.member=t.shift();else if(n){var o=i.split("(");this.sid=o.shift();for(var a=0;a<o.length;a++)o[a]=parseInt(o[a].replace(/\)/,""));this.arrIndices=o}else this.sid=i;return this.fullSid=i,this.dotSyntax=r,this.arrSyntax=n,this},te.prototype.parse=function(e){this.id=e.getAttribute("id"),this.inputs=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"input":this.inputs.push((new H).parse(i))}}return this},te.prototype.create=function(){for(var e=0;e<this.inputs.length;e++){var t=this.inputs[e],i=this.animation.source[t.source];switch(t.semantic){case"INPUT":this.input=i.read();break;case"OUTPUT":this.output=i.read(),this.strideOut=i.accessor.stride;break;case"INTERPOLATION":this.interpolation=i.read();break;case"IN_TANGENT":break;case"OUT_TANGENT":break;default:console.log(t.semantic)}}if(this.startTime=0,this.endTime=0,this.duration=0,this.input.length){this.startTime=1e8,this.endTime=-1e8;for(var e=0;e<this.input.length;e++)this.startTime=Math.min(this.startTime,this.input[e]),this.endTime=Math.max(this.endTime,this.input[e]);this.duration=this.endTime-this.startTime}},te.prototype.getData=function(e,t,i){var r;if("matrix"===e&&16===this.strideOut)r=this.output[t];else if(this.strideOut>1){r=[],t*=this.strideOut;for(var n=0;n<this.strideOut;++n)r[n]=this.output[t+n];if(3===this.strideOut)switch(e){case"rotate":case"translate":we(r,-1);break;case"scale":we(r,1)}else 4===this.strideOut&&"matrix"===e&&we(r,-1)}else r=this.output[t],i&&"translate"===e&&(r=Me(i,r));return r},ie.prototype.addTarget=function(e,t,i,r){this.targets.push({sid:e,member:i,transform:t,data:r})},ie.prototype.apply=function(e){for(var t=0;t<this.targets.length;++t){var i=this.targets[t];e&&i.sid!==e||i.transform.update(i.data,i.member)}},ie.prototype.getTarget=function(e){for(var t=0;t<this.targets.length;++t)if(this.targets[t].sid===e)return this.targets[t];return null},ie.prototype.hasTarget=function(e){for(var t=0;t<this.targets.length;++t)if(this.targets[t].sid===e)return!0;return!1},ie.prototype.interpolate=function(e,t){for(var i=0,r=this.targets.length;r>i;i++){var n,o=this.targets[i],a=e.getTarget(o.sid);if("matrix"!==o.transform.type&&a){var s=(t-this.time)/(e.time-this.time),c=a.data,h=o.data;if(0>s&&(s=0),s>1&&(s=1),h.length){n=[];for(var l=0;l<h.length;++l)n[l]=h[l]+(c[l]-h[l])*s}else n=h+(c-h)*s}else n=o.data;o.transform.update(n,o.member)}},re.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"optics":this.parseOptics(i)}}return this},re.prototype.parseOptics=function(e){for(var t=0;t<e.childNodes.length;t++)if("technique_common"===e.childNodes[t].nodeName)for(var i=e.childNodes[t],r=0;r<i.childNodes.length;r++)if(this.technique=i.childNodes[r].nodeName,"perspective"===this.technique)for(var n=i.childNodes[r],o=0;o<n.childNodes.length;o++){var a=n.childNodes[o];switch(a.nodeName){case"yfov":this.yfov=a.textContent;break;case"xfov":this.xfov=a.textContent;break;case"znear":this.znear=a.textContent;break;case"zfar":this.zfar=a.textContent;break;case"aspect_ratio":this.aspect_ratio=a.textContent}}else if("orthographic"===this.technique)for(var s=i.childNodes[r],o=0;o<s.childNodes.length;o++){var a=s.childNodes[o];switch(a.nodeName){case"xmag":this.xmag=a.textContent;break;case"ymag":this.ymag=a.textContent;break;case"znear":this.znear=a.textContent;break;case"zfar":this.zfar=a.textContent;break;case"aspect_ratio":this.aspect_ratio=a.textContent}}return this},ne.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},oe.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"technique_common":this.parseCommon(i);break;case"technique":this.parseTechnique(i)}}return this},oe.prototype.parseCommon=function(e){for(var t=0;t<e.childNodes.length;t++)switch(e.childNodes[t].nodeName){case"directional":case"point":case"spot":case"ambient":this.technique=e.childNodes[t].nodeName;for(var i=e.childNodes[t],r=0;r<i.childNodes.length;r++){var n=i.childNodes[r];switch(n.nodeName){case"color":var o=pe(n.textContent);this.color=new THREE.Color(0),this.color.setRGB(o[0],o[1],o[2]),this.color.a=o[3];break;case"falloff_angle":this.falloff_angle=parseFloat(n.textContent);break;case"quadratic_attenuation":var a=parseFloat(n.textContent);this.distance=a?Math.sqrt(1/a):0}}}return this},oe.prototype.parseTechnique=function(e){this.profile=e.getAttribute("profile");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"intensity":this.intensity=parseFloat(i.textContent)}}return this},ae.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},se.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.joints=[],this.links=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"technique_common":this.parseCommon(i)}}return this},se.prototype.parseCommon=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(e.childNodes[t].nodeName){case"joint":this.joints.push((new ce).parse(i));break;case"link":this.links.push((new he).parse(i))}}return this},ce.prototype.parse=function(e){this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.axis=new THREE.Vector3,this.limits={min:0,max:0},this.type="",this["static"]=!1,this.zeroPosition=0,this.middlePosition=0;var t=e.querySelector("axis"),i=pe(t.textContent);this.axis=_e(i,0);var r=e.querySelector("limits min")?parseFloat(e.querySelector("limits min").textContent):-360,n=e.querySelector("limits max")?parseFloat(e.querySelector("limits max").textContent):360;this.limits={min:r,max:n};for(var o=["prismatic","revolute"],a=0;a<o.length;a++){var s=o[a],c=e.querySelector(s);c&&(this.type=s)}return this.limits.min>=this.limits.max&&(this["static"]=!0),this.middlePosition=(this.limits.min+this.limits.max)/2,this},he.prototype.parse=function(e){this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.transforms=[],this.attachments=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"attachment_full":this.attachments.push((new le).parse(i));break;case"rotate":case"translate":case"matrix":this.transforms.push((new D).parse(i))}}return this},le.prototype.parse=function(e){this.joint=e.getAttribute("joint").split("/").pop(),this.links=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"link":this.links.push((new he).parse(i));break;case"rotate":case"translate":case"matrix":this.transforms.push((new D).parse(i))}}return this},{load:e,parse:t,setPreferredShading:i,applySkin:m,geometries:Ge,options:Qe}}},{}],19:[function(){THREE.MTLLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.MTLLoader.prototype={constructor:THREE.MTLLoader,load:function(e,t,i,r){var n=this,o=new THREE.XHRLoader(this.manager);o.setPath(this.path),o.load(e,function(e){t(n.parse(e))},i,r)},setPath:function(e){this.path=e},setBaseUrl:function(e){this.baseUrl=e},setCrossOrigin:function(e){this.crossOrigin=e},setMaterialOptions:function(e){this.materialOptions=e},parse:function(e){for(var t=e.split("\n"),i={},r=/\s+/,n={},o=0;o<t.length;o++){var a=t[o];if(a=a.trim(),0!==a.length&&"#"!==a.charAt(0)){var s=a.indexOf(" "),c=s>=0?a.substring(0,s):a;c=c.toLowerCase();var h=s>=0?a.substring(s+1):"";if(h=h.trim(),"newmtl"===c)i={name:h},n[h]=i;else if(i)if("ka"===c||"kd"===c||"ks"===c){var l=h.split(r,3);i[c]=[parseFloat(l[0]),parseFloat(l[1]),parseFloat(l[2])]}else i[c]=h}}var u=new THREE.MTLLoader.MaterialCreator(this.baseUrl,this.materialOptions);return u.setCrossOrigin(this.crossOrigin),u.setManager(this.manager),u.setMaterials(n),u}},THREE.MTLLoader.MaterialCreator=function(e,t){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:THREE.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:THREE.RepeatWrapping},THREE.MTLLoader.MaterialCreator.prototype={constructor:THREE.MTLLoader.MaterialCreator,setCrossOrigin:function(e){this.crossOrigin=e},setManager:function(e){this.manager=e},setMaterials:function(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(e){if(!this.options)return e;var t={};for(var i in e){var r=e[i],n={};t[i]=n;for(var o in r){var a=!0,s=r[o],c=o.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(s=[s[0]/255,s[1]/255,s[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===s[0]&&0===s[1]&&0===s[1]&&(a=!1)}a&&(n[c]=s)}}return t},preload:function(){for(var e in this.materialsInfo)this.create(e)},getIndex:function(e){return this.nameLookup[e]},getAsArray:function(){var e=0;for(var t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray},create:function(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]},createMaterial_:function(e){var t=this.materialsInfo[e],i={name:e,side:this.side};for(var r in t){var n=t[r];if(""!==n)switch(r.toLowerCase()){case"kd":i.color=(new THREE.Color).fromArray(n);break;case"ks":i.specular=(new THREE.Color).fromArray(n);break;case"map_kd":i.map=this.loadTexture(this.baseUrl+n),i.map.wrapS=this.wrap,i.map.wrapT=this.wrap;break;case"ns":i.shininess=parseFloat(n);break;case"d":1>n&&(i.opacity=n,i.transparent=!0);break;case"Tr":n>0&&(i.opacity=1-n,i.transparent=!0);break;case"map_bump":case"bump":if(i.bumpMap)break;i.bumpMap=this.loadTexture(this.baseUrl+n),i.bumpMap.wrapS=this.wrap,i.bumpMap.wrapT=this.wrap}}return this.materials[e]=new THREE.MeshPhongMaterial(i),this.materials[e]},loadTexture:function(e,t,i,r,n){var o,a=THREE.Loader.Handlers.get(e),s=void 0!==this.manager?this.manager:THREE.DefaultLoadingManager;return null===a&&(a=new THREE.TextureLoader(s)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin),o=a.load(e,i,r,n),void 0!==t&&(o.mapping=t),o}},THREE.EventDispatcher.prototype.apply(THREE.MTLLoader.prototype)},{}],20:[function(){THREE.OBJLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.materials=null},THREE.OBJLoader.prototype={constructor:THREE.OBJLoader,load:function(e,t,i,r){var n=this,o=new THREE.XHRLoader(n.manager);o.setPath(this.path),o.load(e,function(e){t(n.parse(e))},i,r)},setPath:function(e){this.path=e},setMaterials:function(e){this.materials=e},parse:function(e){function t(e){var t={vertices:[],normals:[],uvs:[]},i={name:"",smooth:!0};h={name:e,geometry:t,material:i},l.push(h)}function i(e){var t=parseInt(e);return 3*(t>=0?t-1:t+d.length/3)}function r(e){var t=parseInt(e);return 3*(t>=0?t-1:t+p.length/3)}function n(e){var t=parseInt(e);return 2*(t>=0?t-1:t+f.length/2)}function o(e,t,i){h.geometry.vertices.push(d[e],d[e+1],d[e+2],d[t],d[t+1],d[t+2],d[i],d[i+1],d[i+2])}function a(e,t,i){h.geometry.normals.push(p[e],p[e+1],p[e+2],p[t],p[t+1],p[t+2],p[i],p[i+1],p[i+2])}function s(e,t,i){h.geometry.uvs.push(f[e],f[e+1],f[t],f[t+1],f[i],f[i+1])}function c(e,t,c,h,l,u,d,p,f,m,v,g){var y,x=i(e),b=i(t),w=i(c);void 0===h?o(x,b,w):(y=i(h),o(x,b,y),o(b,w,y)),void 0!==l&&(x=n(l),b=n(u),w=n(d),void 0===h?s(x,b,w):(y=n(p),s(x,b,y),s(b,w,y))),void 0!==f&&(x=r(f),b=r(m),w=r(v),void 0===h?a(x,b,w):(y=r(g),a(x,b,y),a(b,w,y)))}console.time("OBJLoader");var h,l=[],u=!1,d=[],p=[],f=[];t("");for(var m=/^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,v=/^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,g=/^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,y=/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,x=/^f\s+((-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+))(?:\s+((-?\d+)\/(-?\d+)))?/,b=/^f\s+((-?\d+)\/(-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+)\/(-?\d+))(?:\s+((-?\d+)\/(-?\d+)\/(-?\d+)))?/,w=/^f\s+((-?\d+)\/\/(-?\d+))\s+((-?\d+)\/\/(-?\d+))\s+((-?\d+)\/\/(-?\d+))(?:\s+((-?\d+)\/\/(-?\d+)))?/,M=/^[og]\s*(.+)?/,_=/^s\s+(\d+|on|off)/,E=e.split("\n"),A=0;A<E.length;A++){var S=E[A];S=S.trim();var T;if(0!==S.length&&"#"!==S.charAt(0))if(null!==(T=m.exec(S)))d.push(parseFloat(T[1]),parseFloat(T[2]),parseFloat(T[3]));else if(null!==(T=v.exec(S)))p.push(parseFloat(T[1]),parseFloat(T[2]),parseFloat(T[3]));else if(null!==(T=g.exec(S)))f.push(parseFloat(T[1]),parseFloat(T[2]));else if(null!==(T=y.exec(S)))c(T[1],T[2],T[3],T[4]);else if(null!==(T=x.exec(S)))c(T[2],T[5],T[8],T[11],T[3],T[6],T[9],T[12]);else if(null!==(T=b.exec(S)))c(T[2],T[6],T[10],T[14],T[3],T[7],T[11],T[15],T[4],T[8],T[12],T[16]);else if(null!==(T=w.exec(S)))c(T[2],T[5],T[8],T[11],void 0,void 0,void 0,void 0,T[3],T[6],T[9],T[12]);else if(null!==(T=M.exec(S))){var C=T[0].substr(1).trim();u===!1?(u=!0,h.name=C):t(C)}else if(/^usemtl /.test(S))h.material.name=S.substring(7).trim();else if(/^mtllib /.test(S));else{if(null===(T=_.exec(S)))throw new Error("Unexpected line: "+S);h.material.smooth="1"===T[1]||"on"===T[1]}}for(var L=new THREE.Group,A=0,R=l.length;R>A;A++){h=l[A];var P=h.geometry,D=new THREE.BufferGeometry;D.addAttribute("position",new THREE.BufferAttribute(new Float32Array(P.vertices),3)),P.normals.length>0?D.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(P.normals),3)):D.computeVertexNormals(),P.uvs.length>0&&D.addAttribute("uv",new THREE.BufferAttribute(new Float32Array(P.uvs),2));var O;null!==this.materials&&(O=this.materials.create(h.material.name)),O||(O=new THREE.MeshPhongMaterial,O.name=h.material.name),O.shading=h.material.smooth?THREE.SmoothShading:THREE.FlatShading;var I=new THREE.Mesh(D,O);I.name=h.name,L.add(I)}return console.timeEnd("OBJLoader"),L}}},{}],21:[function(e,i,r){var n={REVISION:"75"};"function"==typeof t&&t.amd?t("three",n):"undefined"!=typeof r&&"undefined"!=typeof i&&(i.exports=n),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1: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]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(e){"use strict";if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),i=1,r=arguments.length;i!==r;++i){var n=arguments[i];if(void 0!==n&&null!==n){n=Object(n);for(var o=Object.keys(n),a=0,s=o.length;a!==s;++a){var c=o[a],h=Object.getOwnPropertyDescriptor(n,c);void 0!==h&&h.enumerable&&(t[c]=n[c])}}}return t}}),n.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},n.CullFaceNone=0,n.CullFaceBack=1,n.CullFaceFront=2,n.CullFaceFrontBack=3,n.FrontFaceDirectionCW=0,n.FrontFaceDirectionCCW=1,n.BasicShadowMap=0,n.PCFShadowMap=1,n.PCFSoftShadowMap=2,n.FrontSide=0,n.BackSide=1,n.DoubleSide=2,n.FlatShading=1,n.SmoothShading=2,n.NoColors=0,n.FaceColors=1,n.VertexColors=2,n.NoBlending=0,n.NormalBlending=1,n.AdditiveBlending=2,n.SubtractiveBlending=3,n.MultiplyBlending=4,n.CustomBlending=5,n.AddEquation=100,n.SubtractEquation=101,n.ReverseSubtractEquation=102,n.MinEquation=103,n.MaxEquation=104,n.ZeroFactor=200,n.OneFactor=201,n.SrcColorFactor=202,n.OneMinusSrcColorFactor=203,n.SrcAlphaFactor=204,n.OneMinusSrcAlphaFactor=205,n.DstAlphaFactor=206,n.OneMinusDstAlphaFactor=207,n.DstColorFactor=208,n.OneMinusDstColorFactor=209,n.SrcAlphaSaturateFactor=210,n.NeverDepth=0,n.AlwaysDepth=1,n.LessDepth=2,n.LessEqualDepth=3,n.EqualDepth=4,n.GreaterEqualDepth=5,n.GreaterDepth=6,n.NotEqualDepth=7,n.MultiplyOperation=0,n.MixOperation=1,n.AddOperation=2,n.NoToneMapping=0,n.LinearToneMapping=1,n.ReinhardToneMapping=2,n.Uncharted2ToneMapping=3,n.CineonToneMapping=4,n.UVMapping=300,n.CubeReflectionMapping=301,n.CubeRefractionMapping=302,n.EquirectangularReflectionMapping=303,n.EquirectangularRefractionMapping=304,n.SphericalReflectionMapping=305,n.CubeUVReflectionMapping=306,n.CubeUVRefractionMapping=307,n.RepeatWrapping=1e3,n.ClampToEdgeWrapping=1001,n.MirroredRepeatWrapping=1002,n.NearestFilter=1003,n.NearestMipMapNearestFilter=1004,n.NearestMipMapLinearFilter=1005,n.LinearFilter=1006,n.LinearMipMapNearestFilter=1007,n.LinearMipMapLinearFilter=1008,n.UnsignedByteType=1009,n.ByteType=1010,n.ShortType=1011,n.UnsignedShortType=1012,n.IntType=1013,n.UnsignedIntType=1014,n.FloatType=1015,n.HalfFloatType=1025,n.UnsignedShort4444Type=1016,n.UnsignedShort5551Type=1017,n.UnsignedShort565Type=1018,n.AlphaFormat=1019,n.RGBFormat=1020,n.RGBAFormat=1021,n.LuminanceFormat=1022,n.LuminanceAlphaFormat=1023,n.RGBEFormat=n.RGBAFormat,n.RGB_S3TC_DXT1_Format=2001,n.RGBA_S3TC_DXT1_Format=2002,n.RGBA_S3TC_DXT3_Format=2003,n.RGBA_S3TC_DXT5_Format=2004,n.RGB_PVRTC_4BPPV1_Format=2100,n.RGB_PVRTC_2BPPV1_Format=2101,n.RGBA_PVRTC_4BPPV1_Format=2102,n.RGBA_PVRTC_2BPPV1_Format=2103,n.RGB_ETC1_Format=2151,n.LoopOnce=2200,n.LoopRepeat=2201,n.LoopPingPong=2202,n.InterpolateDiscrete=2300,n.InterpolateLinear=2301,n.InterpolateSmooth=2302,n.ZeroCurvatureEnding=2400,n.ZeroSlopeEnding=2401,n.WrapAroundEnding=2402,n.TrianglesDrawMode=0,n.TriangleStripDrawMode=1,n.TriangleFanDrawMode=2,n.LinearEncoding=3e3,n.sRGBEncoding=3001,n.GammaEncoding=3007,n.RGBEEncoding=3002,n.LogLuvEncoding=3003,n.RGBM7Encoding=3004,n.RGBM16Encoding=3005,n.RGBDEncoding=3006,n.Color=function(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},n.Color.prototype={constructor:n.Color,r:1,g:1,b:1,set:function(e){return e instanceof n.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.r=e,this.g=e,this.b=e},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,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(){function e(e,t,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?e+6*(t-e)*i:.5>i?t:2/3>i?e+6*(t-e)*(2/3-i):e}return function(t,i,r){if(t=n.Math.euclideanModulo(t,1),i=n.Math.clamp(i,0,1),r=n.Math.clamp(r,0,1),0===i)this.r=this.g=this.b=r;else{var o=.5>=r?r*(1+i):r+i-r*i,a=2*r-o;this.r=e(a,o,t+1/3),this.g=e(a,o,t),this.b=e(a,o,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 i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var s=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,h=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(s,c,h)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=i[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(e&&e.length>0){var l=n.ColorKeywords[e];void 0!==l?this.setHex(l):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 i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,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,i,r=e||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),c=Math.min(n,o,a),h=(c+s)/2;if(c===s)t=0,i=0;else{var l=s-c;switch(i=.5>=h?l/(s+c):l/(2-s-c),s){case n:t=(o-a)/l+(a>o?6:0);break;case o:t=(a-n)/l+2;break;case a:t=(n-o)/l+4}t/=6}return r.h=t,r.s=i,r.l=h,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,i){var r=this.getHSL();return r.h+=e,r.s+=t,r.l+=i,this.setHSL(r.h,r.s,r.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}},n.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},n.Quaternion=function(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==r?r:1},n.Quaternion.prototype={constructor:n.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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,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 n.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var i=Math.cos(e._x/2),r=Math.cos(e._y/2),o=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),c=Math.sin(e._z/2),h=e.order;return"XYZ"===h?(this._x=a*r*o+i*s*c,this._y=i*s*o-a*r*c,this._z=i*r*c+a*s*o,this._w=i*r*o-a*s*c):"YXZ"===h?(this._x=a*r*o+i*s*c,this._y=i*s*o-a*r*c,this._z=i*r*c-a*s*o,this._w=i*r*o+a*s*c):"ZXY"===h?(this._x=a*r*o-i*s*c,this._y=i*s*o+a*r*c,this._z=i*r*c+a*s*o,this._w=i*r*o-a*s*c):"ZYX"===h?(this._x=a*r*o-i*s*c,this._y=i*s*o+a*r*c,this._z=i*r*c-a*s*o,this._w=i*r*o+a*s*c):"YZX"===h?(this._x=a*r*o+i*s*c,this._y=i*s*o+a*r*c,this._z=i*r*c-a*s*o,this._w=i*r*o-a*s*c):"XZY"===h&&(this._x=a*r*o-i*s*c,this._y=i*s*o-a*r*c,this._z=i*r*c+a*s*o,this._w=i*r*o+a*s*c),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,r=i[0],n=i[4],o=i[8],a=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],d=r+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(l-c)*t,this._y=(o-h)*t,this._z=(a-n)*t):r>s&&r>u?(t=2*Math.sqrt(1+r-s-u),this._w=(l-c)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+h)/t):s>u?(t=2*Math.sqrt(1+s-r-u),this._w=(o-h)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+u-r-s),this._w=(a-n)/t,this._x=(o+h)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,i=1e-6;return function(r,o){return void 0===e&&(e=new n.Vector3),t=r.dot(o)+1,i>t?(t=0,Math.abs(r.x)>Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,o),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 i=e._x,r=e._y,n=e._z,o=e._w,a=t._x,s=t._y,c=t._z,h=t._w;return this._x=i*h+o*a+r*c-n*s,this._y=r*h+o*s+n*a-i*c,this._z=n*h+o*c+i*s-r*a,this._w=o*h-i*a-r*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,r=this._y,n=this._z,o=this._w,a=o*e._w+i*e._x+r*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=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,a),h=Math.sin((1-t)*c)/s,l=Math.sin(t*c)/s;return this._w=o*h+this._w*l,this._x=i*h+this._x*l,this._y=r*h+this._y*l,this._z=n*h+this._z*l,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(){}},Object.assign(n.Quaternion,{slerp:function(e,t,i,r){return i.copy(e).slerp(t,r)},slerpFlat:function(e,t,i,r,n,o,a){var s=i[r+0],c=i[r+1],h=i[r+2],l=i[r+3],u=n[o+0],d=n[o+1],p=n[o+2],f=n[o+3];if(l!==f||s!==u||c!==d||h!==p){var m=1-a,v=s*u+c*d+h*p+l*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+u*w,c=c*m+d*w,h=h*m+p*w,l=l*m+f*w,m===1-a){var M=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=M,c*=M,h*=M,l*=M}}e[t]=s,e[t+1]=c,e[t+2]=h,e[t+3]=l}}),n.Vector2=function(e,t){this.x=e||0,this.y=t||0},n.Vector2.prototype={constructor:n.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},setScalar:function(e){return this.x=e,this.y=e,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(i,r){return void 0===e&&(e=new n.Vector2,t=new n.Vector2),e.set(i,i),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i),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())},angle:function(){var e=Math.atan2(this.y,this.x);return 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},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,i){return this.subVectors(t,e).multiplyScalar(i).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,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*i-o*r+e.x,this.y=n*r+o*i+e.y,this}},n.Vector3=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0},n.Vector3.prototype={constructor:n.Vector3,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,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 n.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new n.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,i){return void 0===e&&(e=new n.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,i)),this}}(),applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r+n[12],this.y=n[1]*t+n[5]*i+n[9]*r+n[13],this.z=n[2]*t+n[6]*i+n[10]*r+n[14],this},applyProjection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements,o=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*o,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*o,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*r-a*i,h=s*i+a*t-n*r,l=s*r+n*i-o*t,u=-n*t-o*i-a*r;return this.x=c*s+u*-n+h*-a-l*-o,this.y=h*s+u*-o+l*-n-c*-a,this.z=l*s+u*-a+c*-o-h*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new n.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 n.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,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(i,r){return void 0===e&&(e=new n.Vector3,t=new n.Vector3),e.set(i,i,i),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i),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,i){return this.subVectors(t,e).multiplyScalar(i).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 i=this.x,r=this.y,n=this.z;return this.x=r*e.z-n*e.y,this.y=n*e.x-i*e.z,this.z=i*e.y-r*e.x,this},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,this},projectOnVector:function(){var e,t;return function(i){return void 0===e&&(e=new n.Vector3),e.copy(i).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new n.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new n.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(n.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this},setFromMatrixColumn:function(e,t){return"number"==typeof e&&(console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."),e=arguments[1],t=arguments[0]),this.fromArray(e.elements,4*t)},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,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},n.Vector4=function(e,t,i,r){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==r?r:1},n.Vector4.prototype={constructor:n.Vector4,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,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,i=this.y,r=this.z,n=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*n,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*n,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*n,this.w=o[3]*t+o[7]*i+o[11]*r+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,i,r,n,o=.01,a=.1,s=e.elements,c=s[0],h=s[4],l=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(h-u)<o&&Math.abs(l-f)<o&&Math.abs(p-m)<o){if(Math.abs(h+u)<a&&Math.abs(l+f)<a&&Math.abs(p+m)<a&&Math.abs(c+d+v-3)<a)return this.set(1,0,0,0),this;t=Math.PI;var g=(c+1)/2,y=(d+1)/2,x=(v+1)/2,b=(h+u)/4,w=(l+f)/4,M=(p+m)/4;return g>y&&g>x?o>g?(i=0,r=.707106781,n=.707106781):(i=Math.sqrt(g),r=b/i,n=w/i):y>x?o>y?(i=.707106781,r=0,n=.707106781):(r=Math.sqrt(y),i=b/r,n=M/r):o>x?(i=.707106781,r=.707106781,n=0):(n=Math.sqrt(x),i=w/n,r=M/n),this.set(i,r,n,t),this}var _=Math.sqrt((m-p)*(m-p)+(l-f)*(l-f)+(u-h)*(u-h));return Math.abs(_)<.001&&(_=1),this.x=(m-p)/_,this.y=(l-f)/_,this.z=(u-h)/_,this.w=Math.acos((c+d+v-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(i,r){return void 0===e&&(e=new n.Vector4,t=new n.Vector4),e.set(i,i,i,i),t.set(r,r,r,r),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,i){return this.subVectors(t,e).multiplyScalar(i).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,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},n.Euler=function(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._order=r||n.Euler.DefaultOrder},n.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],n.Euler.DefaultOrder="XYZ",n.Euler.prototype={constructor:n.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,i,r){return this._x=e,this._y=t,this._z=i,this._order=r||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,i){var r=n.Math.clamp,o=e.elements,a=o[0],s=o[4],c=o[8],h=o[1],l=o[5],u=o[9],d=o[2],p=o[6],f=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-d,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===t?(this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(c,f))):"XZY"===t?(this._z=Math.asin(-r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(c,a)):(this._x=Math.atan2(-u,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,i!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,i,r){return void 0===e&&(e=new n.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,i,r),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new n.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 n.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},n.Line3=function(e,t){this.start=void 0!==e?e:new n.Vector3,this.end=void 0!==t?t:new n.Vector3},n.Line3.prototype={constructor:n.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 n.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new n.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 i=t||new n.Vector3;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new n.Vector3,t=new n.Vector3;return function(i,r){e.subVectors(i,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),a=t.dot(e),s=a/o;return r&&(s=n.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,i){var r=this.closestPointToPointParameter(e,t),o=i||new n.Vector3;return this.delta(o).multiplyScalar(r).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)}},n.Box2=function(e,t){this.min=void 0!==e?e:new n.Vector2(+(1/0),+(1/0)),this.max=void 0!==t?t:new n.Vector2(-(1/0),-(1/0))},n.Box2.prototype={constructor:n.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;i>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new n.Vector2;return function(t,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),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},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){var t=e||new n.Vector2;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new n.Vector2;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.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 i=t||new n.Vector2;return i.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){var i=t||new n.Vector2;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n.Vector2;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.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)}},n.Box3=function(e,t){this.min=void 0!==e?e:new n.Vector3(+(1/0),+(1/0),+(1/0)),this.max=void 0!==t?t:new n.Vector3(-(1/0),-(1/0),-(1/0))},n.Box3.prototype={constructor:n.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){this.makeEmpty();for(var t=+(1/0),i=+(1/0),r=+(1/0),n=-(1/0),o=-(1/0),a=-(1/0),s=0,c=e.length;c>s;s+=3){var h=e[s],l=e[s+1],u=e[s+2];t>h&&(t=h),i>l&&(i=l),r>u&&(r=u),h>n&&(n=h),l>o&&(o=l),u>a&&(a=u)}this.min.set(t,i,r),this.max.set(n,o,a)},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;i>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new n.Vector3;return function(t,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),this}}(),setFromObject:function(){var e;return function(t){void 0===e&&(e=new n.Box3);var i=this;return this.makeEmpty(),t.updateMatrixWorld(!0),t.traverse(function(t){var r=t.geometry;void 0!==r&&(null===r.boundingBox&&r.computeBoundingBox(),r.boundingBox.isEmpty()===!1&&(e.copy(r.boundingBox),e.applyMatrix4(t.matrixWorld),i.union(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},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){var t=e||new n.Vector3;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new n.Vector3;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.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 i=t||new n.Vector3;return i.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))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new n.Vector3),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=e.constant&&i>=e.constant},clampPoint:function(e,t){var i=t||new n.Vector3;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n.Vector3;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),getBoundingSphere:function(){var e=new n.Vector3;return function(t){var i=t||new n.Sphere;return i.center=this.center(),i.radius=.5*this.size(e).length(),i}}(),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 n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.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)}},n.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.")},n.Matrix3.prototype={constructor:n.Matrix3,set:function(e,t,i,r,n,o,a,s,c){var h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=n,h[5]=s,h[6]=i,h[7]=o,h[8]=c,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},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToVector3Array:function(){var e;return function(t,i,r){void 0===e&&(e=new n.Vector3),void 0===i&&(i=0),void 0===r&&(r=t.length);for(var o=0,a=i;r>o;o+=3,a+=3)e.fromArray(t,a),e.applyMatrix3(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,i,r){void 0===e&&(e=new n.Vector3),void 0===i&&(i=0),void 0===r&&(r=t.length/t.itemSize);for(var o=0,a=i;r>o;o++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),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],i=e[1],r=e[2],n=e[3],o=e[4],a=e[5],s=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-i*n*h+i*a*s+r*n*c-r*o*s},getInverse:function(e,t){e instanceof n.Matrix4&&console.warn("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=e.elements,r=this.elements,o=i[0],a=i[1],s=i[2],c=i[3],h=i[4],l=i[5],u=i[6],d=i[7],p=i[8],f=p*h-l*d,m=l*u-p*c,v=d*c-h*u,g=o*f+a*m+s*v;if(0===g){var y="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(y);return console.warn(y),this.identity()}return r[0]=f,r[1]=s*d-p*a,r[2]=l*a-s*h,r[3]=m,r[4]=p*o-s*u,r[5]=s*c-l*o,r[6]=v,r[7]=a*u-d*o,r[8]=h*o-a*c,this.multiplyScalar(1/g)},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 i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},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]]}},n.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.")},n.Matrix4.prototype={constructor:n.Matrix4,set:function(e,t,i,r,n,o,a,s,c,h,l,u,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=r,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=d,v[7]=p,v[11]=f,v[15]=m,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 n.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new n.Vector3);var i=this.elements,r=t.elements,o=1/e.setFromMatrixColumn(t,0).length(),a=1/e.setFromMatrixColumn(t,1).length(),s=1/e.setFromMatrixColumn(t,2).length();return i[0]=r[0]*o,i[1]=r[1]*o,i[2]=r[2]*o,i[4]=r[4]*a,i[5]=r[5]*a,i[6]=r[6]*a,i[8]=r[8]*s,i[9]=r[9]*s,i[10]=r[10]*s,this}}(),makeRotationFromEuler:function(e){e instanceof n.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,r=e.y,o=e.z,a=Math.cos(i),s=Math.sin(i),c=Math.cos(r),h=Math.sin(r),l=Math.cos(o),u=Math.sin(o);if("XYZ"===e.order){var d=a*l,p=a*u,f=s*l,m=s*u;t[0]=c*l,t[4]=-c*u,t[8]=h,t[1]=p+f*h,t[5]=d-m*h,t[9]=-s*c,t[2]=m-d*h,t[6]=f+p*h,t[10]=a*c}else if("YXZ"===e.order){var v=c*l,g=c*u,y=h*l,x=h*u;t[0]=v+x*s,t[4]=y*s-g,t[8]=a*h,t[1]=a*u,t[5]=a*l,t[9]=-s,t[2]=g*s-y,t[6]=x+v*s,t[10]=a*c}else if("ZXY"===e.order){var v=c*l,g=c*u,y=h*l,x=h*u;t[0]=v-x*s,t[4]=-a*u,t[8]=y+g*s,t[1]=g+y*s,t[5]=a*l,t[9]=x-v*s,t[2]=-a*h,t[6]=s,t[10]=a*c}else if("ZYX"===e.order){var d=a*l,p=a*u,f=s*l,m=s*u;t[0]=c*l,t[4]=f*h-p,t[8]=d*h+m,t[1]=c*u,t[5]=m*h+d,t[9]=p*h-f,t[2]=-h,t[6]=s*c,t[10]=a*c}else if("YZX"===e.order){var b=a*c,w=a*h,M=s*c,_=s*h;t[0]=c*l,t[4]=_-b*u,t[8]=M*u+w,t[1]=u,t[5]=a*l,t[9]=-s*l,t[2]=-h*l,t[6]=w*u+M,t[10]=b-_*u}else if("XZY"===e.order){var b=a*c,w=a*h,M=s*c,_=s*h;t[0]=c*l,t[4]=-u,t[8]=h*l,t[1]=b*u+_,t[5]=a*l,t[9]=w*u-M,t[2]=M*u-w,t[6]=s*l,t[10]=_*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,r=e.y,n=e.z,o=e.w,a=i+i,s=r+r,c=n+n,h=i*a,l=i*s,u=i*c,d=r*s,p=r*c,f=n*c,m=o*a,v=o*s,g=o*c;return t[0]=1-(d+f),t[4]=l-g,t[8]=u+v,t[1]=l+g,t[5]=1-(h+f),
t[9]=p-m,t[2]=u-v,t[6]=p+m,t[10]=1-(h+d),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,i;return function(r,o,a){void 0===e&&(e=new n.Vector3),void 0===t&&(t=new n.Vector3),void 0===i&&(i=new n.Vector3);var s=this.elements;return i.subVectors(r,o).normalize(),0===i.lengthSq()&&(i.z=1),e.crossVectors(a,i).normalize(),0===e.lengthSq()&&(i.x+=1e-4,e.crossVectors(a,i).normalize()),t.crossVectors(i,e),s[0]=e.x,s[4]=t.x,s[8]=i.x,s[1]=e.y,s[5]=t.y,s[9]=i.y,s[2]=e.z,s[6]=t.z,s[10]=i.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 i=e.elements,r=t.elements,n=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],b=i[15],w=r[0],M=r[4],_=r[8],E=r[12],A=r[1],S=r[5],T=r[9],C=r[13],L=r[2],R=r[6],P=r[10],D=r[14],O=r[3],I=r[7],k=r[11],N=r[15];return n[0]=o*w+a*A+s*L+c*O,n[4]=o*M+a*S+s*R+c*I,n[8]=o*_+a*T+s*P+c*k,n[12]=o*E+a*C+s*D+c*N,n[1]=h*w+l*A+u*L+d*O,n[5]=h*M+l*S+u*R+d*I,n[9]=h*_+l*T+u*P+d*k,n[13]=h*E+l*C+u*D+d*N,n[2]=p*w+f*A+m*L+v*O,n[6]=p*M+f*S+m*R+v*I,n[10]=p*_+f*T+m*P+v*k,n[14]=p*E+f*C+m*D+v*N,n[3]=g*w+y*A+x*L+b*O,n[7]=g*M+y*S+x*R+b*I,n[11]=g*_+y*T+x*P+b*k,n[15]=g*E+y*C+x*D+b*N,this},multiplyToArray:function(e,t,i){var r=this.elements;return this.multiplyMatrices(e,t),i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[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},applyToVector3Array:function(){var e;return function(t,i,r){void 0===e&&(e=new n.Vector3),void 0===i&&(i=0),void 0===r&&(r=t.length);for(var o=0,a=i;r>o;o+=3,a+=3)e.fromArray(t,a),e.applyMatrix4(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,i,r){void 0===e&&(e=new n.Vector3),void 0===i&&(i=0),void 0===r&&(r=t.length/t.itemSize);for(var o=0,a=i;r>o;o++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],o=e[1],a=e[5],s=e[9],c=e[13],h=e[2],l=e[6],u=e[10],d=e[14],p=e[3],f=e[7],m=e[11],v=e[15];return p*(+n*s*l-r*c*l-n*a*u+i*c*u+r*a*d-i*s*d)+f*(+t*s*d-t*c*u+n*o*u-r*o*d+r*c*h-n*s*h)+m*(+t*c*l-t*a*d-n*o*l+i*o*d+n*a*h-i*c*h)+v*(-r*a*h-t*s*l+t*a*u+r*o*l-i*o*u+i*s*h)},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 i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e},getPosition:function(){var e;return function(){return void 0===e&&(e=new n.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),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 i=this.elements,r=e.elements,n=r[0],o=r[1],a=r[2],s=r[3],c=r[4],h=r[5],l=r[6],u=r[7],d=r[8],p=r[9],f=r[10],m=r[11],v=r[12],g=r[13],y=r[14],x=r[15],b=p*y*u-g*f*u+g*l*m-h*y*m-p*l*x+h*f*x,w=v*f*u-d*y*u-v*l*m+c*y*m+d*l*x-c*f*x,M=d*g*u-v*p*u+v*h*m-c*g*m-d*h*x+c*p*x,_=v*p*l-d*g*l-v*h*f+c*g*f+d*h*y-c*p*y,E=n*b+o*w+a*M+s*_;if(0===E){var A="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(A);return console.warn(A),this.identity()}return i[0]=b,i[1]=g*f*s-p*y*s-g*a*m+o*y*m+p*a*x-o*f*x,i[2]=h*y*s-g*l*s+g*a*u-o*y*u-h*a*x+o*l*x,i[3]=p*l*s-h*f*s-p*a*u+o*f*u+h*a*m-o*l*m,i[4]=w,i[5]=d*y*s-v*f*s+v*a*m-n*y*m-d*a*x+n*f*x,i[6]=v*l*s-c*y*s-v*a*u+n*y*u+c*a*x-n*l*x,i[7]=c*f*s-d*l*s+d*a*u-n*f*u-c*a*m+n*l*m,i[8]=M,i[9]=v*p*s-d*g*s-v*o*m+n*g*m+d*o*x-n*p*x,i[10]=c*g*s-v*h*s+v*o*u-n*g*u-c*o*x+n*h*x,i[11]=d*h*s-c*p*s-d*o*u+n*p*u+c*o*m-n*h*m,i[12]=_,i[13]=d*g*a-v*p*a+v*o*f-n*g*f-d*o*y+n*p*y,i[14]=v*h*a-c*g*a-v*o*l+n*g*l+c*o*y-n*h*y,i[15]=c*p*a-d*h*a+d*o*l-n*p*l-c*o*f+n*h*f,this.multiplyScalar(1/E)},scale:function(e){var t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=1-i,o=e.x,a=e.y,s=e.z,c=n*o,h=n*a;return this.set(c*o+i,c*a-r*s,c*s+r*a,0,c*a+r*s,h*a+i,h*s-r*o,0,c*s-r*a,h*s+r*o,n*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},compose:function(e,t,i){return this.makeRotationFromQuaternion(t),this.scale(i),this.setPosition(e),this},decompose:function(){var e,t;return function(i,r,o){void 0===e&&(e=new n.Vector3),void 0===t&&(t=new n.Matrix4);var a=this.elements,s=e.set(a[0],a[1],a[2]).length(),c=e.set(a[4],a[5],a[6]).length(),h=e.set(a[8],a[9],a[10]).length(),l=this.determinant();0>l&&(s=-s),i.x=a[12],i.y=a[13],i.z=a[14],t.elements.set(this.elements);var u=1/s,d=1/c,p=1/h;return t.elements[0]*=u,t.elements[1]*=u,t.elements[2]*=u,t.elements[4]*=d,t.elements[5]*=d,t.elements[6]*=d,t.elements[8]*=p,t.elements[9]*=p,t.elements[10]*=p,r.setFromRotationMatrix(t),o.x=s,o.y=c,o.z=h,this}}(),makeFrustum:function(e,t,i,r,n,o){var a=this.elements,s=2*n/(t-e),c=2*n/(r-i),h=(t+e)/(t-e),l=(r+i)/(r-i),u=-(o+n)/(o-n),d=-2*o*n/(o-n);return a[0]=s,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,i,r){var o=i*Math.tan(n.Math.degToRad(.5*e)),a=-o,s=a*t,c=o*t;return this.makeFrustum(s,c,a,o,i,r)},makeOrthographic:function(e,t,i,r,n,o){var a=this.elements,s=1/(t-e),c=1/(i-r),h=1/(o-n),l=(t+e)*s,u=(i+r)*c,d=(o+n)*h;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,i=e.elements,r=0;16>r;r++)if(t[r]!==i[r])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]]}},n.Ray=function(e,t){this.origin=void 0!==e?e:new n.Vector3,this.direction=void 0!==t?t:new n.Vector3},n.Ray.prototype={constructor:n.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 i=t||new n.Vector3;return i.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){this.direction.copy(e).sub(this.origin).normalize()},recast:function(){var e=new n.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var i=t||new n.Vector3;i.subVectors(e,this.origin);var r=i.dot(this.direction);return 0>r?i.copy(this.origin):i.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new n.Vector3;return function(t){var i=e.subVectors(t,this.origin).dot(this.direction);return 0>i?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new n.Vector3,t=new n.Vector3,i=new n.Vector3;return function(r,n,o,a){e.copy(r).add(n).multiplyScalar(.5),t.copy(n).sub(r).normalize(),i.copy(this.origin).sub(e);var s,c,h,l,u=.5*r.distanceTo(n),d=-this.direction.dot(t),p=i.dot(this.direction),f=-i.dot(t),m=i.lengthSq(),v=Math.abs(1-d*d);if(v>0)if(s=d*f-p,c=d*p-f,l=u*v,s>=0)if(c>=-l)if(l>=c){var g=1/v;s*=g,c*=g,h=s*(s+d*c+2*p)+c*(d*s+c+2*f)+m}else c=u,s=Math.max(0,-(d*c+p)),h=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(d*c+p)),h=-s*s+c*(c+2*f)+m;else-l>=c?(s=Math.max(0,-(-d*u+p)),c=s>0?-u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m):l>=c?(s=0,c=Math.min(Math.max(-u,-f),u),h=c*(c+2*f)+m):(s=Math.max(0,-(d*u+p)),c=s>0?u:Math.min(Math.max(-u,-f),u),h=-s*s+c*(c+2*f)+m);else c=d>0?-u:u,s=Math.max(0,-(d*c+p)),h=-s*s+c*(c+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(c).add(e),h}}(),intersectSphere:function(){var e=new n.Vector3;return function(t,i){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),n=e.dot(e)-r*r,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=r-a,c=r+a;return 0>s&&0>c?null:0>s?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var i=e.normal.dot(this.direction);return 0>i*t?!0:!1},intersectBox:function(e,t){var i,r,n,o,a,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),h>=0?(n=(e.min.y-u.y)*h,o=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,o=(e.min.y-u.y)*h),i>o||n>r?null:((n>i||i!==i)&&(i=n),(r>o||r!==r)&&(r=o),l>=0?(a=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(a=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),i>s||a>r?null:((a>i||i!==i)&&(i=a),(r>s||r!==r)&&(r=s),0>r?null:this.at(i>=0?i:r,t)))},intersectsBox:function(){var e=new n.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new n.Vector3,t=new n.Vector3,i=new n.Vector3,r=new n.Vector3;return function(n,o,a,s,c){t.subVectors(o,n),i.subVectors(a,n),r.crossVectors(t,i);var h,l=this.direction.dot(r);if(l>0){if(s)return null;h=1}else{if(!(0>l))return null;h=-1,l=-l}e.subVectors(this.origin,n);var u=h*this.direction.dot(i.crossVectors(e,i));if(0>u)return null;var d=h*this.direction.dot(t.cross(e));if(0>d)return null;if(u+d>l)return null;var p=-h*e.dot(r);return 0>p?null:this.at(p/l,c)}}(),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)}},n.Sphere=function(e,t){this.center=void 0!==e?e:new n.Vector3,this.radius=void 0!==t?t:0},n.Sphere.prototype={constructor:n.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new n.Box3;return function(t,i){var r=this.center;void 0!==i?r.copy(i):e.setFromPoints(t).center(r);for(var n=0,o=0,a=t.length;a>o;o++)n=Math.max(n,r.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},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var i=this.center.distanceToSquared(e),r=t||new n.Vector3;return r.copy(e),i>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new n.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}},n.Frustum=function(e,t,i,r,o,a){this.planes=[void 0!==e?e:new n.Plane,void 0!==t?t:new n.Plane,void 0!==i?i:new n.Plane,void 0!==r?r:new n.Plane,void 0!==o?o:new n.Plane,void 0!==a?a:new n.Plane]},n.Frustum.prototype={constructor:n.Frustum,set:function(e,t,i,r,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),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,i=0;6>i;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,r=i[0],n=i[1],o=i[2],a=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return t[0].setComponents(a-r,l-s,f-u,y-m).normalize(),t[1].setComponents(a+r,l+s,f+u,y+m).normalize(),t[2].setComponents(a+n,l+c,f+d,y+v).normalize(),t[3].setComponents(a-n,l-c,f-d,y-v).normalize(),t[4].setComponents(a-o,l-h,f-p,y-g).normalize(),t[5].setComponents(a+o,l+h,f+p,y+g).normalize(),this},intersectsObject:function(){var e=new n.Sphere;return function(t){var i=t.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),e.copy(i.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,r=-e.radius,n=0;6>n;n++){var o=t[n].distanceToPoint(i);if(r>o)return!1}return!0},intersectsBox:function(){var e=new n.Vector3,t=new n.Vector3;return function(i){for(var r=this.planes,n=0;6>n;n++){var o=r[n];e.x=o.normal.x>0?i.min.x:i.max.x,t.x=o.normal.x>0?i.max.x:i.min.x,e.y=o.normal.y>0?i.min.y:i.max.y,t.y=o.normal.y>0?i.max.y:i.min.y,e.z=o.normal.z>0?i.min.z:i.max.z,t.z=o.normal.z>0?i.max.z:i.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,i=0;6>i;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}},n.Plane=function(e,t){this.normal=void 0!==e?e:new n.Vector3(1,0,0),this.constant=void 0!==t?t:0},n.Plane.prototype={constructor:n.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new n.Vector3,t=new n.Vector3;return function(i,r,n){var o=e.subVectors(n,r).cross(t.subVectors(i,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,i),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 i=this.distanceToPoint(e),r=t||new n.Vector3;return r.copy(this.normal).multiplyScalar(i)},intersectLine:function(){var e=new n.Vector3;return function(t,i){var r=i||new n.Vector3,o=t.delta(e),a=this.normal.dot(o);if(0===a)return 0===this.distanceToPoint(t.start)?r.copy(t.start):void 0;var s=-(t.start.dot(this.normal)+this.constant)/a;return 0>s||s>1?void 0:r.copy(o).multiplyScalar(s).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return 0>t&&i>0||0>i&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){var t=e||new n.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new n.Vector3,t=new n.Vector3,i=new n.Matrix3;return function(r,n){var o=n||i.getNormalMatrix(r),a=e.copy(this.normal).applyMatrix3(o),s=this.coplanarPoint(t);return s.applyMatrix4(r),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}},n.Spherical=function(e,t,i){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==i?i:0,this},n.Spherical.prototype={constructor:n.Spherical,set:function(e,t,i){this.radius=e,this.phi=t,this.theta=i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius.copy(e.radius),this.phi.copy(e.phi),this.theta.copy(e.theta),this},makeSafe:function(){var e=1e-6;this.phi=Math.max(e,Math.min(Math.PI-e,this.phi))},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(n.Math.clamp(e.y/this.radius,-1,1))),this}},n.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),r=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?i[n]="-":14===n?i[n]="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,i[n]=t[19===n?3&e|8:e]);return i.join("")}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},smoothstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*(3-2*e))},smootherstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},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}},n.Spline=function(e){function t(e,t,i,r,n,o,a){var s=.5*(i-e),c=.5*(r-t);return(2*(t-i)+s+c)*a+(-3*(t-i)-2*s-c)*o+s*n+t}this.points=e;var i,r,o,a,s,c,h,l,u,d=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return i=(this.points.length-1)*e,r=Math.floor(i),o=i-r,d[0]=0===r?r:r-1,d[1]=r,d[2]=r>this.points.length-2?this.points.length-1:r+1,d[3]=r>this.points.length-3?this.points.length-1:r+2,c=this.points[d[0]],h=this.points[d[1]],l=this.points[d[2]],u=this.points[d[3]],a=o*o,s=o*a,p.x=t(c.x,h.x,l.x,u.x,o,a,s),p.y=t(c.y,h.y,l.y,u.y,o,a,s),p.z=t(c.z,h.z,l.z,u.z,o,a,s),p},this.getControlPointsArray=function(){var e,t,i=this.points.length,r=[];for(e=0;i>e;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(e){var t,i,r,o,a=0,s=0,c=0,h=new n.Vector3,l=new n.Vector3,u=[],d=0;for(u[0]=0,e||(e=100),r=this.points.length*e,h.copy(this.points[0]),t=1;r>t;t++)i=t/r,o=this.getPoint(i),l.copy(o),d+=l.distanceTo(h),h.copy(o),a=(this.points.length-1)*i,s=Math.floor(a),s!==c&&(u[s]=d,c=s);return u[u.length]=d,{chunks:u,total:d}},this.reparametrizeByArcLength=function(e){var t,i,r,o,a,s,c,h,l=[],u=new n.Vector3,d=this.getLength();for(l.push(u.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(s=d.chunks[t]-d.chunks[t-1],c=Math.ceil(e*s/d.total),o=(t-1)/(this.points.length-1),a=t/(this.points.length-1),i=1;c-1>i;i++)r=o+i*(1/c)*(a-o),h=this.getPoint(r),l.push(u.copy(h).clone());l.push(u.copy(this.points[t]).clone())}this.points=l}},n.Triangle=function(e,t,i){this.a=void 0!==e?e:new n.Vector3,this.b=void 0!==t?t:new n.Vector3,this.c=void 0!==i?i:new n.Vector3},n.Triangle.normal=function(){var e=new n.Vector3;return function(t,i,r,o){var a=o||new n.Vector3;a.subVectors(r,i),e.subVectors(t,i),a.cross(e);var s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}}(),n.Triangle.barycoordFromPoint=function(){var e=new n.Vector3,t=new n.Vector3,i=new n.Vector3;return function(r,o,a,s,c){e.subVectors(s,o),t.subVectors(a,o),i.subVectors(r,o);var h=e.dot(e),l=e.dot(t),u=e.dot(i),d=t.dot(t),p=t.dot(i),f=h*d-l*l,m=c||new n.Vector3;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(d*u-l*p)*v,y=(h*p-l*u)*v;return m.set(1-g-y,y,g)}}(),n.Triangle.containsPoint=function(){var e=new n.Vector3;return function(t,i,r,o){var a=n.Triangle.barycoordFromPoint(t,i,r,o,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),n.Triangle.prototype={constructor:n.Triangle,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),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 n.Vector3,t=new n.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 n.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return n.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new n.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return n.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return n.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)}},n.Interpolant=function(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i},n.Interpolant.prototype={constructor:n.Interpolant,evaluate:function(e){var t=this.parameterPositions,i=this._cachedIndex,r=t[i],n=t[i-1];e:{t:{var o;i:{r:if(!(r>e)){for(var a=i+2;;){if(void 0===r){if(n>e)break r;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,n)}if(i===a)break;if(n=r,r=t[++i],r>e)break t}o=t.length;break i}{if(e>=n)break e;var s=t[1];s>e&&(i=2,n=s);for(var a=i-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(i===a)break;if(r=n,n=t[--i-1],e>=n)break t}o=i,i=0}}for(;o>i;){var c=i+o>>>1;e<t[c]?o=c:i=c+1}if(r=t[i],n=t[i-1],void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,n,e)}this._cachedIndex=i,this.intervalChanged_(i,n,r)}return this.interpolate_(i,n,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r,o=0;o!==r;++o)t[o]=i[n+o];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}},Object.assign(n.Interpolant.prototype,{beforeStart_:n.Interpolant.prototype.copySampleValue_,afterEnd_:n.Interpolant.prototype.copySampleValue_}),n.CubicInterpolant=function(e,t,i,r){n.Interpolant.call(this,e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0},n.CubicInterpolant.prototype=Object.assign(Object.create(n.Interpolant.prototype),{constructor:n.CubicInterpolant,DefaultSettings_:{endingStart:n.ZeroCurvatureEnding,endingEnd:n.ZeroCurvatureEnding},intervalChanged_:function(e,t,i){var r=this.parameterPositions,o=e-2,a=e+1,s=r[o],c=r[a];if(void 0===s)switch(this.getSettings_().endingStart){case n.ZeroSlopeEnding:o=e,s=2*t-i;break;case n.WrapAroundEnding:o=r.length-2,s=t+r[o]-r[o+1];break;default:o=e,s=i}if(void 0===c)switch(this.getSettings_().endingEnd){case n.ZeroSlopeEnding:a=e,c=2*i-t;break;case n.WrapAroundEnding:a=1,c=i+r[1]-r[0];break;default:a=e-1,c=t}var h=.5*(i-t),l=this.valueSize;this._weightPrev=h/(t-s),this._weightNext=h/(c-i),this._offsetPrev=o*l,this._offsetNext=a*l},interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(r-t),f=p*p,m=f*p,v=-u*m+2*u*f-u*p,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==a;++b)n[b]=v*o[h+b]+g*o[c+b]+y*o[s+b]+x*o[l+b];return n}}),n.DiscreteInterpolant=function(e,t,i,r){n.Interpolant.call(this,e,t,i,r)},n.DiscreteInterpolant.prototype=Object.assign(Object.create(n.Interpolant.prototype),{constructor:n.DiscreteInterpolant,interpolate_:function(e){return this.copySampleValue_(e-1)}}),n.LinearInterpolant=function(e,t,i,r){n.Interpolant.call(this,e,t,i,r)},n.LinearInterpolant.prototype=Object.assign(Object.create(n.Interpolant.prototype),{constructor:n.LinearInterpolant,interpolate_:function(e,t,i,r){for(var n=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,h=(i-t)/(r-t),l=1-h,u=0;u!==a;++u)n[u]=o[c+u]*l+o[s+u]*h;return n}}),n.QuaternionLinearInterpolant=function(e,t,i,r){n.Interpolant.call(this,e,t,i,r)},n.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(n.Interpolant.prototype),{constructor:n.QuaternionLinearInterpolant,interpolate_:function(e,t,i,r){for(var o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,c=e*s,h=(i-t)/(r-t),l=c+s;c!==l;c+=4)n.Quaternion.slerpFlat(o,0,a,c-s,a,c,h);return o}}),n.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},n.Clock.prototype={constructor:n.Clock,start:function(){this.startTime=performance.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=performance.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},n.EventDispatcher=function(){},n.EventDispatcher.prototype={constructor:n.EventDispatcher,apply:function(e){e.addEventListener=n.EventDispatcher.prototype.addEventListener,e.hasEventListener=n.EventDispatcher.prototype.hasEventListener,e.removeEventListener=n.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=n.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners,r=i[e];if(void 0!==r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,i=t[e.type];if(void 0!==i){e.target=this;for(var r=[],n=i.length,o=0;n>o;o++)r[o]=i[o];for(var o=0;n>o;o++)r[o].call(this,e)}}}},n.Layers=function(){this.mask=1},n.Layers.prototype={constructor:n.Layers,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}},function(e){function t(e,t){return e.distance-t.distance}function i(e,t,r,n){if(e.visible!==!1&&(e.raycast(t,r),n===!0))for(var o=e.children,a=0,s=o.length;s>a;a++)i(o[a],t,r,!0)}e.Raycaster=function(t,i,r,n){this.ray=new e.Ray(t,i),this.near=r||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,i){i instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(i.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(i).sub(this.ray.origin).normalize()):i instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,r){var n=[];return i(e,this,n,r),n.sort(t),n},intersectObjects:function(e,r){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++)i(e[o],this,n,r);return n.sort(t),n}}}(n),n.Object3D=function(){function e(){o.setFromEuler(r,!1)}function t(){r.setFromQuaternion(o,void 0,!1)}Object.defineProperty(this,"id",{value:n.Object3DIdCount++}),this.uuid=n.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.Object3D.DefaultUp.clone();var i=new n.Vector3,r=new n.Euler,o=new n.Quaternion,a=new n.Vector3(1,1,1);r.onChange(e),o.onChange(t),Object.defineProperties(this,{position:{enumerable:!0,value:i},rotation:{enumerable:!0,value:r},quaternion:{enumerable:!0,value:o},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new n.Matrix4},normalMatrix:{value:new n.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new n.Matrix4,this.matrixWorld=new n.Matrix4,this.matrixAutoUpdate=n.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new n.Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},n.Object3D.DefaultUp=new n.Vector3(0,1,0),n.Object3D.DefaultMatrixAutoUpdate=!0,n.Object3D.prototype={constructor:n.Object3D,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 n.Quaternion;return function(t,i){return e.setFromAxisAngle(t,i),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new n.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new n.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new n.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new n.Vector3;return function(t,i){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(i)),this}}(),translateX:function(){var e=new n.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new n.Vector3(0,1,0);
return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new n.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 n.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new n.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;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof n.Object3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var i=this.children.indexOf(e);-1!==i&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var i=0,r=this.children.length;r>i;i++){var n=this.children[i],o=n.getObjectByProperty(e,t);if(void 0!==o)return o}return void 0},getWorldPosition:function(e){var t=e||new n.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new n.Vector3,t=new n.Vector3;return function(i){var r=i||new n.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,r,t),r}}(),getWorldRotation:function(){var e=new n.Quaternion;return function(t){var i=t||new n.Euler;return this.getWorldQuaternion(e),i.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new n.Vector3,t=new n.Quaternion;return function(i){var r=i||new n.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,r),r}}(),getWorldDirection:function(){var e=new n.Quaternion;return function(t){var i=t||new n.Vector3;return this.getWorldQuaternion(e),i.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,i=0,r=t.length;r>i;i++)t[i].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,i=0,r=t.length;r>i;i++)t[i].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,i=this.children.length;i>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}var i=void 0===e,r={};i&&(e={geometries:{},materials:{},textures:{},images:{}},r.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;o<this.children.length;o++)n.children.push(this.children[o].toJSON(e).object)}if(i){var a=t(e.geometries),s=t(e.materials),c=t(e.textures),h=t(e.images);a.length>0&&(r.geometries=a),s.length>0&&(r.materials=s),c.length>0&&(r.textures=c),h.length>0&&(r.images=h)}return r.object=n,r},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 i=0;i<e.children.length;i++){var r=e.children[i];this.add(r.clone())}return this}},n.EventDispatcher.prototype.apply(n.Object3D.prototype),n.Object3DIdCount=0,n.Face3=function(e,t,i,r,o,a){this.a=e,this.b=t,this.c=i,this.normal=r instanceof n.Vector3?r:new n.Vector3,this.vertexNormals=Array.isArray(r)?r:[],this.color=o instanceof n.Color?o:new n.Color,this.vertexColors=Array.isArray(o)?o:[],this.materialIndex=void 0!==a?a:0},n.Face3.prototype={constructor:n.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,i=e.vertexNormals.length;i>t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,i=e.vertexColors.length;i>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},n.BufferAttribute=function(e,t){this.uuid=n.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},n.BufferAttribute.prototype={constructor:n.BufferAttribute,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,i){e*=this.itemSize,i*=t.itemSize;for(var r=0,n=this.itemSize;n>r;r++)this.array[e+r]=t.array[i+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,i=0,r=0,o=e.length;o>r;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new n.Color),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,i=0,r=0,n=e.length;n>r;r++){var o=e[r];t[i++]=o.a,t[i++]=o.b,t[i++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,i=0,r=0,o=e.length;o>r;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new n.Vector2),t[i++]=a.x,t[i++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,i=0,r=0,o=e.length;o>r;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new n.Vector3),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,i=0,r=0,o=e.length;o>r;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new n.Vector4),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.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,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this},setXYZ:function(e,t,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this},setXYZW:function(e,t,i,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},n.Int8Attribute=function(e,t){return new n.BufferAttribute(new Int8Array(e),t)},n.Uint8Attribute=function(e,t){return new n.BufferAttribute(new Uint8Array(e),t)},n.Uint8ClampedAttribute=function(e,t){return new n.BufferAttribute(new Uint8ClampedArray(e),t)},n.Int16Attribute=function(e,t){return new n.BufferAttribute(new Int16Array(e),t)},n.Uint16Attribute=function(e,t){return new n.BufferAttribute(new Uint16Array(e),t)},n.Int32Attribute=function(e,t){return new n.BufferAttribute(new Int32Array(e),t)},n.Uint32Attribute=function(e,t){return new n.BufferAttribute(new Uint32Array(e),t)},n.Float32Attribute=function(e,t){return new n.BufferAttribute(new Float32Array(e),t)},n.Float64Attribute=function(e,t){return new n.BufferAttribute(new Float64Array(e),t)},n.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new n.BufferAttribute(e,t).setDynamic(!0)},n.InstancedBufferAttribute=function(e,t,i){n.BufferAttribute.call(this,e,t),this.meshPerAttribute=i||1},n.InstancedBufferAttribute.prototype=Object.create(n.BufferAttribute.prototype),n.InstancedBufferAttribute.prototype.constructor=n.InstancedBufferAttribute,n.InstancedBufferAttribute.prototype.copy=function(e){return n.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},n.InterleavedBuffer=function(e,t){this.uuid=n.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},n.InterleavedBuffer.prototype={constructor:n.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){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.stride,i*=t.stride;for(var r=0,n=this.stride;n>r;r++)this.array[e+r]=t.array[i+r];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)}},n.InstancedInterleavedBuffer=function(e,t,i){n.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=i||1},n.InstancedInterleavedBuffer.prototype=Object.create(n.InterleavedBuffer.prototype),n.InstancedInterleavedBuffer.prototype.constructor=n.InstancedInterleavedBuffer,n.InstancedInterleavedBuffer.prototype.copy=function(e){return n.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},n.InterleavedBufferAttribute=function(e,t,i){this.uuid=n.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=i},n.InterleavedBufferAttribute.prototype={constructor:n.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},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,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this},setXYZ:function(e,t,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this},setXYZW:function(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}},n.Geometry=function(){Object.defineProperty(this,"id",{value:n.GeometryIdCount++}),this.uuid=n.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},n.Geometry.prototype={constructor:n.Geometry,applyMatrix:function(e){for(var t=(new n.Matrix3).getNormalMatrix(e),i=0,r=this.vertices.length;r>i;i++){var o=this.vertices[i];o.applyMatrix4(e)}for(var i=0,r=this.faces.length;r>i;i++){var a=this.faces[i];a.normal.applyMatrix3(t).normalize();for(var s=0,c=a.vertexNormals.length;c>s;s++)a.vertexNormals[s].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,i,r){return void 0===e&&(e=new n.Matrix4),e.makeTranslation(t,i,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,i,r){return void 0===e&&(e=new n.Matrix4),e.makeScale(t,i,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new n.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,r,o){var a=void 0!==s?[u[e].clone(),u[t].clone(),u[r].clone()]:[],f=void 0!==c?[i.colors[e].clone(),i.colors[t].clone(),i.colors[r].clone()]:[],m=new n.Face3(e,t,r,a,f,o);i.faces.push(m),void 0!==h&&i.faceVertexUvs[0].push([d[e].clone(),d[t].clone(),d[r].clone()]),void 0!==l&&i.faceVertexUvs[1].push([p[e].clone(),p[t].clone(),p[r].clone()])}var i=this,r=null!==e.index?e.index.array:void 0,o=e.attributes,a=o.position.array,s=void 0!==o.normal?o.normal.array:void 0,c=void 0!==o.color?o.color.array:void 0,h=void 0!==o.uv?o.uv.array:void 0,l=void 0!==o.uv2?o.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var u=[],d=[],p=[],f=0,m=0;f<a.length;f+=3,m+=2)i.vertices.push(new n.Vector3(a[f],a[f+1],a[f+2])),void 0!==s&&u.push(new n.Vector3(s[f],s[f+1],s[f+2])),void 0!==c&&i.colors.push(new n.Color(c[f],c[f+1],c[f+2])),void 0!==h&&d.push(new n.Vector2(h[m],h[m+1])),void 0!==l&&p.push(new n.Vector2(l[m],l[m+1]));if(void 0!==r){var v=e.groups;if(v.length>0)for(var f=0;f<v.length;f++)for(var g=v[f],y=g.start,x=g.count,m=y,b=y+x;b>m;m+=3)t(r[m],r[m+1],r[m+2],g.materialIndex);else for(var f=0;f<r.length;f+=3)t(r[f],r[f+1],r[f+2])}else for(var f=0;f<a.length/3;f+=3)t(f,f+1,f+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,r=new n.Matrix4;return r.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new n.Vector3,t=new n.Vector3,i=0,r=this.faces.length;r>i;i++){var o=this.faces[i],a=this.vertices[o.a],s=this.vertices[o.b],c=this.vertices[o.c];e.subVectors(c,s),t.subVectors(a,s),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,i,r,o,a,s;for(s=new Array(this.vertices.length),t=0,i=this.vertices.length;i>t;t++)s[t]=new n.Vector3;if(e){var c,h,l,u=new n.Vector3,d=new n.Vector3;for(r=0,o=this.faces.length;o>r;r++)a=this.faces[r],c=this.vertices[a.a],h=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,h),d.subVectors(c,h),u.cross(d),s[a.a].add(u),s[a.b].add(u),s[a.c].add(u)}else for(r=0,o=this.faces.length;o>r;r++)a=this.faces[r],s[a.a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(t=0,i=this.vertices.length;i>t;t++)s[t].normalize();for(r=0,o=this.faces.length;o>r;r++){a=this.faces[r];var p=a.vertexNormals;3===p.length?(p[0].copy(s[a.a]),p[1].copy(s[a.b]),p[2].copy(s[a.c])):(p[0]=s[a.a].clone(),p[1]=s[a.b].clone(),p[2]=s[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,r,o;for(i=0,r=this.faces.length;r>i;i++)for(o=this.faces[i],o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),e=0,t=o.vertexNormals.length;t>e;e++)o.__originalVertexNormals[e]?o.__originalVertexNormals[e].copy(o.vertexNormals[e]):o.__originalVertexNormals[e]=o.vertexNormals[e].clone();var a=new n.Geometry;for(a.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 s,c,h=this.morphNormals[e].faceNormals,l=this.morphNormals[e].vertexNormals;for(i=0,r=this.faces.length;r>i;i++)s=new n.Vector3,c={a:new n.Vector3,b:new n.Vector3,c:new n.Vector3},h.push(s),l.push(c)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var s,c;for(i=0,r=this.faces.length;r>i;i++)o=this.faces[i],s=u.faceNormals[i],c=u.vertexNormals[i],s.copy(o.normal),c.a.copy(o.vertexNormals[0]),c.b.copy(o.vertexNormals[1]),c.c.copy(o.vertexNormals[2])}for(i=0,r=this.faces.length;r>i;i++)o=this.faces[i],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,i=0,r=t.length;r>i;i++)i>0&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(e instanceof n.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var r,o=this.vertices.length,a=this.vertices,s=e.vertices,c=this.faces,h=e.faces,l=this.faceVertexUvs[0],u=e.faceVertexUvs[0];void 0===i&&(i=0),void 0!==t&&(r=(new n.Matrix3).getNormalMatrix(t));for(var d=0,p=s.length;p>d;d++){var f=s[d],m=f.clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(d=0,p=h.length;p>d;d++){var v,g,y,x=h[d],b=x.vertexNormals,w=x.vertexColors;v=new n.Face3(x.a+o,x.b+o,x.c+o),v.normal.copy(x.normal),void 0!==r&&v.normal.applyMatrix3(r).normalize();for(var M=0,_=b.length;_>M;M++)g=b[M].clone(),void 0!==r&&g.applyMatrix3(r).normalize(),v.vertexNormals.push(g);v.color.copy(x.color);for(var M=0,_=w.length;_>M;M++)y=w[M],v.vertexColors.push(y.clone());v.materialIndex=x.materialIndex+i,c.push(v)}for(d=0,p=u.length;p>d;d++){var E=u[d],A=[];if(void 0!==E){for(var M=0,_=E.length;_>M;M++)A.push(E[M].clone());l.push(A)}}},mergeMesh:function(e){return e instanceof n.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,i,r,n,o,a,s,c={},h=[],l=[],u=4,d=Math.pow(10,u);for(i=0,r=this.vertices.length;r>i;i++)e=this.vertices[i],t=Math.round(e.x*d)+"_"+Math.round(e.y*d)+"_"+Math.round(e.z*d),void 0===c[t]?(c[t]=i,h.push(this.vertices[i]),l[i]=h.length-1):l[i]=l[c[t]];var p=[];for(i=0,r=this.faces.length;r>i;i++){n=this.faces[i],n.a=l[n.a],n.b=l[n.b],n.c=l[n.c],o=[n.a,n.b,n.c];for(var f=-1,m=0;3>m;m++)if(o[m]===o[(m+1)%3]){f=m,p.push(i);break}}for(i=p.length-1;i>=0;i--){var v=p[i];for(this.faces.splice(v,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(v,1)}var g=this.vertices.length-h.length;return this.vertices=h,g},sortFacesByMaterialIndex:function(){function e(e,t){return e.materialIndex-t.materialIndex}for(var t=this.faces,i=t.length,r=0;i>r;r++)t[r]._id=r;t.sort(e);var n,o,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===i&&(n=[]),s&&s.length===i&&(o=[]);for(var r=0;i>r;r++){var c=t[r]._id;n&&n.push(a[c]),o&&o.push(s[c])}n&&(this.faceVertexUvs[0]=n),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){function e(e,t,i){return i?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==d[t]?d[t]:(d[t]=u.length/3,u.push(e.x,e.y,e.z),d[t])}function i(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==f[t]?f[t]:(f[t]=p.length,p.push(e.getHex()),f[t])}function r(e){var t=e.x.toString()+e.y.toString();return void 0!==v[t]?v[t]:(v[t]=m.length/2,m.push(e.x,e.y),v[t])}var n={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var o=this.parameters;for(var a in o)void 0!==o[a]&&(n[a]=o[a]);return n}for(var s=[],c=0;c<this.vertices.length;c++){var h=this.vertices[c];s.push(h.x,h.y,h.z)}for(var l=[],u=[],d={},p=[],f={},m=[],v={},c=0;c<this.faces.length;c++){var g=this.faces[c],y=!0,x=!1,b=void 0!==this.faceVertexUvs[0][c],w=g.normal.length()>0,M=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,A=0;if(A=e(A,0,0),A=e(A,1,y),A=e(A,2,x),A=e(A,3,b),A=e(A,4,w),A=e(A,5,M),A=e(A,6,_),A=e(A,7,E),l.push(A),l.push(g.a,g.b,g.c),l.push(g.materialIndex),b){var S=this.faceVertexUvs[0][c];l.push(r(S[0]),r(S[1]),r(S[2]))}if(w&&l.push(t(g.normal)),M){var T=g.vertexNormals;l.push(t(T[0]),t(T[1]),t(T[2]))}if(_&&l.push(i(g.color)),E){var C=g.vertexColors;l.push(i(C[0]),i(C[1]),i(C[2]))}}return n.data={},n.data.vertices=s,n.data.normals=u,p.length>0&&(n.data.colors=p),m.length>0&&(n.data.uvs=[m]),n.data.faces=l,n},clone:function(){return(new n.Geometry).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,i=0,r=t.length;r>i;i++)this.vertices.push(t[i].clone());for(var n=e.faces,i=0,r=n.length;r>i;i++)this.faces.push(n[i].clone());for(var i=0,r=e.faceVertexUvs.length;r>i;i++){var o=e.faceVertexUvs[i];void 0===this.faceVertexUvs[i]&&(this.faceVertexUvs[i]=[]);for(var a=0,s=o.length;s>a;a++){for(var c=o[a],h=[],l=0,u=c.length;u>l;l++){var d=c[l];h.push(d.clone())}this.faceVertexUvs[i].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},n.EventDispatcher.prototype.apply(n.Geometry.prototype),n.GeometryIdCount=0,n.DirectGeometry=function(){Object.defineProperty(this,"id",{value:n.GeometryIdCount++}),this.uuid=n.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},n.DirectGeometry.prototype={constructor:n.DirectGeometry,computeBoundingBox:n.Geometry.prototype.computeBoundingBox,computeBoundingSphere:n.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,i,r=[],n=e.faces,o=0;o<n.length;o++){var a=n[o];a.materialIndex!==i&&(i=a.materialIndex,void 0!==t&&(t.count=3*o-t.start,r.push(t)),t={start:3*o,materialIndex:i})}void 0!==t&&(t.count=3*o-t.start,r.push(t)),this.groups=r},fromGeometry:function(e){var t,i=e.faces,r=e.vertices,o=e.faceVertexUvs,a=o[0]&&o[0].length>0,s=o[1]&&o[1].length>0,c=e.morphTargets,h=c.length;if(h>0){t=[];for(var l=0;h>l;l++)t[l]=[];this.morphTargets.position=t}var u,d=e.morphNormals,p=d.length;if(p>0){u=[];for(var l=0;p>l;l++)u[l]=[];this.morphTargets.normal=u}for(var f=e.skinIndices,m=e.skinWeights,v=f.length===r.length,g=m.length===r.length,l=0;l<i.length;l++){var y=i[l];this.vertices.push(r[y.a],r[y.b],r[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var b=y.normal;this.normals.push(b,b,b)}var w=y.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var M=y.color;this.colors.push(M,M,M)}if(a===!0){var _=o[0][l];void 0!==_?this.uvs.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new n.Vector2,new n.Vector2,new n.Vector2))}if(s===!0){var _=o[1][l];void 0!==_?this.uvs2.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new n.Vector2,new n.Vector2,new n.Vector2))}for(var E=0;h>E;E++){var A=c[E].vertices;t[E].push(A[y.a],A[y.b],A[y.c])}for(var E=0;p>E;E++){var S=d[E].vertexNormals[l];u[E].push(S.a,S.b,S.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.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"})}},n.EventDispatcher.prototype.apply(n.DirectGeometry.prototype),n.BufferGeometry=function(){Object.defineProperty(this,"id",{value:n.GeometryIdCount++}),this.uuid=n.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}},n.BufferGeometry.prototype={constructor:n.BufferGeometry,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t){return t instanceof n.BufferAttribute==!1&&t instanceof n.InterleavedBufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new n.BufferAttribute(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i: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 i=this.attributes.normal;if(void 0!==i){var r=(new n.Matrix3).getNormalMatrix(e);r.applyToVector3Array(i.array),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,i,r){return void 0===e&&(e=new n.Matrix4),e.makeTranslation(t,i,r),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,i,r){return void 0===e&&(e=new n.Matrix4),e.makeScale(t,i,r),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new n.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 n.Points||e instanceof n.Line){var i=new n.Float32Attribute(3*t.vertices.length,3),r=new n.Float32Attribute(3*t.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var o=new n.Float32Attribute(t.lineDistances.length,1);this.addAttribute("lineDistance",o.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof n.Mesh&&t instanceof n.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof n.Mesh){var i=t.__directGeometry;if(void 0===i)return this.fromGeometry(t);i.verticesNeedUpdate=t.verticesNeedUpdate,i.normalsNeedUpdate=t.normalsNeedUpdate,i.colorsNeedUpdate=t.colorsNeedUpdate,i.uvsNeedUpdate=t.uvsNeedUpdate,i.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=i}if(t.verticesNeedUpdate===!0){var r=this.attributes.position;void 0!==r&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1}if(t.normalsNeedUpdate===!0){var r=this.attributes.normal;void 0!==r&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1}if(t.colorsNeedUpdate===!0){var r=this.attributes.color;void 0!==r&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){var r=this.attributes.uv;void 0!==r&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){var r=this.attributes.lineDistance;void 0!==r&&(r.copyArray(t.lineDistances),r.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 n.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new n.BufferAttribute(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new n.BufferAttribute(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new n.BufferAttribute(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var o=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new n.BufferAttribute(o,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new n.BufferAttribute(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var s=e.vertices.length>65535?Uint32Array:Uint16Array,c=new s(3*e.indices.length);this.setIndex(new n.BufferAttribute(c,1).copyIndicesArray(e.indices));
}this.groups=e.groups;for(var h in e.morphTargets){for(var l=[],u=e.morphTargets[h],d=0,p=u.length;p>d;d++){var f=u[d],m=new n.Float32Attribute(3*f.length,3);l.push(m.copyVector3sArray(f))}this.morphAttributes[h]=l}if(e.skinIndices.length>0){var v=new n.Float32Attribute(4*e.skinIndices.length,4);this.addAttribute("skinIndex",v.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var g=new n.Float32Attribute(4*e.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){new n.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.position.array;e&&this.boundingBox.setFromArray(e),(void 0===e||0===e.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 n.Box3,t=new n.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere);var i=this.attributes.position.array;if(i){var r=this.boundingSphere.center;e.setFromArray(i),e.center(r);for(var o=0,a=0,s=i.length;s>a;a+=3)t.fromArray(i,a),o=Math.max(o,r.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(o),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,i=this.groups;if(t.position){var r=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new n.BufferAttribute(new Float32Array(r.length),3));else for(var o=t.normal.array,a=0,s=o.length;s>a;a++)o[a]=0;var c,h,l,u=t.normal.array,d=new n.Vector3,p=new n.Vector3,f=new n.Vector3,m=new n.Vector3,v=new n.Vector3;if(e){var g=e.array;0===i.length&&this.addGroup(0,g.length);for(var y=0,x=i.length;x>y;++y)for(var b=i[y],w=b.start,M=b.count,a=w,s=w+M;s>a;a+=3)c=3*g[a+0],h=3*g[a+1],l=3*g[a+2],d.fromArray(r,c),p.fromArray(r,h),f.fromArray(r,l),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var a=0,s=r.length;s>a;a+=9)d.fromArray(r,a),p.fromArray(r,a+3),f.fromArray(r,a+6),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),u[a]=m.x,u[a+1]=m.y,u[a+2]=m.z,u[a+3]=m.x,u[a+4]=m.y,u[a+5]=m.z,u[a+6]=m.x,u[a+7]=m.y,u[a+8]=m.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e instanceof n.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var i=this.attributes;for(var r in i)if(void 0!==e.attributes[r])for(var o=i[r],a=o.array,s=e.attributes[r],c=s.array,h=s.itemSize,l=0,u=h*t;l<c.length;l++,u++)a[u]=c[l];return this},normalizeNormals:function(){for(var e,t,i,r,n=this.attributes.normal.array,o=0,a=n.length;a>o;o+=3)e=n[o],t=n[o+1],i=n[o+2],r=1/Math.sqrt(e*e+t*t+i*i),n[o]*=r,n[o+1]*=r,n[o+2]*=r},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new n.BufferGeometry,t=this.index.array,i=this.attributes;for(var r in i){for(var o=i[r],a=o.array,s=o.itemSize,c=new a.constructor(t.length*s),h=0,l=0,u=0,d=t.length;d>u;u++){h=t[u]*s;for(var p=0;s>p;p++)c[l++]=a[h++]}e.addAttribute(r,new n.BufferAttribute(c,s))}return e},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 i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};var r=this.index;if(null!==r){var n=Array.prototype.slice.call(r.array);e.data.index={type:r.array.constructor.name,array:n}}var o=this.attributes;for(var i in o){var a=o[i],n=Array.prototype.slice.call(a.array);e.data.attributes[i]={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 c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new n.BufferGeometry).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var r in i){var n=i[r];this.addAttribute(r,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var c=o[a];this.addGroup(c.start,c.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},n.EventDispatcher.prototype.apply(n.BufferGeometry.prototype),n.BufferGeometry.MaxIndex=65535,n.InstancedBufferGeometry=function(){n.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},n.InstancedBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.InstancedBufferGeometry.prototype.constructor=n.InstancedBufferGeometry,n.InstancedBufferGeometry.prototype.addGroup=function(e,t,i){this.groups.push({start:e,count:t,instances:i})},n.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var r in i){var n=i[r];this.addAttribute(r,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var c=o[a];this.addGroup(c.start,c.count,c.instances)}return this},n.EventDispatcher.prototype.apply(n.InstancedBufferGeometry.prototype),n.Uniform=function(e,t){this.type=e,this.value=t,this.dynamic=!1},n.Uniform.prototype={constructor:n.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},n.AnimationClip=function(e,t,i){this.name=e||n.Math.generateUUID(),this.tracks=i,this.duration=void 0!==t?t:-1,this.duration<0&&this.resetDuration(),this.trim(),this.optimize()},n.AnimationClip.prototype={constructor:n.AnimationClip,resetDuration:function(){for(var e=this.tracks,t=0,i=0,r=e.length;i!==r;++i){var n=this.tracks[i];t=Math.max(t,n.times[n.times.length-1])}this.duration=t},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(n.AnimationClip,{parse:function(e){for(var t=[],i=e.tracks,r=1/(e.fps||1),o=0,a=i.length;o!==a;++o)t.push(n.KeyframeTrack.parse(i[o]).scale(r));return new n.AnimationClip(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t},o=0,a=i.length;o!==a;++o)t.push(n.KeyframeTrack.toJSON(i[o]));return r},CreateFromMorphTargetSequence:function(e,t,i){for(var r=t.length,o=[],a=0;r>a;a++){var s=[],c=[];s.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);var h=n.AnimationUtils.getKeyframeOrder(s);s=n.AnimationUtils.sortedArray(s,1,h),c=n.AnimationUtils.sortedArray(c,1,h),0===s[0]&&(s.push(r),c.push(c[0])),o.push(new n.NumberKeyframeTrack(".morphTargetInfluences["+t[a].name+"]",s,c).scale(1/i))}return new n.AnimationClip(e,-1,o)},findByName:function(e,t){for(var i=0;i<e.length;i++)if(e[i].name===t)return e[i];return null},CreateClipsFromMorphTargetSequences:function(e,t){for(var i={},r=/^([\w-]*?)([\d]+)$/,o=0,a=e.length;a>o;o++){var s=e[o],c=s.name.match(r);if(c&&c.length>1){var h=c[1],l=i[h];l||(i[h]=l=[]),l.push(s)}}var u=[];for(var h in i)u.push(n.AnimationClip.CreateFromMorphTargetSequence(h,i[h],t));return u},parseAnimation:function(e,t){if(!e)return console.error(" no animation in JSONLoader data"),null;for(var i=function(e,t,i,r,o){if(0!==i.length){var a=[],s=[];n.AnimationUtils.flattenJSON(i,a,s,r),0!==a.length&&o.push(new e(t,a,s))}},r=[],o=e.name||"default",a=e.length||-1,s=e.fps||30,c=e.hierarchy||[],h=0;h<c.length;h++){var l=c[h].keys;if(l&&0!=l.length)if(l[0].morphTargets){for(var u={},d=0;d<l.length;d++)if(l[d].morphTargets)for(var p=0;p<l[d].morphTargets.length;p++)u[l[d].morphTargets[p]]=-1;for(var f in u){for(var m=[],v=[],p=0;p!==l[d].morphTargets.length;++p){var g=l[d];m.push(g.time),v.push(g.morphTarget===f?1:0)}r.push(new n.NumberKeyframeTrack(".morphTargetInfluence["+f+"]",m,v))}a=u.length*(s||1)}else{var y=".bones["+t[h].name+"]";i(n.VectorKeyframeTrack,y+".position",l,"pos",r),i(n.QuaternionKeyframeTrack,y+".quaternion",l,"rot",r),i(n.VectorKeyframeTrack,y+".scale",l,"scl",r)}}if(0===r.length)return null;var x=new n.AnimationClip(o,a,r);return x}}),n.AnimationMixer=function(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1},n.AnimationMixer.prototype={constructor:n.AnimationMixer,clipAction:function(e,t){var i,r=t||this._root,o=r.uuid,a="string"==typeof e?e:e.name,s=e!==a?e:null,c=this._actionsByClip[a];if(void 0!==c){var h=c.actionByRoot[o];if(void 0!==h)return h;if(i=c.knownActions[0],s=i._clip,e!==a&&e!==s)throw new Error("Different clips with the same name detected!")}if(null===s)return null;var l=new n.AnimationMixer._Action(this,s,t);return this._bindAction(l,i),this._addInactiveAction(l,a,o),l},existingAction:function(e,t){var i=t||this._root,r=i.uuid,n="string"==typeof e?e:e.name,o=this._actionsByClip[n];return void 0!==o?o.actionByRoot[r]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,i=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var n=0;n!==t;++n)e[n].reset();for(var n=0;n!==r;++n)i[n].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,i=this._nActiveActions,r=this.time+=e,n=Math.sign(e),o=this._accuIndex^=1,a=0;a!==i;++a){var s=t[a];s.enabled&&s._update(r,e,n,o)}for(var c=this._bindings,h=this._nActiveBindings,a=0;a!==h;++a)c[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,i=e.name,r=this._actionsByClip,n=r[i];if(void 0!==n){for(var o=n.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var h=c._cacheIndex,l=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=h,t[h]=l,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}},uncacheRoot:function(e){var t=e.uuid,i=this._actionsByClip;for(var r in i){var n=i[r].actionByRoot,o=n[t];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[t];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(e,t){var i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}},n.EventDispatcher.prototype.apply(n.AnimationMixer.prototype),n.AnimationMixer._Action=function(e,t,i){this._mixer=e,this._clip=t,this._localRoot=i||null;for(var r=t.tracks,o=r.length,a=new Array(o),s={endingStart:n.ZeroCurvatureEnding,endingEnd:n.ZeroCurvatureEnding},c=0;c!==o;++c){var h=r[c].createInterpolant(null);a[c]=h,h.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=n.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0},n.AnimationMixer._Action.prototype={constructor:n.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){this._startTime;return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,i){this._mixer;if(e.fadeOut(t),this.fadeIn(t),i){var r=this._clip.duration,n=e._clip.duration,o=n/r,a=r/n;e.warp(1,o,t),this.warp(a,1,t)}return this},crossFadeTo:function(e,t,i){return e.crossFadeFrom(this,t,i)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._currentTimeScale,0,e)},warp:function(e,t,i){var r=this._mixer,n=r.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=n,s[1]=n+i,c[0]=e/a,c[1]=t/a,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,i,r){var n=this._startTime;if(null!==n){var o=(e-n)*i;if(0>o||0===i)return;this._startTime=null,t=i*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(a),h[l].accumulate(r,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.pause=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,r=this.loop,o=this._loopCount,a=!1;switch(r){case n.LoopOnce:if(-1===o&&(this.loopCount=0,this._setEndings(!0,!0,!1)),t>=i)t=i;else{if(!(0>t))break;t=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1});break;case n.LoopPingPong:a=!0;case n.LoopRepeat:if(-1===o&&(e>0?(o=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=i||0>t){var s=Math.floor(t/i);t-=i*s,o+=Math.abs(s);var c=this.repetitions-o;if(0>c){this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});break}if(0===c){var h=0>e;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=o,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}if(r===n.LoopPingPong&&1===(1&o))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var r=this._interpolantSettings;i?(r.endingStart=n.ZeroSlopeEnding,r.endingEnd=n.ZeroSlopeEnding):(r.endingStart=e?this.zeroSlopeAtStart?n.ZeroSlopeEnding:n.ZeroCurvatureEnding:n.WrapAroundEnding,r.endingEnd=t?this.zeroSlopeAtEnd?n.ZeroSlopeEnding:n.ZeroCurvatureEnding:n.WrapAroundEnding)},_scheduleFading:function(e,t,i){var r=this._mixer,n=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=n,s[0]=t,a[1]=n+e,s[1]=i,this}},Object.assign(n.AnimationMixer.prototype,{_bindAction:function(e,t){var i=e._localRoot||this._root,r=e._clip.tracks,o=r.length,a=e._propertyBindings,s=e._interpolants,c=i.uuid,h=this._bindingsByRootAndName,l=h[c];void 0===l&&(l={},h[c]=l);for(var u=0;u!==o;++u){var d=r[u],p=d.name,f=l[p];if(void 0!==f)a[u]=f;else{if(f=a[u],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,c,p));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;f=new n.PropertyMixer(n.PropertyBinding.create(i,p,m),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,c,p),a[u]=f}s[u].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.name,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,o=0,a=n.length;o!==a;++o){var s=n[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,i){var r=this._actions,n=this._actionsByClip,o=n[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=o;else{var a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e},_removeInactiveAction:function(e){var t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;var n=e._clip.name,o=this._actionsByClip,a=o[n],s=a.knownActions,c=s[s.length-1],h=e._byClipCacheIndex;c._byClipCacheIndex=h,s[h]=c,s.pop(),e._byClipCacheIndex=null;var l=a.actionByRoot,u=(t._localRoot||this._root).uuid;delete l[u],0===s.length&&delete o[n],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0===--n.referenceCount&&this._removeInactiveBinding(n)}},_lendAction:function(e){var t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n},_takeBackAction:function(e){var t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n},_addInactiveBinding:function(e,t,i){var r=this._bindingsByRootAndName,n=r[t],o=this._bindings;void 0===n&&(n={},r[t]=n),n[i]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,i=e.binding,r=i.rootNode.uuid,n=i.path,o=this._bindingsByRootAndName,a=o[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete a[n];e:{for(var h in a)break e;delete o[r]}},_lendBinding:function(e){var t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n},_takeBackBinding:function(e){var t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&(i=new n.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=t,e[t]=i),i},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,n=t[r];e.__cacheIndex=r,t[r]=e,n.__cacheIndex=i,t[i]=n},_controlInterpolantsResultBuffer:new Float32Array(1)}),n.AnimationObjectGroup=function(){this.uuid=n.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,i=arguments.length;t!==i;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}},n.AnimationObjectGroup.prototype={constructor:n.AnimationObjectGroup,add:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,c=s.length,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],d=u.uuid,p=r[d];if(void 0===p){p=t++,r[d]=p,e.push(u);for(var f=0,m=c;f!==m;++f)s[f].push(new n.PropertyBinding(u,o[f],a[f]))}else if(i>p){var v=e[p],g=--i,y=e[g];r[y.uuid]=p,e[p]=y,r[d]=g,e[g]=u;for(var f=0,m=c;f!==m;++f){var x=s[f],b=x[g],w=x[p];x[p]=b,void 0===w&&(w=new n.PropertyBinding(u,o[f],a[f])),x[g]=w}}else e[p]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(){for(var e=this._objects,t=(e.length,this.nCachedObjects_),i=this._indicesByUUID,r=this._bindings,n=r.length,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],c=s.uuid,h=i[c];if(void 0!==h&&h>=t){var l=t++,u=e[l];i[u.uuid]=h,e[h]=u,i[c]=l,e[l]=s;for(var d=0,p=n;d!==p;++d){var f=r[d],m=f[l],v=f[h];f[h]=m,f[l]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],h=c.uuid,l=r[h];if(void 0!==l)if(delete r[h],i>l){var u=--i,d=e[u],p=--t,f=e[p];r[d.uuid]=l,e[l]=d,r[f.uuid]=u,e[u]=f,e.pop();for(var m=0,v=o;m!==v;++m){var g=n[m],y=g[u],x=g[p];g[l]=y,g[u]=x,g.pop()}}else{var p=--t,f=e[p];r[f.uuid]=l,e[l]=f,e.pop();for(var m=0,v=o;m!==v;++m){var g=n[m];g[l]=g[p],g.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){var i=this._bindingsIndicesByPath,r=i[e],o=this._bindings;if(void 0!==r)return o[r];var a=this._paths,s=this._parsedPaths,c=this._objects,h=c.length,l=this.nCachedObjects_,u=new Array(h);r=o.length,i[e]=r,a.push(e),s.push(t),o.push(u);for(var d=l,p=c.length;d!==p;++d){var f=c[d];u[d]=new n.PropertyBinding(f,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,i=t[e];if(void 0!==i){var r=this._paths,n=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a],c=e[a];t[c]=i,o[i]=s,o.pop(),n[i]=n[a],n.pop(),r[i]=r[a],r.pop()}}},n.AnimationUtils={arraySlice:function(e,t,i){return n.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,i)):e.slice(t,i)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,i){return e[t]-e[i]}for(var i=e.length,r=new Array(i),n=0;n!==i;++n)r[n]=n;return r.sort(t),r},sortedArray:function(e,t,i){for(var r=e.length,n=new e.constructor(r),o=0,a=0;a!==r;++o)for(var s=i[o]*t,c=0;c!==t;++c)n[a++]=e[s+c];return n},flattenJSON:function(e,t,i,r){for(var n=1,o=e[0];void 0!==o&&void 0===o[r];)o=e[n++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a)){do a=o[r],void 0!==a&&(t.push(o.time),i.push.apply(i,a)),o=e[n++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[r],void 0!==a&&(t.push(o.time),a.toArray(i,i.length)),o=e[n++];while(void 0!==o)}else do a=o[r],void 0!==a&&(t.push(o.time),i.push(a)),o=e[n++];while(void 0!==o)}}},n.KeyframeTrack=function(e,t,i,r){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=n.AnimationUtils.convertArray(t,this.TimeBufferType),this.values=n.AnimationUtils.convertArray(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()},n.KeyframeTrack.prototype={constructor:n.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:n.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(e){return new n.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new n.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new n.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t=void 0;switch(e){case n.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case n.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case n.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(i)}this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return n.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return n.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return n.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,i=0,r=t.length;i!==r;++i)t[i]*=e;return this},trim:function(e,t){for(var i=this.times,r=i.length,o=0,a=r-1;o!==r&&i[o]<e;)++o;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==o||a!==r){o>=a&&(a=Math.max(a,1),o=a-1);var s=this.getValueSize();this.times=n.AnimationUtils.arraySlice(i,o,a),this.values=n.AnimationUtils.arraySlice(this.values,o*s,a*s)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("invalid value size in track",this),e=!1);var i=this.times,r=this.values,o=i.length;0===o&&(console.error("track is empty",this),e=!1);for(var a=null,s=0;s!==o;s++){var c=i[s];if("number"==typeof c&&isNaN(c)){console.error("time is not a valid number",this,s,c),e=!1;break}if(null!==a&&a>c){console.error("out of order keys",this,s,c,a),e=!1;break}a=c}if(void 0!==r&&n.AnimationUtils.isTypedArray(r))for(var s=0,h=r.length;s!==h;++s){var l=r[s];if(isNaN(l)){console.error("value is not a valid number",this,s,l),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),r=1,o=1,a=e.length-1;a>=o;++o){var s=!1,c=e[o],h=e[o+1];if(c!==h&&(1!==o||c!==c[0]))for(var l=o*i,u=l-i,d=l+i,p=0;p!==i;++p){var f=t[l+p];if(f!==t[u+p]||f!==t[d+p]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];for(var m=o*i,v=r*i,p=0;p!==i;++p)t[v+p]=t[m+p]}++r}}return r!==e.length&&(this.times=n.AnimationUtils.arraySlice(e,0,r),this.values=n.AnimationUtils.arraySlice(t,0,r*i)),this}},Object.assign(n.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=n.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){console.warn("legacy JSON format detected, converting");var i=[],r=[];n.AnimationUtils.flattenJSON(e.keys,i,r,"value"),e.times=i,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,i=e.constructor;if(void 0!==i.toJSON)t=i.toJSON(e);else{t={name:e.name,times:n.AnimationUtils.convertArray(e.times,Array),values:n.AnimationUtils.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return n.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return n.VectorKeyframeTrack;case"color":return n.ColorKeyframeTrack;case"quaternion":return n.QuaternionKeyframeTrack;case"bool":case"boolean":return n.BooleanKeyframeTrack;case"string":return n.StringKeyframeTrack}throw new Error("Unsupported typeName: "+e)}}),n.PropertyBinding=function(e,t,i){this.path=t,this.parsedPath=i||n.PropertyBinding.parseTrackName(t),this.node=n.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},n.PropertyBinding.prototype={constructor:n.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,o=t.propertyIndex;if(e||(e=n.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var a=t.objectIndex;switch(i){case"materials":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;break;case"bones":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 s=0;s<e.length;s++)if(e[s].name===a){a=s;break}break;default:if(void 0===e[i])return void console.error(" can not bind to objectName of node, undefined",this);e=e[i]}if(void 0!==a){if(void 0===e[a])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[a]}}var c=e[r];if(!c){var h=t.nodeName;return void console.error(" trying to update property for track: "+h+"."+r+" but it wasn't found.",e)}var l=this.Versioning.None;void 0!==e.needsUpdate?(l=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var u=this.BindingType.Direct;if(void 0!==o){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var s=0;s<this.node.geometry.morphTargets.length;s++)if(e.geometry.morphTargets[s].name===o){o=s;break}}u=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=o}else void 0!==c.fromArray&&void 0!==c.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=c):void 0!==c.length?(u=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(n.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:n.PropertyBinding.prototype.getValue,
_setValue_unbound:n.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)e[t++]=i[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++]},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),n.PropertyBinding.Composite=function(e,t,i){var r=i||n.PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)},n.PropertyBinding.Composite.prototype={constructor:n.PropertyBinding.Composite,getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},n.PropertyBinding.create=function(e,t,i){return e instanceof n.AnimationObjectGroup?new n.PropertyBinding.Composite(e,t,i):new n.PropertyBinding(e,t,i)},n.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_.:\- ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,i=t.exec(e);if(!i)throw new Error("cannot parse trackName at all: "+e);i.index===t.lastIndex&&t.lastIndex++;var r={nodeName:i[3],objectName:i[5],objectIndex:i[7],propertyName:i[9],propertyIndex:i[11]};if(null===r.propertyName||0===r.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return r},n.PropertyBinding.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var i=function(e){for(var i=0;i<e.bones.length;i++){var r=e.bones[i];if(r.name===t)return r}return null},r=i(e.skeleton);if(r)return r}if(e.children){var n=function(e){for(var i=0;i<e.length;i++){var r=e[i];if(r.name===t||r.uuid===t)return r;var o=n(r.children);if(o)return o}return null},o=n(e.children);if(o)return o}return null},n.PropertyMixer=function(e,t,i){this.binding=e,this.valueSize=i;var r,n=Float64Array;switch(t){case"quaternion":r=this._slerp;break;case"string":case"bool":n=Array,r=this._select;break;default:r=this._lerp}this.buffer=new n(4*i),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0},n.PropertyMixer.prototype={constructor:n.PropertyMixer,accumulate:function(e,t){var i=this.buffer,r=this.valueSize,n=e*r+r,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==r;++a)i[n+a]=i[a];o=t}else{o+=t;var s=t/o;this._mixBufferRegion(i,n,0,s,r)}this.cumulativeWeight=o},apply:function(e){var t=this.valueSize,i=this.buffer,r=e*t+t,n=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,1>n){var a=3*t;this._mixBufferRegion(i,r,a,1-n,t)}for(var s=t,c=t+t;s!==c;++s)if(i[s]!==i[s+t]){o.setValue(i,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,i=this.valueSize,r=3*i;e.getValue(t,r);for(var n=i,o=r;n!==o;++n)t[n]=t[r+n%i];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,i,r,n){if(r>=.5)for(var o=0;o!==n;++o)e[t+o]=e[i+o]},_slerp:function(e,t,i,r){n.Quaternion.slerpFlat(e,t,e,t,e,i,r)},_lerp:function(e,t,i,r,n){for(var o=1-r,a=0;a!==n;++a){var s=t+a;e[s]=e[s]*o+e[i+a]*r}}},n.BooleanKeyframeTrack=function(e,t,i){n.KeyframeTrack.call(this,e,t,i)},n.BooleanKeyframeTrack.prototype=Object.assign(Object.create(n.KeyframeTrack.prototype),{constructor:n.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:n.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),n.NumberKeyframeTrack=function(e,t,i,r){n.KeyframeTrack.call(this,e,t,i,r)},n.NumberKeyframeTrack.prototype=Object.assign(Object.create(n.KeyframeTrack.prototype),{constructor:n.NumberKeyframeTrack,ValueTypeName:"number"}),n.QuaternionKeyframeTrack=function(e,t,i,r){n.KeyframeTrack.call(this,e,t,i,r)},n.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(n.KeyframeTrack.prototype),{constructor:n.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:n.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new n.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),n.StringKeyframeTrack=function(e,t,i,r){n.KeyframeTrack.call(this,e,t,i,r)},n.StringKeyframeTrack.prototype=Object.assign(Object.create(n.KeyframeTrack.prototype),{constructor:n.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:n.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),n.VectorKeyframeTrack=function(e,t,i,r){n.KeyframeTrack.call(this,e,t,i,r)},n.VectorKeyframeTrack.prototype=Object.assign(Object.create(n.KeyframeTrack.prototype),{constructor:n.VectorKeyframeTrack,ValueTypeName:"vector"}),n.Audio=function(e){n.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(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},n.Audio.prototype=Object.create(n.Object3D.prototype),n.Audio.prototype.constructor=n.Audio,n.Audio.prototype.getOutput=function(){return this.gain},n.Audio.prototype.load=function(e){var t=new n.AudioBuffer(this.context);return t.load(e),this.setBuffer(t),this},n.Audio.prototype.setNodeSource=function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},n.Audio.prototype.setBuffer=function(e){var t=this;return e.onReady(function(e){t.source.buffer=e,t.sourceType="buffer",t.autoplay&&t.play()}),this},n.Audio.prototype.play=function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");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()},n.Audio.prototype.pause=function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),void(this.startTime=this.context.currentTime))},n.Audio.prototype.stop=function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),void(this.startTime=0))},n.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},n.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},n.Audio.prototype.getFilter=function(){return this.filter},n.Audio.prototype.setFilter=function(e){void 0===e&&(e=null),this.isPlaying===!0?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},n.Audio.prototype.setPlaybackRate=function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,void(this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate)))},n.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},n.Audio.prototype.onEnded=function(){this.isPlaying=!1},n.Audio.prototype.setLoop=function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):void(this.source.loop=e)},n.Audio.prototype.getLoop=function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},n.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},n.Audio.prototype.getVolume=function(){return this.gain.gain.value},n.AudioAnalyser=function(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)},n.AudioAnalyser.prototype={constructor:n.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},n.AudioBuffer=function(e){this.context=e,this.ready=!1,this.readyCallbacks=[]},n.AudioBuffer.prototype.load=function(e){var t=this,i=new XMLHttpRequest;return i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){t.context.decodeAudioData(this.response,function(e){t.buffer=e,t.ready=!0;for(var i=0;i<t.readyCallbacks.length;i++)t.readyCallbacks[i](t.buffer);t.readyCallbacks=[]})},i.send(),this},n.AudioBuffer.prototype.onReady=function(e){this.ready?e(this.buffer):this.readyCallbacks.push(e)},n.PositionalAudio=function(e){n.Audio.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},n.PositionalAudio.prototype=Object.create(n.Audio.prototype),n.PositionalAudio.prototype.constructor=n.PositionalAudio,n.PositionalAudio.prototype.getOutput=function(){return this.panner},n.PositionalAudio.prototype.setRefDistance=function(e){this.panner.refDistance=e},n.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},n.PositionalAudio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},n.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},n.PositionalAudio.prototype.setDistanceModel=function(e){this.panner.distanceModel=e},n.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},n.PositionalAudio.prototype.setMaxDistance=function(e){this.panner.maxDistance=e},n.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},n.PositionalAudio.prototype.updateMatrixWorld=function(){var e=new n.Vector3;return function(t){n.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),n.AudioListener=function(){n.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},n.AudioListener.prototype=Object.create(n.Object3D.prototype),n.AudioListener.prototype.constructor=n.AudioListener,n.AudioListener.prototype.getInput=function(){return this.gain},n.AudioListener.prototype.removeFilter=function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},n.AudioListener.prototype.setFilter=function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},n.AudioListener.prototype.getFilter=function(){return this.filter},n.AudioListener.prototype.setMasterVolume=function(e){this.gain.gain.value=e},n.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},n.AudioListener.prototype.updateMatrixWorld=function(){var e=new n.Vector3,t=new n.Quaternion,i=new n.Vector3,r=new n.Vector3;return function(o){n.Object3D.prototype.updateMatrixWorld.call(this,o);var a=this.context.listener,s=this.up;this.matrixWorld.decompose(e,t,i),r.set(0,0,-1).applyQuaternion(t),a.setPosition(e.x,e.y,e.z),a.setOrientation(r.x,r.y,r.z,s.x,s.y,s.z)}}(),n.Camera=function(){n.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new n.Matrix4,this.projectionMatrix=new n.Matrix4},n.Camera.prototype=Object.create(n.Object3D.prototype),n.Camera.prototype.constructor=n.Camera,n.Camera.prototype.getWorldDirection=function(){var e=new n.Quaternion;return function(t){var i=t||new n.Vector3;return this.getWorldQuaternion(e),i.set(0,0,-1).applyQuaternion(e)}}(),n.Camera.prototype.lookAt=function(){var e=new n.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),n.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},n.Camera.prototype.copy=function(e){return n.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},n.CubeCamera=function(e,t,i){n.Object3D.call(this),this.type="CubeCamera";var r=90,o=1,a=new n.PerspectiveCamera(r,o,e,t);a.up.set(0,-1,0),a.lookAt(new n.Vector3(1,0,0)),this.add(a);var s=new n.PerspectiveCamera(r,o,e,t);s.up.set(0,-1,0),s.lookAt(new n.Vector3(-1,0,0)),this.add(s);var c=new n.PerspectiveCamera(r,o,e,t);c.up.set(0,0,1),c.lookAt(new n.Vector3(0,1,0)),this.add(c);var h=new n.PerspectiveCamera(r,o,e,t);h.up.set(0,0,-1),h.lookAt(new n.Vector3(0,-1,0)),this.add(h);var l=new n.PerspectiveCamera(r,o,e,t);l.up.set(0,-1,0),l.lookAt(new n.Vector3(0,0,1)),this.add(l);var u=new n.PerspectiveCamera(r,o,e,t);u.up.set(0,-1,0),u.lookAt(new n.Vector3(0,0,-1)),this.add(u);var d={format:n.RGBFormat,magFilter:n.LinearFilter,minFilter:n.LinearFilter};this.renderTarget=new n.WebGLRenderTargetCube(i,i,d),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,r=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,e.render(t,a,i),i.activeCubeFace=1,e.render(t,s,i),i.activeCubeFace=2,e.render(t,c,i),i.activeCubeFace=3,e.render(t,h,i),i.activeCubeFace=4,e.render(t,l,i),i.texture.generateMipmaps=r,i.activeCubeFace=5,e.render(t,u,i),e.setRenderTarget(null)}},n.CubeCamera.prototype=Object.create(n.Object3D.prototype),n.CubeCamera.prototype.constructor=n.CubeCamera,n.OrthographicCamera=function(e,t,i,r,o,a){n.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=void 0!==o?o:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()},n.OrthographicCamera.prototype=Object.create(n.Camera.prototype),n.OrthographicCamera.prototype.constructor=n.OrthographicCamera,n.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(i-e,i+e,r+t,r-t,this.near,this.far)},n.OrthographicCamera.prototype.copy=function(e){return n.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},n.OrthographicCamera.prototype.toJSON=function(e){var t=n.Object3D.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},n.PerspectiveCamera=function(e,t,i,r){n.Camera.call(this),this.type="PerspectiveCamera",this.focalLength=10,this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==i?i:.1,this.far=void 0!==r?r:2e3,this.updateProjectionMatrix()},n.PerspectiveCamera.prototype=Object.create(n.Camera.prototype),n.PerspectiveCamera.prototype.constructor=n.PerspectiveCamera,n.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*n.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},n.PerspectiveCamera.prototype.setViewOffset=function(e,t,i,r,n,o){this.fullWidth=e,this.fullHeight=t,this.x=i,this.y=r,this.width=n,this.height=o,this.updateProjectionMatrix()},n.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=n.Math.radToDeg(2*Math.atan(Math.tan(.5*n.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=this.fullWidth/this.fullHeight,i=Math.tan(n.Math.degToRad(.5*e))*this.near,r=-i,o=t*r,a=t*i,s=Math.abs(a-o),c=Math.abs(i-r);this.projectionMatrix.makeFrustum(o+this.x*s/this.fullWidth,o+(this.x+this.width)*s/this.fullWidth,i-(this.y+this.height)*c/this.fullHeight,i-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},n.PerspectiveCamera.prototype.copy=function(e){return n.Camera.prototype.copy.call(this,e),this.focalLength=e.focalLength,this.zoom=e.zoom,this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this},n.PerspectiveCamera.prototype.toJSON=function(e){var t=n.Object3D.prototype.toJSON.call(this,e);return t.object.focalLength=this.focalLength,t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},n.StereoCamera=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new n.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new n.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},n.StereoCamera.prototype={constructor:n.StereoCamera,update:function(){var e,t,i,r,o,a=new n.Matrix4,s=new n.Matrix4;return function(c){var h=e!==c.focalLength||t!==c.fov||i!==c.aspect*this.aspect||r!==c.near||o!==c.far;if(h){e=c.focalLength,t=c.fov,i=c.aspect*this.aspect,r=c.near,o=c.far;var l,u,d=c.projectionMatrix.clone(),p=.032,f=p*r/e,m=r*Math.tan(n.Math.degToRad(.5*t));s.elements[12]=-p,a.elements[12]=p,l=-m*i+f,u=m*i+f,d.elements[0]=2*r/(u-l),d.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(d),l=-m*i-f,u=m*i-f,d.elements[0]=2*r/(u-l),d.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(c.matrixWorld).multiply(s),this.cameraR.matrixWorld.copy(c.matrixWorld).multiply(a)}}()},n.Light=function(e,t){n.Object3D.call(this),this.type="Light",this.color=new n.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},n.Light.prototype=Object.create(n.Object3D.prototype),n.Light.prototype.constructor=n.Light,n.Light.prototype.copy=function(e){return n.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},n.Light.prototype.toJSON=function(e){var t=n.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),t},n.LightShadow=function(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new n.Vector2(512,512),this.map=null,this.matrix=new n.Matrix4},n.LightShadow.prototype={constructor:n.LightShadow,copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},n.AmbientLight=function(e,t){n.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},n.AmbientLight.prototype=Object.create(n.Light.prototype),n.AmbientLight.prototype.constructor=n.AmbientLight,n.DirectionalLight=function(e,t){n.Light.call(this,e,t),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new n.Object3D,this.shadow=new n.LightShadow(new n.OrthographicCamera(-5,5,5,-5,.5,500))},n.DirectionalLight.prototype=Object.create(n.Light.prototype),n.DirectionalLight.prototype.constructor=n.DirectionalLight,n.DirectionalLight.prototype.copy=function(e){return n.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},n.HemisphereLight=function(e,t,i){n.Light.call(this,e,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new n.Color(t)},n.HemisphereLight.prototype=Object.create(n.Light.prototype),n.HemisphereLight.prototype.constructor=n.HemisphereLight,n.HemisphereLight.prototype.copy=function(e){return n.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this},n.PointLight=function(e,t,i,r){n.Light.call(this,e,t),this.type="PointLight",this.distance=void 0!==i?i:0,this.decay=void 0!==r?r:1,this.shadow=new n.LightShadow(new n.PerspectiveCamera(90,1,.5,500))},n.PointLight.prototype=Object.create(n.Light.prototype),n.PointLight.prototype.constructor=n.PointLight,Object.defineProperty(n.PointLight.prototype,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),n.PointLight.prototype.copy=function(e){return n.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},n.SpotLight=function(e,t,i,r,o,a){n.Light.call(this,e,t),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new n.Object3D,this.distance=void 0!==i?i:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==o?o:0,this.decay=void 0!==a?a:1,this.shadow=new n.LightShadow(new n.PerspectiveCamera(50,1,.5,500))},n.SpotLight.prototype=Object.create(n.Light.prototype),n.SpotLight.prototype.constructor=n.SpotLight,Object.defineProperty(n.SpotLight.prototype,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),n.SpotLight.prototype.copy=function(e){return n.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},n.Cache={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){return this.enabled!==!1?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},n.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},n.Loader.prototype={constructor:n.Loader,crossOrigin:void 0,extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,i){for(var r=[],n=0;n<e.length;++n)r[n]=this.createMaterial(e[n],t,i);return r},createMaterial:function(){var e,t,i;return function(r,o,a){function s(e,i,r,s,h){var l,u=o+e,d=n.Loader.Handlers.get(u);null!==d?l=d.load(u):(t.setCrossOrigin(a),l=t.load(u)),void 0!==i&&(l.repeat.fromArray(i),1!==i[0]&&(l.wrapS=n.RepeatWrapping),1!==i[1]&&(l.wrapT=n.RepeatWrapping)),void 0!==r&&l.offset.fromArray(r),void 0!==s&&("repeat"===s[0]&&(l.wrapS=n.RepeatWrapping),"mirror"===s[0]&&(l.wrapS=n.MirroredRepeatWrapping),"repeat"===s[1]&&(l.wrapT=n.RepeatWrapping),"mirror"===s[1]&&(l.wrapT=n.MirroredRepeatWrapping)),void 0!==h&&(l.anisotropy=h);var p=n.Math.generateUUID();return c[p]=l,p}void 0===e&&(e=new n.Color),void 0===t&&(t=new n.TextureLoader),void 0===i&&(i=new n.MaterialLoader);var c={},h={uuid:n.Math.generateUUID(),type:"MeshLambertMaterial"};for(var l in r){var u=r[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":h.name=u;break;case"blending":h.blending=n[u];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":h.color=e.fromArray(u).getHex();break;case"colorSpecular":h.specular=e.fromArray(u).getHex();break;case"colorEmissive":h.emissive=e.fromArray(u).getHex();break;case"specularCoef":h.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(h.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(h.type="MeshPhongMaterial");break;case"mapDiffuse":h.map=s(u,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":h.lightMap=s(u,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":h.aoMap=s(u,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":h.bumpMap=s(u,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":h.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":h.normalMap=s(u,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":h.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":h.specularMap=s(u,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":h.alphaMap=s(u,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":h.side=n.BackSide;break;case"doubleSided":h.side=n.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),h.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":h[l]=u;break;case"vertexColors":u===!0&&(h.vertexColors=n.VertexColors),"face"===u&&(h.vertexColors=n.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,u)}}return"MeshBasicMaterial"===h.type&&delete h.emissive,"MeshPhongMaterial"!==h.type&&delete h.specular,h.opacity<1&&(h.transparent=!0),i.setTextures(c),i.parse(h)}}()},n.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,i=0,r=t.length;r>i;i+=2){var n=t[i],o=t[i+1];if(n.test(e))return o}return null}},n.XHRLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.XHRLoader.prototype={constructor:n.XHRLoader,load:function(e,t,i,r){void 0!==this.path&&(e=this.path+e);var o=this,a=n.Cache.get(e);if(void 0!==a)return t&&setTimeout(function(){t(a)},0),a;var s=new XMLHttpRequest;return s.overrideMimeType("text/plain"),s.open("GET",e,!0),s.addEventListener("load",function(i){var a=i.target.response;n.Cache.add(e,a),200===this.status?(t&&t(a),o.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(a),o.manager.itemEnd(e)):(r&&r(i),o.manager.itemError(e))},!1),void 0!==i&&s.addEventListener("progress",function(e){i(e)},!1),s.addEventListener("error",function(t){r&&r(t),o.manager.itemError(e)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.send(null),o.manager.itemStart(e),s},setPath:function(e){this.path=e},setResponseType:function(e){this.responseType=e},setWithCredentials:function(e){this.withCredentials=e}},n.FontLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.FontLoader.prototype={constructor:n.FontLoader,load:function(e,t,i,r){var o=new n.XHRLoader(this.manager);o.load(e,function(e){t(new n.Font(JSON.parse(e.substring(65,e.length-2))))},i,r)}},n.ImageLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.ImageLoader.prototype={constructor:n.ImageLoader,load:function(e,t,i,r){void 0!==this.path&&(e=this.path+e);var o=this,a=n.Cache.get(e);if(void 0!==a)return o.manager.itemStart(e),t?setTimeout(function(){t(a),o.manager.itemEnd(e)},0):o.manager.itemEnd(e),a;var s=document.createElement("img");return s.addEventListener("load",function(){n.Cache.add(e,this),t&&t(this),o.manager.itemEnd(e)},!1),void 0!==i&&s.addEventListener("progress",function(e){i(e)},!1),s.addEventListener("error",function(t){r&&r(t),o.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),o.manager.itemStart(e),s.src=e,s},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},n.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:n.DefaultLoadingManager,this.withCredentials=!1},n.JSONLoader.prototype={constructor:n.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,i,r){var o=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:n.Loader.prototype.extractUrlBase(e),s=new n.XHRLoader(this.manager);s.setWithCredentials(this.withCredentials),s.load(e,function(i){var r=JSON.parse(i),n=r.metadata;if(void 0!==n){var s=n.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}}var c=o.parse(r,a);t(c.geometry,c.materials)},i,r)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function i(t){function i(e,t){return e&1<<t}var r,o,a,c,h,l,u,d,p,f,m,v,g,y,x,b,w,M,_,E,A,S,T,C,L,R,P,D=e.faces,O=e.vertices,I=e.normals,k=e.colors,N=0;if(void 0!==e.uvs){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&N++;for(r=0;N>r;r++)s.faceVertexUvs[r]=[]}for(c=0,h=O.length;h>c;)M=new n.Vector3,M.x=O[c++]*t,M.y=O[c++]*t,M.z=O[c++]*t,s.vertices.push(M);for(c=0,h=D.length;h>c;)if(f=D[c++],m=i(f,0),v=i(f,1),g=i(f,3),y=i(f,4),x=i(f,5),b=i(f,6),w=i(f,7),m){if(E=new n.Face3,E.a=D[c],E.b=D[c+1],E.c=D[c+3],A=new n.Face3,A.a=D[c+1],A.b=D[c+2],A.c=D[c+3],c+=4,v&&(p=D[c++],E.materialIndex=p,A.materialIndex=p),a=s.faces.length,g)for(r=0;N>r;r++)for(C=e.uvs[r],s.faceVertexUvs[r][a]=[],s.faceVertexUvs[r][a+1]=[],o=0;4>o;o++)d=D[c++],R=C[2*d],P=C[2*d+1],L=new n.Vector2(R,P),2!==o&&s.faceVertexUvs[r][a].push(L),0!==o&&s.faceVertexUvs[r][a+1].push(L);if(y&&(u=3*D[c++],E.normal.set(I[u++],I[u++],I[u]),A.normal.copy(E.normal)),x)for(r=0;4>r;r++)u=3*D[c++],T=new n.Vector3(I[u++],I[u++],I[u]),2!==r&&E.vertexNormals.push(T),0!==r&&A.vertexNormals.push(T);if(b&&(l=D[c++],S=k[l],E.color.setHex(S),A.color.setHex(S)),w)for(r=0;4>r;r++)l=D[c++],S=k[l],2!==r&&E.vertexColors.push(new n.Color(S)),0!==r&&A.vertexColors.push(new n.Color(S));s.faces.push(E),s.faces.push(A)}else{if(_=new n.Face3,_.a=D[c++],_.b=D[c++],_.c=D[c++],v&&(p=D[c++],_.materialIndex=p),
a=s.faces.length,g)for(r=0;N>r;r++)for(C=e.uvs[r],s.faceVertexUvs[r][a]=[],o=0;3>o;o++)d=D[c++],R=C[2*d],P=C[2*d+1],L=new n.Vector2(R,P),s.faceVertexUvs[r][a].push(L);if(y&&(u=3*D[c++],_.normal.set(I[u++],I[u++],I[u])),x)for(r=0;3>r;r++)u=3*D[c++],T=new n.Vector3(I[u++],I[u++],I[u]),_.vertexNormals.push(T);if(b&&(l=D[c++],_.color.setHex(k[l])),w)for(r=0;3>r;r++)l=D[c++],_.vertexColors.push(new n.Color(k[l]));s.faces.push(_)}}function r(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var i=0,r=e.skinWeights.length;r>i;i+=t){var o=e.skinWeights[i],a=t>1?e.skinWeights[i+1]:0,c=t>2?e.skinWeights[i+2]:0,h=t>3?e.skinWeights[i+3]:0;s.skinWeights.push(new n.Vector4(o,a,c,h))}if(e.skinIndices)for(var i=0,r=e.skinIndices.length;r>i;i+=t){var l=e.skinIndices[i],u=t>1?e.skinIndices[i+1]:0,d=t>2?e.skinIndices[i+2]:0,p=t>3?e.skinIndices[i+3]:0;s.skinIndices.push(new n.Vector4(l,u,d,p))}s.bones=e.bones,s.bones&&s.bones.length>0&&(s.skinWeights.length!==s.skinIndices.length||s.skinIndices.length!==s.vertices.length)&&console.warn("When skinning, number of vertices ("+s.vertices.length+"), skinIndices ("+s.skinIndices.length+"), and skinWeights ("+s.skinWeights.length+") should match.")}function o(t){if(void 0!==e.morphTargets)for(var i=0,r=e.morphTargets.length;r>i;i++){s.morphTargets[i]={},s.morphTargets[i].name=e.morphTargets[i].name,s.morphTargets[i].vertices=[];for(var o=s.morphTargets[i].vertices,a=e.morphTargets[i].vertices,c=0,h=a.length;h>c;c+=3){var l=new n.Vector3;l.x=a[c]*t,l.y=a[c+1]*t,l.z=a[c+2]*t,o.push(l)}}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=s.faces,d=e.morphColors[0].colors,i=0,r=u.length;r>i;i++)u[i].color.fromArray(d,3*i)}}function a(){var t=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var r=0;r<i.length;r++){var o=n.AnimationClip.parseAnimation(i[r],s.bones);o&&t.push(o)}if(s.morphTargets){var a=n.AnimationClip.CreateClipsFromMorphTargetSequences(s.morphTargets,10);t=t.concat(a)}t.length>0&&(s.animations=t)}var s=new n.Geometry,c=void 0!==e.scale?1/e.scale:1;if(i(c),r(),o(c),a(),s.computeFaceNormals(),s.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:s};var h=n.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:s,materials:h}}},n.LoadingManager=function(e,t,i){var r=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){a++,n===!1&&void 0!==r.onStart&&r.onStart(e,o,a),n=!0},this.itemEnd=function(e){o++,void 0!==r.onProgress&&r.onProgress(e,o,a),o===a&&(n=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)}},n.DefaultLoadingManager=new n.LoadingManager,n.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.BufferGeometryLoader.prototype={constructor:n.BufferGeometryLoader,load:function(e,t,i,r){var o=this,a=new n.XHRLoader(o.manager);a.load(e,function(e){t(o.parse(JSON.parse(e)))},i,r)},parse:function(e){var t=new n.BufferGeometry,i=e.data.index,r={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==i){var o=new r[i.type](i.array);t.setIndex(new n.BufferAttribute(o,1))}var a=e.data.attributes;for(var s in a){var c=a[s],o=new r[c.type](c.array);t.addAttribute(s,new n.BufferAttribute(o,c.itemSize))}var h=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==h)for(var l=0,u=h.length;l!==u;++l){var d=h[l];t.addGroup(d.start,d.count,d.materialIndex)}var p=e.data.boundingSphere;if(void 0!==p){var f=new n.Vector3;void 0!==p.center&&f.fromArray(p.center),t.boundingSphere=new n.Sphere(f,p.radius)}return t}},n.MaterialLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager,this.textures={}},n.MaterialLoader.prototype={constructor:n.MaterialLoader,load:function(e,t,i,r){var o=this,a=new n.XHRLoader(o.manager);a.load(e,function(e){t(o.parse(JSON.parse(e)))},i,r)},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 n[e.type];if(void 0!==e.uuid&&(t.uuid=e.uuid),void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.metalness&&(t.metalness=e.metalness),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.colorWrite&&(t.colorWrite=e.colorWrite),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)),void 0!==e.normalScale){var i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),t.normalScale=(new n.Vector2).fromArray(i)}if(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.roughnessMap&&(t.roughnessMap=this.getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(t.metalnessMap=this.getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(t.emissiveMap=this.getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(t.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=n.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,o=e.materials.length;o>r;r++)t.materials.push(this.parse(e.materials[r]));return t}},n.ObjectLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager,this.texturePath=""},n.ObjectLoader.prototype={constructor:n.ObjectLoader,load:function(e,t,i,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var o=this,a=new n.XHRLoader(o.manager);a.load(e,function(e){o.parse(JSON.parse(e),t)},i,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseGeometries(e.geometries),r=this.parseImages(e.images,function(){void 0!==t&&t(a)}),n=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,n),a=this.parseObject(e.object,i,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 i=new n.JSONLoader,r=new n.BufferGeometryLoader,o=0,a=e.length;a>o;o++){var s,c=e[o];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new n[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new n[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new n[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new n[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new n[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":s=new n.DodecahedronGeometry(c.radius,c.detail);break;case"IcosahedronGeometry":s=new n.IcosahedronGeometry(c.radius,c.detail);break;case"OctahedronGeometry":s=new n.OctahedronGeometry(c.radius,c.detail);break;case"TetrahedronGeometry":s=new n.TetrahedronGeometry(c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new n[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new n[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new n[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":s=new n.LatheGeometry(c.points,c.segments,c.phiStart,c.phiLength);break;case"BufferGeometry":s=r.parse(c);break;case"Geometry":s=i.parse(c.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),t[c.uuid]=s}return t},parseMaterials:function(e,t){var i={};if(void 0!==e){var r=new n.MaterialLoader;r.setTextures(t);for(var o=0,a=e.length;a>o;o++){var s=r.parse(e[o]);i[s.uuid]=s}}return i},parseAnimations:function(e){for(var t=[],i=0;i<e.length;i++){var r=n.AnimationClip.parse(e[i]);t.push(r)}return t},parseImages:function(e,t){function i(e){return r.manager.itemStart(e),s.load(e,function(){r.manager.itemEnd(e)})}var r=this,o={};if(void 0!==e&&e.length>0){var a=new n.LoadingManager(t),s=new n.ImageLoader(a);s.setCrossOrigin(this.crossOrigin);for(var c=0,h=e.length;h>c;c++){var l=e[c],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:r.texturePath+l.url;o[l.uuid]=i(u)}}return o},parseTextures:function(e,t){function i(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),n[e])}var r={};if(void 0!==e)for(var o=0,a=e.length;a>o;o++){var s=e[o];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new n.Texture(t[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=i(s.mapping)),void 0!==s.offset&&(c.offset=new n.Vector2(s.offset[0],s.offset[1])),void 0!==s.repeat&&(c.repeat=new n.Vector2(s.repeat[0],s.repeat[1])),void 0!==s.minFilter&&(c.minFilter=i(s.minFilter)),void 0!==s.magFilter&&(c.magFilter=i(s.magFilter)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),Array.isArray(s.wrap)&&(c.wrapS=i(s.wrap[0]),c.wrapT=i(s.wrap[1])),r[s.uuid]=c}return r},parseObject:function(){var e=new n.Matrix4;return function(t,i,r){function o(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),i[e]}function a(e){return void 0===e?void 0:(void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e])}var s;switch(t.type){case"Scene":s=new n.Scene;break;case"PerspectiveCamera":s=new n.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":s=new n.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":s=new n.AmbientLight(t.color,t.intensity);break;case"DirectionalLight":s=new n.DirectionalLight(t.color,t.intensity);break;case"PointLight":s=new n.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":s=new n.SpotLight(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":s=new n.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":var c=o(t.geometry),h=a(t.material);s=c.bones&&c.bones.length>0?new n.SkinnedMesh(c,h):new n.Mesh(c,h);break;case"LOD":s=new n.LOD;break;case"Line":s=new n.Line(o(t.geometry),a(t.material),t.mode);break;case"PointCloud":case"Points":s=new n.Points(o(t.geometry),a(t.material));break;case"Sprite":s=new n.Sprite(a(t.material));break;case"Group":s=new n.Group;break;default:s=new n.Object3D}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.children)for(var l in t.children)s.add(this.parseObject(t.children[l],i,r));if("LOD"===t.type)for(var u=t.levels,d=0;d<u.length;d++){var p=u[d],l=s.getObjectByProperty("uuid",p.object);void 0!==l&&s.addLevel(l,p.distance)}return s}}()},n.TextureLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.TextureLoader.prototype={constructor:n.TextureLoader,load:function(e,t,i,r){var o=new n.Texture,a=new n.ImageLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){o.image=e,o.needsUpdate=!0,void 0!==t&&t(o)},i,r),o},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},n.CubeTextureLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.CubeTextureLoader.prototype={constructor:n.CubeTextureLoader,load:function(e,t,i,r){function o(i){s.load(e[i],function(e){a.images[i]=e,c++,6===c&&(a.needsUpdate=!0,t&&t(a))},void 0,r)}var a=new n.CubeTexture,s=new n.ImageLoader(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var c=0,h=0;h<e.length;++h)o(h);return a},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},n.DataTextureLoader=n.BinaryTextureLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager,this._parser=null},n.BinaryTextureLoader.prototype={constructor:n.BinaryTextureLoader,load:function(e,t,i,r){var o=this,a=new n.DataTexture,s=new n.XHRLoader(this.manager);return s.setResponseType("arraybuffer"),s.load(e,function(e){var i=o._parser(e);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:n.ClampToEdgeWrapping,a.wrapT=void 0!==i.wrapT?i.wrapT:n.ClampToEdgeWrapping,a.magFilter=void 0!==i.magFilter?i.magFilter:n.LinearFilter,a.minFilter=void 0!==i.minFilter?i.minFilter:n.LinearMipMapLinearFilter,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps),1===i.mipmapCount&&(a.minFilter=n.LinearFilter),a.needsUpdate=!0,t&&t(a,i))},i,r),a}},n.CompressedTextureLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager,this._parser=null},n.CompressedTextureLoader.prototype={constructor:n.CompressedTextureLoader,load:function(e,t,i,r){function o(o){h.load(e[o],function(e){var i=a._parser(e,!0);s[o]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},l+=1,6===l&&(1===i.mipmapCount&&(c.minFilter=n.LinearFilter),c.format=i.format,c.needsUpdate=!0,t&&t(c))},i,r)}var a=this,s=[],c=new n.CompressedTexture;c.image=s;var h=new n.XHRLoader(this.manager);if(h.setPath(this.path),h.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,d=e.length;d>u;++u)o(u);else h.load(e,function(e){var i=a._parser(e,!0);if(i.isCubemap)for(var r=i.mipmaps.length/i.mipmapCount,o=0;r>o;o++){s[o]={mipmaps:[]};for(var h=0;h<i.mipmapCount;h++)s[o].mipmaps.push(i.mipmaps[o*i.mipmapCount+h]),s[o].format=i.format,s[o].width=i.width,s[o].height=i.height}else c.image.width=i.width,c.image.height=i.height,c.mipmaps=i.mipmaps;1===i.mipmapCount&&(c.minFilter=n.LinearFilter),c.format=i.format,c.needsUpdate=!0,t&&t(c)},i,r);return c},setPath:function(e){this.path=e}},n.Material=function(){Object.defineProperty(this,"id",{value:n.MaterialIdCount++}),this.uuid=n.Math.generateUUID(),this.name="",this.type="Material",this.side=n.FrontSide,this.opacity=1,this.transparent=!1,this.blending=n.NormalBlending,this.blendSrc=n.SrcAlphaFactor,this.blendDst=n.OneMinusSrcAlphaFactor,this.blendEquation=n.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=n.LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0},n.Material.prototype={constructor:n.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){e===!0&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i){var r=this[t];void 0!==r?r instanceof n.Color?r.set(i):r instanceof n.Vector3&&i instanceof n.Vector3?r.copy(i):this[t]="overdraw"===t?Number(i):i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}var i=void 0===e;i&&(e={textures:{},images:{}});var r={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color instanceof n.Color&&(r.color=this.color.getHex()),.5!==this.roughness&&(r.roughness=this.roughness),.5!==this.metalness&&(r.metalness=this.metalness),this.emissive instanceof n.Color&&(r.emissive=this.emissive.getHex()),this.specular instanceof n.Color&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),this.map instanceof n.Texture&&(r.map=this.map.toJSON(e).uuid),this.alphaMap instanceof n.Texture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap instanceof n.Texture&&(r.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap instanceof n.Texture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap instanceof n.Texture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap instanceof n.Texture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap instanceof n.Texture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap instanceof n.Texture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap instanceof n.Texture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap instanceof n.Texture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.envMap instanceof n.Texture&&(r.envMap=this.envMap.toJSON(e).uuid,r.reflectivity=this.reflectivity),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==n.NoColors&&(r.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==n.SmoothShading&&(r.shading=this.shading),void 0!==this.blending&&this.blending!==n.NormalBlending&&(r.blending=this.blending),void 0!==this.side&&this.side!==n.FrontSide&&(r.side=this.side),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),i){var o=t(e.textures),a=t(e.images);o.length>0&&(r.textures=o),a.length>0&&(r.images=a)}return r},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.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},n.EventDispatcher.prototype.apply(n.Material.prototype),n.MaterialIdCount=0,n.LineBasicMaterial=function(e){n.Material.call(this),this.type="LineBasicMaterial",this.color=new n.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.blending=n.NormalBlending,this.vertexColors=n.NoColors,this.fog=!0,this.setValues(e)},n.LineBasicMaterial.prototype=Object.create(n.Material.prototype),n.LineBasicMaterial.prototype.constructor=n.LineBasicMaterial,n.LineBasicMaterial.prototype.copy=function(e){return n.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},n.LineDashedMaterial=function(e){n.Material.call(this),this.type="LineDashedMaterial",this.color=new n.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.blending=n.NormalBlending,this.vertexColors=n.NoColors,this.fog=!0,this.setValues(e)},n.LineDashedMaterial.prototype=Object.create(n.Material.prototype),n.LineDashedMaterial.prototype.constructor=n.LineDashedMaterial,n.LineDashedMaterial.prototype.copy=function(e){return n.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},n.MeshBasicMaterial=function(e){n.Material.call(this),this.type="MeshBasicMaterial",this.color=new n.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=n.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=n.SmoothShading,this.blending=n.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=n.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},n.MeshBasicMaterial.prototype=Object.create(n.Material.prototype),n.MeshBasicMaterial.prototype.constructor=n.MeshBasicMaterial,n.MeshBasicMaterial.prototype.copy=function(e){return n.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},n.MeshLambertMaterial=function(e){n.Material.call(this),this.type="MeshLambertMaterial",this.color=new n.Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new n.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=n.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.blending=n.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=n.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},n.MeshLambertMaterial.prototype=Object.create(n.Material.prototype),n.MeshLambertMaterial.prototype.constructor=n.MeshLambertMaterial,n.MeshLambertMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,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},n.MeshPhongMaterial=function(e){n.Material.call(this),this.type="MeshPhongMaterial",this.color=new n.Color(16777215),this.specular=new n.Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new n.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new n.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=n.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=n.SmoothShading,this.blending=n.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=n.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},n.MeshPhongMaterial.prototype=Object.create(n.Material.prototype),n.MeshPhongMaterial.prototype.constructor=n.MeshPhongMaterial,n.MeshPhongMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,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},n.MeshStandardMaterial=function(e){n.Material.call(this),this.type="MeshStandardMaterial",this.color=new n.Color(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new n.Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new n.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=n.SmoothShading,this.blending=n.NormalBlending,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=n.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},n.MeshStandardMaterial.prototype=Object.create(n.Material.prototype),n.MeshStandardMaterial.prototype.constructor=n.MeshStandardMaterial,n.MeshStandardMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,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},n.MeshDepthMaterial=function(e){n.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},n.MeshDepthMaterial.prototype=Object.create(n.Material.prototype),n.MeshDepthMaterial.prototype.constructor=n.MeshDepthMaterial,n.MeshDepthMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},n.MeshNormalMaterial=function(e){n.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},n.MeshNormalMaterial.prototype=Object.create(n.Material.prototype),n.MeshNormalMaterial.prototype.constructor=n.MeshNormalMaterial,n.MeshNormalMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},n.MultiMaterial=function(e){this.uuid=n.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},n.MultiMaterial.prototype={constructor:n.MultiMaterial,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},i=this.materials,r=0,n=i.length;n>r;r++){var o=i[r].toJSON(e);delete o.metadata,t.materials.push(o)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},n.PointsMaterial=function(e){n.Material.call(this),this.type="PointsMaterial",this.color=new n.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.blending=n.NormalBlending,
this.vertexColors=n.NoColors,this.fog=!0,this.setValues(e)},n.PointsMaterial.prototype=Object.create(n.Material.prototype),n.PointsMaterial.prototype.constructor=n.PointsMaterial,n.PointsMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.vertexColors=e.vertexColors,this.fog=e.fog,this},n.ShaderMaterial=function(e){n.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=n.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=n.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))},n.ShaderMaterial.prototype=Object.create(n.Material.prototype),n.ShaderMaterial.prototype.constructor=n.ShaderMaterial,n.ShaderMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=n.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},n.ShaderMaterial.prototype.toJSON=function(e){var t=n.Material.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},n.RawShaderMaterial=function(e){n.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},n.RawShaderMaterial.prototype=Object.create(n.ShaderMaterial.prototype),n.RawShaderMaterial.prototype.constructor=n.RawShaderMaterial,n.SpriteMaterial=function(e){n.Material.call(this),this.type="SpriteMaterial",this.color=new n.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},n.SpriteMaterial.prototype=Object.create(n.Material.prototype),n.SpriteMaterial.prototype.constructor=n.SpriteMaterial,n.SpriteMaterial.prototype.copy=function(e){return n.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.fog=e.fog,this},n.Texture=function(e,t,i,r,o,a,s,c,h){Object.defineProperty(this,"id",{value:n.TextureIdCount++}),this.uuid=n.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==e?e:n.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:n.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:n.ClampToEdgeWrapping,this.wrapT=void 0!==r?r:n.ClampToEdgeWrapping,this.magFilter=void 0!==o?o:n.LinearFilter,this.minFilter=void 0!==a?a:n.LinearMipMapLinearFilter,this.anisotropy=void 0!==h?h:1,this.format=void 0!==s?s:n.RGBAFormat,this.type=void 0!==c?c:n.UnsignedByteType,this.offset=new n.Vector2(0,0),this.repeat=new n.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=n.LinearEncoding,this.version=0,this.onUpdate=null},n.Texture.DEFAULT_IMAGE=void 0,n.Texture.DEFAULT_MAPPING=n.UVMapping,n.Texture.prototype={constructor:n.Texture,set needsUpdate(e){e===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){function t(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElement("canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||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 i={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 r=this.image;void 0===r.uuid&&(r.uuid=n.Math.generateUUID()),void 0===e.images[r.uuid]&&(e.images[r.uuid]={uuid:r.uuid,url:t(r)}),i.image=r.uuid}return e.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===n.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case n.RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case n.ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case n.MirroredRepeatWrapping:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case n.RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case n.ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case n.MirroredRepeatWrapping:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},n.EventDispatcher.prototype.apply(n.Texture.prototype),n.TextureIdCount=0,n.CanvasTexture=function(e,t,i,r,o,a,s,c,h){n.Texture.call(this,e,t,i,r,o,a,s,c,h),this.needsUpdate=!0},n.CanvasTexture.prototype=Object.create(n.Texture.prototype),n.CanvasTexture.prototype.constructor=n.CanvasTexture,n.CubeTexture=function(e,t,i,r,o,a,s,c,h){e=void 0!==e?e:[],t=void 0!==t?t:n.CubeReflectionMapping,n.Texture.call(this,e,t,i,r,o,a,s,c,h),this.flipY=!1},n.CubeTexture.prototype=Object.create(n.Texture.prototype),n.CubeTexture.prototype.constructor=n.CubeTexture,Object.defineProperty(n.CubeTexture.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),n.CompressedTexture=function(e,t,i,r,o,a,s,c,h,l,u){n.Texture.call(this,null,a,s,c,h,l,r,o,u),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},n.CompressedTexture.prototype=Object.create(n.Texture.prototype),n.CompressedTexture.prototype.constructor=n.CompressedTexture,n.DataTexture=function(e,t,i,r,o,a,s,c,h,l,u){n.Texture.call(this,null,a,s,c,h,l,r,o,u),this.image={data:e,width:t,height:i},this.magFilter=void 0!==h?h:n.NearestFilter,this.minFilter=void 0!==l?l:n.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},n.DataTexture.prototype=Object.create(n.Texture.prototype),n.DataTexture.prototype.constructor=n.DataTexture,n.VideoTexture=function(e,t,i,r,o,a,s,c,h){function l(){requestAnimationFrame(l),e.readyState===e.HAVE_ENOUGH_DATA&&(u.needsUpdate=!0)}n.Texture.call(this,e,t,i,r,o,a,s,c,h),this.generateMipmaps=!1;var u=this;l()},n.VideoTexture.prototype=Object.create(n.Texture.prototype),n.VideoTexture.prototype.constructor=n.VideoTexture,n.Group=function(){n.Object3D.call(this),this.type="Group"},n.Group.prototype=Object.create(n.Object3D.prototype),n.Group.prototype.constructor=n.Group,n.Points=function(e,t){n.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new n.Geometry,this.material=void 0!==t?t:new n.PointsMaterial({color:16777215*Math.random()})},n.Points.prototype=Object.create(n.Object3D.prototype),n.Points.prototype.constructor=n.Points,n.Points.prototype.raycast=function(){var e=new n.Matrix4,t=new n.Ray,i=new n.Sphere;return function(r,o){function a(e,i){var n=t.distanceSqToPoint(e);if(d>n){var a=t.closestPointToPoint(e);a.applyMatrix4(h);var c=r.ray.origin.distanceTo(a);if(c<r.near||c>r.far)return;o.push({distance:c,distanceToRay:Math.sqrt(n),point:a.clone(),index:i,face:null,object:s})}}var s=this,c=this.geometry,h=this.matrixWorld,l=r.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),i.copy(c.boundingSphere),i.applyMatrix4(h),r.ray.intersectsSphere(i)!==!1){e.getInverse(h),t.copy(r.ray).applyMatrix4(e);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),d=u*u,p=new n.Vector3;if(c instanceof n.BufferGeometry){var f=c.index,m=c.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,x=g.length;x>y;y++){var b=g[y];p.fromArray(v,3*b),a(p,b)}else for(var y=0,w=v.length/3;w>y;y++)p.fromArray(v,3*y),a(p,y)}else for(var M=c.vertices,y=0,w=M.length;w>y;y++)a(M[y],y)}}}(),n.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},n.Line=function(e,t,i){return 1===i?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new n.LineSegments(e,t)):(n.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new n.Geometry,void(this.material=void 0!==t?t:new n.LineBasicMaterial({color:16777215*Math.random()})))},n.Line.prototype=Object.create(n.Object3D.prototype),n.Line.prototype.constructor=n.Line,n.Line.prototype.raycast=function(){var e=new n.Matrix4,t=new n.Ray,i=new n.Sphere;return function(r,o){var a=r.linePrecision,s=a*a,c=this.geometry,h=this.matrixWorld;if(null===c.boundingSphere&&c.computeBoundingSphere(),i.copy(c.boundingSphere),i.applyMatrix4(h),r.ray.intersectsSphere(i)!==!1){e.getInverse(h),t.copy(r.ray).applyMatrix4(e);var l=new n.Vector3,u=new n.Vector3,d=new n.Vector3,p=new n.Vector3,f=this instanceof n.LineSegments?2:1;if(c instanceof n.BufferGeometry){var m=c.index,v=c.attributes,g=v.position.array;if(null!==m)for(var y=m.array,x=0,b=y.length-1;b>x;x+=f){var w=y[x],M=y[x+1];l.fromArray(g,3*w),u.fromArray(g,3*M);var _=t.distanceSqToSegment(l,u,p,d);if(!(_>s)){p.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(p);E<r.near||E>r.far||o.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=g.length/3-1;b>x;x+=f){l.fromArray(g,3*x),u.fromArray(g,3*x+3);var _=t.distanceSqToSegment(l,u,p,d);if(!(_>s)){p.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(p);E<r.near||E>r.far||o.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(c instanceof n.Geometry)for(var A=c.vertices,S=A.length,x=0;S-1>x;x+=f){var _=t.distanceSqToSegment(A[x],A[x+1],p,d);if(!(_>s)){p.applyMatrix4(this.matrixWorld);var E=r.ray.origin.distanceTo(p);E<r.near||E>r.far||o.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),n.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},n.LineStrip=0,n.LinePieces=1,n.LineSegments=function(e,t){n.Line.call(this,e,t),this.type="LineSegments"},n.LineSegments.prototype=Object.create(n.Line.prototype),n.LineSegments.prototype.constructor=n.LineSegments,n.Mesh=function(e,t){n.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new n.Geometry,this.material=void 0!==t?t:new n.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=n.TrianglesDrawMode,this.updateMorphTargets()},n.Mesh.prototype=Object.create(n.Object3D.prototype),n.Mesh.prototype.constructor=n.Mesh,n.Mesh.prototype.setDrawMode=function(e){this.drawMode=e},n.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}},n.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)},n.Mesh.prototype.raycast=function(){function e(e,t,i,r,o,a,s){return n.Triangle.barycoordFromPoint(e,t,i,r,v),o.multiplyScalar(v.x),a.multiplyScalar(v.y),s.multiplyScalar(v.z),o.add(a).add(s),o.clone()}function t(e,t,i,r,o,a,s){var c,h=e.material;if(c=h.side===n.BackSide?i.intersectTriangle(a,o,r,!0,s):i.intersectTriangle(r,o,a,h.side!==n.DoubleSide,s),null===c)return null;y.copy(s),y.applyMatrix4(e.matrixWorld);var l=t.ray.origin.distanceTo(y);return l<t.near||l>t.far?null:{distance:l,point:y.clone(),object:e}}function i(i,r,o,a,l,u,d,v){s.fromArray(a,3*u),c.fromArray(a,3*d),h.fromArray(a,3*v);var y=t(i,r,o,s,c,h,g);return y&&(l&&(p.fromArray(l,2*u),f.fromArray(l,2*d),m.fromArray(l,2*v),y.uv=e(g,s,c,h,p,f,m)),y.face=new n.Face3(u,d,v,n.Triangle.normal(s,c,h)),y.faceIndex=u),y}var r=new n.Matrix4,o=new n.Ray,a=new n.Sphere,s=new n.Vector3,c=new n.Vector3,h=new n.Vector3,l=new n.Vector3,u=new n.Vector3,d=new n.Vector3,p=new n.Vector2,f=new n.Vector2,m=new n.Vector2,v=new n.Vector3,g=new n.Vector3,y=new n.Vector3;return function(v,y){var x=this.geometry,b=this.material,w=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),a.copy(x.boundingSphere),a.applyMatrix4(w),v.ray.intersectsSphere(a)!==!1&&(r.getInverse(w),o.copy(v.ray).applyMatrix4(r),null===x.boundingBox||o.intersectsBox(x.boundingBox)!==!1))){var M,_;if(x instanceof n.BufferGeometry){var E,A,S,T=x.index,C=x.attributes,L=C.position.array;if(void 0!==C.uv&&(M=C.uv.array),null!==T)for(var R=T.array,P=0,D=R.length;D>P;P+=3)E=R[P],A=R[P+1],S=R[P+2],_=i(this,v,o,L,M,E,A,S),_&&(_.faceIndex=Math.floor(P/3),y.push(_));else for(var P=0,D=L.length;D>P;P+=9)E=P/3,A=E+1,S=E+2,_=i(this,v,o,L,M,E,A,S),_&&(_.index=E,y.push(_))}else if(x instanceof n.Geometry){var O,I,k,N=b instanceof n.MultiMaterial,B=N===!0?b.materials:null,F=x.vertices,V=x.faces,U=x.faceVertexUvs[0];U.length>0&&(M=U);for(var z=0,j=V.length;j>z;z++){var G=V[z],H=N===!0?B[G.materialIndex]:b;if(void 0!==H){if(O=F[G.a],I=F[G.b],k=F[G.c],H.morphTargets===!0){var W=x.morphTargets,q=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),h.set(0,0,0);for(var X=0,Y=W.length;Y>X;X++){var Q=q[X];if(0!==Q){var K=W[X].vertices;s.addScaledVector(l.subVectors(K[G.a],O),Q),c.addScaledVector(u.subVectors(K[G.b],I),Q),h.addScaledVector(d.subVectors(K[G.c],k),Q)}}s.add(O),c.add(I),h.add(k),O=s,I=c,k=h}if(_=t(this,v,o,O,I,k,g)){if(M){var Z=M[z];p.copy(Z[0]),f.copy(Z[1]),m.copy(Z[2]),_.uv=e(g,O,I,k,p,f,m)}_.face=G,_.faceIndex=z,y.push(_)}}}}}}}(),n.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},n.Bone=function(e){n.Object3D.call(this),this.type="Bone",this.skin=e},n.Bone.prototype=Object.create(n.Object3D.prototype),n.Bone.prototype.constructor=n.Bone,n.Bone.prototype.copy=function(e){return n.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},n.Skeleton=function(e,t,i){if(this.useVertexTexture=void 0!==i?i:!0,this.identityMatrix=new n.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=n.Math.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new n.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,n.RGBAFormat,n.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 o=0,a=this.bones.length;a>o;o++)this.boneInverses.push(new n.Matrix4)}},n.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var i=new n.Matrix4;this.bones[e]&&i.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(i)}},n.Skeleton.prototype.pose=function(){for(var e,t=0,i=this.bones.length;i>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,i=this.bones.length;i>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))},n.Skeleton.prototype.update=function(){var e=new n.Matrix4;return function(){for(var t=0,i=this.bones.length;i>t;t++){var r=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(r,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),n.Skeleton.prototype.clone=function(){return new n.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},n.SkinnedMesh=function(e,t,i){n.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new n.Matrix4,this.bindMatrixInverse=new n.Matrix4;var r=[];if(this.geometry&&void 0!==this.geometry.bones){for(var o,a,s=0,c=this.geometry.bones.length;c>s;++s)a=this.geometry.bones[s],o=new n.Bone(this),r.push(o),o.name=a.name,o.position.fromArray(a.pos),o.quaternion.fromArray(a.rotq),void 0!==a.scl&&o.scale.fromArray(a.scl);for(var s=0,c=this.geometry.bones.length;c>s;++s)a=this.geometry.bones[s],-1!==a.parent&&null!==a.parent?r[a.parent].add(r[s]):this.add(r[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new n.Skeleton(r,void 0,i),this.matrixWorld)},n.SkinnedMesh.prototype=Object.create(n.Mesh.prototype),n.SkinnedMesh.prototype.constructor=n.SkinnedMesh,n.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)},n.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},n.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof n.Geometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],i=1/t.lengthManhattan();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0)}else if(this.geometry instanceof n.BufferGeometry)for(var r=new n.Vector4,o=this.geometry.attributes.skinWeight,e=0;e<o.count;e++){r.x=o.getX(e),r.y=o.getY(e),r.z=o.getZ(e),r.w=o.getW(e);var i=1/r.lengthManhattan();i!==1/0?r.multiplyScalar(i):r.set(1,0,0,0),o.setXYZW(e,r.x,r.y,r.z,r.w)}},n.SkinnedMesh.prototype.updateMatrixWorld=function(){n.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},n.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},n.LOD=function(){n.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},n.LOD.prototype=Object.create(n.Object3D.prototype),n.LOD.prototype.constructor=n.LOD,n.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=this.levels,r=0;r<i.length&&!(t<i[r].distance);r++);i.splice(r,0,{distance:t,object:e}),this.add(e)},n.LOD.prototype.getObjectForDistance=function(e){for(var t=this.levels,i=1,r=t.length;r>i&&!(e<t[i].distance);i++);return t[i-1].object},n.LOD.prototype.raycast=function(){var e=new n.Vector3;return function(t,i){e.setFromMatrixPosition(this.matrixWorld);var r=t.ray.origin.distanceTo(e);this.getObjectForDistance(r).raycast(t,i)}}(),n.LOD.prototype.update=function(){var e=new n.Vector3,t=new n.Vector3;return function(i){var r=this.levels;if(r.length>1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);r[0].object.visible=!0;for(var o=1,a=r.length;a>o&&n>=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;a>o;o++)r[o].object.visible=!1}}}(),n.LOD.prototype.copy=function(e){n.Object3D.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,r=t.length;r>i;i++){var o=t[i];this.addLevel(o.object.clone(),o.distance)}return this},n.LOD.prototype.toJSON=function(e){var t=n.Object3D.prototype.toJSON.call(this,e);t.object.levels=[];for(var i=this.levels,r=0,o=i.length;o>r;r++){var a=i[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t},n.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]),i=new Float32Array([0,0,1,0,1,1,0,1]),r=new n.BufferGeometry;return r.setIndex(new n.BufferAttribute(e,1)),r.addAttribute("position",new n.BufferAttribute(t,3)),r.addAttribute("uv",new n.BufferAttribute(i,2)),function(e){n.Object3D.call(this),this.type="Sprite",this.geometry=r,this.material=void 0!==e?e:new n.SpriteMaterial}}(),n.Sprite.prototype=Object.create(n.Object3D.prototype),n.Sprite.prototype.constructor=n.Sprite,n.Sprite.prototype.raycast=function(){var e=new n.Vector3;return function(t,i){e.setFromMatrixPosition(this.matrixWorld);var r=t.ray.distanceSqToPoint(e),n=this.scale.x*this.scale.y;r>n||i.push({distance:Math.sqrt(r),point:this.position,face:null,object:this})}}(),n.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},n.Particle=n.Sprite,n.LensFlare=function(e,t,i,r,o){n.Object3D.call(this),this.lensFlares=[],this.positionScreen=new n.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,r,o)},n.LensFlare.prototype=Object.create(n.Object3D.prototype),n.LensFlare.prototype.constructor=n.LensFlare,n.LensFlare.prototype.add=function(e,t,i,r,o,a){void 0===t&&(t=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===o&&(o=new n.Color(16777215)),void 0===r&&(r=n.NormalBlending),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:e,size:t,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:o,blending:r})},n.LensFlare.prototype.updateLensFlares=function(){var e,t,i=this.lensFlares.length,r=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;i>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+r*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},n.LensFlare.prototype.copy=function(e){n.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,i=e.lensFlares.length;i>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},n.Scene=function(){n.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},n.Scene.prototype=Object.create(n.Object3D.prototype),n.Scene.prototype.constructor=n.Scene,n.Scene.prototype.copy=function(e,t){return n.Object3D.prototype.copy.call(this,e,t),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},n.Fog=function(e,t,i){this.name="",this.color=new n.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3},n.Fog.prototype.clone=function(){return new n.Fog(this.color.getHex(),this.near,this.far)},n.FogExp2=function(e,t){this.name="",this.color=new n.Color(e),this.density=void 0!==t?t:25e-5},n.FogExp2.prototype.clone=function(){return new n.FogExp2(this.color.getHex(),this.density)},n.ShaderChunk={},n.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",n.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif\n",n.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",n.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif\n",n.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",n.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",n.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",n.ShaderChunk.bsdfs="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n return any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n if( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n return distanceFalloff * maxDistanceCutoffFactor;\n#else\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n }\n return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_Smith( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",n.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\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 return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\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 float fDet = dot( vSigmaX, R1 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n",n.ShaderChunk.color_fragment="#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",n.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif\n",n.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",n.ShaderChunk.color_vertex="#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",n.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",n.ShaderChunk.cube_uv_reflection_fragment="#ifdef ENVMAP_TYPE_CUBE_UV\nconst float cubeUV_textureSize = 1024.0;\nint getFaceFromDirection(vec3 direction) {\n vec3 absDirection = abs(direction);\n int face = -1;\n if( absDirection.x > absDirection.z ) {\n if(absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0 : 3;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n else {\n if(absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2 : 5;\n else\n face = direction.y > 0.0 ? 1 : 4;\n }\n return face;\n}\nconst float cubeUV_maxLods1 = log2(cubeUV_textureSize*0.25) - 1.0;\nconst float cubeUV_rangeClamp = exp2((6.0 - 1.0) * 2.0);\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n float dxRoughness = dFdx(roughness);\n float dyRoughness = dFdy(roughness);\n vec3 dx = dFdx( vec * scale * dxRoughness );\n vec3 dy = dFdy( vec * scale * dyRoughness );\n float d = max( dot( dx, dx ), dot( dy, dy ) );\n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\nconst float cubeUV_maxLods2 = log2(cubeUV_textureSize*0.25) - 2.0;\nconst float cubeUV_rcpTextureSize = 1.0 / cubeUV_textureSize;\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n float powScale = exp2_packed.x * exp2_packed.y;\n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 r;\n vec2 offset;\n int face = getFaceFromDirection(direction);\n float rcpPowScale = 1.0 / powScale;\n if( face == 0) {\n r = vec3(direction.x, -direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 1) {\n r = vec3(direction.y, direction.x, direction.z);\n offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 2) {\n r = vec3(direction.z, direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n }\n else if( face == 3) {\n r = vec3(direction.x, direction.z, direction.y);\n offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else if( face == 4) {\n r = vec3(direction.y, direction.x, -direction.z);\n offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n else {\n r = vec3(direction.z, -direction.x, direction.y);\n offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n }\n r = normalize(r);\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n vec2 base = offset + vec2( texelOffset );\n return base + s * ( scale - 2.0 * texelOffset );\n}\nconst float cubeUV_maxLods3 = log2(cubeUV_textureSize*0.25) - 3.0;\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n float roughnessVal = roughness* cubeUV_maxLods3;\n float r1 = floor(roughnessVal);\n float r2 = r1 + 1.0;\n float t = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n float s = mipInfo.y;\n float level0 = mipInfo.x;\n float level1 = level0 + 1.0;\n level1 = level1 > 5.0 ? 5.0 : level1;\n level0 += min( floor( s + 0.5 ), 5.0 );\n vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n vec4 result = mix(color10, color20, t);\n return vec4(result.rgb, 1.0);\n}\n#endif\n",
n.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n objectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",n.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",n.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif\n",n.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",n.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif\n",n.ShaderChunk.encodings_pars_fragment="\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",n.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",n.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\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 #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 envColor = envMapTexelToLinear( envColor );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif\n",n.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n uniform float reflectivity;\n uniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif\n",n.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n varying vec3 vReflect;\n uniform float refractionRatio;\n#endif\n",n.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n#endif\n",n.ShaderChunk.fog_fragment="#ifdef USE_FOG\n #ifdef USE_LOGDEPTHBUF_EXT\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n #else\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n #endif\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",n.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n uniform vec3 fogColor;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",n.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",n.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",n.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n vLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n directLight = getPointDirectLightIrradiance( pointLights[ i ], geometry );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n directLight = getSpotDirectLightIrradiance( spotLights[ i ], geometry );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directLight = getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n#endif\n",n.ShaderChunk.lights_pars="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n IncidentLight getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n return directLight;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n IncidentLight getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n if ( testLightInRange( lightDistance, pointLight.distance ) ) {\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n return directLight;\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n IncidentLight getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry ) {\n IncidentLight directLight;\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n return directLight;\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n vec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n #else\n vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n #endif\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\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 #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\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 #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n",n.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",n.ShaderChunk.lights_phong_pars_fragment="#ifdef USE_ENVMAP\n varying vec3 vWorldPosition;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)\n",n.ShaderChunk.lights_phong_pars_vertex="#ifdef USE_ENVMAP\n varying vec3 vWorldPosition;\n#endif\n",n.ShaderChunk.lights_phong_vertex="#ifdef USE_ENVMAP\n vWorldPosition = worldPosition.xyz;\n#endif\n",n.ShaderChunk.lights_standard_fragment="StandardMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\nmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n",n.ShaderChunk.lights_standard_pars_fragment="struct StandardMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n};\nvoid RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n}\nvoid RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n}\n#define RE_Direct RE_Direct_Standard\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Standard\n#define RE_IndirectSpecular RE_IndirectSpecular_Standard\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",n.ShaderChunk.lights_template="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n directLight = getPointDirectLightIrradiance( pointLight, geometry );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n directLight = getSpotDirectLightIrradiance( spotLight, geometry );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n directLight = getDirectionalDirectLightIrradiance( directionalLight, geometry );\n #ifdef USE_SHADOWMAP\n directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n irradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n #endif\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n RE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n#endif\n",n.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",n.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n#endif\n",n.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #endif\n uniform float logDepthBufFC;\n#endif",n.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n #endif\n#endif\n",n.ShaderChunk.map_fragment="#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif\n",n.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n",n.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",n.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n#endif\n",n.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.r;\n#endif\n",n.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",n.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\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#endif\n",n.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif",n.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\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 #ifndef USE_MORPHNORMALS\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 #endif\n#endif\n",n.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #endif\n#endif\n#ifdef USE_NORMALMAP\n normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",n.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\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 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 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#endif\n",n.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",n.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n vec4 mvPosition = modelViewMatrix * skinned;\n#else\n vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",n.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.r;\n#endif\n",n.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",n.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n float unpackDepth( const in vec4 rgba_depth ) {\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 return dot( rgba_depth, bit_shift );\n }\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackDepth( texture2D( depths, uv ) ) );\n }\n float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n const vec2 offset = vec2( 0.0, 1.0 );\n vec2 texelSize = vec2( 1.0 ) / size;\n vec2 centroidUV = floor( uv * size + 0.5 ) / size;\n float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n vec2 f = fract( uv * size + 0.5 );\n float a = mix( lb, lt, f.y );\n float b = mix( rb, rt, f.y );\n float c = mix( a, b, f.x );\n return c;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\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 bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n return (\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return 1.0;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\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 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif\n",
n.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n #endif\n#endif\n",n.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #endif\n#endif\n",n.ShaderChunk.shadowmask_pars_fragment="float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n }\n #endif\n #endif\n return shadow;\n}\n",n.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\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#endif",n.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n y = dy * ( y + 0.5 );\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 mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif\n",n.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\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#endif\n",n.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\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 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",n.ShaderChunk.specularmap_fragment="float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",n.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",n.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",n.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",n.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif",n.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",n.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = uv2;\n#endif",n.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n varying vec2 vUv;\n#endif",n.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n#endif\n",n.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",n.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n #ifdef USE_SKINNING\n vec4 worldPosition = modelMatrix * skinned;\n #else\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #endif\n#endif\n",n.UniformsUtils={merge:function(e){for(var t={},i=0;i<e.length;i++){var r=this.clone(e[i]);for(var n in r)t[n]=r[n]}return t},clone:function(e){var t={};for(var i in e){t[i]={};for(var r in e[i]){var o=e[i][r];t[i][r]=o instanceof n.Color||o instanceof n.Vector2||o instanceof n.Vector3||o instanceof n.Vector4||o instanceof n.Matrix3||o instanceof n.Matrix4||o instanceof n.Texture?o.clone():Array.isArray(o)?o.slice():o}}return t}},n.UniformsLib={common:{diffuse:{type:"c",value:new n.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new n.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new n.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new n.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},directionalShadowMap:{type:"tv",value:[]},directionalShadowMatrix:{type:"m4v",value:[]},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"f"},coneCos:{type:"f"},penumbraCos:{type:"f"},decay:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},spotShadowMap:{type:"tv",value:[]},spotShadowMatrix:{type:"m4v",value:[]},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"f"},distance:{type:"f"},shadow:{type:"i"},shadowBias:{type:"f"},shadowRadius:{type:"f"},shadowMapSize:{type:"v2"}}},pointShadowMap:{type:"tv",value:[]},pointShadowMatrix:{type:"m4v",value:[]},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}}},points:{diffuse:{type:"c",value:new n.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new n.Vector4(0,0,1,1)}}},n.ShaderChunk.cube_frag="uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n #include <logdepthbuf_fragment>\n}\n",n.ShaderChunk.cube_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n #include <logdepthbuf_vertex>\n}\n",n.ShaderChunk.depth_frag="uniform float mNear;\nuniform float mFar;\nuniform float opacity;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n #ifdef USE_LOGDEPTHBUF_EXT\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n #else\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n #endif\n float color = 1.0 - smoothstep( mNear, mFar, depth );\n gl_FragColor = vec4( vec3( color ), opacity );\n}\n",n.ShaderChunk.depth_vert="#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n}\n",n.ShaderChunk.depthRGBA_frag="#include <common>\n#include <logdepthbuf_pars_fragment>\nvec4 pack_depth( const in float depth ) {\n const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n res -= res.xxyz * bit_mask;\n return res;\n}\nvoid main() {\n #include <logdepthbuf_fragment>\n #ifdef USE_LOGDEPTHBUF_EXT\n gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n #else\n gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n #endif\n}\n",n.ShaderChunk.depthRGBA_vert="#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n}\n",n.ShaderChunk.distanceRGBA_frag="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\nvec4 pack1K ( float depth ) {\n depth /= 1000.0;\n const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n vec4 res = mod( depth * bitSh * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n res -= res.xxyz * bitMsk;\n return res;\n}\nfloat unpack1K ( vec4 color ) {\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 return dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n gl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}\n",n.ShaderChunk.distanceRGBA_vert="varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\nvoid main() {\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n vWorldPosition = worldPosition;\n}\n",n.ShaderChunk.equirect_frag="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n vec3 direction = normalize( vWorldPosition );\n vec2 sampleUV;\n sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <logdepthbuf_fragment>\n}\n",n.ShaderChunk.equirect_vert="varying vec3 vWorldPosition;\n#include <common>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n vWorldPosition = transformDirection( position, modelMatrix );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n #include <logdepthbuf_vertex>\n}\n",n.ShaderChunk.linedashed_frag="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",n.ShaderChunk.linedashed_vert="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <color_vertex>\n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n}\n",n.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight;\n reflectedLight.directDiffuse = vec3( 0.0 );\n reflectedLight.directSpecular = vec3( 0.0 );\n reflectedLight.indirectDiffuse = diffuseColor.rgb;\n reflectedLight.indirectSpecular = vec3( 0.0 );\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",n.ShaderChunk.meshbasic_vert="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n}\n",n.ShaderChunk.meshlambert_frag="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",n.ShaderChunk.meshlambert_vert="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n}\n",n.ShaderChunk.meshphong_frag="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",n.ShaderChunk.meshphong_vert="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <lights_phong_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_phong_vertex>\n #include <shadowmap_vertex>\n}\n",n.ShaderChunk.meshstandard_frag="#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_standard_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment>\n #include <emissivemap_fragment>\n #include <lights_standard_fragment>\n #include <lights_template>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",n.ShaderChunk.meshstandard_vert="#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <displacementmap_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n}\n",n.ShaderChunk.normal_frag="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n #include <logdepthbuf_fragment>\n}\n",n.ShaderChunk.normal_vert="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n vNormal = normalize( normalMatrix * normal );\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n}\n",n.ShaderChunk.points_frag="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",n.ShaderChunk.points_vert="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <project_vertex>\n #ifdef USE_SIZEATTENUATION\n gl_PointSize = size * ( scale / - mvPosition.z );\n #else\n gl_PointSize = size;\n #endif\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n}\n",n.ShaderLib={basic:{uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.aomap,n.UniformsLib.fog]),vertexShader:n.ShaderChunk.meshbasic_vert,fragmentShader:n.ShaderChunk.meshbasic_frag},lambert:{uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.aomap,n.UniformsLib.lightmap,n.UniformsLib.emissivemap,n.UniformsLib.fog,n.UniformsLib.lights,{emissive:{type:"c",value:new n.Color(0)}}]),vertexShader:n.ShaderChunk.meshlambert_vert,fragmentShader:n.ShaderChunk.meshlambert_frag},phong:{uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.aomap,n.UniformsLib.lightmap,n.UniformsLib.emissivemap,n.UniformsLib.bumpmap,n.UniformsLib.normalmap,n.UniformsLib.displacementmap,n.UniformsLib.fog,n.UniformsLib.lights,{emissive:{type:"c",value:new n.Color(0)},specular:{type:"c",value:new n.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:n.ShaderChunk.meshphong_vert,fragmentShader:n.ShaderChunk.meshphong_frag},standard:{uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.aomap,n.UniformsLib.lightmap,n.UniformsLib.emissivemap,n.UniformsLib.bumpmap,n.UniformsLib.normalmap,n.UniformsLib.displacementmap,n.UniformsLib.roughnessmap,n.UniformsLib.metalnessmap,n.UniformsLib.fog,n.UniformsLib.lights,{emissive:{type:"c",value:new n.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:n.ShaderChunk.meshstandard_vert,fragmentShader:n.ShaderChunk.meshstandard_frag},points:{uniforms:n.UniformsUtils.merge([n.UniformsLib.points,n.UniformsLib.fog]),vertexShader:n.ShaderChunk.points_vert,fragmentShader:n.ShaderChunk.points_frag},dashed:{uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:n.ShaderChunk.linedashed_vert,fragmentShader:n.ShaderChunk.linedashed_frag},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:n.ShaderChunk.depth_vert,fragmentShader:n.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:n.ShaderChunk.normal_vert,fragmentShader:n.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:n.ShaderChunk.cube_vert,fragmentShader:n.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:n.ShaderChunk.equirect_vert,fragmentShader:n.ShaderChunk.equirect_frag},depthRGBA:{uniforms:{},vertexShader:n.ShaderChunk.depthRGBA_vert,fragmentShader:n.ShaderChunk.depthRGBA_frag},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new n.Vector3(0,0,0)}},vertexShader:n.ShaderChunk.distanceRGBA_vert,fragmentShader:n.ShaderChunk.distanceRGBA_frag}},n.WebGLRenderer=function(e){function t(){return null===xe?De:1}function i(e,t,i,r){se===!0&&(e*=r,t*=r,i*=r),Xe.clearColor(e,t,i,r)}function r(){Xe.init(),Xe.scissor(Ee.copy(Oe).multiplyScalar(De)),Xe.viewport(Se.copy(ke).multiplyScalar(De)),i(Ce.r,Ce.g,Ce.b,Le)}function o(){ye=null,_e=null,Me="",we=-1,Xe.reset()}function a(e){e.preventDefault(),o(),r(),Ye.clear()}function s(e){var t=e.target;t.removeEventListener("dispose",s),l(t),Ue.textures--}function c(e){var t=e.target;t.removeEventListener("dispose",c),u(t),Ue.textures--}function h(e){var t=e.target;t.removeEventListener("dispose",h),d(t)}function l(e){var t=Ye.get(e);if(e.image&&t.__image__webglTextureCube)je.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;je.deleteTexture(t.__webglTexture)}Ye["delete"](e)}function u(e){var t=Ye.get(e),i=Ye.get(e.texture);if(e&&void 0!==i.__webglTexture){if(je.deleteTexture(i.__webglTexture),e instanceof n.WebGLRenderTargetCube)for(var r=0;6>r;r++)je.deleteFramebuffer(t.__webglFramebuffer[r]),je.deleteRenderbuffer(t.__webglDepthbuffer[r]);
else je.deleteFramebuffer(t.__webglFramebuffer),je.deleteRenderbuffer(t.__webglDepthbuffer);Ye["delete"](e.texture),Ye["delete"](e)}}function d(e){p(e),Ye["delete"](e)}function p(e){var t=Ye.get(e).program;e.program=void 0,void 0!==t&&Ke.releaseProgram(t)}function f(e,t,i,r){var o;if(i instanceof n.InstancedBufferGeometry&&(o=We.get("ANGLE_instanced_arrays"),null===o))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===r&&(r=0),Xe.initAttributes();var a=i.attributes,s=t.getAttributes(),c=e.defaultAttributeValues;for(var h in s){var l=s[h];if(l>=0){var u=a[h];if(void 0!==u){var d=u.itemSize,p=Qe.getAttributeBuffer(u);if(u instanceof n.InterleavedBufferAttribute){var f=u.data,m=f.stride,v=u.offset;f instanceof n.InstancedInterleavedBuffer?(Xe.enableAttributeAndDivisor(l,f.meshPerAttribute,o),void 0===i.maxInstancedCount&&(i.maxInstancedCount=f.meshPerAttribute*f.count)):Xe.enableAttribute(l),je.bindBuffer(je.ARRAY_BUFFER,p),je.vertexAttribPointer(l,d,je.FLOAT,!1,m*f.array.BYTES_PER_ELEMENT,(r*m+v)*f.array.BYTES_PER_ELEMENT)}else u instanceof n.InstancedBufferAttribute?(Xe.enableAttributeAndDivisor(l,u.meshPerAttribute,o),void 0===i.maxInstancedCount&&(i.maxInstancedCount=u.meshPerAttribute*u.count)):Xe.enableAttribute(l),je.bindBuffer(je.ARRAY_BUFFER,p),je.vertexAttribPointer(l,d,je.FLOAT,!1,0,r*d*4)}else if(void 0!==c){var g=c[h];if(void 0!==g)switch(g.length){case 2:je.vertexAttrib2fv(l,g);break;case 3:je.vertexAttrib3fv(l,g);break;case 4:je.vertexAttrib4fv(l,g);break;default:je.vertexAttrib1fv(l,g)}}}}Xe.disableUnusedAttributes()}function m(e,t){return Math.abs(t[0])-Math.abs(e[0])}function v(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 g(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 y(e,t,i,r,n){var o,a;i.transparent?(o=de,a=++pe):(o=le,a=++ue);var s=o[a];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=i,s.z=Fe.z,s.group=n):(s={id:e.id,object:e,geometry:t,material:i,z:Fe.z,group:n},o.push(s))}function x(e,t){if(e.visible!==!1){if(e.layers.test(t.layers))if(e instanceof n.Light)he.push(e);else if(e instanceof n.Sprite)(e.frustumCulled===!1||Ne.intersectsObject(e)===!0)&&me.push(e);else if(e instanceof n.LensFlare)ve.push(e);else if(e instanceof n.ImmediateRenderObject)ge.sortObjects===!0&&(Fe.setFromMatrixPosition(e.matrixWorld),Fe.applyProjection(Be)),y(e,null,e.material,Fe.z,null);else if((e instanceof n.Mesh||e instanceof n.Line||e instanceof n.Points)&&(e instanceof n.SkinnedMesh&&e.skeleton.update(),e.frustumCulled===!1||Ne.intersectsObject(e)===!0)){var i=e.material;if(i.visible===!0){ge.sortObjects===!0&&(Fe.setFromMatrixPosition(e.matrixWorld),Fe.applyProjection(Be));var r=Qe.update(e);if(i instanceof n.MultiMaterial)for(var o=r.groups,a=i.materials,s=0,c=o.length;c>s;s++){var h=o[s],l=a[h.materialIndex];l.visible===!0&&y(e,r,l,Fe.z,h)}else y(e,r,i,Fe.z,null)}}for(var u=e.children,s=0,c=u.length;c>s;s++)x(u[s],t)}}function b(e,t,i,r){for(var o=0,a=e.length;a>o;o++){var s=e[o],c=s.object,h=s.geometry,l=void 0===r?s.material:r,u=s.group;if(c.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,c.matrixWorld),c.normalMatrix.getNormalMatrix(c.modelViewMatrix),c instanceof n.ImmediateRenderObject){M(l);var d=E(t,i,l,c);Me="",c.render(function(e){ge.renderBufferImmediate(e,d,l)})}else ge.renderBufferDirect(t,i,h,l,c,u)}}function w(e,t,i){var r=Ye.get(e),o=Ke.getParameters(e,Ve,t,i),a=Ke.getProgramCode(e,o),s=r.program,c=!0;if(void 0===s)e.addEventListener("dispose",h);else if(s.code!==a)p(e);else{if(void 0!==o.shaderID)return;c=!1}if(c){if(o.shaderID){var l=n.ShaderLib[o.shaderID];r.__webglShader={name:e.type,uniforms:n.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else r.__webglShader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.__webglShader=r.__webglShader,s=Ke.acquireProgram(e,o,a),r.program=s,e.program=s}var u=s.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<ge.maxMorphTargets;d++)u["morphTarget"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var d=0;d<ge.maxMorphNormals;d++)u["morphNormal"+d]>=0&&e.numSupportedMorphNormals++}r.uniformsList=[];var f=r.__webglShader.uniforms,m=r.program.getUniforms();for(var v in f){var g=m[v];g&&r.uniformsList.push([r.__webglShader.uniforms[v],g])}(e instanceof n.MeshPhongMaterial||e instanceof n.MeshLambertMaterial||e instanceof n.MeshStandardMaterial||e.lights)&&(r.lightsHash=Ve.hash,f.ambientLightColor.value=Ve.ambient,f.directionalLights.value=Ve.directional,f.spotLights.value=Ve.spot,f.pointLights.value=Ve.point,f.hemisphereLights.value=Ve.hemi,f.directionalShadowMap.value=Ve.directionalShadowMap,f.directionalShadowMatrix.value=Ve.directionalShadowMatrix,f.spotShadowMap.value=Ve.spotShadowMap,f.spotShadowMatrix.value=Ve.spotShadowMatrix,f.pointShadowMap.value=Ve.pointShadowMap,f.pointShadowMatrix.value=Ve.pointShadowMatrix),r.hasDynamicUniforms=!1;for(var y=0,x=r.uniformsList.length;x>y;y++){var b=r.uniformsList[y][0];if(b.dynamic===!0){r.hasDynamicUniforms=!0;break}}}function M(e){_(e),e.transparent===!0?Xe.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):Xe.setBlending(n.NoBlending),Xe.setDepthFunc(e.depthFunc),Xe.setDepthTest(e.depthTest),Xe.setDepthWrite(e.depthWrite),Xe.setColorWrite(e.colorWrite),Xe.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function _(e){e.side!==n.DoubleSide?Xe.enable(je.CULL_FACE):Xe.disable(je.CULL_FACE),Xe.setFlipSided(e.side===n.BackSide)}function E(e,t,i,r){Te=0;var o=Ye.get(i);void 0===o.program&&(i.needsUpdate=!0),void 0!==o.lightsHash&&o.lightsHash!==Ve.hash&&(i.needsUpdate=!0),i.needsUpdate&&(w(i,t,r),i.needsUpdate=!1);var a=!1,s=!1,c=!1,h=o.program,l=h.getUniforms(),u=o.__webglShader.uniforms;if(h.id!==ye&&(je.useProgram(h.program),ye=h.id,a=!0,s=!0,c=!0),i.id!==we&&(we=i.id,s=!0),(a||e!==_e)&&(je.uniformMatrix4fv(l.projectionMatrix,!1,e.projectionMatrix.elements),qe.logarithmicDepthBuffer&&je.uniform1f(l.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==_e&&(_e=e,s=!0,c=!0),(i instanceof n.ShaderMaterial||i instanceof n.MeshPhongMaterial||i instanceof n.MeshStandardMaterial||i.envMap)&&void 0!==l.cameraPosition&&(Fe.setFromMatrixPosition(e.matrixWorld),je.uniform3f(l.cameraPosition,Fe.x,Fe.y,Fe.z)),(i instanceof n.MeshPhongMaterial||i instanceof n.MeshLambertMaterial||i instanceof n.MeshBasicMaterial||i instanceof n.MeshStandardMaterial||i instanceof n.ShaderMaterial||i.skinning)&&void 0!==l.viewMatrix&&je.uniformMatrix4fv(l.viewMatrix,!1,e.matrixWorldInverse.elements),void 0!==l.toneMappingExposure&&je.uniform1f(l.toneMappingExposure,ge.toneMappingExposure),void 0!==l.toneMappingWhitePoint&&je.uniform1f(l.toneMappingWhitePoint,ge.toneMappingWhitePoint)),i.skinning)if(r.bindMatrix&&void 0!==l.bindMatrix&&je.uniformMatrix4fv(l.bindMatrix,!1,r.bindMatrix.elements),r.bindMatrixInverse&&void 0!==l.bindMatrixInverse&&je.uniformMatrix4fv(l.bindMatrixInverse,!1,r.bindMatrixInverse.elements),qe.floatVertexTextures&&r.skeleton&&r.skeleton.useVertexTexture){if(void 0!==l.boneTexture){var d=N();je.uniform1i(l.boneTexture,d),ge.setTexture(r.skeleton.boneTexture,d)}void 0!==l.boneTextureWidth&&je.uniform1i(l.boneTextureWidth,r.skeleton.boneTextureWidth),void 0!==l.boneTextureHeight&&je.uniform1i(l.boneTextureHeight,r.skeleton.boneTextureHeight)}else r.skeleton&&r.skeleton.boneMatrices&&void 0!==l.boneGlobalMatrices&&je.uniformMatrix4fv(l.boneGlobalMatrices,!1,r.skeleton.boneMatrices);return s&&((i instanceof n.MeshPhongMaterial||i instanceof n.MeshLambertMaterial||i instanceof n.MeshStandardMaterial||i.lights)&&I(u,c),t&&i.fog&&R(u,t),(i instanceof n.MeshBasicMaterial||i instanceof n.MeshLambertMaterial||i instanceof n.MeshPhongMaterial||i instanceof n.MeshStandardMaterial)&&S(u,i),i instanceof n.LineBasicMaterial?T(u,i):i instanceof n.LineDashedMaterial?(T(u,i),C(u,i)):i instanceof n.PointsMaterial?L(u,i):i instanceof n.MeshLambertMaterial?P(u,i):i instanceof n.MeshPhongMaterial?D(u,i):i instanceof n.MeshStandardMaterial?O(u,i):i instanceof n.MeshDepthMaterial?(u.mNear.value=e.near,u.mFar.value=e.far,u.opacity.value=i.opacity):i instanceof n.MeshNormalMaterial&&(u.opacity.value=i.opacity),F(o.uniformsList)),k(l,r),void 0!==l.modelMatrix&&je.uniformMatrix4fv(l.modelMatrix,!1,r.matrixWorld.elements),o.hasDynamicUniforms===!0&&A(o.uniformsList,r,e),h}function A(e,t,i){for(var r=[],n=0,o=e.length;o>n;n++){var a=e[n][0],s=a.onUpdateCallback;void 0!==s&&(s.bind(a)(t,i),r.push(e[n]))}F(r)}function S(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),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 i;if(t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i){i instanceof n.WebGLRenderTarget&&(i=i.texture);var r=i.offset,o=i.repeat;e.offsetRepeat.value.set(r.x,r.y,o.x,o.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof n.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function T(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function C(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function L(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*De,e.scale.value=te.clientHeight/2,e.map.value=t.map,null!==t.map){var i=t.map.offset,r=t.map.repeat;e.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}}function R(e,t){e.fogColor.value=t.color,t instanceof n.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof n.FogExp2&&(e.fogDensity.value=t.density)}function P(e,t){t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function D(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 O(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),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),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function I(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function k(e,t){je.uniformMatrix4fv(e.modelViewMatrix,!1,t.modelViewMatrix.elements),e.normalMatrix&&je.uniformMatrix3fv(e.normalMatrix,!1,t.normalMatrix.elements)}function N(){var e=Te;return e>=qe.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+qe.maxTextures),Te+=1,e}function B(e,t,i,r){var o,a;if("1i"===t)je.uniform1i(i,r);else if("1f"===t)je.uniform1f(i,r);else if("2f"===t)je.uniform2f(i,r[0],r[1]);else if("3f"===t)je.uniform3f(i,r[0],r[1],r[2]);else if("4f"===t)je.uniform4f(i,r[0],r[1],r[2],r[3]);else if("1iv"===t)je.uniform1iv(i,r);else if("3iv"===t)je.uniform3iv(i,r);else if("1fv"===t)je.uniform1fv(i,r);else if("2fv"===t)je.uniform2fv(i,r);else if("3fv"===t)je.uniform3fv(i,r);else if("4fv"===t)je.uniform4fv(i,r);else if("Matrix2fv"===t)je.uniformMatrix2fv(i,!1,r);else if("Matrix3fv"===t)je.uniformMatrix3fv(i,!1,r);else if("Matrix4fv"===t)je.uniformMatrix4fv(i,!1,r);else if("i"===t)je.uniform1i(i,r);else if("f"===t)je.uniform1f(i,r);else if("v2"===t)je.uniform2f(i,r.x,r.y);else if("v3"===t)je.uniform3f(i,r.x,r.y,r.z);else if("v4"===t)je.uniform4f(i,r.x,r.y,r.z,r.w);else if("c"===t)je.uniform3f(i,r.r,r.g,r.b);else if("s"===t){var s=e.properties;for(var c in s){var h=s[c],l=i[c],u=r[c];B(h,h.type,l,u)}}else if("sa"===t)for(var s=e.properties,d=0,p=r.length;p>d;d++)for(var c in s){var h=s[c],l=i[d][c],u=r[d][c];B(h,h.type,l,u)}else if("iv1"===t)je.uniform1iv(i,r);else if("iv"===t)je.uniform3iv(i,r);else if("fv1"===t)je.uniform1fv(i,r);else if("fv"===t)je.uniform3fv(i,r);else if("v2v"===t){void 0===e._array&&(e._array=new Float32Array(2*r.length));for(var d=0,f=0,m=r.length;m>d;d++,f+=2)e._array[f+0]=r[d].x,e._array[f+1]=r[d].y;je.uniform2fv(i,e._array)}else if("v3v"===t){void 0===e._array&&(e._array=new Float32Array(3*r.length));for(var d=0,v=0,m=r.length;m>d;d++,v+=3)e._array[v+0]=r[d].x,e._array[v+1]=r[d].y,e._array[v+2]=r[d].z;je.uniform3fv(i,e._array)}else if("v4v"===t){void 0===e._array&&(e._array=new Float32Array(4*r.length));for(var d=0,g=0,m=r.length;m>d;d++,g+=4)e._array[g+0]=r[d].x,e._array[g+1]=r[d].y,e._array[g+2]=r[d].z,e._array[g+3]=r[d].w;je.uniform4fv(i,e._array)}else if("m2"===t)je.uniformMatrix2fv(i,!1,r.elements);else if("m3"===t)je.uniformMatrix3fv(i,!1,r.elements);else if("m3v"===t){void 0===e._array&&(e._array=new Float32Array(9*r.length));for(var d=0,m=r.length;m>d;d++)r[d].flattenToArrayOffset(e._array,9*d);je.uniformMatrix3fv(i,!1,e._array)}else if("m4"===t)je.uniformMatrix4fv(i,!1,r.elements);else if("m4v"===t){void 0===e._array&&(e._array=new Float32Array(16*r.length));for(var d=0,m=r.length;m>d;d++)r[d].flattenToArrayOffset(e._array,16*d);je.uniformMatrix4fv(i,!1,e._array)}else if("t"===t){if(o=r,a=N(),je.uniform1i(i,a),!o)return;o instanceof n.CubeTexture||Array.isArray(o.image)&&6===o.image.length?q(o,a):o instanceof n.WebGLRenderTargetCube?X(o.texture,a):o instanceof n.WebGLRenderTarget?ge.setTexture(o.texture,a):ge.setTexture(o,a)}else if("tv"===t){void 0===e._array&&(e._array=[]);for(var d=0,m=e.value.length;m>d;d++)e._array[d]=N();je.uniform1iv(i,e._array);for(var d=0,m=e.value.length;m>d;d++)o=e.value[d],a=e._array[d],o&&(o instanceof n.CubeTexture||o.image instanceof Array&&6===o.image.length?q(o,a):o instanceof n.WebGLRenderTarget?ge.setTexture(o.texture,a):o instanceof n.WebGLRenderTargetCube?X(o.texture,a):ge.setTexture(o,a))}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+t)}function F(e){for(var t=0,i=e.length;i>t;t++){var r=e[t][0];if(r.needsUpdate!==!1){var n=r.type,o=e[t][1],a=r.value;B(r,n,o,a)}}}function V(e,t){var i,r,o,a,s,c,h=0,l=0,u=0,d=t.matrixWorldInverse,p=0,f=0,m=0,v=0,g=0;for(Ve.shadowsPointLight=0,i=0,r=e.length;r>i;i++)if(o=e[i],a=o.color,s=o.intensity,c=o.distance,o instanceof n.AmbientLight)h+=a.r*s,l+=a.g*s,u+=a.b*s;else if(o instanceof n.DirectionalLight){var y=Ze.get(o);y.color.copy(o.color).multiplyScalar(o.intensity),y.direction.setFromMatrixPosition(o.matrixWorld),Fe.setFromMatrixPosition(o.target.matrixWorld),y.direction.sub(Fe),y.direction.transformDirection(d),y.shadow=o.castShadow,o.castShadow&&(y.shadowBias=o.shadow.bias,y.shadowRadius=o.shadow.radius,y.shadowMapSize=o.shadow.mapSize,Ve.shadows[g++]=o),Ve.directionalShadowMap[p]=o.shadow.map,Ve.directionalShadowMatrix[p]=o.shadow.matrix,Ve.directional[p++]=y}else if(o instanceof n.SpotLight){var y=Ze.get(o);y.position.setFromMatrixPosition(o.matrixWorld),y.position.applyMatrix4(d),y.color.copy(a).multiplyScalar(s),y.distance=c,y.direction.setFromMatrixPosition(o.matrixWorld),Fe.setFromMatrixPosition(o.target.matrixWorld),y.direction.sub(Fe),y.direction.transformDirection(d),y.coneCos=Math.cos(o.angle),y.penumbraCos=Math.cos(o.angle*(1-o.penumbra)),y.decay=0===o.distance?0:o.decay,y.shadow=o.castShadow,o.castShadow&&(y.shadowBias=o.shadow.bias,y.shadowRadius=o.shadow.radius,y.shadowMapSize=o.shadow.mapSize,Ve.shadows[g++]=o),Ve.spotShadowMap[m]=o.shadow.map,Ve.spotShadowMatrix[m]=o.shadow.matrix,Ve.spot[m++]=y}else if(o instanceof n.PointLight){var y=Ze.get(o);y.position.setFromMatrixPosition(o.matrixWorld),y.position.applyMatrix4(d),y.color.copy(o.color).multiplyScalar(o.intensity),y.distance=o.distance,y.decay=0===o.distance?0:o.decay,y.shadow=o.castShadow,o.castShadow&&(y.shadowBias=o.shadow.bias,y.shadowRadius=o.shadow.radius,y.shadowMapSize=o.shadow.mapSize,Ve.shadows[g++]=o),Ve.pointShadowMap[f]=o.shadow.map,void 0===Ve.pointShadowMatrix[f]&&(Ve.pointShadowMatrix[f]=new n.Matrix4),Fe.setFromMatrixPosition(o.matrixWorld).negate(),Ve.pointShadowMatrix[f].identity().setPosition(Fe),Ve.point[f++]=y}else if(o instanceof n.HemisphereLight){var y=Ze.get(o);y.direction.setFromMatrixPosition(o.matrixWorld),y.direction.transformDirection(d),y.direction.normalize(),y.skyColor.copy(o.color).multiplyScalar(s),y.groundColor.copy(o.groundColor).multiplyScalar(s),Ve.hemi[v++]=y}Ve.ambient[0]=h,Ve.ambient[1]=l,Ve.ambient[2]=u,Ve.directional.length=p,Ve.spot.length=m,Ve.point.length=f,Ve.hemi.length=v,Ve.shadows.length=g,Ve.hash=p+","+f+","+m+","+v+","+g}function U(e,t,i){var r;if(i?(je.texParameteri(e,je.TEXTURE_WRAP_S,ee(t.wrapS)),je.texParameteri(e,je.TEXTURE_WRAP_T,ee(t.wrapT)),je.texParameteri(e,je.TEXTURE_MAG_FILTER,ee(t.magFilter)),je.texParameteri(e,je.TEXTURE_MIN_FILTER,ee(t.minFilter))):(je.texParameteri(e,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(e,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),(t.wrapS!==n.ClampToEdgeWrapping||t.wrapT!==n.ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),je.texParameteri(e,je.TEXTURE_MAG_FILTER,$(t.magFilter)),je.texParameteri(e,je.TEXTURE_MIN_FILTER,$(t.minFilter)),t.minFilter!==n.NearestFilter&&t.minFilter!==n.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),r=We.get("EXT_texture_filter_anisotropic")){if(t.type===n.FloatType&&null===We.get("OES_texture_float_linear"))return;if(t.type===n.HalfFloatType&&null===We.get("OES_texture_half_float_linear"))return;(t.anisotropy>1||Ye.get(t).__currentAnisotropy)&&(je.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,ge.getMaxAnisotropy())),Ye.get(t).__currentAnisotropy=t.anisotropy)}}function z(e,t,i){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",s),e.__webglTexture=je.createTexture(),Ue.textures++),Xe.activeTexture(je.TEXTURE0+i),Xe.bindTexture(je.TEXTURE_2D,e.__webglTexture),je.pixelStorei(je.UNPACK_FLIP_Y_WEBGL,t.flipY),je.pixelStorei(je.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),je.pixelStorei(je.UNPACK_ALIGNMENT,t.unpackAlignment);var r=j(t.image,qe.maxTextureSize);H(t)&&G(r)===!1&&(r=W(r));var o=G(r),a=ee(t.format),c=ee(t.type);U(je.TEXTURE_2D,t,o);var h,l=t.mipmaps;if(t instanceof n.DataTexture)if(l.length>0&&o){for(var u=0,d=l.length;d>u;u++)h=l[u],Xe.texImage2D(je.TEXTURE_2D,u,a,h.width,h.height,0,a,c,h.data);t.generateMipmaps=!1}else Xe.texImage2D(je.TEXTURE_2D,0,a,r.width,r.height,0,a,c,r.data);else if(t instanceof n.CompressedTexture)for(var u=0,d=l.length;d>u;u++)h=l[u],t.format!==n.RGBAFormat&&t.format!==n.RGBFormat?Xe.getCompressedTextureFormats().indexOf(a)>-1?Xe.compressedTexImage2D(je.TEXTURE_2D,u,a,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Xe.texImage2D(je.TEXTURE_2D,u,a,h.width,h.height,0,a,c,h.data);else if(l.length>0&&o){for(var u=0,d=l.length;d>u;u++)h=l[u],Xe.texImage2D(je.TEXTURE_2D,u,a,a,c,h);t.generateMipmaps=!1}else Xe.texImage2D(je.TEXTURE_2D,0,a,a,c,r);t.generateMipmaps&&o&&je.generateMipmap(je.TEXTURE_2D),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function j(e,t){if(e.width>t||e.height>t){var i=t/Math.max(e.width,e.height),r=document.createElement("canvas");r.width=Math.floor(e.width*i),r.height=Math.floor(e.height*i);var n=r.getContext("2d");return n.drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height,e),r}return e}function G(e){return n.Math.isPowerOfTwo(e.width)&&n.Math.isPowerOfTwo(e.height)}function H(e){return e.wrapS!==n.ClampToEdgeWrapping||e.wrapT!==n.ClampToEdgeWrapping?!0:e.minFilter!==n.NearestFilter&&e.minFilter!==n.LinearFilter?!0:!1}function W(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElement("canvas");t.width=n.Math.nearestPowerOfTwo(e.width),t.height=n.Math.nearestPowerOfTwo(e.height);var i=t.getContext("2d");return i.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 q(e,t){var i=Ye.get(e);if(6===e.image.length)if(e.version>0&&i.__version!==e.version){i.__image__webglTextureCube||(e.addEventListener("dispose",s),i.__image__webglTextureCube=je.createTexture(),Ue.textures++),Xe.activeTexture(je.TEXTURE0+t),Xe.bindTexture(je.TEXTURE_CUBE_MAP,i.__image__webglTextureCube),je.pixelStorei(je.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var r=e instanceof n.CompressedTexture,o=e.image[0]instanceof n.DataTexture,a=[],c=0;6>c;c++)a[c]=!ge.autoScaleCubemaps||r||o?o?e.image[c].image:e.image[c]:j(e.image[c],qe.maxCubemapSize);var h=a[0],l=G(h),u=ee(e.format),d=ee(e.type);U(je.TEXTURE_CUBE_MAP,e,l);for(var c=0;6>c;c++)if(r)for(var p,f=a[c].mipmaps,m=0,v=f.length;v>m;m++)p=f[m],e.format!==n.RGBAFormat&&e.format!==n.RGBFormat?Xe.getCompressedTextureFormats().indexOf(u)>-1?Xe.compressedTexImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+c,m,u,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):Xe.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+c,m,u,p.width,p.height,0,u,d,p.data);else o?Xe.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,u,a[c].width,a[c].height,0,u,d,a[c].data):Xe.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,u,u,d,a[c]);e.generateMipmaps&&l&&je.generateMipmap(je.TEXTURE_CUBE_MAP),i.__version=e.version,e.onUpdate&&e.onUpdate(e)}else Xe.activeTexture(je.TEXTURE0+t),Xe.bindTexture(je.TEXTURE_CUBE_MAP,i.__image__webglTextureCube)}function X(e,t){Xe.activeTexture(je.TEXTURE0+t),Xe.bindTexture(je.TEXTURE_CUBE_MAP,Ye.get(e).__webglTexture)}function Y(e,t,i,r){var n=ee(t.texture.format),o=ee(t.texture.type);Xe.texImage2D(r,0,n,t.width,t.height,0,n,o,null),je.bindFramebuffer(je.FRAMEBUFFER,e),je.framebufferTexture2D(je.FRAMEBUFFER,i,r,Ye.get(t.texture).__webglTexture,0),je.bindFramebuffer(je.FRAMEBUFFER,null)}function Q(e,t){je.bindRenderbuffer(je.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(je.renderbufferStorage(je.RENDERBUFFER,je.DEPTH_COMPONENT16,t.width,t.height),je.framebufferRenderbuffer(je.FRAMEBUFFER,je.DEPTH_ATTACHMENT,je.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(je.renderbufferStorage(je.RENDERBUFFER,je.DEPTH_STENCIL,t.width,t.height),je.framebufferRenderbuffer(je.FRAMEBUFFER,je.DEPTH_STENCIL_ATTACHMENT,je.RENDERBUFFER,e)):je.renderbufferStorage(je.RENDERBUFFER,je.RGBA4,t.width,t.height),je.bindRenderbuffer(je.RENDERBUFFER,null)}function K(e){var t=Ye.get(e),i=e instanceof n.WebGLRenderTargetCube;if(i){t.__webglDepthbuffer=[];for(var r=0;6>r;r++)je.bindFramebuffer(je.FRAMEBUFFER,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=je.createRenderbuffer(),Q(t.__webglDepthbuffer[r],e)}else je.bindFramebuffer(je.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=je.createRenderbuffer(),Q(t.__webglDepthbuffer,e);je.bindFramebuffer(je.FRAMEBUFFER,null)}function Z(e){var t=Ye.get(e),i=Ye.get(e.texture);e.addEventListener("dispose",c),i.__webglTexture=je.createTexture(),Ue.textures++;var r=e instanceof n.WebGLRenderTargetCube,o=n.Math.isPowerOfTwo(e.width)&&n.Math.isPowerOfTwo(e.height);if(r){t.__webglFramebuffer=[];for(var a=0;6>a;a++)t.__webglFramebuffer[a]=je.createFramebuffer()}else t.__webglFramebuffer=je.createFramebuffer();if(r){Xe.bindTexture(je.TEXTURE_CUBE_MAP,i.__webglTexture),U(je.TEXTURE_CUBE_MAP,e.texture,o);for(var a=0;6>a;a++)Y(t.__webglFramebuffer[a],e,je.COLOR_ATTACHMENT0,je.TEXTURE_CUBE_MAP_POSITIVE_X+a);e.texture.generateMipmaps&&o&&je.generateMipmap(je.TEXTURE_CUBE_MAP),Xe.bindTexture(je.TEXTURE_CUBE_MAP,null)}else Xe.bindTexture(je.TEXTURE_2D,i.__webglTexture),U(je.TEXTURE_2D,e.texture,o),Y(t.__webglFramebuffer,e,je.COLOR_ATTACHMENT0,je.TEXTURE_2D),e.texture.generateMipmaps&&o&&je.generateMipmap(je.TEXTURE_2D),Xe.bindTexture(je.TEXTURE_2D,null);e.depthBuffer&&K(e)}function J(e){var t=e instanceof n.WebGLRenderTargetCube?je.TEXTURE_CUBE_MAP:je.TEXTURE_2D,i=Ye.get(e.texture).__webglTexture;Xe.bindTexture(t,i),je.generateMipmap(t),Xe.bindTexture(t,null)}function $(e){return e===n.NearestFilter||e===n.NearestMipMapNearestFilter||e===n.NearestMipMapLinearFilter?je.NEAREST:je.LINEAR}function ee(e){var t;if(e===n.RepeatWrapping)return je.REPEAT;if(e===n.ClampToEdgeWrapping)return je.CLAMP_TO_EDGE;if(e===n.MirroredRepeatWrapping)return je.MIRRORED_REPEAT;if(e===n.NearestFilter)return je.NEAREST;if(e===n.NearestMipMapNearestFilter)return je.NEAREST_MIPMAP_NEAREST;if(e===n.NearestMipMapLinearFilter)return je.NEAREST_MIPMAP_LINEAR;if(e===n.LinearFilter)return je.LINEAR;if(e===n.LinearMipMapNearestFilter)return je.LINEAR_MIPMAP_NEAREST;if(e===n.LinearMipMapLinearFilter)return je.LINEAR_MIPMAP_LINEAR;if(e===n.UnsignedByteType)return je.UNSIGNED_BYTE;if(e===n.UnsignedShort4444Type)return je.UNSIGNED_SHORT_4_4_4_4;if(e===n.UnsignedShort5551Type)return je.UNSIGNED_SHORT_5_5_5_1;if(e===n.UnsignedShort565Type)return je.UNSIGNED_SHORT_5_6_5;if(e===n.ByteType)return je.BYTE;if(e===n.ShortType)return je.SHORT;if(e===n.UnsignedShortType)return je.UNSIGNED_SHORT;if(e===n.IntType)return je.INT;if(e===n.UnsignedIntType)return je.UNSIGNED_INT;if(e===n.FloatType)return je.FLOAT;if(t=We.get("OES_texture_half_float"),null!==t&&e===n.HalfFloatType)return t.HALF_FLOAT_OES;if(e===n.AlphaFormat)return je.ALPHA;if(e===n.RGBFormat)return je.RGB;if(e===n.RGBAFormat)return je.RGBA;if(e===n.LuminanceFormat)return je.LUMINANCE;if(e===n.LuminanceAlphaFormat)return je.LUMINANCE_ALPHA;if(e===n.AddEquation)return je.FUNC_ADD;if(e===n.SubtractEquation)return je.FUNC_SUBTRACT;if(e===n.ReverseSubtractEquation)return je.FUNC_REVERSE_SUBTRACT;if(e===n.ZeroFactor)return je.ZERO;if(e===n.OneFactor)return je.ONE;if(e===n.SrcColorFactor)return je.SRC_COLOR;if(e===n.OneMinusSrcColorFactor)return je.ONE_MINUS_SRC_COLOR;if(e===n.SrcAlphaFactor)return je.SRC_ALPHA;if(e===n.OneMinusSrcAlphaFactor)return je.ONE_MINUS_SRC_ALPHA;if(e===n.DstAlphaFactor)return je.DST_ALPHA;if(e===n.OneMinusDstAlphaFactor)return je.ONE_MINUS_DST_ALPHA;if(e===n.DstColorFactor)return je.DST_COLOR;if(e===n.OneMinusDstColorFactor)return je.ONE_MINUS_DST_COLOR;if(e===n.SrcAlphaSaturateFactor)return je.SRC_ALPHA_SATURATE;if(t=We.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===n.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===n.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===n.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===n.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=We.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===n.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===n.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===n.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===n.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=We.get("WEBGL_compressed_texture_etc1"),null!==t&&e===n.RGB_ETC1_Format)return t.COMPRESSED_RGB_ETC1_WEBGL;if(t=We.get("EXT_blend_minmax"),null!==t){if(e===n.MinEquation)return t.MIN_EXT;if(e===n.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",n.REVISION),e=e||{};var te=void 0!==e.canvas?e.canvas:document.createElement("canvas"),ie=void 0!==e.context?e.context:null,re=void 0!==e.alpha?e.alpha:!1,ne=void 0!==e.depth?e.depth:!0,oe=void 0!==e.stencil?e.stencil:!0,ae=void 0!==e.antialias?e.antialias:!1,se=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,ce=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,he=[],le=[],ue=-1,de=[],pe=-1,fe=new Float32Array(8),me=[],ve=[];this.domElement=te,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.physicallyCorrectLights=!1,this.toneMapping=n.LinearToneMapping,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var ge=this,ye=null,xe=null,be=null,we=-1,Me="",_e=null,Ee=new n.Vector4,Ae=null,Se=new n.Vector4,Te=0,Ce=new n.Color(0),Le=0,Re=te.width,Pe=te.height,De=1,Oe=new n.Vector4(0,0,Re,Pe),Ie=!1,ke=new n.Vector4(0,0,Re,Pe),Ne=new n.Frustum,Be=new n.Matrix4,Fe=new n.Vector3,Ve={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[],shadowsPointLight:0},Ue={geometries:0,textures:0},ze={calls:0,vertices:0,faces:0,points:0};this.info={render:ze,memory:Ue,programs:null};var je;try{var Ge={alpha:re,depth:ne,stencil:oe,antialias:ae,premultipliedAlpha:se,preserveDrawingBuffer:ce};if(je=ie||te.getContext("webgl",Ge)||te.getContext("experimental-webgl",Ge),null===je)throw null!==te.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===je.getShaderPrecisionFormat&&(je.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),te.addEventListener("webglcontextlost",a,!1)}catch(He){console.error("THREE.WebGLRenderer: "+He)}var We=new n.WebGLExtensions(je);We.get("OES_texture_float"),We.get("OES_texture_float_linear"),We.get("OES_texture_half_float"),We.get("OES_texture_half_float_linear"),We.get("OES_standard_derivatives"),We.get("ANGLE_instanced_arrays"),We.get("OES_element_index_uint")&&(n.BufferGeometry.MaxIndex=4294967296);var qe=new n.WebGLCapabilities(je,We,e),Xe=new n.WebGLState(je,We,ee),Ye=new n.WebGLProperties,Qe=new n.WebGLObjects(je,Ye,this.info),Ke=new n.WebGLPrograms(this,qe),Ze=new n.WebGLLights;this.info.programs=Ke.programs;var Je=new n.WebGLBufferRenderer(je,We,ze),$e=new n.WebGLIndexedBufferRenderer(je,We,ze);r(),this.context=je,this.capabilities=qe,this.extensions=We,this.properties=Ye,this.state=Xe;var et=new n.WebGLShadowMap(this,Ve,Qe);this.shadowMap=et;var tt=new n.SpritePlugin(this,me),it=new n.LensFlarePlugin(this,ve);this.getContext=function(){return je},this.getContextAttributes=function(){return je.getContextAttributes()},this.forceContextLoss=function(){We.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=We.get("EXT_texture_filter_anisotropic");return e=null!==t?je.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;
}}(),this.getPrecision=function(){return qe.precision},this.getPixelRatio=function(){return De},this.setPixelRatio=function(e){void 0!==e&&(De=e,this.setSize(ke.z,ke.w,!1))},this.getSize=function(){return{width:Re,height:Pe}},this.setSize=function(e,t,i){Re=e,Pe=t,te.width=e*De,te.height=t*De,i!==!1&&(te.style.width=e+"px",te.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,i,r){Xe.viewport(ke.set(e,t,i,r))},this.setScissor=function(e,t,i,r){Xe.scissor(Oe.set(e,t,i,r))},this.setScissorTest=function(e){Xe.setScissorTest(Ie=e)},this.getClearColor=function(){return Ce},this.setClearColor=function(e,t){Ce.set(e),Le=void 0!==t?t:1,i(Ce.r,Ce.g,Ce.b,Le)},this.getClearAlpha=function(){return Le},this.setClearAlpha=function(e){Le=e,i(Ce.r,Ce.g,Ce.b,Le)},this.clear=function(e,t,i){var r=0;(void 0===e||e)&&(r|=je.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=je.DEPTH_BUFFER_BIT),(void 0===i||i)&&(r|=je.STENCIL_BUFFER_BIT),je.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,i,r){this.setRenderTarget(e),this.clear(t,i,r)},this.resetGLState=o,this.dispose=function(){te.removeEventListener("webglcontextlost",a,!1)},this.renderBufferImmediate=function(e,t,i){Xe.initAttributes();var r=Ye.get(e);e.hasPositions&&!r.position&&(r.position=je.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=je.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=je.createBuffer()),e.hasColors&&!r.color&&(r.color=je.createBuffer());var o=t.getAttributes();if(e.hasPositions&&(je.bindBuffer(je.ARRAY_BUFFER,r.position),je.bufferData(je.ARRAY_BUFFER,e.positionArray,je.DYNAMIC_DRAW),Xe.enableAttribute(o.position),je.vertexAttribPointer(o.position,3,je.FLOAT,!1,0,0)),e.hasNormals){if(je.bindBuffer(je.ARRAY_BUFFER,r.normal),"MeshPhongMaterial"!==i.type&&"MeshStandardMaterial"!==i.type&&i.shading===n.FlatShading)for(var a=0,s=3*e.count;s>a;a+=9){var c=e.normalArray,h=(c[a+0]+c[a+3]+c[a+6])/3,l=(c[a+1]+c[a+4]+c[a+7])/3,u=(c[a+2]+c[a+5]+c[a+8])/3;c[a+0]=h,c[a+1]=l,c[a+2]=u,c[a+3]=h,c[a+4]=l,c[a+5]=u,c[a+6]=h,c[a+7]=l,c[a+8]=u}je.bufferData(je.ARRAY_BUFFER,e.normalArray,je.DYNAMIC_DRAW),Xe.enableAttribute(o.normal),je.vertexAttribPointer(o.normal,3,je.FLOAT,!1,0,0)}e.hasUvs&&i.map&&(je.bindBuffer(je.ARRAY_BUFFER,r.uv),je.bufferData(je.ARRAY_BUFFER,e.uvArray,je.DYNAMIC_DRAW),Xe.enableAttribute(o.uv),je.vertexAttribPointer(o.uv,2,je.FLOAT,!1,0,0)),e.hasColors&&i.vertexColors!==n.NoColors&&(je.bindBuffer(je.ARRAY_BUFFER,r.color),je.bufferData(je.ARRAY_BUFFER,e.colorArray,je.DYNAMIC_DRAW),Xe.enableAttribute(o.color),je.vertexAttribPointer(o.color,3,je.FLOAT,!1,0,0)),Xe.disableUnusedAttributes(),je.drawArrays(je.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,i,r,o,a,s){M(o);var c=E(e,i,o,a),h=!1,l=r.id+"_"+c.id+"_"+o.wireframe;l!==Me&&(Me=l,h=!0);var u=a.morphTargetInfluences;if(void 0!==u){for(var d=[],p=0,v=u.length;v>p;p++){var g=u[p];d.push([g,p])}d.sort(m),d.length>8&&(d.length=8);for(var y=r.morphAttributes,p=0,v=d.length;v>p;p++){var g=d[p];if(fe[p]=g[0],0!==g[0]){var x=g[1];o.morphTargets===!0&&y.position&&r.addAttribute("morphTarget"+p,y.position[x]),o.morphNormals===!0&&y.normal&&r.addAttribute("morphNormal"+p,y.normal[x])}else o.morphTargets===!0&&r.removeAttribute("morphTarget"+p),o.morphNormals===!0&&r.removeAttribute("morphNormal"+p)}var b=c.getUniforms();null!==b.morphTargetInfluences&&je.uniform1fv(b.morphTargetInfluences,fe),h=!0}var x=r.index,w=r.attributes.position;o.wireframe===!0&&(x=Qe.getWireframeAttribute(r));var _;null!==x?(_=$e,_.setIndex(x)):_=Je,h&&(f(o,c,r),null!==x&&je.bindBuffer(je.ELEMENT_ARRAY_BUFFER,Qe.getAttributeBuffer(x)));var A=0,S=1/0;null!==x?S=x.count:void 0!==w&&(S=w.count);var T=r.drawRange.start,C=r.drawRange.count,L=null!==s?s.start:0,R=null!==s?s.count:1/0,P=Math.max(A,T,L),D=Math.min(A+S,T+C,L+R)-1,O=Math.max(0,D-P+1);if(a instanceof n.Mesh)if(o.wireframe===!0)Xe.setLineWidth(o.wireframeLinewidth*t()),_.setMode(je.LINES);else switch(a.drawMode){case n.TrianglesDrawMode:_.setMode(je.TRIANGLES);break;case n.TriangleStripDrawMode:_.setMode(je.TRIANGLE_STRIP);break;case n.TriangleFanDrawMode:_.setMode(je.TRIANGLE_FAN)}else if(a instanceof n.Line){var I=o.linewidth;void 0===I&&(I=1),Xe.setLineWidth(I*t()),_.setMode(a instanceof n.LineSegments?je.LINES:je.LINE_STRIP)}else a instanceof n.Points&&_.setMode(je.POINTS);r instanceof n.InstancedBufferGeometry?r.maxInstancedCount>0&&_.renderInstances(r,P,O):_.render(P,O)},this.render=function(e,t,i,r){if(t instanceof n.Camera==!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=e.fog;if(Me="",we=-1,_e=null,e.autoUpdate===!0&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),Be.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Ne.setFromMatrix(Be),he.length=0,ue=-1,pe=-1,me.length=0,ve.length=0,x(e,t),le.length=ue+1,de.length=pe+1,ge.sortObjects===!0&&(le.sort(v),de.sort(g)),V(he,t),et.render(e,t),ze.calls=0,ze.vertices=0,ze.faces=0,ze.points=0,void 0===i&&(i=null),this.setRenderTarget(i),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial){var a=e.overrideMaterial;b(le,t,o,a),b(de,t,o,a)}else Xe.setBlending(n.NoBlending),b(le,t,o),b(de,t,o);if(tt.render(e,t),it.render(e,t,Se),i){var s=i.texture;s.generateMipmaps&&G(i)&&s.minFilter!==n.NearestFilter&&s.minFilter!==n.LinearFilter&&J(i)}Xe.setDepthTest(!0),Xe.setDepthWrite(!0),Xe.setColorWrite(!0)},this.setFaceCulling=function(e,t){e===n.CullFaceNone?Xe.disable(je.CULL_FACE):(je.frontFace(t===n.FrontFaceDirectionCW?je.CW:je.CCW),je.cullFace(e===n.CullFaceBack?je.BACK:e===n.CullFaceFront?je.FRONT:je.FRONT_AND_BACK),Xe.enable(je.CULL_FACE))},this.setTexture=function(e,t){var i=Ye.get(e);if(e.version>0&&i.__version!==e.version){var r=e.image;return void 0===r?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e):r.complete===!1?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e):void z(i,e,t)}Xe.activeTexture(je.TEXTURE0+t),Xe.bindTexture(je.TEXTURE_2D,i.__webglTexture)},this.getCurrentRenderTarget=function(){return xe},this.setRenderTarget=function(e){xe=e,e&&void 0===Ye.get(e).__webglFramebuffer&&Z(e);var t,i=e instanceof n.WebGLRenderTargetCube;if(e){var r=Ye.get(e);t=i?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,Ee.copy(e.scissor),Ae=e.scissorTest,Se.copy(e.viewport)}else t=null,Ee.copy(Oe).multiplyScalar(De),Ae=Ie,Se.copy(ke).multiplyScalar(De);if(be!==t&&(je.bindFramebuffer(je.FRAMEBUFFER,t),be=t),Xe.scissor(Ee),Xe.setScissorTest(Ae),Xe.viewport(Se),i){var o=Ye.get(e.texture);je.framebufferTexture2D(je.FRAMEBUFFER,je.COLOR_ATTACHMENT0,je.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,o.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,i,r,o,a){if(e instanceof n.WebGLRenderTarget==!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var s=Ye.get(e).__webglFramebuffer;if(s){var c=!1;s!==be&&(je.bindFramebuffer(je.FRAMEBUFFER,s),c=!0);try{var h=e.texture;if(h.format!==n.RGBAFormat&&ee(h.format)!==je.getParameter(je.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h.type===n.UnsignedByteType||ee(h.type)===je.getParameter(je.IMPLEMENTATION_COLOR_READ_TYPE)||h.type===n.FloatType&&We.get("WEBGL_color_buffer_float")||h.type===n.HalfFloatType&&We.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");je.checkFramebufferStatus(je.FRAMEBUFFER)===je.FRAMEBUFFER_COMPLETE?je.readPixels(t,i,r,o,ee(h.format),ee(h.type),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&je.bindFramebuffer(je.FRAMEBUFFER,be)}}}},n.WebGLRenderTarget=function(e,t,i){this.uuid=n.Math.generateUUID(),this.width=e,this.height=t,this.scissor=new n.Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new n.Vector4(0,0,e,t),i=i||{},void 0===i.minFilter&&(i.minFilter=n.LinearFilter),this.texture=new n.Texture(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy),this.depthBuffer=void 0!==i.depthBuffer?i.depthBuffer:!0,this.stencilBuffer=void 0!==i.stencilBuffer?i.stencilBuffer:!0},n.WebGLRenderTarget.prototype={constructor:n.WebGLRenderTarget,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},n.EventDispatcher.prototype.apply(n.WebGLRenderTarget.prototype),n.WebGLRenderTargetCube=function(e,t,i){n.WebGLRenderTarget.call(this,e,t,i),this.activeCubeFace=0,this.activeMipMapLevel=0},n.WebGLRenderTargetCube.prototype=Object.create(n.WebGLRenderTarget.prototype),n.WebGLRenderTargetCube.prototype.constructor=n.WebGLRenderTargetCube,n.WebGLBufferRenderer=function(e,t,i){function r(e){s=e}function o(t,r){e.drawArrays(s,t,r),i.calls++,i.vertices+=r,s===e.TRIANGLES&&(i.faces+=r/3)}function a(r){var o=t.get("ANGLE_instanced_arrays");if(null===o)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var a=r.attributes.position,c=0;a instanceof n.InterleavedBufferAttribute?(c=a.data.count,o.drawArraysInstancedANGLE(s,0,c,r.maxInstancedCount)):(c=a.count,o.drawArraysInstancedANGLE(s,0,c,r.maxInstancedCount)),i.calls++,i.vertices+=c*r.maxInstancedCount,s===e.TRIANGLES&&(i.faces+=r.maxInstancedCount*c/3)}var s;this.setMode=r,this.render=o,this.renderInstances=a},n.WebGLIndexedBufferRenderer=function(e,t,i){function r(e){s=e}function n(i){i.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(c=e.UNSIGNED_INT,h=4):(c=e.UNSIGNED_SHORT,h=2)}function o(t,r){e.drawElements(s,r,c,t*h),i.calls++,i.vertices+=r,s===e.TRIANGLES&&(i.faces+=r/3)}function a(r,n,o){var a=t.get("ANGLE_instanced_arrays");return null===a?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(a.drawElementsInstancedANGLE(s,o,c,n*h,r.maxInstancedCount),i.calls++,i.vertices+=o*r.maxInstancedCount,void(s===e.TRIANGLES&&(i.faces+=r.maxInstancedCount*o/3)))}var s,c,h;this.setMode=r,this.setIndex=n,this.render=o,this.renderInstances=a},n.WebGLExtensions=function(e){var t={};this.get=function(i){if(void 0!==t[i])return t[i];var r;switch(i){case"EXT_texture_filter_anisotropic":r=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":r=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":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=e.getExtension("WEBGL_compressed_texture_etc1");break;default:r=e.getExtension(i)}return null===r&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),t[i]=r,r}},n.WebGLCapabilities=function(e,t,i){function r(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=r,this.precision=void 0!==i.precision?i.precision:"highp",this.logarithmicDepthBuffer=void 0!==i.logarithmicDepthBuffer?i.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=r(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"))},n.WebGLGeometries=function(e,t,i){function r(e){var t=e.geometry;if(void 0!==l[t.id])return l[t.id];t.addEventListener("dispose",o);var r;return t instanceof n.BufferGeometry?r=t:t instanceof n.Geometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new n.BufferGeometry).setFromObject(e)),r=t._bufferGeometry),l[t.id]=r,i.memory.geometries++,r}function o(e){var r=e.target,n=l[r.id];null!==n.index&&s(n.index),c(n.attributes),r.removeEventListener("dispose",o),delete l[r.id];var a=t.get(r);a.wireframe&&s(a.wireframe),t["delete"](r);var h=t.get(n);h.wireframe&&s(h.wireframe),t["delete"](n),i.memory.geometries--}function a(e){return e instanceof n.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function s(t){var i=a(t);void 0!==i&&(e.deleteBuffer(i),h(t))}function c(e){for(var t in e)s(e[t])}function h(e){t["delete"](e instanceof n.InterleavedBufferAttribute?e.data:e)}var l={};this.get=r},n.WebGLLights=function(){var e={};this.get=function(t){if(void 0!==e[t.id])return e[t.id];var i;switch(t.type){case"DirectionalLight":i={direction:new n.Vector3,color:new n.Color,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n.Vector2};break;case"SpotLight":i={position:new n.Vector3,direction:new n.Vector3,color:new n.Color,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n.Vector2};break;case"PointLight":i={position:new n.Vector3,color:new n.Color,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n.Vector2};break;case"HemisphereLight":i={direction:new n.Vector3,skyColor:new n.Color,groundColor:new n.Color}}return e[t.id]=i,i}},n.WebGLObjects=function(e,t,i){function r(t){var i=u.get(t);t.geometry instanceof n.Geometry&&i.updateFromObject(t);var r=i.index,a=i.attributes;null!==r&&o(r,e.ELEMENT_ARRAY_BUFFER);for(var s in a)o(a[s],e.ARRAY_BUFFER);var c=i.morphAttributes;for(var s in c)for(var h=c[s],l=0,d=h.length;d>l;l++)o(h[l],e.ARRAY_BUFFER);return i}function o(e,i){var r=e instanceof n.InterleavedBufferAttribute?e.data:e,o=t.get(r);void 0===o.__webglBuffer?a(o,r,i):o.version!==r.version&&s(o,r,i)}function a(t,i,r){t.__webglBuffer=e.createBuffer(),e.bindBuffer(r,t.__webglBuffer);var n=i.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW;e.bufferData(r,i.array,n),t.version=i.version}function s(t,i,r){e.bindBuffer(r,t.__webglBuffer),i.dynamic===!1||-1===i.updateRange.count?e.bufferSubData(r,0,i.array):0===i.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(r,i.updateRange.offset*i.array.BYTES_PER_ELEMENT,i.array.subarray(i.updateRange.offset,i.updateRange.offset+i.updateRange.count)),i.updateRange.count=0),t.version=i.version}function c(e){return e instanceof n.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function h(i){var r=t.get(i);if(void 0!==r.wireframe)return r.wireframe;var a=[],s=i.index,c=i.attributes,h=c.position;if(null!==s)for(var u={},d=s.array,p=0,f=d.length;f>p;p+=3){var m=d[p+0],v=d[p+1],g=d[p+2];l(u,m,v)&&a.push(m,v),l(u,v,g)&&a.push(v,g),l(u,g,m)&&a.push(g,m)}else for(var d=c.position.array,p=0,f=d.length/3-1;f>p;p+=3){var m=p+0,v=p+1,g=p+2;a.push(m,v,v,g,g,m)}var y=h.count>65535?Uint32Array:Uint16Array,x=new n.BufferAttribute(new y(a),1);return o(x,e.ELEMENT_ARRAY_BUFFER),r.wireframe=x,x}function l(e,t,i){if(t>i){var r=t;t=i,i=r}var n=e[t];return void 0===n?(e[t]=[i],!0):-1===n.indexOf(i)?(n.push(i),!0):!1}var u=new n.WebGLGeometries(e,t,i);this.getAttributeBuffer=c,this.getWireframeAttribute=h,this.update=r},n.WebGLProgram=function(){function e(e){switch(e){case n.LinearEncoding:return["Linear","( value )"];case n.sRGBEncoding:return["sRGB","( value )"];case n.RGBEEncoding:return["RGBE","( value )"];case n.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case n.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case n.RGBDEncoding:return["RGBD","( value, 256.0 )"];case n.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function t(t,i){var r=e(i);return"vec4 "+t+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function i(t,i){var r=e(i);return"vec4 "+t+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function r(e,t){var i;switch(t){case n.LinearToneMapping:i="Linear";break;case n.ReinhardToneMapping:i="Reinhard";break;case n.Uncharted2ToneMapping:i="Uncharted2";break;case n.CineonToneMapping:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function o(e,t,i){e=e||{};var r=[e.derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return r.filter(h).join("\n")}function a(e){var t=[];for(var i in e){var r=e[i];r!==!1&&t.push("#define "+i+" "+r)}return t.join("\n")}function s(e,t){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;r>n;n++){var o=e.getActiveUniform(t,n),a=o.name,s=e.getUniformLocation(t,a),c=f.exec(a);if(c){var h=c[1],l=c[2],u=i[h];u||(u=i[h]={}),u[l]=s}else if(c=m.exec(a)){var d=c[1],p=c[2],g=c[3],y=i[d];y||(y=i[d]=[]);var x=y[p];x||(x=y[p]={}),x[g]=s}else if(c=v.exec(a)){var d=c[1];i[d]=s}else i[a]=s}return i}function c(e,t){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;r>n;n++){var o=e.getActiveAttrib(t,n),a=o.name;i[a]=e.getAttribLocation(t,a)}return i}function h(e){return""!==e}function l(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function u(e){function t(e,t){var i=n.ShaderChunk[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return u(i)}var i=/#include +<([\w\d.]+)>/g;return e.replace(i,t)}function d(e){function t(e,t,i,r){for(var n="",o=parseInt(t);o<parseInt(i);o++)n+=r.replace(/\[ i \]/g,"[ "+o+" ]");return n}var i=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return e.replace(i,t)}var p=0,f=/^([\w\d_]+)\.([\w\d_]+)$/,m=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,v=/^([\w\d_]+)\[0\]$/;return function(e,f,m,v){var g=e.context,y=m.extensions,x=m.defines,b=m.__webglShader.vertexShader,w=m.__webglShader.fragmentShader,M="SHADOWMAP_TYPE_BASIC";v.shadowMapType===n.PCFShadowMap?M="SHADOWMAP_TYPE_PCF":v.shadowMapType===n.PCFSoftShadowMap&&(M="SHADOWMAP_TYPE_PCF_SOFT");var _="ENVMAP_TYPE_CUBE",E="ENVMAP_MODE_REFLECTION",A="ENVMAP_BLENDING_MULTIPLY";if(v.envMap){switch(m.envMap.mapping){case n.CubeReflectionMapping:case n.CubeRefractionMapping:_="ENVMAP_TYPE_CUBE";break;case n.CubeUVReflectionMapping:case n.CubeUVRefractionMapping:_="ENVMAP_TYPE_CUBE_UV";break;case n.EquirectangularReflectionMapping:case n.EquirectangularRefractionMapping:_="ENVMAP_TYPE_EQUIREC";break;case n.SphericalReflectionMapping:_="ENVMAP_TYPE_SPHERE"}switch(m.envMap.mapping){case n.CubeRefractionMapping:case n.EquirectangularRefractionMapping:E="ENVMAP_MODE_REFRACTION"}switch(m.combine){case n.MultiplyOperation:A="ENVMAP_BLENDING_MULTIPLY";break;case n.MixOperation:A="ENVMAP_BLENDING_MIX";break;case n.AddOperation:A="ENVMAP_BLENDING_ADD"}}var S,T,C=e.gammaFactor>0?e.gammaFactor:1,L=o(y,v,e.extensions),R=a(x),P=g.createProgram();m instanceof n.RawShaderMaterial?(S="",T=""):(S=["precision "+v.precision+" float;","precision "+v.precision+" int;","#define SHADER_NAME "+m.__webglShader.name,R,v.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+C,"#define MAX_BONES "+v.maxBones,v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.envMap?"#define "+E:"",v.lightMap?"#define USE_LIGHTMAP":"",v.aoMap?"#define USE_AOMAP":"",v.emissiveMap?"#define USE_EMISSIVEMAP":"",v.bumpMap?"#define USE_BUMPMAP":"",v.normalMap?"#define USE_NORMALMAP":"",v.displacementMap&&v.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",v.specularMap?"#define USE_SPECULARMAP":"",v.roughnessMap?"#define USE_ROUGHNESSMAP":"",v.metalnessMap?"#define USE_METALNESSMAP":"",v.alphaMap?"#define USE_ALPHAMAP":"",v.vertexColors?"#define USE_COLOR":"",v.flatShading?"#define FLAT_SHADED":"",v.skinning?"#define USE_SKINNING":"",v.useVertexTexture?"#define BONE_TEXTURE":"",v.morphTargets?"#define USE_MORPHTARGETS":"",v.morphNormals&&v.flatShading===!1?"#define USE_MORPHNORMALS":"",v.doubleSided?"#define DOUBLE_SIDED":"",v.flipSided?"#define FLIP_SIDED":"",v.shadowMapEnabled?"#define USE_SHADOWMAP":"",v.shadowMapEnabled?"#define "+M:"",v.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",v.sizeAttenuation?"#define USE_SIZEATTENUATION":"",v.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",v.logarithmicDepthBuffer&&e.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(h).join("\n"),T=[L,"precision "+v.precision+" float;","precision "+v.precision+" int;","#define SHADER_NAME "+m.__webglShader.name,R,v.alphaTest?"#define ALPHATEST "+v.alphaTest:"","#define GAMMA_FACTOR "+C,v.useFog&&v.fog?"#define USE_FOG":"",v.useFog&&v.fogExp?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.envMap?"#define "+_:"",v.envMap?"#define "+E:"",v.envMap?"#define "+A:"",v.lightMap?"#define USE_LIGHTMAP":"",v.aoMap?"#define USE_AOMAP":"",v.emissiveMap?"#define USE_EMISSIVEMAP":"",v.bumpMap?"#define USE_BUMPMAP":"",v.normalMap?"#define USE_NORMALMAP":"",v.specularMap?"#define USE_SPECULARMAP":"",v.roughnessMap?"#define USE_ROUGHNESSMAP":"",v.metalnessMap?"#define USE_METALNESSMAP":"",v.alphaMap?"#define USE_ALPHAMAP":"",v.vertexColors?"#define USE_COLOR":"",v.flatShading?"#define FLAT_SHADED":"",v.doubleSided?"#define DOUBLE_SIDED":"",v.flipSided?"#define FLIP_SIDED":"",v.shadowMapEnabled?"#define USE_SHADOWMAP":"",v.shadowMapEnabled?"#define "+M:"",v.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",v.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",v.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",v.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",v.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",v.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",v.toneMapping!==n.NoToneMapping?"#define TONE_MAPPING":"",v.toneMapping!==n.NoToneMapping?n.ShaderChunk.tonemapping_pars_fragment:"",v.toneMapping!==n.NoToneMapping?r("toneMapping",v.toneMapping):"",v.outputEncoding||v.mapEncoding||v.envMapEncoding||v.emissiveMapEncoding?n.ShaderChunk.encodings_pars_fragment:"",v.mapEncoding?t("mapTexelToLinear",v.mapEncoding):"",v.envMapEncoding?t("envMapTexelToLinear",v.envMapEncoding):"",v.emissiveMapEncoding?t("emissiveMapTexelToLinear",v.emissiveMapEncoding):"",v.outputEncoding?i("linearToOutputTexel",v.outputEncoding):"","\n"].filter(h).join("\n")),b=u(b,v),b=l(b,v),w=u(w,v),w=l(w,v),m instanceof n.ShaderMaterial==!1&&(b=d(b),w=d(w));var D=S+b,O=T+w,I=n.WebGLShader(g,g.VERTEX_SHADER,D),k=n.WebGLShader(g,g.FRAGMENT_SHADER,O);g.attachShader(P,I),g.attachShader(P,k),void 0!==m.index0AttributeName?g.bindAttribLocation(P,0,m.index0AttributeName):v.morphTargets===!0&&g.bindAttribLocation(P,0,"position"),g.linkProgram(P);var N=g.getProgramInfoLog(P),B=g.getShaderInfoLog(I),F=g.getShaderInfoLog(k),V=!0,U=!0;g.getProgramParameter(P,g.LINK_STATUS)===!1?(V=!1,console.error("THREE.WebGLProgram: shader error: ",g.getError(),"gl.VALIDATE_STATUS",g.getProgramParameter(P,g.VALIDATE_STATUS),"gl.getProgramInfoLog",N,B,F)):""!==N?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",N):(""===B||""===F)&&(U=!1),U&&(this.diagnostics={runnable:V,material:m,programLog:N,vertexShader:{log:B,prefix:S},fragmentShader:{log:F,prefix:T}}),g.deleteShader(I),g.deleteShader(k);var z;this.getUniforms=function(){return void 0===z&&(z=s(g,P)),z};var j;return this.getAttributes=function(){return void 0===j&&(j=c(g,P)),j},this.destroy=function(){g.deleteProgram(P),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=p++,this.code=f,this.usedTimes=1,this.program=P,this.vertexShader=I,this.fragmentShader=k,this}}(),n.WebGLPrograms=function(e,t){function i(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var i=t.maxVertexUniforms,r=Math.floor((i-20)/4),o=r;return void 0!==e&&e instanceof n.SkinnedMesh&&(o=Math.min(e.skeleton.bones.length,o),o<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+o+" (try OpenGL instead of ANGLE)")),o}function r(e,t){var i;return e?e instanceof n.Texture?i=e.encoding:e instanceof n.WebGLRenderTarget&&(i=e.texture.encoding):i=n.LinearEncoding,i===n.LinearEncoding&&t&&(i=n.GammaEncoding),i}var o=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},s=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","shadowMapEnabled","pointLightShadows","toneMapping","physicallyCorrectLights","shadowMapType","alphaTest","doubleSided","flipSided"];this.getParameters=function(o,s,c,h){var l=a[o.type],u=i(h),d=e.getPrecision();null!==o.precision&&(d=t.getMaxPrecision(o.precision),d!==o.precision&&console.warn("THREE.WebGLProgram.getParameters:",o.precision,"not supported, using",d,"instead."));var p={shaderID:l,precision:d,supportsVertexTextures:t.vertexTextures,outputEncoding:r(e.getCurrentRenderTarget(),e.gammaOutput),map:!!o.map,mapEncoding:r(o.map,e.gammaInput),envMap:!!o.envMap,envMapMode:o.envMap&&o.envMap.mapping,envMapEncoding:r(o.envMap,e.gammaInput),envMapCubeUV:!!o.envMap&&(o.envMap.mapping===n.CubeUVReflectionMapping||o.envMap.mapping===n.CubeUVRefractionMapping),lightMap:!!o.lightMap,aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,emissiveMapEncoding:r(o.emissiveMap,e.gammaInput),bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,alphaMap:!!o.alphaMap,combine:o.combine,vertexColors:o.vertexColors,fog:c,useFog:o.fog,fogExp:c instanceof n.FogExp2,flatShading:o.shading===n.FlatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:o.skinning,maxBones:u,useVertexTexture:t.floatVertexTextures&&h&&h.skeleton&&h.skeleton.useVertexTexture,morphTargets:o.morphTargets,morphNormals:o.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numHemiLights:s.hemi.length,pointLightShadows:s.shadowsPointLight,shadowMapEnabled:e.shadowMap.enabled&&h.receiveShadow&&s.shadows.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,alphaTest:o.alphaTest,doubleSided:o.side===n.DoubleSide,flipSided:o.side===n.BackSide};return p},this.getProgramCode=function(e,t){var i=[];if(t.shaderID?i.push(t.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)i.push(r),i.push(e.defines[r]);for(var n=0;n<s.length;n++){var o=s[n];i.push(o),i.push(t[o])}return i.join()},this.acquireProgram=function(t,i,r){for(var a,s=0,c=o.length;c>s;s++){var h=o[s];if(h.code===r){a=h,++a.usedTimes;break}}return void 0===a&&(a=new n.WebGLProgram(e,r,t,i),o.push(a)),a},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},n.WebGLProperties=function(){var e={};this.get=function(t){var i=t.uuid,r=e[i];return void 0===r&&(r={},e[i]=r),r},this["delete"]=function(t){delete e[t.uuid]},this.clear=function(){e={}}},n.WebGLShader=function(){function e(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")}return function(t,i,r){var n=t.createShader(i);return t.shaderSource(n,r),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",i===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),e(r)),n}}(),n.WebGLShadowMap=function(e,t,i){function r(e,t,i,r){var o=e.geometry,a=null,s=g,c=e.customDepthMaterial;if(i&&(s=y,c=e.customDistanceMaterial),c)a=c;else{var h=void 0!==o.morphTargets&&o.morphTargets.length>0&&t.morphTargets,l=e instanceof n.SkinnedMesh&&t.skinning,u=0;
h&&(u|=f),l&&(u|=m),a=s[u]}return a.visible=t.visible,a.wireframe=t.wireframe,a.wireframeLinewidth=t.wireframeLinewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function o(e,t,i){if(e.visible!==!1){if(e.layers.test(t.layers)&&(e instanceof n.Mesh||e instanceof n.Line||e instanceof n.Points)&&e.castShadow&&(e.frustumCulled===!1||c.intersectsObject(e)===!0)){var r=e.material;r.visible===!0&&(e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),p.push(e))}for(var a=e.children,s=0,h=a.length;h>s;s++)o(a[s],t,i)}}for(var a=e.context,s=e.state,c=new n.Frustum,h=new n.Matrix4,l=new n.Vector2,u=new n.Vector3,d=new n.Vector3,p=[],f=1,m=2,v=(f|m)+1,g=new Array(v),y=new Array(v),x=[new n.Vector3(1,0,0),new n.Vector3(-1,0,0),new n.Vector3(0,0,1),new n.Vector3(0,0,-1),new n.Vector3(0,1,0),new n.Vector3(0,-1,0)],b=[new n.Vector3(0,1,0),new n.Vector3(0,1,0),new n.Vector3(0,1,0),new n.Vector3(0,1,0),new n.Vector3(0,0,1),new n.Vector3(0,0,-1)],w=[new n.Vector4,new n.Vector4,new n.Vector4,new n.Vector4,new n.Vector4,new n.Vector4],M=n.ShaderLib.depthRGBA,_=n.UniformsUtils.clone(M.uniforms),E=n.ShaderLib.distanceRGBA,A=n.UniformsUtils.clone(E.uniforms),S=0;S!==v;++S){var T=0!==(S&f),C=0!==(S&m),L=new n.ShaderMaterial({uniforms:_,vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,morphTargets:T,skinning:C});g[S]=L;var R=new n.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:A,vertexShader:E.vertexShader,fragmentShader:E.fragmentShader,morphTargets:T,skinning:C});y[S]=R}var P=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=n.PCFShadowMap,this.cullFace=n.CullFaceFront,this.render=function(f,m){var v,g,y=t.shadows;if(0!==y.length&&P.enabled!==!1&&(P.autoUpdate!==!1||P.needsUpdate!==!1)){s.clearColor(1,1,1,1),s.disable(a.BLEND),s.enable(a.CULL_FACE),a.frontFace(a.CCW),a.cullFace(P.cullFace===n.CullFaceFront?a.FRONT:a.BACK),s.setDepthTest(!0),s.setScissorTest(!1);for(var M=0,_=y.length;_>M;M++){var E=y[M],A=E.shadow,S=A.camera;if(l.copy(A.mapSize),E instanceof n.PointLight){v=6,g=!0;var T=l.x,C=l.y;w[0].set(2*T,C,T,C),w[1].set(0,C,T,C),w[2].set(3*T,C,T,C),w[3].set(T,C,T,C),w[4].set(3*T,0,T,C),w[5].set(T,0,T,C),l.x*=4,l.y*=2}else v=1,g=!1;if(null===A.map){var L={minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBAFormat};A.map=new n.WebGLRenderTarget(l.x,l.y,L),E instanceof n.SpotLight&&(S.aspect=l.x/l.y),S.updateProjectionMatrix()}var R=A.map,D=A.matrix;d.setFromMatrixPosition(E.matrixWorld),S.position.copy(d),e.setRenderTarget(R),e.clear();for(var O=0;v>O;O++){if(g){u.copy(S.position),u.add(x[O]),S.up.copy(b[O]),S.lookAt(u);var I=w[O];s.viewport(I)}else u.setFromMatrixPosition(E.target.matrixWorld),S.lookAt(u);S.updateMatrixWorld(),S.matrixWorldInverse.getInverse(S.matrixWorld),D.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),D.multiply(S.projectionMatrix),D.multiply(S.matrixWorldInverse),h.multiplyMatrices(S.projectionMatrix,S.matrixWorldInverse),c.setFromMatrix(h),p.length=0,o(f,m,S);for(var k=0,N=p.length;N>k;k++){var B=p[k],F=i.update(B),V=B.material;if(V instanceof n.MultiMaterial)for(var U=F.groups,z=V.materials,j=0,G=U.length;G>j;j++){var H=U[j],W=z[H.materialIndex];if(W.visible===!0){var q=r(B,W,g,d);e.renderBufferDirect(S,null,F,q,B,H)}}else{var q=r(B,V,g,d);e.renderBufferDirect(S,null,F,q,B,null)}}}}var X=e.getClearColor(),Y=e.getClearAlpha();e.setClearColor(X,Y),s.enable(a.BLEND),P.cullFace===n.CullFaceFront&&a.cullFace(a.BACK),P.needsUpdate=!1}}},n.WebGLState=function(e,t,i){var r=this,o=new n.Vector4,a=new Uint8Array(16),s=new Uint8Array(16),c=new Uint8Array(16),h={},l=null,u=null,d=null,p=null,f=null,m=null,v=null,g=null,y=!1,x=null,b=null,w=null,M=null,_=null,E=null,A=null,S=null,T=null,C=null,L=null,R=null,P=null,D=null,O=null,I=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),k=void 0,N={},B=new n.Vector4,F=null,V=null,U=new n.Vector4,z=new n.Vector4,j=e.createTexture();e.bindTexture(e.TEXTURE_2D,j),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGB,1,1,0,e.RGB,e.UNSIGNED_BYTE,new Uint8Array(3)),this.init=function(){this.clearColor(0,0,0,1),this.clearDepth(1),this.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=a.length;t>e;e++)a[e]=0},this.enableAttribute=function(i){if(a[i]=1,0===s[i]&&(e.enableVertexAttribArray(i),s[i]=1),0!==c[i]){var r=t.get("ANGLE_instanced_arrays");r.vertexAttribDivisorANGLE(i,0),c[i]=0}},this.enableAttributeAndDivisor=function(t,i,r){a[t]=1,0===s[t]&&(e.enableVertexAttribArray(t),s[t]=1),c[t]!==i&&(r.vertexAttribDivisorANGLE(t,i),c[t]=i)},this.disableUnusedAttributes=function(){for(var t=0,i=s.length;i>t;t++)s[t]!==a[t]&&(e.disableVertexAttribArray(t),s[t]=0)},this.enable=function(t){h[t]!==!0&&(e.enable(t),h[t]=!0)},this.disable=function(t){h[t]!==!1&&(e.disable(t),h[t]=!1)},this.getCompressedTextureFormats=function(){if(null===l&&(l=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var i=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),r=0;r<i.length;r++)l.push(i[r]);return l},this.setBlending=function(t,r,o,a,s,c,h,l){t===n.NoBlending?this.disable(e.BLEND):this.enable(e.BLEND),(t!==u||l!==y)&&(t===n.AdditiveBlending?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===n.SubtractiveBlending?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===n.MultiplyBlending?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.SRC_COLOR,e.SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),u=t,y=l),t===n.CustomBlending?(s=s||r,c=c||o,h=h||a,(r!==d||s!==m)&&(e.blendEquationSeparate(i(r),i(s)),d=r,m=s),(o!==p||a!==f||c!==v||h!==g)&&(e.blendFuncSeparate(i(o),i(a),i(c),i(h)),p=o,f=a,v=c,g=h)):(d=null,p=null,f=null,m=null,v=null,g=null)},this.setDepthFunc=function(t){if(x!==t){if(t)switch(t){case n.NeverDepth:e.depthFunc(e.NEVER);break;case n.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case n.LessDepth:e.depthFunc(e.LESS);break;case n.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case n.EqualDepth:e.depthFunc(e.EQUAL);break;case n.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case n.GreaterDepth:e.depthFunc(e.GREATER);break;case n.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);x=t}},this.setDepthTest=function(t){t?this.enable(e.DEPTH_TEST):this.disable(e.DEPTH_TEST)},this.setDepthWrite=function(t){b!==t&&(e.depthMask(t),b=t)},this.setColorWrite=function(t){w!==t&&(e.colorMask(t,t,t,t),w=t)},this.setStencilFunc=function(t,i,r){(_!==t||E!==i||A!==r)&&(e.stencilFunc(t,i,r),_=t,E=i,A=r)},this.setStencilOp=function(t,i,r){(S!==t||T!==i||C!==r)&&(e.stencilOp(t,i,r),S=t,T=i,C=r)},this.setStencilTest=function(t){t?this.enable(e.STENCIL_TEST):this.disable(e.STENCIL_TEST)},this.setStencilWrite=function(t){M!==t&&(e.stencilMask(t),M=t)},this.setFlipSided=function(t){L!==t&&(e.frontFace(t?e.CW:e.CCW),L=t)},this.setLineWidth=function(t){t!==R&&(e.lineWidth(t),R=t)},this.setPolygonOffset=function(t,i,r){t?this.enable(e.POLYGON_OFFSET_FILL):this.disable(e.POLYGON_OFFSET_FILL),!t||P===i&&D===r||(e.polygonOffset(i,r),P=i,D=r)},this.getScissorTest=function(){return O},this.setScissorTest=function(t){O=t,t?this.enable(e.SCISSOR_TEST):this.disable(e.SCISSOR_TEST)},this.activeTexture=function(t){void 0===t&&(t=e.TEXTURE0+I-1),k!==t&&(e.activeTexture(t),k=t)},this.bindTexture=function(t,i){void 0===k&&r.activeTexture();var n=N[k];void 0===n&&(n={type:void 0,texture:void 0},N[k]=n),(n.type!==t||n.texture!==i)&&(e.bindTexture(t,i||j),n.type=t,n.texture=i)},this.compressedTexImage2D=function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.clearColor=function(t,i,r,n){o.set(t,i,r,n),B.equals(o)===!1&&(e.clearColor(t,i,r,n),B.copy(o))},this.clearDepth=function(t){F!==t&&(e.clearDepth(t),F=t)},this.clearStencil=function(t){V!==t&&(e.clearStencil(t),V=t)},this.scissor=function(t){U.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),U.copy(t))},this.viewport=function(t){z.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),z.copy(t))},this.reset=function(){for(var t=0;t<s.length;t++)1===s[t]&&(e.disableVertexAttribArray(t),s[t]=0);h={},l=null,k=void 0,N={},u=null,w=null,b=null,M=null,L=null}},n.LensFlarePlugin=function(e,t){function i(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),t=new Uint16Array([0,1,2,0,2,3]);o=p.createBuffer(),a=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,o),p.bufferData(p.ARRAY_BUFFER,e,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),p.bufferData(p.ELEMENT_ARRAY_BUFFER,t,p.STATIC_DRAW),u=p.createTexture(),d=p.createTexture(),f.bindTexture(p.TEXTURE_2D,u),p.texImage2D(p.TEXTURE_2D,0,p.RGB,16,16,0,p.RGB,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),f.bindTexture(p.TEXTURE_2D,d),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,16,16,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),l=p.getParameter(p.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var i;i=l?{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")},s=r(i),c={vertex:p.getAttribLocation(s,"position"),uv:p.getAttribLocation(s,"uv")},h={renderType:p.getUniformLocation(s,"renderType"),map:p.getUniformLocation(s,"map"),occlusionMap:p.getUniformLocation(s,"occlusionMap"),opacity:p.getUniformLocation(s,"opacity"),color:p.getUniformLocation(s,"color"),scale:p.getUniformLocation(s,"scale"),rotation:p.getUniformLocation(s,"rotation"),screenPosition:p.getUniformLocation(s,"screenPosition")}}function r(t){var i=p.createProgram(),r=p.createShader(p.FRAGMENT_SHADER),n=p.createShader(p.VERTEX_SHADER),o="precision "+e.getPrecision()+" float;\n";return p.shaderSource(r,o+t.fragmentShader),p.shaderSource(n,o+t.vertexShader),p.compileShader(r),p.compileShader(n),p.attachShader(i,r),p.attachShader(i,n),p.linkProgram(i),i}var o,a,s,c,h,l,u,d,p=e.context,f=e.state;this.render=function(r,m,v){if(0!==t.length){var g=new n.Vector3,y=v.w/v.z,x=.5*v.z,b=.5*v.w,w=16/v.w,M=new n.Vector2(w*y,w),_=new n.Vector3(1,1,0),E=new n.Vector2(1,1);void 0===s&&i(),p.useProgram(s),f.initAttributes(),f.enableAttribute(c.vertex),f.enableAttribute(c.uv),f.disableUnusedAttributes(),p.uniform1i(h.occlusionMap,0),p.uniform1i(h.map,1),p.bindBuffer(p.ARRAY_BUFFER,o),p.vertexAttribPointer(c.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(c.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),f.disable(p.CULL_FACE),f.setDepthWrite(!1);for(var A=0,S=t.length;S>A;A++){w=16/v.w,M.set(w*y,w);var T=t[A];if(g.set(T.matrixWorld.elements[12],T.matrixWorld.elements[13],T.matrixWorld.elements[14]),g.applyMatrix4(m.matrixWorldInverse),g.applyProjection(m.projectionMatrix),_.copy(g),E.x=_.x*x+x,E.y=_.y*b+b,l||E.x>0&&E.x<v.z&&E.y>0&&E.y<v.w){f.activeTexture(p.TEXTURE0),f.bindTexture(p.TEXTURE_2D,null),f.activeTexture(p.TEXTURE1),f.bindTexture(p.TEXTURE_2D,u),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGB,v.x+E.x-8,v.y+E.y-8,16,16,0),p.uniform1i(h.renderType,0),p.uniform2f(h.scale,M.x,M.y),p.uniform3f(h.screenPosition,_.x,_.y,_.z),f.disable(p.BLEND),f.enable(p.DEPTH_TEST),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),f.activeTexture(p.TEXTURE0),f.bindTexture(p.TEXTURE_2D,d),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,v.x+E.x-8,v.y+E.y-8,16,16,0),p.uniform1i(h.renderType,1),f.disable(p.DEPTH_TEST),f.activeTexture(p.TEXTURE1),f.bindTexture(p.TEXTURE_2D,u),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),T.positionScreen.copy(_),T.customUpdateCallback?T.customUpdateCallback(T):T.updateLensFlares(),p.uniform1i(h.renderType,2),f.enable(p.BLEND);for(var C=0,L=T.lensFlares.length;L>C;C++){var R=T.lensFlares[C];R.opacity>.001&&R.scale>.001&&(_.x=R.x,_.y=R.y,_.z=R.z,w=R.size*R.scale/v.w,M.x=w*y,M.y=w,p.uniform3f(h.screenPosition,_.x,_.y,_.z),p.uniform2f(h.scale,M.x,M.y),p.uniform1f(h.rotation,R.rotation),p.uniform1f(h.opacity,R.opacity),p.uniform3f(h.color,R.color.r,R.color.g,R.color.b),f.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),e.setTexture(R.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}f.enable(p.CULL_FACE),f.enable(p.DEPTH_TEST),f.setDepthWrite(!0),e.resetGLState()}}},n.SpritePlugin=function(e,t){function i(){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]);a=d.createBuffer(),s=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,a),d.bufferData(d.ARRAY_BUFFER,e,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.bufferData(d.ELEMENT_ARRAY_BUFFER,t,d.STATIC_DRAW),c=r(),h={position:d.getAttribLocation(c,"position"),uv:d.getAttribLocation(c,"uv")},l={uvOffset:d.getUniformLocation(c,"uvOffset"),uvScale:d.getUniformLocation(c,"uvScale"),rotation:d.getUniformLocation(c,"rotation"),scale:d.getUniformLocation(c,"scale"),color:d.getUniformLocation(c,"color"),map:d.getUniformLocation(c,"map"),opacity:d.getUniformLocation(c,"opacity"),modelViewMatrix:d.getUniformLocation(c,"modelViewMatrix"),projectionMatrix:d.getUniformLocation(c,"projectionMatrix"),fogType:d.getUniformLocation(c,"fogType"),fogDensity:d.getUniformLocation(c,"fogDensity"),fogNear:d.getUniformLocation(c,"fogNear"),fogFar:d.getUniformLocation(c,"fogFar"),fogColor:d.getUniformLocation(c,"fogColor"),alphaTest:d.getUniformLocation(c,"alphaTest")};var i=document.createElement("canvas");i.width=8,i.height=8;var o=i.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),u=new n.Texture(i),u.needsUpdate=!0}function r(){var t=d.createProgram(),i=d.createShader(d.VERTEX_SHADER),r=d.createShader(d.FRAGMENT_SHADER);return d.shaderSource(i,["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")),d.shaderSource(r,["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")),d.compileShader(i),d.compileShader(r),d.attachShader(t,i),d.attachShader(t,r),d.linkProgram(t),t}function o(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var a,s,c,h,l,u,d=e.context,p=e.state,f=new n.Vector3,m=new n.Quaternion,v=new n.Vector3;this.render=function(r,g){if(0!==t.length){void 0===c&&i(),d.useProgram(c),p.initAttributes(),p.enableAttribute(h.position),p.enableAttribute(h.uv),p.disableUnusedAttributes(),p.disable(d.CULL_FACE),p.enable(d.BLEND),d.bindBuffer(d.ARRAY_BUFFER,a),d.vertexAttribPointer(h.position,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(h.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.uniformMatrix4fv(l.projectionMatrix,!1,g.projectionMatrix.elements),p.activeTexture(d.TEXTURE0),d.uniform1i(l.map,0);var y=0,x=0,b=r.fog;b?(d.uniform3f(l.fogColor,b.color.r,b.color.g,b.color.b),b instanceof n.Fog?(d.uniform1f(l.fogNear,b.near),d.uniform1f(l.fogFar,b.far),d.uniform1i(l.fogType,1),y=1,x=1):b instanceof n.FogExp2&&(d.uniform1f(l.fogDensity,b.density),d.uniform1i(l.fogType,2),y=2,x=2)):(d.uniform1i(l.fogType,0),y=0,x=0);for(var w=0,M=t.length;M>w;w++){var _=t[w];_.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,_.matrixWorld),_.z=-_.modelViewMatrix.elements[14]}t.sort(o);for(var E=[],w=0,M=t.length;M>w;w++){var _=t[w],A=_.material;d.uniform1f(l.alphaTest,A.alphaTest),d.uniformMatrix4fv(l.modelViewMatrix,!1,_.modelViewMatrix.elements),_.matrixWorld.decompose(f,m,v),E[0]=v.x,E[1]=v.y;var S=0;r.fog&&A.fog&&(S=x),y!==S&&(d.uniform1i(l.fogType,S),y=S),null!==A.map?(d.uniform2f(l.uvOffset,A.map.offset.x,A.map.offset.y),d.uniform2f(l.uvScale,A.map.repeat.x,A.map.repeat.y)):(d.uniform2f(l.uvOffset,0,0),d.uniform2f(l.uvScale,1,1)),d.uniform1f(l.opacity,A.opacity),d.uniform3f(l.color,A.color.r,A.color.g,A.color.b),d.uniform1f(l.rotation,A.rotation),d.uniform2fv(l.scale,E),p.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),p.setDepthTest(A.depthTest),p.setDepthWrite(A.depthWrite),A.map&&A.map.image&&A.map.image.width?e.setTexture(A.map,0):e.setTexture(u,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}p.enable(d.CULL_FACE),e.resetGLState()}}},Object.defineProperties(n.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}}}),Object.defineProperties(n.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(n.Matrix3.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}}}),Object.defineProperties(n.Matrix4.prototype,{extractPosition:{value:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)}},setRotationFromQuaternion:{value:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)}},multiplyVector3:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)}},multiplyVector4:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}},rotateAxis:{value:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)}},crossVector:{value:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},translate:{value:function(){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(n.Plane.prototype,{isIntersectionLine:{value:function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)}}}),Object.defineProperties(n.Quaternion.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)}}}),Object.defineProperties(n.Ray.prototype,{isIntersectionBox:{value:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionPlane:{value:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(n.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)}},getScaleFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)}},getColumnFromMatrix:{value:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}}),n.Face4=function(e,t,i,r,o,a,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new n.Face3(e,t,i,o,a,s)},n.Vertex=function(e,t,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new n.Vector3(e,t,i)},Object.defineProperties(n.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},getChildByName:{value:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)}},renderDepth:{set:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(n,{PointCloud:{value:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new n.Points(e,t)}},ParticleSystem:{value:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new n.Points(e,t)}}}),Object.defineProperties(n.Light.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(n.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(n.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)}},addDrawCall:{value:function(e,t,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(n.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new n.Color}}}),Object.defineProperties(n,{PointCloudMaterial:{value:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new n.PointsMaterial(e)}},ParticleBasicMaterial:{value:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new n.PointsMaterial(e)}},ParticleSystemMaterial:{value:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new n.PointsMaterial(e)}}}),Object.defineProperties(n.MeshPhongMaterial.prototype,{metal:{
get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(n.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.defineProperties(n.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(n.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),n.GeometryUtils={merge:function(e,t,i){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var r;t instanceof n.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,i)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},n.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,i,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var o=new n.TextureLoader;o.setCrossOrigin(this.crossOrigin);var a=o.load(e,i,void 0,r);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,i,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var o=new n.CubeTextureLoader;o.setCrossOrigin(this.crossOrigin);var a=o.load(e,i,void 0,r);return t&&(a.mapping=t),a},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.")}},n.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(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},n.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(){}},n.MeshFaceMaterial=n.MultiMaterial,n.CurveUtils={tangentQuadraticBezier:function(e,t,i,r){return 2*(1-e)*(i-t)+2*e*(r-i)},tangentCubicBezier:function(e,t,i,r,n){return-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*r*(1-e)-3*e*e*r+3*e*e*n},tangentSpline:function(e){var t=6*e*e-6*e,i=3*e*e-4*e+1,r=-6*e*e+6*e,n=3*e*e-2*e;return t+i+r+n},interpolate:function(e,t,i,r,n){var o=.5*(i-e),a=.5*(r-t),s=n*n,c=n*s;return(2*t-2*i+o+a)*c+(-3*t+3*i-2*o-a)*s+o*n+t}},n.SceneUtils={createMultiMaterialObject:function(e,t){for(var i=new n.Group,r=0,o=t.length;o>r;r++)i.add(new n.Mesh(e,t[r]));return i},detach:function(e,t,i){e.applyMatrix(t.matrixWorld),t.remove(e),i.add(e)},attach:function(e,t,i){var r=new n.Matrix4;r.getInverse(i.matrixWorld),e.applyMatrix(r),t.remove(e),i.add(e)}},n.ShapeUtils={area:function(e){for(var t=e.length,i=0,r=t-1,n=0;t>n;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return.5*i},triangulate:function(){function e(e,t,i,r,n,o){var a,s,c,h,l,u,d,p,f;if(s=e[o[t]].x,c=e[o[t]].y,h=e[o[i]].x,l=e[o[i]].y,u=e[o[r]].x,d=e[o[r]].y,Number.EPSILON>(h-s)*(d-c)-(l-c)*(u-s))return!1;var m,v,g,y,x,b,w,M,_,E,A,S,T,C,L;for(m=u-h,v=d-l,g=s-u,y=c-d,x=h-s,b=l-c,a=0;n>a;a++)if(p=e[o[a]].x,f=e[o[a]].y,!(p===s&&f===c||p===h&&f===l||p===u&&f===d)&&(w=p-s,M=f-c,_=p-h,E=f-l,A=p-u,S=f-d,L=m*E-v*_,T=x*M-b*w,C=g*S-y*A,L>=-Number.EPSILON&&C>=-Number.EPSILON&&T>=-Number.EPSILON))return!1;return!0}return function(t,i){var r=t.length;if(3>r)return null;var o,a,s,c=[],h=[],l=[];if(n.ShapeUtils.area(t)>0)for(a=0;r>a;a++)h[a]=a;else for(a=0;r>a;a++)h[a]=r-1-a;var u=r,d=2*u;for(a=u-1;u>2;){if(d--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?l:c;if(o=a,o>=u&&(o=0),a=o+1,a>=u&&(a=0),s=a+1,s>=u&&(s=0),e(t,o,a,s,u,h)){var p,f,m,v,g;for(p=h[o],f=h[a],m=h[s],c.push([t[p],t[f],t[m]]),l.push([h[o],h[a],h[s]]),v=a,g=a+1;u>g;v++,g++)h[v]=h[g];u--,d=2*u}}return i?l:c}}(),triangulateShape:function(e,t){function i(e,t,i){return e.x!==t.x?e.x<t.x?e.x<=i.x&&i.x<=t.x:t.x<=i.x&&i.x<=e.x:e.y<t.y?e.y<=i.y&&i.y<=t.y:t.y<=i.y&&i.y<=e.y}function r(e,t,r,n,o){var a=t.x-e.x,s=t.y-e.y,c=n.x-r.x,h=n.y-r.y,l=e.x-r.x,u=e.y-r.y,d=s*c-a*h,p=s*l-a*u;if(Math.abs(d)>Number.EPSILON){var f;if(d>0){if(0>p||p>d)return[];if(f=h*l-c*u,0>f||f>d)return[]}else{if(p>0||d>p)return[];if(f=h*l-c*u,f>0||d>f)return[]}if(0===f)return!o||0!==p&&p!==d?[e]:[];if(f===d)return!o||0!==p&&p!==d?[t]:[];if(0===p)return[r];if(p===d)return[n];var m=f/d;return[{x:e.x+m*a,y:e.y+m*s}]}if(0!==p||h*l!==c*u)return[];var v=0===a&&0===s,g=0===c&&0===h;if(v&&g)return e.x!==r.x||e.y!==r.y?[]:[e];if(v)return i(r,n,e)?[e]:[];if(g)return i(e,t,r)?[r]:[];var y,x,b,w,M,_,E,A;return 0!==a?(e.x<t.x?(y=e,b=e.x,x=t,w=t.x):(y=t,b=t.x,x=e,w=e.x),r.x<n.x?(M=r,E=r.x,_=n,A=n.x):(M=n,E=n.x,_=r,A=r.x)):(e.y<t.y?(y=e,b=e.y,x=t,w=t.y):(y=t,b=t.y,x=e,w=e.y),r.y<n.y?(M=r,E=r.y,_=n,A=n.y):(M=n,E=n.y,_=r,A=r.y)),E>=b?E>w?[]:w===E?o?[]:[M]:A>=w?[M,x]:[M,_]:b>A?[]:b===A?o?[]:[y]:A>=w?[y,x]:[y,_]}function o(e,t,i,r){var n=t.x-e.x,o=t.y-e.y,a=i.x-e.x,s=i.y-e.y,c=r.x-e.x,h=r.y-e.y,l=n*s-o*a,u=n*h-o*c;if(Math.abs(l)>Number.EPSILON){var d=c*s-h*a;return l>0?u>=0&&d>=0:u>=0||d>=0}return u>0}function a(e,t){function i(e,t){var i=y.length-1,r=e-1;0>r&&(r=i);var n=e+1;n>i&&(n=0);var a=o(y[e],y[r],y[n],s[t]);if(!a)return!1;var c=s.length-1,h=t-1;0>h&&(h=c);var l=t+1;return l>c&&(l=0),a=o(s[t],s[h],s[l],y[e]),a?!0:!1}function n(e,t){var i,n,o;for(i=0;i<y.length;i++)if(n=i+1,n%=y.length,o=r(e,t,y[i],y[n],!0),o.length>0)return!0;return!1}function a(e,i){var n,o,a,s,c;for(n=0;n<x.length;n++)for(o=t[x[n]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,c=r(e,i,o[a],o[s],!0),c.length>0)return!0;return!1}for(var s,c,h,l,u,d,p,f,m,v,g,y=e.concat(),x=[],b=[],w=0,M=t.length;M>w;w++)x.push(w);for(var _=0,E=2*x.length;x.length>0;){if(E--,0>E){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");break}for(h=_;h<y.length;h++){l=y[h],c=-1;for(var w=0;w<x.length;w++)if(d=x[w],p=l.x+":"+l.y+":"+d,void 0===b[p]){s=t[d];for(var A=0;A<s.length;A++)if(u=s[A],i(h,A)&&!n(l,u)&&!a(l,u)){c=A,x.splice(w,1),f=y.slice(0,h+1),m=y.slice(h),v=s.slice(c),g=s.slice(0,c+1),y=f.concat(v).concat(g).concat(m),_=h;break}if(c>=0)break;b[p]=!0}if(c>=0)break}}return y}for(var s,c,h,l,u,d,p={},f=e.concat(),m=0,v=t.length;v>m;m++)Array.prototype.push.apply(f,t[m]);for(s=0,c=f.length;c>s;s++)u=f[s].x+":"+f[s].y,void 0!==p[u]&&console.warn("THREE.Shape: Duplicate point",u),p[u]=s;var g=a(e,t),y=n.ShapeUtils.triangulate(g,!1);for(s=0,c=y.length;c>s;s++)for(l=y[s],h=0;3>h;h++)u=l[h].x+":"+l[h].y,d=p[u],void 0!==d&&(l[h]=d);return y.concat()},isClockWise:function(e){return n.ShapeUtils.area(e)<0},b2:function(){function e(e,t){var i=1-e;return i*i*t}function t(e,t){return 2*(1-e)*e*t}function i(e,t){return e*e*t}return function(r,n,o,a){return e(r,n)+t(r,o)+i(r,a)}}(),b3:function(){function e(e,t){var i=1-e;return i*i*i*t}function t(e,t){var i=1-e;return 3*i*i*e*t}function i(e,t){var i=1-e;return 3*i*e*e*t}function r(e,t){return e*e*e*t}return function(n,o,a,s,c){return e(n,o)+t(n,a)+i(n,s)+r(n,c)}}()},n.Curve=function(){},n.Curve.prototype={constructor:n.Curve,getPoint:function(){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,i=[];for(t=0;e>=t;t++)i.push(this.getPoint(t/e));return i},getSpacedPoints:function(e){e||(e=5);var t,i=[];for(t=0;e>=t;t++)i.push(this.getPointAt(t/e));return i},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,i,r=[],n=this.getPoint(0),o=0;for(r.push(0),i=1;e>=i;i++)t=this.getPoint(i/e),o+=t.distanceTo(n),r.push(o),n=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,r=this.getLengths(),n=0,o=r.length;i=t?t:e*r[o-1];for(var a,s=0,c=o-1;c>=s;)if(n=Math.floor(s+(c-s)/2),a=r[n]-i,0>a)s=n+1;else{if(!(a>0)){c=n;break}c=n-1}if(n=c,r[n]===i){var h=n/(o-1);return h}var l=r[n],u=r[n+1],d=u-l,p=(i-l)/d,h=(n+p)/(o-1);return h},getTangent:function(e){var t=1e-4,i=e-t,r=e+t;0>i&&(i=0),r>1&&(r=1);var n=this.getPoint(i),o=this.getPoint(r),a=o.clone().sub(n);return a.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)}},n.Curve.create=function(e,t){return e.prototype=Object.create(n.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},n.CurvePath=function(){this.curves=[],this.autoClose=!1},n.CurvePath.prototype=Object.create(n.Curve.prototype),n.CurvePath.prototype.constructor=n.CurvePath,n.CurvePath.prototype.add=function(e){this.curves.push(e)},n.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 n.LineCurve(t,e))},n.CurvePath.prototype.getPoint=function(e){for(var t=e*this.getLength(),i=this.getCurveLengths(),r=0;r<i.length;){if(i[r]>=t){var n=i[r]-t,o=this.curves[r],a=1-n/o.getLength();return o.getPointAt(a)}r++}return null},n.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},n.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,r=this.curves.length;r>i;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e},n.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e);return this.createGeometry(t)},n.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},n.CurvePath.prototype.createGeometry=function(e){for(var t=new n.Geometry,i=0,r=e.length;r>i;i++){var o=e[i];t.vertices.push(new n.Vector3(o.x,o.y,o.z||0))}return t},n.Font=function(e){this.data=e},n.Font.prototype={constructor:n.Font,generateShapes:function(e,t,i){function r(e){for(var i=String(e).split(""),r=t/a.resolution,n=0,s=[],c=0;c<i.length;c++){var h=o(i[c],r,n);n+=h.offset,s.push(h.path)}return s}function o(e,t,r){var o=a.glyphs[e]||a.glyphs["?"];if(o){var s,c,h,l,u,d,p,f,m,v,g,y=new n.Path,x=[],b=n.ShapeUtils.b2,w=n.ShapeUtils.b3;if(o.o)for(var M=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),_=0,E=M.length;E>_;){var A=M[_++];switch(A){case"m":s=M[_++]*t+r,c=M[_++]*t,y.moveTo(s,c);break;case"l":s=M[_++]*t+r,c=M[_++]*t,y.lineTo(s,c);break;case"q":if(h=M[_++]*t+r,l=M[_++]*t,p=M[_++]*t+r,f=M[_++]*t,y.quadraticCurveTo(p,f,h,l),g=x[x.length-1]){u=g.x,d=g.y;for(var S=1;i>=S;S++){var T=S/i;b(T,u,p,h),b(T,d,f,l)}}break;case"b":if(h=M[_++]*t+r,l=M[_++]*t,p=M[_++]*t+r,f=M[_++]*t,m=M[_++]*t+r,v=M[_++]*t,y.bezierCurveTo(p,f,m,v,h,l),g=x[x.length-1]){u=g.x,d=g.y;for(var S=1;i>=S;S++){var T=S/i;w(T,u,p,m,h),w(T,d,f,v,l)}}}}return{offset:o.ha*t,path:y}}}void 0===t&&(t=100),void 0===i&&(i=4);for(var a=this.data,s=r(e),c=[],h=0,l=s.length;l>h;h++)Array.prototype.push.apply(c,s[h].toShapes());return c}},n.Path=function(e){n.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},n.Path.prototype=Object.create(n.CurvePath.prototype),n.Path.prototype.constructor=n.Path,n.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;i>t;t++)this.lineTo(e[t].x,e[t].y)},n.Path.prototype.moveTo=function(e,t){this.actions.push({action:"moveTo",args:[e,t]})},n.Path.prototype.lineTo=function(e,t){var i=this.actions[this.actions.length-1].args,r=i[i.length-2],o=i[i.length-1],a=new n.LineCurve(new n.Vector2(r,o),new n.Vector2(e,t));this.curves.push(a),this.actions.push({action:"lineTo",args:[e,t]})},n.Path.prototype.quadraticCurveTo=function(e,t,i,r){var o=this.actions[this.actions.length-1].args,a=o[o.length-2],s=o[o.length-1],c=new n.QuadraticBezierCurve(new n.Vector2(a,s),new n.Vector2(e,t),new n.Vector2(i,r));this.curves.push(c),this.actions.push({action:"quadraticCurveTo",args:[e,t,i,r]})},n.Path.prototype.bezierCurveTo=function(e,t,i,r,o,a){var s=this.actions[this.actions.length-1].args,c=s[s.length-2],h=s[s.length-1],l=new n.CubicBezierCurve(new n.Vector2(c,h),new n.Vector2(e,t),new n.Vector2(i,r),new n.Vector2(o,a));this.curves.push(l),this.actions.push({action:"bezierCurveTo",args:[e,t,i,r,o,a]})},n.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,r=i[i.length-2],o=i[i.length-1],a=[new n.Vector2(r,o)];Array.prototype.push.apply(a,e);var s=new n.SplineCurve(a);this.curves.push(s),this.actions.push({action:"splineThru",args:t})},n.Path.prototype.arc=function(e,t,i,r,n,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],c=a[a.length-1];this.absarc(e+s,t+c,i,r,n,o)},n.Path.prototype.absarc=function(e,t,i,r,n,o){this.absellipse(e,t,i,i,r,n,o)},n.Path.prototype.ellipse=function(e,t,i,r,n,o,a,s){var c=this.actions[this.actions.length-1].args,h=c[c.length-2],l=c[c.length-1];this.absellipse(e+h,t+l,i,r,n,o,a,s)},n.Path.prototype.absellipse=function(e,t,i,r,o,a,s,c){var h=[e,t,i,r,o,a,s,c||0],l=new n.EllipseCurve(e,t,i,r,o,a,s,c);this.curves.push(l);var u=l.getPoint(1);h.push(u.x),h.push(u.y),this.actions.push({action:"ellipse",args:h})},n.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],i=0;e>i;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t},n.Path.prototype.getPoints=function(e){e=e||12;for(var t,i,r,o,a,s,c,h,l,u,d,p=n.ShapeUtils.b2,f=n.ShapeUtils.b3,m=[],v=0,g=this.actions.length;g>v;v++){var y=this.actions[v],x=y.action,b=y.args;switch(x){case"moveTo":m.push(new n.Vector2(b[0],b[1]));break;case"lineTo":m.push(new n.Vector2(b[0],b[1]));break;case"quadraticCurveTo":t=b[2],i=b[3],a=b[0],s=b[1],m.length>0?(l=m[m.length-1],c=l.x,h=l.y):(l=this.actions[v-1].args,c=l[l.length-2],h=l[l.length-1]);for(var w=1;e>=w;w++){var M=w/e;u=p(M,c,a,t),d=p(M,h,s,i),m.push(new n.Vector2(u,d))}break;case"bezierCurveTo":t=b[4],i=b[5],a=b[0],s=b[1],r=b[2],o=b[3],m.length>0?(l=m[m.length-1],c=l.x,h=l.y):(l=this.actions[v-1].args,c=l[l.length-2],h=l[l.length-1]);for(var w=1;e>=w;w++){var M=w/e;u=f(M,c,a,r,t),d=f(M,h,s,o,i),m.push(new n.Vector2(u,d))}break;case"splineThru":l=this.actions[v-1].args;var _=new n.Vector2(l[l.length-2],l[l.length-1]),E=[_],A=e*b[0].length;E=E.concat(b[0]);for(var S=new n.SplineCurve(E),w=1;A>=w;w++)m.push(S.getPointAt(w/A));break;case"arc":for(var T,C=b[0],L=b[1],R=b[2],P=b[3],D=b[4],O=!!b[5],I=D-P,k=2*e,w=1;k>=w;w++){var M=w/k;O||(M=1-M),T=P+M*I,u=C+R*Math.cos(T),d=L+R*Math.sin(T),m.push(new n.Vector2(u,d))}break;case"ellipse":var T,N,B,C=b[0],L=b[1],F=b[2],V=b[3],P=b[4],D=b[5],O=!!b[6],U=b[7],I=D-P,k=2*e;0!==U&&(N=Math.cos(U),B=Math.sin(U));for(var w=1;k>=w;w++){var M=w/k;if(O||(M=1-M),T=P+M*I,u=C+F*Math.cos(T),d=L+V*Math.sin(T),0!==U){var z=u,j=d;u=(z-C)*N-(j-L)*B+C,d=(z-C)*B+(j-L)*N+L}m.push(new n.Vector2(u,d))}}}var G=m[m.length-1];return Math.abs(G.x-m[0].x)<Number.EPSILON&&Math.abs(G.y-m[0].y)<Number.EPSILON&&m.splice(m.length-1,1),this.autoClose&&m.push(m[0]),m},n.Path.prototype.toShapes=function(e,t){function i(e){for(var t=[],i=new n.Path,r=0,o=e.length;o>r;r++){var a=e[r],s=a.args,c=a.action;"moveTo"===c&&0!==i.actions.length&&(t.push(i),i=new n.Path),i[c].apply(i,s)}return 0!==i.actions.length&&t.push(i),t}function r(e){for(var t=[],i=0,r=e.length;r>i;i++){var o=e[i],a=new n.Shape;a.actions=o.actions,a.curves=o.curves,t.push(a)}return t}function o(e,t){for(var i=t.length,r=!1,n=i-1,o=0;i>o;n=o++){var a=t[n],s=t[o],c=s.x-a.x,h=s.y-a.y;if(Math.abs(h)>Number.EPSILON){if(0>h&&(a=t[o],c=-c,s=t[n],h=-h),e.y<a.y||e.y>s.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var l=h*(e.x-a.x)-c*(e.y-a.y);if(0===l)return!0;if(0>l)continue;r=!r}}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 r}var a=n.ShapeUtils.isClockWise,s=i(this.actions);if(0===s.length)return[];if(t===!0)return r(s);var c,h,l,u=[];if(1===s.length)return h=s[0],l=new n.Shape,l.actions=h.actions,l.curves=h.curves,u.push(l),u;var d=!a(s[0].getPoints());d=e?!d:d;var p,f=[],m=[],v=[],g=0;m[g]=void 0,v[g]=[];for(var y=0,x=s.length;x>y;y++)h=s[y],p=h.getPoints(),c=a(p),c=e?!c:c,c?(!d&&m[g]&&g++,m[g]={s:new n.Shape,p:p},m[g].s.actions=h.actions,m[g].s.curves=h.curves,d&&g++,v[g]=[]):v[g].push({h:h,p:p[0]});if(!m[0])return r(s);if(m.length>1){for(var b=!1,w=[],M=0,_=m.length;_>M;M++)f[M]=[];for(var M=0,_=m.length;_>M;M++)for(var E=v[M],A=0;A<E.length;A++){for(var S=E[A],T=!0,C=0;C<m.length;C++)o(S.p,m[C].p)&&(M!==C&&w.push({froms:M,tos:C,hole:A}),T?(T=!1,f[C].push(S)):b=!0);T&&f[M].push(S)}w.length>0&&(b||(v=f))}for(var L,y=0,R=m.length;R>y;y++){l=m[y].s,u.push(l),L=v[y];for(var P=0,D=L.length;D>P;P++)l.holes.push(L[P].h)}return u},n.Shape=function(){n.Path.apply(this,arguments),this.holes=[]},n.Shape.prototype=Object.create(n.Path.prototype),n.Shape.prototype.constructor=n.Shape,n.Shape.prototype.extrude=function(e){return new n.ExtrudeGeometry(this,e)},n.Shape.prototype.makeGeometry=function(e){return new n.ShapeGeometry(this,e)},n.Shape.prototype.getPointsHoles=function(e){for(var t=[],i=0,r=this.holes.length;r>i;i++)t[i]=this.holes[i].getPoints(e);return t},n.Shape.prototype.extractAllPoints=function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},n.Shape.prototype.extractPoints=function(e){return this.extractAllPoints(e)},n.LineCurve=function(e,t){this.v1=e,this.v2=t},n.LineCurve.prototype=Object.create(n.Curve.prototype),n.LineCurve.prototype.constructor=n.LineCurve,n.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},n.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},n.LineCurve.prototype.getTangent=function(){var e=this.v2.clone().sub(this.v1);return e.normalize()},n.QuadraticBezierCurve=function(e,t,i){this.v0=e,this.v1=t,this.v2=i},n.QuadraticBezierCurve.prototype=Object.create(n.Curve.prototype),n.QuadraticBezierCurve.prototype.constructor=n.QuadraticBezierCurve,n.QuadraticBezierCurve.prototype.getPoint=function(e){var t=n.ShapeUtils.b2;return new n.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},n.QuadraticBezierCurve.prototype.getTangent=function(e){var t=n.CurveUtils.tangentQuadraticBezier;return new n.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()},n.CubicBezierCurve=function(e,t,i,r){this.v0=e,this.v1=t,this.v2=i,this.v3=r},n.CubicBezierCurve.prototype=Object.create(n.Curve.prototype),n.CubicBezierCurve.prototype.constructor=n.CubicBezierCurve,n.CubicBezierCurve.prototype.getPoint=function(e){var t=n.ShapeUtils.b3;return new n.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))},n.CubicBezierCurve.prototype.getTangent=function(e){var t=n.CurveUtils.tangentCubicBezier;return new n.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()},n.SplineCurve=function(e){this.points=void 0==e?[]:e},n.SplineCurve.prototype=Object.create(n.Curve.prototype),n.SplineCurve.prototype.constructor=n.SplineCurve,n.SplineCurve.prototype.getPoint=function(e){var t=this.points,i=(t.length-1)*e,r=Math.floor(i),o=i-r,a=t[0===r?r:r-1],s=t[r],c=t[r>t.length-2?t.length-1:r+1],h=t[r>t.length-3?t.length-1:r+2],l=n.CurveUtils.interpolate;return new n.Vector2(l(a.x,s.x,c.x,h.x,o),l(a.y,s.y,c.y,h.y,o))},n.EllipseCurve=function(e,t,i,r,n,o,a,s){this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},n.EllipseCurve.prototype=Object.create(n.Curve.prototype),n.EllipseCurve.prototype.constructor=n.EllipseCurve,n.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 i;i=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var r=this.aX+this.xRadius*Math.cos(i),o=this.aY+this.yRadius*Math.sin(i);if(0!==this.aRotation){var a=Math.cos(this.aRotation),s=Math.sin(this.aRotation),c=r,h=o;r=(c-this.aX)*a-(h-this.aY)*s+this.aX,o=(c-this.aX)*s+(h-this.aY)*a+this.aY}return new n.Vector2(r,o)},n.ArcCurve=function(e,t,i,r,o,a){n.EllipseCurve.call(this,e,t,i,i,r,o,a)},n.ArcCurve.prototype=Object.create(n.EllipseCurve.prototype),n.ArcCurve.prototype.constructor=n.ArcCurve,n.LineCurve3=n.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new n.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),n.QuadraticBezierCurve3=n.Curve.create(function(e,t,i){this.v0=e,this.v1=t,this.v2=i},function(e){var t=n.ShapeUtils.b2;return new n.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))}),n.CubicBezierCurve3=n.Curve.create(function(e,t,i,r){this.v0=e,this.v1=t,this.v2=i,this.v3=r},function(e){var t=n.ShapeUtils.b3;return new n.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))}),n.SplineCurve3=n.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,i=(t.length-1)*e,r=Math.floor(i),o=i-r,a=t[0==r?r:r-1],s=t[r],c=t[r>t.length-2?t.length-1:r+1],h=t[r>t.length-3?t.length-1:r+2],l=n.CurveUtils.interpolate;return new n.Vector3(l(a.x,s.x,c.x,h.x,o),l(a.y,s.y,c.y,h.y,o),l(a.z,s.z,c.z,h.z,o))}),n.CatmullRomCurve3=function(){function e(){}var t=new n.Vector3,i=new e,r=new e,o=new e;return e.prototype.init=function(e,t,i,r){this.c0=e,this.c1=i,this.c2=-3*e+3*t-2*i-r,this.c3=2*e-2*t+i+r},e.prototype.initNonuniformCatmullRom=function(e,t,i,r,n,o,a){var s=(t-e)/n-(i-e)/(n+o)+(i-t)/o,c=(i-t)/o-(r-t)/(o+a)+(r-i)/a;s*=o,c*=o,this.init(t,i,s,c)},e.prototype.initCatmullRom=function(e,t,i,r,n){this.init(t,i,n*(i-e),n*(r-t))},e.prototype.calc=function(e){var t=e*e,i=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*i},n.Curve.create(function(e){this.points=e||[],this.closed=!1},function(e){var a,s,c,h,l=this.points;h=l.length,2>h&&console.log("duh, you need at least 2 points"),a=(h-(this.closed?0:1))*e,s=Math.floor(a),c=a-s,this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/l.length)+1)*l.length:0===c&&s===h-1&&(s=h-2,c=1);var u,d,p,f;if(this.closed||s>0?u=l[(s-1)%h]:(t.subVectors(l[0],l[1]).add(l[0]),u=t),d=l[s%h],p=l[(s+1)%h],this.closed||h>s+2?f=l[(s+2)%h]:(t.subVectors(l[h-1],l[h-2]).add(l[h-1]),f=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,v=Math.pow(u.distanceToSquared(d),m),g=Math.pow(d.distanceToSquared(p),m),y=Math.pow(p.distanceToSquared(f),m);1e-4>g&&(g=1),1e-4>v&&(v=g),1e-4>y&&(y=g),i.initNonuniformCatmullRom(u.x,d.x,p.x,f.x,v,g,y),r.initNonuniformCatmullRom(u.y,d.y,p.y,f.y,v,g,y),o.initNonuniformCatmullRom(u.z,d.z,p.z,f.z,v,g,y)}else if("catmullrom"===this.type){var x=void 0!==this.tension?this.tension:.5;i.initCatmullRom(u.x,d.x,p.x,f.x,x),r.initCatmullRom(u.y,d.y,p.y,f.y,x),o.initCatmullRom(u.z,d.z,p.z,f.z,x)}var b=new n.Vector3(i.calc(c),r.calc(c),o.calc(c));return b})}(),n.ClosedSplineCurve3=function(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),n.CatmullRomCurve3.call(this,e),this.type="catmullrom",this.closed=!0},n.ClosedSplineCurve3.prototype=Object.create(n.CatmullRomCurve3.prototype),n.BoxGeometry=function(e,t,i,r,o,a){n.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:o,depthSegments:a},this.fromBufferGeometry(new n.BoxBufferGeometry(e,t,i,r,o,a)),this.mergeVertices()},n.BoxGeometry.prototype=Object.create(n.Geometry.prototype),n.BoxGeometry.prototype.constructor=n.BoxGeometry,n.CubeGeometry=n.BoxGeometry,n.BoxBufferGeometry=function(e,t,i,r,o,a){function s(e,t,i){var r=0;return r+=e*t*2,r+=e*i*2,r+=i*t*2,4*r}function c(e,t,i,r,o,a,s,c,l,u,w){for(var M=a/l,_=s/u,E=a/2,A=s/2,S=c/2,T=l+1,C=u+1,L=0,R=0,P=new n.Vector3,D=0;C>D;D++)for(var O=D*_-A,I=0;T>I;I++){var k=I*M-E;P[e]=k*r,P[t]=O*o,P[i]=S,p[v]=P.x,p[v+1]=P.y,p[v+2]=P.z,P[e]=0,P[t]=0,P[i]=c>0?1:-1,f[v]=P.x,f[v+1]=P.y,f[v+2]=P.z,m[g]=I/l,m[g+1]=1-D/u,v+=3,g+=2,L+=1}for(D=0;u>D;D++)for(I=0;l>I;I++){var N=x+I+T*D,B=x+I+T*(D+1),F=x+(I+1)+T*(D+1),V=x+(I+1)+T*D;d[y]=N,d[y+1]=B,d[y+2]=V,d[y+3]=B,d[y+4]=F,d[y+5]=V,y+=6,R+=6}h.addGroup(b,R,w),b+=R,x+=L}n.BufferGeometry.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:o,depthSegments:a};var h=this;r=Math.floor(r)||1,o=Math.floor(o)||1,a=Math.floor(a)||1;var l=s(r,o,a),u=l/4*6,d=new(u>65535?Uint32Array:Uint16Array)(u),p=new Float32Array(3*l),f=new Float32Array(3*l),m=new Float32Array(2*l),v=0,g=0,y=0,x=0,b=0;c("z","y","x",-1,-1,i,t,e,a,o,0),c("z","y","x",1,-1,i,t,-e,a,o,1),c("x","z","y",1,1,e,i,t,r,a,2),c("x","z","y",1,-1,e,i,-t,r,a,3),c("x","y","z",1,-1,e,t,i,r,o,4),c("x","y","z",-1,-1,e,t,-i,r,o,5),this.setIndex(new n.BufferAttribute(d,1)),this.addAttribute("position",new n.BufferAttribute(p,3)),this.addAttribute("normal",new n.BufferAttribute(f,3)),this.addAttribute("uv",new n.BufferAttribute(m,2))},n.BoxBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.BoxBufferGeometry.prototype.constructor=n.BoxBufferGeometry,n.CircleGeometry=function(e,t,i,r){n.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},this.fromBufferGeometry(new n.CircleBufferGeometry(e,t,i,r))},n.CircleGeometry.prototype=Object.create(n.Geometry.prototype),n.CircleGeometry.prototype.constructor=n.CircleGeometry,n.CircleBufferGeometry=function(e,t,i,r){n.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},e=e||50,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;
var o=t+2,a=new Float32Array(3*o),s=new Float32Array(3*o),c=new Float32Array(2*o);s[2]=1,c[0]=.5,c[1]=.5;for(var h=0,l=3,u=2;t>=h;h++,l+=3,u+=2){var d=i+h/t*r;a[l]=e*Math.cos(d),a[l+1]=e*Math.sin(d),s[l+2]=1,c[u]=(a[l]/e+1)/2,c[u+1]=(a[l+1]/e+1)/2}for(var p=[],l=1;t>=l;l++)p.push(l,l+1,0);this.setIndex(new n.BufferAttribute(new Uint16Array(p),1)),this.addAttribute("position",new n.BufferAttribute(a,3)),this.addAttribute("normal",new n.BufferAttribute(s,3)),this.addAttribute("uv",new n.BufferAttribute(c,2)),this.boundingSphere=new n.Sphere(new n.Vector3,e)},n.CircleBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.CircleBufferGeometry.prototype.constructor=n.CircleBufferGeometry,n.CylinderBufferGeometry=function(e,t,i,r,o,a,s,c){function h(){var e=(r+1)*(o+1);return a===!1&&(e+=2*(r+1)+2*r),e}function l(){var e=r*o*2*3;return a===!1&&(e+=2*r*3),e}function u(){var a,h,l=new n.Vector3,u=new n.Vector3,d=(t-e)/i;for(h=0;o>=h;h++){var p=[],f=h/o,_=f*(t-e)+e;for(a=0;r>=a;a++){var E=a/r;u.x=_*Math.sin(E*c+s),u.y=-f*i+M,u.z=_*Math.cos(E*c+s),v.setXYZ(x,u.x,u.y,u.z),l.copy(u),(0===e&&0===h||0===t&&h===o)&&(l.x=Math.sin(E*c+s),l.z=Math.cos(E*c+s)),l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*d).normalize(),g.setXYZ(x,l.x,l.y,l.z),y.setXY(x,E,1-f),p.push(x),x++}w.push(p)}for(a=0;r>a;a++)for(h=0;o>h;h++){var A=w[h][a],S=w[h+1][a],T=w[h+1][a+1],C=w[h][a+1];m.setX(b,A),b++,m.setX(b,S),b++,m.setX(b,C),b++,m.setX(b,S),b++,m.setX(b,T),b++,m.setX(b,C),b++}}function d(i){var o,a,h,l=new n.Vector2,u=new n.Vector3,d=i===!0?e:t,p=i===!0?1:-1;for(a=x,o=1;r>=o;o++)v.setXYZ(x,0,M*p,0),g.setXYZ(x,0,p,0),i===!0?(l.x=o/r,l.y=0):(l.x=(o-1)/r,l.y=1),y.setXY(x,l.x,l.y),x++;for(h=x,o=0;r>=o;o++){var f=o/r;u.x=d*Math.sin(f*c+s),u.y=M*p,u.z=d*Math.cos(f*c+s),v.setXYZ(x,u.x,u.y,u.z),g.setXYZ(x,0,p,0),y.setXY(x,f,i===!0?1:0),x++}for(o=0;r>o;o++){var w=a+o,_=h+o;i===!0?(m.setX(b,_),b++,m.setX(b,_+1),b++,m.setX(b,w),b++):(m.setX(b,_+1),b++,m.setX(b,_),b++,m.setX(b,w),b++)}}n.BufferGeometry.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:c},e=void 0!==e?e:20,t=void 0!==t?t:20,i=void 0!==i?i:100,r=Math.floor(r)||8,o=Math.floor(o)||1,a=void 0!==a?a:!1,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var p=h(),f=l(),m=new n.BufferAttribute(new(f>65535?Uint32Array:Uint16Array)(f),1),v=new n.BufferAttribute(new Float32Array(3*p),3),g=new n.BufferAttribute(new Float32Array(3*p),3),y=new n.BufferAttribute(new Float32Array(2*p),2),x=0,b=0,w=[],M=i/2;u(),a===!1&&(e>0&&d(!0),t>0&&d(!1)),this.setIndex(m),this.addAttribute("position",v),this.addAttribute("normal",g),this.addAttribute("uv",y)},n.CylinderBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.CylinderBufferGeometry.prototype.constructor=n.CylinderBufferGeometry,n.CylinderGeometry=function(e,t,i,r,o,a,s,c){n.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:c},this.fromBufferGeometry(new n.CylinderBufferGeometry(e,t,i,r,o,a,s,c)),this.mergeVertices()},n.CylinderGeometry.prototype=Object.create(n.Geometry.prototype),n.CylinderGeometry.prototype.constructor=n.CylinderGeometry,n.EdgesGeometry=function(e,t){function i(e,t){return e-t}n.BufferGeometry.call(this),t=void 0!==t?t:1;var r,o=Math.cos(n.Math.degToRad(t)),a=[0,0],s={},c=["a","b","c"];e instanceof n.BufferGeometry?(r=new n.Geometry,r.fromBufferGeometry(e)):r=e.clone(),r.mergeVertices(),r.computeFaceNormals();for(var h=r.vertices,l=r.faces,u=0,d=l.length;d>u;u++)for(var p=l[u],f=0;3>f;f++){a[0]=p[c[f]],a[1]=p[c[(f+1)%3]],a.sort(i);var m=a.toString();void 0===s[m]?s[m]={vert1:a[0],vert2:a[1],face1:u,face2:void 0}:s[m].face2=u}var v=[];for(var m in s){var g=s[m];if(void 0===g.face2||l[g.face1].normal.dot(l[g.face2].normal)<=o){var y=h[g.vert1];v.push(y.x),v.push(y.y),v.push(y.z),y=h[g.vert2],v.push(y.x),v.push(y.y),v.push(y.z)}}this.addAttribute("position",new n.BufferAttribute(new Float32Array(v),3))},n.EdgesGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.EdgesGeometry.prototype.constructor=n.EdgesGeometry,n.ExtrudeGeometry=function(e,t){return"undefined"==typeof e?void(e=[]):(n.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())},n.ExtrudeGeometry.prototype=Object.create(n.Geometry.prototype),n.ExtrudeGeometry.prototype.constructor=n.ExtrudeGeometry,n.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var i=e.length,r=0;i>r;r++){var n=e[r];this.addShape(n,t)}},n.ExtrudeGeometry.prototype.addShape=function(e,t){function i(e,t,i){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(i).add(e)}function r(e,t,i){var r,o,a=1,s=e.x-t.x,c=e.y-t.y,h=i.x-e.x,l=i.y-e.y,u=s*s+c*c,d=s*l-c*h;if(Math.abs(d)>Number.EPSILON){var p=Math.sqrt(u),f=Math.sqrt(h*h+l*l),m=t.x-c/p,v=t.y+s/p,g=i.x-l/f,y=i.y+h/f,x=((g-m)*l-(y-v)*h)/(s*l-c*h);r=m+s*x-e.x,o=v+c*x-e.y;var b=r*r+o*o;if(2>=b)return new n.Vector2(r,o);a=Math.sqrt(b/2)}else{var w=!1;s>Number.EPSILON?h>Number.EPSILON&&(w=!0):s<-Number.EPSILON?h<-Number.EPSILON&&(w=!0):Math.sign(c)===Math.sign(l)&&(w=!0),w?(r=-c,o=s,a=Math.sqrt(u)):(r=s,o=c,a=Math.sqrt(u/2))}return new n.Vector2(r/a,o/a)}function o(){if(b){var e=0,t=G*e;for(q=0;H>q;q++)j=k[q],h(j[2]+t,j[1]+t,j[0]+t);for(e=M+2*x,t=G*e,q=0;H>q;q++)j=k[q],h(j[0]+t,j[1]+t,j[2]+t)}else{for(q=0;H>q;q++)j=k[q],h(j[2],j[1],j[0]);for(q=0;H>q;q++)j=k[q],h(j[0]+G*M,j[1]+G*M,j[2]+G*M)}}function a(){var e=0;for(s(N,e),e+=N.length,T=0,C=O.length;C>T;T++)S=O[T],s(S,e),e+=S.length}function s(e,t){var i,r;for(q=e.length;--q>=0;){i=q,r=q-1,0>r&&(r=e.length-1);var n=0,o=M+2*x;for(n=0;o>n;n++){var a=G*n,s=G*(n+1),c=t+i+a,h=t+r+a,u=t+r+s,d=t+i+s;l(c,h,u,d,e,n,o,i,r)}}}function c(e,t,i){L.vertices.push(new n.Vector3(e,t,i))}function h(e,t,i){e+=R,t+=R,i+=R,L.faces.push(new n.Face3(e,t,i,null,null,0));var r=A.generateTopUV(L,e,t,i);L.faceVertexUvs[0].push(r)}function l(e,t,i,r){e+=R,t+=R,i+=R,r+=R,L.faces.push(new n.Face3(e,t,r,null,null,1)),L.faces.push(new n.Face3(t,i,r,null,null,1));var o=A.generateSideWallUV(L,e,t,i,r);L.faceVertexUvs[0].push([o[0],o[1],o[3]]),L.faceVertexUvs[0].push([o[1],o[2],o[3]])}var u,d,p,f,m,v=void 0!==t.amount?t.amount:100,g=void 0!==t.bevelThickness?t.bevelThickness:6,y=void 0!==t.bevelSize?t.bevelSize:g-2,x=void 0!==t.bevelSegments?t.bevelSegments:3,b=void 0!==t.bevelEnabled?t.bevelEnabled:!0,w=void 0!==t.curveSegments?t.curveSegments:12,M=void 0!==t.steps?t.steps:1,_=t.extrudePath,E=!1,A=void 0!==t.UVGenerator?t.UVGenerator:n.ExtrudeGeometry.WorldUVGenerator;_&&(u=_.getSpacedPoints(M),E=!0,b=!1,d=void 0!==t.frames?t.frames:new n.TubeGeometry.FrenetFrames(_,M,!1),p=new n.Vector3,f=new n.Vector3,m=new n.Vector3),b||(x=0,g=0,y=0);var S,T,C,L=this,R=this.vertices.length,P=e.extractPoints(w),D=P.shape,O=P.holes,I=!n.ShapeUtils.isClockWise(D);if(I){for(D=D.reverse(),T=0,C=O.length;C>T;T++)S=O[T],n.ShapeUtils.isClockWise(S)&&(O[T]=S.reverse());I=!1}var k=n.ShapeUtils.triangulateShape(D,O),N=D;for(T=0,C=O.length;C>T;T++)S=O[T],D=D.concat(S);for(var B,F,V,U,z,j,G=D.length,H=k.length,W=[],q=0,X=N.length,Y=X-1,Q=q+1;X>q;q++,Y++,Q++)Y===X&&(Y=0),Q===X&&(Q=0),W[q]=r(N[q],N[Y],N[Q]);var K,Z=[],J=W.concat();for(T=0,C=O.length;C>T;T++){for(S=O[T],K=[],q=0,X=S.length,Y=X-1,Q=q+1;X>q;q++,Y++,Q++)Y===X&&(Y=0),Q===X&&(Q=0),K[q]=r(S[q],S[Y],S[Q]);Z.push(K),J=J.concat(K)}for(B=0;x>B;B++){for(V=B/x,U=g*(1-V),F=y*Math.sin(V*Math.PI/2),q=0,X=N.length;X>q;q++)z=i(N[q],W[q],F),c(z.x,z.y,-U);for(T=0,C=O.length;C>T;T++)for(S=O[T],K=Z[T],q=0,X=S.length;X>q;q++)z=i(S[q],K[q],F),c(z.x,z.y,-U)}for(F=y,q=0;G>q;q++)z=b?i(D[q],J[q],F):D[q],E?(f.copy(d.normals[0]).multiplyScalar(z.x),p.copy(d.binormals[0]).multiplyScalar(z.y),m.copy(u[0]).add(f).add(p),c(m.x,m.y,m.z)):c(z.x,z.y,0);var $;for($=1;M>=$;$++)for(q=0;G>q;q++)z=b?i(D[q],J[q],F):D[q],E?(f.copy(d.normals[$]).multiplyScalar(z.x),p.copy(d.binormals[$]).multiplyScalar(z.y),m.copy(u[$]).add(f).add(p),c(m.x,m.y,m.z)):c(z.x,z.y,v/M*$);for(B=x-1;B>=0;B--){for(V=B/x,U=g*(1-V),F=y*Math.sin(V*Math.PI/2),q=0,X=N.length;X>q;q++)z=i(N[q],W[q],F),c(z.x,z.y,v+U);for(T=0,C=O.length;C>T;T++)for(S=O[T],K=Z[T],q=0,X=S.length;X>q;q++)z=i(S[q],K[q],F),E?c(z.x,z.y+u[M-1].y,u[M-1].x+U):c(z.x,z.y,v+U)}o(),a()},n.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,i,r){var o=e.vertices,a=o[t],s=o[i],c=o[r];return[new n.Vector2(a.x,a.y),new n.Vector2(s.x,s.y),new n.Vector2(c.x,c.y)]},generateSideWallUV:function(e,t,i,r,o){var a=e.vertices,s=a[t],c=a[i],h=a[r],l=a[o];return Math.abs(s.y-c.y)<.01?[new n.Vector2(s.x,1-s.z),new n.Vector2(c.x,1-c.z),new n.Vector2(h.x,1-h.z),new n.Vector2(l.x,1-l.z)]:[new n.Vector2(s.y,1-s.z),new n.Vector2(c.y,1-c.z),new n.Vector2(h.y,1-h.z),new n.Vector2(l.y,1-l.z)]}},n.ShapeGeometry=function(e,t){n.Geometry.call(this),this.type="ShapeGeometry",Array.isArray(e)===!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},n.ShapeGeometry.prototype=Object.create(n.Geometry.prototype),n.ShapeGeometry.prototype.constructor=n.ShapeGeometry,n.ShapeGeometry.prototype.addShapeList=function(e,t){for(var i=0,r=e.length;r>i;i++)this.addShape(e[i],t);return this},n.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var i,r,o,a=void 0!==t.curveSegments?t.curveSegments:12,s=t.material,c=void 0===t.UVGenerator?n.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,h=this.vertices.length,l=e.extractPoints(a),u=l.shape,d=l.holes,p=!n.ShapeUtils.isClockWise(u);if(p){for(u=u.reverse(),i=0,r=d.length;r>i;i++)o=d[i],n.ShapeUtils.isClockWise(o)&&(d[i]=o.reverse());p=!1}var f=n.ShapeUtils.triangulateShape(u,d);for(i=0,r=d.length;r>i;i++)o=d[i],u=u.concat(o);var m,v,g=u.length,y=f.length;for(i=0;g>i;i++)m=u[i],this.vertices.push(new n.Vector3(m.x,m.y,0));for(i=0;y>i;i++){v=f[i];var x=v[0]+h,b=v[1]+h,w=v[2]+h;this.faces.push(new n.Face3(x,b,w,null,null,s)),this.faceVertexUvs[0].push(c.generateTopUV(this,x,b,w))}},n.LatheBufferGeometry=function(e,t,i,r){n.BufferGeometry.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t)||12,i=i||0,r=r||2*Math.PI,r=n.Math.clamp(r,0,2*Math.PI);var o,a,s,c=(t+1)*e.length,h=t*e.length*2*3,l=new n.BufferAttribute(new(h>65535?Uint32Array:Uint16Array)(h),1),u=new n.BufferAttribute(new Float32Array(3*c),3),d=new n.BufferAttribute(new Float32Array(2*c),2),p=0,f=0,m=(1/(e.length-1),1/t),v=new n.Vector3,g=new n.Vector2;for(a=0;t>=a;a++){var y=i+a*m*r,x=Math.sin(y),b=Math.cos(y);for(s=0;s<=e.length-1;s++)v.x=e[s].x*x,v.y=e[s].y,v.z=e[s].x*b,u.setXYZ(p,v.x,v.y,v.z),g.x=a/t,g.y=s/(e.length-1),d.setXY(p,g.x,g.y),p++}for(a=0;t>a;a++)for(s=0;s<e.length-1;s++){o=s+a*e.length;var w=o,M=o+e.length,_=o+e.length+1,E=o+1;l.setX(f,w),f++,l.setX(f,M),f++,l.setX(f,E),f++,l.setX(f,M),f++,l.setX(f,_),f++,l.setX(f,E),f++}if(this.setIndex(l),this.addAttribute("position",u),this.addAttribute("uv",d),this.computeVertexNormals(),r===2*Math.PI){var A=this.attributes.normal.array,S=new n.Vector3,T=new n.Vector3,C=new n.Vector3;for(o=t*e.length*3,a=0,s=0;a<e.length;a++,s+=3)S.x=A[s+0],S.y=A[s+1],S.z=A[s+2],T.x=A[o+s+0],T.y=A[o+s+1],T.z=A[o+s+2],C.addVectors(S,T).normalize(),A[s+0]=A[o+s+0]=C.x,A[s+1]=A[o+s+1]=C.y,A[s+2]=A[o+s+2]=C.z}},n.LatheBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.LatheBufferGeometry.prototype.constructor=n.LatheBufferGeometry,n.LatheGeometry=function(e,t,i,r){n.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},this.fromBufferGeometry(new n.LatheBufferGeometry(e,t,i,r)),this.mergeVertices()},n.LatheGeometry.prototype=Object.create(n.Geometry.prototype),n.LatheGeometry.prototype.constructor=n.LatheGeometry,n.PlaneGeometry=function(e,t,i,r){n.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r},this.fromBufferGeometry(new n.PlaneBufferGeometry(e,t,i,r))},n.PlaneGeometry.prototype=Object.create(n.Geometry.prototype),n.PlaneGeometry.prototype.constructor=n.PlaneGeometry,n.PlaneBufferGeometry=function(e,t,i,r){n.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};for(var o=e/2,a=t/2,s=Math.floor(i)||1,c=Math.floor(r)||1,h=s+1,l=c+1,u=e/s,d=t/c,p=new Float32Array(h*l*3),f=new Float32Array(h*l*3),m=new Float32Array(h*l*2),v=0,g=0,y=0;l>y;y++)for(var x=y*d-a,b=0;h>b;b++){var w=b*u-o;p[v]=w,p[v+1]=-x,f[v+2]=1,m[g]=b/s,m[g+1]=1-y/c,v+=3,g+=2}v=0;for(var M=new(p.length/3>65535?Uint32Array:Uint16Array)(s*c*6),y=0;c>y;y++)for(var b=0;s>b;b++){var _=b+h*y,E=b+h*(y+1),A=b+1+h*(y+1),S=b+1+h*y;M[v]=_,M[v+1]=E,M[v+2]=S,M[v+3]=E,M[v+4]=A,M[v+5]=S,v+=6}this.setIndex(new n.BufferAttribute(M,1)),this.addAttribute("position",new n.BufferAttribute(p,3)),this.addAttribute("normal",new n.BufferAttribute(f,3)),this.addAttribute("uv",new n.BufferAttribute(m,2))},n.PlaneBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.PlaneBufferGeometry.prototype.constructor=n.PlaneBufferGeometry,n.RingBufferGeometry=function(e,t,i,r,o,a){n.BufferGeometry.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:o,thetaLength:a},e=e||20,t=t||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,i=void 0!==i?Math.max(3,i):8,r=void 0!==r?Math.max(1,r):1;var s,c,h,l=(i+1)*(r+1),u=i*r*2*3,d=new n.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),p=new n.BufferAttribute(new Float32Array(3*l),3),f=new n.BufferAttribute(new Float32Array(3*l),3),m=new n.BufferAttribute(new Float32Array(2*l),2),v=0,g=0,y=e,x=(t-e)/r,b=new n.Vector3,w=new n.Vector2;for(c=0;r>=c;c++){for(h=0;i>=h;h++)s=o+h/i*a,b.x=y*Math.cos(s),b.y=y*Math.sin(s),p.setXYZ(v,b.x,b.y,b.z),f.setXYZ(v,0,0,1),w.x=(b.x/t+1)/2,w.y=(b.y/t+1)/2,m.setXY(v,w.x,w.y),v++;y+=x}for(c=0;r>c;c++){var M=c*(i+1);for(h=0;i>h;h++){s=h+M;var _=s,E=s+i+1,A=s+i+2,S=s+1;d.setX(g,_),g++,d.setX(g,E),g++,d.setX(g,A),g++,d.setX(g,_),g++,d.setX(g,A),g++,d.setX(g,S),g++}}this.setIndex(d),this.addAttribute("position",p),this.addAttribute("normal",f),this.addAttribute("uv",m)},n.RingBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.RingBufferGeometry.prototype.constructor=n.RingBufferGeometry,n.RingGeometry=function(e,t,i,r,o,a){n.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new n.RingBufferGeometry(e,t,i,r,o,a))},n.RingGeometry.prototype=Object.create(n.Geometry.prototype),n.RingGeometry.prototype.constructor=n.RingGeometry,n.SphereGeometry=function(e,t,i,r,o,a,s){n.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new n.SphereBufferGeometry(e,t,i,r,o,a,s))},n.SphereGeometry.prototype=Object.create(n.Geometry.prototype),n.SphereGeometry.prototype.constructor=n.SphereGeometry,n.SphereBufferGeometry=function(e,t,i,r,o,a,s){n.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:o,thetaStart:a,thetaLength:s},e=e||50,t=Math.max(3,Math.floor(t)||8),i=Math.max(2,Math.floor(i)||6),r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,a=void 0!==a?a:0,s=void 0!==s?s:Math.PI;for(var c=a+s,h=(t+1)*(i+1),l=new n.BufferAttribute(new Float32Array(3*h),3),u=new n.BufferAttribute(new Float32Array(3*h),3),d=new n.BufferAttribute(new Float32Array(2*h),2),p=0,f=[],m=new n.Vector3,v=0;i>=v;v++){for(var g=[],y=v/i,x=0;t>=x;x++){var b=x/t,w=-e*Math.cos(r+b*o)*Math.sin(a+y*s),M=e*Math.cos(a+y*s),_=e*Math.sin(r+b*o)*Math.sin(a+y*s);m.set(w,M,_).normalize(),l.setXYZ(p,w,M,_),u.setXYZ(p,m.x,m.y,m.z),d.setXY(p,b,1-y),g.push(p),p++}f.push(g)}for(var E=[],v=0;i>v;v++)for(var x=0;t>x;x++){var A=f[v][x+1],S=f[v][x],T=f[v+1][x],C=f[v+1][x+1];(0!==v||a>0)&&E.push(A,S,C),(v!==i-1||c<Math.PI)&&E.push(S,T,C)}this.setIndex(new(l.count>65535?n.Uint32Attribute:n.Uint16Attribute)(E,1)),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",d),this.boundingSphere=new n.Sphere(new n.Vector3,e)},n.SphereBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.SphereBufferGeometry.prototype.constructor=n.SphereBufferGeometry,n.TextGeometry=function(e,t){t=t||{};var i=t.font;if(i instanceof n.Font==!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new n.Geometry;var r=i.generateShapes(e,t.size,t.curveSegments);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),n.ExtrudeGeometry.call(this,r,t),this.type="TextGeometry"},n.TextGeometry.prototype=Object.create(n.ExtrudeGeometry.prototype),n.TextGeometry.prototype.constructor=n.TextGeometry,n.TorusBufferGeometry=function(e,t,i,r,o){n.BufferGeometry.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:o},e=e||100,t=t||40,i=Math.floor(i)||8,r=Math.floor(r)||6,o=o||2*Math.PI;var a,s,c=(i+1)*(r+1),h=i*r*2*3,l=new(h>65535?Uint32Array:Uint16Array)(h),u=new Float32Array(3*c),d=new Float32Array(3*c),p=new Float32Array(2*c),f=0,m=0,v=0,g=new n.Vector3,y=new n.Vector3,x=new n.Vector3;for(a=0;i>=a;a++)for(s=0;r>=s;s++){var b=s/r*o,w=a/i*Math.PI*2;y.x=(e+t*Math.cos(w))*Math.cos(b),y.y=(e+t*Math.cos(w))*Math.sin(b),y.z=t*Math.sin(w),u[f]=y.x,u[f+1]=y.y,u[f+2]=y.z,g.x=e*Math.cos(b),g.y=e*Math.sin(b),x.subVectors(y,g).normalize(),d[f]=x.x,d[f+1]=x.y,d[f+2]=x.z,p[m]=s/r,p[m+1]=a/i,f+=3,m+=2}for(a=1;i>=a;a++)for(s=1;r>=s;s++){var M=(r+1)*a+s-1,_=(r+1)*(a-1)+s-1,E=(r+1)*(a-1)+s,A=(r+1)*a+s;l[v]=M,l[v+1]=_,l[v+2]=A,l[v+3]=_,l[v+4]=E,l[v+5]=A,v+=6}this.setIndex(new n.BufferAttribute(l,1)),this.addAttribute("position",new n.BufferAttribute(u,3)),this.addAttribute("normal",new n.BufferAttribute(d,3)),this.addAttribute("uv",new n.BufferAttribute(p,2))},n.TorusBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.TorusBufferGeometry.prototype.constructor=n.TorusBufferGeometry,n.TorusGeometry=function(e,t,i,r,o){n.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:o},this.fromBufferGeometry(new n.TorusBufferGeometry(e,t,i,r,o))},n.TorusGeometry.prototype=Object.create(n.Geometry.prototype),n.TorusGeometry.prototype.constructor=n.TorusGeometry,n.TorusKnotBufferGeometry=function(e,t,i,r,o,a){function s(e,t,i,r,n){var o=Math.cos(e),a=Math.sin(e),s=i/t*e,c=Math.cos(s);n.x=r*(2+c)*.5*o,n.y=r*(2+c)*a*.5,n.z=r*Math.sin(s)*.5}n.BufferGeometry.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:o,q:a},e=e||100,t=t||40,i=Math.floor(i)||64,r=Math.floor(r)||8,o=o||2,a=a||3;var c,h,l=(r+1)*(i+1),u=r*i*2*3,d=new n.BufferAttribute(new(u>65535?Uint32Array:Uint16Array)(u),1),p=new n.BufferAttribute(new Float32Array(3*l),3),f=new n.BufferAttribute(new Float32Array(3*l),3),m=new n.BufferAttribute(new Float32Array(2*l),2),v=0,g=0,y=new n.Vector3,x=new n.Vector3,b=new n.Vector2,w=new n.Vector3,M=new n.Vector3,_=new n.Vector3,E=new n.Vector3,A=new n.Vector3;for(c=0;i>=c;++c){var S=c/i*o*Math.PI*2;for(s(S,o,a,e,w),s(S+.01,o,a,e,M),E.subVectors(M,w),A.addVectors(M,w),_.crossVectors(E,A),A.crossVectors(_,E),_.normalize(),A.normalize(),h=0;r>=h;++h){var T=h/r*Math.PI*2,C=-t*Math.cos(T),L=t*Math.sin(T);y.x=w.x+(C*A.x+L*_.x),y.y=w.y+(C*A.y+L*_.y),y.z=w.z+(C*A.z+L*_.z),p.setXYZ(v,y.x,y.y,y.z),x.subVectors(y,w).normalize(),f.setXYZ(v,x.x,x.y,x.z),b.x=c/i,b.y=h/r,m.setXY(v,b.x,b.y),v++}}for(h=1;i>=h;h++)for(c=1;r>=c;c++){var R=(r+1)*(h-1)+(c-1),P=(r+1)*h+(c-1),D=(r+1)*h+c,O=(r+1)*(h-1)+c;d.setX(g,R),g++,d.setX(g,P),g++,d.setX(g,O),g++,d.setX(g,P),g++,d.setX(g,D),g++,d.setX(g,O),g++}this.setIndex(d),this.addAttribute("position",p),this.addAttribute("normal",f),this.addAttribute("uv",m)},n.TorusKnotBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.TorusKnotBufferGeometry.prototype.constructor=n.TorusKnotBufferGeometry,n.TorusKnotGeometry=function(e,t,i,r,o,a,s){n.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:o,q:a},void 0!==s&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new n.TorusKnotBufferGeometry(e,t,i,r,o,a)),this.mergeVertices()},n.TorusKnotGeometry.prototype=Object.create(n.Geometry.prototype),n.TorusKnotGeometry.prototype.constructor=n.TorusKnotGeometry,n.TubeGeometry=function(e,t,i,r,o,a){function s(e,t,i){return R.vertices.push(new n.Vector3(e,t,i))-1}n.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:i,radialSegments:r,closed:o,taper:a},t=t||64,i=i||1,r=r||8,o=o||!1,a=a||n.TubeGeometry.NoTaper;var c,h,l,u,d,p,f,m,v,g,y,x,b,w,M,_,E,A,S,T,C,L=[],R=this,P=t+1,D=new n.Vector3,O=new n.TubeGeometry.FrenetFrames(e,t,o),I=O.tangents,k=O.normals,N=O.binormals;for(this.tangents=I,this.normals=k,this.binormals=N,g=0;P>g;g++)for(L[g]=[],u=g/(P-1),v=e.getPointAt(u),c=I[g],h=k[g],l=N[g],p=i*a(u),y=0;r>y;y++)d=y/r*2*Math.PI,f=-p*Math.cos(d),m=p*Math.sin(d),D.copy(v),D.x+=f*h.x+m*l.x,D.y+=f*h.y+m*l.y,D.z+=f*h.z+m*l.z,L[g][y]=s(D.x,D.y,D.z);for(g=0;t>g;g++)for(y=0;r>y;y++)x=o?(g+1)%t:g+1,b=(y+1)%r,w=L[g][y],M=L[x][y],_=L[x][b],E=L[g][b],A=new n.Vector2(g/t,y/r),S=new n.Vector2((g+1)/t,y/r),T=new n.Vector2((g+1)/t,(y+1)/r),C=new n.Vector2(g/t,(y+1)/r),this.faces.push(new n.Face3(w,M,E)),this.faceVertexUvs[0].push([A,S,C]),this.faces.push(new n.Face3(M,_,E)),this.faceVertexUvs[0].push([S.clone(),T,C.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},n.TubeGeometry.prototype=Object.create(n.Geometry.prototype),n.TubeGeometry.prototype.constructor=n.TubeGeometry,n.TubeGeometry.NoTaper=function(){return 1},n.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},n.TubeGeometry.FrenetFrames=function(e,t,i){function r(){f[0]=new n.Vector3,m[0]=new n.Vector3,a=Number.MAX_VALUE,s=Math.abs(p[0].x),c=Math.abs(p[0].y),h=Math.abs(p[0].z),a>=s&&(a=s,d.set(1,0,0)),a>=c&&(a=c,d.set(0,1,0)),a>=h&&d.set(0,0,1),v.crossVectors(p[0],d).normalize(),f[0].crossVectors(p[0],v),m[0].crossVectors(p[0],f[0])}var o,a,s,c,h,l,u,d=new n.Vector3,p=[],f=[],m=[],v=new n.Vector3,g=new n.Matrix4,y=t+1;for(this.tangents=p,this.normals=f,this.binormals=m,l=0;y>l;l++)u=l/(y-1),p[l]=e.getTangentAt(u),p[l].normalize();for(r(),l=1;y>l;l++)f[l]=f[l-1].clone(),m[l]=m[l-1].clone(),v.crossVectors(p[l-1],p[l]),v.length()>Number.EPSILON&&(v.normalize(),o=Math.acos(n.Math.clamp(p[l-1].dot(p[l]),-1,1)),f[l].applyMatrix4(g.makeRotationAxis(v,o))),m[l].crossVectors(p[l],f[l]);if(i)for(o=Math.acos(n.Math.clamp(f[0].dot(f[y-1]),-1,1)),o/=y-1,p[0].dot(v.crossVectors(f[0],f[y-1]))>0&&(o=-o),l=1;y>l;l++)f[l].applyMatrix4(g.makeRotationAxis(p[l],o*l)),m[l].crossVectors(p[l],f[l])},n.PolyhedronGeometry=function(e,t,i,r){function o(e){var t=e.normalize().clone();t.index=u.vertices.push(t)-1;var i=c(e)/2/Math.PI+.5,r=h(e)/Math.PI+.5;return t.uv=new n.Vector2(i,1-r),t}function a(e,t,i,r){var o=new n.Face3(e.index,t.index,i.index,[e.clone(),t.clone(),i.clone()],void 0,r);u.faces.push(o),b.copy(e).add(t).add(i).divideScalar(3);var a=c(b);u.faceVertexUvs[0].push([l(e.uv,e,a),l(t.uv,t,a),l(i.uv,i,a)])}function s(e,t){for(var i=Math.pow(2,t),r=o(u.vertices[e.a]),n=o(u.vertices[e.b]),s=o(u.vertices[e.c]),c=[],h=e.materialIndex,l=0;i>=l;l++){c[l]=[];for(var d=o(r.clone().lerp(s,l/i)),p=o(n.clone().lerp(s,l/i)),f=i-l,m=0;f>=m;m++)c[l][m]=0===m&&l===i?d:o(d.clone().lerp(p,m/f))}for(var l=0;i>l;l++)for(var m=0;2*(i-l)-1>m;m++){var v=Math.floor(m/2);m%2===0?a(c[l][v+1],c[l+1][v],c[l][v],h):a(c[l][v+1],c[l+1][v+1],c[l+1][v],h)}}function c(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 l(e,t,i){return 0>i&&1===e.x&&(e=new n.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new n.Vector2(i/2/Math.PI+.5,e.y)),e.clone()}n.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r},i=i||1,r=r||0;for(var u=this,d=0,p=e.length;p>d;d+=3)o(new n.Vector3(e[d],e[d+1],e[d+2]));for(var f=this.vertices,m=[],d=0,v=0,p=t.length;p>d;d+=3,v++){var g=f[t[d]],y=f[t[d+1]],x=f[t[d+2]];m[v]=new n.Face3(g.index,y.index,x.index,[g.clone(),y.clone(),x.clone()],void 0,v)}for(var b=new n.Vector3,d=0,p=m.length;p>d;d++)s(m[d],r);for(var d=0,p=this.faceVertexUvs[0].length;p>d;d++){var w=this.faceVertexUvs[0][d],M=w[0].x,_=w[1].x,E=w[2].x,A=Math.max(M,_,E),S=Math.min(M,_,E);A>.9&&.1>S&&(.2>M&&(w[0].x+=1),.2>_&&(w[1].x+=1),.2>E&&(w[2].x+=1))}for(var d=0,p=this.vertices.length;p>d;d++)this.vertices[d].multiplyScalar(i);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new n.Sphere(new n.Vector3,i)},n.PolyhedronGeometry.prototype=Object.create(n.Geometry.prototype),n.PolyhedronGeometry.prototype.constructor=n.PolyhedronGeometry,n.DodecahedronGeometry=function(e,t){var i=(1+Math.sqrt(5))/2,r=1/i,o=[-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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],a=[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];n.PolyhedronGeometry.call(this,o,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}},n.DodecahedronGeometry.prototype=Object.create(n.PolyhedronGeometry.prototype),n.DodecahedronGeometry.prototype.constructor=n.DodecahedronGeometry,n.IcosahedronGeometry=function(e,t){var i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],o=[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];n.PolyhedronGeometry.call(this,r,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},n.IcosahedronGeometry.prototype=Object.create(n.PolyhedronGeometry.prototype),n.IcosahedronGeometry.prototype.constructor=n.IcosahedronGeometry,n.OctahedronGeometry=function(e,t){var i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];n.PolyhedronGeometry.call(this,i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},n.OctahedronGeometry.prototype=Object.create(n.PolyhedronGeometry.prototype),n.OctahedronGeometry.prototype.constructor=n.OctahedronGeometry,n.TetrahedronGeometry=function(e,t){var i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];n.PolyhedronGeometry.call(this,i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},n.TetrahedronGeometry.prototype=Object.create(n.PolyhedronGeometry.prototype),n.TetrahedronGeometry.prototype.constructor=n.TetrahedronGeometry,n.ParametricGeometry=function(e,t,i){n.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:i};var r,o,a,s,c,h=this.vertices,l=this.faces,u=this.faceVertexUvs[0],d=t+1;for(r=0;i>=r;r++)for(c=r/i,o=0;t>=o;o++)s=o/t,a=e(s,c),h.push(a);var p,f,m,v,g,y,x,b;for(r=0;i>r;r++)for(o=0;t>o;o++)p=r*d+o,f=r*d+o+1,m=(r+1)*d+o+1,v=(r+1)*d+o,g=new n.Vector2(o/t,r/i),y=new n.Vector2((o+1)/t,r/i),x=new n.Vector2((o+1)/t,(r+1)/i),b=new n.Vector2(o/t,(r+1)/i),l.push(new n.Face3(p,f,v)),u.push([g,y,b]),l.push(new n.Face3(f,m,v)),u.push([y.clone(),x,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},n.ParametricGeometry.prototype=Object.create(n.Geometry.prototype),n.ParametricGeometry.prototype.constructor=n.ParametricGeometry,n.WireframeGeometry=function(e){function t(e,t){return e-t}n.BufferGeometry.call(this);var i=[0,0],r={},o=["a","b","c"];if(e instanceof n.Geometry){for(var a=e.vertices,s=e.faces,c=0,h=new Uint32Array(6*s.length),l=0,u=s.length;u>l;l++)for(var d=s[l],p=0;3>p;p++){i[0]=d[o[p]],i[1]=d[o[(p+1)%3]],i.sort(t);var f=i.toString();void 0===r[f]&&(h[2*c]=i[0],h[2*c+1]=i[1],r[f]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,u=c;u>l;l++)for(var p=0;2>p;p++){var v=a[h[2*l+p]],g=6*l+3*p;m[g+0]=v.x,m[g+1]=v.y,m[g+2]=v.z}this.addAttribute("position",new n.BufferAttribute(m,3))}else if(e instanceof n.BufferGeometry)if(null!==e.index){var y=e.index.array,a=e.attributes.position,x=e.groups,c=0;0===x.length&&e.addGroup(0,y.length);for(var h=new Uint32Array(2*y.length),b=0,w=x.length;w>b;++b)for(var M=x[b],_=M.start,E=M.count,l=_,A=_+E;A>l;l+=3)for(var p=0;3>p;p++){i[0]=y[l+p],i[1]=y[l+(p+1)%3],i.sort(t);var f=i.toString();void 0===r[f]&&(h[2*c]=i[0],h[2*c+1]=i[1],r[f]=!0,c++)}for(var m=new Float32Array(2*c*3),l=0,u=c;u>l;l++)for(var p=0;2>p;p++){var g=6*l+3*p,S=h[2*l+p];m[g+0]=a.getX(S),m[g+1]=a.getY(S),m[g+2]=a.getZ(S)}this.addAttribute("position",new n.BufferAttribute(m,3))}else{for(var a=e.attributes.position.array,c=a.length/3,T=c/3,m=new Float32Array(2*c*3),l=0,u=T;u>l;l++)for(var p=0;3>p;p++){var g=18*l+6*p,C=9*l+3*p;m[g+0]=a[C],m[g+1]=a[C+1],m[g+2]=a[C+2];var S=9*l+3*((p+1)%3);m[g+3]=a[S],m[g+4]=a[S+1],m[g+5]=a[S+2]}this.addAttribute("position",new n.BufferAttribute(m,3))}},n.WireframeGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.WireframeGeometry.prototype.constructor=n.WireframeGeometry,n.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]),i=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),r=new n.BufferGeometry;r.addAttribute("position",new n.BufferAttribute(t,3)),r.addAttribute("color",new n.BufferAttribute(i,3));var o=new n.LineBasicMaterial({vertexColors:n.VertexColors});n.LineSegments.call(this,r,o)},n.AxisHelper.prototype=Object.create(n.LineSegments.prototype),n.AxisHelper.prototype.constructor=n.AxisHelper,n.ArrowHelper=function(){var e=new n.Geometry;e.vertices.push(new n.Vector3(0,0,0),new n.Vector3(0,1,0));var t=new n.CylinderGeometry(0,.5,1,5,1);return t.translate(0,-.5,0),function(i,r,o,a,s,c){n.Object3D.call(this),void 0===a&&(a=16776960),void 0===o&&(o=1),void 0===s&&(s=.2*o),void 0===c&&(c=.2*s),this.position.copy(r),this.line=new n.Line(e,new n.LineBasicMaterial({color:a})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new n.Mesh(t,new n.MeshBasicMaterial({color:a})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(i),this.setLength(o,s,c)}}(),n.ArrowHelper.prototype=Object.create(n.Object3D.prototype),n.ArrowHelper.prototype.constructor=n.ArrowHelper,n.ArrowHelper.prototype.setDirection=function(){var e,t=new n.Vector3;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(i.z,0,-i.x).normalize(),e=Math.acos(i.y),this.quaternion.setFromAxisAngle(t,e))}}(),n.ArrowHelper.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},n.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},n.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]),i=new Float32Array(24),r=new n.BufferGeometry;r.setIndex(new n.BufferAttribute(t,1)),r.addAttribute("position",new n.BufferAttribute(i,3)),n.LineSegments.call(this,r,new n.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},n.BoxHelper.prototype=Object.create(n.LineSegments.prototype),n.BoxHelper.prototype.constructor=n.BoxHelper,n.BoxHelper.prototype.update=function(){var e=new n.Box3;return function(t){
if(e.setFromObject(t),!e.isEmpty()){var i=e.min,r=e.max,n=this.geometry.attributes.position,o=n.array;o[0]=r.x,o[1]=r.y,o[2]=r.z,o[3]=i.x,o[4]=r.y,o[5]=r.z,o[6]=i.x,o[7]=i.y,o[8]=r.z,o[9]=r.x,o[10]=i.y,o[11]=r.z,o[12]=r.x,o[13]=r.y,o[14]=i.z,o[15]=i.x,o[16]=r.y,o[17]=i.z,o[18]=i.x,o[19]=i.y,o[20]=i.z,o[21]=r.x,o[22]=i.y,o[23]=i.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),n.BoundingBoxHelper=function(e,t){var i=void 0!==t?t:8947848;this.object=e,this.box=new n.Box3,n.Mesh.call(this,new n.BoxGeometry(1,1,1),new n.MeshBasicMaterial({color:i,wireframe:!0}))},n.BoundingBoxHelper.prototype=Object.create(n.Mesh.prototype),n.BoundingBoxHelper.prototype.constructor=n.BoundingBoxHelper,n.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},n.CameraHelper=function(e){function t(e,t,r){i(e,r),i(t,r)}function i(e,t){r.vertices.push(new n.Vector3),r.colors.push(new n.Color(t)),void 0===a[e]&&(a[e]=[]),a[e].push(r.vertices.length-1)}var r=new n.Geometry,o=new n.LineBasicMaterial({color:16777215,vertexColors:n.FaceColors}),a={},s=16755200,c=16711680,h=43775,l=16777215,u=3355443;t("n1","n2",s),t("n2","n4",s),t("n4","n3",s),t("n3","n1",s),t("f1","f2",s),t("f2","f4",s),t("f4","f3",s),t("f3","f1",s),t("n1","f1",s),t("n2","f2",s),t("n3","f3",s),t("n4","f4",s),t("p","n1",c),t("p","n2",c),t("p","n3",c),t("p","n4",c),t("u1","u2",h),t("u2","u3",h),t("u3","u1",h),t("c","t",l),t("p","c",u),t("cn1","cn2",u),t("cn3","cn4",u),t("cf1","cf2",u),t("cf3","cf4",u),n.LineSegments.call(this,r,o),this.camera=e,this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},n.CameraHelper.prototype=Object.create(n.LineSegments.prototype),n.CameraHelper.prototype.constructor=n.CameraHelper,n.CameraHelper.prototype.update=function(){function e(e,n,a,s){r.set(n,a,s).unproject(o);var c=i[e];if(void 0!==c)for(var h=0,l=c.length;l>h;h++)t.vertices[c[h]].copy(r)}var t,i,r=new n.Vector3,o=new n.Camera;return function(){t=this.geometry,i=this.pointMap;var r=1,n=1;o.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-r,-n,-1),e("n2",r,-n,-1),e("n3",-r,n,-1),e("n4",r,n,-1),e("f1",-r,-n,1),e("f2",r,-n,1),e("f3",-r,n,1),e("f4",r,n,1),e("u1",.7*r,1.1*n,-1),e("u2",.7*-r,1.1*n,-1),e("u3",0,2*n,-1),e("cf1",-r,0,1),e("cf2",r,0,1),e("cf3",0,-n,1),e("cf4",0,n,1),e("cn1",-r,0,-1),e("cn2",r,0,-1),e("cn3",0,-n,-1),e("cn4",0,n,-1),t.verticesNeedUpdate=!0}}(),n.DirectionalLightHelper=function(e,t){n.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var i=new n.Geometry;i.vertices.push(new n.Vector3(-t,t,0),new n.Vector3(t,t,0),new n.Vector3(t,-t,0),new n.Vector3(-t,-t,0),new n.Vector3(-t,t,0));var r=new n.LineBasicMaterial({fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new n.Line(i,r),this.add(this.lightPlane),i=new n.Geometry,i.vertices.push(new n.Vector3,new n.Vector3),r=new n.LineBasicMaterial({fog:!1}),r.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new n.Line(i,r),this.add(this.targetLine),this.update()},n.DirectionalLightHelper.prototype=Object.create(n.Object3D.prototype),n.DirectionalLightHelper.prototype.constructor=n.DirectionalLightHelper,n.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},n.DirectionalLightHelper.prototype.update=function(){var e=new n.Vector3,t=new n.Vector3,i=new n.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(t,e),this.lightPlane.lookAt(i),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(i),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),n.EdgesHelper=function(e,t,i){var r=void 0!==t?t:16777215;n.LineSegments.call(this,new n.EdgesGeometry(e.geometry,i),new n.LineBasicMaterial({color:r})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},n.EdgesHelper.prototype=Object.create(n.LineSegments.prototype),n.EdgesHelper.prototype.constructor=n.EdgesHelper,n.FaceNormalsHelper=function(e,t,i,r){this.object=e,this.size=void 0!==t?t:1;var o=void 0!==i?i:16776960,a=void 0!==r?r:1,s=0,c=this.object.geometry;c instanceof n.Geometry?s=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var h=new n.BufferGeometry,l=new n.Float32Attribute(2*s*3,3);h.addAttribute("position",l),n.LineSegments.call(this,h,new n.LineBasicMaterial({color:o,linewidth:a})),this.matrixAutoUpdate=!1,this.update()},n.FaceNormalsHelper.prototype=Object.create(n.LineSegments.prototype),n.FaceNormalsHelper.prototype.constructor=n.FaceNormalsHelper,n.FaceNormalsHelper.prototype.update=function(){var e=new n.Vector3,t=new n.Vector3,i=new n.Matrix3;return function(){this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);for(var r=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,c=0,h=0,l=s.length;l>h;h++){var u=s[h],d=u.normal;e.copy(a[u.a]).add(a[u.b]).add(a[u.c]).divideScalar(3).applyMatrix4(r),t.copy(d).applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),n.setXYZ(c,e.x,e.y,e.z),c+=1,n.setXYZ(c,t.x,t.y,t.z),c+=1}return n.needsUpdate=!0,this}}(),n.GridHelper=function(e,t){var i=new n.Geometry,r=new n.LineBasicMaterial({vertexColors:n.VertexColors});this.color1=new n.Color(4473924),this.color2=new n.Color(8947848);for(var o=-e;e>=o;o+=t){i.vertices.push(new n.Vector3(-e,0,o),new n.Vector3(e,0,o),new n.Vector3(o,0,-e),new n.Vector3(o,0,e));var a=0===o?this.color1:this.color2;i.colors.push(a,a,a,a)}n.LineSegments.call(this,i,r)},n.GridHelper.prototype=Object.create(n.LineSegments.prototype),n.GridHelper.prototype.constructor=n.GridHelper,n.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},n.HemisphereLightHelper=function(e,t){n.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new n.Color,new n.Color];var i=new n.SphereGeometry(t,4,2);i.rotateX(-Math.PI/2);for(var r=0,o=8;o>r;r++)i.faces[r].color=this.colors[4>r?0:1];var a=new n.MeshBasicMaterial({vertexColors:n.FaceColors,wireframe:!0});this.lightSphere=new n.Mesh(i,a),this.add(this.lightSphere),this.update()},n.HemisphereLightHelper.prototype=Object.create(n.Object3D.prototype),n.HemisphereLightHelper.prototype.constructor=n.HemisphereLightHelper,n.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},n.HemisphereLightHelper.prototype.update=function(){var e=new n.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}}(),n.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var i=new n.SphereGeometry(t,4,2),r=new n.MeshBasicMaterial({wireframe:!0,fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),n.Mesh.call(this,i,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},n.PointLightHelper.prototype=Object.create(n.Mesh.prototype),n.PointLightHelper.prototype.constructor=n.PointLightHelper,n.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},n.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},n.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new n.Geometry,i=0;i<this.bones.length;i++){var r=this.bones[i];r.parent instanceof n.Bone&&(t.vertices.push(new n.Vector3),t.vertices.push(new n.Vector3),t.colors.push(new n.Color(0,0,1)),t.colors.push(new n.Color(0,1,0)))}t.dynamic=!0;var o=new n.LineBasicMaterial({vertexColors:n.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});n.LineSegments.call(this,t,o),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()},n.SkeletonHelper.prototype=Object.create(n.LineSegments.prototype),n.SkeletonHelper.prototype.constructor=n.SkeletonHelper,n.SkeletonHelper.prototype.getBoneList=function(e){var t=[];e instanceof n.Bone&&t.push(e);for(var i=0;i<e.children.length;i++)t.push.apply(t,this.getBoneList(e.children[i]));return t},n.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(new n.Matrix4).getInverse(this.root.matrixWorld),i=new n.Matrix4,r=0,o=0;o<this.bones.length;o++){var a=this.bones[o];a.parent instanceof n.Bone&&(i.multiplyMatrices(t,a.matrixWorld),e.vertices[r].setFromMatrixPosition(i),i.multiplyMatrices(t,a.parent.matrixWorld),e.vertices[r+1].setFromMatrixPosition(i),r+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},n.SpotLightHelper=function(e){n.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;var t=new n.CylinderGeometry(0,1,1,8,1,!0);t.translate(0,-.5,0),t.rotateX(-Math.PI/2);var i=new n.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new n.Mesh(t,i),this.add(this.cone),this.update()},n.SpotLightHelper.prototype=Object.create(n.Object3D.prototype),n.SpotLightHelper.prototype.constructor=n.SpotLightHelper,n.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},n.SpotLightHelper.prototype.update=function(){var e=new n.Vector3,t=new n.Vector3;return function(){var i=this.light.distance?this.light.distance:1e4,r=i*Math.tan(this.light.angle);this.cone.scale.set(r,r,i),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),n.VertexNormalsHelper=function(e,t,i,r){this.object=e,this.size=void 0!==t?t:1;var o=void 0!==i?i:16711680,a=void 0!==r?r:1,s=0,c=this.object.geometry;c instanceof n.Geometry?s=3*c.faces.length:c instanceof n.BufferGeometry&&(s=c.attributes.normal.count);var h=new n.BufferGeometry,l=new n.Float32Attribute(2*s*3,3);h.addAttribute("position",l),n.LineSegments.call(this,h,new n.LineBasicMaterial({color:o,linewidth:a})),this.matrixAutoUpdate=!1,this.update()},n.VertexNormalsHelper.prototype=Object.create(n.LineSegments.prototype),n.VertexNormalsHelper.prototype.constructor=n.VertexNormalsHelper,n.VertexNormalsHelper.prototype.update=function(){var e=new n.Vector3,t=new n.Vector3,i=new n.Matrix3;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var o=this.object.matrixWorld,a=this.geometry.attributes.position,s=this.object.geometry;if(s instanceof n.Geometry)for(var c=s.vertices,h=s.faces,l=0,u=0,d=h.length;d>u;u++)for(var p=h[u],f=0,m=p.vertexNormals.length;m>f;f++){var v=c[p[r[f]]],g=p.vertexNormals[f];e.copy(v).applyMatrix4(o),t.copy(g).applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1}else if(s instanceof n.BufferGeometry)for(var y=s.attributes.position,x=s.attributes.normal,l=0,f=0,m=y.count;m>f;f++)e.set(y.getX(f),y.getY(f),y.getZ(f)).applyMatrix4(o),t.set(x.getX(f),x.getY(f),x.getZ(f)),t.applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1;return a.needsUpdate=!0,this}}(),n.WireframeHelper=function(e,t){var i=void 0!==t?t:16777215;n.LineSegments.call(this,new n.WireframeGeometry(e.geometry),new n.LineBasicMaterial({color:i})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},n.WireframeHelper.prototype=Object.create(n.LineSegments.prototype),n.WireframeHelper.prototype.constructor=n.WireframeHelper,n.ImmediateRenderObject=function(e){n.Object3D.call(this),this.material=e,this.render=function(){}},n.ImmediateRenderObject.prototype=Object.create(n.Object3D.prototype),n.ImmediateRenderObject.prototype.constructor=n.ImmediateRenderObject,n.MorphBlendMesh=function(e,t){n.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,r="__default",o=0,a=i-1,s=i/1;this.createAnimation(r,o,a,s),this.setAnimationWeight(r,1)},n.MorphBlendMesh.prototype=Object.create(n.Mesh.prototype),n.MorphBlendMesh.prototype.constructor=n.MorphBlendMesh,n.MorphBlendMesh.prototype.createAnimation=function(e,t,i,r){var n={start:t,end:i,length:i-t+1,fps:r,duration:(i-t)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=n,this.animationsList.push(n)},n.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,i=/([a-z]+)_?(\d+)/i,r={},n=this.geometry,o=0,a=n.morphTargets.length;a>o;o++){var s=n.morphTargets[o],c=s.name.match(i);if(c&&c.length>1){var h=c[1];r[h]||(r[h]={start:1/0,end:-(1/0)});var l=r[h];o<l.start&&(l.start=o),o>l.end&&(l.end=o),t||(t=h)}}for(var h in r){var l=r[h];this.createAnimation(h,l.start,l.end,e)}this.firstAnimation=t},n.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},n.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},n.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var i=this.animationsMap[e];i&&(i.fps=t,i.duration=(i.end-i.start)/i.fps)},n.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var i=this.animationsMap[e];i&&(i.duration=t,i.fps=(i.end-i.start)/i.duration)},n.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var i=this.animationsMap[e];i&&(i.weight=t)},n.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var i=this.animationsMap[e];i&&(i.time=t)},n.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,i=this.animationsMap[e];return i&&(t=i.time),t},n.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,i=this.animationsMap[e];return i&&(t=i.duration),t},n.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()")},n.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},n.MorphBlendMesh.prototype.update=function(e){for(var t=0,i=this.animationsList.length;i>t;t++){var r=this.animationsList[t];if(r.active){var o=r.duration/r.length;r.time+=r.direction*e,r.mirroredLoop?(r.time>r.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var a=r.start+n.Math.clamp(Math.floor(r.time/o),0,r.length-1),s=r.weight;a!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*s,this.morphTargetInfluences[a]=0,r.lastFrame=r.currentFrame,r.currentFrame=a);var c=r.time%o/o;r.directionBackwards&&(c=1-c),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=c*s,this.morphTargetInfluences[r.lastFrame]=(1-c)*s):this.morphTargetInfluences[r.currentFrame]=s}}},"undefined"!=typeof r?("undefined"!=typeof i&&i.exports&&(r=i.exports=n),r.THREE=n):this.THREE=n},{}],22:[function(e,i,r){!function(e){if("performance"in e==!1&&(e.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in e.performance==!1){var t=e.performance.timing&&e.performance.timing.navigationStart?performance.timing.navigationStart:Date.now();e.performance.now=function(){return Date.now()-t}}}(this);var n=n||function(){var e=[];return{REVISION:"14",getAll:function(){return e},removeAll:function(){e=[]},add:function(t){e.push(t)},remove:function(t){var i=e.indexOf(t);-1!==i&&e.splice(i,1)},update:function(t){if(0===e.length)return!1;var i=0;for(t=void 0!==t?t:window.performance.now();i<e.length;)e[i].update(t)?i++:e.splice(i,1);return!0}}}();n.Tween=function(e){var t=e,i={},r={},o={},a=1e3,s=0,c=!1,h=!1,l=!1,u=0,d=null,p=n.Easing.Linear.None,f=n.Interpolation.Linear,m=[],v=null,g=!1,y=null,x=null,b=null;for(var w in e)i[w]=parseFloat(e[w],10);this.to=function(e,t){return void 0!==t&&(a=t),r=e,this},this.start=function(e){n.add(this),h=!0,g=!1,d=void 0!==e?e:window.performance.now(),d+=u;for(var a in r){if(r[a]instanceof Array){if(0===r[a].length)continue;r[a]=[t[a]].concat(r[a])}i[a]=t[a],i[a]instanceof Array==!1&&(i[a]*=1),o[a]=i[a]||0}return this},this.stop=function(){return h?(n.remove(this),h=!1,null!==b&&b.call(t),this.stopChainedTweens(),this):this},this.stopChainedTweens=function(){for(var e=0,t=m.length;t>e;e++)m[e].stop()},this.delay=function(e){return u=e,this},this.repeat=function(e){return s=e,this},this.yoyo=function(e){return c=e,this},this.easing=function(e){return p=e,this},this.interpolation=function(e){return f=e,this},this.chain=function(){return m=arguments,this},this.onStart=function(e){return v=e,this},this.onUpdate=function(e){return y=e,this},this.onComplete=function(e){return x=e,this},this.onStop=function(e){return b=e,this},this.update=function(e){var n;if(d>e)return!0;g===!1&&(null!==v&&v.call(t),g=!0);var h=(e-d)/a;h=h>1?1:h;var b=p(h);for(n in r){var w=i[n]||0,M=r[n];M instanceof Array?t[n]=f(M,b):("string"==typeof M&&(M=w+parseFloat(M,10)),"number"==typeof M&&(t[n]=w+(M-w)*b))}if(null!==y&&y.call(t,b),1==h){if(s>0){isFinite(s)&&s--;for(n in o){if("string"==typeof r[n]&&(o[n]=o[n]+parseFloat(r[n],10)),c){var _=o[n];o[n]=r[n],r[n]=_}i[n]=o[n]}return c&&(l=!l),d=e+u,!0}null!==x&&x.call(t);for(var E=0,A=m.length;A>E;E++)m[E].start(e);return!1}return!0}},n.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){var t,i=.1,r=.4;return 0===e?0:1===e?1:(!i||1>i?(i=1,t=r/4):t=r*Math.asin(1/i)/(2*Math.PI),-(i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r)))},Out:function(e){var t,i=.1,r=.4;return 0===e?0:1===e?1:(!i||1>i?(i=1,t=r/4):t=r*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*e)*Math.sin(2*(e-t)*Math.PI/r)+1)},InOut:function(e){var t,i=.1,r=.4;return 0===e?0:1===e?1:(!i||1>i?(i=1,t=r/4):t=r*Math.asin(1/i)/(2*Math.PI),(e*=2)<1?-.5*i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r):i*Math.pow(2,-10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r)*.5+1)}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-n.Easing.Bounce.Out(1-e)},Out:function(e){return 1/2.75>e?7.5625*e*e:2/2.75>e?7.5625*(e-=1.5/2.75)*e+.75:2.5/2.75>e?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return.5>e?.5*n.Easing.Bounce.In(2*e):.5*n.Easing.Bounce.Out(2*e-1)+.5}}},n.Interpolation={Linear:function(e,t){var i=e.length-1,r=i*t,o=Math.floor(r),a=n.Interpolation.Utils.Linear;return 0>t?a(e[0],e[1],r):t>1?a(e[i],e[i-1],i-r):a(e[o],e[o+1>i?i:o+1],r-o)},Bezier:function(e,t){var i,r=0,o=e.length-1,a=Math.pow,s=n.Interpolation.Utils.Bernstein;for(i=0;o>=i;i++)r+=a(1-t,o-i)*a(t,i)*e[i]*s(o,i);return r},CatmullRom:function(e,t){var i=e.length-1,r=i*t,o=Math.floor(r),a=n.Interpolation.Utils.CatmullRom;return e[0]===e[i]?(0>t&&(o=Math.floor(r=i*(1+t))),a(e[(o-1+i)%i],e[o],e[(o+1)%i],e[(o+2)%i],r-o)):0>t?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[i]-(a(e[i],e[i],e[i-1],e[i-1],r-i)-e[i]):a(e[o?o-1:0],e[o],e[o+1>i?i:o+1],e[o+2>i?i:o+2],r-o)},Utils:{Linear:function(e,t,i){return(t-e)*i+e},Bernstein:function(e,t){var i=n.Interpolation.Utils.Factorial;return i(e)/i(t)/i(e-t)},Factorial:function(){var e=[1];return function(t){var i,r=1;if(e[t])return e[t];for(i=t;i>1;i--)r*=i;return e[t]=r}}(),CatmullRom:function(e,t,i,r,n){var o=.5*(i-e),a=.5*(r-t),s=n*n,c=n*s;return(2*t-2*i+o+a)*c+(-3*t+3*i-2*o-a)*s+o*n+t}}},function(e){"function"==typeof t&&t.amd?t([],function(){return n}):"object"==typeof r?i.exports=n:e.TWEEN=n}(this)},{}],23:[function(e){!function t(i,r,n){function o(s,c){if(!r[s]){if(!i[s]){var h="function"==typeof e&&e;if(!c&&h)return h(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[s]={exports:{}};i[s][0].call(u.exports,function(e){var t=i[s][1][e];return o(t?t:e)},u,u.exports,t,i,r,n)}return r[s].exports}for(var a="function"==typeof e&&e,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t){function i(){this.hardwareUnitId="webvr-polyfill hardwareUnitId",this.deviceId="webvr-polyfill deviceId",this.deviceName="webvr-polyfill deviceName"}function r(){}function n(){}r.prototype=new i,n.prototype=new i,t.exports.VRDevice=i,t.exports.HMDVRDevice=r,t.exports.PositionSensorVRDevice=n},{}],2:[function(e,t){function i(){this.fov={upDegrees:s,downDegrees:a,leftDegrees:o,rightDegrees:o},this.eyeTranslationLeft={x:n*-.5,y:0,z:0},this.eyeTranslationRight={x:.5*n,y:0,z:0}}var r=e("./base.js").HMDVRDevice,n=.06,o=40,a=40,s=40;i.prototype=new r,i.prototype.getEyeParameters=function(e){var t;if("left"==e)t=this.eyeTranslationLeft;else{if("right"!=e)return console.error("Invalid eye provided: %s",e),null;t=this.eyeTranslationRight}return{recommendedFieldOfView:this.fov,eyeTranslation:t}},t.exports=i},{"./base.js":1}],3:[function(e,t){function i(e){this.kFilter=e,this.currentAccelMeasurement=new r,this.currentGyroMeasurement=new r,this.previousGyroMeasurement=new r,this.filterQ=new n.Quaternion,this.previousFilterQ=new n.Quaternion,this.accelQ=new n.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new n.Vector3,this.measuredGravity=new n.Vector3,this.gyroIntegralQ=new n.Quaternion}var r=e("./sensor-sample.js"),n=e("./three-math.js"),o=e("./util.js"),a=!1;i.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},i.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var i=t-this.previousGyroMeasurement.timestampS;o.isTimestampDeltaValid(i)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},i.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var i=new n.Quaternion;i.copy(this.filterQ),i.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(i),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var r=new n.Quaternion;r.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),r.inverse(),a&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",n.Math.radToDeg(o.getQuaternionAngle(r)),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new n.Quaternion;s.copy(this.filterQ),s.multiply(r),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},i.prototype.getOrientation=function(){return this.filterQ},i.prototype.accelToQuaternion_=function(e){var t=new n.Vector3;t.copy(e),t.normalize();var i=new n.Quaternion;return i.setFromUnitVectors(new n.Vector3(0,0,-1),t),i.inverse(),i},i.prototype.gyroToQuaternionDelta_=function(e,t){var i=new n.Quaternion,r=new n.Vector3;return r.copy(e),r.normalize(),i.setFromAxisAngle(r,e.length()*t),i},t.exports=i},{"./sensor-sample.js":8,"./three-math.js":9,"./util.js":11}],4:[function(e,t){function i(){this.deviceId="webvr-polyfill:fused",this.deviceName="VR Position Device (webvr-polyfill:fused)",this.accelerometer=new s.Vector3,this.gyroscope=new s.Vector3,window.addEventListener("devicemotion",this.onDeviceMotionChange_.bind(this)),window.addEventListener("orientationchange",this.onScreenOrientationChange_.bind(this)),this.filter=new n(WebVRConfig.K_FILTER||.98),this.posePredictor=new o(WebVRConfig.PREDICTION_TIME_S||.04),this.touchPanner=new a,this.filterToWorldQ=new s.Quaternion,c.isIOS()?this.filterToWorldQ.setFromAxisAngle(new s.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new s.Vector3(1,0,0),-Math.PI/2),this.worldToScreenQ=new s.Quaternion,this.setScreenTransform_(),this.resetQ=new s.Quaternion,this.isFirefoxAndroid=c.isFirefoxAndroid(),this.isIOS=c.isIOS()}var r=e("./base.js").PositionSensorVRDevice,n=e("./complementary-filter.js"),o=e("./pose-predictor.js"),a=e("./touch-panner.js"),s=e("./three-math.js"),c=e("./util.js");i.prototype=new r,i.prototype.getState=function(){return{hasOrientation:!0,orientation:this.getOrientation(),hasPosition:!1,position:null}},i.prototype.getOrientation=function(){var e=this.filter.getOrientation();this.predictedQ=this.posePredictor.getPrediction(e,this.gyroscope,this.previousTimestampS);var t=new s.Quaternion;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),WebVRConfig.TOUCH_PANNER_DISABLED||t.multiply(this.touchPanner.getOrientation()),t.multiply(this.predictedQ),t.multiply(this.worldToScreenQ),WebVRConfig.YAW_ONLY&&(t.x=0,t.z=0,t.normalize()),t},i.prototype.resetSensor=function(){var e=new s.Euler;e.setFromQuaternion(this.filter.getOrientation());var t=e.y;console.log("resetSensor with yaw: %f",t),this.resetQ.setFromAxisAngle(new s.Vector3(0,0,1),-t),WebVRConfig.TOUCH_PANNER_DISABLED||this.touchPanner.resetSensor()},i.prototype.onDeviceMotionChange_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,r=e.timeStamp/1e3;this.isFirefoxAndroid&&(r/=1e3);var n=r-this.previousTimestampS;return n<=c.MIN_TIMESTEP||n>c.MAX_TIMESTEP?(console.warn("Invalid timestamps detected. Time step between successive gyroscope sensor samples is very small or not monotonic"),void(this.previousTimestampS=r)):(this.accelerometer.set(-t.x,-t.y,-t.z),this.gyroscope.set(i.alpha,i.beta,i.gamma),(this.isIOS||this.isFirefoxAndroid)&&this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,r),this.filter.addGyroMeasurement(this.gyroscope,r),void(this.previousTimestampS=r))},i.prototype.onScreenOrientationChange_=function(){this.setScreenTransform_()},i.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new s.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new s.Vector3(0,0,1),Math.PI/2);break;case 180:}},t.exports=i},{"./base.js":1,"./complementary-filter.js":3,"./pose-predictor.js":7,"./three-math.js":9,"./touch-panner.js":10,"./util.js":11}],5:[function(e){var t=e("./webvr-polyfill.js");window.WebVRConfig=window.WebVRConfig||{},new t},{"./webvr-polyfill.js":12}],6:[function(e,t){function i(){this.deviceId="webvr-polyfill:mouse-keyboard",this.deviceName="VR Position Device (webvr-polyfill:mouse-keyboard)",window.addEventListener("keydown",this.onKeyDown_.bind(this)),window.addEventListener("mousemove",this.onMouseMove_.bind(this)),window.addEventListener("mousedown",this.onMouseDown_.bind(this)),window.addEventListener("mouseup",this.onMouseUp_.bind(this)),this.phi=0,this.theta=0,this.targetAngle=null,this.euler=new n.Euler,this.orientation=new n.Quaternion,this.rotateStart=new n.Vector2,this.rotateEnd=new n.Vector2,this.rotateDelta=new n.Vector2}var r=e("./base.js").PositionSensorVRDevice,n=e("./three-math.js"),o=e("./util.js"),a=.15,s=80,c=.5,h=.3;i.prototype=new r,i.prototype.getState=function(){return this.euler.set(this.phi,this.theta,0,"YXZ"),this.orientation.setFromEuler(this.euler),{hasOrientation:!0,orientation:this.orientation,hasPosition:!1,position:null}},i.prototype.onKeyDown_=function(e){38==e.keyCode?this.animatePhi_(this.phi+a):39==e.keyCode?this.animateTheta_(this.theta-a):40==e.keyCode?this.animatePhi_(this.phi-a):37==e.keyCode&&this.animateTheta_(this.theta+a)},i.prototype.animateTheta_=function(e){this.animateKeyTransitions_("theta",e)},i.prototype.animatePhi_=function(e){e=o.clamp(e,-Math.PI/2,Math.PI/2),this.animateKeyTransitions_("phi",e)},i.prototype.animateKeyTransitions_=function(e,t){this.angleAnimation&&clearInterval(this.angleAnimation);var i=this[e],r=new Date;this.angleAnimation=setInterval(function(){var n=new Date-r;if(n>=s)return this[e]=t,void clearInterval(this.angleAnimation);var o=n/s;this[e]=i+(t-i)*o}.bind(this),1e3/60)},i.prototype.onMouseDown_=function(e){this.rotateStart.set(e.clientX,e.clientY),this.isDragging=!0},i.prototype.onMouseMove_=function(e){if(this.isDragging||this.isPointerLocked_()){if(this.isPointerLocked_()){var t=e.movementX||e.mozMovementX||0,i=e.movementY||e.mozMovementY||0;this.rotateEnd.set(this.rotateStart.x-t,this.rotateStart.y-i)}else this.rotateEnd.set(e.clientX,e.clientY);this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd);var r=document.body;this.phi+=2*Math.PI*this.rotateDelta.y/r.clientHeight*h,this.theta+=2*Math.PI*this.rotateDelta.x/r.clientWidth*c,this.phi=o.clamp(this.phi,-Math.PI/2,Math.PI/2)}},i.prototype.onMouseUp_=function(){this.isDragging=!1},i.prototype.isPointerLocked_=function(){var e=document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement;return void 0!==e},i.prototype.resetSensor=function(){console.error("Not implemented yet.")},t.exports=i},{"./base.js":1,"./three-math.js":9,"./util.js":11}],7:[function(e,t){function i(e){this.predictionTimeS=e,this.previousQ=new r.Quaternion,this.previousTimestampS=null,this.deltaQ=new r.Quaternion,this.outQ=new r.Quaternion}var r=e("./three-math.js"),n=!1;i.prototype.getPrediction=function(e,t,i){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=i,e;var o=new r.Vector3;o.copy(t),o.normalize();var a=t.length();if(a<r.Math.degToRad(20))return n&&console.log("Moving slowly, at %s deg/s: no prediction",r.Math.radToDeg(a).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var s=(i-this.previousTimestampS,a*this.predictionTimeS);return this.deltaQ.setFromAxisAngle(o,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.outQ},t.exports=i},{"./three-math.js":9}],8:[function(e,t){
function i(e,t){this.set(e,t)}i.prototype.set=function(e,t){this.sample=e,this.timestampS=t},i.prototype.copy=function(e){this.set(e.sample,e.timestampS)},t.exports=i},{}],9:[function(e,t){var i=window.THREE||{};i.Quaternion&&i.Vector3&&i.Vector2&&i.Euler&&i.Math||(console.log("No THREE.js found."),i.Quaternion=function(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==r?r:1},i.Quaternion.prototype={constructor:i.Quaternion,_x:0,_y:0,_z:0,_w:0,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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this.onChangeCallback(),this},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 i.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),n=Math.cos(e._y/2),o=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),c=Math.sin(e._z/2);return"XYZ"===e.order?(this._x=a*n*o+r*s*c,this._y=r*s*o-a*n*c,this._z=r*n*c+a*s*o,this._w=r*n*o-a*s*c):"YXZ"===e.order?(this._x=a*n*o+r*s*c,this._y=r*s*o-a*n*c,this._z=r*n*c-a*s*o,this._w=r*n*o+a*s*c):"ZXY"===e.order?(this._x=a*n*o-r*s*c,this._y=r*s*o+a*n*c,this._z=r*n*c+a*s*o,this._w=r*n*o-a*s*c):"ZYX"===e.order?(this._x=a*n*o-r*s*c,this._y=r*s*o+a*n*c,this._z=r*n*c-a*s*o,this._w=r*n*o+a*s*c):"YZX"===e.order?(this._x=a*n*o+r*s*c,this._y=r*s*o+a*n*c,this._z=r*n*c-a*s*o,this._w=r*n*o-a*s*c):"XZY"===e.order&&(this._x=a*n*o-r*s*c,this._y=r*s*o-a*n*c,this._z=r*n*c+a*s*o,this._w=r*n*o+a*s*c),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,r=i[0],n=i[4],o=i[8],a=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],d=r+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(l-c)*t,this._y=(o-h)*t,this._z=(a-n)*t):r>s&&r>u?(t=2*Math.sqrt(1+r-s-u),this._w=(l-c)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+h)/t):s>u?(t=2*Math.sqrt(1+s-r-u),this._w=(o-h)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+u-r-s),this._w=(a-n)/t,this._x=(o+h)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(n,o){return void 0===e&&(e=new i.Vector3),t=n.dot(o)+1,r>t?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,o),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 i=e._x,r=e._y,n=e._z,o=e._w,a=t._x,s=t._y,c=t._z,h=t._w;return this._x=i*h+o*a+r*c-n*s,this._y=r*h+o*s+n*a-i*c,this._z=n*h+o*c+i*s-r*a,this._w=o*h-i*a-r*s-n*c,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 i=this._x,r=this._y,n=this._z,o=this._w,a=o*e._w+i*e._x+r*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=i,this._y=r,this._z=n,this;var s=Math.acos(a),c=Math.sqrt(1-a*a);if(Math.abs(c)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var h=Math.sin((1-t)*s)/c,l=Math.sin(t*s)/c;return this._w=o*h+this._w*l,this._x=i*h+this._x*l,this._y=r*h+this._y*l,this._z=n*h+this._z*l,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(){},clone:function(){return new i.Quaternion(this._x,this._y,this._z,this._w)}},i.Quaternion.slerp=function(e,t,i,r){return i.copy(e).slerp(t,r)},i.Vector2=function(e,t){this.x=e||0,this.y=t||0},i.Vector2.prototype={constructor:i.Vector2,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)}},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)},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScalar:function(e){return this.x+=e,this.y+=e,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)},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 this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector2,t=new i.Vector2),e.set(r,r),t.set(n,n),this.clamp(e,t)}}(),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)},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,i=this.y-e.y;return t*t+i*i},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,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,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this},clone:function(){return new i.Vector2(this.x,this.y)}},i.Vector3=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0},i.Vector3.prototype={constructor:i.Vector3,set:function(e,t,i){return this.x=e,this.y=t,this.z=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},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)}},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},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)},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 this.x*=e,this.y*=e,this.z*=e,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 i.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r+n[12],this.y=n[1]*t+n[5]*i+n[9]*r+n[13],this.z=n[2]*t+n[6]*i+n[10]*r+n[14],this},applyProjection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements,o=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*o,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*o,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*r-a*i,h=s*i+a*t-n*r,l=s*r+n*i-o*t,u=-n*t-o*i-a*r;return this.x=c*s+u*-n+h*-a-l*-o,this.y=h*s+u*-o+l*-n-c*-a,this.z=l*s+u*-a+c*-o-h*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new i.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 i.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector3,t=new i.Vector3),e.set(r,r,r),t.set(n,n,n),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},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){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},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},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 i=this.x,r=this.y,n=this.z;return this.x=r*e.z-n*e.y,this.y=n*e.x-i*e.z,this.z=i*e.y-r*e.x,this},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new i.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 i.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new i.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(i.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r},setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){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(),i=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),r=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=i,this.z=r,this},setFromMatrixColumn:function(e,t){var i=4*e,r=t.elements;return this.x=r[i],this.y=r[i+1],this.z=r[i+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,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this},clone:function(){return new i.Vector3(this.x,this.y,this.z)}},i.Euler=function(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||i.Euler.DefaultOrder},i.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],i.Euler.DefaultOrder="XYZ",i.Euler.prototype={constructor:i.Euler,_x:0,_y:0,_z:0,_order:i.Euler.DefaultOrder,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,i,r){return this._x=e,this._y=t,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},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 n=i.Math.clamp,o=e.elements,a=o[0],s=o[4],c=o[8],h=o[1],l=o[5],u=o[9],d=o[2],p=o[6],f=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-d,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===t?(this._y=Math.asin(-n(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(n(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(c,f))):"XZY"===t?(this._z=Math.asin(-n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(c,a)):(this._x=Math.atan2(-u,f),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,n){return void 0===e&&(e=new i.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,n),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new i.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(){return[this._x,this._y,this._z,this._order]},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new i.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new i.Euler(this._x,this._y,this._z,this._order)}},i.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),r=0;return function(){for(var n=0;36>n;n++)8==n||13==n||18==n||23==n?i[n]="-":14==n?i[n]="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,i[n]=t[19==n?3&e|8:e]);return i.join("")}}(),clamp:function(e,t,i){return t>e?t:e>i?i:e},clampBottom:function(e,t){return t>e?t:e},mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},smoothstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*(3-2*e))},smootherstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return Math.floor(this.randFloat(e,t))},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},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}}),t.exports=i},{}],10:[function(e,t){function i(){window.addEventListener("touchstart",this.onTouchStart_.bind(this)),window.addEventListener("touchmove",this.onTouchMove_.bind(this)),window.addEventListener("touchend",this.onTouchEnd_.bind(this)),this.isTouching=!1,this.rotateStart=new r.Vector2,this.rotateEnd=new r.Vector2,this.rotateDelta=new r.Vector2,this.theta=0,this.orientation=new r.Quaternion}var r=e("./three-math.js"),n=e("./util.js"),o=.5;i.prototype.getOrientation=function(){return this.orientation.setFromEuler(new r.Euler(0,0,this.theta)),this.orientation},i.prototype.resetSensor=function(){this.theta=0},i.prototype.onTouchStart_=function(e){1==e.touches.length&&(this.rotateStart.set(e.touches[0].pageX,e.touches[0].pageY),this.isTouching=!0)},i.prototype.onTouchMove_=function(e){if(this.isTouching){this.rotateEnd.set(e.touches[0].pageX,e.touches[0].pageY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd),n.isIOS()&&(this.rotateDelta.x*=-1);var t=document.body;this.theta+=2*Math.PI*this.rotateDelta.x/t.clientWidth*o}},i.prototype.onTouchEnd_=function(){this.isTouching=!1},t.exports=i},{"./three-math.js":9,"./util.js":11}],11:[function(e,t){var i=window.Util||{};i.MIN_TIMESTEP=.001,i.MAX_TIMESTEP=1,i.clamp=function(e,t,i){return Math.min(Math.max(t,e),i)},i.isIOS=function(){return/iPad|iPhone|iPod/.test(navigator.platform)},i.isFirefoxAndroid=function(){return-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android")},i.isTimestampDeltaValid=function(e){return isNaN(e)?!1:e<=i.MIN_TIMESTEP?!1:e>i.MAX_TIMESTEP?!1:!0},t.exports=i},{}],12:[function(e,t){function i(){this.devices=[],this.isWebVRAvailable()||this.enablePolyfill()}var r=e("./cardboard-hmd-vr-device.js"),n=e("./fusion-position-sensor-vr-device.js"),o=e("./mouse-keyboard-position-sensor-vr-device.js"),a=e("./base.js").HMDVRDevice,s=e("./base.js").PositionSensorVRDevice;i.prototype.isWebVRAvailable=function(){return"getVRDevices"in navigator||"mozGetVRDevices"in navigator},i.prototype.enablePolyfill=function(){this.isCardboardCompatible()&&this.devices.push(new r),this.isMobile()?this.devices.push(new n):WebVRConfig.MOUSE_KEYBOARD_CONTROLS_DISABLED||this.devices.push(new o),navigator.getVRDevices=this.getVRDevices.bind(this),window.HMDVRDevice=a,window.PositionSensorVRDevice=s},i.prototype.getVRDevices=function(){var e=this.devices;return new Promise(function(t,i){try{t(e)}catch(r){i(r)}})},i.prototype.isMobile=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},i.prototype.isCardboardCompatible=function(){return this.isMobile()||WebVRConfig.FORCE_ENABLE_VR},t.exports=i},{"./base.js":1,"./cardboard-hmd-vr-device.js":2,"./fusion-position-sensor-vr-device.js":4,"./mouse-keyboard-position-sensor-vr-device.js":6}]},{},[5])},{}],24:[function(e,t){t.exports={name:"aframe",version:"0.2.0",description:"Building blocks for the VR Web",main:"dist/aframe.js",scripts:{browserify:"browserify src/index.js -s 'AFRAME' -p browserify-derequire",build:"mkdirp build/ && npm run browserify -- --debug -o build/aframe.js",dev:"npm run build && node ./scripts/budo",dist:"mkdirp dist/ && npm run browserify -s -- --debug | exorcist dist/aframe.js.map > dist/aframe.js && uglifyjs dist/aframe.js -c warnings=false -m -o dist/aframe.min.js","gh-pages":"npm run ghpages",ghpages:"node ./scripts/gh-pages",lint:"semistandard -v | snazzy",precommit:"npm run lint",preghpages:"npm run dist && rimraf gh-pages && mkdirp gh-pages && cp -r {.nojekyll,dist,lib,examples,index.html,style} gh-pages/. 2>/dev/null || : && git checkout dist/ && replace 'build/aframe.js' 'dist/aframe.min.js' gh-pages/ -r --silent","release:bump":"npm run dist && git commit -am 'bump dist' && npm version patch --preminor","release:push":"npm login && npm publish && git push --follow-tags",start:"npm run dev",test:"karma start ./tests/karma.conf.js","test:ci":"TEST_ENV=ci karma start ./tests/karma.conf.js --single-run",version:"npm run dist"},repository:"aframevr/aframe",license:"MIT",dependencies:{"browserify-css":"^0.8.2",debug:"^2.2.0","deep-assign":"^2.0.0","document-register-element":"dmarcos/document-register-element#8ccc532b7","promise-polyfill":"^3.1.0","object-assign":"^4.0.1",polymerize:"^1.0.0",present:"0.0.6","request-interval":"^1.0.0","style-attr":"^1.0.2",three:"^0.75.0","tween.js":"^15.0.0","webvr-polyfill":"borismus/webvr-polyfill#3f47796"},devDependencies:{browserify:"^11.0.1","browserify-derequire":"^0.9.4",budo:"^8.1.0",chai:"^3.5.0","chai-shallow-deep-equal":"^1.3.0",exorcist:"^0.4.0","gh-pages":"^0.6.0",husky:"^0.10.1",karma:"^0.13.15","karma-browserify":"^4.4.0","karma-chai-shallow-deep-equal":"0.0.4","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-mocha-reporter":"^1.1.0","karma-sinon-chai":"^1.1.0",lolex:"^1.4.0",mkdirp:"0.5.1",mocha:"^2.3.3","mozilla-download":"^1.0.5",open:"0.0.5",replace:"^0.3.0",rimraf:"2.5.0",semistandard:"^7.0.2",sinon:"^1.17.3","sinon-chai":"^2.8.0",snazzy:"^3.0.0",uglifyjs:"^2.4.10"},link:!0,browserify:{transform:["browserify-css",["polymerize",{match:".*.html$"}]]},semistandard:{ignore:["build/**","dist/**","examples/_js/**","examples/**/shaders/*.js","vendor/**"]},keywords:["aframe","vr","webvr","3d","three","components","elements"],"browserify-css":{minify:!0},engines:{node:">= 0.12.7",npm:"^2.12.1"}}},{}],25:[function(e,t){var i=e("../core/component").registerComponent,r=e("../lib/three");t.exports.Component=i("camera",{schema:{active:{"default":!0},far:{"default":1e4},fov:{"default":80,min:0},near:{"default":.5,min:0}},init:function(){var e=this.camera=new r.PerspectiveCamera;this.el.setObject3D("camera",e)},remove:function(){this.el.removeObject3D("camera")},update:function(e){var t=this.el,i=this.data,r=this.camera,n=this.system;r.aspect=i.aspect||window.innerWidth/window.innerHeight,r.far=i.far,r.fov=i.fov,r.near=i.near,r.updateProjectionMatrix(),e&&e.active===i.active||(i.active&&n.activeCameraEl!==this.el?n.setActiveCamera(t,r):i.active||n.activeCameraEl!==this.el||n.disableActiveCamera())}})},{"../core/component":56,"../lib/three":90}],26:[function(e,t){var i=e("../core/component").registerComponent,r=e("../lib/three"),n=new r.ColladaLoader;n.options.convertUpAxis=!0,t.exports.Component=i("collada-model",{schema:{type:"src"},init:function(){this.model=null},update:function(){var e=this,t=this.el,i=this.data;i&&(this.remove(),n.load(i,function(i){e.model=i.scene,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"collada",model:e.model})}))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{"../core/component":56,"../lib/three":90}],27:[function(e,t){var i=e("../core/component").registerComponent,r=e("../utils/");t.exports.Component=i("cursor",{schema:{timeout:{"default":1500,min:0},maxDistance:{"default":5,min:0},fuse:{"default":!1}},dependencies:["raycaster"],init:function(){this.raycaster=this.el.components.raycaster,this.schema.fuse["default"]=r.isMobile(),this.attachEventListeners()},attachEventListeners:function(){var e=this.el,t=e.sceneEl.canvas;return t?(t.addEventListener("mousedown",this.onMouseDown.bind(this)),t.addEventListener("mouseup",this.onMouseUp.bind(this)),e.addEventListener("intersection",this.onIntersection.bind(this)),void e.addEventListener("intersectioncleared",this.onIntersectionCleared.bind(this))):void e.sceneEl.addEventListener("render-target-loaded",this.attachEventListeners.bind(this))},onMouseDown:function(){this.emit("mousedown"),this.mouseDownEl=this.intersectedEl},onMouseUp:function(){this.emit("mouseup"),this.data.fuse||this.intersectedEl&&this.mouseDownEl===this.intersectedEl&&this.emit("click")},emit:function(e){var t=this.intersectedEl;this.el.emit(e,{target:this.intersectedEl}),t&&t.emit(e)},emitter:function(e){return function(){this.emit(e)}.bind(this)},onIntersection:function(e){function t(){i.el.removeState("fusing"),i.emit("click")}var i=this,r=this.data,n=e.detail.el,o=e.detail.distance;this.intersectedEl!==n&&(o>=this.data.maxDistance||(this.intersectedEl=n,n.addState("hovered"),n.emit("mouseenter"),this.el.addState("hovering"),0!==r.timeout&&r.fuse&&(this.el.addState("fusing"),this.fuseTimeout=setTimeout(t,r.timeout))))},onIntersectionCleared:function(e){var t=e.detail.el;t&&this.intersectedEl&&(t.removeState("hovered"),t.emit("mouseleave"),this.el.removeState("hovering"),this.el.removeState("fusing"),this.intersectedEl=null,clearTimeout(this.fuseTimeout))}})},{"../core/component":56,"../utils/":102}],28:[function(e,t){function i(e){switch("cube"===e.primitive&&u('geometry.primitive="cube" should be "box"'),e.primitive){case"box":return new a.BoxGeometry(e.width,e.height,e.depth);case"circle":return new a.CircleGeometry(e.radius,e.segments,l(e.thetaStart),l(e.thetaLength));case"cone":return new a.CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,l(e.thetaStart),l(e.thetaLength));case"cylinder":return new a.CylinderGeometry(e.radius,e.radius,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,l(e.thetaStart),l(e.thetaLength));case"plane":return new a.PlaneBufferGeometry(e.width,e.height);case"ring":return new a.RingGeometry(e.radiusInner,e.radiusOuter,e.segmentsTheta,e.segmentsPhi,l(e.thetaStart),l(e.thetaLength));case"sphere":return 360===e.thetaLength&&(e.thetaLength=180),new a.SphereBufferGeometry(e.radius,e.segmentsWidth,e.segmentsHeight,l(e.phiStart),l(e.phiLength),l(e.thetaStart),l(e.thetaLength));case"torus":return new a.TorusGeometry(e.radius,2*e.radiusTubular,e.segmentsRadial,e.segmentsTubular,l(e.arc));case"torusKnot":return new a.TorusKnotGeometry(e.radius,2*e.radiusTubular,e.segmentsTubular,e.segmentsRadial,e.p,e.q);default:return u("Primitive type not supported: "+e.primitive),new a.Geometry}}function r(e,t,i){var r=h.makeTranslation(t.x-i.x,t.y-i.y,t.z-i.z);e.applyMatrix(r),e.verticesNeedsUpdate=!0}var n=e("../utils/debug"),o=e("../core/component").registerComponent,a=e("../lib/three"),s=e("../utils"),c=1,h=new a.Matrix4,l=a.Math.degToRad,u=n("components:geometry:warn");t.exports.Component=o("geometry",{schema:{arc:{"default":360,"if":{primitive:["torus"]}},depth:{"default":1,min:0,"if":{primitive:["box"]}},height:{"default":1,min:0,"if":{primitive:["box","plane","cone"]}},openEnded:{"default":!1,"if":{primitive:["cylinder","cone"]}},p:{"default":2,"if":{primitive:["torusKnot"]},type:"int"},primitive:{"default":"",oneOf:["","box","circle","cone","cylinder","plane","ring","sphere","torus","torusKnot"]},q:{"default":3,"if":{primitive:["torusKnot"]},type:"int"},phiLength:{"default":360,"if":{primitive:["sphere"]}},phiStart:{"default":0,min:0,"if":{primitive:["sphere"]}},radius:{"default":c,min:0,"if":{primitive:["circle","cylinder","sphere","torus","torusKnot"]}},radiusBottom:{"default":c,min:0,"if":{primitive:["cylinder","cone"]}},radiusInner:{"default":.8,min:0,"if":{primitive:["ring"]}},radiusOuter:{"default":1.2,min:0,"if":{primitive:["ring"]}},radiusTop:{"default":c,"if":{primitive:["cylinder","cone"]}},radiusTubular:{"default":.2,min:0,"if":{primitive:["torus","torusKnot"]}},segments:{"default":32,min:0,"if":{primitive:["circle"]},type:"int"},segmentsHeight:{"default":18,
min:0,"if":{primitive:["cylinder","sphere","cone"]},type:"int"},segmentsPhi:{"default":8,min:0,"if":{primitive:["ring"]},type:"int"},segmentsRadial:{"default":36,min:0,"if":{primitive:["cylinder","torusKnot","cone"]},type:"int"},segmentsTheta:{"default":32,min:0,"if":{primitive:["ring"]},type:"int"},segmentsTubular:{"default":32,min:0,"if":{primitive:["torus","torusKnot"]},type:"int"},segmentsWidth:{"default":36,min:0,"if":{primitive:["sphere"]},type:"int"},thetaLength:{"default":360,min:0,"if":{primitive:["circle","cylinder","ring","sphere","cone"]}},thetaStart:{"default":0,"if":{primitive:["circle","cylinder","ring","sphere","cone"]}},translate:{type:"vec3"},width:{"default":1,min:0,"if":{primitive:["box","plane"]}}},update:function(e){e=e||{};var t=this.data,n=e.translate||this.schema.translate["default"],o=s.diff(e,t),c=this.el.getOrCreateObject3D("mesh",a.Mesh),h=c.geometry,l=!(1===Object.keys(o).length&&"translate"in o),u=!s.deepEqual(t.translate,n);l&&(c.geometry.dispose(),h=c.geometry=i(this.data,this.schema)),u&&r(h,t.translate,n)},remove:function(){this.el.getObject3D("mesh").geometry.dispose(),this.el.getObject3D("mesh").geometry=new a.Geometry}})},{"../core/component":56,"../lib/three":90,"../utils":102,"../utils/debug":101}],29:[function(e){e("./camera"),e("./collada-model"),e("./cursor"),e("./geometry"),e("./light"),e("./look-at"),e("./look-controls"),e("./material"),e("./obj-model"),e("./position"),e("./raycaster"),e("./rotation"),e("./scale"),e("./sound"),e("./visible"),e("./wasd-controls"),e("./scene/canvas"),e("./scene/fog"),e("./scene/keyboard-shortcuts"),e("./scene/stats"),e("./scene/vr-mode-ui"),e("./loader")},{"./camera":25,"./collada-model":26,"./cursor":27,"./geometry":28,"./light":30,"./loader":31,"./look-at":32,"./look-controls":33,"./material":34,"./obj-model":35,"./position":36,"./raycaster":37,"./rotation":38,"./scale":39,"./scene/canvas":40,"./scene/fog":41,"./scene/keyboard-shortcuts":42,"./scene/stats":43,"./scene/vr-mode-ui":44,"./sound":45,"./visible":46,"./wasd-controls":47}],30:[function(e,t){function i(e){var t=e.angle,i=new a.Color(e.color).getHex(),r=e.decay,n=e.distance,o=new a.Color(e.groundColor).getHex(),h=e.intensity,l=e.type;switch(l.toLowerCase()){case"ambient":return new a.AmbientLight(i,h);case"directional":return new a.DirectionalLight(i,h);case"hemisphere":return new a.HemisphereLight(i,o,h);case"point":return new a.PointLight(i,h,n,r);case"spot":return new a.SpotLight(i,h,n,s(t),e.exponent,r);default:c("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",l)}}var r=e("../utils").diff,n=e("../utils/debug"),o=e("../core/component").registerComponent,a=e("../lib/three"),s=a.Math.degToRad,c=n("components:light:warn");t.exports.Component=o("light",{schema:{angle:{"default":60,"if":{type:["spot"]}},color:{type:"color"},groundColor:{type:"color","if":{type:["hemisphere"]}},decay:{"default":1,"if":{type:["point","spot"]}},distance:{"default":0,min:0,"if":{type:["point","spot"]}},exponent:{"default":10,"if":{type:["spot"]}},intensity:{"default":1,min:0,"if":{type:["ambient","directional","hemisphere","point","spot"]}},type:{"default":"directional",oneOf:["ambient","directional","hemisphere","point","spot"]}},init:function(){var e=this.el;this.light=null,this.system.registerLight(e)},update:function(e){var t=this.data,i=r(t,e||{}),n=this.light;return!n||"type"in i?void this.setLight(this.data):void Object.keys(i).forEach(function(e){var i=t[e];-1!==["color","groundColor"].indexOf(e)&&(i=new a.Color(i)),n[e]=i})},setLight:function(e){var t=this.el,r=i(e);r&&(this.light&&t.removeObject3D("light"),this.light=r,this.light.el=t,t.setObject3D("light",this.light))},remove:function(){this.el.removeObject3D("light")}})},{"../core/component":56,"../lib/three":90,"../utils":102,"../utils/debug":101}],31:[function(e,t){var i=e("../utils/debug"),r=e("../core/component").registerComponent,n=e("../utils/src-loader").parseUrl,o=e("../lib/three"),a=i("components:loader:warn");t.exports.Component=r("loader",{dependencies:["material"],schema:{src:{"default":""},format:{"default":"obj",oneOf:["obj","collada"]}},init:function(){a("loader component is deprecated. Use collada-model or obj-model component instead.")},update:function(){var e=this.el,t=this.data,i=this.model,r=n(t.src),o=t.format;if(i&&e.removeObject3D("mesh"),!r)return void a("Model URL not provided");switch(o){case"obj":this.loadObj(r);break;case"collada":this.loadCollada(r);break;default:a("Model format not supported")}},loadObj:function(e){var t=this.el,i=new o.OBJLoader;i.load(e,function(e){this.model=e,this.applyMaterial(),t.setObject3D("mesh",e)})},applyMaterial:function(){var e=this.el.components.material.material;this.model&&this.model.traverse(function(t){t instanceof o.Mesh&&(t.material=e)})},loadCollada:function(e){var t=this,i=this.el,r=new o.ColladaLoader;r.options.convertUpAxis=!0,r.load(e,function(e){t.model=e.scene,i.setObject3D("mesh",e.scene)})}})},{"../core/component":56,"../lib/three":90,"../utils/debug":101,"../utils/src-loader":104}],32:[function(e,t){var i=e("../utils/debug"),r=e("../utils/coordinates"),n=e("../core/component").registerComponent,o=e("../lib/three"),a=i("components:look-at:warn"),s=r.isCoordinate;t.exports.Component=n("look-at",{schema:{"default":"",parse:function(e){return s(e)||"object"==typeof e?r.parse(e):e},stringify:function(e){return"object"==typeof e?r.stringify(e):e}},init:function(){this.target3D=null,this.vector=new o.Vector3},update:function(){var e,t=this,i=t.data,r=t.el.object3D;return!i||"object"==typeof i&&!Object.keys(i).length?t.remove():"object"==typeof i?r.lookAt(new o.Vector3(i.x,i.y,i.z)):(e=t.el.sceneEl.querySelector(i),e?e.hasLoaded?t.beginTracking(e):e.addEventListener("loaded",function(){t.beginTracking(e)}):void a('"'+i+'" does not point to a valid entity to look-at'))},tick:function(){var e=this.target3D;return e?this.el.object3D.lookAt(this.vector.setFromMatrixPosition(e.matrixWorld)):void 0},beginTracking:function(e){this.target3D=e.object3D}})},{"../core/component":56,"../lib/three":90,"../utils/coordinates":100,"../utils/debug":101}],33:[function(e,t){var i=e("../core/component").registerComponent,r=e("../lib/three"),n=Math.PI/2;t.exports.Component=i("look-controls",{dependencies:["position","rotation"],schema:{enabled:{"default":!0}},init:function(){this.previousPosition=new r.Vector3,this.deltaPosition=new r.Vector3,this.setupMouseControls(),this.setupHMDControls(),this.bindMethods()},update:function(){this.data.enabled&&(this.controls.update(),this.updateOrientation(),this.updatePosition())},play:function(){this.previousPosition.set(0,0,0),this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(){this.update()},remove:function(){this.pause()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.releaseMouse=this.releaseMouse.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new r.Object3D,this.yawObject=new r.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},setupHMDControls:function(){this.dolly=new r.Object3D,this.euler=new r.Euler,this.controls=new r.VRControls(this.dolly),this.zeroQuaternion=new r.Quaternion},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;return t?(t.addEventListener("mousedown",this.onMouseDown,!1),t.addEventListener("mousemove",this.onMouseMove,!1),t.addEventListener("mouseup",this.releaseMouse,!1),t.addEventListener("mouseout",this.releaseMouse,!1),t.addEventListener("touchstart",this.onTouchStart),t.addEventListener("touchmove",this.onTouchMove),void t.addEventListener("touchend",this.onTouchEnd)):void e.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var e=document.querySelector("a-scene"),t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("mouseup",this.releaseMouse),t.removeEventListener("mouseout",this.releaseMouse),t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchmove",this.onTouchMove),t.removeEventListener("touchend",this.onTouchEnd))},updateOrientation:function(){var e=new r.Euler;return e.order="YXZ",function(){var t=this.pitchObject,i=this.yawObject,n=this.calculateHMDQuaternion();e.setFromQuaternion(n),this.el.setAttribute("rotation",{x:r.Math.radToDeg(e.x)+r.Math.radToDeg(t.rotation.x),y:r.Math.radToDeg(e.y)+r.Math.radToDeg(i.rotation.y),z:r.Math.radToDeg(e.z)})}}(),calculateHMDQuaternion:function(){var e=new r.Quaternion;return function(){var t=this.dolly;return this.zeroed||t.quaternion.equals(this.zeroQuaternion)||(this.zeroOrientation(),this.zeroed=!0),e.copy(this.zeroQuaternion).multiply(t.quaternion),e}}(),updatePosition:function(){var e=this.el,t=this.calculateDeltaPosition(),i=e.getComputedAttribute("position");e.setAttribute("position",{x:i.x+t.x,y:i.y+t.y,z:i.z+t.z})},calculateDeltaPosition:function(){var e=this.dolly,t=this.deltaPosition,i=this.previousPosition;return t.copy(e.position),t.sub(i),i.copy(e.position),t},updateHMDQuaternion:function(){var e=new r.Quaternion;return function(){var t=this.dolly;return this.controls.update(),this.zeroed||t.quaternion.equals(this.zeroQuaternion)||(this.zeroOrientation(),this.zeroed=!0),e.copy(this.zeroQuaternion).multiply(t.quaternion),e}}(),zeroOrientation:function(){var e=new r.Euler;e.setFromQuaternion(this.dolly.quaternion.clone().inverse()),e.z=0,e.x=0,this.zeroQuaternion.setFromEuler(e)},onMouseMove:function(e){var t=this.pitchObject,i=this.yawObject,r=this.previousMouseEvent;if(this.mouseDown&&this.data.enabled){var o=e.movementX||e.mozMovementX,a=e.movementY||e.mozMovementY;(void 0===o||void 0===a)&&(o=e.screenX-r.screenX,a=e.screenY-r.screenY),this.previousMouseEvent=e,i.rotation.y-=.002*o,t.rotation.x-=.002*a,t.rotation.x=Math.max(-n,Math.min(n,t.rotation.x))}},onMouseDown:function(e){this.mouseDown=!0,this.previousMouseEvent=e},releaseMouse:function(){this.mouseDown=!1},onTouchStart:function(e){1===e.touches.length&&(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,i=this.yawObject;this.touchStarted&&(t=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/this.el.sceneEl.canvas.clientWidth,i.rotation.y-=.5*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1}})},{"../core/component":56,"../lib/three":90}],34:[function(e,t){function i(e){switch(e){case"back":return s.BackSide;case"double":return s.DoubleSide;default:return s.FrontSide}}function r(e,t){e.dispose(),t.unregisterMaterial(e)}var n=e("../utils/debug"),o=e("../utils"),a=e("../core/component"),s=e("../lib/three"),c=e("../core/shader"),h=n("components:material:error"),l=o.diff,u=a.registerComponent,d=c.shaders,p=c.shaderNames;t.exports.Component=u("material",{schema:{shader:{"default":"standard",oneOf:p},transparent:{"default":!1},opacity:{"default":1,min:0,max:1},side:{"default":"front",oneOf:["front","back","double"]},depthTest:{"default":!0}},init:function(){this.material=null},update:function(e){var t=this.data,i=e?l(e,t):t;(!this.shader||i.shader)&&this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial()},updateSchema:function(e){var t=e.shader,i=this.data&&this.data.shader,r=t||i,n=d[r]&&d[r].schema;n||h("Unknown shader schema "+r),i&&t===i||(this.extendSchema(n),this.updateBehavior())},updateBehavior:function(){var e=this.el.sceneEl,t=this.schema,i=this,r={},n=function(e){function t(t){r[t]=e}var n=Object.keys(r);n.forEach(t),i.shader.update(r)},o=Object.keys(t);o.forEach(function(o){"time"===t[o].type&&(i.tick=n,r[o]=!0,e.addBehavior(i))}),0===Object.keys(r).length&&e.removeBehavior(this)},updateShader:function(e){var t,i=this.data,r=d[e]&&d[e].Shader;if(!r)throw new Error("Unknown shader "+e);this.shader=new r,this.shader.el=this.el,t=this.shader.init(i),this.setMaterial(t),this.updateSchema(i)},updateMaterial:function(){var e=this.data,t=this.material;t.side=i(e.side),t.opacity=e.opacity,t.transparent=e.transparent!==!1||e.opacity<1,t.depthTest=e.depthTest!==!1},remove:function(){var e=new s.MeshBasicMaterial,t=this.material,i=this.el.getObject3D("mesh");i&&(i.material=e),r(t,this.system)},setMaterial:function(e){var t=this.el.getOrCreateObject3D("mesh",s.Mesh),i=this.system;this.material&&r(this.material,i),this.material=t.material=e,i.registerMaterial(e)}})},{"../core/component":56,"../core/shader":63,"../lib/three":90,"../utils":102,"../utils/debug":101}],35:[function(e,t){var i=e("../utils/debug"),r=e("../core/component").registerComponent,n=e("../lib/three"),o=i("components:obj-model:warn");t.exports.Component=r("obj-model",{dependencies:["material"],schema:{mtl:{type:"src"},obj:{type:"src"}},init:function(){this.model=null,this.objLoader=new n.OBJLoader,this.mtlLoader=new n.MTLLoader(this.objLoader.manager)},update:function(){var e=this.data;e.obj&&(this.remove(),this.loadObj(e.obj,e.mtl))},remove:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(e,t){var i=this,r=this.el,a=this.mtlLoader,s=this.objLoader;return t?(HTMLElement.prototype.getAttribute.call(r,"material")&&o("Material component properties are ignored when a .MTL is provided"),a.setBaseUrl(t.substr(0,t.lastIndexOf("/")+1)),void a.load(t,function(t){t.preload(),s.setMaterials(t),s.load(e,function(e){i.model=e,r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})})})):void s.load(e,function(e){var t=r.components.material.material;e.traverse(function(e){e instanceof n.Mesh&&(e.material=t)}),i.model=e,r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})})}})},{"../core/component":56,"../lib/three":90,"../utils/debug":101}],36:[function(e,t){var i=e("../core/component").registerComponent;t.exports.Component=i("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)}})},{"../core/component":56}],37:[function(e,t){var i=e("../core/component").registerComponent,r=e("request-interval"),n=e("../lib/three");t.exports.Component=i("raycaster",{init:function(){this.raycaster=new n.Raycaster,this.intersectedEl=null},play:function(){this.pollForHoverIntersections()},pause:function(){var e=this.pollInterval;e&&r.clear(this.pollInterval)},remove:function(){this.pause()},pollForHoverIntersections:function(){this.pollInterval=r(100,this.getIntersections.bind(this))},getIntersections:function(){var e=this.getClosestIntersected();return e?void this.handleIntersection(e):void(this.intersectedEl&&this.clearExistingIntersection())},intersect:function(e){var t=this.el,i=this.raycaster,r=t.object3D,o=t.parentNode.object3D,a=(new n.Vector3).setFromMatrixPosition(o.matrixWorld),s=(new n.Vector3).setFromMatrixPosition(r.matrixWorld),c=s.sub(a).normalize();return i.set(a,c),i.intersectObjects(e,!0)},getClosestIntersected:function(){for(var e,t=this.el.sceneEl.object3D,i=this.el,r=this.intersect(t.children),n=0;n<r.length;++n){for(e=r[n];e.object.parent&&void 0===e.object.el;)e.object=e.object.parent;if(void 0!==e.object.el&&e.object.el!==i&&e.object.visible)return e}return null},setExistingIntersection:function(e,t){this.intersectedEl=e,this.el.emit("intersection",{el:e,distance:t})},clearExistingIntersection:function(){var e=this.intersectedEl;this.el.emit("intersectioncleared",{el:e}),this.intersectedEl=null},handleIntersection:function(e){var t=e.object.el;this.intersectedEl!==t&&this.clearExistingIntersection(),this.setExistingIntersection(t,e.distance)}})},{"../core/component":56,"../lib/three":90,"request-interval":12}],38:[function(e,t){var i=e("../lib/three").Math.degToRad,r=e("../core/component").registerComponent;t.exports.Component=r("rotation",{schema:{type:"vec3"},update:function(){var e=this.data,t=this.el.object3D;t.rotation.set(i(e.x),i(e.y),i(e.z)),t.rotation.order="YXZ"}})},{"../core/component":56,"../lib/three":90}],39:[function(e,t){var i=e("../core/component").registerComponent,r=1e-5;t.exports.Component=i("scale",{schema:{type:"vec3","default":{x:1,y:1,z:1}},update:function(){var e=this.data,t=this.el.object3D,i=0===e.x?r:e.x,n=0===e.y?r:e.y,o=0===e.z?r:e.z;t.scale.set(i,n,o)}})},{"../core/component":56}],40:[function(e,t){var i=e("../../core/component").registerComponent;t.exports.Component=i("canvas",{schema:{canvas:{type:"selector","default":void 0},height:{"default":100},width:{"default":100}},update:function(){var e=this.data,t=e.canvas,i=this.el;i.canvas||(t||(t=document.createElement("canvas"),t.classList.add("a-canvas"),t.style.height=e.height+"%",t.style.width=e.width+"%",t.dataset.aframeProvided=!0,i.appendChild(t)),t.addEventListener("touchmove",function(e){e.preventDefault()}),i.canvas=t,i.emit("render-target-loaded",{target:t}))}})},{"../../core/component":56}],41:[function(e,t){function i(e){var t;return t="exponential"===e.type?new n.FogExp2(e.color,e.density):new n.Fog(e.color,e.near,e.far),t.name=e.type,t}var r=e("../../core/component").registerComponent,n=e("../../lib/three"),o=e("../../utils/debug"),a=o("components:fog:warn");t.exports.Component=r("fog",{schema:{color:{"default":"#000"},density:{"default":25e-5},far:{"default":1e3,min:0},near:{"default":1,min:0},type:{"default":"linear",oneOf:["linear","exponential"]}},update:function(){var e=this.data,t=this.el,r=this.el.object3D.fog;return t.isScene?r&&e.type===r.name?void Object.keys(this.schema).forEach(function(t){var i=e[t];"color"===t&&(i=new n.Color(i)),r[t]=i}):(t.object3D.fog=i(e),void t.systems.material.updateMaterials()):void a("Fog component can only be applied to <a-scene>")},remove:function(){var e=this.el.object3D.fog;e&&(e.density=0,e.far=0,e.near=0)}})},{"../../core/component":56,"../../lib/three":90,"../../utils/debug":101}],42:[function(e,t){var i=e("../../core/component").registerComponent,r=e("../../utils/").shouldCaptureKeyEvent,n=e("../../lib/three"),o=new n.VRControls(new n.Object3D);t.exports.Component=i("keyboard-shortcuts",{schema:{enterVR:{"default":!0},resetSensor:{"default":!0}},init:function(){var e=this,t=this.el;this.listener=window.addEventListener("keyup",function(i){r(i)&&(e.enterVREnabled&&70===i.keyCode&&t.enterVR(),e.resetSensorEnabled&&90===i.keyCode&&o.resetSensor())},!1)},update:function(){var e=this.data;this.enterVREnabled=e.enterVR,this.resetSensorEnabled=e.resetSensor},remove:function(){window.removeEventListener("keyup",this.listener)}})},{"../../core/component":56,"../../lib/three":90,"../../utils/":102}],43:[function(e,t){function i(e){var t=new a(e.renderer),i=new s(e),r=e.isMobile?[]:[t,i];return new n({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:r})}var r=e("../../core/component").registerComponent,n=e("../../../vendor/rStats");e("../../../vendor/rStats.extras"),e("../../lib/rStatsAframe");var o="a-hidden",a=window.threeStats,s=window.aframeStats;t.exports.Component=r("stats",{init:function(){var e=this.el;this.stats=i(e),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),e.addEventListener("enter-vr",this.hideBound),e.addEventListener("exit-vr",this.showBound)},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var e=this.stats;e("rAF").tick(),e("FPS").frame(),e().update()},hide:function(){this.statsEl.classList.add(o)},show:function(){this.statsEl.classList.remove(o)}})},{"../../../vendor/rStats":107,"../../../vendor/rStats.extras":106,"../../core/component":56,"../../lib/rStatsAframe":89}],44:[function(e,t){function i(e,t){function i(){return c.update(),a=s.quaternion,0!==a._x||0!==a._y||0!==a._z?!0:void 0}var r,n,o,a,f,m,v=t||window.hasNonPolyfillWebVRSupport;return m=document.createElement("div"),m.classList.add(h),r=document.createElement("div"),r.className=p,o=document.createElement("p"),n=document.createElement("a"),n.setAttribute("href","http://mozvr.com/#start"),n.setAttribute("target","_blank"),n.innerHTML="Learn more.",f=document.createElement("button"),f.className=d,m.appendChild(f),r&&(r.appendChild(o),r.appendChild(n),m.appendChild(r)),i()||t||(o.innerHTML="Your browser supports WebVR. To enter VR, connect a headset, or use a mobile phone.",m.setAttribute(l,"")),v?f.addEventListener("click",e):(o.innerHTML="Your browser does not support WebVR. To enter VR, use a VR-compatible browser or a mobile phone.",m.setAttribute(u,"")),m}function r(e){var t=document.createElement("div");t.className=m,t.classList.add(f);var i=document.createElement("button");return i.innerHTML="Exit VR",i.addEventListener("click",e),t.appendChild(i),t}var n=e("../../core/component").registerComponent,o=e("../../lib/three"),a=e("../../utils/"),s=new o.Object3D,c=new o.VRControls(s),h="a-enter-vr",l="data-a-enter-vr-no-headset",u="data-a-enter-vr-no-webvr",d="a-enter-vr-button",p="a-enter-vr-modal",f="a-hidden",m="a-orientation-modal";t.exports.Component=n("vr-mode-ui",{dependencies:["canvas"],schema:{enabled:{"default":!0}},init:function(){var e=this,t=this.el;this.enterVR=t.enterVR.bind(t),this.exitVR=t.exitVR.bind(t),this.insideLoader=!1,this.enterVREl=null,this.orientationModalEl=null,t.addEventListener("enter-vr",this.updateEnterVRInterface.bind(this)),t.addEventListener("exit-vr",this.updateEnterVRInterface.bind(this)),window.addEventListener("message",function(t){"loaderReady"===t.data.type&&(e.insideLoader=!0,e.remove())}),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded.bind(this))},update:function(){var e=this.el;return!this.data.enabled||this.insideLoader?this.remove():void(this.enterVREl||this.orientationModalEl||(this.enterVREl=i(this.enterVR,e.isMobile),this.el.appendChild(this.enterVREl),this.orientationModalEl=r(this.exitVR),this.el.appendChild(this.orientationModalEl),this.updateEnterVRInterface()))},remove:function(){[this.enterVREl,this.orientationModalEl].forEach(function(e){e&&e.parentNode.removeChild(e)})},updateEnterVRInterface:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){if(this.enterVREl){var e=this.el;e.is("vr-mode")?this.enterVREl.classList.add(f):this.enterVREl.classList.remove(f)}},toggleOrientationModalIfNeeded:function(){var e=this.el;this.orientationModalEl&&e.isMobile&&(!a.isLandscape()&&e.is("vr-mode")?this.orientationModalEl.classList.remove(f):this.orientationModalEl.classList.add(f))}})},{"../../core/component":56,"../../lib/three":90,"../../utils/":102}],45:[function(e,t){var i=e("../utils/debug"),r=e("../utils").diff,n=e("../core/component").registerComponent,o=e("../lib/three"),a=i("components:sound:warn");t.exports.Component=n("sound",{schema:{src:{"default":""},on:{"default":"click"},autoplay:{"default":!1},loop:{"default":!1},volume:{"default":1}},init:function(){this.listener=null,this.sound=null},update:function(e){var t=this.data,i=r(e||{},t),n=this.el,o=this.sound,s=t.src,c="src"in i;if(c){if(!s)return void a("Audio source was not specified with `src`");o=this.setupSound()}(c||"autoplay"in i)&&(o.autoplay=t.autoplay),(c||"loop"in i)&&o.setLoop(t.loop),(c||"volume"in i)&&o.setVolume(t.volume),"on"in i&&(e&&e.on&&n.removeEventListener(e.on),n.addEventListener(t.on,this.play.bind(this))),c&&o.load(s)},remove:function(){this.el.removeObject3D("sound"),this.sound.disconnect()},setupSound:function(){var e=this.el,t=e.sceneEl,i=this.sound;i&&(this.stop(),e.removeObject3D("sound"));var r=this.listener=t.audioListener||new o.AudioListener;return t.audioListener=r,t.camera&&t.camera.add(r),t.addEventListener("camera-set-active",function(e){e.detail.cameraEl.getObject3D("camera").add(r)}),i=this.sound=new o.PositionalAudio(r),e.setObject3D("sound",i),i.source.onended=function(){i.onEnded(),e.emit("sound-ended")},i},play:function(){this.sound.source.buffer&&this.sound.play()},stop:function(){this.sound.source.buffer&&this.sound.stop()},pause:function(){this.sound.source.buffer&&this.sound.isPlaying&&this.sound.pause()}})},{"../core/component":56,"../lib/three":90,"../utils":102,"../utils/debug":101}],46:[function(e,t){var i=e("../core/component").registerComponent;t.exports.Component=i("visible",{schema:{type:"boolean","default":!0},update:function(){this.el.object3D.visible=this.data}})},{"../core/component":56}],47:[function(e,t){var i=e("../core/component").registerComponent,r=e("../utils/").shouldCaptureKeyEvent,n=e("../lib/three"),o=.2;t.exports.Component=i("wasd-controls",{schema:{easing:{"default":20},acceleration:{"default":65},enabled:{"default":!0},fly:{"default":!1},wsAxis:{"default":"z",oneOf:["x","y","z"]},adAxis:{"default":"x",oneOf:["x","y","z"]},wsInverted:{"default":!1},wsEnabled:{"default":!0},adInverted:{"default":!1},adEnabled:{"default":!0}},init:function(){this.velocity=new n.Vector3,this.keys={},this.onBlur=this.onBlur.bind(this),this.onFocus=this.onFocus.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.attachVisibilityEventListeners()},update:function(e){var t,i=this.data,r=i.acceleration,n=i.easing,a=this.velocity,s=this.prevTime=this.prevTime||Date.now(),c=window.performance.now(),h=(c-s)/1e3,l=this.keys,u=i.adAxis,d=i.wsAxis,p=i.adInverted?-1:1,f=i.wsInverted?-1:1,m=this.el;if(this.prevTime=c,e||h>o)return a[u]=0,void(a[d]=0);a[u]-=a[u]*n*h,a[d]-=a[d]*n*h;var v=m.getComputedAttribute("position");i.enabled&&(i.adEnabled&&(l[65]&&(a[u]-=p*r*h),l[68]&&(a[u]+=p*r*h)),i.wsEnabled&&(l[87]&&(a[d]-=f*r*h),l[83]&&(a[d]+=f*r*h))),t=this.getMovementVector(h),m.object3D.translateX(t.x),m.object3D.translateY(t.y),m.object3D.translateZ(t.z),m.setAttribute("position",{x:v.x+t.x,y:v.y+t.y,z:v.z+t.z})},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},tick:function(){this.update()},remove:function(){this.pause(),this.removeVisibilityEventListeners()},attachVisibilityEventListeners:function(){window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(e){r(e)&&(this.keys[e.keyCode]=!0)},onKeyUp:function(e){r(e)&&(this.keys[e.keyCode]=!1)},getMovementVector:function(){var e=new n.Vector3(0,0,0),t=new n.Euler(0,0,0,"YXZ");return function(i){var r=this.velocity,o=this.el.getAttribute("rotation");return e.copy(r),e.multiplyScalar(i),o?(this.data.fly||(o.x=0),t.set(n.Math.degToRad(o.x),n.Math.degToRad(o.y),0),e.applyEuler(t),e):e}}()})},{"../core/component":56,"../lib/three":90,"../utils/":102}],48:[function(e,t){var i=e("tween.js"),r={alternate:"alternate",alternateReverse:"alternate-reverse",normal:"normal",reverse:"reverse"},n={linear:i.Easing.Linear.None,ease:i.Easing.Cubic.InOut,"ease-in":i.Easing.Cubic.In,"ease-out":i.Easing.Cubic.Out,"ease-in-out":i.Easing.Cubic.InOut,"ease-cubic":i.Easing.Cubic.In,"ease-in-cubic":i.Easing.Cubic.In,"ease-out-cubic":i.Easing.Cubic.Out,"ease-in-out-cubic":i.Easing.Cubic.InOut,"ease-quad":i.Easing.Quadratic.InOut,"ease-in-quad":i.Easing.Quadratic.In,"ease-out-quad":i.Easing.Quadratic.Out,"ease-in-out-quad":i.Easing.Quadratic.InOut,"ease-quart":i.Easing.Quartic.InOut,"ease-in-quart":i.Easing.Quartic.In,"ease-out-quart":i.Easing.Quartic.Out,"ease-in-out-quart":i.Easing.Quartic.InOut,"ease-quint":i.Easing.Quintic.InOut,"ease-in-quint":i.Easing.Quintic.In,"ease-out-quint":i.Easing.Quintic.Out,"ease-in-out-quint":i.Easing.Quintic.InOut,"ease-sine":i.Easing.Sinusoidal.InOut,"ease-in-sine":i.Easing.Sinusoidal.In,"ease-out-sine":i.Easing.Sinusoidal.Out,"ease-in-out-sine":i.Easing.Sinusoidal.InOut,"ease-expo":i.Easing.Exponential.InOut,"ease-in-expo":i.Easing.Exponential.In,"ease-out-expo":i.Easing.Exponential.Out,"ease-in-out-expo":i.Easing.Exponential.InOut,"ease-circ":i.Easing.Circular.InOut,"ease-in-circ":i.Easing.Circular.In,"ease-out-circ":i.Easing.Circular.Out,"ease-in-out-circ":i.Easing.Circular.InOut,"ease-elastic":i.Easing.Elastic.InOut,"ease-in-elastic":i.Easing.Elastic.In,"ease-out-elastic":i.Easing.Elastic.Out,"ease-in-out-elastic":i.Easing.Elastic.InOut,"ease-back":i.Easing.Back.InOut,"ease-in-back":i.Easing.Back.In,"ease-out-back":i.Easing.Back.Out,"ease-in-out-back":i.Easing.Back.InOut,"ease-bounce":i.Easing.Bounce.InOut,"ease-in-bounce":i.Easing.Bounce.In,"ease-out-bounce":i.Easing.Bounce.Out,"ease-in-out-bounce":i.Easing.Bounce.InOut},o={backwards:"backwards",both:"both",forwards:"forwards",none:"none"},a={indefinite:"indefinite"},s={attribute:"rotation",begin:"0",dur:1e3,easing:"ease",direction:r.normal,fill:o.forwards,from:void 0,repeat:0,to:void 0};t.exports.defaults=s,t.exports.directions=r,t.exports.easingFunctions=n,t.exports.fills=o,t.exports.repeats=a},{"tween.js":22}],49:[function(e,t){function i(e){return d.extend({},e)}function r(e,t,i,r,a){function s(){v=x[0],m=x[1],f=e.components[v],f||(e.setAttribute(v,""),f=e.components[v]),p=f.schema,b[t]=void 0===i?e.getComputedAttribute(v)[m]:i,b[t]=h(b[t],p[m]),w[t]=h(r,p[m]),g=function(i){t in i&&e.setAttribute(v,m,i[t])}}function l(){b=i?c.parse(i):a,w=c.parse(r),g=function(i){e.setAttribute(t,i)}}function u(){b[t]=void 0===i?!1:n(i),b[t]=o(b[t]),w[t]=o(n(r)),g=function(i){e.setAttribute(t,!!i[t])}}function d(){b[t]=parseFloat(void 0===i?e.getAttribute(t):i),w[t]=parseFloat(r),g=function(i){e.setAttribute(t,i[t])}}var p,f,m,v,g,x=t.split("."),b={},w={};return 2===x.length?s():r&&y(r)?l():-1!==["true","false"].indexOf(r)?u():d(),{from:b,partialSetAttribute:g,to:w}}function n(e){return"true"===e?!0:!1}function o(e){return e?1:0}var a=e("./a-node"),s=e("../constants/animation"),c=e("../utils/").coordinates,h=e("./schema").parseProperty,l=e("./a-register-element").registerElement,u=e("tween.js"),d=e("../utils/"),p=s.defaults,f=s.directions,m=s.easingFunctions,v=s.fills,g=s.repeats,y=c.isCoordinate;t.exports.AAnimation=l("a-animation",{prototype:Object.create(a.prototype,{createdCallback:{value:function(){this.bindMethods(),this.isRunning=!1,this.partialSetAttribute=function(){},this.tween=null}},attachedCallback:{value:function(){function e(){t.applyMixin(),t.update(),t.load()}var t=this,i=t.el=t.parentNode;i.isNode?i.hasLoaded?e():i.addEventListener("loaded",e.bind(t)):i.addEventListener("nodeready",e.bind(t))}},attributeChangedCallback:{value:function(){this.hasLoaded&&this.isRunning&&(this.stop(),this.applyMixin(),this.update())}},detachedCallback:{value:function(){this.isRunning&&this.stop()}},getTween:{value:function(){var e,t,n,o,a=this,s=a.data,c=a.el,h=s.attribute,l=parseInt(s.begin,10),d=c.getComputedAttribute(h),p=a.getDirection(s.direction),y=m[s.easing],x=s.fill,b=s.repeat===g.indefinite?1/0:0,w=!1;return e=r(c,h,s.from||a.initialValue,s.to,d),t=e.from,n=e.to,a.partialSetAttribute=e.partialSetAttribute,void 0===a.count&&(a.count=b===1/0?0:parseInt(s.repeat,10)),isNaN(l)&&(l=0),a.initialValue=a.initialValue||i(d),b===1/0&&x===v.forwards&&-1!==[f.alternate,f.alternateReverse].indexOf(s.direction)&&(w=!0),p===f.reverse&&(o=n,n=i(t),
t=i(o)),-1!==[v.backwards,v.both].indexOf(x)&&a.partialSetAttribute(t),new u.Tween(i(t)).to(n,s.dur).delay(l).easing(y).repeat(b).yoyo(w).onUpdate(function(){a.partialSetAttribute(this)}).onComplete(a.onCompleted.bind(a))}},update:{value:function(){var e=this.data,t=e.begin;this.removeEventListeners(this.evt),this.addEventListeners(t),this.evt=t,isNaN(t)||(this.stop(),this.start())},writable:window.debug},onCompleted:{value:function(){var e=this.data;return this.isRunning=!1,-1!==[v.backwards,v.none].indexOf(e.fill)&&this.partialSetAttribute(this.initialValue),0===this.count?(this.count=void 0,void this.emit("animationend")):(this.isRunning=!1,this.count--,void this.start())}},start:{value:function(){!this.isRunning&&this.el.isPlaying&&(this.tween=this.getTween(),this.isRunning=!0,this.tween.start(),this.emit("animationstart"))},writable:!0},stop:{value:function(){var e=this.tween;e&&(e.stop(),this.isRunning=!1,-1!==[v.backwards,v.none].indexOf(this.data.fill)&&this.partialSetAttribute(this.initialValue),this.emit("animationstop"))},writable:!0},getDirection:{value:function(e){return e===f.alternate?(this.prevDirection=this.prevDirection===f.normal?f.reverse:f.normal,this.prevDirection):e===f.alternateReverse?(this.prevDirection=this.prevDirection===f.reverse?f.normal:f.reverse,this.prevDirection):e}},bindMethods:{value:function(){this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.onStateAdded=this.onStateAdded.bind(this),this.onStateRemoved=this.onStateRemoved.bind(this)}},addEventListeners:{value:function(e){var t=this.el,i=this;d.splitString(e).forEach(function(e){t.addEventListener(e,i.start)}),isNaN(e)||t.addEventListener("play",this.start),t.addEventListener("pause",this.stop),t.addEventListener("stateadded",this.onStateAdded),t.addEventListener("stateremoved",this.onStateRemoved)}},removeEventListeners:{value:function(e){var t=this.el,i=this.start;d.splitString(e).forEach(function(e){t.removeEventListener(e,i)}),t.removeEventListener("stateadded",this.onStateAdded),t.removeEventListener("stateremoved",this.onStateRemoved)}},onStateAdded:{value:function(e){e.detail.state===this.data.begin&&this.start()},writable:!0},onStateRemoved:{value:function(e){e.detail.state===this.data.begin&&this.stop()},writable:!0},applyMixin:{value:function(){var e,t,i,r={};i=document.querySelector("#"+this.getAttribute("mixin")),t=i?d.getElData(i,p):{},e=d.getElData(this,p),d.extend(r,p,t,e),this.data=r}}})}),t.exports.getAnimationValues=r},{"../constants/animation":48,"../utils/":102,"./a-node":54,"./a-register-element":55,"./schema":62,"tween.js":22}],50:[function(e,t){function i(e){return e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload")?new Promise(function(t,i){function r(){for(var i=0,r=0;r<e.buffered.length;r++)i+=e.buffered.end(r)-e.buffered.start(r);i>=e.duration&&t()}return 4===e.readyState?t():e.error?i():(e.addEventListener("loadeddata",r,!1),e.addEventListener("progress",r,!1),void e.addEventListener("error",i,!1))}):void 0}var r=e("./a-node"),n=e("../utils/debug"),o=e("./a-register-element").registerElement,a=e("../lib/three"),s=new a.XHRLoader,c=n("core:a-assets:warn");t.exports=o("a-assets",{prototype:Object.create(r.prototype,{createdCallback:{value:function(){this.isAssets=!0}},attachedCallback:{value:function(){var e=this,t=[],r=this.querySelectorAll("audio"),n=this.querySelectorAll("img"),o=parseInt(this.getAttribute("timeout"),10)||3e3,a=this.querySelectorAll("video");if("A-SCENE"!==this.parentNode.tagName)throw new Error("<a-assets> must be a child of a <a-scene>.");for(var s=0;s<n.length;s++)t.push(new Promise(function(e,t){var i=n[s];i.onload=e,i.onerror=t}));for(s=0;s<r.length;s++)t.push(i(r[s]));for(s=0;s<a.length;s++)t.push(i(a[s]));Promise.all(t).then(this.load.bind(this)),setTimeout(function(){e.hasLoaded||(c("Asset loading timed out in ",o,"ms"),e.emit("timeout"),e.load())},o)}},load:{value:function(){r.prototype.load.call(this,null,function(e){return e.isAssetItem&&e.hasAttribute("src")})}}})}),o("a-asset-item",{prototype:Object.create(r.prototype,{createdCallback:{value:function(){this.data=null,this.isAssetItem=!0}},attachedCallback:{value:function(){var e=this,t=this.getAttribute("src");s.load(t,function(t){e.data=t,r.prototype.load.call(e)})}}})})},{"../lib/three":90,"../utils/debug":101,"./a-node":54,"./a-register-element":55}],51:[function(e,t){var i=e("../utils/debug"),r=e("./a-register-element").registerElement,n=i("core:cubemap:warn");t.exports=r("a-cubemap",{prototype:Object.create(HTMLElement.prototype,{attachedCallback:{value:function(){this.srcs=this.validate()},writable:window.debug},validate:{value:function(){var e,t=this.querySelectorAll("[src]"),i=[];if(6===t.length){for(e=0;e<t.length;e++)i.push(t[e].getAttribute("src"));return i}n("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")},writable:window.debug}})})},{"../utils/debug":101,"./a-register-element":55}],52:[function(e,t){function i(e,t){return void 0!==e.defaultComponents[t]?!0:e.hasAttribute(t)?!0:r(t,e.mixinEls)}function r(e,t){var i,r=!1;for(i=0;i<t.length&&!(r=t[i].hasAttribute(e));++i);return r}function n(e,t){e.pause(),e.tick&&t.removeBehavior(e)}function o(e,t){e.play(),e.tick&&t.addBehavior(e)}var a,s=e("./a-node"),c=e("./component").components,h=e("./a-register-element"),l=e("../lib/three"),u=e("../utils/"),d=h.isNode,p=u.debug("core:a-entity:debug"),f=h.registerElement,m=u.styleParser,v=Object.create(s.prototype,{defaultComponents:{value:{position:"",rotation:"",scale:"",visible:""}},createdCallback:{value:function(){this.components={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new l.Group,this.object3D.el=this,this.object3DMap={},this.states=[]}},attributeChangedCallback:{value:function(e,t,i){this.setEntityAttribute(e,t,i)}},attachedCallback:{value:function(){this.addToParent(),this.isScene||(this.load(),this.parentNode.paused||this.play())}},detachedCallback:{value:function(){this.parentEl&&!this.isScene&&(Object.keys(this.components).forEach(this.removeComponent.bind(this)),this.parentEl.remove(this))}},applyMixin:{value:function(e){var t=this.getAttribute(e);return e?void this.updateComponent(e,t):void this.updateComponents()}},mapStateMixins:{value:function(e,t){var i,r=this.getAttribute("mixin");r&&(i=r.split(" "),i.forEach(function(i){var r=i+"-"+e;t(r)}),this.updateComponents())}},updateStateMixins:{value:function(e,t){var i=this;t=t||"";var r=e.split(" "),n=t?t.split(" "):[],o=n.filter(function(e){return r.indexOf(e)<0});o.forEach(function(e){var t=Array.prototype.forEach,r=document.querySelectorAll("[id^="+e+"-]"),n=[];t.call(r,function(e){n.push(e.id)}),n.forEach(i.unregisterMixin.bind(i))}),this.states.forEach(function(e){r.forEach(function(t){var r=t+"-"+e;i.registerMixin(r)})})}},getObject3D:{value:function(e){return this.object3DMap[e]}},setObject3D:{value:function(e,t){var i=this.object3DMap[e];i&&this.object3D.remove(i),t instanceof l.Object3D&&(t.el=this,this.object3D.add(t)),this.object3DMap[e]=t}},removeObject3D:{value:function(e){this.setObject3D(e,null)}},getOrCreateObject3D:{value:function(e,t){var i=this.getObject3D(e);return!i&&t&&(i=new t,this.setObject3D(e,i)),i}},add:{value:function(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.emit("child-attached",{el:e}),this.object3D.add(e.object3D)}},addToParent:{value:function(){function e(){t.attachedToParent=!0,i.add&&i.add(t)}var t=this,i=this.parentEl=this.parentNode,r=this.attachedToParent;return i&&!r?d(i)?void e():void i.addEventListener("nodeready",e):void 0}},load:{value:function(){this.hasLoaded||(this.addToParent(),this.isScene?s.prototype.load.call(this,this.updateComponents.bind(this)):s.prototype.load.call(this,this.updateComponents.bind(this),function(e){return e.isEntity}))},writable:window.debug},remove:{value:function(e){this.object3D.remove(e.object3D)}},getChildEntities:{value:function(){for(var e=this.children,t=[],i=0;i<e.length;i++){var r=e[i];r instanceof a&&t.push(r)}return t}},initComponent:{value:function(e,t){var r,n=i(this,e);if(c[e]&&(n||t)){if(this.initComponentDependencies(e),t&&!n)this.setAttribute(e,"");else{if(this.isScene&&!this.hasAttribute(e)&&e in this.defaultComponents&&HTMLElement.prototype.setAttribute.call(this,e,this.defaultComponents[e]),e in this.components)return;r=this.components[e]=new c[e].Component(this),this.isPlaying&&o(r,this.sceneEl)}p("Component initialized: %s",e)}},writable:window.debug},initComponentDependencies:{value:function(e){var t,i=this,r=c[e];r&&(t=c[e].dependencies,t&&t.forEach(function(e){i.initComponent(e,!0)}))}},removeComponent:{value:function(e){var t=this.components[e];n(t,this.sceneEl),t.remove(),delete this.components[e]}},updateComponents:{value:function(){function e(e){var i=t.getAttribute(e);t.updateComponent(e,i)}var t=this,i=Object.keys(c);i.forEach(e)}},updateComponent:{value:function(e,t){var n=this.components[e],o=e in this.defaultComponents,a=r(e,this.mixinEls);return n?i(this,e)&&(null!==t||o||a)?void n.updateProperties(t):void this.removeComponent(e):void this.initComponent(e)}},removeAttribute:{value:function(e){var t=c[e];t&&this.setEntityAttribute(e,void 0,null),HTMLElement.prototype.removeAttribute.call(this,e)}},play:{value:function(){var e=this.components,t=Object.keys(e),i=this.sceneEl;this.isPlaying||(this.isPlaying=!0,t.forEach(function(t){o(e[t],i)}),this.getChildEntities().forEach(function(e){e.play()}),this.emit("play"))},writable:!0},pause:{value:function(){var e=this.components,t=Object.keys(e),i=this.sceneEl;this.isPlaying&&(this.isPlaying=!1,t.forEach(function(t){n(e[t],i)}),this.getChildEntities().forEach(function(e){e.pause()}),this.emit("pause"))},writable:!0},setEntityAttribute:{value:function(e,t,i){var r=c[e];return t=t||this.getAttribute(e),this.hasLoaded||this.isScene?"mixin"===e?(this.updateStateMixins(i,t),void this.updateComponents()):void(r&&this.updateComponent(e,i)):void 0}},setAttribute:{value:function(e,t,i){var r,n=this,o=this.components[e]||c[e];t=void 0===t?"":t;var a,h=t,l=t;o&&("string"==typeof t&&void 0!==i&&(r=m.parse(HTMLElement.prototype.getAttribute.call(this,e))||{},r[t]=i,h=r),l=o.stringify(h)),a=this.getAttribute(e),s.prototype.setAttribute.call(n,e,l),n.setEntityAttribute(e,a,h)},writable:window.debug},getAttribute:{value:function(e){var t=this.components[e]||c[e],i=HTMLElement.prototype.getAttribute.call(this,e);return t&&"string"==typeof i?t.parse(i,!0):i},writable:window.debug},getComputedAttribute:{value:function(e){var t=this.components[e];return t?t.getData():HTMLElement.prototype.getAttribute.call(this,e)}},addState:{value:function(e){this.is(e)||(this.states.push(e),this.mapStateMixins(e,this.registerMixin.bind(this)),this.emit("stateadded",{state:e}))}},removeState:{value:function(e){var t=this.states.indexOf(e);-1!==t&&(this.states.splice(t,1),this.mapStateMixins(e,this.unregisterMixin.bind(this)),this.emit("stateremoved",{state:e}))}},is:{value:function(e){return-1!==this.states.indexOf(e)}}});a=f("a-entity",{prototype:v}),t.exports=a},{"../lib/three":90,"../utils/":102,"./a-node":54,"./a-register-element":55,"./component":56}],53:[function(e,t){var i=e("./component").components,r=e("./a-node"),n=e("./a-register-element").registerElement;t.exports=n("a-mixin",{prototype:Object.create(r.prototype,{attachedCallback:{value:function(){this.load()},writable:window.debug},setAttribute:{value:function(e,t){var r=i[e];r&&"object"==typeof t&&(t=r.stringify(t)),HTMLElement.prototype.setAttribute.call(this,e,t)},writable:window.debug},getAttribute:{value:function(e){var t=i[e],r=HTMLElement.prototype.getAttribute.call(this,e);return t&&"string"==typeof r?t.parse(r):r},writable:window.debug}})})},{"./a-node":54,"./a-register-element":55,"./component":56}],54:[function(e,t){var i=e("./a-register-element").registerElement,r=e("../utils/");t.exports=i("a-node",{prototype:Object.create(HTMLElement.prototype,{createdCallback:{value:function(){this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[],this.mixinObservers={}}},attachedCallback:{value:function(){var e=this.getAttribute("mixin");this.sceneEl="A-SCENE"===this.tagName?this:this.closest("a-scene"),this.emit("nodeready",{},!1),e&&this.updateMixins(e)}},attributeChangedCallback:{value:function(e,t,i){"mixin"===e&&this.updateMixins(i,t)}},closest:{value:function(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,i=this;i&&!t.call(i,e);)i=i.parentElement;return i}},detachedCallback:{value:function(){}},load:{value:function(e,t){var i,r,n=this;this.hasLoaded||(t=t||function(e){return e.isNode},i=this.getChildren(),r=i.filter(t).map(function(e){return new Promise(function(t){return e.hasLoaded?t():void e.addEventListener("loaded",t)})}),Promise.all(r).then(function(){e&&e(),n.hasLoaded=!0,n.emit("loaded",{},!1)}))},writable:!0},getChildren:{value:function(){for(var e=[],t=0;t<this.children.length;t++)e.push(this.children[t]);return e}},updateMixins:{value:function(e,t){var i=e.split(" "),r=t?t.split(" "):[],n=r.filter(function(e){return i.indexOf(e)<0});this.mixinEls=[],n.forEach(this.unregisterMixin.bind(this)),i.forEach(this.registerMixin.bind(this))}},addMixin:{value:function(e){var t,i=this.getAttribute("mixin"),r=i.split(" ");for(t=0;t<r.length;++t)if(r[t]===e)return;r.push(e),this.setAttribute("mixin",r.join(" "))}},removeMixin:{value:function(e){var t,i=this.getAttribute("mixin"),r=i.split(" ");for(t=0;t<r.length;++t)if(r[t]===e)return r.splice(t,1),void this.setAttribute("mixin",r.join(" "))}},registerMixin:{value:function(e){if(this.sceneEl){var t=this.sceneEl.querySelector("a-mixin#"+e);t&&(this.attachMixinListener(t),this.mixinEls.push(t))}}},setAttribute:{value:function(e,t){"mixin"===e&&this.updateMixins(t),HTMLElement.prototype.setAttribute.call(this,e,t)}},unregisterMixin:{value:function(e){var t,i,r=this.mixinEls;for(i=0;i<r.length;++i)if(t=r[i],e===t.id){r.splice(i,1);break}this.removeMixinListener(e)}},removeMixinListener:{value:function(e){var t=this.mixinObservers[e];t&&(t.disconnect(),this.mixinObservers[e]=null)}},attachMixinListener:{value:function(e){var t=this,i=e.id,r=this.mixinObservers[i];if(e&&!r){var n=new MutationObserver(function(e){var i=e[0].attributeName;t.applyMixin(i)}),o={attributes:!0};n.observe(e,o),this.mixinObservers[i]=n}}},applyMixin:{value:function(){}},emit:{value:function(e,t,i){var n=this;t=t||{},void 0===i&&(i=!0);var o={bubbles:!!i,detail:t};return e.split(" ").map(function(e){return r.fireEvent(n,e,o)})}},emitter:{value:function(e,t,i){var r=this;return function(){r.emit(e,t,i)}}}})})},{"../utils/":102,"./a-register-element":55}],55:[function(e,t){function i(e){var t={},i=["attachedCallback","attributeChangedCallback","createdCallback"];return n(t,i,e,l.prototype),a(e,t),t}function r(e){var t={},i=["attachedCallback","attributeChangedCallback","createdCallback"],r=["attributeChangedCallback","attachedCallback","createdCallback","detachedCallback"];return n(t,i,e,l.prototype),n(t,r,e,u.prototype),a(e,t),t}function n(e,t,i,r){t.forEach(function(t){o(e,t,i,r)})}function o(e,t,i,r){var n=i[t],o=r[t];if(n&&o&&n!==o){var a=function(){return o.apply(this,arguments),n.apply(this,arguments)};e[t]={value:a,writable:window.debug}}}function a(e,t){var i=Object.getOwnPropertyNames(e);i.forEach(function(i){var r;t[i]||(r=Object.getOwnPropertyDescriptor(e,i),t[i]={value:e[i],writable:r.writable})})}e("document-register-element");var s=document.registerElement,c=t.exports.knownTags={},h=function(e){c[e.toLowerCase()]=!0};t.exports.isNode=function(e){return e.tagName.toLowerCase()in c||e.isNode},t.exports.registerElement=document.registerElement=function(e,t){var n=Object.getPrototypeOf(t.prototype),o=t,a=l&&n===l.prototype,c=u&&n===u.prototype;return(a||c)&&h(e),a&&(o=i(t.prototype),o={prototype:Object.create(n,o)}),c&&(o=r(t.prototype),o={prototype:Object.create(n,o)}),s.call(document,e,o)};var l=e("./a-node"),u=e("./a-entity")},{"./a-entity":52,"./a-node":54,"document-register-element":8}],56:[function(e,t){function i(e,t,i,n,o){function a(e){var i=HTMLElement.prototype.getAttribute.call(e,t);i&&(i=d?i:f.parse(i),l=r(l,i,d))}var s=null!==n,l={},d=u(i),p=e.mixinEls;return d||"string"!=typeof n||(n=f.parse(n)),d?l=i["default"]:Object.keys(i).forEach(function(e){l[e]=i[e]["default"]}),p.forEach(a),s&&(l=r(l,n,d)),u(i)?h(l,i):c(l,i,void 0,o)}function r(e,t,i){return i?void 0===t||"object"==typeof t&&0===Object.keys(t).length?e:t:a.extend(e,t)}var n=e("./schema"),o=e("./system"),a=e("../utils/"),s=t.exports.components={},c=n.parseProperties,h=n.parseProperty,l=n.process,u=n.isSingleProperty,d=n.stringifyProperties,p=n.stringifyProperty,f=a.styleParser,m=t.exports.Component=function(e){var t=this.name,r=HTMLElement.prototype.getAttribute.call(e,t);this.el=e,this.updateSchema&&this.updateSchema(i(e,t,this.schema,r,!0)),this.data=i(e,t,this.schema,r),this.init(),this.update()};m.prototype={schema:{},init:function(){},update:function(){},updateSchema:void 0,tick:void 0,play:function(){},pause:function(){},remove:function(){},parse:function(e,t){var i=this.schema;return u(i)?h(e,i):c(f.parse(e),i,!0,t)},stringify:function(e){var t=this.schema;return"string"==typeof e?e:u(t)?p(e,t):(e=d(e,t),f.stringify(e))},getData:function(){var e=this.data;return"object"!=typeof e?e:a.extend({},e)},updateProperties:function(e){var t=this.el,n=u(this.schema),o=r({},this.data,n);this.updateSchema&&this.updateSchema(i(t,this.name,this.schema,e,!0)),this.data=i(t,this.name,this.schema,e),(n||!a.deepEqual(o,this.data))&&(this.update(o),t.emit("componentchanged",{name:this.name,newData:this.getData(),oldData:o}))},extendSchema:function(e){var t=a.extend({},s[this.name].schema);a.extend(t,e),this.schema=l(t),this.el.emit("schemachanged",{component:this.name})}},t.exports.registerComponent=function(e,t){var i,r={};if(Object.keys(t).forEach(function(e){r[e]={value:t[e],writable:!0}}),s[e])throw new Error("The component `"+e+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");return i=function(e){m.call(this,e)},i.prototype=Object.create(m.prototype,r),i.prototype.name=e,i.prototype.constructor=i,i.prototype.system=o&&o.systems[e],s[e]={Component:i,dependencies:i.prototype.dependencies,parse:i.prototype.parse.bind(i.prototype),schema:a.extend(l(i.prototype.schema)),stringify:i.prototype.stringify.bind(i.prototype),type:i.prototype.type},i},t.exports.buildData=i},{"../utils/":102,"./schema":62,"./system":64}],57:[function(e,t){function i(e,t,i,r){return"type"in x?void y("Property type "+e+" is already registered."):void(x[e]={"default":t,parse:i||o,stringify:r||a})}function r(e){function t(e){return e.trim()}return Array.isArray(e)?e:e&&"string"==typeof e?e.split(",").map(t):[]}function n(e){return e.join(", ")}function o(e){return e}function a(e){return null===e?"null":e.toString()}function s(e){return"false"!==e&&e!==!1}function c(e){return parseInt(e,10)}function h(e){return parseFloat(e,10)}function l(e){return e?"string"!=typeof e?e:document.querySelector(e):null}function u(e){return e?"string"!=typeof e?e:document.querySelectorAll(e):null}function d(e){return e.getAttribute?"#"+e.getAttribute("id"):a(e)}function p(e){if(e.item){var t,i="";for(t=0;t<e.length;++t)i+="#"+e[t].getAttribute("id"),t!==e.length-1&&(i+=", ");return i}return a(e)}function f(e){var t=e.match(/\url\((.+)\)/);if(t)return t[1];var i=l(e);return i?i.getAttribute("src"):""}function m(e){return v.parse(e,this["default"])}var v=e("../utils/coordinates"),g=e("debug"),y=g("core:propertyTypes:warn"),x=t.exports.propertyTypes={};i("array",[],r,n),i("boolean",!1,s),i("color","#FFF",o,a),i("int",0,c),i("number",0,h),i("selector","",l,d),i("selectorAll","",u,p),i("src","",f),i("string","",o,a),i("time",0,c),i("vec2",{x:0,y:0},m,v.stringify),i("vec3",{x:0,y:0,z:0},m,v.stringify),i("vec4",{x:0,y:0,z:0,w:0},m,v.stringify),t.exports.registerPropertyType=i},{"../utils/coordinates":100,debug:3}],58:[function(e,t){function i(e){return v?{height:window.innerHeight,width:window.innerWidth}:{height:e.offsetHeight,width:e.offsetWidth}}function r(e){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}var n=e("./fullscreen"),o=e("./metaTags").inject,a=e("./wakelock"),s=e("../a-register-element"),c=e("../system").systems,h=e("../../lib/three"),l=e("tween.js"),u=e("../../utils/"),d=e("../a-entity"),p=e("../a-node"),f=s.registerElement,m=u.isIOS(),v=u.isMobile(),g=t.exports=f("a-scene",{prototype:Object.create(d.prototype,{defaultComponents:{value:{canvas:"","keyboard-shortcuts":"","vr-mode-ui":""}},createdCallback:{value:function(){this.isMobile=v,this.isIOS=m,this.isScene=!0,this.object3D=new h.Scene,this.systems={},this.time=0,this.init()}},init:{value:function(){this.behaviors=[],this.hasLoaded=!1,this.isPlaying=!0,this.originalHTML=this.innerHTML,this.setupSystems(),this.addEventListener("render-target-loaded",function(){this.setupRenderer(),this.resize()})},writable:!0},attachedCallback:{value:function(){n(this),o(this),a(this),window.addEventListener("load",this.resize.bind(this)),window.addEventListener("resize",this.resize.bind(this),!1),this.addEventListener("fullscreen-exit",this.exitVR.bind(this)),this.play()},writable:window.debug},setupSystems:{value:function(){var e=Object.keys(c);e.forEach(this.initSystem.bind(this))}},initSystem:{value:function(e){var t;this.systems[e]||(t=this.systems[e]=new c[e],t.sceneEl=this,t.init())}},detachedCallback:{value:function(){window.cancelAnimationFrame(this.animationFrameID),this.animationFrameID=null}},addBehavior:{value:function(e){var t=this.behaviors;-1===t.indexOf(e)&&t.push(e)}},enterVR:{value:function(e){this.setStereoRenderer(),v?r(this.canvas):this.stereoRenderer.setFullScreen(!0),this.addState("vr-mode"),this.emit("enter-vr",e)}},exitVR:{value:function(){this.setMonoRenderer(),this.removeState("vr-mode"),this.emit("exit-vr",{target:this})}},removeBehavior:{value:function(e){var t=this.behaviors,i=t.indexOf(e);-1!==i&&t.splice(i,1)}},resize:{value:function(){var e,t=this.camera,r=this.canvas;t&&r&&(!v&&r.dataset.aframeProvided&&(r.style.width="100%",r.style.height="100%"),e=i(r,v),t.aspect=e.width/e.height,t.updateProjectionMatrix(),this.renderer.setSize(e.width,e.height,!0))},writable:window.debug},setMonoRenderer:{value:function(){this.renderer=this.monoRenderer,this.resize()}},setStereoRenderer:{value:function(){this.renderer=this.stereoRenderer,this.resize()}},setupRenderer:{value:function(){var e=this.canvas,t="true"===this.getAttribute("antialias"),i=this.renderer=this.monoRenderer=new h.WebGLRenderer({canvas:e,antialias:t,alpha:!0});i.setPixelRatio(window.devicePixelRatio),i.sortObjects=!1,g.renderer=i,this.stereoRenderer=new h.VREffect(i)},writable:window.debug},play:{value:function(){var e=this;return this.renderStarted?void d.prototype.play.call(this):(this.addEventListener("loaded",function(){this.renderStarted||(d.prototype.play.call(this),this.resize(),this.renderer&&(window.performance&&window.performance.mark("render-started"),this.render(),this.renderStarted=!0,this.emit("renderstart")))}),void setTimeout(function(){d.prototype.load.call(e)}))}},reload:{value:function(e){function t(){i.isPlaying&&d.prototype.play.call(i)}var i=this;e&&this.pause(),this.innerHTML=this.originalHTML,this.init(),p.prototype.load.call(this,t)}},render:{value:function(e){var t=this.camera,i=e-this.time,r=this.systems;this.isPlaying&&(l.update(e),this.behaviors.forEach(function(t){t.el.isPlaying&&t.tick(e,i)}),Object.keys(r).forEach(function(t){r[t].tick&&r[t].tick(e,i)})),this.renderer.render(this.object3D,t),this.time=e,this.animationFrameID=window.requestAnimationFrame(this.render.bind(this))},writable:window.debug}})})},{"../../lib/three":90,"../../utils/":102,"../a-entity":52,"../a-node":54,"../a-register-element":55,"../system":64,"./fullscreen":59,"./metaTags":60,"./wakelock":61,"tween.js":22}],59:[function(e,t){function i(){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement,t=this;t.isMobile&&window.screen.orientation&&(e?window.screen.orientation.lock("landscape"):window.screen.orientation.unlock()),e?n(t):o(t)}function r(e){var t=this;if(e.data)switch(e.data.type){case"fullscreen":switch(e.data.data){case"enter":n(t);break;case"exit":o(t)}}}function n(e){e.addState("fullscreen"),e.emit("fullscreen-enter")}function o(e){e.removeState("fullscreen"),e.emit("fullscreen-exit")}var a=e("../../utils/").isIframed;t.exports=function(e){var t=i.bind(e);document.addEventListener("mozfullscreenchange",t),document.addEventListener("webkitfullscreenchange",t),a()&&window.addEventListener("message",r.bind(e))}},{"../../utils/":102}],60:[function(e,t){function i(e){return{tagName:"meta",attributes:e,exists:function(){return document.querySelector('meta[name="'+e.name+'"]')}}}function r(e){return{tagName:"link",attributes:e,exists:function(){return document.querySelector('link[rel="'+e.rel+'"]')}}}function n(e){if(e&&e.tagName){var t=document.createElement(e.tagName);return o(t,e.attributes)}}var o=e("../../utils").extend,a=t.exports.MOBILE_HEAD_TAGS=[i({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui"}),i({name:"mobile-web-app-capable",content:"yes"}),i({name:"theme-color",content:"black"}),r({rel:"icon",sizes:"192x192",href:"https://aframe.io/images/aframe-logo-192.png"})],s=[i({name:"apple-mobile-web-app-capable",content:"yes"}),i({name:"apple-mobile-web-app-status-bar-style",content:"black"}),r({rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"})];t.exports.inject=function(e){function t(e){e&&!e.exists()&&(i=n(e),i&&(o?o.parentNode.insertBefore(i,o):r.appendChild(i),c.push(i)))}var i,r=document.head,o=r.querySelector("script"),c=[];return a.forEach(t),e.isIOS&&s.forEach(t),c}},{"../../utils":102}],61:[function(e,t){var i=e("../../../vendor/wakelock/wakelock");t.exports=function(e){if(e.isMobile){var t=e.wakelock=new i;e.addEventListener("enter-vr",function(){t.request()}),e.addEventListener("exit-vr",function(){t.release()})}}},{"../../../vendor/wakelock/wakelock":109}],62:[function(e,t){function i(e){return"type"in e?"string"==typeof e.type:"default"in e}function r(e){var t,i=e["default"],r=e.type;return e.type?"bool"===e.type?r="boolean":"float"===e.type&&(r="number"):r=void 0!==i&&-1!==["boolean","number"].indexOf(typeof i)?typeof i:Array.isArray(i)?"array":"string",t=s[r],t||c("Unknown property type: "+r),e.parse=e.parse||t.parse,e.stringify=e.stringify||t.stringify,e.type=r,"default"in e||(e["default"]=t["default"]),e}function n(e,t){return"string"!=typeof e?e:"undefined"==typeof e?e:t.parse(e)}function o(e,t){return"object"!=typeof e?e:t?t.stringify(e):JSON.stringify(e)}var a=e("../utils/debug"),s=e("./propertyTypes").propertyTypes,c=a("core:schema:warn");t.exports.isSingleProperty=i,t.exports.process=function(e){return i(e)?r(e):(Object.keys(e).forEach(function(t){e[t]=r(e[t])}),e)},t.exports.processPropertyDefinition=r,t.exports.parseProperties=function(e,t,i,r){var o=Object.keys(i?e:t);return null===e||"object"!=typeof e?e:(Object.keys(e).forEach(function(e){t[e]||r||c("Unknown component property: "+e)}),o.forEach(function(i){var r=t[i],o=e[i];t[i]&&(o=void 0===o?r["default"]:o,e[i]=n(o,r))}),e)},t.exports.parseProperty=n,t.exports.stringifyProperties=function(e,t){var i={};return Object.keys(e).forEach(function(r){var n=t[r],a=e[r],s=a;"object"==typeof s&&(s=o(a,n),n||c("Unknown component property: "+r)),i[r]=s}),i},t.exports.stringifyProperty=o},{"../utils/debug":101,"./propertyTypes":57}],63:[function(e,t){var i=e("./schema"),r=i.process,n=t.exports.shaders={},o=t.exports.shaderNames=[],a=e("../lib/three"),s={number:"f",time:"f",vec4:"v4",vec3:"v3",vec2:"v2",color:"v3"},c=t.exports.Shader=function(){};c.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0,0.0,1.0,1.0);}",init:function(e){return this.attributes=this.initVariables(e,"attribute"),this.uniforms=this.initVariables(e,"uniform"),this.material=new a.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initVariables:function(e,t){function i(i){if(o[i].is===t){var a=s[o[i].type],c=o[i].parse(e[i]||o[i]["default"]);n[i]={type:a,value:r.parseValue(o[i].type,c)}}}var r=this,n={},o=this.schema,a=Object.keys(o);return a.forEach(i),n},update:function(e){this.updateVariables(e,"attribute"),this.updateVariables(e,"uniform")},updateVariables:function(e,t){function i(i){a[i]&&a[i].is===t&&n[i].value!==e[i]&&(n[i].value=r.parseValue(a[i].type,e[i]),n[i].needsUpdate=!0)}var r=this,n="uniform"===t?this.uniforms:this.attributes,o=Object.keys(e),a=this.schema;o.forEach(i)},parseValue:function(e,t){var i;switch(e){case"vec2":return new a.Vector2(t.x,t.y);case"vec3":return new a.Vector3(t.x,t.y,t.z);case"vec4":return new a.Vector4(t.x,t.y,t.z,t.w);case"color":return i=new a.Color(t),new a.Vector3(i.r,i.g,i.b);default:return t}}},t.exports.registerShader=function(e,t){var i,a={};if(Object.keys(t).forEach(function(e){a[e]={value:t[e],writable:!0}}),n[e])throw Error("The shader "+e+" has been already registered");return i=function(){c.call(this)},i.prototype=Object.create(c.prototype,a),i.prototype.name=e,i.prototype.constructor=i,n[e]={Shader:i,schema:r(i.prototype.schema)},o.push(e),i}},{"../lib/three":90,"./schema":62}],64:[function(e,t){var i=e("./component"),r=t.exports.systems={},n=t.exports.System=function(){var e=i&&i.components[this.name];e&&(e.Component.prototype.system=this)};n.prototype={init:function(){},tick:void 0,play:function(){},pause:function(){}},t.exports.registerSystem=function(e,t){var i,o,a={},s=document.querySelectorAll("a-scene");if(Object.keys(t).forEach(function(e){a[e]={value:t[e],writable:!0}}),r[e])throw new Error("The system `"+e+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");for(o=function(){n.call(this)},o.prototype=Object.create(n.prototype,a),o.prototype.name=e,o.prototype.constructor=o,r[e]=o,i=0;i<s.length;i++)s[i].initSystem(e)}},{"./component":56}],65:[function(e,t){var i=e("../../core/a-node"),r=e("../../core/a-register-element").registerElement;t.exports=r("a-event",{prototype:Object.create(i.prototype,{createdCallback:{value:function(){this.el=null,this.isAEvent=!0,this.name="",this.targetEls=[]}},attachedCallback:{value:function(){var e=this.getAttribute("target");this.el=this.parentNode,this.name=this.getAttribute("name")||this.getAttribute("type"),this.targetEls=e?this.closest("a-scene").querySelectorAll(e):[this.el],this.deprecated&&console.warn("<"+this.tagName.toLowerCase()+'> has been DEPRECATED. Use <a-event name="'+this.name+'"> instead.'),this.hasAttribute("type")&&console.log("<a-event type> has been DEPRECATED. Use <a-event name> instead."),this.listener=this.attachEventListener(),this.load()}},detachedCallback:{value:function(){var e=this.listener;e&&this.removeEventListener(this.name,e)}},attachEventListener:{value:function(){var e=this.attributes,t=this.el,i=this.name,r=this.targetEls;return t.addEventListener(i,function(){for(var t,i,n,o,a,s=0;s<r.length;s++)for(var c=0;c<e.length;c++)t=e[c],i=t.name,o=t.value,a=r[s],"target"!==i&&(-1===i.indexOf(".")?a.setAttribute(i,o):(n=i.split("."),a.setAttribute(n[0],n[1],o)))})}}})})},{"../../core/a-node":54,"../../core/a-register-element":55}],66:[function(e,t){t.exports=function(){return{defaultAttributes:{material:{}},mappings:{color:"material.color",metalness:"material.metalness",opacity:"material.opacity",repeat:"material.repeat",roughness:"material.roughness",shader:"material.shader",side:"material.side",
src:"material.src",translate:"geometry.translate",transparent:"material.transparent"},transforms:{src:function(e){return"#"===e[0]?e:"url("+e+")"}}}}},{}],67:[function(e){e("./primitives/a-box"),e("./primitives/a-camera"),e("./primitives/a-circle"),e("./primitives/a-collada-model"),e("./primitives/a-cone"),e("./primitives/a-cursor"),e("./primitives/a-curvedimage"),e("./primitives/a-cylinder"),e("./primitives/a-image"),e("./primitives/a-light"),e("./primitives/a-model"),e("./primitives/a-obj-model"),e("./primitives/a-plane"),e("./primitives/a-ring"),e("./primitives/a-sky"),e("./primitives/a-sphere"),e("./primitives/a-torus"),e("./primitives/a-video"),e("./primitives/a-videosphere")},{"./primitives/a-box":68,"./primitives/a-camera":69,"./primitives/a-circle":70,"./primitives/a-collada-model":71,"./primitives/a-cone":72,"./primitives/a-cursor":73,"./primitives/a-curvedimage":74,"./primitives/a-cylinder":75,"./primitives/a-image":76,"./primitives/a-light":77,"./primitives/a-model":78,"./primitives/a-obj-model":79,"./primitives/a-plane":80,"./primitives/a-ring":81,"./primitives/a-sky":82,"./primitives/a-sphere":83,"./primitives/a-torus":84,"./primitives/a-video":85,"./primitives/a-videosphere":86}],68:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/"),n=r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"box"}},mappings:{depth:"geometry.depth",height:"geometry.height",translate:"geometry.translate",width:"geometry.width"}});i("a-box",n),i("a-cube",r.extendDeep({deprecated:"<a-cube> is deprecated. Use <a-box> instead."},n))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],69:[function(e){var t=e("../registerPrimitive");t("a-camera",{defaultAttributes:{camera:{},"look-controls":{},"wasd-controls":{}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","wasd-controls-enabled":"wasd-controls.enabled"},deprecatedMappings:{"cursor-color":"a-camera[cursor-color] has been removed. Use a-cursor[color] instead.","cursor-maxdistance":"a-camera[cursor-maxdistance] has been removed. Use a-cursor[max-distance] instead.","cursor-offset":"a-camera[cursor-offset] has been removed. Use a-cursor[position] instead.","cursor-opacity":"a-camera[cursor-offset] has been removed. Use a-cursor[opacity] instead.","cursor-scale":"a-camera[cursor-scale] has been removed. Use a-cursor[scale] instead.","cursor-visible":"a-camera[cursor-visible] has been removed. Use a-cursor[visible] instead."}})},{"../registerPrimitive":87}],70:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-circle",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"circle"}},mappings:{radius:"geometry.radius",segments:"geometry.segments","theta-length":"geometry.theta-length","theta-start":"geometry.theta-start"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],71:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-collada-model",r.extendDeep({},t(),{mappings:{src:"collada-model"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],72:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-cone",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"cone"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded","radius-bottom":"geometry.radiusBottom","radius-top":"geometry.radiusTop","segments-height":"geometry.segmentsHeight","segments-radial":"geometry.segmentsRadial","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",translate:"geometry.translate"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],73:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-cursor",r.extendDeep({},t(),{defaultAttributes:{cursor:{maxDistance:1e3},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:64},material:{shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{fuse:"cursor.fuse","max-distance":"cursor.maxDistance",timeout:"cursor.timeout"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],74:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-curvedimage",r.extendDeep({},t(),{defaultAttributes:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",translate:"geometry.translate",width:"geometry.thetaLength"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],75:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-cylinder",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"cylinder"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius","radius-bottom":"geometry.radiusBottom","radius-top":"geometry.radiusTop","segments-radial":"geometry.segmentsRadial","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",translate:"geometry.translate"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],76:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-image",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",translate:"geometry.translate",width:"geometry.width"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],77:[function(e){var t=e("../registerPrimitive");t("a-light",{defaultAttributes:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",exponent:"light.exponent",intensity:"light.intensity",type:"light.type"}})},{"../registerPrimitive":87}],78:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-model",r.extend({},t(),{deprecated:"<a-model> is deprecated. Use <a-obj-model> or <a-collada-model> instead.",defaultAttributes:{loader:{format:"collada"},material:{color:"#FFF"}},mappings:{src:"loader.src",format:"loader.format"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],79:[function(e){var t=e("../getMeshMixin")(),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-obj-model",r.extendDeep({},t,{mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"},transforms:{mtl:t.transforms.src}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],80:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-plane",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"plane"}},mappings:{height:"geometry.height",translate:"geometry.translate",width:"geometry.width"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],81:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-ring",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"ring"}},mappings:{"radius-inner":"geometry.radiusInner","radius-outer":"geometry.radiusOuter","segments-phi":"geometry.segments-phi","segments-theta":"geometry.segments-theta","theta-length":"geometry.theta-length","theta-start":"geometry.theta-start"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],82:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-sky",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"sphere",radius:100,segmentsWidth:64,segmentsHeight:20},material:{color:"#FFF",shader:"flat"},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-width":"geometry.segmentsWidth","segments-height":"geometry.segmentsHeight"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],83:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-sphere",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"sphere"}},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth",translate:"geometry.translate"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],84:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-torus",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"torus"}},mappings:{arc:"geometry.arc",radius:"geometry.radius","radius-tubular":"geometry.radiusTubular","segments-radial":"geometry.segmentsRadial","segments-tubular":"geometry.segmentsTubular"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],85:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-video",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",translate:"geometry.translate",width:"geometry.width"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],86:[function(e){var t=e("../getMeshMixin"),i=e("../registerPrimitive"),r=e("../../../utils/");i("a-videosphere",r.extendDeep({},t(),{defaultAttributes:{geometry:{primitive:"sphere",radius:5e3,segmentsWidth:64,segmentsHeight:64},material:{color:"#FFF",shader:"flat"},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}))},{"../../../utils/":102,"../getMeshMixin":66,"../registerPrimitive":87}],87:[function(e,t){function i(e){var t={};return Object.keys(e).forEach(function(i){var r=e[i];t[i]="object"==typeof r?a.extend({},r):r}),t}var r=e("../../core/a-entity"),n=e("../../core/component").components,o=e("../../core/a-register-element").registerElement,a=e("../../utils/"),s=a.debug,c=s("extras:primitives");t.exports=function(e,t){return e=e.toLowerCase(),c("Registering <%s>",e),o(e,{prototype:Object.create(r.prototype,{defaultAttributes:{value:t.defaultAttributes||{}},deprecated:{value:t.deprecated||null},deprecatedMappings:{value:t.deprecatedMappings||{}},mappings:{value:t.mappings||{}},transforms:{value:t.transforms||{}},createdCallback:{value:function(){this.componentData={},t.deprecated&&console.warn(t.deprecated)}},attachedCallback:{value:function(){var e=this,t=this.attributes;this.componentData=i(this.defaultAttributes),Object.keys(this.componentData).forEach(function(t){e.hasAttribute(t)||e.setAttribute(t,e.componentData[t])}),Object.keys(t).forEach(function(i){var r=t[i];e.syncAttributeToComponent(r.name,r.value)})}},attributeChangedCallback:{value:function(e,t,i){return this.mappings[e]?void this.syncAttributeToComponent(e,i):void r.prototype.attributeChangedCallback.call(this,e,t,i)}},syncAttributeToComponent:{value:function(e,t){var i,r,o;e in this.deprecatedMappings&&console.warn(this.deprecatedMappings[e]),e&&this.mappings[e]&&(i=this.mappings[e],-1!==i.indexOf(".")&&(r=this.mappings[e].split("."),i=r[0],o=r[1]),n[i]&&(t=this.getTransformedValue(e,t),this.componentData[i]||(this.componentData[i]=this.defaultAttributes[i]||{}),o?this.componentData[i][o]=t:this.componentData[i]=t,this.setAttribute(i,this.componentData[i])))}},getTransformedValue:{value:function(e,t){return this.transforms&&this.transforms[e]?this.transforms[e].bind(this)(t):t}}})})}},{"../../core/a-entity":52,"../../core/a-register-element":55,"../../core/component":56,"../../utils/":102}],88:[function(e,t){window.Promise=window.Promise||e("promise-polyfill"),e("present"),e("./style/aframe.css"),e("./style/rStats.css");var i=e("./core/scene/a-scene"),r=e("./core/component").components,n=e("./core/component").registerComponent,o=e("./extras/primitives/registerPrimitive"),a=e("./core/shader").registerShader,s=e("./core/system").registerSystem,c=e("./core/shader").shaders,h=e("./core/system").systems,l=window.THREE=e("./lib/three"),u=window.TWEEN=e("tween.js"),d=e("../package"),p=e("./utils/");e("./systems/index"),e("./components/index"),e("./shaders/index");var f=e("./core/a-node"),m=e("./core/a-entity");window.hasNonPolyfillWebVRSupport=!!navigator.getVRDevices,window.WebVRConfig={TOUCH_PANNER_DISABLED:!0,MOUSE_KEYBOARD_CONTROLS_DISABLED:!0},e("webvr-polyfill"),e("./core/a-animation"),e("./core/a-assets"),e("./core/a-cubemap"),e("./core/a-mixin"),e("./extras/declarative-events/"),e("./extras/primitives/"),console.log("A-Frame Version:",d.version),console.log("three Version:",d.dependencies.three),console.log("WebVR Polyfill Version:",d.dependencies["webvr-polyfill"]),t.exports=window.AFRAME={AEntity:m,ANode:f,AScene:i,components:r,registerComponent:n,registerShader:a,registerSystem:s,registerPrimitive:o,shaders:c,systems:h,THREE:l,TWEEN:u,utils:p,version:d.version}},{"../package":24,"./components/index":29,"./core/a-animation":49,"./core/a-assets":50,"./core/a-cubemap":51,"./core/a-entity":52,"./core/a-mixin":53,"./core/a-node":54,"./core/component":56,"./core/scene/a-scene":58,"./core/shader":63,"./core/system":64,"./extras/declarative-events/":65,"./extras/primitives/":67,"./extras/primitives/registerPrimitive":87,"./lib/three":90,"./shaders/index":92,"./style/aframe.css":94,"./style/rStats.css":95,"./systems/index":97,"./utils/":102,present:10,"promise-polyfill":11,"tween.js":22,"webvr-polyfill":23}],89:[function(e,t){window.aframeStats=function(e){function t(){o("te").set(a.querySelectorAll("a-entity").length),o("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))}function i(){}function r(){}function n(e){o=e}var o=null,a=e,s={te:{caption:"Entities"},lt:{caption:"Load Time"}},c=[{caption:"A-Frame",values:["te","lt"]}];return{update:t,start:i,end:r,attach:n,values:s,groups:c,fractions:[]}},"object"==typeof t&&(t.exports={aframeStats:window.aframeStats})},{}],90:[function(e,t){(function(i){var r=i.THREE=e("three");r.TextureLoader&&(r.TextureLoader.prototype.crossOrigin=""),r.ImageLoader&&(r.ImageLoader.prototype.crossOrigin=""),r.Cache&&(r.Cache.enabled=!0),e("../../node_modules/three/examples/js/loaders/OBJLoader"),e("../../node_modules/three/examples/js/loaders/MTLLoader"),e("../../node_modules/three/examples/js/loaders/ColladaLoader"),e("../../node_modules/three/examples/js/controls/VRControls"),e("../../node_modules/three/examples/js/effects/VREffect"),t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../node_modules/three/examples/js/controls/VRControls":16,"../../node_modules/three/examples/js/effects/VREffect":17,"../../node_modules/three/examples/js/loaders/ColladaLoader":18,"../../node_modules/three/examples/js/loaders/MTLLoader":19,"../../node_modules/three/examples/js/loaders/OBJLoader":20,three:21}],91:[function(e,t){function i(e){var t={fog:e.fog,color:new n.Color(e.color)};return t}var r=e("../core/shader").registerShader,n=e("../lib/three"),o=e("../utils/");t.exports.Component=r("flat",{schema:{color:{type:"color"},fog:{"default":!0},height:{"default":256},repeat:{"default":""},src:{"default":""},width:{"default":512}},init:function(e){return this.textureSrc=null,this.material=new n.MeshBasicMaterial(i(e)),this.updateTexture(e),this.material},update:function(e){return this.updateMaterial(e),this.updateTexture(e),this.material},updateTexture:function(e){var t=this.el,i=e.src,r=this.material,n=t.sceneEl.systems.material;if(i){if(i===this.textureSrc)return;return this.textureSrc=i,void o.srcLoader.validateSrc(i,function(i){n.loadImage(t,r,e,i)},function(i){n.loadVideo(t,r,e,i)})}o.material.updateMaterialTexture(r,null)},updateMaterial:function(e){var t=this.material;e=i(e),Object.keys(e).forEach(function(i){t[i]=e[i]})}})},{"../core/shader":63,"../lib/three":90,"../utils/":102}],92:[function(e){e("./flat"),e("./standard")},{"./flat":91,"./standard":93}],93:[function(e,t){function i(e){var t={color:new n.Color(e.color),metalness:e.metalness,roughness:e.roughness};return t}var r=e("../core/shader").registerShader,n=e("../lib/three"),o=e("../utils/"),a=new n.CubeTextureLoader,s={};t.exports.Component=r("standard",{schema:{color:{type:"color"},envMap:{"default":""},fog:{"default":!0},height:{"default":256},metalness:{"default":0,min:0,max:1},repeat:{"default":""},src:{"default":""},roughness:{"default":.5,min:0,max:1},width:{"default":512}},init:function(e){return this.material=new n.MeshStandardMaterial(i(e)),this.updateTexture(e),this.updateEnvMap(e),this.material},update:function(e){return this.updateMaterial(e),this.updateTexture(e),this.updateEnvMap(e),this.material},updateTexture:function(e){var t=this.el,i=e.src,r=this.material,n=t.sceneEl.systems.material;if(i){if(i===this.textureSrc)return;this.textureSrc=i,o.srcLoader.validateSrc(i,function(i){n.loadImage(t,r,e,i)},function(i){n.loadVideo(t,r,e,i)})}else o.material.updateMaterialTexture(r,null)},updateMaterial:function(e){var t=this.material;e=i(e),Object.keys(e).forEach(function(i){t[i]=e[i]})},updateEnvMap:function(e){var t=this,i=this.material,r=e.envMap;return!r||this.isLoadingEnvMap?(i.envMap=null,void(i.needsUpdate=!0)):(this.isLoadingEnvMap=!0,s[r]?void s[r].then(function(e){t.isLoadingEnvMap=!1,i.envMap=e,i.needsUpdate=!0}):void(s[r]=new Promise(function(e){o.srcLoader.validateCubemapSrc(r,function(r){a.load(r,function(r){t.isLoadingEnvMap=!1,i.envMap=r,e(r)})})})))}})},{"../core/shader":63,"../lib/three":90,"../utils/":102}],94:[function(e,t){var i="html{bottom:0;left:0;position:fixed;right:0;top:0}body{height:100%;margin:0;overflow:hidden;padding:0;width:100%}.a-hidden{display:none!important}.a-canvas{height:100%;left:0;position:absolute;top:0;width:100%}a-assets,a-scene img,a-scene video{display:none}.a-enter-vr{align-items:flex-end;-webkit-align-items:flex-end;bottom:5px;display:flex;display:-webkit-flex;font-family:sans-serif,monospace;font-size:13px;font-weight:200;line-height:16px;height:72px;position:fixed;right:5px}.a-enter-vr-button{background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20245.82%20141.73%22%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill%3A%23fff%3Bfill-rule%3Aevenodd%3B%7D%3C%2Fstyle%3E%3C%2Fdefs%3E%3Ctitle%3Emask%3C%2Ftitle%3E%3Cpath%20class%3D%22a%22%20d%3D%22M175.56%2C111.37c-22.52%2C0-40.77-18.84-40.77-42.07S153%2C27.24%2C175.56%2C27.24s40.77%2C18.84%2C40.77%2C42.07S198.08%2C111.37%2C175.56%2C111.37ZM26.84%2C69.31c0-23.23%2C18.25-42.07%2C40.77-42.07s40.77%2C18.84%2C40.77%2C42.07-18.26%2C42.07-40.77%2C42.07S26.84%2C92.54%2C26.84%2C69.31ZM27.27%2C0C11.54%2C0%2C0%2C12.34%2C0%2C28.58V110.9c0%2C16.24%2C11.54%2C30.83%2C27.27%2C30.83H99.57c2.17%2C0%2C4.19-1.83%2C5.4-3.7L116.47%2C118a8%2C8%2C0%2C0%2C1%2C12.52-.18l11.51%2C20.34c1.2%2C1.86%2C3.22%2C3.61%2C5.39%2C3.61h72.29c15.74%2C0%2C27.63-14.6%2C27.63-30.83V28.58C245.82%2C12.34%2C233.93%2C0%2C218.19%2C0H27.27Z%22%2F%3E%3C%2Fsvg%3E) 50% 50%/70% 70% no-repeat rgba(0,0,0,.35);border:0;bottom:0;color:#FFF;cursor:pointer;height:50px;position:absolute;right:0;transition:background-color .05s ease;-webkit-transition:background-color .05s ease;width:60px;z-index:999999}.a-enter-vr-button:active,.a-enter-vr-button:hover{background-color:#666}[data-a-enter-vr-no-webvr] .a-enter-vr-button{border-color:#666;opacity:.65}[data-a-enter-vr-no-webvr] .a-enter-vr-button:active,[data-a-enter-vr-no-webvr] .a-enter-vr-button:hover{background-color:rgba(0,0,0,.35);cursor:not-allowed}.a-enter-vr-modal{background-color:#666;border-radius:0;color:#FFF;height:32px;margin-right:70px;padding:9px;width:280px;position:relative;display:none}.a-enter-vr-modal:after{border-bottom:10px solid transparent;border-left:10px solid #666;border-top:10px solid transparent;display:inline-block;content:'';position:absolute;right:-5px;top:5px;width:0;height:0}.a-enter-vr-modal p{margin:0;display:inline}.a-enter-vr-modal p:after{content:' '}.a-enter-vr-modal a{color:#FFF;display:inline}[data-a-enter-vr-no-headset].a-enter-vr:hover .a-enter-vr-modal,[data-a-enter-vr-no-webvr].a-enter-vr:hover .a-enter-vr-modal{display:block}.a-orientation-modal{position:absolute;width:100%;height:100%;top:0;left:0;background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center center/50% 50% no-repeat rgba(244,244,244,1)}.a-orientation-modal:after{display:block;content:\"Insert phone into Cardboard holder.\";color:#333;font-family:sans-serif,monospace;font-size:13px;text-align:center;position:absolute;width:100%;top:70%;transform:translateY(-70%)}.a-orientation-modal button{background:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E);width:50px;height:50px;border:none;text-indent:-9999px}@media (min-width:480px){.a-enter-vr{bottom:20px;right:20px}.a-enter-vr-modal{width:400px}}";e("browserify-css").createStyle(i,{href:"src/style/aframe.css"}),t.exports=i},{"browserify-css":1}],95:[function(e,t){var i=".rs-base{background-color:#EF2D5E;border-radius:0;font:10px monospace;left:5px;line-height:1em;opacity:.75;overflow:hidden;padding:10px;position:fixed;top:5px;width:300px;z-index:10000}.rs-base div.hidden{display:none}.rs-base h1{color:#fff;cursor:pointer;font-size:1.4em;font-weight:300;margin:0 0 5px;padding:0}.rs-group{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column-reverse;flex-direction:column-reverse;margin-bottom:5px}.rs-group:last-child{margin-bottom:0}.rs-counter-base{align-items:center;display:-webkit-box;display:-webkit-flex;display:flex;height:10px;-webkit-justify-content:space-between;justify-content:space-between;margin:2px 0}.rs-counter-id{font-weight:300;-webkit-box-ordinal-group:0;-webkit-order:0;order:0;width:50px}.rs-counter-value{font-weight:300;-webkit-box-ordinal-group:1;-webkit-order:1;order:1;text-align:right;width:35px}.rs-canvas{-webkit-box-ordinal-group:2;-webkit-order:2;order:2}@media (min-width:480px){.rs-base{left:20px;top:20px}}";e("browserify-css").createStyle(i,{href:"src/style/rStats.css"}),t.exports=i},{"browserify-css":1}],96:[function(e,t){function i(e){var t,i=e.camera;i&&(t=e.querySelector("["+n+"]"),t&&e.removeChild(t))}var r=e("../core/system").registerSystem,n="data-aframe-default-camera";t.exports.System=r("camera",{init:function(){this.activeCameraEl=null,this.setupDefaultCamera()},setupDefaultCamera:function(){var e,t,i=this.sceneEl;setTimeout(function(){var r=i.querySelector("[camera]");return r&&r.isEntity?void i.emit("camera-ready",{cameraEl:r}):(e=document.createElement("a-entity"),e.setAttribute("position",{x:0,y:1.8,z:4}),e.setAttribute(n,""),t=document.createElement("a-entity"),t.setAttribute("camera",{active:!0}),t.setAttribute("wasd-controls"),t.setAttribute("look-controls"),e.appendChild(t),i.appendChild(e),void i.emit("camera-ready",{cameraEl:t}))})},disableActiveCamera:function(){var e=this.sceneEl,t=e.querySelectorAll("[camera]"),i=t[t.length-1];i.setAttribute("camera","active",!0)},setActiveCamera:function(e,t){var r,o,a=this.sceneEl,s=a.querySelectorAll("[camera]"),c=a.querySelector("["+n+"]"),h=c&&c.querySelector("[camera]");for(e!==h&&i(a),this.activeCameraEl=e,a.isPlaying&&e.play(),e.setAttribute("camera","active",!0),a.camera=t,a.emit("camera-set-active",{cameraEl:e}),o=0;o<s.length;o++)r=s[o],e!==r&&(r.setAttribute("camera","active",!1),r.pause())}})},{"../core/system":64}],97:[function(e){e("./camera"),e("./material"),e("./light")},{"./camera":96,"./light":98,"./material":99}],98:[function(e,t){var i=e("../core/system").registerSystem,r="data-aframe-default-light";t.exports.System=i("light",{init:function(){this.defaultLightsEnabled=null,this.setupDefaultLights()},registerLight:function(e){var t,i=this.sceneEl;if(this.defaultLightsEnabled&&!e.hasAttribute(r)){t=document.querySelectorAll("["+r+"]");for(var n=0;n<t.length;n++)i.removeChild(t[n]);this.defaultLightsEnabled=!1}},setupDefaultLights:function(){var e=this.sceneEl,t=document.createElement("a-entity"),i=document.createElement("a-entity");t.setAttribute("light",{color:"#fff",type:"ambient"}),t.setAttribute(r,""),e.appendChild(t),i.setAttribute("light",{color:"#fff",intensity:.2}),i.setAttribute("position",{x:-1,y:2,z:1}),i.setAttribute(r,""),e.appendChild(i),this.defaultLightsEnabled=!0}})},{"../core/system":64}],99:[function(e,t){function i(e){var t,i,r,n=e.getAttribute("id");if(n)return n;for(i="",r={},t=0;t<e.attributes.length;t++)r[e.attributes[t].name]=e.attributes[t].value;return Object.keys(r).sort().forEach(function(e){i+=e+":"+r[e]+";"}),i}function r(e,t,i){function r(e){function r(t){var r;t instanceof s.Texture||(t=new s.Texture(t)),r=i.split(" "),2===r.length&&(t.wrapS=s.RepeatWrapping,t.wrapT=s.RepeatWrapping,t.repeat.set(parseInt(r[0],10),parseInt(r[1],10))),e(t)}var n="string"!=typeof t;return n?void r(t):void d.load(t,r,function(){},function(e){u("`$s` could not be fetched (Error code: %s; Response: %s)",e.status,e.statusText)})}return new Promise(r)}function n(e,t,i,r){var n=e.videoEl||document.createElement("video");return n.width=i,n.height=r,n!==this.videoEl&&(n.setAttribute("webkit-playsinline",""),n.autoplay=!0,n.loop=!0,n.crossOrigin=!0,n.addEventListener("error",function(){p("`$s` is not a valid video",t)},!0),e.videoEl=n),n.src=t,n}function o(e){return e.autoplay="false"!==e.getAttribute("autoplay"),e.controls="false"!==e.getAttribute("controls"),"false"===e.getAttribute("loop")&&e.removeAttribute("loop"),"false"===e.getAttribute("preload")&&(e.preload="none"),e.crossOrigin=!0,e.setAttribute("webkit-playsinline",""),e}var a=e("../core/system").registerSystem,s=e("../lib/three"),c=e("../utils/"),h={TEXTURE_LOADED:"material-texture-loaded"},l=c.debug,u=l("components:texture:error"),d=new s.TextureLoader,p=l("components:texture:warn");t.exports.System=a("material",{init:function(){this.materials={},this.textureCache={}},clearTextureCache:function(){this.textureCache={}},loadImage:function(e,t,i,n){function o(i){c.material.updateMaterialTexture(t,i),e.emit(h.TEXTURE_LOADED,{src:n,texture:i})}var a=i.repeat||"1 1",s=n,l=this.textureCache;return"string"!=typeof n&&(s=n.getAttribute("src")),l[n]&&l[n][a]?void l[n][a].then(o):(l[s]=l[s]||{},l[s][a]=l[s][a]||{},l[s][a]=r(t,n,a),void l[s][a].then(o))},loadVideo:function(e,t,r,a){function l(i){d=i.texture,p=i.videoEl,c.material.updateMaterialTexture(t,d),e.emit(h.TEXTURE_LOADED,{element:p,src:a}),p.addEventListener("loadeddata",function(){e.emit("material-video-loadeddata",{element:p,src:a})}),p.addEventListener("ended",function(){e.emit("material-video-ended",{element:p,src:a})})}var u,d,p,f,m=this.textureCache;if("string"!=typeof a){if(p=a,u=i(p),m[u])return void m[u].then(l);o(p)}return p=p||n(t,a,r.width,r.height),u=i(p),m[u]?void m[u].then(l):(d=new s.VideoTexture(p),d.minFilter=s.LinearFilter,f={texture:d,videoEl:p},m[u]=Promise.resolve(f),void l(f))},registerMaterial:function(e){this.materials[e.uuid]=e},unregisterMaterial:function(e){delete this.materials[e.uuid]},updateMaterials:function(){var e=this.materials;Object.keys(e).forEach(function(t){e[t].needsUpdate=!0})}})},{"../core/system":64,"../lib/three":90,"../utils/":102}],100:[function(e,t){function i(e,t){var i,r={};return e&&"object"==typeof e?n(e):"string"!=typeof e||null===e?t:(i=e.trim().replace(/\s+/g," ").split(" "),r.x=i[0]||t&&t.x,r.y=i[1]||t&&t.y,r.z=i[2]||t&&t.z,r.w=i[3]||t&&t.w,n(r))}function r(e){return"object"!=typeof e?e:[e.x,e.y,e.z].join(" ")}function n(e){return Object.keys(e).forEach(function(t){return void 0===e[t]?void delete e[t]:void(e[t]=parseFloat(e[t],10))}),e}var o=/\s*(-?\d*\.{0,1}\d+)\s*(-?\d*\.{0,1}\d+)\s*(-?\d*\.{0,1}\d+)\s*/;t.exports.regex=o,t.exports.parse=i,t.exports.stringify=r,t.exports.isCoordinate=function(e){return o.test(e)}},{}],101:[function(e,t){(function(i){function r(e){var t=e.split(":");return t[t.length-1]}function n(e){var t=r(e),i=c.colors&&c.colors[t];return i||null}function o(){try{return window.localStorage}catch(e){}}var a=e("debug"),s=e("object-assign"),c={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}},h=function(e){var t=a(e);return t.color=n(e),t};s(h,a);
var l=o();h.enable(l&&(parseInt(l.logs,10)||"true"===l.logs)?"*":"*:error,*:info,*:warn"),i.browser&&(window.logs=h),t.exports=h}).call(this,e("_process"))},{_process:2,debug:3,"object-assign":9}],102:[function(e,t){function i(e,t){var i,r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;if(0===r.length)return e===t;for(i=0;i<r.length;++i)if(e[r[i]]!==t[r[i]])return!1;return!0}var r=e("deep-assign"),n=e("object-assign");t.exports.coordinates=e("./coordinates"),t.exports.debug=e("./debug"),t.exports.material=e("./material"),t.exports.styleParser=e("./styleParser"),t.exports.fireEvent=function(e,t,i){i=i||{},i.detail=i.detail||{},i.detail.target=i.detail.target||e;var r=new CustomEvent(t,i);r.target=e,e.dispatchEvent(r)},t.exports.error=function(e){throw new Error(e)},t.exports.warn=function(){console.warn.apply(console,arguments)},t.exports.log=function(){console.log.apply(console,arguments)},t.exports.extend=n,t.exports.extendDeep=r,t.exports.deepEqual=i,t.exports.diff=function(e,t){var r={},n=Object.keys(e);return Object.keys(t).forEach(function(e){-1===n.indexOf(e)&&n.push(e)}),n.forEach(function(n){var o=e[n],a=t[n],s=o&&a&&o.constructor===Object&&a.constructor===Object;(s&&!i(o,a)||!s&&o!==a)&&(r[n]=a)}),r},t.exports.isMobile=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),o()&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e};var o=t.exports.isIOS=function(){return/iPad|iPhone|iPod/.test(navigator.platform)};t.exports.isLandscape=function(){return 90===window.orientation||-90===window.orientation},t.exports.shouldCaptureKeyEvent=function(e){return e.shiftKey||e.metaKey||e.altKey||e.ctrlKey?!1:document.activeElement===document.body},t.exports.splitString=function(e,t){"undefined"==typeof t&&(t=" ");var i=new RegExp(t,"g");return e=(e||"").replace(i,t),e.split(t)},t.exports.getElData=function(e,t){function i(t){e.hasAttribute(t)&&(r[t]=e.getAttribute(t))}t=t||{};var r={};return Object.keys(t).forEach(i),r},t.exports.getUrlParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),i=t.exec(location.search);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))},t.exports.isIframed=function(){return window.top!==window.self},t.exports.srcLoader=e("./src-loader")},{"./coordinates":100,"./debug":101,"./material":103,"./src-loader":104,"./styleParser":105,"deep-assign":6,"object-assign":9}],103:[function(e,t){t.exports.updateMaterialTexture=function(e,t){var i=e.map;t&&(t.needsUpdate=!0),e.map=t,(null===i&&e.map||null===e.map&&i)&&(e.needsUpdate=!0)}},{}],104:[function(e,t){function i(e,t,i){var r,s,h,l=n(e);return l?void o(l,function(e){return e?void t(l):void i(l)}):(r=a(e))?(s=r&&"IMG"===r.tagName,h=r&&"VIDEO"===r.tagName,s?t(r):h?i(r):void c('"%s" does not point to a valid <img> or <video> element',e)):void 0}function r(e,t){function r(e){l.push(e),6===l.length&&t(l)}var n,o,s,h="",l=[];for(o=0;6>o;o++)h+="url((.+))s*,s*";if(s=e.match(h))for(o=1;7>o;o++)i(s[o],r);else if(n=a(e))return"A-CUBEMAP"===n.tagName&&n.srcs?t(n.srcs):void c('Selector "%s" does not point to <a-cubemap>',e)}function n(e){var t=e.match(/\url\((.+)\)/);if(t)return t[1]}function o(e,t){function i(){t(!0)}function r(){t(!1)}var n=new Image;n.addEventListener("load",i),n.addEventListener("error",r),n.src=e}function a(e){try{var t=document.querySelector(e);return t||c('No element was found matching the selector: "%s"',e),t}catch(i){return void c('"%s" is not a valid selector',e)}}var s=e("./debug"),c=s("utils:src-loader:warn");t.exports={parseUrl:n,validateSrc:i,validateCubemapSrc:r}},{"./debug":101}],105:[function(e,t){function i(e){function t(e){return e[1].toUpperCase()}return e.replace(/-([a-z])/g,t)}function r(e){var t=Object.keys(e),r={};return t.forEach(function(t){var n=i(t);r[n]=e[t]}),r}var n=e("style-attr");t.exports.parse=function(e){var t;return"string"!=typeof e?e:(t=n.parse(e),r(t))},t.exports.stringify=function(e){return"string"==typeof e?e:n.stringify(e)},t.exports.toCamelCase=i,t.exports.transformKeysToCamelCase=r},{"style-attr":15}],106:[function(e,t){window.glStats=function(){function e(e,t){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function t(){o("allcalls").set(a+s),o("drawElements").set(s),o("drawArrays").set(a),o("bindTexture").set(d),o("useProgram").set(c),o("glfaces").set(h),o("glvertices").set(l),o("glpoints").set(u)}function i(){a=0,s=0,c=0,h=0,l=0,u=0,d=0}function r(){}function n(e){o=e}var o=null,a=0,s=0,c=0,h=0,l=0,u=0,d=0;WebGLRenderingContext.prototype.drawArrays=e(WebGLRenderingContext.prototype.drawArrays,function(){a++,arguments[0]==this.POINTS?u+=arguments[2]:l+=arguments[2]}),WebGLRenderingContext.prototype.drawElements=e(WebGLRenderingContext.prototype.drawElements,function(){s++,h+=arguments[1]/3,l+=arguments[1]}),WebGLRenderingContext.prototype.useProgram=e(WebGLRenderingContext.prototype.useProgram,function(){c++}),WebGLRenderingContext.prototype.bindTexture=e(WebGLRenderingContext.prototype.bindTexture,function(){d++});var p={allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},f=[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],m=[{base:"allcalls",steps:["drawelements","drawarrays"]}];return{update:t,start:i,end:r,attach:n,values:p,groups:f,fractions:m}},window.threeStats=function(e){function t(){o("renderer.info.memory.geometries").set(e.info.memory.geometries),o("renderer.info.memory.programs").set(e.info.memory.programs),o("renderer.info.memory.textures").set(e.info.memory.textures),o("renderer.info.render.calls").set(e.info.render.calls),o("renderer.info.render.faces").set(e.info.render.faces),o("renderer.info.render.points").set(e.info.render.points),o("renderer.info.render.vertices").set(e.info.render.vertices)}function i(){}function r(){}function n(e){o=e}var o=null,a={"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.memory.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.faces":{caption:"Faces",over:1e3},"renderer.info.render.points":{caption:"Points"},"renderer.info.render.vertices":{caption:"Vertices"}},s=[{caption:"Three.js - memory",values:["renderer.info.memory.geometries","renderer.info.memory.programs","renderer.info.memory.textures"]},{caption:"Three.js - render",values:["renderer.info.render.calls","renderer.info.render.faces","renderer.info.render.points","renderer.info.render.vertices"]}],c=[];return{update:t,start:i,end:r,attach:n,values:a,groups:s,fractions:c}},window.BrowserStats=function(){function e(e){var t=100,i=Math.floor(Math.log(e)/u);return Math.round(e*t/Math.pow(1024,i))/t}function t(){a=e(performance.memory.usedJSHeapSize),s=e(performance.memory.totalJSHeapSize),o("memory").set(a),o("total").set(s)}function i(){a=0}function r(){}function n(e){o=e}var o=null,a=0,s=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var c={memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},h=[{caption:"Browser",values:["memory","total"]}],l=[{base:"total",steps:["memory"]}],u=Math.log(1024);return{update:t,start:i,end:r,attach:n,values:c,groups:h,fractions:l}},"object"==typeof t&&(t.exports={aframeStats:window.aframeStats,glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats})},{}],107:[function(e,t){"use strict";!function(){if("undefined"==typeof window.performance&&(window.performance={}),!window.performance.now){var e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-e}}window.performance.mark||(window.performance.mark=function(){}),window.performance.measure||(window.performance.measure=function(){})}(),window.rStats=function(e){function t(e,t){for(var i=Object.keys(e),r=0,n=i.length;n>r;r++)t(i[r])}function i(e){var t=document.createElement("link");t.href=e,t.rel="stylesheet",t.type="text/css",document.getElementsByTagName("head")[0].appendChild(t)}function r(e,t,i){function r(){a.width=g,a.height=v,a.style.width=a.width+"px",a.style.height=a.height+"px",a.className="rs-canvas",e.appendChild(a),s.fillStyle="#444444",s.fillRect(0,0,a.width,a.height)}function n(e,t){h+=.1*(e-h),c*=.99,h>c&&(c=h),s.drawImage(a,1,0,a.width-1,a.height,0,0,a.width-1,a.height),t?s.drawImage(p,a.width-1,a.height-h*a.height/c-v):s.drawImage(u,a.width-1,a.height-h*a.height/c-v)}var o=i||{},a=document.createElement("canvas"),s=a.getContext("2d"),c=0,h=0,l=o.color?o.color:"#666666",u=document.createElement("canvas"),d=u.getContext("2d");u.width=1,u.height=2*v,d.fillStyle="#444444",d.fillRect(0,0,1,2*v),d.fillStyle=l,d.fillRect(0,v,1,v),d.fillStyle="#ffffff",d.globalAlpha=.5,d.fillRect(0,v,1,1),d.globalAlpha=1;var p=document.createElement("canvas"),f=p.getContext("2d");return p.width=1,p.height=2*v,f.fillStyle="#444444",f.fillRect(0,0,1,2*v),f.fillStyle="#b70000",f.fillRect(0,v,1,v),f.globalAlpha=.5,f.fillStyle="#ffffff",f.fillRect(0,v,1,1),f.globalAlpha=1,r(),{draw:n}}function n(e,i){function r(){o.width=g,o.height=v*i,o.style.width=o.width+"px",o.style.height=o.height+"px",o.className="rs-canvas",e.appendChild(o),a.fillStyle="#444444",a.fillRect(0,0,o.width,o.height)}function n(e){a.drawImage(o,1,0,o.width-1,o.height,0,0,o.width-1,o.height);var i=0;t(e,function(t){var r=e[t]*o.height;a.fillStyle=l[t],a.fillRect(o.width-1,i,1,r),i+=r})}var o=document.createElement("canvas"),a=o.getContext("2d");return r(),{draw:n}}function o(e,t){function i(e){if(E&&E.average){g+=e,x++;var t=performance.now();t-y>=(E.avgMs||1e3)&&(v=g/x,g=0,y=t,x=0)}}function n(){u=performance.now(),h.userTimingAPI&&performance.mark(d+"-start"),S=!0}function o(){p=performance.now()-u,h.userTimingAPI&&(performance.mark(d+"-end"),S&&performance.measure(d,d+"-start",d+"-end")),i(p)}function a(){o(),n()}function s(){var e=E&&E.average?v:p;_.nodeValue=Math.round(100*e)/100;var t=E&&(E.below&&p<E.below||E.over&&p>E.over);A.draw(p,t),b.style.color=t?"#b70000":"#ffffff"}function c(){var e=performance.now(),t=e-u;f++,t>1e3&&(p=E&&E.interpolate===!1?f:1e3*f/t,f=0,u=e,i(p))}function l(e){p=e,i(p)}var u,d=e,p=0,f=0,v=0,g=0,y=performance.now(),x=0,b=document.createElement("div"),w=document.createElement("span"),M=document.createElement("div"),_=document.createTextNode(""),E=h?h.values[d.toLowerCase()]:null,A=new r(b,d,E),S=!1;return b.className="rs-counter-base",w.className="rs-counter-id",w.textContent=E&&E.caption?E.caption:d,M.className="rs-counter-value",M.appendChild(_),b.appendChild(w),b.appendChild(M),t?t.div.appendChild(b):m.appendChild(b),u=performance.now(),{set:l,start:n,tick:a,end:o,frame:c,value:function(){return p},draw:s}}function a(e){var i=e.toLowerCase();if(void 0===i&&(i="default"),y[i])return y[i];var r=null;h&&h.groups&&t(h.groups,function(e){var t=h.groups[parseInt(e,10)];r||-1===t.values.indexOf(i.toLowerCase())||(r=t)});var n=new o(i,r);return y[i]=n,n}function s(){if(h.plugins){h.values||(h.values={}),h.groups||(h.groups=[]),h.fractions||(h.fractions=[]);for(var e=0;e<h.plugins.length;e++)h.plugins[e].attach(a),t(h.plugins[e].values,function(t){h.values[t]=h.plugins[e].values[t]}),h.groups=h.groups.concat(h.plugins[e].groups),h.fractions=h.fractions.concat(h.plugins[e].fractions)}else h.plugins={};f=document.createElement("div"),f.className="rs-base",m=document.createElement("div"),m.className="rs-container",m.style.height="auto",f.appendChild(m),document.body.appendChild(f),h&&(h.groups&&t(h.groups,function(e){var t=h.groups[parseInt(e,10)],i=document.createElement("div");i.className="rs-group",t.div=i;var r=document.createElement("h1");r.textContent=t.caption,r.addEventListener("click",function(e){this.classList.toggle("hidden"),e.preventDefault()}.bind(i)),m.appendChild(r),m.appendChild(i)}),h.fractions&&t(h.fractions,function(e){var i=h.fractions[parseInt(e,10)],r=document.createElement("div");r.className="rs-fraction";var o=document.createElement("div");o.className="rs-legend";var a=0;t(h.fractions[e].steps,function(t){var i=document.createElement("p");i.textContent=h.fractions[e].steps[t],i.style.color=l[a],o.appendChild(i),a++}),r.appendChild(o),r.style.height=a*v+"px",i.div=r;var s=new n(r,a);i.graph=s,m.appendChild(r)}))}function c(){t(h.plugins,function(e){h.plugins[e].update()}),t(y,function(e){y[e].draw()}),h&&h.fractions&&t(h.fractions,function(e){var i=h.fractions[parseInt(e,10)],r=[],n=y[i.base.toLowerCase()];n&&(n=n.value(),t(h.fractions[e].steps,function(t){var i=h.fractions[e].steps[parseInt(t,10)].toLowerCase(),o=y[i];o&&r.push(o.value()/n)})),i.graph.draw(r)})}var h=e||{},l=h.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],u="//fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",d=(h.CSSPath?h.CSSPath:"")+"rStats.css",p=h.css||[u,d];p.forEach(function(e){i(e)}),h.values||(h.values={});var f,m,v=10,g=200,y={};return s(),function(e){return e?a(e):{element:f,update:c}}},"object"==typeof t&&(t.exports=window.rStats)},{}],108:[function(e,t){var i={};i.base64=function(e,t){return"data:"+e+";base64,"+t},i.isMobile=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},i.isIOS=function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},i.isIFrame=function(){try{return window.self!==window.top}catch(e){return!0}},i.appendQueryParameter=function(e,t,i){var r=e.indexOf("?")<0?"?":"&";return e+=r+t+"="+i},i.getQueryParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),i=t.exec(location.search);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))},i.isLandscapeMode=function(){return 90==window.orientation||-90==window.orientation},t.exports=i},{}],109:[function(e,t){function i(){var e=document.createElement("video");e.addEventListener("ended",function(){e.play()}),this.request=function(){e.paused&&(e.src=o.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),e.play())},this.release=function(){e.pause(),e.src=""}}function r(){var e=null;this.request=function(){e||(e=setInterval(function(){window.location=window.location,setTimeout(window.stop,0)},3e4))},this.release=function(){e&&(clearInterval(e),e=null)}}function n(){var e=navigator.userAgent||navigator.vendor||window.opera;return e.match(/iPhone/i)||e.match(/iPod/i)?r:i}var o=e("./util.js");t.exports=n()},{"./util.js":108}]},{},[88])(88)});
<!DOCTYPE html>
<meta charset="utf-8">
<title>Quadtree</title>
<style>
svg {
width: 960px;
height: 800px;
}
#mycanvas {
position: absolute;
top: 20px;
right: 20px;
width: 400px;
height: 400px;
}
.point {
fill: #999;
stroke: #fff;
pointer-events: none;
}
.point.scanned {
fill: orange;
fill-opacity: 1;
stroke: brown;
}
.point.selected {
fill: red;
fill-opacity: 1;
}
.node.selected {
stroke: red;
}
.leaf.selected rect {
stroke: red;
}
.leaf.selected circle {
fill: red;
}
.leaf rect.highlighted {
fill: #2ae8e2;
}
.leaf circle {
stroke: #fff;
fill: #999;
}
.leaf rect {
stroke: #111;
fill: #83979a;
}
.branch {
fill: none;
stroke: #111;
stroke-width: 3;
}
.branch.selected {
stroke: red;
}
.node {
fill: #83979a;
stroke: #ccc;
shape-rendering: crispEdges;
}
.node.highlighted {
fill: #5cf9e6;
}
.overlay {
fill: none;
pointer-events: all;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="aframe.min.js"></script>
<body>
<a-scene canvas="canvas: #mycanvas">
<canvas id="mycanvas"></canvas>
<a-entity position="0 0 0.8">
<a-entity rotation="0 0 0">
<a-entity camera look-controls wasd-controls></a-entity>
</a-entity>
</a-entity>
<a-light color="#9ddce6" position="-1 -3 2" intensity="0.3" type="hemisphere"></a-light>
<a-light color="#36e78e" position="1 3 2" intensity="0.3" type="hemisphere"></a-light>
<a-light color="#9ddce6" position="1 3 -2" intensity="0.5" type="directional"></a-light>
<!-- Sky -->
<a-sky color="#ecfcf4"></a-sky>
</a-scene>
<script>
d3.selection.prototype.moveToFront = function() {
return this.each(function(){
this.parentNode.appendChild(this);
});
};
var width = 400,
height = 400;
var cubeColor = "#c6c6c6"
var cubeDepth = 0.1;
var nodeHighlightColor = "#2ae8e2"
var leafSize = 16;
// scale x,y in a-frame
var axscale = d3.scale.linear()
.domain([0, width])
.range([-1, 1])
var ayscale = d3.scale.linear()
.domain([0, height])
.range([1, -1])
var data = d3.range(25).map(function(i) {
return {
id: i,
x:Math.random() * width,
y:Math.random() * height
};
});
var diagonal = d3.svg.diagonal()
.projection(function(d) { return [d.x, d.y]; });
var quadtree = d3.geom.quadtree()
.extent([[-1, -1], [width + 1, height + 1]])
.x(function(d) { return d.x })
.y(function(d) { return d.y })
(data);
function walkTree(node) {
var nodes = [];
if(node.nodes && node.nodes.length) {
node.nodes.forEach(function(d) {
if(d) {
nodes.push(walkTree(d))
}
})
}
var newNode = {
leaf: node.leaf,
point: node.point,
x0: node.x0,
x1: node.x1,
y0: node.y0,
y1: node.y1
}
if(nodes.length) newNode.nodes = nodes;
return newNode;
}
var tree = d3.layout.tree()
.size([940, 250])
.children(function(d) {
return d.nodes;
})
var rects = nodes(quadtree)
console.log("quadtree", quadtree, rects);
var copy = walkTree(quadtree)
//copy.visit = quadtree.visit; //jank because i want depth on my nodes
var leaves = tree.nodes(copy)
var branches = tree.links(leaves)
console.log("copy", copy)
console.log("leaves", leaves, "branches\n", branches);
// not a self contained recursive function, oh well
var flattened = [];
function flattenTree(node) {
if(node.nodes && node.nodes.length) {
node.nodes.forEach(function(d) {
if(d) {
flattenTree(d)
}
})
}
var newNode = {
depth: node.depth,
leaf: node.leaf,
point: node.point,
x0: node.x0,
x1: node.x1,
y0: node.y0,
y1: node.y1
}
flattened.push(newNode)
}
flattenTree(copy);
console.log("flattened", flattened)
var svg = d3.select("body").append("svg")
var twodgroup = svg.append("g").classed("twodgroup", true)
.attr("transform", "translate(20, 20)")
var squares = twodgroup.selectAll(".node")
.data(flattened.reverse())
squares
.enter().append("rect")
.attr("class", "node")
.attr("x", function(d) { return d.x0; })
.attr("y", function(d) { return d.y0; })
.attr("width", function(d) { return d.y1 - d.y0; })
.attr("height", function(d) { return d.x1 - d.x0; })
.on("mousemove", function(d){
var x = getX(d)
var y = getY(d)
var w = getWidth(d)
var h = getHeight(d)
//console.log(d, x, y ,w , h)
squares.classed("highlighted", false)
d3.select(this).classed("highlighted", true)
d3.selectAll("a-box")
.attr({
// opacity: 0.3
color: cubeColor
})
.filter(function(f) { return f === d})
.attr({
// opacity: 1
color: nodeHighlightColor
})
d3.selectAll(".leaf rect")
.classed("highlighted", false)
.filter(function(l,i) {
return (l.depth === d.depth
&& l.x0 === d.x0
&& l.y0 === d.y0
&& l.x1 === d.x1
&& l.y1 === d.y1)
})
.classed("highlighted", true)
})
var point = twodgroup.selectAll(".point")
.data(data)
.enter().append("circle")
.attr("class", "point")
.attr("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; })
.attr("r", 4);
/*
twodgroup.append("rect")
.attr("class", "overlay")
.attr("width", width)
.attr("height", height)
.on("mousemove", mousemoved);
*/
twodgroup.on("mousemove", mousemoved)
var treegroup = svg.append("g")
.attr("transform", "translate(10, 520)")
var branch = treegroup.selectAll(".branch")
.data(branches)
.enter().append("path").classed("branch", true)
.attr({
d: diagonal
})
var leaf = treegroup.selectAll(".leaf")
.data(leaves)
var leafEnter = leaf
.enter().append("g")
.classed("leaf", true)
.attr("transform", function(d) {
var x = d.x - leafSize/2
var y = d.y - leafSize/2
return "translate(" + [x,y] + ")"
})
leafEnter.append("rect")
.attr({
//x: function(d) { return d.x - leafSize/2},
//y: function(d) { return d.y - leafSize/2},
width: leafSize,
height: leafSize,
})
leafEnter.append("circle")
.attr({
cx: leafSize/2,
cy: leafSize/2,
r: function(d) { return d.leaf ? 4: 0 }
})
var scene = d3.select('a-scene');
if (scene.node().hasLoaded) {
renderScene();
} else {
scene.on('loaded', renderScene);
}
function getX(d) {
var x = axscale(d.x0) + getWidth(d)/2;
return x
}
function getY(d) {
var y = ayscale(d.y0) - getHeight(d)/2;
return y;
}
function getWidth(d) {
var w = Math.abs(d.x1 - d.x0)/width
return 2*w;
}
function getHeight(d) {
var h = Math.abs(d.y1 - d.y0)/height
return 2*h;
}
function renderScene() {
var cubes = scene.selectAll("a-box.rect")
.data(flattened)
cubes.enter().append("a-box")
.attr({
width: function(d) {
return getWidth(d)
},
height: function(d) {
//return cubeDepth
return getHeight(d)
},
depth: function(d) {
//return getHeight(d)
return cubeDepth
},
opacity: 1,
color: cubeColor,
position: function(d) {
//var x = ascale((d.x0 + d.x1)/2);
//var y = ascale((d.y0 + d.y1)/2);
var x = getX(d)
var y = getY(d)
var z = -1 + d.depth * cubeDepth;
return [x,y,z].join(" ")
}
})
}
function paintParentPath(node) {
branch.filter(function(d) { return d.target === node})
.classed("selected", true)
.each(function(d) { if(d.source) paintParentPath(d.source) });
}
function mousemoved() {
var p = quadtree.find(d3.mouse(this));
point.classed("selected", function(d) { return d === p; });
//squares.classed("selected", function(d) { return d.point === p})
//.filter(function(d) { return d.point === p})
//.moveToFront();
leaf
.classed("selected", false)
.attr({r: 3})
.filter(function(d) { return d.point === p })
.classed("selected", true)
.attr({r: 6})
.moveToFront();
branch.classed("selected", false)
.filter(function(d) { return d.target.point === p})
.classed("selected", true)
.each(function(d) {
//console.log(d.target.parent)
if(d.source) paintParentPath(d.source)
})
}
// Collapse the quadtree into an array of rectangles.
function nodes(quadtree) {
var nodes = [];
quadtree.visit(function(node, x0, y0, x1, y1) {
node.x0 = x0, node.y0 = y0;
node.x1 = x1, node.y1 = y1;
nodes.push(node);
});
return nodes;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment