paella-webgl-plugins
Advanced tools
Comparing version 1.25.1 to 1.25.2
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("paella-core")):"function"==typeof define&&define.amd?define(["paella-core"],e):"object"==typeof exports?exports["paella-webgl-plugins"]=e(require("paella-core")):t["paella-webgl-plugins"]=e(t[void 0])}(self,(t=>(()=>{var e={323:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>c});var r=n(995);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function a(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(l,t);var e,n,r,i,c=(r=l,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=h(r);if(i){var n=h(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return a(this,t)});function l(){return o(this,l),c.apply(this,arguments)}return e=l,(n=[{key:"moduleName",get:function(){return"paella-webgl-plugins"}},{key:"moduleVersion",get:function(){return"1.25.1"}}])&&s(e.prototype,n),l}(r.PluginModule)},503:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Video360Canvas:()=>at,default:()=>ht});var r=n(995);function i(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e,n,r,i,o,s){try{var u=t[o](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,i)}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e.getContext("webgl"),null===this.gl)throw new Error("This browser does not support WebGL")}var e,n,r,o;return e=t,n=[{key:"init",value:(r=regeneratorRuntime.mark((function t(){var e,n,r,o,s=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=s.length>0&&void 0!==s[0]?s[0]:{},n=e.clearColor,r=void 0===n?[0,0,0,1]:n,(o=this.gl).enable(o.DEPTH_TEST),o.clearColor.apply(o,i(r)),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);case 5:case"end":return t.stop()}}),t,this)})),o=function(){var t=this,e=arguments;return new Promise((function(n,i){var o=r.apply(t,e);function u(t){s(o,n,i,u,a,"next",t)}function a(t){s(o,n,i,u,a,"throw",t)}u(void 0)}))},function(){return o.apply(this,arguments)})}],n&&u(e.prototype,n),t}();function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=function(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS)||console.error("Error compiling shdaer: \n".concat(t.getShaderInfoLog(r))),r},l=function(){function t(e,n){var r=this,i=n.vertex,o=void 0===i?"\n\nattribute vec4 inVertexPos;\n\nvoid main() {\n gl_Position = inVertexPos;\n}\n":i,s=n.fragment,u=void 0===s?"\nvoid main() {\n gl_FragColor = vec4(1.0, 0.5, 1.0, 1.0);\n}\n":s,a=n.attribs,h=void 0===a?[]:a,l=n.uniforms,f=void 0===l?[]:l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e;var y=c(e,e.VERTEX_SHADER,o),v=c(e,e.FRAGMENT_SHADER,u),p=e.createProgram();e.attachShader(p,y),e.attachShader(p,v),e.linkProgram(p),e.getProgramParameter(p,e.LINK_STATUS)||console.error("Unable to initialize shader program: ".concat(e.getProgramInfoLog(p))),e.deleteShader(y),e.deleteShader(v),this._shaderProgram=p,this.attribs={},h.forEach((function(t){r.attribs[t]=e.getAttribLocation(p,t),-1==r.attribs[t]&&console.warn("Attribute not found in shader: '".concat(t,"'"))})),this.uniforms={},f.forEach((function(t){r.uniforms[t]=e.getUniformLocation(p,t),null===r.uniforms[t]&&console.warn("Uniform not found in shader: ".concat(t))}))}var e,n;return e=t,(n=[{key:"useProgram",value:function(){this.gl.useProgram(this._shaderProgram)}},{key:"enablePositionArray",value:function(t,e){e.bindPositions(),this.enableArray(t,3)}},{key:"enableTexCoordArray",value:function(t,e){e.bindTexCoord(),this.enableArray(t,2)}},{key:"enableArray",value:function(t,e){var n=this.gl;n.enableVertexAttribArray(this.attribs[t]),n.vertexAttribPointer(this.attribs[t],e,n.FLOAT,!1,0,0)}},{key:"bindTexture",value:function(t,e){var n=this.gl;n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e),n.uniform1i(this.uniforms[t],0)}},{key:"bindFloat",value:function(t,e){this.gl.uniform1f(this.uniforms[t],e)}},{key:"bindMatrix4",value:function(t,e){this.gl.uniformMatrix4fv(this.uniforms[t],!1,e)}}])&&h(e.prototype,n),t}();function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function y(t,e){var n=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),n}var p=function(){function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.positionArray=n,this.positionBuffer=y(e,n),this.texCoordArray=r,this.texCoordBuffer=y(e,r),this.indexArray=i,this.indexBuffer=function(t,e){var n=t.createBuffer();return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array(e),t.STATIC_DRAW),n}(e,i)}var e,n;return e=t,(n=[{key:"bindPositions",value:function(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer)}},{key:"bindTexCoord",value:function(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texCoordBuffer)}},{key:"draw",value:function(){this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.indexBuffer),this.gl.drawElements(this.gl.TRIANGLES,this.indexArray.length,this.gl.UNSIGNED_SHORT,0)}}])&&f(e.prototype,n),t}();function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var g=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.video=n,this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture);var r=new Uint8Array([0,0,255,255]);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}var e,n;return e=t,(n=[{key:"updateTexture",value:function(){var t=this.gl;t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)}}])&&w(e.prototype,n),t}();function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null!=n){var r,i,o=[],s=!0,u=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);s=!0);}catch(t){u=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var b=2*Math.PI,k=Math.PI/2;function E(t,e,n){return(n-t)/(e-t)}function x(t){for(var e,n,r,i,o=Math.PI/t,s=2*t,u=[],a=[],h=-Math.PI/2,c=0;c<=t;c++){for(var l=E(-k,k,-h),f=0,y=s+(c>0&&c<t?1:0),v=0;v<y;v++)u.push((void 0,void 0,void 0,i=void 0,n=(e=d([1,h,f],3))[0],r=e[1],i=-(i=e[2])+Math.PI/2,[n*Math.cos(r)*Math.cos(i),n*Math.sin(r),n*-Math.cos(r)*Math.sin(i)])),a.push([E(0,b,f),l]),f+=o;h+=o}for(var p=[],w=0;w<u.length;w++)p.push([1,1,0]);for(var g=[],m=0,x=0;x<t;x++){for(var _=x>0?1:0,R=0;R<s;R++){var P=m+R,T=m+R+1,I=P+s+_,N=T+s+_;0===x&&g.push([P,N,I]),x===t-1&&g.push([P,T,I]),x>0&&x<t-1&&t>2&&(g.push([P,N,I]),g.push([P,T,N]))}m+=0===x?s:s+1}return{positions:u.flat(),colors:p.flat(),triangles:g.flat(),uvs:a.flat(),normals:u.flat()}}var _=Float32Array,R=(Float64Array,Date.now(),function(t){return t>-1e-7&&t<1e-7?0:t}),P=function(t){return 0===R(t)},T=function(t,e){return Math.abs(t-e)<1e-7};function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function N(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function M(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function O(t,e){return O=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},O(t,e)}function z(t,e){return!e||"object"!==I(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function S(t){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},S(t)}var A=function(t,e){if(t.length!=e.length)throw new Error("Invalid vector length in operation")},D=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&O(t,e)}(u,t);var e,n,r,i,o,s=(i=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=S(i);if(o){var n=S(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return z(this,t)});function u(){var t;switch(N(this,u),arguments.length){case 0:t=s.call(this,[0,0]);break;case 1:arguments[0].length>1&&arguments[0].length<5&&(t=s.call(this,arguments[0]));break;case 2:2===arguments[0].length&&"number"==typeof arguments[1]?t=s.call(this,[arguments[0][0],arguments[0][1],arguments[1]]):3===arguments[0].length&&"number"==typeof arguments[1]?t=s.call(this,[arguments[0][0],arguments[0][1],arguments[0][2],arguments[1]]):"number"==typeof arguments[0]&&"number"==typeof arguments[1]&&(t=s.call(this,[arguments[0],arguments[1]]));break;case 3:2===arguments[0].length&&"number"==typeof arguments[1]&&"number"==typeof arguments[2]?t=s.call(this,[arguments[0][0],arguments[0][1],arguments[1],arguments[2]]):"number"==typeof arguments[0]&&"number"==typeof arguments[1]&&"number"==typeof arguments[2]&&(t=s.call(this,[arguments[0],arguments[1],arguments[2]]));break;case 4:t=s.call(this,[arguments[0],arguments[1],arguments[2],arguments[3]]);break;default:throw new Error("Invalid parameters in Vec constructor")}return z(t)}return e=u,n=[{key:"normalize",value:function(){var t=u.Magnitude(this);switch(this.length){case 4:this[3]=this[3]/t;case 3:this[2]=this[2]/t;case 2:this[1]=this[1]/t,this[0]=this[0]/t;break;default:throw new Error("Invalid vector size: ".concat(this.length))}return this}},{key:"assign",value:function(t){switch(A(this,t),this.length){case 4:this[3]=t[3];case 3:this[2]=t[2];case 2:this[1]=t[1],this[0]=t[0];break;default:throw new Error("Invalid vector size: ".concat(this.length))}}},{key:"set",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(2===this.length)this[0]=t,this[1]=e;else if(3===this.length&&null!==n)this[0]=t,this[1]=e,this[2]=n;else{if(4!==this.length||null===r)throw new Error("Invalid vector size: ".concat(this.length,". Trying to set x=").concat(t,", y=").concat(e,", z=").concat(n,", w=").concat(r));this[0]=t,this[1]=e,this[2]=n,this[3]=r}}},{key:"scale",value:function(t){switch(this.length){case 4:this[3]=this[3]*t;case 3:this[2]=this[2]*t;case 2:this[1]=this[1]*t,this[0]=this[0]*t;break;default:throw new Error("Invalid vector size: ".concat(v.length))}return this}},{key:"x",get:function(){return this[0]},set:function(t){return this[0]=t,this}},{key:"y",get:function(){return this[1]},set:function(t){return this[1]=t,this}},{key:"z",get:function(){return this[2]},set:function(t){return this[2]=t,this}},{key:"w",get:function(){return this[3]},set:function(t){return this[3]=t,this}},{key:"r",get:function(){return this[0]},set:function(t){return this[0]=t,this}},{key:"g",get:function(){return this[1]},set:function(t){return this[1]=t,this}},{key:"b",get:function(){return this[2]},set:function(t){return this[2]=t,this}},{key:"a",get:function(){return this[3]},set:function(t){return this[3]=t,this}},{key:"width",get:function(){switch(this.length){case 2:return this[0];case 4:return this[2];default:throw new Error("Vec.width function used on non size or viewport vectors (two or four elements)")}},set:function(t){return this[0]=t,this}},{key:"height",get:function(){switch(this.length){case 2:return this[1];case 4:return this[3];default:throw new Error("Vec.width function used on non size or viewport vectors (two or four elements)")}},set:function(t){return this[1]=t,this}},{key:"xy",get:function(){switch(this.length){case 2:return new u(this);case 3:case 4:return new u(this[0],this[1]);default:throw new Error("Invalid vector size: ".concat(this.length))}},set:function(t){return this[0]=t[0],this[1]=t[1],this}},{key:"xz",get:function(){switch(this.length){case 3:case 4:return new u(this[0],this[2]);default:throw new Error("Invalid vector size: ".concat(this.length))}},set:function(t){if(this.length<3)throw new Error("Invalid vector size");return this[0]=t[0],this[2]=t[1],this}},{key:"yz",get:function(){switch(this.length){case 3:case 4:return new u(this[1],this[2]);default:throw new Error("Invalid vector size: ".concat(this.length))}},set:function(t){if(this.length<3)throw new Error("Invalid vector size");return this[1]=t[0],this[2]=t[1],this}},{key:"xyz",get:function(){if(this.length<3)throw new Error("Invalid vector size: ".concat(this.length));return new u(this[0],this[1],this[2])},set:function(t){if(t.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(t.length));return this[0]=t[0],this[1]=t[1],this[2]=t[2],this}},{key:"xyzw",get:function(){if(this.length<4)throw new Error("Invalid vector size: ".concat(this.length,", 4 required"));return new u(this[0],this[1],this[2],this[3])},set:function(t){if(this.length<4||t.length<4)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(t.length));return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this}},{key:"rgb",get:function(){if(this.length<3)throw new Error("Invalid vector size: ".concat(this.length,", but at least 3 required"));return new u(this[0],this[1],this[2])},set:function(t){if(t.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(t.length));return this[0]=t[0],this[1]=t[1],this[2]=t[2],this}},{key:"rg",get:function(){if(v.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(v.length));return new u(this[0],this[1])}},{key:"gb",get:function(){if(v.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(v.length));return new u(this[1],this[2])}},{key:"rb",get:function(){if(v.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(v.length));return new u(this[0],this[2])}},{key:"hexColor",get:function(){var t=Math.round(255*this.r),e=Math.round(255*this.g),n=Math.round(255*this.b),r=function(t){return t.toString(16).toUpperCase()};return"#".concat(r(t)).concat(r(e)).concat(r(n))}},{key:"cssColor",get:function(){}},{key:"aspectRatio",get:function(){return this.width/this.height}},{key:"toString",value:function(){switch(this.length){case 2:return"[".concat(this[0],", ").concat(this[1],"]");case 3:return"[".concat(this[0],", ").concat(this[1],", ").concat(this[2],"]");case 4:return"[".concat(this[0],", ").concat(this[1],", ").concat(this[2],", ").concat(this[5],"]")}}}],r=[{key:"CheckEqualLength",value:function(t,e){A(t,e)}},{key:"Max",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]>e[0]?t[0]:e[0],t[1]>e[1]?t[1]:e[1]]);case 3:return new u([t[0]>e[0]?t[0]:e[0],t[1]>e[1]?t[1]:e[1],t[2]>e[2]?t[2]:e[2]]);case 4:return new u([t[0]>e[0]?t[0]:e[0],t[1]>e[1]?t[1]:e[1],t[2]>e[2]?t[2]:e[2],t[3]>e[3]?t[3]:e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Min",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]<e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1]]);case 3:return new u([t[0]<e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1],t[2]<e[2]?t[2]:e[2]]);case 4:return new u([t[0]<e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1],t[2]<e[2]?t[2]:e[2],t[3]<e[3]?t[3]:e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Add",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]+e[0],t[1]+e[1]]);case 3:return new u([t[0]+e[0],t[1]+e[1],t[2]+e[2]]);case 4:return new u([t[0]+e[0],t[1]+e[1],t[2]+e[2],t[3]+e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Sub",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]-e[0],t[1]-e[1]]);case 3:return new u([t[0]-e[0],t[1]-e[1],t[2]-e[2]]);case 4:return new u([t[0]-e[0],t[1]-e[1],t[2]-e[2],t[3]-e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Magnitude",value:function(t){switch(t.length){case 2:return Math.sqrt(t[0]*t[0]+t[1]*t[1]);case 3:return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);case 4:return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Distance",value:function(t,e){return A(t,e),u.Magnitude(u.Sub(t,e))}},{key:"Dot",value:function(t,e){switch(A(t,e),t.length){case 2:return t[0]*e[0]+t[1]*e[1];case 3:return t[0]*e[0]+t[1]*e[1]+t[2]*e[2];case 4:return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3];default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Cross",value:function(t,e){switch(A(t,e),t.length){case 2:return t[0]*e[1]-t[1]-e[0];case 3:return new u([t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]);default:throw new Error("Invalid vector size for cross product: ".concat(t.length))}}},{key:"Normalized",value:function(t){var e=u.Magnitude(t);switch(t.length){case 2:return new u([t[0]/e,t[1]/e]);case 3:return new u([t[0]/e,t[1]/e,t[2]/e]);case 4:return new u([t[0]/e,t[1]/e,t[2]/e,t[3]/e]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Mult",value:function(t,e){switch(t.length){case 2:return new u([t[0]*e,t[1]*e]);case 3:return new u([t[0]*e,t[1]*e,t[2]*e]);case 4:return new u([t[0]*e,t[1]*e,t[2]*e,t[3]*e]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Div",value:function(t,e){switch(t.length){case 2:return new u([t[0]/e,t[1]/e]);case 3:return new u([t[0]/e,t[1]/e,t[2]/e]);case 4:return new u([t[0]/e,t[1]/e,t[2]/e,t[3]/e]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Equals",value:function(t,e){if(t.length!=e.length)return!1;switch(t.length){case 2:return T(t[0],e[0])&&T(t[1],e[1]);case 3:return T(t[0],e[0])&&T(t[1],e[1])&&T(t[2],e[2]);case 4:return T(t[0],e[0])&&T(t[1],e[1])&&T(t[2],e[2])&&T(t[3],e[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"IsZero",value:function(t){switch(t.length){case 2:return P(t[0])||P(t[1]);case 3:return P(t[0])||P(t[1])||P(t[2]);case 4:return P(t[0])||P(t[1])||P(t[2])||P(t[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"IsNaN",value:function(t){switch(t.length){case 2:return isNaN(t[0])||isNaN(t[1]);case 3:return isNaN(t[0])||isNaN(t[1])||isNaN(t[2]);case 4:return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])||isNaN(t[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Vec2",value:function(){return new u(0,0)}},{key:"Vec3",value:function(){return new u(0,0,0)}},{key:"Vec4",value:function(){return new u(0,0,0,0)}}],n&&M(e.prototype,n),r&&M(e,r),u}(_);function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function C(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function U(t,e){return U=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},U(t,e)}function V(t,e){return!e||"object"!==j(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function F(t){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},F(t)}var L=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&U(t,e)}(u,t);var e,n,r,i,o,s=(i=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=F(i);if(o){var n=F(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return V(this,t)});function u(){var t;if(C(this,u),9===arguments.length)t=s.call(this,arguments);else if(1===arguments.length&&9===arguments[0].length)t=s.call(this,arguments[0]);else{if(0!==arguments.length)throw new Error("Invalid parameter size in Mat3 constructor");t=s.call(this,[0,0,0,0,0,0,0,0,0])}return V(t)}return e=u,n=[{key:"identity",value:function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=1,this[5]=0,this[6]=0,this[7]=0,this[8]=1,this}},{key:"zero",value:function(){return this[0]=0,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=0,this[6]=0,this[7]=0,this[8]=0,this}},{key:"row",value:function(t){return new D(this[3*t],this[3*t+1],this[3*t+2])}},{key:"setRow",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if((null==e?void 0:e.length)>=3)this[3*t]=e[0],this[3*t+1]=e[1],this[3*t+2]=e[2];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r)throw new Error("Invalid parameter setting matrix row");this[3*t]=e,this[3*t+1]=n,this[3*t+2]=r}return this}},{key:"col",value:function(t){return new D(this[t],this[t+3],this[t+6])}},{key:"setCol",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if((null==e?void 0:e.length)>=3)this[t]=e[0],this[t+3]=e[1],this[t+6]=e[2];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r)throw new Error("Invalid parameter setting matrix row");this[t]=e,this[t+3]=n,this[t+6]=r}return this}},{key:"assign",value:function(t){if(9===t.length)this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8];else{if(16!==t.length)throw new Error("Invalid plarameter setting matrix data");this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[4],this[4]=t[5],this[5]=t[6],this[6]=t[8],this[7]=t[9],this[8]=t[10]}return this}},{key:"setScale",value:function(t,e,n){var r=new D(this[0],this[3],this[6]).normalize().scale(t),i=new D(this[1],this[4],this[7]).normalize().scale(e),o=new D(this[2],this[5],this[8]).normalize().scale(n);return this[0]=r.x,this[3]=r.y,this[6]=r.z,this[1]=i.x,this[4]=i.y,this[7]=i.z,this[2]=o.x,this[5]=o.y,this[8]=o.z,this}},{key:"traspose",value:function(){var t=this[3],e=this[7],n=this[6];return this[3]=this[1],this[6]=this[2],this[7]=this[5],this[1]=t,this[2]=n,this[5]=e,this}},{key:"mult",value:function(t){if("number"==typeof t)this[0]*=t,this[1]*=t,this[2]*=t,this[3]*=t,this[4]*=t,this[5]*=t,this[6]*=t,this[7]*=t,this[8]*=t;else{if(!(t instanceof _&&9===t.length))throw new Error("Invalid parameter in Mat3.mult()");var e=this.row(0),n=this.row(1),r=this.row(2),i=t.col(0),o=t.col(1),s=t.col(2);this[0]=D.Dot(e,i),this[1]=D.Dot(e,o),this[2]=D.Dot(e,s),this[3]=D.Dot(n,i),this[4]=D.Dot(n,o),this[5]=D.Dot(n,s),this[6]=D.Dot(r,i),this[7]=D.Dot(r,o),this[8]=D.Dot(r,s)}return this}},{key:"multVector",value:function(t){if(2===t.length||3===t.length){var e=t[0],n=t[1],r=2===t.length?1:t[2];return new D(this[0]*e+this[3]*n+this[6]*r,this[1]*e+this[4]*n+this[7]*r,this[2]*e+this[5]*n+this[8]*r)}throw new Error("Invalid parameter in Mat3.multVector()")}},{key:"toString",value:function(){return"[ ".concat(this[0],", ").concat(this[1],", ").concat(this[2],"\n")+" ".concat(this[3],", ").concat(this[4],", ").concat(this[5],"\n")+" ".concat(this[6],", ").concat(this[7],", ").concat(this[8]," ]")}}],r=[{key:"MakeIdentity",value:function(){return(new u).identity()}},{key:"MakeZero",value:function(){return(new u).zero()}},{key:"MakeWithQuaternion",value:function(t){var e=u.MakeIdentity();return e.setRow(0,new D(1-2*t[1]*t[1]-2*t[2]*t[2],2*t[0]*t[1]-2*t[2]*t[3],2*t[0]*t[2]+2*t[1]*t[3])),e.setRow(1,new D(2*t[0]*t[1]+2*t[2]*t[3],1-2*t[0]*t[0]-2*t[2]*t[2],2*t[1]*t[2]-2*t[0]*t[3])),e.setRow(2,new D(2*t[0]*t[2]-2*t[1]*t[3],2*t[1]*t[2]+2*t[0]*t[3],1-2*t[0]*t[0]-2*t[1]*t[1])),e}},{key:"IsZero",value:function(t){return P(v[0])&&P(v[1])&&P(v[2])&&P(v[3])&&P(v[4])&&P(v[5])&&P(v[6])&&P(v[7])&&P(v[8])}},{key:"IsIdentity",value:function(t){return T(v[0],1)&&P(v[1])&&P(v[2])&&P(v[3])&&T(v[4],1)&&P(v[5])&&P(v[6])&&P(v[7])&&T(v[8],1)}},{key:"GetScale",value:function(t){return new D(D.Magnitude(new D(t[0],t[3],t[6])),D.Magnitude(new D(t[1],t[4],t[7])),D.Magnitude(new D(t[2],t[5],t[8])))}},{key:"Equals",value:function(t,e){return T(t[0],e[0])&&T(t[1],e[1])&&T(t[2],e[2])&&T(t[3],e[3])&&T(t[4],e[4])&&T(t[5],e[5])&&T(t[6],e[6])&&T(t[7],e[7])&&T(t[8],e[8])}},{key:"IsNaN",value:function(t){return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])&&isNaN(t[3])||isNaN(t[4])||isNaN(t[5])&&isNaN(t[6])||isNaN(t[7])||isNaN(t[8])}}],n&&B(e.prototype,n),r&&B(e,r),u}(_);function G(t){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(t)}function Z(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function X(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Y(t,e){return Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Y(t,e)}function q(t,e){return!e||"object"!==G(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function W(t){return W=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},W(t)}var H=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Y(t,e)}(u,t);var e,n,r,i,o,s=(i=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=W(i);if(o){var n=W(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return q(this,t)});function u(){Z(this,u);var t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];if(9===arguments.length)t[0]=arguments[0],t[1]=arguments[1],t[2]=arguments[2],t[4]=arguments[3],t[5]=arguments[4],t[6]=arguments[5],t[8]=arguments[6],t[9]=arguments[7],t[10]=arguments[8],t[15]=1;else if(1===arguments.length&&9===arguments[0].length)t[0]=arguments[0][0],t[1]=arguments[0][1],t[2]=arguments[0][2],t[4]=arguments[0][3],t[5]=arguments[0][4],t[6]=arguments[0][5],t[8]=arguments[0][6],t[9]=arguments[0][7],t[10]=arguments[0][8],t[15]=1;else if(16===arguments.length)t[0]=arguments[0],t[1]=arguments[1],t[2]=arguments[2],t[3]=arguments[3],t[4]=arguments[4],t[5]=arguments[5],t[6]=arguments[6],t[7]=arguments[7],t[8]=arguments[8],t[9]=arguments[9],t[10]=arguments[10],t[11]=arguments[11],t[12]=arguments[12],t[13]=arguments[13],t[14]=arguments[14],t[15]=arguments[15];else if(1===arguments.length&&16===arguments[0].length)t[0]=arguments[0][0],t[1]=arguments[0][1],t[2]=arguments[0][2],t[3]=arguments[0][3],t[4]=arguments[0][4],t[5]=arguments[0][5],t[6]=arguments[0][6],t[7]=arguments[0][7],t[8]=arguments[0][8],t[9]=arguments[0][9],t[10]=arguments[0][10],t[11]=arguments[0][11],t[12]=arguments[0][12],t[13]=arguments[0][13],t[14]=arguments[0][14],t[15]=arguments[0][15];else if(0!=arguments.length)throw new Error("Invalid parameter size in Matrix3 constructor");return s.call(this,t)}return e=u,n=[{key:"identity",value:function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=1,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this}},{key:"zero",value:function(){return this[0]=0,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=0,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=0,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=0,this}},{key:"perspective",value:function(t,e,n,r){var i=Math.tan(3.141592653589793*t/360)*n,o=i*e;return this.frustum(-o,o,-i,i,n,r),this}},{key:"frustum",value:function(t,e,n,r,i,o){var s=e-t,u=r-n,a=o-i;return this.setRow(0,new D(2*i/s,0,0,0)),this.setRow(1,new D(0,2*i/u,0,0)),this.setRow(2,new D((e+t)/s,(r+n)/u,-(o+i)/a,-1)),this.setRow(3,new D(0,0,-o*i*2/a,0)),this}},{key:"ortho",value:function(t,e,n,r,i,o){var s=e-t,u=r-n,a=o-i;return this[0]=2/s,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=2/u,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=-2/a,this[11]=0,this[12]=-(t+e)/s,this[13]=-(r+n)/u,this[14]=-(o+i)/a,this[15]=1,this}},{key:"lookAt",value:function(t,e,n){this.identity();var r=new D(n),i=D.Sub(t,e);i.normalize();var o=D.Cross(r,i);return o.normalize(),r.normalize(),this.m00=o.x,this.m10=o.y,this.m20=o.z,this.m30=-D.Dot(o,t),this.m01=r.x,this.m11=r.y,this.m21=r.z,this.m31=-D.Dot(r,t),this.m02=i.x,this.m12=i.y,this.m22=i.z,this.m32=-D.Dot(i,t),this.m03=0,this.m13=0,this.m23=0,this.m33=1,this}},{key:"m00",get:function(){return this[0]},set:function(t){this[0]=t}},{key:"m01",get:function(){return this[1]},set:function(t){this[1]=t}},{key:"m02",get:function(){return this[2]},set:function(t){this[2]=t}},{key:"m03",get:function(){return this[3]},set:function(t){this[3]=t}},{key:"m10",get:function(){return this[4]},set:function(t){this[4]=t}},{key:"m11",get:function(){return this[5]},set:function(t){this[5]=t}},{key:"m12",get:function(){return this[6]},set:function(t){this[6]=t}},{key:"m13",get:function(){return this[7]},set:function(t){this[7]=t}},{key:"m20",get:function(){return this[8]},set:function(t){this[8]=t}},{key:"m21",get:function(){return this[9]},set:function(t){this[9]=t}},{key:"m22",get:function(){return this[10]},set:function(t){this[10]=t}},{key:"m23",get:function(){return this[11]},set:function(t){this[11]=t}},{key:"m30",get:function(){return this[12]},set:function(t){this[12]=t}},{key:"m31",get:function(){return this[13]},set:function(t){this[13]=t}},{key:"m32",get:function(){return this[14]},set:function(t){this[14]=t}},{key:"m33",get:function(){return this[15]},set:function(t){this[15]=t}},{key:"mat3",get:function(){return new L(this[0],this[1],this[2],this[4],this[5],this[6],this[8],this[9],this[10])}},{key:"forwardVector",get:function(){return u.TransformDirection(this,new D(0,0,1))}},{key:"rightVector",get:function(){return u.TransformDirection(this,new D(1,0,0))}},{key:"upVector",get:function(){return u.TransformDirection(this,new D(0,1,0))}},{key:"backwardVector",get:function(){return u.TransformDirection(this,new D(0,0,-1))}},{key:"leftVector",get:function(){return u.TransformDirection(this,new D(-1,0,0))}},{key:"downVector",get:function(){return u.TransformDirection(this,new D(0,-1,0))}},{key:"row",value:function(t){return new D(this[4*t],this[4*t+1],this[4*t+2],this[4*t+3])}},{key:"setRow",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(e.length>=4)this[4*t]=e[0],this[4*t+1]=e[1],this[4*t+2]=e[2],this[4*t+3]=e[3];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r||"number"!=typeof i)throw new Error("Invalid parameter setting matrix row");this[4*t]=e,this[4*t+1]=n,this[4*t+2]=r,this[4*t+3]=i}return this}},{key:"col",value:function(t){return new D(this[t],this[t+4],this[t+8],this[t+12])}},{key:"setCol",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(e.length>=4)this[t]=e[0],this[t+4]=e[1],this[t+8]=e[2],this[t+12]=e[3];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r||"number"!=typeof i)throw new Error("Invalid parameter setting matrix row");this[t]=e,this[t+4]=n,this[t+8]=r,this[t+12]=i}return this}},{key:"assign",value:function(t){return 9==t.length?(this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=0,this[4]=t[3],this[5]=t[4],this[6]=t[5],this[7]=0,this[8]=t[6],this[9]=t[7],this[10]=t[8],this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1):16==t.length&&(this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15]),this}},{key:"translate",value:function(t,e,n){return this.mult(u.MakeTranslation(t,e,n)),this}},{key:"rotate",value:function(t,e,n,r){return this.mult(u.MakeRotation(t,e,n,r)),this}},{key:"scale",value:function(t,e,n){return this.mult(u.MakeScale(t,e,n)),this}},{key:"toString",value:function(){return"[ ".concat(this[0],", ").concat(this[1],", ").concat(this[2],", ").concat(this[3],"\n")+" ".concat(this[4],", ").concat(this[5],", ").concat(this[6],", ").concat(this[7],"\n")+" ".concat(this[8],", ").concat(this[9],", ").concat(this[10],", ").concat(this[11],"\n")+" ".concat(this[12],", ").concat(this[13],", ").concat(this[14],", ").concat(this[15]," ]")}},{key:"setScale",value:function(t,e,n){var r=new D(this[0],this[4],this[8]).normalize().scale(t),i=new D(this[1],this[5],this[9]).normalize().scale(e),o=new D(this[2],this[6],this[10]).normalize().scale(n);return this[0]=r.x,this[4]=r.y,this[8]=r.z,this[1]=i.x,this[5]=i.y,this[9]=i.z,this[2]=o.x,this[6]=o.y,this[10]=o.z,this}},{key:"setPosition",value:function(t,e,n){return"number"==typeof t?(this[12]=t,this[13]=e,this[14]=n):(this[12]=t.x,this[13]=t.y,this[14]=t.z),this}},{key:"mult",value:function(t){if("number"==typeof t)return this[0]*=t,this[1]*=t,this[2]*=t,this[3]*=t,this[4]*=t,this[5]*=t,this[6]*=t,this[7]*=t,this[8]*=t,this[9]*=t,this[10]*=t,this[11]*=t,this[12]*=t,this[13]*=t,this[14]*=t,this[15]*=t,this;var e=this.row(0),n=this.row(1),r=this.row(2),i=this.row(3),o=t.col(0),s=t.col(1),u=t.col(2),a=t.col(3);return this[0]=D.Dot(e,o),this[1]=D.Dot(e,s),this[2]=D.Dot(e,u),this[3]=D.Dot(e,a),this[4]=D.Dot(n,o),this[5]=D.Dot(n,s),this[6]=D.Dot(n,u),this[7]=D.Dot(n,a),this[8]=D.Dot(r,o),this[9]=D.Dot(r,s),this[10]=D.Dot(r,u),this[11]=D.Dot(r,a),this[12]=D.Dot(i,o),this[13]=D.Dot(i,s),this[14]=D.Dot(i,u),this[15]=D.Dot(i,a),this}},{key:"multVector",value:function(t){if(t.length<3)throw new Error("Invalid parameter multiplying Mat4 by vector");var e=t[0],n=t[1],r=t[2],i=t.length>3?t[3]:1;return new D(this[0]*e+this[4]*n+this[8]*r+this[12]*i,this[1]*e+this[5]*n+this[9]*r+this[13]*i,this[2]*e+this[6]*n+this[10]*r+this[14]*i,this[3]*e+this[7]*n+this[11]*r+this[15]*i)}},{key:"invert",value:function(){var t=this[0],e=this[1],n=this[2],r=this[3],i=this[4],o=this[5],s=this[6],u=this[7],a=this[8],h=this[9],c=this[10],l=this[11],f=this[12],y=this[13],v=this[14],p=this[15],w=t*o-e*i,g=t*s-n*i,d=t*u-r*i,m=e*s-n*o,b=e*u-r*o,k=n*u-r*s,E=a*y-h*f,x=a*v-c*f,_=a*p-l*f,R=h*v-c*y,P=h*p-l*y,T=c*p-l*v,I=w*T-g*P+d*R+m*_-b*x+k*E;return I?(I=1/I,this[0]=(o*T-s*P+u*R)*I,this[1]=(n*P-e*T-r*R)*I,this[2]=(y*k-v*b+p*m)*I,this[3]=(c*b-h*k-l*m)*I,this[4]=(s*_-i*T-u*x)*I,this[5]=(t*T-n*_+r*x)*I,this[6]=(v*d-f*k-p*g)*I,this[7]=(a*k-c*d+l*g)*I,this[8]=(i*P-o*_+u*E)*I,this[9]=(e*_-t*P-r*E)*I,this[10]=(f*b-y*d+p*w)*I,this[11]=(h*d-a*b-l*w)*I,this[12]=(o*x-i*R-s*E)*I,this[13]=(t*R-e*x+n*E)*I,this[14]=(y*g-f*m-v*w)*I,this[15]=(a*m-h*g+c*w)*I):this.zero(),this}},{key:"traspose",value:function(){var t=new D(this[0],this[4],this[8],this[12]),e=new D(this[1],this[5],this[9],this[13]),n=new D(this[2],this[6],this[10],this[14]),r=new D(this[3],this[7],this[11],this[15]);return this.setRow(0,t),this.setRow(1,e),this.setRow(2,n),this.setRow(3,r),this}}],r=[{key:"MakeIdentity",value:function(){return(new u).identity()}},{key:"MakeZero",value:function(){return(new u).zero()}},{key:"MakeWithQuaternion",value:function(t){var e=u.MakeIdentity();return e.setRow(0,new D(1-2*t[1]*t[1]-2*t[2]*t[2],2*t[0]*t[1]-2*t[2]*t[3],2*t[0]*t[2]+2*t[1]*t[3],0)),e.setRow(1,new D(2*t[0]*t[1]+2*t[2]*t[3],1-2*t[0]*t[0]-2*t[2]*t[2],2*t[1]*t[2]-2*t[0]*t[3],0)),e.setRow(2,new D(2*t[0]*t[2]-2*t[1]*t[3],2*t[1]*t[2]+2*t[0]*t[3],1-2*t[0]*t[0]-2*t[1]*t[1],0)),e}},{key:"MakeTranslation",value:function(t,e,n){return t instanceof _&&t.length>=3&&(e=t[1],n=t[2],t=t[0]),new u(1,0,0,0,0,1,0,0,0,0,1,0,t,e,n,1)}},{key:"MakeRotation",value:function(t,e,n,r){var i=new D(e,n,r);i.normalize();var o=Math.cos(t),s=1-o,a=Math.sin(t);return new u(i.x*i.x*s+o,i.x*i.y*s+i.z*a,i.x*i.z*s-i.y*a,0,i.y*i.x*s-i.z*a,i.y*i.y*s+o,i.y*i.z*s+i.x*a,0,i.z*i.x*s+i.y*a,i.z*i.y*s-i.x*a,i.z*i.z*s+o,0,0,0,0,1)}},{key:"MakeScale",value:function(t,e,n){return t instanceof _&&t.length>=3&&(e=t[1],n=t[2],t=t[0]),new u(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1)}},{key:"MakePerspective",value:function(t,e,n,r){return(new u).perspective(t,e,n,r)}},{key:"MakeFrustum",value:function(t,e,n,r,i,o){return(new u).frustum(t,e,n,r,i,o)}},{key:"MakeOrtho",value:function(t,e,n,r,i,o){return(new u).ortho(t,e,n,r,i,o)}},{key:"MakeLookAt",value:function(t,e,n){return(new u).lookAt(t,e,n)}},{key:"Mult",value:function(t,e){return new u(t).mult(e)}},{key:"Unproject",value:function(t,e,n,r,i,o){var s=new u(i);s.mult(r),s.invert();var a=new D((t-o.y)/o.width*2-1,(e-o.x)/o.height*2-1,2*n-1,1),h=new Vec4(s.multVector(a));return 0==h.z?h.set(0):h.set(h.x/h.w,h.y/h.w,h.z/h.w,h.w/h.w),h}},{key:"GetScale",value:function(t){return new D(D.Magnitude([t[1],t[5],t[9]]),D.Magnitude([t[0],t[4],t[8]]),D.Magnitude([t[2],t[6],t[10]]))}},{key:"GetRotation",value:function(t){var e=u.GetScale(t);return new u(t[0]/e.x,t[1]/e.y,t[2]/e.z,0,t[4]/e.x,t[5]/e.y,t[6]/e.z,0,t[8]/e.x,t[9]/e.y,t[10]/e.z,0,0,0,0,1)}},{key:"GetPosition",value:function(t){return new D(t[12],t[13],t[14])}},{key:"GetInverted",value:function(t){var e=new u(t);return e.invert(),e}},{key:"GetNormalMatrix",value:function(t){return new u(t).invert().traspose().mat3}},{key:"Equals",value:function(t,e){return t[0]==e[0]&&t[1]==e[1]&&t[2]==e[2]&&t[3]==e[3]&&t[4]==e[4]&&t[5]==e[5]&&t[6]==e[6]&&t[7]==e[7]&&t[8]==e[8]&&t[9]==e[9]&&t[10]==e[10]&&t[11]==e[11]&&t[12]==e[12]&&t[13]==e[13]&&t[14]==e[14]&&t[15]==e[15]}},{key:"TransformDirection",value:function(t,e){var n=new D(e),r=new u(t);return r.setRow(3,new D(0,0,0,1)),n.assign(r.multVector(n).xyz),n.normalize(),n}},{key:"IsNan",value:function(){return isNaN(this[0])||isNaN(this[1])||isNaN(this[2])||isNaN(this[3])||isNaN(this[4])||isNaN(this[5])||isNaN(this[6])||isNaN(this[7])||isNaN(this[8])||isNaN(this[9])||isNaN(this[10])||isNaN(this[11])||isNaN(this[12])||isNaN(this[13])||isNaN(this[14])||isNaN(this[15])}},{key:"IsZero",value:function(t){return P(t[0])&&P(t[1])&&P(t[2])&&P(t[3])&&P(t[4])&&P(t[5])&&P(t[6])&&P(t[7])&&P(t[8])&&P(t[9])&&P(t[10])&&P(t[11])&&P(t[12])&&P(t[13])&&P(t[14])&&P(t[15])}},{key:"IsIdentity",value:function(t){return T(t[0],1)&&T(t[1],0)&&T(t[2],0)&&T(t[3],0)&&T(t[4],0)&&T(t[5],1)&&T(t[6],0)&&T(t[7],0)&&T(t[8],0)&&T(t[9],0)&&T(t[10],1)&&T(t[11],0)&&T(t[12],0)&&T(t[13],0)&&T(t[14],0)&&T(t[15],1)}}],n&&X(e.prototype,n),r&&X(e,r),u}(_);function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function $(t,e,n){return $="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=st(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},$(t,e,n||t)}function K(t,e,n,r,i,o,s){try{var u=t[o](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,i)}function J(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function et(t,e,n){return e&&tt(t.prototype,e),n&&tt(t,n),t}function nt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&rt(t,e)}function rt(t,e){return rt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},rt(t,e)}function it(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=st(t);if(e){var i=st(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ot(this,n)}}function ot(t,e){return!e||"object"!==Q(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function st(t){return st=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},st(t)}var ut=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.parentNode;n.removeChild(t),document.body.appendChild(t),t.style.position="fixed",t.style.width="100px",t.style.height="50px",t.style.top="0px",t.style.left="0px",e||(t.style.display="none")},at=function(t){nt(i,t);var e,n,r=it(i);function i(t,e,n){var o,s,u,a,h;J(this,i),(h=r.call(this,"canvas",t,e)).config=n,h.maxZoom=null!==(o=n.maxZoom)&&void 0!==o?o:3,h.minZoom=null!==(s=n.minZoom)&&void 0!==s?s:.3,h.speedX=null!==(u=n.speedX)&&void 0!==u?u:1,h.speedY=null!==(a=n.speedY)&&void 0!==a?a:1;var c=[0,0],l=!1;return h._pitch=0,h._yaw=0,h.element.addEventListener("mousedown",(function(t){l=!0,c=[t.clientX,t.clientY],t.stopPropagation()})),h.element.addEventListener("click",(function(t){t.stopPropagation()})),h.element.addEventListener("mouseup",(function(t){l=!1,t.stopPropagation()})),h.element.addEventListener("wheel",(function(t){h.currentZoom+=t.deltaY/1e3,h.currentZoom>h.maxZoom?h.currentZoom=h.maxZoom:h.currentZoom<h.minZoom&&(h.currentZoom=h.minZoom),t.stopPropagation(),t.preventDefault()})),h.element.addEventListener("mouseout",(function(t){l=!1,t.stopPropagation()})),h.element.addEventListener("mousemove",(function(t){if(l){var e=[t.clientX,t.clientY],n=[c[0]-e[0],c[1]-e[1]];c=e,h._yaw+=.004*n[0]*h.speedX,h._pitch+=.004*n[1]*h.speedY,h._yaw>2*Math.PI?h._yaw=h._yaw-2*Math.PI:h._yaw<0&&(h._yaw=2*Math.PI+h._yaw),h._pitch>Math.PI/2?h._pitch=Math.PI/2:h._pitch<=-Math.PI/2&&(h._pitch=-Math.PI/2)}t.stopPropagation()})),h}return et(i,[{key:"loadCanvas",value:(e=regeneratorRuntime.mark((function t(e){var n,r,i,o,s,u,h=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.currentZoom=1,this._videoPlayer=e,e.element.style.width="100%",e.element.style.height="100%",e.element.style.position="absolute",e.element.style.top="0",e.element.style.left="0",this.element.style.overflow="hidden",this.element.style.position="relative",this._videoPlayer=e,e.element.crossOrigin="",ut.apply(this,[e.element,!1]),this._webGLCanvas=new a(this.element),t.next=15,this._webGLCanvas.init({clearColor:[.2,.3,.8,1]});case 15:n=this._webGLCanvas.gl,r=new g(n,e.element),i=new l(n,{vertex:"\nprecision highp float;\nattribute vec3 inVertexPos;\nattribute vec2 inTexCoord;\n\nvarying vec2 fsTexCoord;\n\nuniform mat4 uView;\nuniform mat4 uProj;\n\nvoid main() {\n gl_Position = uProj * uView * vec4(inVertexPos,1.0);\n fsTexCoord = inTexCoord;\n}\n",fragment:"\nprecision highp float;\nuniform sampler2D uVideoTexture;\n\nvarying vec2 fsTexCoord;\n\nvoid main() {\n gl_FragColor = texture2D(uVideoTexture,fsTexCoord);\n}\n",attribs:["inVertexPos","inTexCoord"],uniforms:["uView","uProj","uVideoTexture"]}),o=x(30),s=new p(n,o.positions,o.uvs,o.triangles),u=this.element,function t(){var e=45*h.currentZoom,o=H.MakePerspective(e,1.33,.01,10),a=H.MakeIdentity(),c=H.MakeRotation(h._yaw,0,1,0);c.rotate(h._pitch,1,0,0),r.updateTexture();var l=u.clientWidth,f=u.clientHeight;u.width=l,u.height=f,n.viewport(0,0,l,f),n.clear(n.COLOR_BUFFER_BIT),i.useProgram(),i.enablePositionArray("inVertexPos",s),i.enableTexCoordArray("inTexCoord",s),i.bindMatrix4("uView",H.Mult(c,a)),i.bindMatrix4("uProj",o),i.bindTexture("uVideoTexture",r.texture),s.draw(),requestAnimationFrame(t)}();case 23:case"end":return t.stop()}}),t,this)})),n=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(t){K(o,r,i,s,u,"next",t)}function u(t){K(o,r,i,s,u,"throw",t)}s(void 0)}))},function(t){return n.apply(this,arguments)})}]),i}(r.Canvas),ht=function(t){nt(n,t);var e=it(n);function n(){return J(this,n),e.apply(this,arguments)}return et(n,[{key:"canvasType",get:function(){return"video360"}},{key:"isCompatible",value:function(t){var e,r=this;return!(null===(e=t.canvas)||void 0===e||!e.find((function(t){return t==r.canvasType})))||$(st(n.prototype),"isCompatible",this).call(this,t)}},{key:"getCanvasInstance",value:function(t){return new at(this.player,t,this.config)}}]),n}(r.CanvasPlugin)},757:(t,e,n)=>{var r={"./WebGLPluginModule.js":323,"./es.upv.paella.video360Canvas.js":503};function i(t){var e=o(t);return n(e)}function o(t){if(!n.o(r,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}i.keys=function(){return Object.keys(r)},i.resolve=o,t.exports=i,i.id=757},995:e=>{"use strict";e.exports=t}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={exports:{}};return e[t](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";function t(){return r(757)}r.r(i),r.d(i,{Video360CanvasPlugin:()=>e,default:()=>t});var e=r(503).default})(),i})())); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("paella-core")):"function"==typeof define&&define.amd?define(["paella-core"],e):"object"==typeof exports?exports["paella-webgl-plugins"]=e(require("paella-core")):t["paella-webgl-plugins"]=e(t[void 0])}(self,(t=>(()=>{var e={323:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>c});var r=n(995);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function a(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(l,t);var e,n,r,i,c=(r=l,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=h(r);if(i){var n=h(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return a(this,t)});function l(){return o(this,l),c.apply(this,arguments)}return e=l,(n=[{key:"moduleName",get:function(){return"paella-webgl-plugins"}},{key:"moduleVersion",get:function(){return"1.25.2"}}])&&s(e.prototype,n),l}(r.PluginModule)},503:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Video360Canvas:()=>at,default:()=>ht});var r=n(995);function i(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(t,e,n,r,i,o,s){try{var u=t[o](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,i)}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e.getContext("webgl"),null===this.gl)throw new Error("This browser does not support WebGL")}var e,n,r,o;return e=t,n=[{key:"init",value:(r=regeneratorRuntime.mark((function t(){var e,n,r,o,s=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=s.length>0&&void 0!==s[0]?s[0]:{},n=e.clearColor,r=void 0===n?[0,0,0,1]:n,(o=this.gl).enable(o.DEPTH_TEST),o.clearColor.apply(o,i(r)),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);case 5:case"end":return t.stop()}}),t,this)})),o=function(){var t=this,e=arguments;return new Promise((function(n,i){var o=r.apply(t,e);function u(t){s(o,n,i,u,a,"next",t)}function a(t){s(o,n,i,u,a,"throw",t)}u(void 0)}))},function(){return o.apply(this,arguments)})}],n&&u(e.prototype,n),t}();function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=function(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS)||console.error("Error compiling shdaer: \n".concat(t.getShaderInfoLog(r))),r},l=function(){function t(e,n){var r=this,i=n.vertex,o=void 0===i?"\n\nattribute vec4 inVertexPos;\n\nvoid main() {\n gl_Position = inVertexPos;\n}\n":i,s=n.fragment,u=void 0===s?"\nvoid main() {\n gl_FragColor = vec4(1.0, 0.5, 1.0, 1.0);\n}\n":s,a=n.attribs,h=void 0===a?[]:a,l=n.uniforms,f=void 0===l?[]:l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e;var y=c(e,e.VERTEX_SHADER,o),v=c(e,e.FRAGMENT_SHADER,u),p=e.createProgram();e.attachShader(p,y),e.attachShader(p,v),e.linkProgram(p),e.getProgramParameter(p,e.LINK_STATUS)||console.error("Unable to initialize shader program: ".concat(e.getProgramInfoLog(p))),e.deleteShader(y),e.deleteShader(v),this._shaderProgram=p,this.attribs={},h.forEach((function(t){r.attribs[t]=e.getAttribLocation(p,t),-1==r.attribs[t]&&console.warn("Attribute not found in shader: '".concat(t,"'"))})),this.uniforms={},f.forEach((function(t){r.uniforms[t]=e.getUniformLocation(p,t),null===r.uniforms[t]&&console.warn("Uniform not found in shader: ".concat(t))}))}var e,n;return e=t,(n=[{key:"useProgram",value:function(){this.gl.useProgram(this._shaderProgram)}},{key:"enablePositionArray",value:function(t,e){e.bindPositions(),this.enableArray(t,3)}},{key:"enableTexCoordArray",value:function(t,e){e.bindTexCoord(),this.enableArray(t,2)}},{key:"enableArray",value:function(t,e){var n=this.gl;n.enableVertexAttribArray(this.attribs[t]),n.vertexAttribPointer(this.attribs[t],e,n.FLOAT,!1,0,0)}},{key:"bindTexture",value:function(t,e){var n=this.gl;n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e),n.uniform1i(this.uniforms[t],0)}},{key:"bindFloat",value:function(t,e){this.gl.uniform1f(this.uniforms[t],e)}},{key:"bindMatrix4",value:function(t,e){this.gl.uniformMatrix4fv(this.uniforms[t],!1,e)}}])&&h(e.prototype,n),t}();function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function y(t,e){var n=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,n),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),n}var p=function(){function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.positionArray=n,this.positionBuffer=y(e,n),this.texCoordArray=r,this.texCoordBuffer=y(e,r),this.indexArray=i,this.indexBuffer=function(t,e){var n=t.createBuffer();return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array(e),t.STATIC_DRAW),n}(e,i)}var e,n;return e=t,(n=[{key:"bindPositions",value:function(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer)}},{key:"bindTexCoord",value:function(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texCoordBuffer)}},{key:"draw",value:function(){this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.indexBuffer),this.gl.drawElements(this.gl.TRIANGLES,this.indexArray.length,this.gl.UNSIGNED_SHORT,0)}}])&&f(e.prototype,n),t}();function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var g=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gl=e,this.video=n,this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture);var r=new Uint8Array([0,0,255,255]);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)}var e,n;return e=t,(n=[{key:"updateTexture",value:function(){var t=this.gl;t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)}}])&&w(e.prototype,n),t}();function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null!=n){var r,i,o=[],s=!0,u=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);s=!0);}catch(t){u=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var b=2*Math.PI,k=Math.PI/2;function E(t,e,n){return(n-t)/(e-t)}function x(t){for(var e,n,r,i,o=Math.PI/t,s=2*t,u=[],a=[],h=-Math.PI/2,c=0;c<=t;c++){for(var l=E(-k,k,-h),f=0,y=s+(c>0&&c<t?1:0),v=0;v<y;v++)u.push((void 0,void 0,void 0,i=void 0,n=(e=d([1,h,f],3))[0],r=e[1],i=-(i=e[2])+Math.PI/2,[n*Math.cos(r)*Math.cos(i),n*Math.sin(r),n*-Math.cos(r)*Math.sin(i)])),a.push([E(0,b,f),l]),f+=o;h+=o}for(var p=[],w=0;w<u.length;w++)p.push([1,1,0]);for(var g=[],m=0,x=0;x<t;x++){for(var _=x>0?1:0,R=0;R<s;R++){var P=m+R,T=m+R+1,I=P+s+_,N=T+s+_;0===x&&g.push([P,N,I]),x===t-1&&g.push([P,T,I]),x>0&&x<t-1&&t>2&&(g.push([P,N,I]),g.push([P,T,N]))}m+=0===x?s:s+1}return{positions:u.flat(),colors:p.flat(),triangles:g.flat(),uvs:a.flat(),normals:u.flat()}}var _=Float32Array,R=(Float64Array,Date.now(),function(t){return t>-1e-7&&t<1e-7?0:t}),P=function(t){return 0===R(t)},T=function(t,e){return Math.abs(t-e)<1e-7};function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function N(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function M(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function O(t,e){return O=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},O(t,e)}function z(t,e){return!e||"object"!==I(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function S(t){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},S(t)}var A=function(t,e){if(t.length!=e.length)throw new Error("Invalid vector length in operation")},D=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&O(t,e)}(u,t);var e,n,r,i,o,s=(i=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=S(i);if(o){var n=S(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return z(this,t)});function u(){var t;switch(N(this,u),arguments.length){case 0:t=s.call(this,[0,0]);break;case 1:arguments[0].length>1&&arguments[0].length<5&&(t=s.call(this,arguments[0]));break;case 2:2===arguments[0].length&&"number"==typeof arguments[1]?t=s.call(this,[arguments[0][0],arguments[0][1],arguments[1]]):3===arguments[0].length&&"number"==typeof arguments[1]?t=s.call(this,[arguments[0][0],arguments[0][1],arguments[0][2],arguments[1]]):"number"==typeof arguments[0]&&"number"==typeof arguments[1]&&(t=s.call(this,[arguments[0],arguments[1]]));break;case 3:2===arguments[0].length&&"number"==typeof arguments[1]&&"number"==typeof arguments[2]?t=s.call(this,[arguments[0][0],arguments[0][1],arguments[1],arguments[2]]):"number"==typeof arguments[0]&&"number"==typeof arguments[1]&&"number"==typeof arguments[2]&&(t=s.call(this,[arguments[0],arguments[1],arguments[2]]));break;case 4:t=s.call(this,[arguments[0],arguments[1],arguments[2],arguments[3]]);break;default:throw new Error("Invalid parameters in Vec constructor")}return z(t)}return e=u,n=[{key:"normalize",value:function(){var t=u.Magnitude(this);switch(this.length){case 4:this[3]=this[3]/t;case 3:this[2]=this[2]/t;case 2:this[1]=this[1]/t,this[0]=this[0]/t;break;default:throw new Error("Invalid vector size: ".concat(this.length))}return this}},{key:"assign",value:function(t){switch(A(this,t),this.length){case 4:this[3]=t[3];case 3:this[2]=t[2];case 2:this[1]=t[1],this[0]=t[0];break;default:throw new Error("Invalid vector size: ".concat(this.length))}}},{key:"set",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(2===this.length)this[0]=t,this[1]=e;else if(3===this.length&&null!==n)this[0]=t,this[1]=e,this[2]=n;else{if(4!==this.length||null===r)throw new Error("Invalid vector size: ".concat(this.length,". Trying to set x=").concat(t,", y=").concat(e,", z=").concat(n,", w=").concat(r));this[0]=t,this[1]=e,this[2]=n,this[3]=r}}},{key:"scale",value:function(t){switch(this.length){case 4:this[3]=this[3]*t;case 3:this[2]=this[2]*t;case 2:this[1]=this[1]*t,this[0]=this[0]*t;break;default:throw new Error("Invalid vector size: ".concat(v.length))}return this}},{key:"x",get:function(){return this[0]},set:function(t){return this[0]=t,this}},{key:"y",get:function(){return this[1]},set:function(t){return this[1]=t,this}},{key:"z",get:function(){return this[2]},set:function(t){return this[2]=t,this}},{key:"w",get:function(){return this[3]},set:function(t){return this[3]=t,this}},{key:"r",get:function(){return this[0]},set:function(t){return this[0]=t,this}},{key:"g",get:function(){return this[1]},set:function(t){return this[1]=t,this}},{key:"b",get:function(){return this[2]},set:function(t){return this[2]=t,this}},{key:"a",get:function(){return this[3]},set:function(t){return this[3]=t,this}},{key:"width",get:function(){switch(this.length){case 2:return this[0];case 4:return this[2];default:throw new Error("Vec.width function used on non size or viewport vectors (two or four elements)")}},set:function(t){return this[0]=t,this}},{key:"height",get:function(){switch(this.length){case 2:return this[1];case 4:return this[3];default:throw new Error("Vec.width function used on non size or viewport vectors (two or four elements)")}},set:function(t){return this[1]=t,this}},{key:"xy",get:function(){switch(this.length){case 2:return new u(this);case 3:case 4:return new u(this[0],this[1]);default:throw new Error("Invalid vector size: ".concat(this.length))}},set:function(t){return this[0]=t[0],this[1]=t[1],this}},{key:"xz",get:function(){switch(this.length){case 3:case 4:return new u(this[0],this[2]);default:throw new Error("Invalid vector size: ".concat(this.length))}},set:function(t){if(this.length<3)throw new Error("Invalid vector size");return this[0]=t[0],this[2]=t[1],this}},{key:"yz",get:function(){switch(this.length){case 3:case 4:return new u(this[1],this[2]);default:throw new Error("Invalid vector size: ".concat(this.length))}},set:function(t){if(this.length<3)throw new Error("Invalid vector size");return this[1]=t[0],this[2]=t[1],this}},{key:"xyz",get:function(){if(this.length<3)throw new Error("Invalid vector size: ".concat(this.length));return new u(this[0],this[1],this[2])},set:function(t){if(t.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(t.length));return this[0]=t[0],this[1]=t[1],this[2]=t[2],this}},{key:"xyzw",get:function(){if(this.length<4)throw new Error("Invalid vector size: ".concat(this.length,", 4 required"));return new u(this[0],this[1],this[2],this[3])},set:function(t){if(this.length<4||t.length<4)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(t.length));return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this}},{key:"rgb",get:function(){if(this.length<3)throw new Error("Invalid vector size: ".concat(this.length,", but at least 3 required"));return new u(this[0],this[1],this[2])},set:function(t){if(t.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(t.length));return this[0]=t[0],this[1]=t[1],this[2]=t[2],this}},{key:"rg",get:function(){if(v.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(v.length));return new u(this[0],this[1])}},{key:"gb",get:function(){if(v.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(v.length));return new u(this[1],this[2])}},{key:"rb",get:function(){if(v.length<3||this.length<3)throw new Error("Invalid vector size to set: l;".concat(this.length,", r:").concat(v.length));return new u(this[0],this[2])}},{key:"hexColor",get:function(){var t=Math.round(255*this.r),e=Math.round(255*this.g),n=Math.round(255*this.b),r=function(t){return t.toString(16).toUpperCase()};return"#".concat(r(t)).concat(r(e)).concat(r(n))}},{key:"cssColor",get:function(){}},{key:"aspectRatio",get:function(){return this.width/this.height}},{key:"toString",value:function(){switch(this.length){case 2:return"[".concat(this[0],", ").concat(this[1],"]");case 3:return"[".concat(this[0],", ").concat(this[1],", ").concat(this[2],"]");case 4:return"[".concat(this[0],", ").concat(this[1],", ").concat(this[2],", ").concat(this[5],"]")}}}],r=[{key:"CheckEqualLength",value:function(t,e){A(t,e)}},{key:"Max",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]>e[0]?t[0]:e[0],t[1]>e[1]?t[1]:e[1]]);case 3:return new u([t[0]>e[0]?t[0]:e[0],t[1]>e[1]?t[1]:e[1],t[2]>e[2]?t[2]:e[2]]);case 4:return new u([t[0]>e[0]?t[0]:e[0],t[1]>e[1]?t[1]:e[1],t[2]>e[2]?t[2]:e[2],t[3]>e[3]?t[3]:e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Min",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]<e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1]]);case 3:return new u([t[0]<e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1],t[2]<e[2]?t[2]:e[2]]);case 4:return new u([t[0]<e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1],t[2]<e[2]?t[2]:e[2],t[3]<e[3]?t[3]:e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Add",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]+e[0],t[1]+e[1]]);case 3:return new u([t[0]+e[0],t[1]+e[1],t[2]+e[2]]);case 4:return new u([t[0]+e[0],t[1]+e[1],t[2]+e[2],t[3]+e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Sub",value:function(t,e){switch(A(t,e),t.length){case 2:return new u([t[0]-e[0],t[1]-e[1]]);case 3:return new u([t[0]-e[0],t[1]-e[1],t[2]-e[2]]);case 4:return new u([t[0]-e[0],t[1]-e[1],t[2]-e[2],t[3]-e[3]]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Magnitude",value:function(t){switch(t.length){case 2:return Math.sqrt(t[0]*t[0]+t[1]*t[1]);case 3:return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);case 4:return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Distance",value:function(t,e){return A(t,e),u.Magnitude(u.Sub(t,e))}},{key:"Dot",value:function(t,e){switch(A(t,e),t.length){case 2:return t[0]*e[0]+t[1]*e[1];case 3:return t[0]*e[0]+t[1]*e[1]+t[2]*e[2];case 4:return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3];default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Cross",value:function(t,e){switch(A(t,e),t.length){case 2:return t[0]*e[1]-t[1]-e[0];case 3:return new u([t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]);default:throw new Error("Invalid vector size for cross product: ".concat(t.length))}}},{key:"Normalized",value:function(t){var e=u.Magnitude(t);switch(t.length){case 2:return new u([t[0]/e,t[1]/e]);case 3:return new u([t[0]/e,t[1]/e,t[2]/e]);case 4:return new u([t[0]/e,t[1]/e,t[2]/e,t[3]/e]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Mult",value:function(t,e){switch(t.length){case 2:return new u([t[0]*e,t[1]*e]);case 3:return new u([t[0]*e,t[1]*e,t[2]*e]);case 4:return new u([t[0]*e,t[1]*e,t[2]*e,t[3]*e]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Div",value:function(t,e){switch(t.length){case 2:return new u([t[0]/e,t[1]/e]);case 3:return new u([t[0]/e,t[1]/e,t[2]/e]);case 4:return new u([t[0]/e,t[1]/e,t[2]/e,t[3]/e]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Equals",value:function(t,e){if(t.length!=e.length)return!1;switch(t.length){case 2:return T(t[0],e[0])&&T(t[1],e[1]);case 3:return T(t[0],e[0])&&T(t[1],e[1])&&T(t[2],e[2]);case 4:return T(t[0],e[0])&&T(t[1],e[1])&&T(t[2],e[2])&&T(t[3],e[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"IsZero",value:function(t){switch(t.length){case 2:return P(t[0])||P(t[1]);case 3:return P(t[0])||P(t[1])||P(t[2]);case 4:return P(t[0])||P(t[1])||P(t[2])||P(t[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"IsNaN",value:function(t){switch(t.length){case 2:return isNaN(t[0])||isNaN(t[1]);case 3:return isNaN(t[0])||isNaN(t[1])||isNaN(t[2]);case 4:return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])||isNaN(t[3]);default:throw new Error("Invalid vector size: ".concat(t.length))}}},{key:"Vec2",value:function(){return new u(0,0)}},{key:"Vec3",value:function(){return new u(0,0,0)}},{key:"Vec4",value:function(){return new u(0,0,0,0)}}],n&&M(e.prototype,n),r&&M(e,r),u}(_);function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function C(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function U(t,e){return U=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},U(t,e)}function V(t,e){return!e||"object"!==j(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function F(t){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},F(t)}var L=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&U(t,e)}(u,t);var e,n,r,i,o,s=(i=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=F(i);if(o){var n=F(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return V(this,t)});function u(){var t;if(C(this,u),9===arguments.length)t=s.call(this,arguments);else if(1===arguments.length&&9===arguments[0].length)t=s.call(this,arguments[0]);else{if(0!==arguments.length)throw new Error("Invalid parameter size in Mat3 constructor");t=s.call(this,[0,0,0,0,0,0,0,0,0])}return V(t)}return e=u,n=[{key:"identity",value:function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=1,this[5]=0,this[6]=0,this[7]=0,this[8]=1,this}},{key:"zero",value:function(){return this[0]=0,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=0,this[6]=0,this[7]=0,this[8]=0,this}},{key:"row",value:function(t){return new D(this[3*t],this[3*t+1],this[3*t+2])}},{key:"setRow",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if((null==e?void 0:e.length)>=3)this[3*t]=e[0],this[3*t+1]=e[1],this[3*t+2]=e[2];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r)throw new Error("Invalid parameter setting matrix row");this[3*t]=e,this[3*t+1]=n,this[3*t+2]=r}return this}},{key:"col",value:function(t){return new D(this[t],this[t+3],this[t+6])}},{key:"setCol",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if((null==e?void 0:e.length)>=3)this[t]=e[0],this[t+3]=e[1],this[t+6]=e[2];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r)throw new Error("Invalid parameter setting matrix row");this[t]=e,this[t+3]=n,this[t+6]=r}return this}},{key:"assign",value:function(t){if(9===t.length)this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8];else{if(16!==t.length)throw new Error("Invalid plarameter setting matrix data");this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[4],this[4]=t[5],this[5]=t[6],this[6]=t[8],this[7]=t[9],this[8]=t[10]}return this}},{key:"setScale",value:function(t,e,n){var r=new D(this[0],this[3],this[6]).normalize().scale(t),i=new D(this[1],this[4],this[7]).normalize().scale(e),o=new D(this[2],this[5],this[8]).normalize().scale(n);return this[0]=r.x,this[3]=r.y,this[6]=r.z,this[1]=i.x,this[4]=i.y,this[7]=i.z,this[2]=o.x,this[5]=o.y,this[8]=o.z,this}},{key:"traspose",value:function(){var t=this[3],e=this[7],n=this[6];return this[3]=this[1],this[6]=this[2],this[7]=this[5],this[1]=t,this[2]=n,this[5]=e,this}},{key:"mult",value:function(t){if("number"==typeof t)this[0]*=t,this[1]*=t,this[2]*=t,this[3]*=t,this[4]*=t,this[5]*=t,this[6]*=t,this[7]*=t,this[8]*=t;else{if(!(t instanceof _&&9===t.length))throw new Error("Invalid parameter in Mat3.mult()");var e=this.row(0),n=this.row(1),r=this.row(2),i=t.col(0),o=t.col(1),s=t.col(2);this[0]=D.Dot(e,i),this[1]=D.Dot(e,o),this[2]=D.Dot(e,s),this[3]=D.Dot(n,i),this[4]=D.Dot(n,o),this[5]=D.Dot(n,s),this[6]=D.Dot(r,i),this[7]=D.Dot(r,o),this[8]=D.Dot(r,s)}return this}},{key:"multVector",value:function(t){if(2===t.length||3===t.length){var e=t[0],n=t[1],r=2===t.length?1:t[2];return new D(this[0]*e+this[3]*n+this[6]*r,this[1]*e+this[4]*n+this[7]*r,this[2]*e+this[5]*n+this[8]*r)}throw new Error("Invalid parameter in Mat3.multVector()")}},{key:"toString",value:function(){return"[ ".concat(this[0],", ").concat(this[1],", ").concat(this[2],"\n")+" ".concat(this[3],", ").concat(this[4],", ").concat(this[5],"\n")+" ".concat(this[6],", ").concat(this[7],", ").concat(this[8]," ]")}}],r=[{key:"MakeIdentity",value:function(){return(new u).identity()}},{key:"MakeZero",value:function(){return(new u).zero()}},{key:"MakeWithQuaternion",value:function(t){var e=u.MakeIdentity();return e.setRow(0,new D(1-2*t[1]*t[1]-2*t[2]*t[2],2*t[0]*t[1]-2*t[2]*t[3],2*t[0]*t[2]+2*t[1]*t[3])),e.setRow(1,new D(2*t[0]*t[1]+2*t[2]*t[3],1-2*t[0]*t[0]-2*t[2]*t[2],2*t[1]*t[2]-2*t[0]*t[3])),e.setRow(2,new D(2*t[0]*t[2]-2*t[1]*t[3],2*t[1]*t[2]+2*t[0]*t[3],1-2*t[0]*t[0]-2*t[1]*t[1])),e}},{key:"IsZero",value:function(t){return P(v[0])&&P(v[1])&&P(v[2])&&P(v[3])&&P(v[4])&&P(v[5])&&P(v[6])&&P(v[7])&&P(v[8])}},{key:"IsIdentity",value:function(t){return T(v[0],1)&&P(v[1])&&P(v[2])&&P(v[3])&&T(v[4],1)&&P(v[5])&&P(v[6])&&P(v[7])&&T(v[8],1)}},{key:"GetScale",value:function(t){return new D(D.Magnitude(new D(t[0],t[3],t[6])),D.Magnitude(new D(t[1],t[4],t[7])),D.Magnitude(new D(t[2],t[5],t[8])))}},{key:"Equals",value:function(t,e){return T(t[0],e[0])&&T(t[1],e[1])&&T(t[2],e[2])&&T(t[3],e[3])&&T(t[4],e[4])&&T(t[5],e[5])&&T(t[6],e[6])&&T(t[7],e[7])&&T(t[8],e[8])}},{key:"IsNaN",value:function(t){return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])&&isNaN(t[3])||isNaN(t[4])||isNaN(t[5])&&isNaN(t[6])||isNaN(t[7])||isNaN(t[8])}}],n&&B(e.prototype,n),r&&B(e,r),u}(_);function G(t){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(t)}function Z(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function X(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Y(t,e){return Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Y(t,e)}function q(t,e){return!e||"object"!==G(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function W(t){return W=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},W(t)}var H=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Y(t,e)}(u,t);var e,n,r,i,o,s=(i=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=W(i);if(o){var n=W(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return q(this,t)});function u(){Z(this,u);var t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];if(9===arguments.length)t[0]=arguments[0],t[1]=arguments[1],t[2]=arguments[2],t[4]=arguments[3],t[5]=arguments[4],t[6]=arguments[5],t[8]=arguments[6],t[9]=arguments[7],t[10]=arguments[8],t[15]=1;else if(1===arguments.length&&9===arguments[0].length)t[0]=arguments[0][0],t[1]=arguments[0][1],t[2]=arguments[0][2],t[4]=arguments[0][3],t[5]=arguments[0][4],t[6]=arguments[0][5],t[8]=arguments[0][6],t[9]=arguments[0][7],t[10]=arguments[0][8],t[15]=1;else if(16===arguments.length)t[0]=arguments[0],t[1]=arguments[1],t[2]=arguments[2],t[3]=arguments[3],t[4]=arguments[4],t[5]=arguments[5],t[6]=arguments[6],t[7]=arguments[7],t[8]=arguments[8],t[9]=arguments[9],t[10]=arguments[10],t[11]=arguments[11],t[12]=arguments[12],t[13]=arguments[13],t[14]=arguments[14],t[15]=arguments[15];else if(1===arguments.length&&16===arguments[0].length)t[0]=arguments[0][0],t[1]=arguments[0][1],t[2]=arguments[0][2],t[3]=arguments[0][3],t[4]=arguments[0][4],t[5]=arguments[0][5],t[6]=arguments[0][6],t[7]=arguments[0][7],t[8]=arguments[0][8],t[9]=arguments[0][9],t[10]=arguments[0][10],t[11]=arguments[0][11],t[12]=arguments[0][12],t[13]=arguments[0][13],t[14]=arguments[0][14],t[15]=arguments[0][15];else if(0!=arguments.length)throw new Error("Invalid parameter size in Matrix3 constructor");return s.call(this,t)}return e=u,n=[{key:"identity",value:function(){return this[0]=1,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=1,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=1,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1,this}},{key:"zero",value:function(){return this[0]=0,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=0,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=0,this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=0,this}},{key:"perspective",value:function(t,e,n,r){var i=Math.tan(3.141592653589793*t/360)*n,o=i*e;return this.frustum(-o,o,-i,i,n,r),this}},{key:"frustum",value:function(t,e,n,r,i,o){var s=e-t,u=r-n,a=o-i;return this.setRow(0,new D(2*i/s,0,0,0)),this.setRow(1,new D(0,2*i/u,0,0)),this.setRow(2,new D((e+t)/s,(r+n)/u,-(o+i)/a,-1)),this.setRow(3,new D(0,0,-o*i*2/a,0)),this}},{key:"ortho",value:function(t,e,n,r,i,o){var s=e-t,u=r-n,a=o-i;return this[0]=2/s,this[1]=0,this[2]=0,this[3]=0,this[4]=0,this[5]=2/u,this[6]=0,this[7]=0,this[8]=0,this[9]=0,this[10]=-2/a,this[11]=0,this[12]=-(t+e)/s,this[13]=-(r+n)/u,this[14]=-(o+i)/a,this[15]=1,this}},{key:"lookAt",value:function(t,e,n){this.identity();var r=new D(n),i=D.Sub(t,e);i.normalize();var o=D.Cross(r,i);return o.normalize(),r.normalize(),this.m00=o.x,this.m10=o.y,this.m20=o.z,this.m30=-D.Dot(o,t),this.m01=r.x,this.m11=r.y,this.m21=r.z,this.m31=-D.Dot(r,t),this.m02=i.x,this.m12=i.y,this.m22=i.z,this.m32=-D.Dot(i,t),this.m03=0,this.m13=0,this.m23=0,this.m33=1,this}},{key:"m00",get:function(){return this[0]},set:function(t){this[0]=t}},{key:"m01",get:function(){return this[1]},set:function(t){this[1]=t}},{key:"m02",get:function(){return this[2]},set:function(t){this[2]=t}},{key:"m03",get:function(){return this[3]},set:function(t){this[3]=t}},{key:"m10",get:function(){return this[4]},set:function(t){this[4]=t}},{key:"m11",get:function(){return this[5]},set:function(t){this[5]=t}},{key:"m12",get:function(){return this[6]},set:function(t){this[6]=t}},{key:"m13",get:function(){return this[7]},set:function(t){this[7]=t}},{key:"m20",get:function(){return this[8]},set:function(t){this[8]=t}},{key:"m21",get:function(){return this[9]},set:function(t){this[9]=t}},{key:"m22",get:function(){return this[10]},set:function(t){this[10]=t}},{key:"m23",get:function(){return this[11]},set:function(t){this[11]=t}},{key:"m30",get:function(){return this[12]},set:function(t){this[12]=t}},{key:"m31",get:function(){return this[13]},set:function(t){this[13]=t}},{key:"m32",get:function(){return this[14]},set:function(t){this[14]=t}},{key:"m33",get:function(){return this[15]},set:function(t){this[15]=t}},{key:"mat3",get:function(){return new L(this[0],this[1],this[2],this[4],this[5],this[6],this[8],this[9],this[10])}},{key:"forwardVector",get:function(){return u.TransformDirection(this,new D(0,0,1))}},{key:"rightVector",get:function(){return u.TransformDirection(this,new D(1,0,0))}},{key:"upVector",get:function(){return u.TransformDirection(this,new D(0,1,0))}},{key:"backwardVector",get:function(){return u.TransformDirection(this,new D(0,0,-1))}},{key:"leftVector",get:function(){return u.TransformDirection(this,new D(-1,0,0))}},{key:"downVector",get:function(){return u.TransformDirection(this,new D(0,-1,0))}},{key:"row",value:function(t){return new D(this[4*t],this[4*t+1],this[4*t+2],this[4*t+3])}},{key:"setRow",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(e.length>=4)this[4*t]=e[0],this[4*t+1]=e[1],this[4*t+2]=e[2],this[4*t+3]=e[3];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r||"number"!=typeof i)throw new Error("Invalid parameter setting matrix row");this[4*t]=e,this[4*t+1]=n,this[4*t+2]=r,this[4*t+3]=i}return this}},{key:"col",value:function(t){return new D(this[t],this[t+4],this[t+8],this[t+12])}},{key:"setCol",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(e.length>=4)this[t]=e[0],this[t+4]=e[1],this[t+8]=e[2],this[t+12]=e[3];else{if("number"!=typeof e||"number"!=typeof n||"number"!=typeof r||"number"!=typeof i)throw new Error("Invalid parameter setting matrix row");this[t]=e,this[t+4]=n,this[t+8]=r,this[t+12]=i}return this}},{key:"assign",value:function(t){return 9==t.length?(this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=0,this[4]=t[3],this[5]=t[4],this[6]=t[5],this[7]=0,this[8]=t[6],this[9]=t[7],this[10]=t[8],this[11]=0,this[12]=0,this[13]=0,this[14]=0,this[15]=1):16==t.length&&(this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15]),this}},{key:"translate",value:function(t,e,n){return this.mult(u.MakeTranslation(t,e,n)),this}},{key:"rotate",value:function(t,e,n,r){return this.mult(u.MakeRotation(t,e,n,r)),this}},{key:"scale",value:function(t,e,n){return this.mult(u.MakeScale(t,e,n)),this}},{key:"toString",value:function(){return"[ ".concat(this[0],", ").concat(this[1],", ").concat(this[2],", ").concat(this[3],"\n")+" ".concat(this[4],", ").concat(this[5],", ").concat(this[6],", ").concat(this[7],"\n")+" ".concat(this[8],", ").concat(this[9],", ").concat(this[10],", ").concat(this[11],"\n")+" ".concat(this[12],", ").concat(this[13],", ").concat(this[14],", ").concat(this[15]," ]")}},{key:"setScale",value:function(t,e,n){var r=new D(this[0],this[4],this[8]).normalize().scale(t),i=new D(this[1],this[5],this[9]).normalize().scale(e),o=new D(this[2],this[6],this[10]).normalize().scale(n);return this[0]=r.x,this[4]=r.y,this[8]=r.z,this[1]=i.x,this[5]=i.y,this[9]=i.z,this[2]=o.x,this[6]=o.y,this[10]=o.z,this}},{key:"setPosition",value:function(t,e,n){return"number"==typeof t?(this[12]=t,this[13]=e,this[14]=n):(this[12]=t.x,this[13]=t.y,this[14]=t.z),this}},{key:"mult",value:function(t){if("number"==typeof t)return this[0]*=t,this[1]*=t,this[2]*=t,this[3]*=t,this[4]*=t,this[5]*=t,this[6]*=t,this[7]*=t,this[8]*=t,this[9]*=t,this[10]*=t,this[11]*=t,this[12]*=t,this[13]*=t,this[14]*=t,this[15]*=t,this;var e=this.row(0),n=this.row(1),r=this.row(2),i=this.row(3),o=t.col(0),s=t.col(1),u=t.col(2),a=t.col(3);return this[0]=D.Dot(e,o),this[1]=D.Dot(e,s),this[2]=D.Dot(e,u),this[3]=D.Dot(e,a),this[4]=D.Dot(n,o),this[5]=D.Dot(n,s),this[6]=D.Dot(n,u),this[7]=D.Dot(n,a),this[8]=D.Dot(r,o),this[9]=D.Dot(r,s),this[10]=D.Dot(r,u),this[11]=D.Dot(r,a),this[12]=D.Dot(i,o),this[13]=D.Dot(i,s),this[14]=D.Dot(i,u),this[15]=D.Dot(i,a),this}},{key:"multVector",value:function(t){if(t.length<3)throw new Error("Invalid parameter multiplying Mat4 by vector");var e=t[0],n=t[1],r=t[2],i=t.length>3?t[3]:1;return new D(this[0]*e+this[4]*n+this[8]*r+this[12]*i,this[1]*e+this[5]*n+this[9]*r+this[13]*i,this[2]*e+this[6]*n+this[10]*r+this[14]*i,this[3]*e+this[7]*n+this[11]*r+this[15]*i)}},{key:"invert",value:function(){var t=this[0],e=this[1],n=this[2],r=this[3],i=this[4],o=this[5],s=this[6],u=this[7],a=this[8],h=this[9],c=this[10],l=this[11],f=this[12],y=this[13],v=this[14],p=this[15],w=t*o-e*i,g=t*s-n*i,d=t*u-r*i,m=e*s-n*o,b=e*u-r*o,k=n*u-r*s,E=a*y-h*f,x=a*v-c*f,_=a*p-l*f,R=h*v-c*y,P=h*p-l*y,T=c*p-l*v,I=w*T-g*P+d*R+m*_-b*x+k*E;return I?(I=1/I,this[0]=(o*T-s*P+u*R)*I,this[1]=(n*P-e*T-r*R)*I,this[2]=(y*k-v*b+p*m)*I,this[3]=(c*b-h*k-l*m)*I,this[4]=(s*_-i*T-u*x)*I,this[5]=(t*T-n*_+r*x)*I,this[6]=(v*d-f*k-p*g)*I,this[7]=(a*k-c*d+l*g)*I,this[8]=(i*P-o*_+u*E)*I,this[9]=(e*_-t*P-r*E)*I,this[10]=(f*b-y*d+p*w)*I,this[11]=(h*d-a*b-l*w)*I,this[12]=(o*x-i*R-s*E)*I,this[13]=(t*R-e*x+n*E)*I,this[14]=(y*g-f*m-v*w)*I,this[15]=(a*m-h*g+c*w)*I):this.zero(),this}},{key:"traspose",value:function(){var t=new D(this[0],this[4],this[8],this[12]),e=new D(this[1],this[5],this[9],this[13]),n=new D(this[2],this[6],this[10],this[14]),r=new D(this[3],this[7],this[11],this[15]);return this.setRow(0,t),this.setRow(1,e),this.setRow(2,n),this.setRow(3,r),this}}],r=[{key:"MakeIdentity",value:function(){return(new u).identity()}},{key:"MakeZero",value:function(){return(new u).zero()}},{key:"MakeWithQuaternion",value:function(t){var e=u.MakeIdentity();return e.setRow(0,new D(1-2*t[1]*t[1]-2*t[2]*t[2],2*t[0]*t[1]-2*t[2]*t[3],2*t[0]*t[2]+2*t[1]*t[3],0)),e.setRow(1,new D(2*t[0]*t[1]+2*t[2]*t[3],1-2*t[0]*t[0]-2*t[2]*t[2],2*t[1]*t[2]-2*t[0]*t[3],0)),e.setRow(2,new D(2*t[0]*t[2]-2*t[1]*t[3],2*t[1]*t[2]+2*t[0]*t[3],1-2*t[0]*t[0]-2*t[1]*t[1],0)),e}},{key:"MakeTranslation",value:function(t,e,n){return t instanceof _&&t.length>=3&&(e=t[1],n=t[2],t=t[0]),new u(1,0,0,0,0,1,0,0,0,0,1,0,t,e,n,1)}},{key:"MakeRotation",value:function(t,e,n,r){var i=new D(e,n,r);i.normalize();var o=Math.cos(t),s=1-o,a=Math.sin(t);return new u(i.x*i.x*s+o,i.x*i.y*s+i.z*a,i.x*i.z*s-i.y*a,0,i.y*i.x*s-i.z*a,i.y*i.y*s+o,i.y*i.z*s+i.x*a,0,i.z*i.x*s+i.y*a,i.z*i.y*s-i.x*a,i.z*i.z*s+o,0,0,0,0,1)}},{key:"MakeScale",value:function(t,e,n){return t instanceof _&&t.length>=3&&(e=t[1],n=t[2],t=t[0]),new u(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1)}},{key:"MakePerspective",value:function(t,e,n,r){return(new u).perspective(t,e,n,r)}},{key:"MakeFrustum",value:function(t,e,n,r,i,o){return(new u).frustum(t,e,n,r,i,o)}},{key:"MakeOrtho",value:function(t,e,n,r,i,o){return(new u).ortho(t,e,n,r,i,o)}},{key:"MakeLookAt",value:function(t,e,n){return(new u).lookAt(t,e,n)}},{key:"Mult",value:function(t,e){return new u(t).mult(e)}},{key:"Unproject",value:function(t,e,n,r,i,o){var s=new u(i);s.mult(r),s.invert();var a=new D((t-o.y)/o.width*2-1,(e-o.x)/o.height*2-1,2*n-1,1),h=new Vec4(s.multVector(a));return 0==h.z?h.set(0):h.set(h.x/h.w,h.y/h.w,h.z/h.w,h.w/h.w),h}},{key:"GetScale",value:function(t){return new D(D.Magnitude([t[1],t[5],t[9]]),D.Magnitude([t[0],t[4],t[8]]),D.Magnitude([t[2],t[6],t[10]]))}},{key:"GetRotation",value:function(t){var e=u.GetScale(t);return new u(t[0]/e.x,t[1]/e.y,t[2]/e.z,0,t[4]/e.x,t[5]/e.y,t[6]/e.z,0,t[8]/e.x,t[9]/e.y,t[10]/e.z,0,0,0,0,1)}},{key:"GetPosition",value:function(t){return new D(t[12],t[13],t[14])}},{key:"GetInverted",value:function(t){var e=new u(t);return e.invert(),e}},{key:"GetNormalMatrix",value:function(t){return new u(t).invert().traspose().mat3}},{key:"Equals",value:function(t,e){return t[0]==e[0]&&t[1]==e[1]&&t[2]==e[2]&&t[3]==e[3]&&t[4]==e[4]&&t[5]==e[5]&&t[6]==e[6]&&t[7]==e[7]&&t[8]==e[8]&&t[9]==e[9]&&t[10]==e[10]&&t[11]==e[11]&&t[12]==e[12]&&t[13]==e[13]&&t[14]==e[14]&&t[15]==e[15]}},{key:"TransformDirection",value:function(t,e){var n=new D(e),r=new u(t);return r.setRow(3,new D(0,0,0,1)),n.assign(r.multVector(n).xyz),n.normalize(),n}},{key:"IsNan",value:function(){return isNaN(this[0])||isNaN(this[1])||isNaN(this[2])||isNaN(this[3])||isNaN(this[4])||isNaN(this[5])||isNaN(this[6])||isNaN(this[7])||isNaN(this[8])||isNaN(this[9])||isNaN(this[10])||isNaN(this[11])||isNaN(this[12])||isNaN(this[13])||isNaN(this[14])||isNaN(this[15])}},{key:"IsZero",value:function(t){return P(t[0])&&P(t[1])&&P(t[2])&&P(t[3])&&P(t[4])&&P(t[5])&&P(t[6])&&P(t[7])&&P(t[8])&&P(t[9])&&P(t[10])&&P(t[11])&&P(t[12])&&P(t[13])&&P(t[14])&&P(t[15])}},{key:"IsIdentity",value:function(t){return T(t[0],1)&&T(t[1],0)&&T(t[2],0)&&T(t[3],0)&&T(t[4],0)&&T(t[5],1)&&T(t[6],0)&&T(t[7],0)&&T(t[8],0)&&T(t[9],0)&&T(t[10],1)&&T(t[11],0)&&T(t[12],0)&&T(t[13],0)&&T(t[14],0)&&T(t[15],1)}}],n&&X(e.prototype,n),r&&X(e,r),u}(_);function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function $(t,e,n){return $="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=st(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},$(t,e,n||t)}function K(t,e,n,r,i,o,s){try{var u=t[o](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,i)}function J(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function et(t,e,n){return e&&tt(t.prototype,e),n&&tt(t,n),t}function nt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&rt(t,e)}function rt(t,e){return rt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},rt(t,e)}function it(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=st(t);if(e){var i=st(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ot(this,n)}}function ot(t,e){return!e||"object"!==Q(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function st(t){return st=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},st(t)}var ut=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.parentNode;n.removeChild(t),document.body.appendChild(t),t.style.position="fixed",t.style.width="100px",t.style.height="50px",t.style.top="0px",t.style.left="0px",e||(t.style.display="none")},at=function(t){nt(i,t);var e,n,r=it(i);function i(t,e,n){var o,s,u,a,h;J(this,i),(h=r.call(this,"canvas",t,e)).config=n,h.maxZoom=null!==(o=n.maxZoom)&&void 0!==o?o:3,h.minZoom=null!==(s=n.minZoom)&&void 0!==s?s:.3,h.speedX=null!==(u=n.speedX)&&void 0!==u?u:1,h.speedY=null!==(a=n.speedY)&&void 0!==a?a:1;var c=[0,0],l=!1;return h._pitch=0,h._yaw=0,h.element.addEventListener("mousedown",(function(t){l=!0,c=[t.clientX,t.clientY],t.stopPropagation()})),h.element.addEventListener("click",(function(t){t.stopPropagation()})),h.element.addEventListener("mouseup",(function(t){l=!1,t.stopPropagation()})),h.element.addEventListener("wheel",(function(t){h.currentZoom+=t.deltaY/1e3,h.currentZoom>h.maxZoom?h.currentZoom=h.maxZoom:h.currentZoom<h.minZoom&&(h.currentZoom=h.minZoom),t.stopPropagation(),t.preventDefault()})),h.element.addEventListener("mouseout",(function(t){l=!1,t.stopPropagation()})),h.element.addEventListener("mousemove",(function(t){if(l){var e=[t.clientX,t.clientY],n=[c[0]-e[0],c[1]-e[1]];c=e,h._yaw+=.004*n[0]*h.speedX,h._pitch+=.004*n[1]*h.speedY,h._yaw>2*Math.PI?h._yaw=h._yaw-2*Math.PI:h._yaw<0&&(h._yaw=2*Math.PI+h._yaw),h._pitch>Math.PI/2?h._pitch=Math.PI/2:h._pitch<=-Math.PI/2&&(h._pitch=-Math.PI/2)}t.stopPropagation()})),h}return et(i,[{key:"loadCanvas",value:(e=regeneratorRuntime.mark((function t(e){var n,r,i,o,s,u,h=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.currentZoom=1,this._videoPlayer=e,e.element.style.width="100%",e.element.style.height="100%",e.element.style.position="absolute",e.element.style.top="0",e.element.style.left="0",this.element.style.overflow="hidden",this.element.style.position="relative",this._videoPlayer=e,e.element.crossOrigin="",ut.apply(this,[e.element,!1]),this._webGLCanvas=new a(this.element),t.next=15,this._webGLCanvas.init({clearColor:[.2,.3,.8,1]});case 15:n=this._webGLCanvas.gl,r=new g(n,e.element),i=new l(n,{vertex:"\nprecision highp float;\nattribute vec3 inVertexPos;\nattribute vec2 inTexCoord;\n\nvarying vec2 fsTexCoord;\n\nuniform mat4 uView;\nuniform mat4 uProj;\n\nvoid main() {\n gl_Position = uProj * uView * vec4(inVertexPos,1.0);\n fsTexCoord = inTexCoord;\n}\n",fragment:"\nprecision highp float;\nuniform sampler2D uVideoTexture;\n\nvarying vec2 fsTexCoord;\n\nvoid main() {\n gl_FragColor = texture2D(uVideoTexture,fsTexCoord);\n}\n",attribs:["inVertexPos","inTexCoord"],uniforms:["uView","uProj","uVideoTexture"]}),o=x(30),s=new p(n,o.positions,o.uvs,o.triangles),u=this.element,function t(){var e=u.clientWidth,o=u.clientHeight,a=45*h.currentZoom,c=e/o,l=H.MakePerspective(a,isNaN(c)?16/9:c,.01,10),f=H.MakeIdentity(),y=H.MakeRotation(h._yaw,0,1,0);y.rotate(h._pitch,1,0,0),r.updateTexture(),u.width=e,u.height=o,n.viewport(0,0,e,o),n.clear(n.COLOR_BUFFER_BIT),i.useProgram(),i.enablePositionArray("inVertexPos",s),i.enableTexCoordArray("inTexCoord",s),i.bindMatrix4("uView",H.Mult(y,f)),i.bindMatrix4("uProj",l),i.bindTexture("uVideoTexture",r.texture),s.draw(),requestAnimationFrame(t)}();case 23:case"end":return t.stop()}}),t,this)})),n=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(t){K(o,r,i,s,u,"next",t)}function u(t){K(o,r,i,s,u,"throw",t)}s(void 0)}))},function(t){return n.apply(this,arguments)})}]),i}(r.Canvas),ht=function(t){nt(n,t);var e=it(n);function n(){return J(this,n),e.apply(this,arguments)}return et(n,[{key:"canvasType",get:function(){return"video360"}},{key:"isCompatible",value:function(t){var e,r=this;return!(null===(e=t.canvas)||void 0===e||!e.find((function(t){return t==r.canvasType})))||$(st(n.prototype),"isCompatible",this).call(this,t)}},{key:"getCanvasInstance",value:function(t){return new at(this.player,t,this.config)}}]),n}(r.CanvasPlugin)},757:(t,e,n)=>{var r={"./WebGLPluginModule.js":323,"./es.upv.paella.video360Canvas.js":503};function i(t){var e=o(t);return n(e)}function o(t){if(!n.o(r,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}i.keys=function(){return Object.keys(r)},i.resolve=o,t.exports=i,i.id=757},995:e=>{"use strict";e.exports=t}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={exports:{}};return e[t](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";function t(){return r(757)}r.r(i),r.d(i,{Video360CanvasPlugin:()=>e,default:()=>t});var e=r(503).default})(),i})())); | ||
//# sourceMappingURL=paella-webgl-plugins.js.map |
{ | ||
"name": "paella-webgl-plugins", | ||
"version": "1.25.1", | ||
"version": "1.25.2", | ||
"description": "A plugin to zoom videos for Paella Player", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -156,4 +156,8 @@ import { CanvasPlugin, Canvas, createElementWithHtmlText } from 'paella-core'; | ||
const draw = () => { | ||
const w = canvas.clientWidth; | ||
const h = canvas.clientHeight; | ||
const fov = 45 * this.currentZoom; | ||
const projection = Mat4.MakePerspective(fov, 1.33, 0.01, 10.0); | ||
const aspectRatio = w / h; | ||
const projection = Mat4.MakePerspective(fov, isNaN(aspectRatio) ? 16/9 : aspectRatio, 0.01, 10.0); | ||
const view = Mat4.MakeIdentity(); | ||
@@ -164,4 +168,2 @@ const model = Mat4.MakeRotation(this._yaw, 0, 1, 0); | ||
videoTexture.updateTexture(); | ||
const w = canvas.clientWidth; | ||
const h = canvas.clientHeight; | ||
canvas.width = w; | ||
@@ -168,0 +170,0 @@ canvas.height = h; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
464069
2975