Naloga 3 WIP
This commit is contained in:
51 files changed
+3327
-28
No files matched your search
@@ -0,0 +1,22 @@
|
||||
function xe(n){if(n&&!(typeof window>"u")){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=n,document.head.appendChild(e),n}}function B(n,e){var t=n.__state.conversionName.toString(),i=Math.round(n.r),o=Math.round(n.g),r=Math.round(n.b),d=n.a,l=Math.round(n.h),u=n.s.toFixed(1),f=n.v.toFixed(1);if(e||t==="THREE_CHAR_HEX"||t==="SIX_CHAR_HEX"){for(var m=n.hex.toString(16);m.length<6;)m="0"+m;return"#"+m}else{if(t==="CSS_RGB")return"rgb("+i+","+o+","+r+")";if(t==="CSS_RGBA")return"rgba("+i+","+o+","+r+","+d+")";if(t==="HEX")return"0x"+n.hex.toString(16);if(t==="RGB_ARRAY")return"["+i+","+o+","+r+"]";if(t==="RGBA_ARRAY")return"["+i+","+o+","+r+","+d+"]";if(t==="RGB_OBJ")return"{r:"+i+",g:"+o+",b:"+r+"}";if(t==="RGBA_OBJ")return"{r:"+i+",g:"+o+",b:"+r+",a:"+d+"}";if(t==="HSV_OBJ")return"{h:"+l+",s:"+u+",v:"+f+"}";if(t==="HSVA_OBJ")return"{h:"+l+",s:"+u+",v:"+f+",a:"+d+"}"}return"unknown format"}var re=Array.prototype.forEach,H=Array.prototype.slice,s={BREAK:{},extend:function(e){return this.each(H.call(arguments,1),function(t){var i=this.isObject(t)?Object.keys(t):[];i.forEach(function(o){this.isUndefined(t[o])||(e[o]=t[o])}.bind(this))},this),e},defaults:function(e){return this.each(H.call(arguments,1),function(t){var i=this.isObject(t)?Object.keys(t):[];i.forEach(function(o){this.isUndefined(e[o])&&(e[o]=t[o])}.bind(this))},this),e},compose:function(){var e=H.call(arguments);return function(){for(var t=H.call(arguments),i=e.length-1;i>=0;i--)t=[e[i].apply(this,t)];return t[0]}},each:function(e,t,i){if(e){if(re&&e.forEach&&e.forEach===re)e.forEach(t,i);else if(e.length===e.length+0){var o=void 0,r=void 0;for(o=0,r=e.length;o<r;o++)if(o in e&&t.call(i,e[o],o)===this.BREAK)return}else for(var d in e)if(t.call(i,e[d],d)===this.BREAK)return}},defer:function(e){setTimeout(e,0)},debounce:function(e,t,i){var o=void 0;return function(){var r=this,d=arguments;function l(){o=null,i||e.apply(r,d)}var u=i||!o;clearTimeout(o),o=setTimeout(l,t),u&&e.apply(r,d)}},toArray:function(e){return e.toArray?e.toArray():H.call(e)},isUndefined:function(e){return e===void 0},isNull:function(e){return e===null},isNaN:function(n){function e(t){return n.apply(this,arguments)}return e.toString=function(){return n.toString()},e}(function(n){return isNaN(n)}),isArray:Array.isArray||function(n){return n.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return e===!1||e===!0},isFunction:function(e){return e instanceof Function}},Ce=[{litmus:s.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return t===null?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:B},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return t===null?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:B},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t===null?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:B},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return t===null?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:B}}},{litmus:s.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:s.isArray,conversions:{RGB_ARRAY:{read:function(e){return e.length!==3?!1:{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return e.length!==4?!1:{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:s.isObject,conversions:{RGBA_OBJ:{read:function(e){return s.isNumber(e.r)&&s.isNumber(e.g)&&s.isNumber(e.b)&&s.isNumber(e.a)?{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return s.isNumber(e.r)&&s.isNumber(e.g)&&s.isNumber(e.b)?{space:"RGB",r:e.r,g:e.g,b:e.b}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return s.isNumber(e.h)&&s.isNumber(e.s)&&s.isNumber(e.v)&&s.isNumber(e.a)?{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return s.isNumber(e.h)&&s.isNumber(e.s)&&s.isNumber(e.v)?{space:"HSV",h:e.h,s:e.s,v:e.v}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],D=void 0,G=void 0,X=function(){G=!1;var e=arguments.length>1?s.toArray(arguments):arguments[0];return s.each(Ce,function(t){if(t.litmus(e))return s.each(t.conversions,function(i,o){if(D=i.read(e),G===!1&&D!==!1)return G=D,D.conversionName=o,D.conversion=i,s.BREAK}),s.BREAK}),G},ae=void 0,M={hsv_to_rgb:function(e,t,i){var o=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),d=i*(1-t),l=i*(1Line truncated
|
||||
|
||||
Here's the new load parameter for your <code>GUI</code>'s constructor:
|
||||
|
||||
<textarea id="dg-new-constructor"></textarea>
|
||||
|
||||
<div id="dg-save-locally">
|
||||
|
||||
<input id="dg-local-storage" type="checkbox"/> Automatically save
|
||||
values to <code>localStorage</code> on exit.
|
||||
|
||||
<div id="dg-local-explain">The values saved to <code>localStorage</code> will
|
||||
override those passed to <code>dat.GUI</code>'s constructor. This makes it
|
||||
easier to work incrementally, but <code>localStorage</code> is fragile,
|
||||
and your friends may not see the same values you do.
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>`,Be=function(e,t){var i=e[t];return s.isArray(arguments[2])||s.isObject(arguments[2])?new ge(e,t,arguments[2]):s.isNumber(i)?s.isNumber(arguments[2])&&s.isNumber(arguments[3])?s.isNumber(arguments[4])?new j(e,t,arguments[2],arguments[3],arguments[4]):new j(e,t,arguments[2],arguments[3]):s.isNumber(arguments[4])?new z(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new z(e,t,{min:arguments[2],max:arguments[3]}):s.isString(i)?new be(e,t):s.isFunction(i)?new ie(e,t,""):s.isBoolean(i)?new te(e,t):null};function Ne(n){setTimeout(n,1e3/60)}var Fe=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||Ne,He=function(){function n(){w(this,n),this.backgroundElement=document.createElement("div"),s.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),a.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),s.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;a.bind(this.backgroundElement,"click",function(){e.hide()})}return x(n,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),s.defer(function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var t=this,i=function o(){t.domElement.style.display="none",t.backgroundElement.style.display="none",a.unbind(t.domElement,"webkitTransitionEnd",o),a.unbind(t.domElement,"transitionend",o),a.unbind(t.domElement,"oTransitionEnd",o)};a.bind(this.domElement,"webkitTransitionEnd",i),a.bind(this.domElement,"transitionend",i),a.bind(this.domElement,"oTransitionEnd",i),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-a.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-a.getHeight(this.domElement)/2+"px"}}]),n}(),De=xe(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100Line truncated
|
||||
`);Re.inject(De);var ue="dg",ce=72,fe=20,U="Default",P=function(){try{return!!window.localStorage}catch{return!1}}(),V=void 0,_e=!0,R=void 0,W=!1,ve=[],p=function n(e){var t=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),a.addClass(this.domElement,ue),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=s.defaults(i,{closeOnTop:!1,autoPlace:!0,width:n.DEFAULT_WIDTH}),i=s.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),s.isUndefined(i.load)?i.load={preset:U}:i.preset&&(i.load.preset=i.preset),s.isUndefined(i.parent)&&i.hideable&&ve.push(this),i.resizable=s.isUndefined(i.parent)&&i.resizable,i.autoPlace&&s.isUndefined(i.scrollable)&&(i.scrollable=!0);var o=P&&localStorage.getItem(L(this,"isLocal"))==="true",r=void 0,d=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return t.parent?t.getRoot().preset:i.load.preset},set:function(h){t.parent?t.getRoot().preset=h:i.load.preset=h,Me(this),t.revert()}},width:{get:function(){return i.width},set:function(h){i.width=h,q(t,h)}},name:{get:function(){return i.name},set:function(h){i.name=h,d&&(d.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(h){i.closed=h,i.closed?a.addClass(t.__ul,n.CLASS_CLOSED):a.removeClass(t.__ul,n.CLASS_CLOSED),this.onResize(),t.__closeButton&&(t.__closeButton.innerHTML=h?n.TEXT_OPEN:n.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(h){P&&(o=h,h?a.bind(window,"unload",r):a.unbind(window,"unload",r),localStorage.setItem(L(t,"isLocal"),h))}}}),s.isUndefined(i.parent)){if(this.closed=i.closed||!1,a.addClass(this.domElement,n.CLASS_MAIN),a.makeSelectable(this.domElement,!1),P&&o){t.useLocalStorage=!0;var l=localStorage.getItem(L(this,"gui"));l&&(i.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=n.TEXT_CLOSED,a.addClass(this.__closeButton,n.CLASS_CLOSE_BUTTON),i.closeOnTop?(a.addClass(this.__closeButton,n.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(a.addClass(this.__closeButton,n.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),a.bind(this.__closeButton,"click",function(){t.closed=!t.closed})}else{i.closed===void 0&&(i.closed=!0);var u=document.createTextNode(i.name);a.addClass(u,"controller-name"),d=oe(t,u);var f=function(h){return h.preventDefault(),t.closed=!t.closed,!1};a.addClass(this.__ul,n.CLASS_CLOSED),a.addClass(d,"title"),a.bind(d,"click",f),i.closed||(this.closed=!1)}i.autoPlace&&(s.isUndefined(i.parent)&&(_e&&(R=document.createElement("div"),a.addClass(R,ue),a.addClass(R,n.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(R),_e=!1),R.appendChild(this.domElement),a.addClass(this.domElement,n.CLASS_AUTO_PLACE)),this.parent||q(t,i.width)),this.__resizeHandler=function(){t.onResizeDebounced()},a.bind(window,"resize",this.__resizeHandler),a.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),a.bind(this.__ul,"transitionend",this.__resizeHandler),a.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&Ie(this),r=function(){P&&localStorage.getItem(L(t,"isLocal"))==="true"&&localStorage.setItem(L(t,"gui"),JSON.stringify(t.getSaveObject()))},this.saveToLocalStorageIfPossible=r;function m(){var c=t.getRoot();c.width+=1,s.defer(function(){c.width-=1})}i.parent||m()};p.toggleHide=function(){W=!W,s.each(ve,function(n){n.domElement.style.display=W?"none":""})};p.CLASS_AUTO_PLACE="a";p.CLASS_AUTO_PLACE_CONTAINER="ac";p.CLASS_MAIN="main";p.CLASS_CONTROLLER_ROW="cr";p.CLASS_TOO_TALL="taller-than-window";p.CLASS_CLOSED="closed";p.CLASS_CLOSE_BUTTON="close-button";p.CLASS_CLOSE_TOP="close-top";p.CLASS_CLOSE_BOTTOM="close-bottom";p.CLASS_DRAG="drag";p.DEFAULT_WIDTH=245;p.TEXT_CLOSED="Close Controls";p.TEXT_OPEN="Open Controls";p._keydownHandler=function(n){document.activeElement.type!=="text"&&(n.which===ce||n.keyCode===ce)&&p.toggleHide()};a.bind(window,"keydown",p._keydownHandler,!1);s.extend(p.prototype,{add:function(e,t){return I(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return I(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;s.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&R.removeChild(this.domElement);var e=this;s.each(this.__folders,function(t){e.removeFolder(t)}),a.unbind(window,"keydown",p._keydownHandler,!1),he(this)},addFolder:func
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
var u="zyx",we=Math.PI/180,pe=180/Math.PI;var _=new Float32Array([1,0,0,1]),j=class h extends Float32Array{static BYTE_LENGTH=4*Float32Array.BYTES_PER_ELEMENT;constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break;default:super(_);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(_),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}transpose(){return h.transpose(this,this)}invert(){return h.invert(this,this)}scale(e){return h.scale(this,this,e)}rotate(e){return h.rotate(this,this,e)}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new h(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],r=t[1],a=t[2],s=t[3],i=n*s-a*r;return i?(i=1/i,e[0]=s*i,e[1]=-r*i,e[2]=-a*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let r=t[0],a=t[1],s=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=r*c+s*y,e[1]=a*c+i*y,e[2]=r*L+s*k,e[3]=a*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let r=t[0],a=t[1],s=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=r*y+s*c,e[1]=a*y+i*c,e[2]=r*-c+s*y,e[3]=a*-c+i*y,e}static scale(e,t,n){let r=t[0],a=t[1],s=t[2],i=t[3],c=n[0],y=n[1];return e[0]=r*c,e[1]=a*c,e[2]=s*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=-n,e[3]=r,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e}static LDU(e,t,n,r){return e[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],r=e[1],a=e[2],s=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(a-y)<=1e-6*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))}static str(e){return`Mat2(${e.join(", ")})`}};j.prototype.mul=j.prototype.multiply;j.mul=j.multiply;j.sub=j.subtract;var ye=j;var ee=new Float32Array([1,0,0,1,0,0]),C=class h extends Float32Array{static BYTE_LENGTH=6*Float32Array.BYTES_PER_ELEMENT;constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(ee);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(ee),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}translate(e){return h.translate(this,this,e)}rotate(e){return h.rotate(this,this,e)}scale(e){return h.scale(this,this,e)}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}static fromValues(...e){return new h(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],r=t[1],a=t[2],s=t[3],i=t[4],c=t[5],y=n*s-r*a;return y?(y=1/y,e[0]=s*y,e[1]=-r*y,e[2]=-a*y,e[3]=n*y,e[4]=(a*c-s*i)*y,e[5]=(r*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let r=t[0],a=t[1],s=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],b=n[3],M=n[4],d=n[5];return e[0]=r*L+s*k,e[1]=a*L+i*k,e[2]=r*l+s*b,e[3]=a*l+i*b,e[4]=r*M+s*d+c,e[5]=a*M+i*d+y,e}static mul(e,t,n){return e}static translate(e,t,n){let r=t[0],a=t[1],s=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=r,e[1]=a,e[2]=s,e[3]=i,e[4]=r*L+s*k+c,e[5]=a*L+i*k+y,e}static rotate(e,t,n){let r=t[0],a=t[1],s=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=r*k+s*L,e[1]=a*k+i*L,e[2]=r*-L+s*k,e[3]=a*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let r=Line truncated
|
||||
Reference in new issue
Block a user