solari
Version:
Solari board on a Canvas using THREE.js
2 lines • 355 kB
JavaScript
!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.Solari=e()}}(function(){var e;return function t(e,i,r){function n(a,s){if(!i[a]){if(!e[a]){var h="function"==typeof require&&require;if(!s&&h)return h(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[a]={exports:{}};e[a][0].call(c.exports,function(t){var i=e[a][1][t];return n(i?i:t)},c,c.exports,t,e,i,r)}return i[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)n(r[a]);return n}({1:[function(t,i,r){(function(){function t(e){function t(t,i,r,n,o,a){for(;o>=0&&a>o;o+=e){var s=n?n[o]:o;r=i(r,t[s],s,t)}return r}return function(i,r,n,o){r=_(r,o,4);var a=!L(i)&&w.keys(i),s=(a||i).length,h=e>0?0:s-1;return arguments.length<3&&(n=i[a?a[h]:h],h+=e),t(i,r,n,a,h,s)}}function n(e){return function(t,i,r){i=S(i,r);for(var n=R(t),o=e>0?0:n-1;o>=0&&n>o;o+=e)if(i(t[o],o,t))return o;return-1}}function o(e,t,i){return function(r,n,o){var a=0,s=R(r);if("number"==typeof o)e>0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(i&&o&&s)return o=i(r,n),r[o]===n?o:-1;if(n!==n)return o=t(p.call(r,a,s),w.isNaN),o>=0?o+a:-1;for(o=e>0?a:s-1;o>=0&&s>o;o+=e)if(r[o]===n)return o;return-1}}function a(e,t){var i=F.length,r=e.constructor,n=w.isFunction(r)&&r.prototype||c,o="constructor";for(w.has(e,o)&&!w.contains(t,o)&&t.push(o);i--;)o=F[i],o in e&&e[o]!==n[o]&&!w.contains(t,o)&&t.push(o)}var s=this,h=s._,l=Array.prototype,c=Object.prototype,u=Function.prototype,f=l.push,p=l.slice,d=c.toString,m=c.hasOwnProperty,g=Array.isArray,v=Object.keys,y=u.bind,x=Object.create,b=function(){},w=function(e){return e instanceof w?e:this instanceof w?void(this._wrapped=e):new w(e)};"undefined"!=typeof r?("undefined"!=typeof i&&i.exports&&(r=i.exports=w),r._=w):s._=w,w.VERSION="1.8.3";var _=function(e,t,i){if(void 0===t)return e;switch(null==i?3:i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,r){return e.call(t,i,r)};case 3:return function(i,r,n){return e.call(t,i,r,n)};case 4:return function(i,r,n,o){return e.call(t,i,r,n,o)}}return function(){return e.apply(t,arguments)}},S=function(e,t,i){return null==e?w.identity:w.isFunction(e)?_(e,t,i):w.isObject(e)?w.matcher(e):w.property(e)};w.iteratee=function(e,t){return S(e,t,1/0)};var M=function(e,t){return function(i){var r=arguments.length;if(2>r||null==i)return i;for(var n=1;r>n;n++)for(var o=arguments[n],a=e(o),s=a.length,h=0;s>h;h++){var l=a[h];t&&void 0!==i[l]||(i[l]=o[l])}return i}},C=function(e){if(!w.isObject(e))return{};if(x)return x(e);b.prototype=e;var t=new b;return b.prototype=null,t},A=function(e){return function(t){return null==t?void 0:t[e]}},T=Math.pow(2,53)-1,R=A("length"),L=function(e){var t=R(e);return"number"==typeof t&&t>=0&&T>=t};w.each=w.forEach=function(e,t,i){t=_(t,i);var r,n;if(L(e))for(r=0,n=e.length;n>r;r++)t(e[r],r,e);else{var o=w.keys(e);for(r=0,n=o.length;n>r;r++)t(e[o[r]],o[r],e)}return e},w.map=w.collect=function(e,t,i){t=S(t,i);for(var r=!L(e)&&w.keys(e),n=(r||e).length,o=Array(n),a=0;n>a;a++){var s=r?r[a]:a;o[a]=t(e[s],s,e)}return o},w.reduce=w.foldl=w.inject=t(1),w.reduceRight=w.foldr=t(-1),w.find=w.detect=function(e,t,i){var r;return r=L(e)?w.findIndex(e,t,i):w.findKey(e,t,i),void 0!==r&&-1!==r?e[r]:void 0},w.filter=w.select=function(e,t,i){var r=[];return t=S(t,i),w.each(e,function(e,i,n){t(e,i,n)&&r.push(e)}),r},w.reject=function(e,t,i){return w.filter(e,w.negate(S(t)),i)},w.every=w.all=function(e,t,i){t=S(t,i);for(var r=!L(e)&&w.keys(e),n=(r||e).length,o=0;n>o;o++){var a=r?r[o]:o;if(!t(e[a],a,e))return!1}return!0},w.some=w.any=function(e,t,i){t=S(t,i);for(var r=!L(e)&&w.keys(e),n=(r||e).length,o=0;n>o;o++){var a=r?r[o]:o;if(t(e[a],a,e))return!0}return!1},w.contains=w.includes=w.include=function(e,t,i,r){return L(e)||(e=w.values(e)),("number"!=typeof i||r)&&(i=0),w.indexOf(e,t,i)>=0},w.invoke=function(e,t){var i=p.call(arguments,2),r=w.isFunction(t);return w.map(e,function(e){var n=r?t:e[t];return null==n?n:n.apply(e,i)})},w.pluck=function(e,t){return w.map(e,w.property(t))},w.where=function(e,t){return w.filter(e,w.matcher(t))},w.findWhere=function(e,t){return w.find(e,w.matcher(t))},w.max=function(e,t,i){var r,n,o=-(1/0),a=-(1/0);if(null==t&&null!=e){e=L(e)?e:w.values(e);for(var s=0,h=e.length;h>s;s++)r=e[s],r>o&&(o=r)}else t=S(t,i),w.each(e,function(e,i,r){n=t(e,i,r),(n>a||n===-(1/0)&&o===-(1/0))&&(o=e,a=n)});return o},w.min=function(e,t,i){var r,n,o=1/0,a=1/0;if(null==t&&null!=e){e=L(e)?e:w.values(e);for(var s=0,h=e.length;h>s;s++)r=e[s],o>r&&(o=r)}else t=S(t,i),w.each(e,function(e,i,r){n=t(e,i,r),(a>n||n===1/0&&o===1/0)&&(o=e,a=n)});return o},w.shuffle=function(e){for(var t,i=L(e)?e:w.values(e),r=i.length,n=Array(r),o=0;r>o;o++)t=w.random(0,o),t!==o&&(n[o]=n[t]),n[t]=i[o];return n},w.sample=function(e,t,i){return null==t||i?(L(e)||(e=w.values(e)),e[w.random(e.length-1)]):w.shuffle(e).slice(0,Math.max(0,t))},w.sortBy=function(e,t,i){return t=S(t,i),w.pluck(w.map(e,function(e,i,r){return{value:e,index:i,criteria:t(e,i,r)}}).sort(function(e,t){var i=e.criteria,r=t.criteria;if(i!==r){if(i>r||void 0===i)return 1;if(r>i||void 0===r)return-1}return e.index-t.index}),"value")};var V=function(e){return function(t,i,r){var n={};return i=S(i,r),w.each(t,function(r,o){var a=i(r,o,t);e(n,r,a)}),n}};w.groupBy=V(function(e,t,i){w.has(e,i)?e[i].push(t):e[i]=[t]}),w.indexBy=V(function(e,t,i){e[i]=t}),w.countBy=V(function(e,t,i){w.has(e,i)?e[i]++:e[i]=1}),w.toArray=function(e){return e?w.isArray(e)?p.call(e):L(e)?w.map(e,w.identity):w.values(e):[]},w.size=function(e){return null==e?0:L(e)?e.length:w.keys(e).length},w.partition=function(e,t,i){t=S(t,i);var r=[],n=[];return w.each(e,function(e,i,o){(t(e,i,o)?r:n).push(e)}),[r,n]},w.first=w.head=w.take=function(e,t,i){return null==e?void 0:null==t||i?e[0]:w.initial(e,e.length-t)},w.initial=function(e,t,i){return p.call(e,0,Math.max(0,e.length-(null==t||i?1:t)))},w.last=function(e,t,i){return null==e?void 0:null==t||i?e[e.length-1]:w.rest(e,Math.max(0,e.length-t))},w.rest=w.tail=w.drop=function(e,t,i){return p.call(e,null==t||i?1:t)},w.compact=function(e){return w.filter(e,w.identity)};var P=function(e,t,i,r){for(var n=[],o=0,a=r||0,s=R(e);s>a;a++){var h=e[a];if(L(h)&&(w.isArray(h)||w.isArguments(h))){t||(h=P(h,t,i));var l=0,c=h.length;for(n.length+=c;c>l;)n[o++]=h[l++]}else i||(n[o++]=h)}return n};w.flatten=function(e,t){return P(e,t,!1)},w.without=function(e){return w.difference(e,p.call(arguments,1))},w.uniq=w.unique=function(e,t,i,r){w.isBoolean(t)||(r=i,i=t,t=!1),null!=i&&(i=S(i,r));for(var n=[],o=[],a=0,s=R(e);s>a;a++){var h=e[a],l=i?i(h,a,e):h;t?(a&&o===l||n.push(h),o=l):i?w.contains(o,l)||(o.push(l),n.push(h)):w.contains(n,h)||n.push(h)}return n},w.union=function(){return w.uniq(P(arguments,!0,!0))},w.intersection=function(e){for(var t=[],i=arguments.length,r=0,n=R(e);n>r;r++){var o=e[r];if(!w.contains(t,o)){for(var a=1;i>a&&w.contains(arguments[a],o);a++);a===i&&t.push(o)}}return t},w.difference=function(e){var t=P(arguments,!0,!0,1);return w.filter(e,function(e){return!w.contains(t,e)})},w.zip=function(){return w.unzip(arguments)},w.unzip=function(e){for(var t=e&&w.max(e,R).length||0,i=Array(t),r=0;t>r;r++)i[r]=w.pluck(e,r);return i},w.object=function(e,t){for(var i={},r=0,n=R(e);n>r;r++)t?i[e[r]]=t[r]:i[e[r][0]]=e[r][1];return i},w.findIndex=n(1),w.findLastIndex=n(-1),w.sortedIndex=function(e,t,i,r){i=S(i,r,1);for(var n=i(t),o=0,a=R(e);a>o;){var s=Math.floor((o+a)/2);i(e[s])<n?o=s+1:a=s}return o},w.indexOf=o(1,w.findIndex,w.sortedIndex),w.lastIndexOf=o(-1,w.findLastIndex),w.range=function(e,t,i){null==t&&(t=e||0,e=0),i=i||1;for(var r=Math.max(Math.ceil((t-e)/i),0),n=Array(r),o=0;r>o;o++,e+=i)n[o]=e;return n};var E=function(e,t,i,r,n){if(!(r instanceof t))return e.apply(i,n);var o=C(e.prototype),a=e.apply(o,n);return w.isObject(a)?a:o};w.bind=function(e,t){if(y&&e.bind===y)return y.apply(e,p.call(arguments,1));if(!w.isFunction(e))throw new TypeError("Bind must be called on a function");var i=p.call(arguments,2),r=function(){return E(e,r,t,this,i.concat(p.call(arguments)))};return r},w.partial=function(e){var t=p.call(arguments,1),i=function(){for(var r=0,n=t.length,o=Array(n),a=0;n>a;a++)o[a]=t[a]===w?arguments[r++]:t[a];for(;r<arguments.length;)o.push(arguments[r++]);return E(e,i,this,this,o)};return i},w.bindAll=function(e){var t,i,r=arguments.length;if(1>=r)throw new Error("bindAll must be passed function names");for(t=1;r>t;t++)i=arguments[t],e[i]=w.bind(e[i],e);return e},w.memoize=function(e,t){var i=function(r){var n=i.cache,o=""+(t?t.apply(this,arguments):r);return w.has(n,o)||(n[o]=e.apply(this,arguments)),n[o]};return i.cache={},i},w.delay=function(e,t){var i=p.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},w.defer=w.partial(w.delay,w,1),w.throttle=function(e,t,i){var r,n,o,a=null,s=0;i||(i={});var h=function(){s=i.leading===!1?0:w.now(),a=null,o=e.apply(r,n),a||(r=n=null)};return function(){var l=w.now();s||i.leading!==!1||(s=l);var c=t-(l-s);return r=this,n=arguments,0>=c||c>t?(a&&(clearTimeout(a),a=null),s=l,o=e.apply(r,n),a||(r=n=null)):a||i.trailing===!1||(a=setTimeout(h,c)),o}},w.debounce=function(e,t,i){var r,n,o,a,s,h=function(){var l=w.now()-a;t>l&&l>=0?r=setTimeout(h,t-l):(r=null,i||(s=e.apply(o,n),r||(o=n=null)))};return function(){o=this,n=arguments,a=w.now();var l=i&&!r;return r||(r=setTimeout(h,t)),l&&(s=e.apply(o,n),o=n=null),s}},w.wrap=function(e,t){return w.partial(t,e)},w.negate=function(e){return function(){return!e.apply(this,arguments)}},w.compose=function(){var e=arguments,t=e.length-1;return function(){for(var i=t,r=e[t].apply(this,arguments);i--;)r=e[i].call(this,r);return r}},w.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},w.before=function(e,t){var i;return function(){return--e>0&&(i=t.apply(this,arguments)),1>=e&&(t=null),i}},w.once=w.partial(w.before,2);var z=!{toString:null}.propertyIsEnumerable("toString"),F=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];w.keys=function(e){if(!w.isObject(e))return[];if(v)return v(e);var t=[];for(var i in e)w.has(e,i)&&t.push(i);return z&&a(e,t),t},w.allKeys=function(e){if(!w.isObject(e))return[];var t=[];for(var i in e)t.push(i);return z&&a(e,t),t},w.values=function(e){for(var t=w.keys(e),i=t.length,r=Array(i),n=0;i>n;n++)r[n]=e[t[n]];return r},w.mapObject=function(e,t,i){t=S(t,i);for(var r,n=w.keys(e),o=n.length,a={},s=0;o>s;s++)r=n[s],a[r]=t(e[r],r,e);return a},w.pairs=function(e){for(var t=w.keys(e),i=t.length,r=Array(i),n=0;i>n;n++)r[n]=[t[n],e[t[n]]];return r},w.invert=function(e){for(var t={},i=w.keys(e),r=0,n=i.length;n>r;r++)t[e[i[r]]]=i[r];return t},w.functions=w.methods=function(e){var t=[];for(var i in e)w.isFunction(e[i])&&t.push(i);return t.sort()},w.extend=M(w.allKeys),w.extendOwn=w.assign=M(w.keys),w.findKey=function(e,t,i){t=S(t,i);for(var r,n=w.keys(e),o=0,a=n.length;a>o;o++)if(r=n[o],t(e[r],r,e))return r},w.pick=function(e,t,i){var r,n,o={},a=e;if(null==a)return o;w.isFunction(t)?(n=w.allKeys(a),r=_(t,i)):(n=P(arguments,!1,!1,1),r=function(e,t,i){return t in i},a=Object(a));for(var s=0,h=n.length;h>s;s++){var l=n[s],c=a[l];r(c,l,a)&&(o[l]=c)}return o},w.omit=function(e,t,i){if(w.isFunction(t))t=w.negate(t);else{var r=w.map(P(arguments,!1,!1,1),String);t=function(e,t){return!w.contains(r,t)}}return w.pick(e,t,i)},w.defaults=M(w.allKeys,!0),w.create=function(e,t){var i=C(e);return t&&w.extendOwn(i,t),i},w.clone=function(e){return w.isObject(e)?w.isArray(e)?e.slice():w.extend({},e):e},w.tap=function(e,t){return t(e),e},w.isMatch=function(e,t){var i=w.keys(t),r=i.length;if(null==e)return!r;for(var n=Object(e),o=0;r>o;o++){var a=i[o];if(t[a]!==n[a]||!(a in n))return!1}return!0};var k=function(e,t,i,r){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof w&&(e=e._wrapped),t instanceof w&&(t=t._wrapped);var n=d.call(e);if(n!==d.call(t))return!1;switch(n){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var o="[object Array]"===n;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!(w.isFunction(a)&&a instanceof a&&w.isFunction(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}i=i||[],r=r||[];for(var h=i.length;h--;)if(i[h]===e)return r[h]===t;if(i.push(e),r.push(t),o){if(h=e.length,h!==t.length)return!1;for(;h--;)if(!k(e[h],t[h],i,r))return!1}else{var l,c=w.keys(e);if(h=c.length,w.keys(t).length!==h)return!1;for(;h--;)if(l=c[h],!w.has(t,l)||!k(e[l],t[l],i,r))return!1}return i.pop(),r.pop(),!0};w.isEqual=function(e,t){return k(e,t)},w.isEmpty=function(e){return null==e?!0:L(e)&&(w.isArray(e)||w.isString(e)||w.isArguments(e))?0===e.length:0===w.keys(e).length},w.isElement=function(e){return!(!e||1!==e.nodeType)},w.isArray=g||function(e){return"[object Array]"===d.call(e)},w.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},w.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){w["is"+e]=function(t){return d.call(t)==="[object "+e+"]"}}),w.isArguments(arguments)||(w.isArguments=function(e){return w.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(w.isFunction=function(e){return"function"==typeof e||!1}),w.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},w.isNaN=function(e){return w.isNumber(e)&&e!==+e},w.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===d.call(e)},w.isNull=function(e){return null===e},w.isUndefined=function(e){return void 0===e},w.has=function(e,t){return null!=e&&m.call(e,t)},w.noConflict=function(){return s._=h,this},w.identity=function(e){return e},w.constant=function(e){return function(){return e}},w.noop=function(){},w.property=A,w.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},w.matcher=w.matches=function(e){return e=w.extendOwn({},e),function(t){return w.isMatch(t,e)}},w.times=function(e,t,i){var r=Array(Math.max(0,e));t=_(t,i,1);for(var n=0;e>n;n++)r[n]=t(n);return r},w.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},w.now=Date.now||function(){return(new Date).getTime()};var U={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},N=w.invert(U),B=function(e){var t=function(t){return e[t]},i="(?:"+w.keys(e).join("|")+")",r=RegExp(i),n=RegExp(i,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(n,t):e}};w.escape=B(U),w.unescape=B(N),w.result=function(e,t,i){var r=null==e?void 0:e[t];return void 0===r&&(r=i),w.isFunction(r)?r.call(e):r};var D=0;w.uniqueId=function(e){var t=++D+"";return e?e+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,I={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\u2028|\u2029/g,W=function(e){return"\\"+I[e]};w.template=function(e,t,i){!t&&i&&(t=i),t=w.defaults({},t,w.templateSettings);var r=RegExp([(t.escape||O).source,(t.interpolate||O).source,(t.evaluate||O).source].join("|")+"|$","g"),n=0,o="__p+='";e.replace(r,function(t,i,r,a,s){return o+=e.slice(n,s).replace(j,W),n=s+t.length,i?o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(t.variable||"obj","_",o)}catch(s){throw s.source=o,s}var h=function(e){return a.call(this,e,w)},l=t.variable||"obj";return h.source="function("+l+"){\n"+o+"}",h},w.chain=function(e){var t=w(e);return t._chain=!0,t};var G=function(e,t){return e._chain?w(t).chain():t};w.mixin=function(e){w.each(w.functions(e),function(t){var i=w[t]=e[t];w.prototype[t]=function(){var e=[this._wrapped];return f.apply(e,arguments),G(this,i.apply(w,e))}})},w.mixin(w),w.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=l[e];w.prototype[e]=function(){var i=this._wrapped;return t.apply(i,arguments),"shift"!==e&&"splice"!==e||0!==i.length||delete i[0],G(this,i)}}),w.each(["concat","join","slice"],function(e){var t=l[e];w.prototype[e]=function(){return G(this,t.apply(this._wrapped,arguments))}}),w.prototype.value=function(){return this._wrapped},w.prototype.valueOf=w.prototype.toJSON=w.prototype.value,w.prototype.toString=function(){return""+this._wrapped},"function"==typeof e&&e.amd&&e("underscore",[],function(){return w})}).call(this)},{}],2:[function(e,t,i){var r,n=e("three"),o=Math.PI/180,a=1400;r=function(e,t,i){var r=t,s=i;t+=3,i-=10;var h=3*e.faceWidth/4,l=2*e.faceHeight/3,c=new n.Mesh(new n.PlaneGeometry(h,l),e.spriteMaterial),u=new n.Mesh(new n.PlaneGeometry(h,l),e.spriteMaterial),f=new n.Mesh(new n.CubeGeometry(h,l,0,1,1,1,[null,null,null,null,e.spriteMaterial,e.spriteMaterial]),new n.MeshFaceMaterial),p=1.1-.2*Math.random();this.SPEED=a*o/1e3*p,this.textureSet=e,this.top_g=c.geometry,this.bottom_g=u.geometry,this.flap_g=f.geometry,this.top_g.dynamic=this.bottom_g.dynamic=this.flap_g.dynamic=!0,u.position=new n.Vector3(t,i,0),c.position=new n.Vector3(t,i+l,0),f.position=new n.Vector3(0,l/2,0),this.flapWrapper=new n.Object3D,this.flapWrapper.position=new n.Vector3(t,i+l/2,2),this.flapWrapper.add(f);var d=new n.LineBasicMaterial({color:466734,linewidth:5}),m=new n.LineBasicMaterial({color:0,linewidth:2}),g=new n.Mesh(new n.PlaneGeometry(e.faceWidth,2*e.faceHeight),d);g.position=new n.Vector3(r,s,0);var v=new n.Mesh(new n.PlaneGeometry(e.faceWidth,1),m);v.position=new n.Vector3(r,s+11,0),this.objToRender=[c,u,this.flapWrapper,v,g],this.i=0,this.setUpTextures(0,1)},r.prototype={MAX_X:180*o,initialize:function(e,t,i){var r=e.faceWidth,s=e.faceHeight,h=new n.Mesh(new n.PlaneGeometry(r,s),e.spriteMaterial),l=new n.Mesh(new n.PlaneGeometry(r,s),e.spriteMaterial),c=new n.Mesh(new n.CubeGeometry(r,s,0,1,1,1,[null,null,null,null,e.spriteMaterial,e.spriteMaterial]),new n.MeshFaceMaterial),u=1.1-.2*Math.random();this.SPEED=a*o/1e3*u,this.textureSet=e,this.top_g=h.geometry,this.bottom_g=l.geometry,this.flap_g=c.geometry,this.top_g.dynamic=this.bottom_g.dynamic=this.flap_g.dynamic=!0,l.position=new n.Vector3(t,i,0),h.position=new n.Vector3(t,i+s,0),c.position=new n.Vector3(0,s/2,0),this.flapWrapper=new n.Object3D,this.flapWrapper.position=new n.Vector3(t,i+s/2,2),this.flapWrapper.add(c),this.objToRender=[h,l,this.flapWrapper],this.i=0,this.spins=0,this.setUpTextures(0,1)},setUpTextures:function(e,t){var i=this.textureSet.UV[e],r=this.textureSet.UV[t];this.top_g.faceVertexUvs[0][0]=r.top,this.bottom_g.faceVertexUvs[0][0]=i.bottom,this.flap_g.faceVertexUvs[0][4]=i.top,this.flap_g.faceVertexUvs[0][5]=r.back,this.top_g.__dirtyUvs=this.bottom_g.__dirtyUvs=this.flap_g.__dirtyUvs=!0},setChar:function(e){var t=this.textureSet.chars.indexOf(e);this.currentChar=-1!==t?t:this.textureSet.max,this.wedged=this.currentChar===this.i;var i=this.currentChar-this.i;return this.spins=0,i>0?this.spins=i:0>i&&(this.spins=this.textureSet.max+1+i),this},next:function(){window.Board.audio().play(),clearTimeout(window.to),window.to=setTimeout(function(){window.Board.audio().pause(),window.Board.audio().currentTime=0},200),this.i=this.i>=this.textureSet.max?0:this.i+1;var e=this.i+1>this.textureSet.max?0:this.i+1;this.setUpTextures(this.i,e),this.wedged=this.currentChar===this.i},update:function(e){if(this.wedged)return this.flapWrapper.rotation.x=0,!0;var t=this.flapWrapper.rotation.x;return t+=e*this.SPEED,this.flapWrapper.rotation.x=t,t>this.MAX_X&&(this.flapWrapper.rotation.x=0,this.next()),!1}},t.exports=r},{three:7}],3:[function(e,t,i){var r=e("./solari-flap"),n=e("underscore"),o=function(e,t){this.flaps=[],this.y=e||0,this.x=0,this.height=0,this.spins=0};o.prototype={add:function(e){var t=new r(e,this.x+e.faceWidth/2,-this.y);return this.height=Math.max(this.height,2*e.faceHeight),this.x+=e.faceWidth+6,this.flaps.push(t),this},setChars:function(e){var t=0;return n.each(this.flaps,function(i,r){var n=i.setChar(e[r]?e[r]:" ");n.spins>t&&(t=n.spins)}),this.spins=t,this}},t.exports=o},{"./solari-flap":2,underscore:1}],4:[function(e,t,i){var r=e("three"),n=e("underscore"),o=e("backbone-events"),a=function(e,t,i,r){};a.prototype=n.extend({loaded:!1,chars:[],faces:{},load:function(e,t,i,n){this.chars=t,this.faceWidth=i,this.faceHeight=n,this.max=t.length-1,this.spriteMaterial=new r.MeshLambertMaterial({map:r.ImageUtils.loadTexture(e)}),this.UV=this.buildUVs();var o=this,a=new Image;a.onload=function(){o.trigger("load")},a.src=e},buildUVs:function(e){var t={},i=0,n=0,o=1/this.chars.length,a=.5;return this.chars.forEach(function(e,s){t[s]={top:[new r.UV(i,n),new r.UV(i,n+a),new r.UV(i+o,n+a),new r.UV(i+o,n)],bottom:[new r.UV(i,n+a),new r.UV(i,n+2*a),new r.UV(i+o,n+2*a),new r.UV(i+o,n+a)],back:[new r.UV(i+o,n+2*a),new r.UV(i+o,n+a),new r.UV(i,n+a),new r.UV(i,n+2*a)]},i+=o}),t}},o),t.exports=a},{"backbone-events":6,three:7,underscore:1}],5:[function(e,t,i){var r=e("three"),n=e("underscore"),o=e("backbone-events"),a=e("./solari-texture"),s=e("./solari-row");String.prototype.rpad=function(e,t){for(var i=this;i.length<t;)i+=e;return i},String.prototype.truncate=function(e){return this.length=e,this},window.requestAnimFrame=function(e){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}();var h=function(){this.animate=!1,this.flaps=[],this.rows=[],this.y=-60,this.width=window.innerWidth,this.height=window.innerHeight,this.aspect=this.width/this.height,this.renderer=new r.WebGLRenderer,this.renderer.sortObjects=!1,this.camera=new r.PerspectiveCamera(20,window.innerWidth/window.innerHeight,this.NEAR,this.FAR),this.scene=new r.Scene,this.renderer.setSize(this.width,this.height),this.camera.position.z=3200,this.camera.lookAt(new r.Vector3(0,0,0)),this.spins=0,this.el=this.renderer.domElement,this.started=!1};h.prototype=n.extend({VIEW_ANGLE:45,NEAR:1,FAR:1e4,render:function(){this.renderer.render(this.scene,this.camera),this.showStats&&this.stats.update()},add:function(e){this.rows.push(e),this.flaps=this.flaps.concat(e.flaps);var t=this;return n.each(e.flaps,function(e){n.each(e.objToRender,function(e){t.scene.add(e)})}),this.y+=e.height+10,this.camera.position.x=(e.x-10)/2,this.camera.position.y=-((e.y-e.height/2)/2),window.addEventListener("resize",n.bind(this.resizeHandler,this)),this},update:function(e){var t,i=this.flaps,r=!0;for(t=0;t<i.length;t++)r=i[t].update(e)&&r;return r},start:function(){function e(){var r=(new Date).getTime(),n=r-i;i=r,t.anim=!t.update(n),t.render(),t.anim?requestAnimFrame(e):setTimeout(function(){e((new Date).getTime())},2e3)}if(!this.started){var t=this,i=(new Date).getTime();e(),this.trigger("start"),this.started=!0}},setMessage:function(e){var t=0;return n.each(this.rows,function(i,r){var n=i.setChars(e[r]?e[r]:" ");n.spins>t&&(t=n.spins)}),this.spins=t,console.log("Spins: "+this.spins),this},resizeHandler:function(){var e=window.innerWidth,t=window.innerHeight;this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.render()}},o),t.exports={Solari:h,SolariRow:s,SolariTexture:a}},{"./solari-row":3,"./solari-texture":4,"backbone-events":6,three:7,underscore:1}],6:[function(e,t,i){(function(e){(function(e,t,i,r,n){var o={bind:function(e,t,i){var r=this._callbacks||(this._callbacks={}),n=r[e]||(r[e]=[]);return n.push([t,i]),this},unbind:function(e,t){var i;if(e){if(i=this._callbacks)if(t){var r=i[e];if(!r)return this;for(var n=0,o=r.length;o>n;n++)if(r[n]&&t===r[n][0]){r[n]=null;break}}else i[e]=[]}else this._callbacks={};return this},trigger:function(e){var t,i,r,n,o,a=2;if(!(i=this._callbacks))return this;for(;a--;)if(r=a?e:"all",t=i[r])for(var s=0,h=t.length;h>s;s++)(n=t[s])?(o=a?Array.prototype.slice.call(arguments,1):arguments,n[0].apply(n[1]||this,o)):(t.splice(s,1),s--,h--);return this}};n("undefined"!=typeof o?o:window.Events)}).call(e,void 0,void 0,void 0,void 0,function(e){t.exports=e})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,n){(function(e){(function(e,t,n,o,h){var c=c||{};self.Int32Array||(self.Int32Array=Array,self.Float32Array=Array),c.Color=function(e){return void 0!==e&&this.setHex(e),this},c.Color.prototype={constructor:c.Color,r:1,g:1,b:1,copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSV:function(e,t,i){var r,n,o;if(0==i)this.r=this.g=this.b=0;else switch(r=Math.floor(6*e),n=6*e-r,e=i*(1-t),o=i*(1-t*n),t=i*(1-t*(1-n)),r){case 1:this.r=o,this.g=i,this.b=e;break;case 2:this.r=e,this.g=i,this.b=t;break;case 3:this.r=e,this.g=o,this.b=i;break;case 4:this.r=t,this.g=e,this.b=i;break;case 5:this.r=i,this.g=e,this.b=o;break;case 6:case 0:this.r=i,this.g=t,this.b=e}return this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},getHex:function(){return~~(255*this.r)<<16^~~(255*this.g)<<8^~~(255*this.b)},getContextStyle:function(){return"rgb("+Math.floor(255*this.r)+","+Math.floor(255*this.g)+","+Math.floor(255*this.b)+")"},clone:function(){return(new c.Color).setRGB(this.r,this.g,this.b)}},c.Vector2=function(e,t){this.x=e||0,this.y=t||0},c.Vector2.prototype={constructor:c.Vector2,set:function(e,t){return this.x=e,this.y=t,this},copy:function(e){return this.x=e.x,this.y=e.y,this},clone:function(){return new c.Vector2(this.x,this.y)},add:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addSelf:function(e){return this.x+=e.x,this.y+=e.y,this},sub:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divideScalar:function(e){return e?(this.x/=e,this.y/=e):this.set(0,0),this},negate:function(){return this.multiplyScalar(-1)},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.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,e=this.y-e.y;return t*t+e*e},setLength:function(e){return this.normalize().multiplyScalar(e)},equals:function(e){return e.x==this.x&&e.y==this.y}},c.Vector3=function(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0},c.Vector3.prototype={constructor:c.Vector3,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},clone:function(){return new c.Vector3(this.x,this.y,this.z)},add:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addSelf:function(e){return 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},sub:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},multiply:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},multiplySelf:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},divideSelf:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return e?(this.x/=e,this.y/=e,this.z/=e):this.set(0,0,0),this},negate:function(){return this.multiplyScalar(-1)},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.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.normalize().multiplyScalar(e)},cross:function(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this},crossSelf:function(e){return this.set(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){return(new c.Vector3).sub(this,e).lengthSq()},setPositionFromMatrix:function(e){this.x=e.n14,this.y=e.n24,this.z=e.n34},setRotationFromMatrix:function(e){var t=Math.cos(this.y);this.y=Math.asin(e.n13),Math.abs(t)>1e-5?(this.x=Math.atan2(-e.n23/t,e.n33/t),this.z=Math.atan2(-e.n12/t,e.n11/t)):(this.x=0,this.z=Math.atan2(e.n21,e.n22))},isZero:function(){return this.lengthSq()<1e-4}},c.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},c.Vector4.prototype={constructor:c.Vector4,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},copy:function(e){this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1},clone:function(){return new c.Vector4(this.x,this.y,this.z,this.w)},add: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},addSelf:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},sub: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},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},divideScalar:function(e){return e?(this.x/=e,this.y/=e,this.z/=e,this.w/=e):(this.z=this.y=this.x=0,this.w=1),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.normalize().multiplyScalar(e)},lerpSelf: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}},c.Ray=function(e,t){this.origin=e||new c.Vector3,this.direction=t||new c.Vector3},c.Ray.prototype={constructor:c.Ray,intersectScene:function(e){return this.intersectObjects(e.objects)},intersectObjects:function(e){var t,i,r=[];for(t=0,i=e.length;i>t;t++)Array.prototype.push.apply(r,this.intersectObject(e[t]));return r.sort(function(e,t){return e.distance-t.distance}),r},intersectObject:function(e){function t(e,t,i){var r;return r=i.clone().subSelf(e).dot(t),0>=r?null:(e=e.clone().addSelf(t.clone().multiplyScalar(r)),i.distanceTo(e))}function i(e,t,i,r){var r=r.clone().subSelf(t),i=i.clone().subSelf(t),n=e.clone().subSelf(t),e=r.dot(r),t=r.dot(i),r=r.dot(n),o=i.dot(i),i=i.dot(n),n=1/(e*o-t*t),o=(o*r-t*i)*n,e=(e*i-t*r)*n;return o>0&&e>0&&1>o+e}if(e instanceof c.Particle){var r=t(this.origin,this.direction,e.matrixWorld.getPosition());return null==r||r>e.scale.x?[]:[{distance:r,point:e.position,face:null,object:e}]}if(e instanceof c.Mesh){if(r=t(this.origin,this.direction,e.matrixWorld.getPosition()),null==r||r>e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)))return[];var n,o,a,s,h,l,u,f,p,d,m=e.geometry,g=m.vertices,v=[],r=0;for(n=m.faces.length;n>r;r++)o=m.faces[r],p=this.origin.clone(),d=this.direction.clone(),l=e.matrixWorld,a=l.multiplyVector3(o.centroid.clone()).subSelf(p),f=a.dot(d),0>=f||(a=l.multiplyVector3(g[o.a].position.clone()),s=l.multiplyVector3(g[o.b].position.clone()),h=l.multiplyVector3(g[o.c].position.clone()),l=o instanceof c.Face4?l.multiplyVector3(g[o.d].position.clone()):null,
u=e.matrixRotationWorld.multiplyVector3(o.normal.clone()),f=d.dot(u),!e.doubleSided&&!(e.flipSided?f>0:0>f))||(f=u.dot((new c.Vector3).sub(a,p))/f,p=p.addSelf(d.multiplyScalar(f)),o instanceof c.Face3?i(p,a,s,h)&&(o={distance:this.origin.distanceTo(p),point:p,face:o,object:e},v.push(o)):o instanceof c.Face4&&(i(p,a,s,l)||i(p,s,h,l))&&(o={distance:this.origin.distanceTo(p),point:p,face:o,object:e},v.push(o)));return v.sort(function(e,t){return e.distance-t.distance}),v}return[]}},c.Rectangle=function(){function e(){o=r-t,a=n-i}var t,i,r,n,o,a,s=!0;this.getX=function(){return t},this.getY=function(){return i},this.getWidth=function(){return o},this.getHeight=function(){return a},this.getLeft=function(){return t},this.getTop=function(){return i},this.getRight=function(){return r},this.getBottom=function(){return n},this.set=function(o,a,h,l){s=!1,t=o,i=a,r=h,n=l,e()},this.addPoint=function(o,a){s?(s=!1,t=o,i=a,r=o,n=a):(t=o>t?t:o,i=a>i?i:a,r=r>o?r:o,n=n>a?n:a),e()},this.add3Points=function(o,a,h,l,c,u){s?(s=!1,t=h>o?c>o?o:c:c>h?h:c,i=l>a?u>a?a:u:u>l?l:u,r=o>h?o>c?o:c:h>c?h:c,n=a>l?a>u?a:u:l>u?l:u):(t=h>o?c>o?t>o?o:t:t>c?c:t:c>h?t>h?h:t:t>c?c:t,i=l>a?u>a?i>a?a:i:i>u?u:i:u>l?i>l?l:i:i>u?u:i,r=o>h?o>c?o>r?o:r:c>r?c:r:h>c?h>r?h:r:c>r?c:r,n=a>l?a>u?a>n?a:n:u>n?u:n:l>u?l>n?l:n:u>n?u:n),e()},this.addRectangle=function(o){s?(s=!1,t=o.getLeft(),i=o.getTop(),r=o.getRight(),n=o.getBottom()):(t=t<o.getLeft()?t:o.getLeft(),i=i<o.getTop()?i:o.getTop(),r=r>o.getRight()?r:o.getRight(),n=n>o.getBottom()?n:o.getBottom()),e()},this.inflate=function(o){t-=o,i-=o,r+=o,n+=o,e()},this.minSelf=function(o){t=t>o.getLeft()?t:o.getLeft(),i=i>o.getTop()?i:o.getTop(),r=r<o.getRight()?r:o.getRight(),n=n<o.getBottom()?n:o.getBottom(),e()},this.intersects=function(e){return Math.min(r,e.getRight())-Math.max(t,e.getLeft())>=0&&Math.min(n,e.getBottom())-Math.max(i,e.getTop())>=0},this.empty=function(){s=!0,n=r=i=t=0,e()},this.isEmpty=function(){return s}},c.Matrix3=function(){this.m=[]},c.Matrix3.prototype={constructor:c.Matrix3,transpose:function(){var e,t=this.m;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},transposeIntoArray:function(e){var t=this.m;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}},c.Matrix4=function(e,t,i,r,n,o,a,s,h,l,u,f,p,d,m,g){this.set(void 0!==e?e:1,t||0,i||0,r||0,n||0,void 0!==o?o:1,a||0,s||0,h||0,l||0,void 0!==u?u:1,f||0,p||0,d||0,m||0,void 0!==g?g:1),this.flat=Array(16),this.m33=new c.Matrix3},c.Matrix4.prototype={constructor:c.Matrix4,set:function(e,t,i,r,n,o,a,s,h,l,c,u,f,p,d,m){return this.n11=e,this.n12=t,this.n13=i,this.n14=r,this.n21=n,this.n22=o,this.n23=a,this.n24=s,this.n31=h,this.n32=l,this.n33=c,this.n34=u,this.n41=f,this.n42=p,this.n43=d,this.n44=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.set(e.n11,e.n12,e.n13,e.n14,e.n21,e.n22,e.n23,e.n24,e.n31,e.n32,e.n33,e.n34,e.n41,e.n42,e.n43,e.n44),this},lookAt:function(e,t,i){var r=c.Matrix4.__v1,n=c.Matrix4.__v2,o=c.Matrix4.__v3;return o.sub(e,t).normalize(),0===o.length()&&(o.z=1),r.cross(i,o).normalize(),0===r.length()&&(o.x+=1e-4,r.cross(i,o).normalize()),n.cross(o,r).normalize(),this.n11=r.x,this.n12=n.x,this.n13=o.x,this.n21=r.y,this.n22=n.y,this.n23=o.y,this.n31=r.z,this.n32=n.z,this.n33=o.z,this},multiplyVector3:function(e){var t=e.x,i=e.y,r=e.z,n=1/(this.n41*t+this.n42*i+this.n43*r+this.n44);return e.x=(this.n11*t+this.n12*i+this.n13*r+this.n14)*n,e.y=(this.n21*t+this.n22*i+this.n23*r+this.n24)*n,e.z=(this.n31*t+this.n32*i+this.n33*r+this.n34)*n,e},multiplyVector4:function(e){var t=e.x,i=e.y,r=e.z,n=e.w;return e.x=this.n11*t+this.n12*i+this.n13*r+this.n14*n,e.y=this.n21*t+this.n22*i+this.n23*r+this.n24*n,e.z=this.n31*t+this.n32*i+this.n33*r+this.n34*n,e.w=this.n41*t+this.n42*i+this.n43*r+this.n44*n,e},rotateAxis:function(e){var t=e.x,i=e.y,r=e.z;return e.x=t*this.n11+i*this.n12+r*this.n13,e.y=t*this.n21+i*this.n22+r*this.n23,e.z=t*this.n31+i*this.n32+r*this.n33,e.normalize(),e},crossVector:function(e){var t=new c.Vector4;return t.x=this.n11*e.x+this.n12*e.y+this.n13*e.z+this.n14*e.w,t.y=this.n21*e.x+this.n22*e.y+this.n23*e.z+this.n24*e.w,t.z=this.n31*e.x+this.n32*e.y+this.n33*e.z+this.n34*e.w,t.w=e.w?this.n41*e.x+this.n42*e.y+this.n43*e.z+this.n44*e.w:1,t},multiply:function(e,t){var i=e.n11,r=e.n12,n=e.n13,o=e.n14,a=e.n21,s=e.n22,h=e.n23,l=e.n24,c=e.n31,u=e.n32,f=e.n33,p=e.n34,d=e.n41,m=e.n42,g=e.n43,v=e.n44,y=t.n11,x=t.n12,b=t.n13,w=t.n14,_=t.n21,S=t.n22,M=t.n23,C=t.n24,A=t.n31,T=t.n32,R=t.n33,L=t.n34,V=t.n41,P=t.n42,E=t.n43,z=t.n44;return this.n11=i*y+r*_+n*A+o*V,this.n12=i*x+r*S+n*T+o*P,this.n13=i*b+r*M+n*R+o*E,this.n14=i*w+r*C+n*L+o*z,this.n21=a*y+s*_+h*A+l*V,this.n22=a*x+s*S+h*T+l*P,this.n23=a*b+s*M+h*R+l*E,this.n24=a*w+s*C+h*L+l*z,this.n31=c*y+u*_+f*A+p*V,this.n32=c*x+u*S+f*T+p*P,this.n33=c*b+u*M+f*R+p*E,this.n34=c*w+u*C+f*L+p*z,this.n41=d*y+m*_+g*A+v*V,this.n42=d*x+m*S+g*T+v*P,this.n43=d*b+m*M+g*R+v*E,this.n44=d*w+m*C+g*L+v*z,this},multiplyToArray:function(e,t,i){return this.multiply(e,t),i[0]=this.n11,i[1]=this.n21,i[2]=this.n31,i[3]=this.n41,i[4]=this.n12,i[5]=this.n22,i[6]=this.n32,i[7]=this.n42,i[8]=this.n13,i[9]=this.n23,i[10]=this.n33,i[11]=this.n43,i[12]=this.n14,i[13]=this.n24,i[14]=this.n34,i[15]=this.n44,this},multiplySelf:function(e){return this.multiply(this,e),this},multiplyScalar:function(e){return this.n11*=e,this.n12*=e,this.n13*=e,this.n14*=e,this.n21*=e,this.n22*=e,this.n23*=e,this.n24*=e,this.n31*=e,this.n32*=e,this.n33*=e,this.n34*=e,this.n41*=e,this.n42*=e,this.n43*=e,this.n44*=e,this},determinant:function(){var e=this.n11,t=this.n12,i=this.n13,r=this.n14,n=this.n21,o=this.n22,a=this.n23,s=this.n24,h=this.n31,l=this.n32,c=this.n33,u=this.n34,f=this.n41,p=this.n42,d=this.n43,m=this.n44;return r*a*l*f-i*s*l*f-r*o*c*f+t*s*c*f+i*o*u*f-t*a*u*f-r*a*h*p+i*s*h*p+r*n*c*p-e*s*c*p-i*n*u*p+e*a*u*p+r*o*h*d-t*s*h*d-r*n*l*d+e*s*l*d+t*n*u*d-e*o*u*d-i*o*h*m+t*a*h*m+i*n*l*m-e*a*l*m-t*n*c*m+e*o*c*m},transpose:function(){var e;return e=this.n21,this.n21=this.n12,this.n12=e,e=this.n31,this.n31=this.n13,this.n13=e,e=this.n32,this.n32=this.n23,this.n23=e,e=this.n41,this.n41=this.n14,this.n14=e,e=this.n42,this.n42=this.n24,this.n24=e,e=this.n43,this.n43=this.n34,this.n43=e,this},clone:function(){var e=new c.Matrix4;return e.n11=this.n11,e.n12=this.n12,e.n13=this.n13,e.n14=this.n14,e.n21=this.n21,e.n22=this.n22,e.n23=this.n23,e.n24=this.n24,e.n31=this.n31,e.n32=this.n32,e.n33=this.n33,e.n34=this.n34,e.n41=this.n41,e.n42=this.n42,e.n43=this.n43,e.n44=this.n44,e},flatten:function(){return this.flat[0]=this.n11,this.flat[1]=this.n21,this.flat[2]=this.n31,this.flat[3]=this.n41,this.flat[4]=this.n12,this.flat[5]=this.n22,this.flat[6]=this.n32,this.flat[7]=this.n42,this.flat[8]=this.n13,this.flat[9]=this.n23,this.flat[10]=this.n33,this.flat[11]=this.n43,this.flat[12]=this.n14,this.flat[13]=this.n24,this.flat[14]=this.n34,this.flat[15]=this.n44,this.flat},flattenToArray:function(e){return e[0]=this.n11,e[1]=this.n21,e[2]=this.n31,e[3]=this.n41,e[4]=this.n12,e[5]=this.n22,e[6]=this.n32,e[7]=this.n42,e[8]=this.n13,e[9]=this.n23,e[10]=this.n33,e[11]=this.n43,e[12]=this.n14,e[13]=this.n24,e[14]=this.n34,e[15]=this.n44,e},flattenToArrayOffset:function(e,t){return e[t]=this.n11,e[t+1]=this.n21,e[t+2]=this.n31,e[t+3]=this.n41,e[t+4]=this.n12,e[t+5]=this.n22,e[t+6]=this.n32,e[t+7]=this.n42,e[t+8]=this.n13,e[t+9]=this.n23,e[t+10]=this.n33,e[t+11]=this.n43,e[t+12]=this.n14,e[t+13]=this.n24,e[t+14]=this.n34,e[t+15]=this.n44,e},setTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},setScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},setRotationX:function(e){var t=Math.cos(e),e=Math.sin(e);return this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this},setRotationY:function(e){var t=Math.cos(e),e=Math.sin(e);return this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this},setRotationZ:function(e){var t=Math.cos(e),e=Math.sin(e);return this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this},setRotationAxis:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=1-i,o=e.x,a=e.y,s=e.z,h=n*o,l=n*a;return this.set(h*o+i,h*a-r*s,h*s+r*a,0,h*a+r*s,l*a+i,l*s-r*o,0,h*s-r*a,l*s+r*o,n*s*s+i,0,0,0,0,1),this},setPosition:function(e){return this.n14=e.x,this.n24=e.y,this.n34=e.z,this},getPosition:function(){return this.position||(this.position=new c.Vector3),this.position.set(this.n14,this.n24,this.n34),this.position},getColumnX:function(){return this.columnX||(this.columnX=new c.Vector3),this.columnX.set(this.n11,this.n21,this.n31),this.columnX},getColumnY:function(){return this.columnY||(this.columnY=new c.Vector3),this.columnY.set(this.n12,this.n22,this.n32),this.columnY},getColumnZ:function(){return this.columnZ||(this.columnZ=new c.Vector3),this.columnZ.set(this.n13,this.n23,this.n33),this.columnZ},setRotationFromEuler:function(e,t){var i=e.x,r=e.y,n=e.z,o=Math.cos(i),i=Math.sin(i),a=Math.cos(r),r=Math.sin(r),s=Math.cos(n),n=Math.sin(n);switch(t){case"YXZ":var h=a*s,l=a*n,c=r*s,u=r*n;this.n11=h+u*i,this.n12=c*i-l,this.n13=o*r,this.n21=o*n,this.n22=o*s,this.n23=-i,this.n31=l*i-c,this.n32=u+h*i,this.n33=o*a;break;case"ZXY":h=a*s,l=a*n,c=r*s,u=r*n,this.n11=h-u*i,this.n12=-o*n,this.n13=c+l*i,this.n21=l+c*i,this.n22=o*s,this.n23=u-h*i,this.n31=-o*r,this.n32=i,this.n33=o*a;break;case"ZYX":h=o*s,l=o*n,c=i*s,u=i*n,this.n11=a*s,this.n12=c*r-l,this.n13=h*r+u,this.n21=a*n,this.n22=u*r+h,this.n23=l*r-c,this.n31=-r,this.n32=i*a,this.n33=o*a;break;case"YZX":h=o*a,l=o*r,c=i*a,u=i*r,this.n11=a*s,this.n12=u-h*n,this.n13=c*n+l,this.n21=n,this.n22=o*s,this.n23=-i*s,this.n31=-r*s,this.n32=l*n+c,this.n33=h-u*n;break;case"XZY":h=o*a,l=o*r,c=i*a,u=i*r,this.n11=a*s,this.n12=-n,this.n13=r*s,this.n21=h*n+u,this.n22=o*s,this.n23=l*n-c,this.n31=c*n-l,this.n32=i*s,this.n33=u*n+h;break;default:h=o*s,l=o*n,c=i*s,u=i*n,this.n11=a*s,this.n12=-a*n,this.n13=r,this.n21=l+c*r,this.n22=h-u*r,this.n23=-i*a,this.n31=u-h*r,this.n32=c+l*r,this.n33=o*a}return this},setRotationFromQuaternion:function(e){var t=e.x,i=e.y,r=e.z,n=e.w,o=t+t,a=i+i,s=r+r,e=t*o,h=t*a;t*=s;var l=i*a;return i*=s,r*=s,o*=n,a*=n,n*=s,this.n11=1-(l+r),this.n12=h-n,this.n13=t+a,this.n21=h+n,this.n22=1-(e+r),this.n23=i-o,this.n31=t-a,this.n32=i+o,this.n33=1-(e+l),this},scale:function(e){var t=e.x,i=e.y,e=e.z;return this.n11*=t,this.n12*=i,this.n13*=e,this.n21*=t,this.n22*=i,this.n23*=e,this.n31*=t,this.n32*=i,this.n33*=e,this.n41*=t,this.n42*=i,this.n43*=e,this},compose:function(e,t,i){var r=c.Matrix4.__m1,n=c.Matrix4.__m2;return r.identity(),r.setRotationFromQuaternion(t),n.setScale(i.x,i.y,i.z),this.multiply(r,n),this.n14=e.x,this.n24=e.y,this.n34=e.z,this},decompose:function(e,t,i){var r=c.Matrix4.__v1,n=c.Matrix4.__v2,o=c.Matrix4.__v3;return r.set(this.n11,this.n21,this.n31),n.set(this.n12,this.n22,this.n32),o.set(this.n13,this.n23,this.n33),e=e instanceof c.Vector3?e:new c.Vector3,t=t instanceof c.Quaternion?t:new c.Quaternion,i=i instanceof c.Vector3?i:new c.Vector3,i.x=r.length(),i.y=n.length(),i.z=o.length(),e.x=this.n14,e.y=this.n24,e.z=this.n34,r=c.Matrix4.__m1,r.copy(this),r.n11/=i.x,r.n21/=i.x,r.n31/=i.x,r.n12/=i.y,r.n22/=i.y,r.n32/=i.y,r.n13/=i.z,r.n23/=i.z,r.n33/=i.z,t.setFromRotationMatrix(r),[e,t,i]},extractPosition:function(e){this.n14=e.n14,this.n24=e.n24,this.n34=e.n34},extractRotation:function(e,t){var i=1/t.x,r=1/t.y,n=1/t.z;this.n11=e.n11*i,this.n21=e.n21*i,this.n31=e.n31*i,this.n12=e.n12*r,this.n22=e.n22*r,this.n32=e.n32*r,this.n13=e.n13*n,this.n23=e.n23*n,this.n33=e.n33*n}},c.Matrix4.makeInvert=function(e,t){var i=e.n11,r=e.n12,n=e.n13,o=e.n14,a=e.n21,s=e.n22,h=e.n23,l=e.n24,u=e.n31,f=e.n32,p=e.n33,d=e.n34,m=e.n41,g=e.n42,v=e.n43,y=e.n44;return void 0===t&&(t=new c.Matrix4),t.n11=h*d*g-l*p*g+l*f*v-s*d*v-h*f*y+s*p*y,t.n12=o*p*g-n*d*g-o*f*v+r*d*v+n*f*y-r*p*y,t.n13=n*l*g-o*h*g+o*s*v-r*l*v-n*s*y+r*h*y,t.n14=o*h*f-n*l*f-o*s*p+r*l*p+n*s*d-r*h*d,t.n21=l*p*m-h*d*m-l*u*v+a*d*v+h*u*y-a*p*y,t.n22=n*d*m-o*p*m+o*u*v-i*d*v-n*u*y+i*p*y,t.n23=o*h*m-n*l*m-o*a*v+i*l*v+n*a*y-i*h*y,t.n24=n*l*u-o*h*u+o*a*p-i*l*p-n*a*d+i*h*d,t.n31=s*d*m-l*f*m+l*u*g-a*d*g-s*u*y+a*f*y,t.n32=o*f*m-r*d*m-o*u*g+i*d*g+r*u*y-i*f*y,t.n33=n*l*m-o*s*m+o*a*g-i*l*g-r*a*y+i*s*y,t.n34=o*s*u-r*l*u-o*a*f+i*l*f+r*a*d-i*s*d,t.n41=h*f*m-s*p*m-h*u*g+a*p*g+s*u*v-a*f*v,t.n42=r*p*m-n*f*m+n*u*g-i*p*g-r*u*v+i*f*v,t.n43=n*s*m-r*h*m-n*a*g+i*h*g+r*a*v-i*s*v,t.n44=r*h*u-n*s*u+n*a*f-i*h*f-r*a*p+i*s*p,t.multiplyScalar(1/e.determinant()),t},c.Matrix4.makeInvert3x3=function(e){var t=e.m33,i=t.m,r=e.n33*e.n22-e.n32*e.n23,n=-e.n33*e.n21+e.n31*e.n23,o=e.n32*e.n21-e.n31*e.n22,a=-e.n33*e.n12+e.n32*e.n13,s=e.n33*e.n11-e.n31*e.n13,h=-e.n32*e.n11+e.n31*e.n12,l=e.n23*e.n12-e.n22*e.n13,c=-e.n23*e.n11+e.n21*e.n13,u=e.n22*e.n11-e.n21*e.n12,e=e.n11*r+e.n21*a+e.n31*l;return 0==e&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible."),e=1/e,i[0]=e*r,i[1]=e*n,i[2]=e*o,i[3]=e*a,i[4]=e*s,i[5]=e*h,i[6]=e*l,i[7]=e*c,i[8]=e*u,t},c.Matrix4.makeFrustum=function(e,t,i,r,n,o){var a;return a=new c.Matrix4,a.n11=2*n/(t-e),a.n12=0,a.n13=(t+e)/(t-e),a.n14=0,a.n21=0,a.n22=2*n/(r-i),a.n23=(r+i)/(r-i),a.n24=0,a.n31=0,a.n32=0,a.n33=-(o+n)/(o-n),a.n34=-2*o*n/(o-n),a.n41=0,a.n42=0,a.n43=-1,a.n44=0,a},c.Matrix4.makePerspective=function(e,t,i,r){var n,e=i*Math.tan(e*Math.PI/360);return n=-e,c.Matrix4.makeFrustum(n*t,e*t,n,e,i,r)},c.Matrix4.makeOrtho=function(e,t,i,r,n,o){var a,s,h,l;return a=new c.Matrix4,s=t-e,h=i-r,l=o-n,a.n11=2/s,a.n12=0,a.n13=0,a.n14=-((t+e)/s),a.n21=0,a.n22=2/h,a.n23=0,a.n24=-((i+r)/h),a.n31=0,a.n32=0,a.n33=-2/l,a.n34=-((o+n)/l),a.n41=0,a.n42=0,a.n43=0,a.n44=1,a},c.Matrix4.__v1=new c.Vector3,c.Matrix4.__v2=new c.Vector3,c.Matrix4.__v3=new c.Vector3,c.Matrix4.__m1=new c.Matrix4,c.Matrix4.__m2=new c.Matrix4,c.Object3D=function(){this.name="",this.id=c.Object3DCount++,this.parent=void 0,this.children=[],this.up=new c.Vector3(0,1,0),this.position=new c.Vector3,this.rotation=new c.Vector3,this.eulerOrder="XYZ",this.scale=new c.Vector3(1,1,1),this.flipSided=this.doubleSided=this.dynamic=!1,this.renderDepth=null,this.rotationAutoUpdate=!0,this.matrix=new c.Matrix4,this.matrixWorld=new c.Matrix4,this.matrixRotationWorld=new c.Matrix4,this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0,this.quaternion=new c.Quaternion,this.useQuaternion=!1,this.boundRadius=0,this.boundRadiusScale=1,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this._vector=new c.Vector3},c.Object3D.prototype={constructor:c.Object3D,translate:function(e,t){this.matrix.rotateAxis(t),this.position.addSelf(t.multiplyScalar(e))},translateX:function(e){this.translate(e,this._vector.set(1,0,0))},translateY:function(e){this.translate(e,this._vector.set(0,1,0))},translateZ:function(e){this.translate(e,this._vector.set(0,0,1))},lookAt:function(e){this.matrix.lookAt(e,this.position,this.up),this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(e){if(-1===this.children.indexOf(e)){void 0!==e.parent&&e.parent.removeChild(e),e.parent=this,this.children.push(e);for(var t=this;void 0!==t.parent;)t=t.parent;void 0!==t&&t instanceof c.Scene&&t.addChildRecurse(e)}},remove:function(e){var t=this,i=this.children.indexOf(e);if(-1!==i){for(e.parent=void 0,this.children.splice(i,1);void 0!==t.parent;)t=t.parent;void 0!==t&&t instanceof c.Scene&&t.removeChildRecurse(e)}},getChildByName:function(e,t){var i,r,n;for(i=0,r=this.children.length;r>i;i++){if(n=this.children[i],n.name===e)return n;if(t&&(n=n.getChildByName(e,t),void 0!==n))return n}},updateMatrix:function(){this.matrix.setPosition(this.position),this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder),(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)&&(this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))),this.matrixWorldNeedsUpdate=!0},update:function(e,t,i){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(e?this.matrixWorld.multiply(e,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,r=this.children.length;r>e;e++)this.children[e].update(this.matrixWorld,t,i)},addChild:function(e){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add()."),this.add(e)},removeChild:function(e){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove()."),this.remove(e)}},c.Object3DCount=0,c.Projector=function(){function e(){var e=g[a]=g[a]||new c.RenderableVertex;return a++,e}function t(e,t){return t.z-e.z}function i(e,t){var i=0,r=1,n=e.z+e.w,o=t.z+t.w,a=-e.z+e.w,s=-t.z+t.w;return n>=0&&o>=0&&a>=0&&s>=0?!0:0>n&&0>o||0>a&&0>s?!1:(0>n?i=Math.max(i,n/(n-o)):0>o&&(r=Math.min(r,n/(n-o))),0>a?i=Math.max(i,a/(a-s)):0>s&&(r=Math.min(r,a/(a-s))),i>r?!1:(e.lerpSelf(t,i),t.lerpSelf(e,1-r),!0))}var r,n,o,a,s,h,l,u,f,p,d,m=[],g=[],v=[],y=[],x=[],b=[],w=[],_=[],S=new c.Vector4,M=new c.Vector4,C=new c.Matrix4,A=new c.Matrix4,T=[new c.Vector4,new c.Vector4,new c.Vector4,new c.Vector4,new c.Vector4,new c.Vector4],R=new c.Vector4,L=new c.Vector4;this.projectVector=function(e,t){return C.multiply(t.projectionMatrix,t.matrixWorldInverse),C.multiplyVector3(e),e},this.unprojectVector=function(e,t){return C.multiply(t.matrixWorld,c.Matrix4.makeInvert(t.projectionMatrix)),C.multiplyVector3(e),e},this.pickingRay=function(e,t){var i;return e.z=-1,i=new c.Vector3(e.x,e.y,1),this.unprojectVector(e,t),this.unprojectVector(i,t),i.subSelf(e).normalize(),new c.Ray(e,i)},this.projectObjects=function(e,i,o){var a,s;for(n=w.length=0,a=e.objects,e=0,i=a.length;i>e;e++){s=a[e];var h;if(!(h=!s.visible)&&(h=s instanceof c.Mesh)&&(h=s.frustumCulled)){e:{h=void 0;for(var l=s.matrixWorld,u=-s.geometry.boundingSphere.radius*Math.max(s.scale.x,Math.max(s.scale.y,s.scale.z)),f=0;6>f;f++