|
!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(o,s){if(!t[o]){if(!e[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=t[o]={exports:{}};e[o][0].call(l.exports,function(t){var i=e[o][1][t];return n(i?i:t)},l,l.exports,i,e,t,r)}return t[o].exports}for(var a="function"==typeof require&&require,o=0;o<r.length;o++)n(r[o]);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 a=t[n];r.setAttribute("data-"+n,a)}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 a=t[n];r.setAttribute("data-"+n,a)}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,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,a=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(n++,"%c"===e&&(a=n))}),e.splice(a,0,r),e}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(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=a,i.formatArgs=n,i.save=o,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":3}],3:[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,a=t-(u||t);e.diff=a,e.prev=u,e.curr=t,u=t,null==e.useColors&&(e.useColors=i.useColors()),null==e.color&&e.useColors&&(e.color=r());var o=Array.prototype.slice.call(arguments);o[0]=i.coerce(o[0]),"string"!=typeof o[0]&&(o=["%o"].concat(o));var s=0;o[0]=o[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var n=i.formatters[r];if("function"==typeof n){var a=o[s];t=n.call(e,a),o.splice(s,1),s--}return t}),"function"==typeof i.formatArgs&&(o=i.formatArgs.apply(e,o));var c=n.log||i.log||console.log.bind(console);c.apply(e,o)}t.enabled=!1,n.enabled=!0;var a=i.enabled(e)?n:t;return a.namespace=e,a}function a(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 o(){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=o,i.enable=a,i.enabled=s,i.humanize=e("ms"),i.names=[],i.skips=[],i.formatters={};var u,l=0},{ms:7}],4:[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(o.call(e,i)&&(void 0===e[i]||null===e[i]))throw new TypeError("Cannot convert undefined or null to object ("+i+")");e[i]=o.call(e,i)&&a(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)o.call(t,i)&&r(e,t,i);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(t),a=0;a<n.length;a++)s.call(t,n[a])&&r(e,t,n[a]);return e}var a=e("is-obj"),o=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":6}],5:[function(){!function(t,i,r,n){"use strict";function a(e,t){for(var i=0,r=e.length;r>i;i++)v(e[i],t)}function o(e){for(var t,i=0,r=e.length;r>i;i++)t=e[i],b(t,P[c(t)])}function s(e){return function(t){nt(t)&&(v(t,e),a(t.querySelectorAll(F),e))}}function c(e){var t=st.call(e,"is"),i=e.nodeName.toUpperCase(),r=V.call(U,t?k+t.toUpperCase():z+i);return t&&r>-1&&!u(i,t)?-1:r}function u(e,t){return-1<F.indexOf(e+'[is="'+t+'"]')}function l(e){var t=e.currentTarget,i=e.attrChange,r=e.attrName,n=e.target;vt&&(!n||n===t)&&t.attributeChangedCallback&&"style"!==r&&e.prevValue!==e.newValue&&t.attributeChangedCallback(r,i===e[S]?null:e.prevValue,i===e[I]?null:e.newValue)}function h(e){var t=s(e);return function(e){y.push(t,e.target)}}function d(e){gt&&(gt=!1,e.currentTarget.removeEventListener(_,d)),a((e.target||i).querySelectorAll(F),e.detail===N?N:L),rt&&m()}function p(e,t){var i=this;ct.call(i,e,t),M.call(i,{target:i})}function f(e,t){et(e,t),w?w.observe(e,ht):(mt&&(e.setAttribute=p,e[T]=x(e),e.addEventListener(O,M)),e.addEventListener(j,l)),e.createdCallback&&vt&&(e.created=!0,e.createdCallback(),e.created=!1)}function m(){for(var e,t=0,i=at.length;i>t;t++)e=at[t],G.contains(e)||(i--,at.splice(t--,1),v(e,N))}function g(e){throw new Error("A "+e+" type is already registered")}function v(e,t){var i,r=c(e);r>-1&&(E(e,P[r]),r=0,t!==L||e[L]?t===N&&!e[N]&&(e[L]=!1,e[N]=!0,r=1):(e[N]=!1,e[L]=!0,r=1,rt&&V.call(at,e)<0&&at.push(e)),r&&(i=e[t+"Callback"])&&i.call(e))}if(!(n in i)){var y,M,A,x,w,E,b,T="__"+n+(1e5*Math.random()>>0),L="attached",N="detached",D="extends",S="ADDITION",C="MODIFICATION",I="REMOVAL",j="DOMAttrModified",_="DOMContentLoaded",O="DOMSubtreeModified",z="<",k="=",R=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,B=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],U=[],P=[],F="",G=i.documentElement,V=U.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},Q=r.prototype,Y=Q.hasOwnProperty,H=Q.isPrototypeOf,W=r.defineProperty,X=r.getOwnPropertyDescriptor,q=r.getOwnPropertyNames,Z=r.getPrototypeOf,K=r.setPrototypeOf,J=!!r.__proto__,$=r.create||function yt(e){return e?(yt.prototype=e,new yt):this},et=K||(J?function(e,t){return e.__proto__=t,e}:q&&X?function(){function e(e,t){for(var i,r=q(t),n=0,a=r.length;a>n;n++)i=r[n],Y.call(e,i)||W(e,i,X(t,i))}return function(t,i){do e(t,i);while((i=Z(i))&&!H.call(i,t));return t}}():function(e,t){for(var i in t)e[i]=t[i];return e}),tt=t.MutationObserver||t.WebKitMutationObserver,it=(t.HTMLElement||t.Element||t.Node).prototype,rt=!H.call(it,G),nt=rt?function(e){return 1===e.nodeType}:function(e){return H.call(it,e)},at=rt&&[],ot=it.cloneNode,st=it.getAttribute,ct=it.setAttribute,ut=it.removeAttribute,lt=i.createElement,ht=tt&&{attributes:!0,characterData:!0,attributeOldValue:!0},dt=tt||function(){mt=!1,G.removeEventListener(j,dt)},pt=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,10)},ft=!1,mt=!0,gt=!0,vt=!0;K||J?(E=function(e,t){H.call(t,e)||f(e,t)},b=f):(E=function(e,t){e[T]||(e[T]=r(!0),f(e,t))},b=E),rt?(mt=!1,function(){var t=X(it,"addEventListener"),i=t.value,r=function(e){var t=new CustomEvent(j,{bubbles:!0});t.attrName=e,t.prevValue=st.call(this,e),t.newValue=null,t[I]=t.attrChange=2,ut.call(this,e),this.dispatchEvent(t)},n=function(t,i){var r=this.hasAttribute(t),n=r&&st.call(this,t);e=new CustomEvent(j,{bubbles:!0}),ct.call(this,t,i),e.attrName=t,e.prevValue=r?n:null,e.newValue=i,r?e[C]=e.attrChange=1:e[S]=e.attrChange=0,this.dispatchEvent(e)},a=function(e){var t,i=e.currentTarget,r=i[T],n=e.propertyName;r.hasOwnProperty(n)&&(r=r[n],t=new CustomEvent(j,{bubbles:!0}),t.attrName=r.name,t.prevValue=r.value||null,t.newValue=r.value=i[n]||null,null==t.prevValue?t[S]=t.attrChange=0:t[C]=t.attrChange=1,i.dispatchEvent(t))};t.value=function(e,t,o){e===j&&this.attributeChangedCallback&&this.setAttribute!==n&&(this[T]={className:{name:"class",value:this.className}},this.setAttribute=n,this.removeAttribute=r,i.call(this,"propertychange",a)),i.call(this,e,t,o)},W(it,"addEventListener",t)}()):tt||(G.addEventListener(j,dt),G.setAttribute(T,1),G.removeAttribute(T),mt&&(M=function(e){var t,i,r,n=this;if(n===e.target){t=n[T],n[T]=i=x(n);for(r in i){if(!(r in t))return A(0,n,r,t[r],i[r],S);if(i[r]!==t[r])return A(1,n,r,t[r],i[r],C)}for(r in t)if(!(r in i))return A(2,n,r,t[r],i[r],I)}},A=function(e,t,i,r,n,a){var o={attrChange:e,currentTarget:t,attrName:i,prevValue:r,newValue:n};o[a]=e,l(o)},x=function(e){for(var t,i,r={},n=e.attributes,a=0,o=n.length;o>a;a++)t=n[a],i=t.name,"setAttribute"!==i&&(r[i]=t.value);return r})),i[n]=function(e,t){if(r=e.toUpperCase(),ft||(ft=!0,tt?(w=function(e,t){function i(e,t){for(var i=0,r=e.length;r>i;t(e[i++]));}return new tt(function(r){for(var n,a,o,s=0,c=r.length;c>s;s++)n=r[s],"childList"===n.type?(i(n.addedNodes,e),i(n.removedNodes,t)):(a=n.target,vt&&a.attributeChangedCallback&&"style"!==n.attributeName&&(o=st.call(a,n.attributeName),o!==n.oldValue&&a.attributeChangedCallback(n.attributeName,n.oldValue,o)))})}(s(L),s(N)),w.observe(i,{childList:!0,subtree:!0})):(y=[],pt(function v(){for(;y.length;)y.shift().call(null,y.shift());pt(v)}),i.addEventListener("DOMNodeInserted",h(L)),i.addEventListener("DOMNodeRemoved",h(N))),i.addEventListener(_,d),i.addEventListener("readystatechange",d),i.createElement=function(e,t){var r=lt.apply(i,arguments),n=""+e,a=V.call(U,(t?k:z)+(t||n).toUpperCase()),o=a>-1;return t&&(r.setAttribute("is",t=t.toLowerCase()),o&&(o=u(n.toUpperCase(),t))),vt=!i.createElement.innerHTMLHelper,o&&b(r,P[a]),r},it.cloneNode=function(e){var t=ot.call(this,!!e),i=c(t);return i>-1&&b(t,P[i]),e&&o(t.querySelectorAll(F)),t}),-2<V.call(U,k+r)+V.call(U,z+r)&&g(e),!R.test(r)||-1<V.call(B,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||Q,f=Y.call(p,D),m=f?t[D].toUpperCase():r;return f&&-1<V.call(U,z+m)&&g(m),n=U.push((f?k:z)+r)-1,F=F.concat(F.length?",":"",f?m+'[is="'+e.toLowerCase()+'"]':m),l.prototype=P[n]=Y.call(p,"prototype")?p.prototype:$(it),a(i.querySelectorAll(F),L),l}}}(window,document,Object,"registerElement")},{}],6:[function(e,t){"use strict";t.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},{}],7:[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*u;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*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i}}}}function r(e){return e>=u?Math.round(e/u)+"d":e>=c?Math.round(e/c)+"h":e>=s?Math.round(e/s)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function n(e){return a(e,u,"day")||a(e,c,"hour")||a(e,s,"minute")||a(e,o,"second")||e+" ms"}function a(e,t,i){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+i:Math.ceil(e/t)+" "+i+"s"}var o=1e3,s=60*o,c=60*s,u=24*c,l=365.25*u;t.exports=function(e,t){return t=t||{},"string"==typeof e?i(e):t.long?n(e):r(e)}},{}],8:[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)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},i=0;10>i;i++)t["_"+String.fromCharCode(i)]=i;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},n)).join("")?!1:!0}catch(a){return!1}}var n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=r()?Object.assign:function(e){for(var t,r,o=i(e),s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var c in t)n.call(t,c)&&(o[c]=t[c]);if(Object.getOwnPropertySymbols){r=Object.getOwnPropertySymbols(t);for(var u=0;u<r.length;u++)a.call(t,r[u])&&(o[r[u]]=t[r[u]])}}return o}},{}],9:[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:{})},{}],10:[function(e,t){function i(){h&&u&&(h=!1,u.length?l=u.concat(l):d=-1,l.length&&r())}function r(){if(!h){var e=o(i);h=!0;for(var t=l.length;t;){for(u=l,l=[];++d<t;)u&&u[d].run();d=-1,t=l.length}u=null,h=!1,s(e)}}function n(e,t){this.fun=e,this.array=t}function a(){}var o,s,c=t.exports={};!function(){try{o=setTimeout}catch(e){o=function(){throw new Error("setTimeout is not defined")}}try{s=clearTimeout}catch(e){s=function(){throw new Error("clearTimeout is not defined")}}}();var u,l=[],h=!1,d=-1;c.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];l.push(new n(e,t)),1!==l.length||h||o(r,0)},n.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=a,c.addListener=a,c.once=a,c.off=a,c.removeListener=a,c.removeAllListeners=a,c.emit=a,c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],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=[],u(e,i(a,this),i(o,this))}function n(e){var t=this;return null===this._state?(this._deferreds.push(e),void 0):(h(function(){var i=t._state?e.onFulfilled:e.onRejected;if(null===i)return(t._state?e.resolve:e.reject)(t._value),void 0;var r;try{r=i(t._value)}catch(n){return e.reject(n),void 0}e.resolve(r)}),void 0)}function a(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 u(i(t,e),i(a,this),i(o,this)),void 0}this._state=!0,this._value=e,s.call(this)}catch(r){o.call(this,r)}}function o(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 u(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,h="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,a){n.call(i,new c(e,t,r,a))})},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(a,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var s=o.then;if("function"==typeof s)return s.call(o,function(e){r(a,e)},i),void 0}e[a]=o,0===--n&&t(e)}catch(c){i(c)}}if(0===e.length)return t([]);for(var n=e.length,a=0;a<e.length;a++)r(a,e[a])})},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){h=e},"undefined"!=typeof t&&t.exports?t.exports=r:e.Promise||(e.Promise=r)}(this)},{}],12:[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=";",a=/url\([^\)]+$/,o="";r<e.length;)t=e.indexOf(n,r),-1===t&&(t=e.length),o+=e.substring(r,t),a.test(o)?(o+=";",r=t+1):(i.push(o),o="",r=t+1);return i}function n(e){return Object.keys(e).map(function(t){return t+":"+e[t]}).join(";")}function a(e){return n(i(e))}t.exports.parse=i,t.exports.stringify=n,t.exports.normalize=a},{}],13:[function(){THREE.BlendCharacter=function(){this.weightSchedule=[],this.warpSchedule=[],this.load=function(e,t){var i=this,r=new THREE.ObjectLoader;r.load(e,function(r){if(r.traverse(function(e){e instanceof THREE.SkinnedMesh&&(i.skinnedMesh=e)}),THREE.SkinnedMesh.call(i,i.skinnedMesh.geometry,i.skinnedMesh.material),void 0==i.skinnedMesh)return console.log("unable to find skinned mesh in "+e),void 0;i.material.skinning=!0,i.mixer=new THREE.AnimationMixer(i),i.mixer=i.mixer;for(var n=0;n<i.geometry.animations.length;++n)i.mixer.clipAction(i.geometry.animations[n]);void 0!==t&&t()})},this.update=function(e){this.mixer.update(e)},this.play=function(e,t){return this.mixer.clipAction(e).setEffectiveWeight(t).play()},this.crossfade=function(e,t,i){this.mixer.stopAllAction();var r=this.play(e,1),n=this.play(t,1);r.crossFadeTo(n,i,!1)},this.warp=function(e,t,i){this.mixer.stopAllAction();var r=this.play(e,1),n=this.play(t,1);r.crossFadeTo(n,i,!0)},this.applyWeight=function(e,t){this.mixer.clipAction(e).setEffectiveWeight(t)},this.getWeight=function(e){return this.mixer.clipAction(e).getEffectiveWeight()},this.pauseAll=function(){this.mixer.timeScale=0},this.unPauseAll=function(){this.mixer.timeScale=1},this.stopAll=function(){this.mixer.stopAllAction()},this.showModel=function(e){this.visible=e}},THREE.BlendCharacter.prototype=Object.create(THREE.SkinnedMesh.prototype),THREE.BlendCharacter.prototype.constructor=THREE.BlendCharacter,THREE.BlendCharacter.prototype.getForward=function(){var e=new THREE.Vector3;return function(){return e.set(-this.matrix.elements[8],-this.matrix.elements[9],-this.matrix.elements[10]),e}}},{}],14:[function(){THREE.ColladaLoader=function(){function e(e,i,r,n){var a=0;if(document.implementation&&document.implementation.createDocument){var o=new XMLHttpRequest;o.onreadystatechange=function(){4===o.readyState?0===o.status||200===o.status?o.response?(Bt=i,t(o.response,void 0,e)):n?n({type:"error",url:e}):console.error("ColladaLoader: Empty or non-existing file ("+e+")"):n?n({type:"error",url:e}):console.error("ColladaLoader: Couldn't load \""+e+'" ('+o.status+")"):3===o.readyState&&r&&(0===a&&(a=o.getResponseHeader("Content-Length")),r({total:a,loaded:o.responseText.length}))},o.open("GET",e,!0),o.send(null)}else alert("Don't know how to parse XML!")}function t(e,t,i){if(kt=(new DOMParser).parseFromString(e,"text/xml"),t=t||Bt,void 0!==i){var c=i.split("/");c.pop(),_t=(c.length<1?".":c.join("/"))+"/"}r(),At(),Pt=n("library_images image",L,"image"),Qt=n("library_materials material",H,"material"),Yt=n("library_effects effect",K,"effect"),Vt=n("library_geometries geometry",k,"geometry"),Ht=n("library_cameras camera",rt,"camera"),Wt=n("library_lights light",at,"light"),Gt=n("library_controllers controller",N,"controller"),Ft=n("library_animations animation",$,"animation"),It=n("library_visual_scenes visual_scene",C,"visual_scene"),jt=n("library_kinematics_models kinematics_model",st,"kinematics_model"),Ot=[],zt=[],Nt=a(),Rt=new THREE.Group;for(var u=0;u<Nt.nodes.length;u++)Rt.add(v(Nt.nodes[u]));Rt.scale.multiplyScalar(Zt),s(),Dt=o(),g();var l={scene:Rt,morphs:Ot,skins:zt,animations:St,kinematics:Ct,dae:{images:Pt,materials:Qt,cameras:Ht,lights:Wt,effects:Yt,geometries:Vt,controllers:Gt,animations:Ft,visualScenes:It,visualScene:Nt,scene:Nt,kinematicsModels:jt,kinematicsModel:Dt}};return t&&t(l),l}function i(e){Xt=e}function r(){var e=kt.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&&(Zt=parseFloat(n));break;case"up_axis":Kt=r.textContent.charAt(0)}}}function n(e,t,i){for(var r=kt.querySelectorAll(e),n={},a=0,o=r.length,s=0;o>s;s++){var c=r[s],u=(new t).parse(c);u.id&&0!==u.id.length||(u.id=i+a++),n[u.id]=u}return n}function a(){var e=kt.querySelectorAll("scene instance_visual_scene")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return It[t.length>0?t:"visual_scene0"]}return null}function o(){var e=kt.querySelectorAll("instance_kinematics_model")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return jt[t.length>0?t:"kinematics_model0"]}return null}function s(){St=[],c(Rt)}function c(e){var t=Nt.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},St.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 a=c(e.children[r]),o=0,s=a.hierarchy.length;s>o;o++)i.hierarchy.push({keys:[],sids:[]});return i}function u(){var e,t=1e6,i=-t,r=0;for(var n in Ft){var a=Ft[n];e=e||a.id;for(var o=0;o<a.sampler.length;o++){var s=a.sampler[o];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 _?Gt[t.url]:t;if(!i||!i.morph)return console.log("could not find morph controller!"),void 0;for(var r=i.morph,n=0;n<r.targets.length;n++){var a=r.targets[n],o=Vt[a];if(o.mesh&&o.mesh.primitives&&o.mesh.primitives.length){var s=o.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 h(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],a=n.sampler.output[i];a instanceof THREE.Matrix4&&(e.world.copy(a),e.localworld.copy(a),0===i&&e.matrix.copy(a))}r&&e.world.multiplyMatrices(r,e.world),t.push(e);for(var o=0;o<e.nodes.length;o++)h(e.nodes[o],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 a=0;a<t.joints.length;a++)if(r.sid===t.joints[a]){n=a;break}if(n>=0){var o=t.invBindMatrices[n];r.invBindMatrix=o,r.skinningMatrix=new THREE.Matrix4,r.skinningMatrix.multiplyMatrices(r.world,o),r.animatrix=new THREE.Matrix4,r.animatrix.copy(r.localworld),r.weights=[];for(var a=0;a<t.weights.length;a++)for(var s=0;s<t.weights[a].length;s++){var c=t.weights[a][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 a=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];n.matrix.decompose(a[0],a[1],a[2]),n.pos=[a[0].x,a[0].y,a[0].z],n.scl=[a[2].x,a[2].y,a[2].z],n.rotq=[a[1].x,a[1].y,a[1].z,a[1].w],r.push(n);for(var o in t.nodes)i(t.sid,t.nodes[o],r)};return i(-1,e,t),t}function f(e,t,i){var r=[];h(t,r,-1),d(r,i.skin);for(var n=new THREE.Vector3,a=[],o=0;o<e.vertices.length;o++)a.push(new THREE.Vector3);for(o=0;o<r.length;o++)if("JOINT"==r[o].type)for(var s=0;s<r[o].weights.length;s++){var c=r[o].weights[s],u=c.index,l=c.weight,p=e.vertices[u],f=a[u];n.x=p.x,n.y=p.y,n.z=p.z,n.applyMatrix4(r[o].skinningMatrix),f.x+=n.x*l,f.y+=n.y*l,f.z+=n.z*l}for(var o=0;o<e.vertices.length;o++)e.vertices[o]=a[o]}function m(e,t,i){var r=Gt[t.url];if(i=void 0!==i?i:40,!r||!r.skin)return console.log("ColladaLoader: Could not find skin controller."),void 0;if(!t.skeleton||!t.skeleton.length)return console.log("ColladaLoader: Could not find the skeleton for the skin. "),void 0;for(var n=u(),a=Nt.getChildById(t.skeleton[0],!0)||Nt.getChildBySid(t.skeleton[0],!0),o=p(a),s=r.skin.joints,c=[],l=0;l<s.length;l++)for(var m=0;m<o.length;m++)o[m].name===s[l]&&(c[l]=o[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,g;new THREE.Vector3}for(l=0;l<e.vertices.length;l++)e.vertices[l].applyMatrix4(r.skin.bindShapeMatrix);for(var v=[],y=[],M=r.skin.weights,l=0;l<M.length;l++){var A=new THREE.Vector4(M[l][0]?M[l][0].joint:0,M[l][1]?M[l][1].joint:0,M[l][2]?M[l][2].joint:0,M[l][3]?M[l][3].joint:0),g=new THREE.Vector4(M[l][0]?M[l][0].weight:0,M[l][1]?M[l][1].weight:0,M[l][2]?M[l][2].weight:0,M[l][3]?M[l][3].weight:0);v.push(A),y.push(g)}e.skinIndices=v,e.skinWeights=y,e.bones=c;for(var x={name:n.ID,fps:30,length:n.frames/30,hierarchy:[]},m=0;m<c.length;m++)x.hierarchy.push({parent:c[m].parent,name:c[m].name,keys:[]});for(console.log("ColladaLoader:",n.ID+" has "+c.length+" bones."),f(e,a,r),i=0;i<n.frames;i++){var w=[];h(a,w,i),d(w,r.skin);for(var l=0;l<w.length;l++)for(var m=0;m<x.hierarchy.length;m++)if(x.hierarchy[m].name===w[l].sid){var E={};E.time=i/30,E.matrix=w[l].animatrix,0===i&&(w[l].matrix=E.matrix);var b=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];E.matrix.decompose(b[0],b[1],b[2]),E.pos=[b[0].x,b[0].y,b[0].z],E.scl=[b[2].x,b[2].y,b[2].z],E.rot=b[1],x.hierarchy[m].keys.push(E)}e.animation=x}}function g(){if(Dt&&0===Dt.joints.length)return Ct=void 0,void 0;var e={},t=function(t,i){var r=i.getAttribute("id"),n=Nt.getChildById(r,!0),a=Dt.joints[t];Rt.traverse(function(i){i.colladaId==r&&(e[t]={node:i,transforms:n.transforms,joint:a,position:a.zeroPosition})})};Ct={joints:Dt&&Dt.joints,getJointValue:function(t){var i=e[t];return i?i.position:(console.log("getJointValue: joint "+t+" doesn't exist"),void 0)},setJointValue:function(t,i){var n=e[t];if(n){var a=n.joint;if(i>a.limits.max||i<a.limits.min)console.log("setJointValue: joint "+t+" value "+i+" outside of limits (min: "+a.limits.min+", max: "+a.limits.max+")");else if(a.static)console.log("setJointValue: joint "+t+" is static");else{var o=n.node,s=a.axis,c=n.transforms,u=new THREE.Matrix4;for(r=0;r<c.length;r++){var l=c[r];if(l.sid&&-1!==l.sid.indexOf("joint"+t))switch(a.type){case"revolute":u.multiply(h.makeRotationAxis(s,THREE.Math.degToRad(i)));break;case"prismatic":u.multiply(h.makeTranslation(s.x*i,s.y*i,s.z*i));break;default:console.warn("setJointValue: unknown joint type: "+a.type)}else{var h=new THREE.Matrix4;switch(l.type){case"matrix":u.multiply(l.obj);break;case"translate":u.multiply(h.makeTranslation(l.obj.x,l.obj.y,l.obj.z));break;case"rotate":u.multiply(h.makeRotationAxis(l.obj,l.angle))}}}var d=u.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]];o.matrix.set.apply(o.matrix,f),o.matrix.decompose(o.position,o.quaternion,o.scale)}}else console.log("setJointValue: joint "+t+" doesn't exist")}};var i=kt.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 a=n.getAttribute("target").split("/").pop(),o=n.querySelector("axis param").textContent,s=parseInt(o.split("joint").pop().split(".")[0]),c=kt.querySelector('[sid="'+a+'"]');if(c){var u=c.parentElement;t(s,u)}}}}function v(e){var t,i,r,n,a=new THREE.Object3D,o=!1;for(r=0;r<e.controllers.length;r++){var s=Gt[e.controllers[r].url];switch(s.type){case"skin":if(Vt[s.skin.source]){var c=new z;c.url=s.skin.source,c.instance_material=e.controllers[r].instance_material,e.geometries.push(c),o=!0,t=e.controllers[r]}else if(Gt[s.skin.source]){var u=Gt[s.skin.source];if(i=u,u.morph&&Vt[u.morph.source]){var c=new z;c.url=u.morph.source,c.instance_material=e.controllers[r].instance_material,e.geometries.push(c)}}break;case"morph":if(Vt[s.morph.source]){var c=new z;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 h={};for(r=0;r<e.geometries.length;r++){var d,p=e.geometries[r],f=p.instance_material,g=Vt[p.url],y={},M=[],A=0;if(g){if(!g.mesh||!g.mesh.primitives)continue;if(0===a.name.length&&(a.name=g.id),f)for(n=0;n<f.length;n++){var x=f[n],w=Qt[x.target],E=w.instance_effect.url,b=Yt[E].shader,T=b.material;if(g.doubleSided){if(!(x.symbol in h)){var L=T.clone();L.side=THREE.DoubleSide,h[x.symbol]=L}T=h[x.symbol]}T.opacity=T.opacity?T.opacity:1,y[x.symbol]=A,M.push(T),d=T,d.name=null===w.name||""===w.name?w.id:w.name,A++}var N,D=d||new THREE.MeshLambertMaterial({color:14540253,side:g.doubleSided?THREE.DoubleSide:THREE.FrontSide}),S=g.mesh.geometry3js;if(A>1)for(D=new THREE.MultiMaterial(M),n=0;n<S.faces.length;n++){var C=S.faces[n];C.materialIndex=y[C.daeMaterial]}void 0!==t?(m(S,t),S.morphTargets.length>0?(D.morphTargets=!0,D.skinning=!1):(D.morphTargets=!1,D.skinning=!0),N=new THREE.SkinnedMesh(S,D,!1),N.name="skin_"+zt.length,zt.push(N)):void 0!==i?(l(S,i),D.morphTargets=!0,N=new THREE.Mesh(S,D),N.name="morph_"+Ot.length,Ot.push(N)):N=S.isLineStrip===!0?new THREE.Line(S):new THREE.Mesh(S,D),a.add(N)}}for(r=0;r<e.cameras.length;r++){var I=e.cameras[r],j=Ht[I.url],_=new THREE.PerspectiveCamera(j.yfov,parseFloat(j.aspect_ratio),parseFloat(j.znear),parseFloat(j.zfar));a.add(_)}for(r=0;r<e.lights.length;r++){var O=null,k=e.lights[r],R=Wt[k.url];if(R&&R.technique){var B=R.color.getHex(),U=R.intensity,P=R.distance,F=R.falloff_angle;switch(R.technique){case"directional":O=new THREE.DirectionalLight(B,U,P),O.position.set(0,0,1);break;case"point":O=new THREE.PointLight(B,U,P);break;case"spot":O=new THREE.SpotLight(B,U,P,F),O.position.set(0,0,1);break;case"ambient":O=new THREE.AmbientLight(B)}}O&&a.add(O)}if(a.name=e.name||e.id||"",a.colladaId=e.id||"",a.layer=e.layer||"",a.matrix=e.matrix,a.matrix.decompose(a.position,a.quaternion,a.scale),qt.centerGeometry&&a.geometry){var G=a.geometry.center();G.multiply(a.scale),G.applyQuaternion(a.quaternion),a.position.sub(G)}for(r=0;r<e.nodes.length;r++)a.add(v(e.nodes[r],e));return a}function y(e){for(var t=kt.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 M(e){var t=[],i=1e6,r=-1e6;for(var n in Ft)for(var a=Ft[n],o=0;o<a.channel.length;o++){var s=a.channel[o],c=a.sampler[o],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 A(e){if(e.channels&&e.channels.length){for(var t=[],i=[],r=0,n=e.channels.length;n>r;r++){var a,o=e.channels[r],s=o.fullSid,c=o.sampler,u=c.input,l=e.getTransformBySid(o.sid); |
|
if(o.arrIndices){a=[];for(var h=0,d=o.arrIndices.length;d>h;h++)a[h]=Tt(o.arrIndices[h])}else a=Lt(o.member);if(l){-1===i.indexOf(s)&&i.push(s);for(var h=0,d=u.length;d>h;h++){var p=u[h],f=c.getData(l.type,h,a),m=x(t,p);if(!m){m=new it(p);var g=w(t,p);t.splice(-1===g?t.length:g,0,m)}m.addTarget(s,l,a,f)}}else console.log('Could not find transform "'+o.sid+'" in node '+e.id)}for(var r=0;r<i.length;r++)for(var v=i[r],h=0;h<t.length;h++){var m=t[h];m.hasTarget(v)||E(t,m,h,v)}e.keys=t,e.sids=i}}function x(e,t){for(var i=null,r=0,n=e.length;n>r&&null===i;r++){var a=e[r];if(a.time===t)i=a;else if(a.time>t)break}return i}function w(e,t){for(var i=-1,r=0,n=e.length;n>r&&-1===i;r++){var a=e[r];a.time>=t&&(i=r)}return i}function E(e,t,i,r){var n=T(e,r,i?i-1:0),a=b(e,r,i+1);if(n&&a){var o,s=(t.time-n.time)/(a.time-n.time),c=n.getTarget(r),u=a.getTarget(r).data,l=c.data;if("matrix"===c.type)o=l;else if(l.length){o=[];for(var h=0;h<l.length;++h)o[h]=l[h]+(u[h]-l[h])*s}else o=l+(u-l)*s;t.addTarget(r,c.transform,c.member,o)}}function b(e,t,i){for(;i<e.length;i++){var r=e[i];if(r.hasTarget(t))return r}return null}function T(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 L(){this.id="",this.init_from=""}function N(){this.id="",this.name="",this.type="",this.skin=null,this.morph=null}function D(){this.method=null,this.source=null,this.targets=null,this.weights=null}function S(){this.source="",this.bindShapeMatrix=null,this.invBindMatrices=[],this.joints=[],this.weights=[]}function C(){this.id="",this.name="",this.nodes=[],this.scene=new THREE.Group}function I(){this.id="",this.name="",this.sid="",this.nodes=[],this.controllers=[],this.transforms=[],this.geometries=[],this.channels=[],this.matrix=new THREE.Matrix4}function j(){this.sid="",this.type="",this.data=[],this.obj=null}function _(){this.url="",this.skeleton=[],this.instance_material=[]}function O(){this.symbol="",this.target=""}function z(){this.url="",this.instance_material=[]}function k(){this.id="",this.mesh=null}function R(e){this.geometry=e.id,this.primitives=[],this.vertices=null,this.geometry3js=null}function B(){this.material="",this.count=0,this.inputs=[],this.vcount=null,this.p=[],this.geometry=new THREE.Geometry}function U(){B.call(this),this.vcount=[]}function P(){B.call(this),this.vcount=1}function F(){B.call(this),this.vcount=3}function G(){this.source="",this.count=0,this.stride=0,this.params=[]}function V(){this.input={}}function Q(){this.semantic="",this.offset=0,this.source="",this.set=0}function Y(e){this.id=e,this.type=null}function H(){this.id="",this.name="",this.instance_effect=null}function W(){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 X(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 Z(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 K(){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 et(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 tt(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 it(e){this.targets=[],this.time=e}function rt(){this.id="",this.name="",this.technique=""}function nt(){this.url=""}function at(){this.id="",this.name="",this.technique=""}function ot(){this.url=""}function st(){this.id="",this.name="",this.joints=[],this.links=[]}function ct(){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 ut(){this.sid="",this.name="",this.transforms=[],this.attachments=[]}function lt(){this.joint="",this.transforms=[],this.links=[]}function ht(e){var t=e.getAttribute("id");return void 0!=Ut[t]?Ut[t]:(Ut[t]=new Y(t).parse(e),Ut[t])}function dt(e){for(var t=mt(e),i=[],r=0,n=t.length;n>r;r++)i.push("true"===t[r]||"1"===t[r]?!0:!1);return i}function pt(e){for(var t=mt(e),i=[],r=0,n=t.length;n>r;r++)i.push(parseFloat(t[r]));return i}function ft(e){for(var t=mt(e),i=[],r=0,n=t.length;n>r;r++)i.push(parseInt(t[r],10));return i}function mt(e){return e.length>0?gt(e).split(/\s+/):[]}function gt(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function vt(e,t,i){return e.hasAttribute(t)?parseInt(e.getAttribute(t),10):i}function yt(e,t){var i=new THREE.ImageLoader;i.load(t,function(t){e.image=t,e.needsUpdate=!0})}function Mt(e,t){e.doubleSided=!1;var i=t.querySelectorAll("extra double_sided")[0];i&&i&&1===parseInt(i.textContent,10)&&(e.doubleSided=!0)}function At(){if(qt.convertUpAxis!==!0||Kt===qt.upAxis)Jt=null;else switch(Kt){case"X":Jt="Y"===qt.upAxis?"XtoY":"XtoZ";break;case"Y":Jt="X"===qt.upAxis?"YtoX":"YtoZ";break;case"Z":Jt="X"===qt.upAxis?"ZtoX":"ZtoY"}}function xt(e,t){if(qt.convertUpAxis===!0&&Kt!==qt.upAxis)switch(Jt){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 wt(e,t){if(qt.convertUpAxis!==!0||Kt===qt.upAxis)return t;switch(e){case"X":t="XtoY"===Jt?-1*t:t;break;case"Y":t="YtoZ"===Jt||"YtoX"===Jt?-1*t:t;break;case"Z":t="ZtoY"===Jt?-1*t:t}return t}function Et(e,t){var i=[e[t],e[t+1],e[t+2]];return xt(i,-1),new THREE.Vector3(i[0],i[1],i[2])}function bt(e){if(qt.convertUpAxis){var t=[e[0],e[4],e[8]];xt(t,-1),e[0]=t[0],e[4]=t[1],e[8]=t[2],t=[e[1],e[5],e[9]],xt(t,-1),e[1]=t[0],e[5]=t[1],e[9]=t[2],t=[e[2],e[6],e[10]],xt(t,-1),e[2]=t[0],e[6]=t[1],e[10]=t[2],t=[e[0],e[1],e[2]],xt(t,-1),e[0]=t[0],e[1]=t[1],e[2]=t[2],t=[e[4],e[5],e[6]],xt(t,-1),e[4]=t[0],e[5]=t[1],e[6]=t[2],t=[e[8],e[9],e[10]],xt(t,-1),e[8]=t[0],e[9]=t[1],e[10]=t[2],t=[e[3],e[7],e[11]],xt(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 Tt(e){if(e>-1&&3>e){var t=["X","Y","Z"],i={X:0,Y:1,Z:2};e=Lt(t[e]),e=i[e]}return e}function Lt(e){if(qt.convertUpAxis)switch(e){case"X":switch(Jt){case"XtoY":case"XtoZ":case"YtoX":e="Y";break;case"ZtoX":e="Z"}break;case"Y":switch(Jt){case"XtoY":case"YtoX":case"ZtoX":e="X";break;case"XtoZ":case"YtoZ":case"ZtoY":e="Z"}break;case"Z":switch(Jt){case"XtoZ":e="X";break;case"YtoZ":case"ZtoX":case"ZtoY":e="Y"}}return e}var Nt,Dt,St,Ct,It,jt,_t,Ot,zt,kt=null,Rt=null,Bt=null,Ut={},Pt={},Ft={},Gt={},Vt={},Qt={},Yt={},Ht={},Wt={},Xt=THREE.SmoothShading,qt={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y",defaultEnvMap:null},Zt=1,Kt="Y",Jt=null;return L.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},N.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 S).parse(i),this.type=i.nodeName;break;case"morph":this.morph=(new D).parse(i),this.type=i.nodeName}}return this},D.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 a=(new Y).parse(n);i[a.id]=a;break;case"targets":r=this.parseInputs(n);break;default:console.log(n.nodeName)}}for(t=0;t<r.length;t++){var o=r[t],a=i[o.source];switch(o.semantic){case"MORPH_TARGET":this.targets=a.read();break;case"MORPH_WEIGHT":this.weights=a.read()}}return this},D.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 Q).parse(r))}}return t},S.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 a=e.childNodes[n];if(1==a.nodeType)switch(a.nodeName){case"bind_shape_matrix":var o=pt(a.textContent);this.bindShapeMatrix=bt(o);break;case"source":var s=(new Y).parse(a);r[s.id]=s;break;case"joints":t=a;break;case"vertex_weights":i=a;break;default:console.log(a.nodeName)}}return this.parseJoints(t,r),this.parseWeights(i,r),this},S.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 Q).parse(r),a=t[n.source];"JOINT"===n.semantic?this.joints=a.read():"INV_BIND_MATRIX"===n.semantic&&(this.invBindMatrices=a.read())}}},S.prototype.parseWeights=function(e,t){for(var i,r,n=[],a=0;a<e.childNodes.length;a++){var o=e.childNodes[a];if(1==o.nodeType)switch(o.nodeName){case"input":n.push((new Q).parse(o));break;case"v":i=ft(o.textContent);break;case"vcount":r=ft(o.textContent)}}for(var s=0,a=0;a<r.length;a++){for(var c=r[a],u=[],l=0;c>l;l++){for(var h={},d=0;d<n.length;d++){var p=n[d],f=i[s+p.offset];switch(p.semantic){case"JOINT":h.joint=f;break;case"WEIGHT":h.weight=t[p.source].data[f]}}u.push(h),s+=n.length}for(var l=0;l<u.length;l++)u[l].index=a;this.weights.push(u)}},C.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},C.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},C.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 I).parse(i))}}return this},I.prototype.getChannelForTransform=function(e){for(var t=0;t<this.channels.length;t++){var i,r,n=this.channels[t],a=n.target.split("/"),o=(a.shift(),a.shift()),s=o.indexOf(".")>=0,c=o.indexOf("(")>=0;if(s)a=o.split("."),o=a.shift(),r=a.shift();else if(c){i=o.split("("),o=i.shift();for(var u=0;u<i.length;u++)i[u]=parseInt(i[u].replace(/\)/,""))}if(o===e)return n.info={sid:o,dotSyntax:s,arrSyntax:c,arrIndices:i},n}return null},I.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},I.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},I.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},I.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 I).parse(r));break;case"instance_camera":this.cameras.push((new nt).parse(r));break;case"instance_controller":this.controllers.push((new _).parse(r));break;case"instance_geometry":this.geometries.push((new z).parse(r));break;case"instance_light":this.lights.push((new ot).parse(r));break;case"instance_node":t=r.getAttribute("url").replace(/^#/,"");var n=y(t);n&&this.nodes.push((new I).parse(n));break;case"rotate":case"translate":case"scale":case"matrix":case"lookat":case"skew":this.transforms.push((new j).parse(r));break;case"extra":break;default:console.log(r.nodeName)}}return this.channels=M(this),A(this),this.updateMatrix(),this},I.prototype.updateMatrix=function(){this.matrix.identity();for(var e=0;e<this.transforms.length;e++)this.transforms[e].apply(this.matrix)},j.prototype.parse=function(e){return this.sid=e.getAttribute("sid"),this.type=e.nodeName,this.data=pt(e.textContent),this.convert(),this},j.prototype.convert=function(){switch(this.type){case"matrix":this.obj=bt(this.data);break;case"rotate":this.angle=THREE.Math.degToRad(this.data[3]);case"translate":xt(this.data,-1),this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case"scale":xt(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)}},j.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)}}}(),j.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])}}},_.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 a=r[n];this.instance_material.push((new O).parse(a))}break;case"extra":}}return this},O.prototype.parse=function(e){return this.symbol=e.getAttribute("symbol"),this.target=e.getAttribute("target").replace(/^#/,""),this},z.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 a=r[n];this.instance_material.push((new O).parse(a))}break}}return this},k.prototype.parse=function(e){this.id=e.getAttribute("id"),Mt(this,e);for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"mesh":this.mesh=new R(this).parse(i);break;case"extra":}}return this},R.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":ht(i);break;case"vertices":this.vertices=(new V).parse(i);break;case"linestrips":this.primitives.push((new P).parse(i));break;case"triangles":this.primitives.push((new F).parse(i));break;case"polygons":this.primitives.push((new B).parse(i));break;case"polylist":this.primitives.push((new U).parse(i))}}if(this.geometry3js=new THREE.Geometry,null===this.vertices)return this;for(var r=Ut[this.vertices.input.POSITION.source].data,t=0;t<r.length;t+=3)this.geometry3js.vertices.push(Et(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},R.prototype.handlePrimitive=function(e,t){if(e instanceof P)return t.isLineStrip=!0,void 0;var i,r,n,a,o,s,c,u=e.p,l=e.inputs,h=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 g=0;g<u.length;++g)for(var v=u[g],y=0;y<v.length;){var M=[],A=[],x=null,w=[];for(d=e.vcount?e.vcount.length?e.vcount[h++]:e.vcount:v.length/p,i=0;d>i;i++)for(r=0;r<l.length;r++)switch(n=l[r],s=Ut[n.source],a=v[y+i*p+n.offset],c=s.accessor.params.length,o=a*c,n.semantic){case"VERTEX":M.push(a);break;case"NORMAL":A.push(Et(s.data,o));break;case"TEXCOORD":x=x||{},void 0===x[n.set]&&(x[n.set]=[]),x[n.set].push(new THREE.Vector2(s.data[o],s.data[o+1]));break;case"COLOR":w.push((new THREE.Color).setRGB(s.data[o],s.data[o+1],s.data[o+2]))}if(0===A.length)if(n=this.vertices.input.NORMAL){s=Ut[n.source],c=s.accessor.params.length;for(var E=0,b=M.length;b>E;E++)A.push(Et(s.data,M[E]*c))}else t.calcNormals=!0;if(!x&&(x={},n=this.vertices.input.TEXCOORD)){f.push(n.set),s=Ut[n.source],c=s.accessor.params.length;for(var E=0,b=M.length;b>E;E++)o=M[E]*c,void 0===x[n.set]&&(x[n.set]=[]),x[n.set].push(new THREE.Vector2(s.data[o],1-s.data[o+1]))}if(0===w.length&&(n=this.vertices.input.COLOR)){s=Ut[n.source],c=s.accessor.params.length;for(var E=0,b=M.length;b>E;E++)o=M[E]*c,w.push((new THREE.Color).setRGB(s.data[o],s.data[o+1],s.data[o+2]))}var T,L,N=null,D=[];if(3===d)D.push(new THREE.Face3(M[0],M[1],M[2],A,w.length?w:new THREE.Color));else if(4===d)D.push(new THREE.Face3(M[0],M[1],M[3],A.length?[A[0].clone(),A[1].clone(),A[3].clone()]:[],w.length?[w[0],w[1],w[3]]:new THREE.Color)),D.push(new THREE.Face3(M[1],M[2],M[3],A.length?[A[1].clone(),A[2].clone(),A[3].clone()]:[],w.length?[w[1],w[2],w[3]]:new THREE.Color));else if(d>4&&qt.subdivideFaces){var S=w.length?w:new THREE.Color;for(r=1;d-1>r;)D.push(new THREE.Face3(M[0],M[r],M[r+1],A.length?[A[0].clone(),A[r++].clone(),A[r].clone()]:[],S))}if(D.length)for(var E=0,b=D.length;b>E;E++)for(N=D[E],N.daeMaterial=e.material,t.faces.push(N),r=0;r<f.length;r++)T=x[f[r]],L=d>4?[T[0],T[E+1],T[E+2]]:4===d?0===E?[T[0],T[1],T[3]]:[T[1].clone(),T[2],T[3].clone()]:[T[0],T[1],T[2]],void 0===t.faceVertexUvs[r]&&(t.faceVertexUvs[r]=[]),t.faceVertexUvs[r].push(L);else console.log("dropped face with vcount "+d+" for geometry with id: "+t.id);y+=p*d}},B.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)},B.prototype.parse=function(e){this.material=e.getAttribute("material"),this.count=vt(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 Q).parse(e.childNodes[t]));break;case"vcount":this.vcount=ft(i.textContent);break;case"p":this.p.push(ft(i.textContent));break;case"ph":console.warn("polygon holes not yet supported!")}}return this},U.prototype=Object.create(B.prototype),U.prototype.constructor=U,P.prototype=Object.create(B.prototype),P.prototype.constructor=P,F.prototype=Object.create(B.prototype),F.prototype.constructor=F,G.prototype.parse=function(e){this.params=[],this.source=e.getAttribute("source"),this.count=vt(e,"count",0),this.stride=vt(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},V.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 Q).parse(e.childNodes[t]);this.input[i.semantic]=i}return this},Q.prototype.parse=function(e){return this.semantic=e.getAttribute("semantic"),this.source=e.getAttribute("source").replace(/^#/,""),this.set=vt(e,"set",-1),this.offset=vt(e,"offset",0),"TEXCOORD"===this.semantic&&this.set<0&&(this.set=0),this},Y.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=dt(i.textContent),this.type=i.nodeName;break;case"float_array":this.data=pt(i.textContent),this.type=i.nodeName;break;case"int_array":this.data=ft(i.textContent),this.type=i.nodeName;break;case"IDREF_array":case"Name_array":this.data=mt(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 G).parse(i.childNodes[r]);break}}}return this},Y.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=bt(r);e.push(n)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+t.type+".")}return e},H.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},W.prototype.isColor=function(){return null===this.texture},W.prototype.isTexture=function(){return null!=this.texture},W.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=pt(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},W.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},X.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 W).parse(i);break;case"bump":var r=i.getAttribute("bumptype");r?"heightfield"===r.toLowerCase()?this.bump=(new W).parse(i):"normalmap"===r.toLowerCase()?this.normal=(new W).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 W).parse(i)):(console.warn("Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'"),this.bump=(new W).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},X.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 a=this[n];if(a instanceof W)if(a.isTexture()){var o=a.texture,s=this.effect.sampler[o];if(void 0!==s&&void 0!==s.source){var c=this.effect.surface[s.source];if(void 0!==c){var u=Pt[c.init_from];if(u){var l,h=_t+u.init_from,d=THREE.Loader.Handlers.get(h);null!==d?l=d.load(h):(l=new THREE.Texture,yt(l,h)),l.wrapS=a.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,l.wrapT=a.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,l.offset.x=a.texOpts.offsetU,l.offset.y=a.texOpts.offsetV,l.repeat.x=a.texOpts.repeatU,l.repeat.y=a.texOpts.repeatV,e[r[n]]=l,"emission"===n&&(e.emissive=16777215)}}}}else"diffuse"!==n&&t||("emission"===n?e.emissive=a.color.getHex():e[n]=a.color.getHex());break;case"shininess":e[n]=this[n];break;case"reflectivity":e[n]=this[n],e[n]>0&&(e.envMap=qt.defaultEnvMap),e.combine=THREE.MixOperation;break;case"index_of_refraction":e.refractionRatio=this[n],1!==this[n]&&(e.envMap=qt.defaultEnvMap);break;case"transparency":}switch(e.shading=Xt,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},Z.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},K.prototype.create=function(){return null===this.shader?null:void 0},K.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),Mt(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},K.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 Z(this).parse(r);break;case"extra":break;default:console.log(r.nodeName)}}},K.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 L).parse(r);Pt[n.id]=n;break;case"extra":break;default:console.log(r.nodeName)}}return t},K.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 X(i.nodeName,this).parse(i);break;case"extra":this.parseExtra(i)}}},K.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)}}},K.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 a=0;a<r.channel.length;a++)this.channel.push(r.channel[a]),this.sampler.push(r.sampler[a]);break;case"source":var n=(new Y).parse(i);this.source[n.id]=n;break;case"sampler":this.sampler.push(new tt(this).parse(i));break;case"channel":this.channel.push(new et(this).parse(i))}}return this},et.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 a=i.split("(");this.sid=a.shift();for(var o=0;o<a.length;o++)a[o]=parseInt(a[o].replace(/\)/,""));this.arrIndices=a}else this.sid=i;return this.fullSid=i,this.dotSyntax=r,this.arrSyntax=n,this},tt.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 Q).parse(i))}}return this},tt.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}},tt.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":xt(r,-1);break;case"scale":xt(r,1)}else 4===this.strideOut&&"matrix"===e&&xt(r,-1)}else r=this.output[t],i&&"translate"===e&&(r=wt(i,r));return r},it.prototype.addTarget=function(e,t,i,r){this.targets.push({sid:e,member:i,transform:t,data:r})},it.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)}},it.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},it.prototype.hasTarget=function(e){for(var t=0;t<this.targets.length;++t)if(this.targets[t].sid===e)return!0;return!1},it.prototype.interpolate=function(e,t){for(var i=0,r=this.targets.length;r>i;i++){var n,a=this.targets[i],o=e.getTarget(a.sid);if("matrix"!==a.transform.type&&o){var s=(t-this.time)/(e.time-this.time),c=o.data,u=a.data;if(0>s&&(s=0),s>1&&(s=1),u.length){n=[];for(var l=0;l<u.length;++l)n[l]=u[l]+(c[l]-u[l])*s}else n=u+(c-u)*s}else n=a.data;a.transform.update(n,a.member)}},rt.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},rt.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],a=0;a<n.childNodes.length;a++){var o=n.childNodes[a]; |
|
switch(o.nodeName){case"yfov":this.yfov=o.textContent;break;case"xfov":this.xfov=o.textContent;break;case"znear":this.znear=o.textContent;break;case"zfar":this.zfar=o.textContent;break;case"aspect_ratio":this.aspect_ratio=o.textContent}}else if("orthographic"===this.technique)for(var s=i.childNodes[r],a=0;a<s.childNodes.length;a++){var o=s.childNodes[a];switch(o.nodeName){case"xmag":this.xmag=o.textContent;break;case"ymag":this.ymag=o.textContent;break;case"znear":this.znear=o.textContent;break;case"zfar":this.zfar=o.textContent;break;case"aspect_ratio":this.aspect_ratio=o.textContent}}return this},nt.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},at.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},at.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 a=pt(n.textContent);this.color=new THREE.Color(0),this.color.setRGB(a[0],a[1],a[2]),this.color.a=a[3];break;case"falloff_angle":this.falloff_angle=parseFloat(n.textContent);break;case"quadratic_attenuation":var o=parseFloat(n.textContent);this.distance=o?Math.sqrt(1/o):0}}}return this},at.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},ot.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},st.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},st.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 ct).parse(i));break;case"link":this.links.push((new ut).parse(i))}}return this},ct.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=pt(t.textContent);this.axis=Et(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 a=["prismatic","revolute"],o=0;o<a.length;o++){var s=a[o],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},ut.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 lt).parse(i));break;case"rotate":case"translate":case"matrix":this.transforms.push((new j).parse(i))}}return this},lt.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 ut).parse(i));break;case"rotate":case"translate":case"matrix":this.transforms.push((new j).parse(i))}}return this},{load:e,parse:t,setPreferredShading:i,applySkin:m,geometries:Vt,options:qt}}},{}],15:[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,a=new THREE.XHRLoader(this.manager);a.setPath(this.path),a.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={},a=0;a<t.length;a++){var o=t[a];if(o=o.trim(),0!==o.length&&"#"!==o.charAt(0)){var s=o.indexOf(" "),c=s>=0?o.substring(0,s):o;c=c.toLowerCase();var u=s>=0?o.substring(s+1):"";if(u=u.trim(),"newmtl"===c)i={name:u},n[u]=i;else if(i)if("ka"===c||"kd"===c||"ks"===c){var l=u.split(r,3);i[c]=[parseFloat(l[0]),parseFloat(l[1]),parseFloat(l[2])]}else i[c]=u}}var h=new THREE.MTLLoader.MaterialCreator(this.baseUrl,this.materialOptions);return h.setCrossOrigin(this.crossOrigin),h.setManager(this.manager),h.setMaterials(n),h}},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 a in r){var o=!0,s=r[a],c=a.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]&&(o=!1)}o&&(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 a,o=THREE.Loader.Handlers.get(e),s=void 0!==this.manager?this.manager:THREE.DefaultLoadingManager;return null===o&&(o=new THREE.TextureLoader(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin),a=o.load(e,i,r,n),void 0!==t&&(a.mapping=t),a}},THREE.EventDispatcher.prototype.apply(THREE.MTLLoader.prototype)},{}],16:[function(){THREE.OBJLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.materials=null,this.regexp={vertex_pattern:/^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}},THREE.OBJLoader.prototype={constructor:THREE.OBJLoader,load:function(e,t,i,r){var n=this,a=new THREE.XHRLoader(n.manager);a.setPath(this.path),a.load(e,function(e){t(n.parse(e))},i,r)},setPath:function(e){this.path=e},setMaterials:function(e){this.materials=e},_createParserState:function(){var e={objects:[],object:{},vertices:[],normals:[],uvs:[],materialLibraries:[],startObject:function(e,t){return this.object&&this.object.fromDeclaration===!1?(this.object.name=e,this.object.fromDeclaration=t!==!1,void 0):(this.object={name:e||"",geometry:{vertices:[],normals:[],uvs:[]},material:{name:"",smooth:!0},fromDeclaration:t!==!1},this.objects.push(this.object),void 0)},parseVertexIndex:function(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseNormalIndex:function(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)},parseUVIndex:function(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)},addVertex:function(e,t,i){var r=this.vertices,n=this.object.geometry.vertices;n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addVertexLine:function(e){var t=this.vertices,i=this.object.geometry.vertices;i.push(t[e+0]),i.push(t[e+1]),i.push(t[e+2])},addNormal:function(e,t,i){var r=this.normals,n=this.object.geometry.normals;n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addUV:function(e,t,i){var r=this.uvs,n=this.object.geometry.uvs;n.push(r[e+0]),n.push(r[e+1]),n.push(r[t+0]),n.push(r[t+1]),n.push(r[i+0]),n.push(r[i+1])},addUVLine:function(e){var t=this.uvs,i=this.object.geometry.uvs;i.push(t[e+0]),i.push(t[e+1])},addFace:function(e,t,i,r,n,a,o,s,c,u,l,h){var d,p=this.vertices.length,f=this.parseVertexIndex(e,p),m=this.parseVertexIndex(t,p),g=this.parseVertexIndex(i,p);if(void 0===r?this.addVertex(f,m,g):(d=this.parseVertexIndex(r,p),this.addVertex(f,m,d),this.addVertex(m,g,d)),void 0!==n){var v=this.uvs.length;f=this.parseUVIndex(n,v),m=this.parseUVIndex(a,v),g=this.parseUVIndex(o,v),void 0===r?this.addUV(f,m,g):(d=this.parseUVIndex(s,v),this.addUV(f,m,d),this.addUV(m,g,d))}if(void 0!==c){var y=this.normals.length;f=this.parseNormalIndex(c,y),m=c===u?f:this.parseNormalIndex(u,y),g=c===l?f:this.parseNormalIndex(l,y),void 0===r?this.addNormal(f,m,g):(d=this.parseNormalIndex(h,y),this.addNormal(f,m,d),this.addNormal(m,g,d))}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var i=this.vertices.length,r=this.uvs.length,n=0,a=e.length;a>n;n++)this.addVertexLine(this.parseVertexIndex(e[n],i));for(var o=0,a=t.length;a>o;o++)this.addUVLine(this.parseUVIndex(t[o],r))}};return e.startObject("",!1),e},parse:function(e){console.time("OBJLoader");var t=this._createParserState();-1!==e.indexOf("\r\n")&&(e=e.replace("\r\n","\n"));for(var i=e.split("\n"),r="",n="",a="",o=0,s=[],c="function"==typeof"".trimLeft,u=0,l=i.length;l>u;u++)if(r=i[u],r=c?r.trimLeft():r.trim(),o=r.length,0!==o&&(n=r.charAt(0),"#"!==n))if("v"===n)if(a=r.charAt(1)," "===a&&null!==(s=this.regexp.vertex_pattern.exec(r)))t.vertices.push(parseFloat(s[1]),parseFloat(s[2]),parseFloat(s[3]));else if("n"===a&&null!==(s=this.regexp.normal_pattern.exec(r)))t.normals.push(parseFloat(s[1]),parseFloat(s[2]),parseFloat(s[3]));else{if("t"!==a||null===(s=this.regexp.uv_pattern.exec(r)))throw new Error("Unexpected vertex/normal/uv line: '"+r+"'");t.uvs.push(parseFloat(s[1]),parseFloat(s[2]))}else if("f"===n)if(null!==(s=this.regexp.face_vertex_uv_normal.exec(r)))t.addFace(s[1],s[4],s[7],s[10],s[2],s[5],s[8],s[11],s[3],s[6],s[9],s[12]);else if(null!==(s=this.regexp.face_vertex_uv.exec(r)))t.addFace(s[1],s[3],s[5],s[7],s[2],s[4],s[6],s[8]);else if(null!==(s=this.regexp.face_vertex_normal.exec(r)))t.addFace(s[1],s[3],s[5],s[7],void 0,void 0,void 0,void 0,s[2],s[4],s[6],s[8]);else{if(null===(s=this.regexp.face_vertex.exec(r)))throw new Error("Unexpected face line: '"+r+"'");t.addFace(s[1],s[2],s[3],s[4])}else if("l"===n){var h=r.substring(1).trim().split(" "),d=[],p=[];if(-1===r.indexOf("/"))d=h;else for(var f=0,m=h.length;m>f;f++){var g=h[f].split("/");""!==g[0]&&d.push(g[0]),""!==g[1]&&p.push(g[1])}t.addLineGeometry(d,p)}else if(null!==(s=this.regexp.object_pattern.exec(r))){var v=s[0].substr(1).trim();t.startObject(v)}else if(this.regexp.material_use_pattern.test(r))t.object.material.name=r.substring(7).trim();else if(this.regexp.material_library_pattern.test(r))t.materialLibraries.push(r.substring(7).trim());else{if(null===(s=this.regexp.smoothing_pattern.exec(r))){if("\x00"===r)continue;throw new Error("Unexpected line: '"+r+"'")}var y=s[1].trim().toLowerCase();t.object.material.smooth="1"===y||"on"===y}var M=new THREE.Group;M.materialLibraries=[].concat(t.materialLibraries);for(var u=0,l=t.objects.length;l>u;u++){var A=t.objects[u],x=A.geometry,w="Line"===x.type;if(0!==x.vertices.length){var E=new THREE.BufferGeometry;E.addAttribute("position",new THREE.BufferAttribute(new Float32Array(x.vertices),3)),x.normals.length>0?E.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(x.normals),3)):E.computeVertexNormals(),x.uvs.length>0&&E.addAttribute("uv",new THREE.BufferAttribute(new Float32Array(x.uvs),2));var b;if(null!==this.materials&&(b=this.materials.create(A.material.name),w&&b&&!(b instanceof THREE.LineBasicMaterial))){var T=new THREE.LineBasicMaterial;T.copy(b),b=T}b||(b=w?new THREE.LineBasicMaterial:new THREE.MeshPhongMaterial,b.name=A.material.name),b.shading=A.material.smooth?THREE.SmoothShading:THREE.FlatShading;var L=w?new THREE.Line(E,b):new THREE.Mesh(E,b);L.name=A.name,M.add(L)}}return console.timeEnd("OBJLoader"),M}}},{}],17:[function(e,i,r){var n={REVISION:"76"};"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 a=Object.keys(n),o=0,s=a.length;o!==s;++o){var c=a[o],u=Object.getOwnPropertyDescriptor(n,c);void 0!==u&&u.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.DepthFormat=1026,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.BasicDepthPacking=3200,n.RGBADepthPacking=3201,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 a=.5>=r?r*(1+i):r+i-r*i,o=2*r-a;this.r=e(o,a,t+1/3),this.g=e(o,a,t),this.b=e(o,a,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,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))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(o))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(o)){var s=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(s,c,u)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=i[1],h=l.length;if(3===h)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===h)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,a=this.g,o=this.b,s=Math.max(n,a,o),c=Math.min(n,a,o),u=(c+s)/2;if(c===s)t=0,i=0;else{var l=s-c;switch(i=.5>=u?l/(s+c):l/(2-s-c),s){case n:t=(a-o)/l+(o>a?6:0);break;case a:t=(o-n)/l+2;break;case o:t=(n-a)/l+4}t/=6}return r.h=t,r.s=i,r.l=u,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),a=Math.cos(e._z/2),o=Math.sin(e._x/2),s=Math.sin(e._y/2),c=Math.sin(e._z/2),u=e.order;return"XYZ"===u?(this._x=o*r*a+i*s*c,this._y=i*s*a-o*r*c,this._z=i*r*c+o*s*a,this._w=i*r*a-o*s*c):"YXZ"===u?(this._x=o*r*a+i*s*c,this._y=i*s*a-o*r*c,this._z=i*r*c-o*s*a,this._w=i*r*a+o*s*c):"ZXY"===u?(this._x=o*r*a-i*s*c,this._y=i*s*a+o*r*c,this._z=i*r*c+o*s*a,this._w=i*r*a-o*s*c):"ZYX"===u?(this._x=o*r*a-i*s*c,this._y=i*s*a+o*r*c,this._z=i*r*c-o*s*a,this._w=i*r*a+o*s*c):"YZX"===u?(this._x=o*r*a+i*s*c,this._y=i*s*a+o*r*c,this._z=i*r*c-o*s*a,this._w=i*r*a-o*s*c):"XZY"===u&&(this._x=o*r*a-i*s*c,this._y=i*s*a-o*r*c,this._z=i*r*c+o*s*a,this._w=i*r*a+o*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],a=i[8],o=i[1],s=i[5],c=i[9],u=i[2],l=i[6],h=i[10],d=r+s+h;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(l-c)*t,this._y=(a-u)*t,this._z=(o-n)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(l-c)/t,this._x=.25*t,this._y=(n+o)/t,this._z=(a+u)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(a-u)/t,this._x=(n+o)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(o-n)/t,this._x=(a+u)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,i=1e-6;return function(r,a){return void 0===e&&(e=new n.Vector3),t=r.dot(a)+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,a),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,a=e._w,o=t._x,s=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-n*s,this._y=r*u+a*s+n*o-i*c,this._z=n*u+a*c+i*s-r*o,this._w=a*u-i*o-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,a=this._w,o=a*e._w+i*e._x+r*e._y+n*e._z;if(0>o?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+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,o),u=Math.sin((1-t)*c)/s,l=Math.sin(t*c)/s;return this._w=a*u+this._w*l,this._x=i*u+this._x*l,this._y=r*u+this._y*l,this._z=n*u+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,a,o){var s=i[r+0],c=i[r+1],u=i[r+2],l=i[r+3],h=n[a+0],d=n[a+1],p=n[a+2],f=n[a+3];if(l!==f||s!==h||c!==d||u!==p){var m=1-o,g=s*h+c*d+u*p+l*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var M=Math.sqrt(y),A=Math.atan2(M,g*v);m=Math.sin(m*A)/M,o=Math.sin(o*A)/M}var x=o*v;if(s=s*m+h*x,c=c*m+d*x,u=u*m+p*x,l=l*m+f*x,m===1-o){var w=1/Math.sqrt(s*s+c*c+u*u+l*l);s*=w,c*=w,u*=w,l*=w}}e[t]=s,e[t+1]=c,e[t+2]=u,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,a=this.y-e.y;return this.x=n*i-a*r+e.x,this.y=n*r+a*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,a=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])*a,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*a,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*i,u=s*i+o*t-n*r,l=s*r+n*i-a*t,h=-n*t-a*i-o*r;return this.x=c*s+h*-n+u*-o-l*-a,this.y=u*s+h*-a+l*-n-c*-o,this.z=l*s+h*-o+c*-a-u*-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,a=t.x,o=t.y,s=t.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,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,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*t+a[7]*i+a[11]*r+a[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,a=.01,o=.1,s=e.elements,c=s[0],u=s[4],l=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(u-h)<a&&Math.abs(l-f)<a&&Math.abs(p-m)<a){if(Math.abs(u+h)<o&&Math.abs(l+f)<o&&Math.abs(p+m)<o&&Math.abs(c+d+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var v=(c+1)/2,y=(d+1)/2,M=(g+1)/2,A=(u+h)/4,x=(l+f)/4,w=(p+m)/4;return v>y&&v>M?a>v?(i=0,r=.707106781,n=.707106781):(i=Math.sqrt(v),r=A/i,n=x/i):y>M?a>y?(i=.707106781,r=0,n=.707106781):(r=Math.sqrt(y),i=A/r,n=w/r):a>M?(i=.707106781,r=.707106781,n=0):(n=Math.sqrt(M),i=x/n,r=w/n),this.set(i,r,n,t),this}var E=Math.sqrt((m-p)*(m-p)+(l-f)*(l-f)+(h-u)*(h-u));return Math.abs(E)<.001&&(E=1),this.x=(m-p)/E,this.y=(l-f)/E,this.z=(h-u)/E,this.w=Math.acos((c+d+g-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,a=e.elements,o=a[0],s=a[4],c=a[8],u=a[1],l=a[5],h=a[9],d=a[2],p=a[6],f=a[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(u,l)):(this._y=Math.atan2(-d,o),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(u,o))):"ZYX"===t?(this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-d,o)):(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,o)):(this._x=Math.atan2(-h,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 a=t.dot(t),o=t.dot(e),s=o/a;return r&&(s=n.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,i){var r=this.closestPointToPointParameter(e,t),a=i||new n.Vector3;return this.delta(a).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){for(var t=+1/0,i=+1/0,r=+1/0,n=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;c>s;s+=3){var u=e[s],l=e[s+1],h=e[s+2];t>u&&(t=u),i>l&&(i=l),r>h&&(r=h),u>n&&(n=u),l>a&&(a=l),h>o&&(o=h)}this.min.set(t,i,r),this.max.set(n,a,o)},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=new n.Vector3;return function(t){var i=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var r=t.geometry;if(void 0!==r)if(r instanceof n.Geometry)for(var a=r.vertices,o=0,s=a.length;s>o;o++)e.copy(a[o]),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e);else if(r instanceof n.BufferGeometry&&void 0!==r.attributes.position)for(var c=r.attributes.position.array,o=0,s=c.length;s>o;o+=3)e.fromArray(c,o),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=+1/0,this.max.x=this.max.y=this.max.z=-1/0,this},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.isEmpty()&&this.makeEmpty(),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 this.isEmpty()?this:(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.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,a,o,s,c){var u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=n,u[5]=s,u[6]=i,u[7]=a,u[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 a=0,o=i;r>a;a+=3,o+=3)e.fromArray(t,o),e.applyMatrix3(this),e.toArray(t,o);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 a=0,o=i;r>a;a++,o++)e.x=t.getX(o),e.y=t.getY(o),e.z=t.getZ(o),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*n*u+i*o*s+r*n*c-r*a*s},getInverse:function(e,t){e instanceof n.Matrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=e.elements,r=this.elements,a=i[0],o=i[1],s=i[2],c=i[3],u=i[4],l=i[5],h=i[6],d=i[7],p=i[8],f=p*u-l*d,m=l*h-p*c,g=d*c-u*h,v=a*f+o*m+s*g;if(0===v){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*o,r[2]=l*o-s*u,r[3]=m,r[4]=p*a-s*h,r[5]=s*c-l*a,r[6]=g,r[7]=o*h-d*a,r[8]=u*a-o*c,this.multiplyScalar(1/v)},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){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},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(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);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}},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,a,o,s,c,u,l,h,d,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=u,g[10]=l,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[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,a=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),s=1/e.setFromMatrixColumn(t,2).length();return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[4]=r[4]*o,i[5]=r[5]*o,i[6]=r[6]*o,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,a=e.z,o=Math.cos(i),s=Math.sin(i),c=Math.cos(r),u=Math.sin(r),l=Math.cos(a),h=Math.sin(a);if("XYZ"===e.order){var d=o*l,p=o*h,f=s*l,m=s*h;t[0]=c*l,t[4]=-c*h,t[8]=u,t[1]=p+f*u,t[5]=d-m*u,t[9]=-s*c,t[2]=m-d*u,t[6]=f+p*u,t[10]=o*c}else if("YXZ"===e.order){var g=c*l,v=c*h,y=u*l,M=u*h;t[0]=g+M*s,t[4]=y*s-v,t[8]=o*u,t[1]=o*h,t[5]=o*l,t[9]=-s,t[2]=v*s-y,t[6]=M+g*s,t[10]=o*c}else if("ZXY"===e.order){var g=c*l,v=c*h,y=u*l,M=u*h;t[0]=g-M*s,t[4]=-o*h,t[8]=y+v*s,t[1]=v+y*s,t[5]=o*l,t[9]=M-g*s,t[2]=-o*u,t[6]=s,t[10]=o*c}else if("ZYX"===e.order){var d=o*l,p=o*h,f=s*l,m=s*h;t[0]=c*l,t[4]=f*u-p,t[8]=d*u+m,t[1]=c*h,t[5]=m*u+d,t[9]=p*u-f,t[2]=-u,t[6]=s*c,t[10]=o*c}else if("YZX"===e.order){var A=o*c,x=o*u,w=s*c,E=s*u;t[0]=c*l,t[4]=E-A*h,t[8]=w*h+x,t[1]=h,t[5]=o*l,t[9]=-s*l,t[2]=-u*l,t[6]=x*h+w,t[10]=A-E*h}else if("XZY"===e.order){var A=o*c,x=o*u,w=s*c,E=s*u;t[0]=c*l,t[4]=-h,t[8]=u*l,t[1]=A*h+E,t[5]=o*l,t[9]=x*h-w,t[2]=w*h-x,t[6]=s*l,t[10]=E*h+A}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,a=e.w,o=i+i,s=r+r,c=n+n,u=i*o,l=i*s,h=i*c,d=r*s,p=r*c,f=n*c,m=a*o,g=a*s,v=a*c; |
|
return t[0]=1-(d+f),t[4]=l-v,t[8]=h+g,t[1]=l+v,t[5]=1-(u+f),t[9]=p-m,t[2]=h-g,t[6]=p+m,t[10]=1-(u+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,a,o){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,a).normalize(),0===i.lengthSq()&&(i.z=1),e.crossVectors(o,i).normalize(),0===e.lengthSq()&&(i.x+=1e-4,e.crossVectors(o,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)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,n=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],u=i[1],l=i[5],h=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],M=i[11],A=i[15],x=r[0],w=r[4],E=r[8],b=r[12],T=r[1],L=r[5],N=r[9],D=r[13],S=r[2],C=r[6],I=r[10],j=r[14],_=r[3],O=r[7],z=r[11],k=r[15];return n[0]=a*x+o*T+s*S+c*_,n[4]=a*w+o*L+s*C+c*O,n[8]=a*E+o*N+s*I+c*z,n[12]=a*b+o*D+s*j+c*k,n[1]=u*x+l*T+h*S+d*_,n[5]=u*w+l*L+h*C+d*O,n[9]=u*E+l*N+h*I+d*z,n[13]=u*b+l*D+h*j+d*k,n[2]=p*x+f*T+m*S+g*_,n[6]=p*w+f*L+m*C+g*O,n[10]=p*E+f*N+m*I+g*z,n[14]=p*b+f*D+m*j+g*k,n[3]=v*x+y*T+M*S+A*_,n[7]=v*w+y*L+M*C+A*O,n[11]=v*E+y*N+M*I+A*z,n[15]=v*b+y*D+M*j+A*k,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 a=0,o=i;r>a;a+=3,o+=3)e.fromArray(t,o),e.applyMatrix4(this),e.toArray(t,o);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 a=0,o=i;r>a;a++,o++)e.x=t.getX(o),e.y=t.getY(o),e.z=t.getZ(o),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],a=e[1],o=e[5],s=e[9],c=e[13],u=e[2],l=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+n*s*l-r*c*l-n*o*h+i*c*h+r*o*d-i*s*d)+f*(+t*s*d-t*c*h+n*a*h-r*a*d+r*c*u-n*s*u)+m*(+t*c*l-t*o*d-n*a*l+i*a*d+n*o*u-i*c*u)+g*(-r*o*u-t*s*l+t*o*h+r*a*l-i*a*h+i*s*u)},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){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},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],a=r[1],o=r[2],s=r[3],c=r[4],u=r[5],l=r[6],h=r[7],d=r[8],p=r[9],f=r[10],m=r[11],g=r[12],v=r[13],y=r[14],M=r[15],A=p*y*h-v*f*h+v*l*m-u*y*m-p*l*M+u*f*M,x=g*f*h-d*y*h-g*l*m+c*y*m+d*l*M-c*f*M,w=d*v*h-g*p*h+g*u*m-c*v*m-d*u*M+c*p*M,E=g*p*l-d*v*l-g*u*f+c*v*f+d*u*y-c*p*y,b=n*A+a*x+o*w+s*E;if(0===b){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(T);return console.warn(T),this.identity()}return i[0]=A,i[1]=v*f*s-p*y*s-v*o*m+a*y*m+p*o*M-a*f*M,i[2]=u*y*s-v*l*s+v*o*h-a*y*h-u*o*M+a*l*M,i[3]=p*l*s-u*f*s-p*o*h+a*f*h+u*o*m-a*l*m,i[4]=x,i[5]=d*y*s-g*f*s+g*o*m-n*y*m-d*o*M+n*f*M,i[6]=g*l*s-c*y*s-g*o*h+n*y*h+c*o*M-n*l*M,i[7]=c*f*s-d*l*s+d*o*h-n*f*h-c*o*m+n*l*m,i[8]=w,i[9]=g*p*s-d*v*s-g*a*m+n*v*m+d*a*M-n*p*M,i[10]=c*v*s-g*u*s+g*a*h-n*v*h-c*a*M+n*u*M,i[11]=d*u*s-c*p*s-d*a*h+n*p*h+c*a*m-n*u*m,i[12]=E,i[13]=d*v*o-g*p*o+g*a*f-n*v*f-d*a*y+n*p*y,i[14]=g*u*o-c*v*o-g*a*l+n*v*l+c*a*y-n*u*y,i[15]=c*p*o-d*u*o+d*a*l-n*p*l-c*a*f+n*u*f,this.multiplyScalar(1/b)},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,a=e.x,o=e.y,s=e.z,c=n*a,u=n*o;return this.set(c*a+i,c*o-r*s,c*s+r*o,0,c*o+r*s,u*o+i,u*s-r*a,0,c*s-r*o,u*s+r*a,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,a){void 0===e&&(e=new n.Vector3),void 0===t&&(t=new n.Matrix4);var o=this.elements,s=e.set(o[0],o[1],o[2]).length(),c=e.set(o[4],o[5],o[6]).length(),u=e.set(o[8],o[9],o[10]).length(),l=this.determinant();0>l&&(s=-s),i.x=o[12],i.y=o[13],i.z=o[14],t.elements.set(this.elements);var h=1/s,d=1/c,p=1/u;return t.elements[0]*=h,t.elements[1]*=h,t.elements[2]*=h,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),a.x=s,a.y=c,a.z=u,this}}(),makeFrustum:function(e,t,i,r,n,a){var o=this.elements,s=2*n/(t-e),c=2*n/(r-i),u=(t+e)/(t-e),l=(r+i)/(r-i),h=-(a+n)/(a-n),d=-2*a*n/(a-n);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(e,t,i,r){var a=i*Math.tan(n.Math.DEG2RAD*e*.5),o=-a,s=o*t,c=a*t;return this.makeFrustum(s,c,o,a,i,r)},makeOrthographic:function(e,t,i,r,n,a){var o=this.elements,s=1/(t-e),c=1/(i-r),u=1/(a-n),l=(t+e)*s,h=(i+r)*c,d=(a+n)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[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(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);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}},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,a,o){e.copy(r).add(n).multiplyScalar(.5),t.copy(n).sub(r).normalize(),i.copy(this.origin).sub(e);var s,c,u,l,h=.5*r.distanceTo(n),d=-this.direction.dot(t),p=i.dot(this.direction),f=-i.dot(t),m=i.lengthSq(),g=Math.abs(1-d*d);if(g>0)if(s=d*f-p,c=d*p-f,l=h*g,s>=0)if(c>=-l)if(l>=c){var v=1/g;s*=v,c*=v,u=s*(s+d*c+2*p)+c*(d*s+c+2*f)+m}else c=h,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;else c=-h,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;else-l>=c?(s=Math.max(0,-(-d*h+p)),c=s>0?-h:Math.min(Math.max(-h,-f),h),u=-s*s+c*(c+2*f)+m):l>=c?(s=0,c=Math.min(Math.max(-h,-f),h),u=c*(c+2*f)+m):(s=Math.max(0,-(d*h+p)),c=s>0?h:Math.min(Math.max(-h,-f),h),u=-s*s+c*(c+2*f)+m);else c=d>0?-h:h,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(t).multiplyScalar(c).add(e),u}}(),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,a=t.radius*t.radius;if(n>a)return null;var o=Math.sqrt(a-n),s=r-o,c=r+o;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,a,o,s,c=1/this.direction.x,u=1/this.direction.y,l=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(n=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(n=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),i>a||n>r?null:((n>i||i!==i)&&(i=n),(r>a||r!==r)&&(r=a),l>=0?(o=(e.min.z-h.z)*l,s=(e.max.z-h.z)*l):(o=(e.max.z-h.z)*l,s=(e.min.z-h.z)*l),i>s||o>r?null:((o>i||i!==i)&&(i=o),(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,a,o,s,c){t.subVectors(a,n),i.subVectors(o,n),r.crossVectors(t,i);var u,l=this.direction.dot(r);if(l>0){if(s)return null;u=1}else{if(!(0>l))return null;u=-1,l=-l}e.subVectors(this.origin,n);var h=u*this.direction.dot(i.crossVectors(e,i));if(0>h)return null;var d=u*this.direction.dot(t.cross(e));if(0>d)return null;if(h+d>l)return null;var p=-u*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,a=0,o=t.length;o>a;a++)n=Math.max(n,r.distanceToSquared(t[a]));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,a,o){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!==a?a:new n.Plane,void 0!==o?o:new n.Plane]},n.Frustum.prototype={constructor:n.Frustum,set:function(e,t,i,r,n,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(n),o[5].copy(a),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],a=i[2],o=i[3],s=i[4],c=i[5],u=i[6],l=i[7],h=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(o-r,l-s,f-h,y-m).normalize(),t[1].setComponents(o+r,l+s,f+h,y+m).normalize(),t[2].setComponents(o+n,l+c,f+d,y+g).normalize(),t[3].setComponents(o-n,l-c,f-d,y-g).normalize(),t[4].setComponents(o-a,l-u,f-p,y-v).normalize(),t[5].setComponents(o+a,l+u,f+p,y+v).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 a=t[n].distanceToPoint(i);if(r>a)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 a=r[n];e.x=a.normal.x>0?i.mi |