(function webpackUniversalModuleDefinition(root, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if (typeof define === 'function' && define.amd) define([], factory); else if (typeof exports === 'object') exports['deck'] = factory(); else root['deck'] = factory();})(globalThis, function () { "use strict";var __exports__=(()=>{var Mi=Object.create;var ee=Object.defineProperty;var Ci=Object.getOwnPropertyDescriptor;var Ei=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,Ti=Object.prototype.hasOwnProperty;var He=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),N=(e,t)=>{for(var n in t)ee(e,n,{get:t[n],enumerable:!0})},te=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ei(t))!Ti.call(e,s)&&s!==n&&ee(e,s,{get:()=>t[s],enumerable:!(r=Ci(t,s))||r.enumerable});return e},tt=(e,t,n)=>(te(e,t,"default"),n&&te(n,t,"default")),F=(e,t,n)=>(n=e!=null?Mi(_i(e)):{},te(t||!e||!e.__esModule?ee(n,"default",{value:e,enumerable:!0}):n,e)),yi=e=>te(ee({},"__esModule",{value:!0}),e);var At=He((Ul,or)=>{or.exports=globalThis.deck});var pt=He((Jl,cr)=>{cr.exports=globalThis.luma});var Dt=He((Kl,ar)=>{ar.exports=globalThis.luma});var $t={};N($t,{ScenegraphLayer:()=>xi,SimpleMeshLayer:()=>Ss});var j={},ir=F(At(),1);tt(j,F(At(),1));if(!ir.Layer)throw new Error("@deck.gl/core is not found");tt($t,j);var nt=F(At(),1),Is=F(pt(),1),Bt=F(Dt(),1);var Xl=1/Math.PI*180,Vl=1/180*Math.PI,bi={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...bi}};var R=globalThis.mathgl.config;function fr(e,{precision:t=R.precision}={}){return e=Ri(e),`${parseFloat(e.toPrecision(t))}`}function mt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Je(e,t,n){let r=R.EPSILON;n&&(R.EPSILON=n);try{if(e===t)return!0;if(mt(e)&&mt(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Je(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=R.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{R.EPSILON=r}}function Ri(e){return Math.round(e/R.EPSILON)*R.EPSILON}var et=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:mt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(R)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+fr(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Je(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof n=="number"?n:n[s];this[s]=o+r*(i-o)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(R.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function Ii(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function y(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function dt(e,t,n=""){if(R.debug&&!Ii(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Ke(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var ne=class extends et{get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return y(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return y(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Ke(t>=0&&t<this.ELEMENTS,"index is out of range"),y(this[t])}setComponent(t,n){return Ke(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var S=typeof Float32Array<"u"?Float32Array:Array;var eh=Math.PI/180;function Si(){let e=new S(2);return S!=Float32Array&&(e[0]=0,e[1]=0),e}function Ar(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var nh=function(){let e=Si();return function(t,n,r,s,o,i){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],o(e,e,i),t[c]=e[0],t[c+1]=e[1];return t}}();function pr(e,t,n){let r=t[0],s=t[1],o=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/o,e[1]=(n[1]*r+n[5]*s)/o,e}function mr(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o||1;return e[0]=(n[0]*r+n[4]*s+n[8]*o)/i,e[1]=(n[1]*r+n[5]*s+n[9]*o)/i,e[2]=(n[2]*r+n[6]*s+n[10]*o)/i,e}function dr(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function ur(e,t,n){let r=t[0],s=t[1],o=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*o,e[1]=n[1]*r+n[4]*s+n[7]*o,e[2]=n[2]*r+n[5]*s+n[8]*o,e[3]=t[3],e}function Xe(){let e=new S(3);return S!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Li(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Ve(e,t,n){let r=new S(3);return r[0]=e,r[1]=t,r[2]=n,r}function gr(e,t){let n=t[0],r=t[1],s=t[2],o=n*n+r*r+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Br(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function re(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2];return e[0]=s*a-o*c,e[1]=o*i-r*a,e[2]=r*c-s*i,e}function se(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*s+n[8]*o+n[12])/i,e[1]=(n[1]*r+n[5]*s+n[9]*o+n[13])/i,e[2]=(n[2]*r+n[6]*s+n[10]*o+n[14])/i,e}function xr(e,t,n){let r=n[0],s=n[1],o=n[2],i=n[3],c=t[0],a=t[1],f=t[2],l=s*f-o*a,h=o*c-r*f,A=r*a-s*c,p=s*A-o*h,m=o*l-r*A,d=r*h-s*l,u=i*2;return l*=u,h*=u,A*=u,p*=2,m*=2,d*=2,e[0]=c+l+p,e[1]=a+h+m,e[2]=f+A+d,e}var Mr=Li;var oh=function(){let e=Xe();return function(t,n,r,s,o,i){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var oe,ut=class extends ne{static get ZERO(){return oe||(oe=new ut(0,0,0,0),Object.freeze(oe)),oe}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),mt(t)&&arguments.length===1?this.copy(t):(R.debug&&(y(t),y(n),y(r),y(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return R.debug&&(y(t.x),y(t.y),y(t.z),y(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}transform(t){return se(this,this,t),this.check()}transformByMatrix3(t){return ur(this,this,t),this.check()}transformByMatrix2(t){return dr(this,this,t),this.check()}transformByQuaternion(t){return xr(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var ie=class extends et{toString(){let t="[";if(R.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=y(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function Cr(){let e=new S(9);return S!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Oi(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Er(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],o=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=s,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function _r(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=t[4],c=t[5],a=t[6],f=t[7],l=t[8],h=t[9],A=t[10],p=t[11],m=t[12],d=t[13],u=t[14],B=t[15],E=n*c-r*i,g=n*a-s*i,x=n*f-o*i,M=r*a-s*c,C=r*f-o*c,O=s*f-o*a,G=l*d-h*m,v=l*u-A*m,P=l*B-p*m,J=h*u-A*d,K=h*B-p*d,X=A*B-p*u,T=E*X-g*K+x*J+M*P-C*v+O*G;return T?(T=1/T,e[0]=(c*X-a*K+f*J)*T,e[1]=(s*K-r*X-o*J)*T,e[2]=(d*O-u*C+B*M)*T,e[3]=(A*C-h*O-p*M)*T,e[4]=(a*P-i*X-f*v)*T,e[5]=(n*X-s*P+o*v)*T,e[6]=(u*x-m*O-B*g)*T,e[7]=(l*O-A*x+p*g)*T,e[8]=(i*K-c*P+f*G)*T,e[9]=(r*P-n*K-o*G)*T,e[10]=(m*C-d*x+B*E)*T,e[11]=(h*x-l*C-p*E)*T,e[12]=(c*v-i*J-a*G)*T,e[13]=(n*J-r*v+s*G)*T,e[14]=(d*g-m*M-u*E)*T,e[15]=(l*M-h*g+A*E)*T,e):null}function Tr(e){let t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],i=e[5],c=e[6],a=e[7],f=e[8],l=e[9],h=e[10],A=e[11],p=e[12],m=e[13],d=e[14],u=e[15],B=t*i-n*o,E=t*c-r*o,g=n*c-r*i,x=f*m-l*p,M=f*d-h*p,C=l*d-h*m,O=t*C-n*M+r*x,G=o*C-i*M+c*x,v=f*g-l*E+h*B,P=p*g-m*E+d*B;return a*O-s*G+u*v-A*P}function je(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],A=t[9],p=t[10],m=t[11],d=t[12],u=t[13],B=t[14],E=t[15],g=n[0],x=n[1],M=n[2],C=n[3];return e[0]=g*r+x*c+M*h+C*d,e[1]=g*s+x*a+M*A+C*u,e[2]=g*o+x*f+M*p+C*B,e[3]=g*i+x*l+M*m+C*E,g=n[4],x=n[5],M=n[6],C=n[7],e[4]=g*r+x*c+M*h+C*d,e[5]=g*s+x*a+M*A+C*u,e[6]=g*o+x*f+M*p+C*B,e[7]=g*i+x*l+M*m+C*E,g=n[8],x=n[9],M=n[10],C=n[11],e[8]=g*r+x*c+M*h+C*d,e[9]=g*s+x*a+M*A+C*u,e[10]=g*o+x*f+M*p+C*B,e[11]=g*i+x*l+M*m+C*E,g=n[12],x=n[13],M=n[14],C=n[15],e[12]=g*r+x*c+M*h+C*d,e[13]=g*s+x*a+M*A+C*u,e[14]=g*o+x*f+M*p+C*B,e[15]=g*i+x*l+M*m+C*E,e}function yr(e,t,n){let r=n[0],s=n[1],o=n[2],i,c,a,f,l,h,A,p,m,d,u,B;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*o+t[12],e[13]=t[1]*r+t[5]*s+t[9]*o+t[13],e[14]=t[2]*r+t[6]*s+t[10]*o+t[14],e[15]=t[3]*r+t[7]*s+t[11]*o+t[15]):(i=t[0],c=t[1],a=t[2],f=t[3],l=t[4],h=t[5],A=t[6],p=t[7],m=t[8],d=t[9],u=t[10],B=t[11],e[0]=i,e[1]=c,e[2]=a,e[3]=f,e[4]=l,e[5]=h,e[6]=A,e[7]=p,e[8]=m,e[9]=d,e[10]=u,e[11]=B,e[12]=i*r+l*s+m*o+t[12],e[13]=c*r+h*s+d*o+t[13],e[14]=a*r+A*s+u*o+t[14],e[15]=f*r+p*s+B*o+t[15]),e}function br(e,t,n){let r=n[0],s=n[1],o=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Rr(e,t,n,r){let s=r[0],o=r[1],i=r[2],c=Math.sqrt(s*s+o*o+i*i),a,f,l,h,A,p,m,d,u,B,E,g,x,M,C,O,G,v,P,J,K,X,T,Ft;return c<1e-6?null:(c=1/c,s*=c,o*=c,i*=c,f=Math.sin(n),a=Math.cos(n),l=1-a,h=t[0],A=t[1],p=t[2],m=t[3],d=t[4],u=t[5],B=t[6],E=t[7],g=t[8],x=t[9],M=t[10],C=t[11],O=s*s*l+a,G=o*s*l+i*f,v=i*s*l-o*f,P=s*o*l-i*f,J=o*o*l+a,K=i*o*l+s*f,X=s*i*l+o*f,T=o*i*l-s*f,Ft=i*i*l+a,e[0]=h*O+d*G+g*v,e[1]=A*O+u*G+x*v,e[2]=p*O+B*G+M*v,e[3]=m*O+E*G+C*v,e[4]=h*P+d*J+g*K,e[5]=A*P+u*J+x*K,e[6]=p*P+B*J+M*K,e[7]=m*P+E*J+C*K,e[8]=h*X+d*T+g*Ft,e[9]=A*X+u*T+x*Ft,e[10]=p*X+B*T+M*Ft,e[11]=m*X+E*T+C*Ft,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Ir(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[4],i=t[5],c=t[6],a=t[7],f=t[8],l=t[9],h=t[10],A=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*s+f*r,e[5]=i*s+l*r,e[6]=c*s+h*r,e[7]=a*s+A*r,e[8]=f*s-o*r,e[9]=l*s-i*r,e[10]=h*s-c*r,e[11]=A*s-a*r,e}function Sr(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[8],l=t[9],h=t[10],A=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s-f*r,e[1]=i*s-l*r,e[2]=c*s-h*r,e[3]=a*s-A*r,e[8]=o*r+f*s,e[9]=i*r+l*s,e[10]=c*r+h*s,e[11]=a*r+A*s,e}function Lr(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[4],l=t[5],h=t[6],A=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s+f*r,e[1]=i*s+l*r,e[2]=c*s+h*r,e[3]=a*s+A*r,e[4]=f*s-o*r,e[5]=l*s-i*r,e[6]=h*s-c*r,e[7]=A*s-a*r,e}function Fr(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n+n,c=r+r,a=s+s,f=n*i,l=r*i,h=r*c,A=s*i,p=s*c,m=s*a,d=o*i,u=o*c,B=o*a;return e[0]=1-h-m,e[1]=l+B,e[2]=A-u,e[3]=0,e[4]=l-B,e[5]=1-f-m,e[6]=p+d,e[7]=0,e[8]=A+u,e[9]=p-d,e[10]=1-f-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Dr(e,t,n,r,s,o,i){let c=1/(n-t),a=1/(s-r),f=1/(o-i);return e[0]=o*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(i+o)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*o*2*f,e[15]=0,e}function Gi(e,t,n,r,s){let o=1/Math.tan(t/2);if(e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let i=1/(r-s);e[10]=(s+r)*i,e[14]=2*s*r*i}else e[10]=-1,e[14]=-2*r;return e}var Or=Gi;function vi(e,t,n,r,s,o,i){let c=1/(t-n),a=1/(r-s),f=1/(o-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*f,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(i+o)*f,e[15]=1,e}var Gr=vi;function vr(e,t,n,r){let s,o,i,c,a,f,l,h,A,p,m=t[0],d=t[1],u=t[2],B=r[0],E=r[1],g=r[2],x=n[0],M=n[1],C=n[2];return Math.abs(m-x)<1e-6&&Math.abs(d-M)<1e-6&&Math.abs(u-C)<1e-6?Oi(e):(h=m-x,A=d-M,p=u-C,s=1/Math.sqrt(h*h+A*A+p*p),h*=s,A*=s,p*=s,o=E*p-g*A,i=g*h-B*p,c=B*A-E*h,s=Math.sqrt(o*o+i*i+c*c),s?(s=1/s,o*=s,i*=s,c*=s):(o=0,i=0,c=0),a=A*c-p*i,f=p*o-h*c,l=h*i-A*o,s=Math.sqrt(a*a+f*f+l*l),s?(s=1/s,a*=s,f*=s,l*=s):(a=0,f=0,l=0),e[0]=o,e[1]=a,e[2]=h,e[3]=0,e[4]=i,e[5]=f,e[6]=A,e[7]=0,e[8]=c,e[9]=l,e[10]=p,e[11]=0,e[12]=-(o*m+i*d+c*u),e[13]=-(a*m+f*d+l*u),e[14]=-(h*m+A*d+p*u),e[15]=1,e)}function Pi(){let e=new S(4);return S!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Pr(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}function wr(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}function Nr(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Ur(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Hr(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=r*i,e[2]=s*i,e[3]=o*i,e}function Jr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Kr(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=o+r*(n[1]-o),e[2]=i+r*(n[2]-i),e[3]=c+r*(n[3]-c),e}function Xr(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*o+n[12]*i,e[1]=n[1]*r+n[5]*s+n[9]*o+n[13]*i,e[2]=n[2]*r+n[6]*s+n[10]*o+n[14]*i,e[3]=n[3]*r+n[7]*s+n[11]*o+n[15]*i,e}function Vr(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2],f=n[3],l=f*r+c*o-a*s,h=f*s+a*r-i*o,A=f*o+i*s-c*r,p=-i*r-c*s-a*o;return e[0]=l*f+p*-i+h*-a-A*-c,e[1]=h*f+p*-c+A*-i-l*-a,e[2]=A*f+p*-a+l*-c-h*-i,e[3]=t[3],e}var gh=function(){let e=Pi();return function(t,n,r,s,o,i){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var ze;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(ze||(ze={}));var Ni=45*Math.PI/180,Ui=1,ke=.1,Ye=500,Hi=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Z=class extends ie{static get IDENTITY(){return Ki()}static get ZERO(){return Ji()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ze}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return 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.check()}set(t,n,r,s,o,i,c,a,f,l,h,A,p,m,d,u){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=o,this[5]=i,this[6]=c,this[7]=a,this[8]=f,this[9]=l,this[10]=h,this[11]=A,this[12]=p,this[13]=m,this[14]=d,this[15]=u,this.check()}setRowMajor(t,n,r,s,o,i,c,a,f,l,h,A,p,m,d,u){return this[0]=t,this[1]=o,this[2]=f,this[3]=p,this[4]=n,this[5]=i,this[6]=l,this[7]=m,this[8]=r,this[9]=c,this[10]=h,this[11]=d,this[12]=s,this[13]=a,this[14]=A,this[15]=u,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(Hi)}fromObject(t){return this.check()}fromQuaternion(t){return Fr(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:o,near:i=ke,far:c=Ye}=t;return c===1/0?Xi(this,n,r,s,o,i):Dr(this,n,r,s,o,i,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return vr(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:o,near:i=ke,far:c=Ye}=t;return Gr(this,n,r,s,o,i,c),this.check()}orthographic(t){let{fovy:n=Ni,aspect:r=Ui,focalDistance:s=1,near:o=ke,far:i=Ye}=t;jr(n);let c=n/2,a=s*Math.tan(c),f=a*r;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:o,far:i})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:o=500}=t;return jr(n),Or(this,n,r,s,o),this.check()}determinant(){return Tr(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*o,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*o,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=this[4]*s,t[4]=this[5]*o,t[5]=this[6]*i,t[6]=this[8]*s,t[7]=this[9]*o,t[8]=this[10]*i,t}transpose(){return Er(this,this),this.check()}invert(){return _r(this,this),this.check()}multiplyLeft(t){return je(this,t,this),this.check()}multiplyRight(t){return je(this,this,t),this.check()}rotateX(t){return Ir(this,this,t),this.check()}rotateY(t){return Sr(this,this,t),this.check()}rotateZ(t){return Lr(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Rr(this,this,t,n),this.check()}scale(t){return br(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return yr(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Xr(n||[-0,-0,-0,-0],t,this),dt(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=Ar(n||[-0,-0],t,this);break;case 3:s=se(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return dt(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=pr(n||[-0,-0],t,this);break;case 3:r=mr(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return dt(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},ce,ae;function Ji(){return ce||(ce=new Z([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(ce)),ce}function Ki(){return ae||(ae=new Z,Object.freeze(ae)),ae}function jr(e){if(e>Math.PI*2)throw Error("expected radians")}function Xi(e,t,n,r,s,o){let i=2*o/(n-t),c=2*o/(s-r),a=(n+t)/(n-t),f=(s+r)/(s-r),l=-1,h=-1,A=-2*o;return e[0]=i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=f,e[10]=l,e[11]=h,e[12]=0,e[13]=0,e[14]=A,e[15]=0,e}function kr(){let e=new S(4);return S!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Yr(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Qe(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function We(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=n[0],a=n[1],f=n[2],l=n[3];return e[0]=r*l+i*c+s*f-o*a,e[1]=s*l+i*a+o*c-r*f,e[2]=o*l+i*f+r*a-s*c,e[3]=i*l-r*c-s*a-o*f,e}function zr(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+i*c,e[1]=s*a+o*c,e[2]=o*a-s*c,e[3]=i*a-r*c,e}function Qr(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-o*c,e[1]=s*a+i*c,e[2]=o*a+r*c,e[3]=i*a-s*c,e}function Wr(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=o*a+i*c,e[3]=i*a-o*c,e}function qr(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Gt(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3],a=n[0],f=n[1],l=n[2],h=n[3],A,p,m,d,u;return A=s*a+o*f+i*l+c*h,A<0&&(A=-A,a=-a,f=-f,l=-l,h=-h),1-A>1e-6?(p=Math.acos(A),u=Math.sin(p),m=Math.sin((1-r)*p)/u,d=Math.sin(r*p)/u):(m=1-r,d=r),e[0]=m*s+d*a,e[1]=m*o+d*f,e[2]=m*i+d*l,e[3]=m*c+d*h,e}function Zr(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o,c=i?1/i:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=o*c,e}function $r(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function qe(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*r,r=.5/r,e[3]=(t[o*3+i]-t[i*3+o])*r,e[o]=(t[o*3+s]+t[s*3+o])*r,e[i]=(t[i*3+s]+t[s*3+i])*r}return e}var ts=Pr;var es=wr,ns=Jr,rs=Kr,ss=Nr;var os=Ur;var is=Hr;var cs=function(){let e=Xe(),t=Ve(1,0,0),n=Ve(0,1,0);return function(r,s,o){let i=Br(s,o);return i<-.999999?(re(e,t,s),Mr(e)<1e-6&&re(e,n,s),gr(e,e),Qe(r,e,Math.PI),r):i>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(re(e,s,o),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+i,is(r,r))}}(),Fh=function(){let e=kr(),t=kr();return function(n,r,s,o,i,c){return Gt(e,r,i,c),Gt(t,s,o,c),Gt(n,e,t,2*c*(1-c)),n}}(),Dh=function(){let e=Cr();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],is(t,qe(t,e))}}();var Vi=[0,0,0,1],vt=class extends et{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return qe(this,t),this.check()}fromAxisRotation(t,n){return Qe(this,t,n),this.check()}identity(){return Yr(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}len(){return ss(this)}lengthSquared(){return os(this)}dot(t){return ns(this,t)}rotationTo(t,n){return cs(this,t,n),this.check()}add(t){return ts(this,this,t),this.check()}calculateW(){return qr(this,this),this.check()}conjugate(){return $r(this,this),this.check()}invert(){return Zr(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(rs(this,t,n,r),this.check())}multiplyRight(t){return We(this,this,t),this.check()}multiplyLeft(t){return We(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return zr(this,this,t),this.check()}rotateY(t){return Qr(this,this,t),this.check()}rotateZ(t){return Wr(this,this,t),this.check()}scale(t){return es(this,this,t),this.check()}slerp(t,n,r){let s,o,i;switch(arguments.length){case 1:({start:s=Vi,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=n;break;default:s=t,o=n,i=r}return Gt(this,s,o,i),this.check()}transformVector4(t,n=new ut){return Vr(n,t,this),dt(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var fs=F(pt(),1);var Ze=`precision highp int; // #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) struct AmbientLight { vec3 color; }; struct PointLight { vec3 color; vec3 position; vec3 attenuation; // 2nd order x:Constant-y:Linear-z:Exponential }; struct DirectionalLight { vec3 color; vec3 direction; }; uniform lightingUniforms { int enabled; int lightType; int directionalLightCount; int pointLightCount; vec3 ambientColor; vec3 lightColor0; vec3 lightPosition0; vec3 lightDirection0; vec3 lightAttenuation0; vec3 lightColor1; vec3 lightPosition1; vec3 lightDirection1; vec3 lightAttenuation1; vec3 lightColor2; vec3 lightPosition2; vec3 lightDirection2; vec3 lightAttenuation2; } lighting; PointLight lighting_getPointLight(int index) { switch (index) { case 0: return PointLight(lighting.lightColor0, lighting.lightPosition0, lighting.lightAttenuation0); case 1: return PointLight(lighting.lightColor1, lighting.lightPosition1, lighting.lightAttenuation1); case 2: default: return PointLight(lighting.lightColor2, lighting.lightPosition2, lighting.lightAttenuation2); } } DirectionalLight lighting_getDirectionalLight(int index) { switch (index) { case 0: return DirectionalLight(lighting.lightColor0, lighting.lightDirection0); case 1: return DirectionalLight(lighting.lightColor1, lighting.lightDirection1); case 2: default: return DirectionalLight(lighting.lightColor2, lighting.lightDirection2); } } float getPointLightAttenuation(PointLight pointLight, float distance) { return pointLight.attenuation.x + pointLight.attenuation.y * distance + pointLight.attenuation.z * distance * distance; } // #endif `;var as=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) struct AmbientLight { color: vec3<f32>, }; struct PointLight { color: vec3<f32>, position: vec3<f32>, attenuation: vec3<f32>, // 2nd order x:Constant-y:Linear-z:Exponential }; struct DirectionalLight { color: vec3<f32>, direction: vec3<f32>, }; struct lightingUniforms { enabled: i32, poightCount: i32, directionalLightCount: i32, ambientColor: vec3<f32>, // TODO - support multiple lights by uncommenting arrays below lightType: i32, lightColor: vec3<f32>, lightDirection: vec3<f32>, lightPosition: vec3<f32>, lightAttenuation: vec3<f32>, // AmbientLight ambientLight; // PointLight pointLight[MAX_LIGHTS]; // DirectionalLight directionalLight[MAX_LIGHTS]; }; // Binding 0:1 is reserved for lighting (Note: could go into separate bind group as it is stable across draw calls) @binding(1) @group(0) var<uniform> lighting : lightingUniforms; fn lighting_getPointLight(index: i32) -> PointLight { return PointLight(lighting.lightColor, lighting.lightPosition, lighting.lightAttenuation); } fn lighting_getDirectionalLight(index: i32) -> DirectionalLight { return DirectionalLight(lighting.lightColor, lighting.lightDirection); } fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 { return pointLight.attenuation.x + pointLight.attenuation.y * distance + pointLight.attenuation.z * distance * distance; } `;var ls=3,ji=255,Pt;(function(e){e[e.POINT=0]="POINT",e[e.DIRECTIONAL=1]="DIRECTIONAL"})(Pt||(Pt={}));var ot={props:{},uniforms:{},name:"lighting",defines:{MAX_LIGHTS:ls},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientLightColor:"vec3<f32>",lightColor0:"vec3<f32>",lightPosition0:"vec3<f32>",lightDirection0:"vec3<f32>",lightAttenuation0:"vec3<f32>",lightColor1:"vec3<f32>",lightPosition1:"vec3<f32>",lightDirection1:"vec3<f32>",lightAttenuation1:"vec3<f32>",lightColor2:"vec3<f32>",lightPosition2:"vec3<f32>",lightDirection2:"vec3<f32>",lightAttenuation2:"vec3<f32>"},defaultUniforms:{enabled:1,lightType:Pt.POINT,directionalLightCount:0,pointLightCount:0,ambientLightColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0]},source:as,vs:Ze,fs:Ze,getUniforms:ki};function ki(e,t={}){if(e=e&&{...e},!e)return{...ot.defaultUniforms};e.lights&&(e={...e,...zi(e.lights),lights:void 0});let{ambientLight:n,pointLights:r,directionalLights:s}=e||{};if(!(n||r&&r.length>0||s&&s.length>0))return{...ot.defaultUniforms,enabled:0};let i={...ot.defaultUniforms,...t,...Yi({ambientLight:n,pointLights:r,directionalLights:s})};return e.enabled!==void 0&&(i.enabled=e.enabled?1:0),i}function Yi({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};r.ambientLightColor=$e(e);let s=0;for(let o of t){r.lightType=Pt.POINT;let i=s;r[`lightColor${i}`]=$e(o),r[`lightPosition${i}`]=o.position,r[`lightAttenuation${i}`]=o.attenuation||[1,0,0],s++}for(let o of n){r.lightType=Pt.DIRECTIONAL;let i=s;r[`lightColor${i}`]=$e(o),r[`lightDirection${i}`]=o.direction,s++}return s>ls&&fs.log.warn("MAX_LIGHTS exceeded")(),r.directionalLightCount=n.length,r.pointLightCount=t.length,r}function zi(e){let t={pointLights:[],directionalLights:[]};for(let n of e||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return t}function $e(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/ji)}var hs=`uniform phongMaterialUniforms { uniform float ambient; uniform float diffuse; uniform float shininess; uniform vec3 specularColor; } material; `,As=`uniform phongMaterialUniforms { uniform float ambient; uniform float diffuse; uniform float shininess; uniform vec3 specularColor; } material; vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) { vec3 halfway_direction = normalize(light_direction + view_direction); float lambertian = dot(light_direction, normal_worldspace); float specular = 0.0; if (lambertian > 0.0) { float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); specular = pow(specular_angle, material.shininess); } lambertian = max(lambertian, 0.0); return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color; } vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) { vec3 lightColor = surfaceColor; if (lighting.enabled == 0) { return lightColor; } vec3 view_direction = normalize(cameraPosition - position_worldspace); lightColor = material.ambient * surfaceColor * lighting.ambientColor; for (int i = 0; i < lighting.pointLightCount; i++) { PointLight pointLight = lighting_getPointLight(i); vec3 light_position_worldspace = pointLight.position; vec3 light_direction = normalize(light_position_worldspace - position_worldspace); float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace)); lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation); } int totalLights = min(MAX_LIGHTS, lighting.pointLightCount + lighting.directionalLightCount); for (int i = lighting.pointLightCount; i < totalLights; i++) { DirectionalLight directionalLight = lighting_getDirectionalLight(i); lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); } return lightColor; } `;var ps=`struct phongMaterialUniforms { ambient: f32, diffuse: f32, shininess: f32, specularColor: vec3<f32>, }; @binding(2) @group(0) var<uniform> material : phongMaterialUniforms; fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, view_direction: vec3<f32>, normal_worldspace: vec3<f32>, color: vec3<f32>) -> vec3<f32> { let halfway_direction: vec3<f32> = normalize(light_direction + view_direction); var lambertian: f32 = dot(light_direction, normal_worldspace); var specular: f32 = 0.0; if (lambertian > 0.0) { let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); specular = pow(specular_angle, material.shininess); } lambertian = max(lambertian, 0.0); return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color; } fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> { var lightColor: vec3<f32> = surfaceColor; if (lighting.enabled == 0) { return lightColor; } let view_direction: vec3<f32> = normalize(cameraPosition - position_worldspace); lightColor = material.ambient * surfaceColor * lighting.ambientColor; if (lighting.lightType == 0) { let pointLight: PointLight = lighting_getPointLight(0); let light_position_worldspace: vec3<f32> = pointLight.position; let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); } else if (lighting.lightType == 1) { var directionalLight: DirectionalLight = lighting_getDirectionalLight(0); lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); } return lightColor; /* for (int i = 0; i < MAX_LIGHTS; i++) { if (i >= lighting.pointLightCount) { break; } PointLight pointLight = lighting.pointLight[i]; vec3 light_position_worldspace = pointLight.position; vec3 light_direction = normalize(light_position_worldspace - position_worldspace); lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); } for (int i = 0; i < MAX_LIGHTS; i++) { if (i >= lighting.directionalLightCount) { break; } DirectionalLight directionalLight = lighting.directionalLight[i]; lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); } */ } fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32>{ var lightColor = vec3<f32>(0, 0, 0); let surfaceColor = vec3<f32>(0, 0, 0); if (lighting.enabled == 0) { let view_direction = normalize(cameraPosition - position_worldspace); switch (lighting.lightType) { case 0, default: { let pointLight: PointLight = lighting_getPointLight(0); let light_position_worldspace: vec3<f32> = pointLight.position; let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); } case 1: { let directionalLight: DirectionalLight = lighting_getDirectionalLight(0); lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); } } } return lightColor; } `;var fe={name:"phongMaterial",dependencies:[ot],source:ps,vs:hs,fs:As,defines:{LIGHTING_FRAGMENT:1},uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(e){let t={...e};return t.specularColor&&(t.specularColor=t.specularColor.map(n=>n/255)),{...fe.defaultUniforms,...t}}};var ms=`out vec3 pbr_vPosition; out vec2 pbr_vUV; #ifdef HAS_NORMALS # ifdef HAS_TANGENTS out mat3 pbr_vTBN; # else out vec3 pbr_vNormal; # endif #endif void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv) { vec4 pos = pbrProjection.modelMatrix * position; pbr_vPosition = vec3(pos.xyz) / pos.w; #ifdef HAS_NORMALS #ifdef HAS_TANGENTS vec3 normalW = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0))); vec3 tangentW = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0))); vec3 bitangentW = cross(normalW, tangentW) * tangent.w; pbr_vTBN = mat3(tangentW, bitangentW, normalW); #else // HAS_TANGENTS != 1 pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0))); #endif #endif #ifdef HAS_UV pbr_vUV = uv; #else pbr_vUV = vec2(0.,0.); #endif } `;var ds=`precision highp float; uniform pbrMaterialUniforms { // Material is unlit bool unlit; // Base color map bool baseColorMapEnabled; vec4 baseColorFactor; bool normalMapEnabled; float normalScale; // #ifdef HAS_NORMALMAP bool emissiveMapEnabled; vec3 emissiveFactor; // #ifdef HAS_EMISSIVEMAP vec2 metallicRoughnessValues; bool metallicRoughnessMapEnabled; bool occlusionMapEnabled; float occlusionStrength; // #ifdef HAS_OCCLUSIONMAP bool alphaCutoffEnabled; float alphaCutoff; // #ifdef ALPHA_CUTOFF // IBL bool IBLenabled; vec2 scaleIBLAmbient; // #ifdef USE_IBL // debugging flags used for shader output of intermediate PBR variables // #ifdef PBR_DEBUG vec4 scaleDiffBaseMR; vec4 scaleFGDSpec; // #endif } pbrMaterial; // Samplers #ifdef HAS_BASECOLORMAP uniform sampler2D pbr_baseColorSampler; #endif #ifdef HAS_NORMALMAP uniform sampler2D pbr_normalSampler; #endif #ifdef HAS_EMISSIVEMAP uniform sampler2D pbr_emissiveSampler; #endif #ifdef HAS_METALROUGHNESSMAP uniform sampler2D pbr_metallicRoughnessSampler; #endif #ifdef HAS_OCCLUSIONMAP uniform sampler2D pbr_occlusionSampler; #endif #ifdef USE_IBL uniform samplerCube pbr_diffuseEnvSampler; uniform samplerCube pbr_specularEnvSampler; uniform sampler2D pbr_brdfLUT; #endif // Inputs from vertex shader in vec3 pbr_vPosition; in vec2 pbr_vUV; #ifdef HAS_NORMALS #ifdef HAS_TANGENTS in mat3 pbr_vTBN; #else in vec3 pbr_vNormal; #endif #endif // Encapsulate the various inputs used by the various functions in the shading equation // We store values in this struct to simplify the integration of alternative implementations // of the shading terms, outlined in the Readme.MD Appendix. struct PBRInfo { float NdotL; // cos angle between normal and light direction float NdotV; // cos angle between normal and view direction float NdotH; // cos angle between normal and half vector float LdotH; // cos angle between light direction and half vector float VdotH; // cos angle between view direction and half vector float perceptualRoughness; // roughness value, as authored by the model creator (input to shader) float metalness; // metallic value at the surface vec3 reflectance0; // full reflectance color (normal incidence angle) vec3 reflectance90; // reflectance color at grazing angle float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2]) vec3 diffuseColor; // color contribution from diffuse lighting vec3 specularColor; // color contribution from specular lighting vec3 n; // normal at surface point vec3 v; // vector from surface point to camera }; const float M_PI = 3.141592653589793; const float c_MinRoughness = 0.04; vec4 SRGBtoLINEAR(vec4 srgbIn) { #ifdef MANUAL_SRGB #ifdef SRGB_FAST_APPROXIMATION vec3 linOut = pow(srgbIn.xyz,vec3(2.2)); #else // SRGB_FAST_APPROXIMATION vec3 bLess = step(vec3(0.04045),srgbIn.xyz); vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess ); #endif //SRGB_FAST_APPROXIMATION return vec4(linOut,srgbIn.w);; #else //MANUAL_SRGB return srgbIn; #endif //MANUAL_SRGB } // Find the normal for this fragment, pulling either from a predefined normal map // or from the interpolated mesh normal and tangent attributes. vec3 getNormal() { // Retrieve the tangent space matrix #ifndef HAS_TANGENTS vec3 pos_dx = dFdx(pbr_vPosition); vec3 pos_dy = dFdy(pbr_vPosition); vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0)); vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0)); vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t); #ifdef HAS_NORMALS vec3 ng = normalize(pbr_vNormal); #else vec3 ng = cross(pos_dx, pos_dy); #endif t = normalize(t - ng * dot(ng, t)); vec3 b = normalize(cross(ng, t)); mat3 tbn = mat3(t, b, ng); #else // HAS_TANGENTS mat3 tbn = pbr_vTBN; #endif #ifdef HAS_NORMALMAP vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb; n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0))); #else // The tbn matrix is linearly interpolated, so we need to re-normalize vec3 n = normalize(tbn[2].xyz); #endif return n; } // Calculation of the lighting contribution from an optional Image Based Light source. // Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1]. // See our README.md on Environment Maps [3] for additional discussion. #ifdef USE_IBL vec3 getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection) { float mipCount = 9.0; // resolution of 512x512 float lod = (pbrInfo.perceptualRoughness * mipCount); // retrieve a scale and bias to F0. See [1], Figure 3 vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT, vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb; vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb; #ifdef USE_TEX_LOD vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb; #else vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb; #endif vec3 diffuse = diffuseLight * pbrInfo.diffuseColor; vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y); // For presentation, this allows us to disable IBL terms diffuse *= pbrMaterial.scaleIBLAmbient.x; specular *= pbrMaterial.scaleIBLAmbient.y; return diffuse + specular; } #endif // Basic Lambertian diffuse // Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog // See also [1], Equation 1 vec3 diffuse(PBRInfo pbrInfo) { return pbrInfo.diffuseColor / M_PI; } // The following equation models the Fresnel reflectance term of the spec equation (aka F()) // Implementation of fresnel from [4], Equation 15 vec3 specularReflection(PBRInfo pbrInfo) { return pbrInfo.reflectance0 + (pbrInfo.reflectance90 - pbrInfo.reflectance0) * pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0); } // This calculates the specular geometric attenuation (aka G()), // where rougher material will reflect less light back to the viewer. // This implementation is based on [1] Equation 4, and we adopt their modifications to // alphaRoughness as input as originally proposed in [2]. float geometricOcclusion(PBRInfo pbrInfo) { float NdotL = pbrInfo.NdotL; float NdotV = pbrInfo.NdotV; float r = pbrInfo.alphaRoughness; float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL))); float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV))); return attenuationL * attenuationV; } // The following equation(s) model the distribution of microfacet normals across // the area being drawn (aka D()) // Implementation from "Average Irregularity Representation of a Roughened Surface // for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz // Follows the distribution function recommended in the SIGGRAPH 2013 course notes // from EPIC Games [1], Equation 3. float microfacetDistribution(PBRInfo pbrInfo) { float roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness; float f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0; return roughnessSq / (M_PI * f * f); } void PBRInfo_setAmbientLight(inout PBRInfo pbrInfo) { pbrInfo.NdotL = 1.0; pbrInfo.NdotH = 0.0; pbrInfo.LdotH = 0.0; pbrInfo.VdotH = 1.0; } void PBRInfo_setDirectionalLight(inout PBRInfo pbrInfo, vec3 lightDirection) { vec3 n = pbrInfo.n; vec3 v = pbrInfo.v; vec3 l = normalize(lightDirection); // Vector from surface point to light vec3 h = normalize(l+v); // Half vector between both l and v pbrInfo.NdotL = clamp(dot(n, l), 0.001, 1.0); pbrInfo.NdotH = clamp(dot(n, h), 0.0, 1.0); pbrInfo.LdotH = clamp(dot(l, h), 0.0, 1.0); pbrInfo.VdotH = clamp(dot(v, h), 0.0, 1.0); } void PBRInfo_setPointLight(inout PBRInfo pbrInfo, PointLight pointLight) { vec3 light_direction = normalize(pointLight.position - pbr_vPosition); PBRInfo_setDirectionalLight(pbrInfo, light_direction); } vec3 calculateFinalColor(PBRInfo pbrInfo, vec3 lightColor) { // Calculate the shading terms for the microfacet specular shading model vec3 F = specularReflection(pbrInfo); float G = geometricOcclusion(pbrInfo); float D = microfacetDistribution(pbrInfo); // Calculation of analytical lighting contribution vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInfo); vec3 specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV); // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law) return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib); } vec4 pbr_filterColor(vec4 colorUnused) { // The albedo may be defined from a base texture or a flat color #ifdef HAS_BASECOLORMAP vec4 baseColor = SRGBtoLINEAR(texture(pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor; #else vec4 baseColor = pbrMaterial.baseColorFactor; #endif #ifdef ALPHA_CUTOFF if (baseColor.a < pbrMaterial.alphaCutoff) { discard; } #endif vec3 color = vec3(0, 0, 0); if(pbrMaterial.unlit){ color.rgb = baseColor.rgb; } else{ // Metallic and Roughness material properties are packed together // In glTF, these factors can be specified by fixed scalar values // or from a metallic-roughness map float perceptualRoughness = pbrMaterial.metallicRoughnessValues.y; float metallic = pbrMaterial.metallicRoughnessValues.x; #ifdef HAS_METALROUGHNESSMAP // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel. // This layout intentionally reserves the 'r' channel for (optional) occlusion map data vec4 mrSample = texture(pbr_metallicRoughnessSampler, pbr_vUV); perceptualRoughness = mrSample.g * perceptualRoughness; metallic = mrSample.b * metallic; #endif perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0); metallic = clamp(metallic, 0.0, 1.0); // Roughness is authored as perceptual roughness; as is convention, // convert to material roughness by squaring the perceptual roughness [2]. float alphaRoughness = perceptualRoughness * perceptualRoughness; vec3 f0 = vec3(0.04); vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0); diffuseColor *= 1.0 - metallic; vec3 specularColor = mix(f0, baseColor.rgb, metallic); // Compute reflectance. float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b); // For typical incident reflectance range (between 4% to 100%) set the grazing // reflectance to 100% for typical fresnel effect. // For very low reflectance range on highly diffuse objects (below 4%), // incrementally reduce grazing reflecance to 0%. float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0); vec3 specularEnvironmentR0 = specularColor.rgb; vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90; vec3 n = getNormal(); // normal at surface point vec3 v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0); vec3 reflection = -normalize(reflect(v, n)); PBRInfo pbrInfo = PBRInfo( 0.0, // NdotL NdotV, 0.0, // NdotH 0.0, // LdotH 0.0, // VdotH perceptualRoughness, metallic, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, specularColor, n, v ); #ifdef USE_LIGHTS // Apply ambient light PBRInfo_setAmbientLight(pbrInfo); color += calculateFinalColor(pbrInfo, lighting.ambientColor); // Apply directional light for(int i = 0; i < lighting.directionalLightCount; i++) { if (i < lighting.directionalLightCount) { PBRInfo_setDirectionalLight(pbrInfo, lighting_getDirectionalLight(i).direction); color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color); } } // Apply point light for(int i = 0; i < lighting.pointLightCount; i++) { if (i < lighting.pointLightCount) { PBRInfo_setPointLight(pbrInfo, lighting_getPointLight(i)); float attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition)); color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation); } } #endif // Calculate lighting contribution from image based lighting source (IBL) #ifdef USE_IBL if (pbrMaterial.IBLenabled) { color += getIBLContribution(pbrInfo, n, reflection); } #endif // Apply optional PBR terms for additional (optional) shading #ifdef HAS_OCCLUSIONMAP if (pbrMaterial.occlusionMapEnabled) { float ao = texture(pbr_occlusionSampler, pbr_vUV).r; color = mix(color, color * ao, pbrMaterial.occlusionStrength); } #endif #ifdef HAS_EMISSIVEMAP if (pbrMaterial.emissiveMapEnabled) { vec3 emissive = SRGBtoLINEAR(texture(pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor; color += emissive; } #endif // This section uses mix to override final color for reference app visualization // of various parameters in the lighting equation. #ifdef PBR_DEBUG // TODO: Figure out how to debug multiple lights // color = mix(color, F, pbr_scaleFGDSpec.x); // color = mix(color, vec3(G), pbr_scaleFGDSpec.y); // color = mix(color, vec3(D), pbr_scaleFGDSpec.z); // color = mix(color, specContrib, pbr_scaleFGDSpec.w); // color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x); color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y); color = mix(color, vec3(metallic), pbrMaterial.scaleDiffBaseMR.z); color = mix(color, vec3(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w); #endif } return vec4(pow(color,vec3(1.0/2.2)), baseColor.a); } `;var us=`uniform pbrProjectionUniforms { mat4 modelViewProjectionMatrix; mat4 modelMatrix; mat4 normalMatrix; vec3 camera; } pbrProjection; `,gs={name:"pbrProjection",vs:us,fs:us,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}};var wt={props:{},uniforms:{},name:"pbrMaterial",dependencies:[ot,gs],vs:ms,fs:ds,defines:{LIGHTING_FRAGMENT:1},getUniforms:e=>e,uniformTypes:{unlit:"i32",baseColorMapEnabled:"i32",baseColorFactor:"vec4<f32>",normalMapEnabled:"i32",normalScale:"f32",emissiveMapEnabled:"i32",emissiveFactor:"vec3<f32>",metallicRoughnessValues:"vec2<f32>",metallicRoughnessMapEnabled:"i32",occlusionMapEnabled:"i32",occlusionStrength:"f32",alphaCutoffEnabled:"i32",alphaCutoff:"f32",IBLenabled:"i32",scaleIBLAmbient:"vec2<f32>",scaleDiffBaseMR:"vec4<f32>",scaleFGDSpec:"vec4<f32>"}};var gt=F(At(),1),tn=Math.PI/180,le=new Float32Array(16),Bs=new Float32Array(12);function xs(e,t,n){let r=t[0]*tn,s=t[1]*tn,o=t[2]*tn,i=Math.sin(o),c=Math.sin(r),a=Math.sin(s),f=Math.cos(o),l=Math.cos(r),h=Math.cos(s),A=n[0],p=n[1],m=n[2];e[0]=A*h*l,e[1]=A*a*l,e[2]=A*-c,e[3]=p*(-a*f+h*c*i),e[4]=p*(h*f+a*c*i),e[5]=p*l*i,e[6]=m*(a*i+h*c*f),e[7]=m*(-h*i+a*c*f),e[8]=m*l*f}function Ms(e){return e[0]=e[0],e[1]=e[1],e[2]=e[2],e[3]=e[4],e[4]=e[5],e[5]=e[6],e[6]=e[8],e[7]=e[9],e[8]=e[10],e[9]=e[12],e[10]=e[13],e[11]=e[14],e.subarray(0,12)}var he={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrixCol0:{size:3,elementOffset:0},instanceModelMatrixCol1:{size:3,elementOffset:3},instanceModelMatrixCol2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(e,{startRow:t,endRow:n}){let{data:r,getOrientation:s,getScale:o,getTranslation:i,getTransformMatrix:c}=this.props,a=Array.isArray(c),f=a&&c.length===16,l=Array.isArray(o),h=Array.isArray(s),A=Array.isArray(i),p=f||!a&&Boolean(c(r[0]));p?e.constant=f:e.constant=h&&l&&A;let m=e.value;if(e.constant){let d;p?(le.set(c),d=Ms(le)):(d=Bs,xs(d,s,o),d.set(i,9)),e.value=new Float32Array(d)}else{let d=t*e.size,{iterable:u,objectInfo:B}=(0,gt.createIterable)(r,t,n);for(let E of u){B.index++;let g;if(p)le.set(f?c:c(E,B)),g=Ms(le);else{g=Bs;let x=h?s:s(E,B),M=l?o:o(E,B);xs(g,x,M),g.set(A?i:i(E,B),9)}m[d++]=g[0],m[d++]=g[1],m[d++]=g[2],m[d++]=g[3],m[d++]=g[4],m[d++]=g[5],m[d++]=g[6],m[d++]=g[7],m[d++]=g[8],m[d++]=g[9],m[d++]=g[10],m[d++]=g[11]}}}};function Ae(e,t){return t===gt.COORDINATE_SYSTEM.CARTESIAN||t===gt.COORDINATE_SYSTEM.METER_OFFSETS||t===gt.COORDINATE_SYSTEM.DEFAULT&&!e.isGeospatial}var Cs=`uniform simpleMeshUniforms { float sizeScale; bool composeModelMatrix; bool hasTexture; bool flatShading; } simpleMesh; `,Es={name:"simpleMesh",vs:Cs,fs:Cs,uniformTypes:{sizeScale:"f32",composeModelMatrix:"f32",hasTexture:"f32",flatShading:"f32"}};var _s=`#version 300 es #define SHADER_NAME simple-mesh-layer-vs in vec3 positions; in vec3 normals; in vec3 colors; in vec2 texCoords; in vec3 instancePositions; in vec3 instancePositions64Low; in vec4 instanceColors; in vec3 instancePickingColors; in vec3 instanceModelMatrixCol0; in vec3 instanceModelMatrixCol1; in vec3 instanceModelMatrixCol2; in vec3 instanceTranslation; out vec2 vTexCoord; out vec3 cameraPosition; out vec3 normals_commonspace; out vec4 position_commonspace; out vec4 vColor; void main(void) { geometry.worldPosition = instancePositions; geometry.uv = texCoords; geometry.pickingColor = instancePickingColors; vTexCoord = texCoords; cameraPosition = project.cameraPosition; vColor = vec4(colors * instanceColors.rgb, instanceColors.a); mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); vec3 pos = (instanceModelMatrix * positions) * simpleMesh.sizeScale + instanceTranslation; if (simpleMesh.composeModelMatrix) { DECKGL_FILTER_SIZE(pos, geometry); normals_commonspace = project_normal(instanceModelMatrix * normals); geometry.worldPosition += pos; gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace); geometry.position = position_commonspace; } else { pos = project_size(pos); DECKGL_FILTER_SIZE(pos, geometry); gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace); geometry.position = position_commonspace; normals_commonspace = project_normal(instanceModelMatrix * normals); } geometry.normal = normals_commonspace; DECKGL_FILTER_GL_POSITION(gl_Position, geometry); DECKGL_FILTER_COLOR(vColor, geometry); } `;var Ts=`#version 300 es #define SHADER_NAME simple-mesh-layer-fs precision highp float; uniform sampler2D sampler; in vec2 vTexCoord; in vec3 cameraPosition; in vec3 normals_commonspace; in vec4 position_commonspace; in vec4 vColor; out vec4 fragColor; void main(void) { geometry.uv = vTexCoord; vec3 normal; if (simpleMesh.flatShading) { normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); } else { normal = normals_commonspace; } vec4 color = simpleMesh.hasTexture ? texture(sampler, vTexCoord) : vColor; DECKGL_FILTER_COLOR(color, geometry); vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal); fragColor = vec4(lightColor, color.a * layer.opacity); } `;function ys(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Nt(e){let t=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,i=-1/0,c=e.POSITION?e.POSITION.value:[],a=c&&c.length;for(let f=0;f<a;f+=3){let l=c[f],h=c[f+1],A=c[f+2];t=l<t?l:t,n=h<n?h:n,r=A<r?A:r,s=l>s?l:s,o=h>o?h:o,i=A>i?A:i}return[[t,n,r],[s,o,i]]}function en(e,t,n){let r=ys(t.value),s=n||bs(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function bs(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function nn(e){let t=e.positions||e.POSITION;nt.log.assert(t,'no "postions" or "POSITION" attribute in mesh');let n=t.value.length/t.size,r=e.COLOR_0||e.colors;r||(r={size:3,value:new Float32Array(n*3).fill(1)});let s=e.NORMAL||e.normals;s||(s={size:3,value:new Float32Array(n*3).fill(0)});let o=e.TEXCOORD_0||e.texCoords;return o||(o={size:2,value:new Float32Array(n*2).fill(0)}),{positions:t,colors:r,normals:s,texCoords:o}}function Rs(e){return e instanceof Bt.Geometry?(e.attributes=nn(e.attributes),e):e.attributes?new Bt.Geometry({...e,topology:"triangle-list",attributes:nn(e.attributes)}):new Bt.Geometry({topology:"triangle-list",attributes:nn(e)})}var Qi=[0,0,0,255],Wi={mesh:{type:"object",value:null,async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:e=>e.position},getColor:{type:"accessor",value:Qi},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},textureParameters:{type:"object",ignore:!0,value:null}},Ut=class extends nt.Layer{getShaders(){return super.getShaders({vs:_s,fs:Ts,modules:[nt.project32,fe,nt.picking,Es]})}getBounds(){if(this.props._instanced)return super.getBounds();let t=this.state.positionBounds;if(t)return t;let{mesh:n}=this.props;if(!n)return null;if(t=n.header?.boundingBox,!t){let{attributes:r}=Rs(n);r.POSITION=r.POSITION||r.positions,t=Nt(r)}return this.state.positionBounds=t,t}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:"float64",fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:"unorm8",transition:!0,size:this.props.colorFormat.length,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:he}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(t){super.updateState(t);let{props:n,oldProps:r,changeFlags:s}=t;if(n.mesh!==r.mesh||s.extensionsChanged){if(this.state.positionBounds=null,this.state.model?.destroy(),n.mesh){this.state.model=this.getModel(n.mesh);let o=n.mesh.attributes||n.mesh;this.setState({hasNormals:Boolean(o.NORMAL||o.normals)})}this.getAttributeManager().invalidateAll()}n.texture!==r.texture&&n.texture instanceof Is.Texture&&this.setTexture(n.texture),this.state.model&&this.state.model.setTopology(this.props.wireframe?"line-strip":"triangle-list")}finalizeState(t){super.finalizeState(t),this.state.emptyTexture.delete()}draw({uniforms:t}){let{model:n}=this.state;if(!n)return;let{viewport:r,renderPass:s}=this.context,{sizeScale:o,coordinateSystem:i,_instanced:c}=this.props,a={sizeScale:o,composeModelMatrix:!c||Ae(r,i),flatShading:!this.state.hasNormals};n.shaderInputs.setProps({simpleMesh:a}),n.draw(s)}get isLoaded(){return Boolean(this.state?.model&&super.isLoaded)}getModel(t){let n=new Bt.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:Rs(t),isInstanced:!0}),{texture:r}=this.props,{emptyTexture:s}=this.state,o={sampler:r||s,hasTexture:Boolean(r)};return n.shaderInputs.setProps({simpleMesh:o}),n}setTexture(t){let{emptyTexture:n,model:r}=this.state;if(r){let s={sampler:t||n,hasTexture:Boolean(t)};r.shaderInputs.setProps({simpleMesh:s})}}};Ut.defaultProps=Wi;Ut.layerName="SimpleMeshLayer";var Ss=Ut;var W=F(At(),1);var ht=F(Dt(),1);var Ls=F(pt(),1),V;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(V||(V={}));function Fs(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=r;return o&&(s.bindings.pbr_diffuseEnvSampler=o.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=o.specularEnvSampler.texture,s.bindings.pbr_BrdfLUT=o.brdfLutTexture.texture,s.uniforms.scaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&qi(e,t,s),s}function qi(e,t,n){if(n.uniforms.unlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Zi(e,t.pbrMetallicRoughness,n),t.normalTexture){Ht(e,t.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.normalScale=r}if(t.occlusionTexture){Ht(e,t.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.occlusionStrength=r}switch(t.emissiveTexture&&(Ht(e,t.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.emissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.alphaCutoff=r;break;case"BLEND":Ls.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=V.FUNC_ADD,n.glParameters.blendFunc=[V.SRC_ALPHA,V.ONE_MINUS_SRC_ALPHA,V.ONE,V.ONE_MINUS_SRC_ALPHA];break}}function Zi(e,t,n){t.baseColorTexture&&Ht(e,t.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.baseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&Ht(e,t.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.metallicRoughnessValues=[r,s]}function Ht(e,t,n,r=null,s){let o=t?.texture?.sampler?.parameters||{},i=t.texture.source.image,c,a={};i.compressed?(c=i,a={[V.TEXTURE_MIN_FILTER]:i.data.length>1?V.LINEAR_MIPMAP_NEAREST:V.LINEAR}):c={data:i};let f=e.createTexture({id:t.uniformName||t.id,parameters:{...o,...a},pixelStore:{[V.UNPACK_FLIP_Y_WEBGL]:!1},...c});s.bindings[n]=f,r&&(s.defines[r]=1),s.generatedTextures.push(f)}var Ds="4.2.1";async function Jt(e,t,n,r){return r._parse(e,t,n,r)}function U(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var k={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},$i=k.self||k.window||k.global||{},tc=k.window||k.self||k.global||{},ec=k.global||k.self||k.window||{},nc=k.document||{};var Kt=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Os=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),rc=Os&&parseFloat(Os[1])||0;function rn(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function sn(e){return globalThis.loaders?.modules?.[e]||null}function sc(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var Gs=sc();function vs(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Y={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},UA=Y.self||Y.window||Y.global||{},HA=Y.window||Y.self||Y.global||{},JA=Y.global||Y.self||Y.window||{},KA=Y.document||{};var xt=typeof process!="object"||String(process)!=="[object process]"||process.browser,pe=typeof importScripts=="function",XA=typeof window<"u"&&typeof window.orientation<"u",Ps=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),VA=Ps&&parseFloat(Ps[1])||0;var on={};async function z(e,t=null,n={},r=null){return t&&(e=ws(e,t,n,r)),on[e]=on[e]||oc(e),await on[e]}function ws(e,t,n={},r=null){if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:xt?n.CDN?(vs(n.CDN.startsWith("http")),`${n.CDN}/${t}@${Gs}/dist/libs/${r}`):pe?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function oc(e){if(e.endsWith("wasm"))return await cc(e);if(!xt)try{let{requireFromFile:n}=globalThis.loaders||{};return await n?.(e)}catch(n){return console.error(n),null}if(pe)return importScripts(e);let t=await ac(e);return ic(t,e)}function ic(e,t){if(!xt){let{requireFromString:r}=globalThis.loaders||{};return r?.(e,t)}if(pe)return eval.call(globalThis,e),null;let n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch{n.text=e}return document.body.appendChild(n),null}async function cc(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return xt||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function ac(e){let{readFileAsText:t}=globalThis.loaders||{};return xt||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function Us(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?Ns(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Ns(e,0,t):""}function Ns(e,t,n){if(e.byteLength<=t+n)return"";let r=new DataView(e),s="";for(let o=0;o<n;o++)s+=String.fromCharCode(r.getUint8(t+o));return s}function cn(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${Us(e)}"`)}}function Xt(e,t,n){let r=n!==void 0?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function rt(e,t){return U(e>=0),U(t>0),e+(t-1)&~(t-1)}function an(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{let s=e.byteOffset,o=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,o)}return t.set(r,n),n+rt(r.byteLength,4)}var me={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Hs;async function ln(e){rn(e.modules);let t=sn("basis");return t||(Hs||=fc(e),await Hs)}async function fc(e){let t=null,n=null;return[t,n]=await Promise.all([await z(me.TRANSCODER,"textures",e),await z(me.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await lc(t,n)}function lc(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:o,initializeBasis:i}=s;i(),r({BasisFile:o})})})}var fn;async function hn(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(fn=fn||hc(e),await fn)}async function hc(e){let t=null,n=null;return[t,n]=await Promise.all([await z(me.ENCODER,"textures",e),await z(me.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await Ac(t,n)}function Ac(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:o,KTX2File:i,initializeBasis:c,BasisEncoder:a}=s;c(),r({BasisFile:o,KTX2File:i,BasisEncoder:a})})})}var it={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var pc=["","WEBKIT_","MOZ_"],Js={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},de=null;function Ks(e){if(!de){e=e||mc()||void 0,de=new Set;for(let t of pc)for(let n in Js)if(e&&e.getExtension(`${t}${n}`)){let r=Js[n];de.add(r)}}return de}function mc(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Ip=new Uint8Array([0]);var Xs,Vs,js,ks,Ys,zs,Qs,Ws;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Xs||(Xs={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Vs||(Vs={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(js||(js={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(ks||(ks={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Ys||(Ys={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(zs||(zs={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Qs||(Qs={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Ws||(Ws={}));var w=[171,75,84,88,32,50,48,187,13,10,26,10];function qs(e){let t=new Uint8Array(e);return!(t.byteLength<w.length||t[0]!==w[0]||t[1]!==w[1]||t[2]!==w[2]||t[3]!==w[3]||t[4]!==w[4]||t[5]!==w[5]||t[6]!==w[6]||t[7]!==w[7]||t[8]!==w[8]||t[9]!==w[9]||t[10]!==w[10]||t[11]!==w[11])}var dc={etc1:{basisFormat:0,compressed:!0,format:it.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:it.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:it.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:it.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:it.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:it.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function pn(e,t){if(t.basis.containerFormat==="auto"){if(qs(e)){let r=await hn(t);return Zs(r.KTX2File,e,t)}let{BasisFile:n}=await ln(t);return An(n,e,t)}switch(t.basis.module){case"encoder":let n=await hn(t);switch(t.basis.containerFormat){case"ktx2":return Zs(n.KTX2File,e,t);case"basis":default:return An(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await ln(t);return An(r,e,t)}}function An(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),o=[];for(let i=0;i<s;i++){let c=r.getNumLevels(i),a=[];for(let f=0;f<c;f++)a.push(uc(r,i,f,n));o.push(a)}return o}finally{r.close(),r.delete()}}function uc(e,t,n,r){let s=e.getImageWidth(t,n),o=e.getImageHeight(t,n),i=e.getHasAlpha(),{compressed:c,format:a,basisFormat:f}=$s(r,i),l=e.getImageTranscodedSizeInBytes(t,n,f),h=new Uint8Array(l);if(!e.transcodeImage(h,t,n,f,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:o,data:h,compressed:c,format:a,hasAlpha:i}}function Zs(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),o=[];for(let i=0;i<s;i++){o.push(gc(r,i,n));break}return[o]}finally{r.close(),r.delete()}}function gc(e,t,n){let{alphaFlag:r,height:s,width:o}=e.getImageLevelInfo(t,0,0),{compressed:i,format:c,basisFormat:a}=$s(n,r),f=e.getImageTranscodedSizeInBytes(t,0,0,a),l=new Uint8Array(f);if(!e.transcodeImage(l,t,0,0,a,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:o,height:s,data:l,compressed:i,levelSize:f,hasAlpha:r,format:c}}function $s(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=ue()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),dc[n]}function ue(){let e=Ks();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var to={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:Ds,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},mn={...to,parse:pn};var eo="4.2.1";var Bc=globalThis.loaders?.parseImageNode,dn=typeof Image<"u",un=typeof ImageBitmap<"u",xc=Boolean(Bc),gn=Kt?!0:xc;function no(e){switch(e){case"auto":return un||dn||gn;case"imagebitmap":return un;case"image":return dn;case"data":return gn;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function ro(){if(un)return"imagebitmap";if(dn)return"image";if(gn)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function so(e){let t=Mc(e);if(!t)throw new Error("Not an image");return t}function Vt(e){switch(so(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Mc(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Cc=/^data:image\/svg\+xml/,Ec=/\.svg((\?|#).*)?$/;function ge(e){return e&&(Cc.test(e)||Ec.test(e))}function oo(e,t){if(ge(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return Bn(e,t)}function Bn(e,t){if(ge(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Be(e,t,n){let r=oo(e,n),s=self.URL||self.webkitURL,o=typeof r!="string"&&s.createObjectURL(r);try{return await _c(o||r,t)}finally{o&&s.revokeObjectURL(o)}}async function _c(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var Tc={},io=!0;async function co(e,t,n){let r;ge(n)?r=await Be(e,t,n):r=Bn(e,n);let s=t&&t.imagebitmap;return await yc(r,s)}async function yc(e,t=null){if((bc(t)||!io)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),io=!1}return await createImageBitmap(e)}function bc(e){for(let t in e||Tc)return!1;return!0}function ao(e){return!Lc(e,"ftyp",4)||!(e[8]&96)?null:Rc(e)}function Rc(e){switch(Ic(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Ic(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Sc(e){return[...e].map(t=>t.charCodeAt(0))}function Lc(e,t,n=0){let r=Sc(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Q=!1,jt=!0;function ct(e){let t=kt(e);return Dc(t)||vc(t)||Oc(t)||Gc(t)||Fc(t)}function Fc(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=ao(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Dc(e){let t=kt(e);return t.byteLength>=24&&t.getUint32(0,Q)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Q),height:t.getUint32(20,Q)}:null}function Oc(e){let t=kt(e);return t.byteLength>=10&&t.getUint32(0,Q)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,jt),height:t.getUint16(8,jt)}:null}function Gc(e){let t=kt(e);return t.byteLength>=14&&t.getUint16(0,Q)===16973&&t.getUint32(2,jt)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,jt),height:t.getUint32(22,jt)}:null}function vc(e){let t=kt(e);if(!(t.byteLength>=3&&t.getUint16(0,Q)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=Pc(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,Q);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,Q),width:t.getUint16(o+7,Q)};if(!r.has(i))return null;o+=2,o+=t.getUint16(o,Q)}return null}function Pc(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function kt(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function fo(e,t){let{mimeType:n}=ct(e)||{},r=globalThis.loaders?.parseImageNode;return U(r),await r(e,n)}async function lo(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=n||{},i=wc(s),c;switch(i){case"imagebitmap":c=await co(e,t,o);break;case"image":c=await Be(e,t,o);break;case"data":c=await fo(e,t);break;default:U(!1)}return s==="data"&&(c=Vt(c)),c}function wc(e){switch(e){case"auto":case"data":return ro();default:return no(e),e}}var Nc=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Uc=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Hc={image:{type:"auto",decode:!0}},xn={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:eo,mimeTypes:Uc,extensions:Nc,parse:lo,tests:[e=>Boolean(ct(new DataView(e)))],options:Hc};var Mn={};function Cn(e){if(Mn[e]===void 0){let t=Kt?Kc(e):Jc(e);Mn[e]=t}return Mn[e]}function Jc(e){let t=["image/png","image/jpeg","image/gif"],n=globalThis.loaders?.imageFormatsNode||t,r=globalThis.loaders?.parseImageNode;return Boolean(r)&&n.includes(e)}function Kc(e){switch(e){case"image/avif":case"image/webp":return Xc(e);default:return!0}}function Xc(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var Mt=F(Dt(),1);var _n=F(pt(),1);var Vc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Tn=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(t){Object.assign(this,t)}animate(t){if(!this.playing)return;let r=(t/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:s,target:o,path:i})=>{qc(r,s,o,i),Yc(o,o._node)})}},xe=class{animations;constructor(t){this.animations=t.animations.map((n,r)=>{let s=n.name||`Animation-${r}`,o=n.samplers.map(({input:c,interpolation:a="LINEAR",output:f})=>({input:ho(t.accessors[c]),interpolation:a,output:ho(t.accessors[f])})),i=n.channels.map(({sampler:c,target:a})=>({sampler:o[c],target:t.nodes[a.node],path:a.path}));return new Tn({name:s,channels:i})})}animate(t){this.setTime(t)}setTime(t){this.animations.forEach(n=>n.animate(t))}getAnimations(){return this.animations}};function ho(e){if(!e._animation){let t=jc[e.componentType],n=Vc[e.type],r=n*e.count,{buffer:s,byteOffset:o}=e.bufferView.data,i=new t(s,o+(e.byteOffset||0),r);if(n===1)e._animation=Array.from(i);else{let c=[];for(let a=0;a<i.length;a+=n)c.push(Array.from(i.slice(a,a+n)));e._animation=c}}return e._animation}var kc=new Z;function Yc(e,t){if(t.matrix.identity(),e.translation&&t.matrix.translate(e.translation),e.rotation){let n=kc.fromQuaternion(e.rotation);t.matrix.multiplyRight(n)}e.scale&&t.matrix.scale(e.scale)}var En=new vt;function zc(e,t,n,r,s){if(t==="rotation"){En.slerp({start:n,target:r,ratio:s});for(let o=0;o<En.length;o++)e[t][o]=En[o]}else for(let o=0;o<n.length;o++)e[t][o]=s*r[o]+(1-s)*n[o]}function Qc(e,t,{p0:n,outTangent0:r,inTangent1:s,p1:o,tDiff:i,ratio:c}){for(let a=0;a<e[t].length;a++){let f=r[a]*i,l=s[a]*i;e[t][a]=(2*Math.pow(c,3)-3*Math.pow(c,2)+1)*n[a]+(Math.pow(c,3)-2*Math.pow(c,2)+c)*f+(-2*Math.pow(c,3)+3*Math.pow(c,2))*o[a]+(Math.pow(c,3)-Math.pow(c,2))*l}}function Wc(e,t,n){for(let r=0;r<n.length;r++)e[t][r]=n[r]}function qc(e,{input:t,interpolation:n,output:r},s,o){let i=t[t.length-1],c=e%i,a=t.findIndex(A=>A>=c),f=Math.max(0,a-1);if(!Array.isArray(s[o]))switch(o){case"translation":s[o]=[0,0,0];break;case"rotation":s[o]=[0,0,0,1];break;case"scale":s[o]=[1,1,1];break;default:_n.log.warn(`Bad animation path ${o}`)()}let l=t[f],h=t[a];switch(n){case"STEP":Wc(s,o,r[f]);break;case"LINEAR":if(h>l){let A=(c-l)/(h-l);zc(s,o,r[f],r[a],A)}break;case"CUBICSPLINE":if(h>l){let A=(c-l)/(h-l),p=h-l,m=r[3*f+1],d=r[3*f+2],u=r[3*a+0],B=r[3*a+1];Qc(s,o,{p0:m,outTangent0:d,inTangent1:u,p1:B,tDiff:p,ratio:A})}break;default:_n.log.warn(`Interpolation ${n} not supported`)();break}}var Ao=F(pt(),1);var Me=F(Dt(),1);var Zc=` layout(0) positions: vec4; // in vec4 POSITION; #ifdef HAS_NORMALS in vec4 normals; // in vec4 NORMAL; #endif #ifdef HAS_TANGENTS in vec4 TANGENT; #endif #ifdef HAS_UV // in vec2 TEXCOORD_0; in vec2 texCoords; #endif @vertex void main(void) { vec4 _NORMAL = vec4(0.); vec4 _TANGENT = vec4(0.); vec2 _TEXCOORD_0 = vec2(0.); #ifdef HAS_NORMALS _NORMAL = normals; #endif #ifdef HAS_TANGENTS _TANGENT = TANGENT; #endif #ifdef HAS_UV _TEXCOORD_0 = texCoords; #endif pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0); gl_Position = u_MVPMatrix * positions; } @fragment out vec4 fragmentColor; void main(void) { vec3 pos = pbr_vPosition; fragmentColor = pbr_filterColor(vec4(1.0)); } `,$c=`#version 300 es // in vec4 POSITION; in vec4 positions; #ifdef HAS_NORMALS // in vec4 NORMAL; in vec4 normals; #endif #ifdef HAS_TANGENTS in vec4 TANGENT; #endif #ifdef HAS_UV // in vec2 TEXCOORD_0; in vec2 texCoords; #endif void main(void) { vec4 _NORMAL = vec4(0.); vec4 _TANGENT = vec4(0.); vec2 _TEXCOORD_0 = vec2(0.); #ifdef HAS_NORMALS _NORMAL = normals; #endif #ifdef HAS_TANGENTS _TANGENT = TANGENT; #endif #ifdef HAS_UV _TEXCOORD_0 = texCoords; #endif pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0); gl_Position = pbrProjection.modelViewProjectionMatrix * positions; } `,ta=`#version 300 es out vec4 fragmentColor; void main(void) { vec3 pos = pbr_vPosition; fragmentColor = pbr_filterColor(vec4(1.0)); } `;function po(e,t){let{id:n,geometry:r,material:s,vertexCount:o,materialOptions:i,modelOptions:c}=t,a=Fs(e,s,r.attributes,i);Ao.log.info(4,"createGLTFModel defines: ",a.defines)();let f=[],l={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},h={id:n,source:Zc,vs:$c,fs:ta,geometry:r,topology:r.topology,vertexCount:o,modules:[wt],...c,defines:{...a.defines,...c.defines},parameters:{...l,...a.parameters,...c.parameters}},A=new Me.Model(e,h),{camera:p,...m}={...a.uniforms,...c.uniforms,...a.bindings,...c.bindings};return A.shaderInputs.setProps({pbrMaterial:m,pbrProjection:{camera:p}}),new Me.ModelNode({managedResources:f,model:A})}var at;(function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(at||(at={}));function mo(e){switch(e){case at.POINTS:return"point-list";case at.LINES:return"line-list";case at.LINE_STRIP:return"line-strip";case at.TRIANGLES:return"triangle-list";case at.TRIANGLE_STRIP:return"triangle-strip";default:throw new Error(String(e))}}var ea={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},Ce=class{device;options;gltf;constructor(t,n={}){this.device=t,this.options={...ea,...n}}instantiate(t){return this.gltf=yn(t),(this.gltf.scenes||[]).map(r=>this.createScene(r))}createAnimator(){return Array.isArray(this.gltf.animations)?new xe(this.gltf):null}createScene(t){let r=(t.nodes||[]).map(o=>this.createNode(o));return new Mt.GroupNode({id:t.name||t.id,children:r})}createNode(t){if(!t._node){let s=(t.children||[]).map(i=>this.createNode(i));t.mesh&&s.push(this.createMesh(t.mesh));let o=new Mt.GroupNode({id:t.name||t.id,children:s});if(t.matrix)o.setMatrix(t.matrix);else{if(o.matrix.identity(),t.translation&&o.matrix.translate(t.translation),t.rotation){let i=new Z().fromQuaternion(t.rotation);o.matrix.multiplyRight(i)}t.scale&&o.matrix.scale(t.scale)}t._node=o}let n=this.gltf.nodes.find(r=>r.id===t.id);return n._node=t._node,t._node}createMesh(t){if(!t._mesh){let r=(t.primitives||[]).map((o,i)=>this.createPrimitive(o,i,t)),s=new Mt.GroupNode({id:t.name||t.id,children:r});t._mesh=s}return t._mesh}createPrimitive(t,n,r){let s=t.name||`${r.name||r.id}-primitive-${n}`,o=mo(t.mode||4),i=t.indices?t.indices.count:this.getVertexCount(t.attributes),c=po(this.device,{id:s,geometry:this.createGeometry(s,t,o),material:t.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:i});return c.bounds=[t.attributes.POSITION.min,t.attributes.POSITION.max],c}getVertexCount(t){throw new Error("getVertexCount not implemented")}createGeometry(t,n,r){let s={};for(let[o,i]of Object.entries(n.attributes)){let{components:c,size:a,value:f}=i;s[o]={size:a??c,value:f}}return new Mt.Geometry({id:t,topology:r,indices:n.indices.value,attributes:s})}createBuffer(t,n){t.bufferView||(t.bufferView={});let{bufferView:r}=t;return r.lumaBuffers||(r.lumaBuffers={}),r.lumaBuffers[n]||(r.lumaBuffers[n]=this.device.createBuffer({id:`from-${r.id}`,data:r.data||t.value})),r.lumaBuffers[n]}createSampler(t){return t}needsPOT(){return!1}};function yn(e){if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof ImageBitmap)return e;if(Array.isArray(e))return e.map(yn);if(e&&typeof e=="object"){let t={};for(let n in e)t[n]=yn(e[n]);return t}return e}function bn(e,t,n){let r=new Ce(e,n),s=r.instantiate(t),o=r.createAnimator();return{scenes:s,animator:o}}var Rn={};N(Rn,{decode:()=>Aa,name:()=>ha});function b(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var Ee={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},_e={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var uo=["SCALAR","VEC2","VEC3","VEC4"],na=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ra=new Map(na),sa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},oa={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ia={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Te(e){return uo[e-1]||uo[0]}function Ct(e){let t=ra.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Et(e,t){let n=ia[e.componentType],r=sa[e.type],s=oa[e.componentType],o=e.count*r,i=e.count*r*s;b(i>=0&&i<=t.byteLength);let c=_e[e.componentType],a=Ee[e.type];return{ArrayType:n,length:o,byteLength:i,componentByteSize:c,numberOfComponentsInElement:a}}function go(e,t,n){let r=e.bufferViews[n];b(r);let s=r.buffer,o=t[s];b(o);let i=(r.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,r.byteLength)}function Bo(e,t,n){let r=typeof n=="number"?e.accessors?.[n]:n;if(!r)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let s=e.bufferViews?.[r.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:o,byteOffset:i}=t[s.buffer],c=(i||0)+(r.byteOffset||0)+(s.byteOffset||0),{ArrayType:a,length:f,componentByteSize:l,numberOfComponentsInElement:h}=Et(r,s),A=l*h,p=s.byteStride||A;if(typeof s.byteStride>"u"||s.byteStride===A)return new a(o,c,f);let m=new a(f);for(let d=0;d<r.count;d++){let u=new a(o,c+d*p,h);m.set(u,d*h)}return m}function ca(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var _=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:t?.json||ca(),buffers:t?.buffers||[],images:t?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.getRequiredExtensions().find(s=>s===t);return typeof n=="string"||typeof r=="string"}getExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.json.extensions||{};return n?r[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(r=>r===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,n){return(t.extensions||{})[n]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,n){if(typeof n=="object")return n;let r=this.json[t]&&this.json[t][n];if(!r)throw new Error(`glTF file error: Could not find ${t}[${n}]`);return r}getTypedArrayForBufferView(t){t=this.getBufferView(t);let n=t.buffer,r=this.gltf.buffers[n];b(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return Bo(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,o=n.byteOffset||0;return new Uint8Array(s,o,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t,n={}){return b(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t,n={}){return b(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){if(this.json.extensions?.[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(t)||n.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:o=4}=t,c={primitives:[{attributes:this._addAttributes(n),mode:o}]};if(r){let a=this._addIndices(r);c.primitives[0].indices=a}return Number.isFinite(s)&&(c.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(c),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=ct(t),s=n||r?.mimeType,i={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t,n=0,r=this.byteLength){let s=t.byteLength;b(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let o={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=rt(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(t,n){let r={bufferView:t,type:Te(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t,n={size:3}){let r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let o={size:n.size,componentType:Ct(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(o,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){this.gltf.buffers=[];let t=this.byteLength,n=new ArrayBuffer(t),r=new Uint8Array(n),s=0;for(let o of this.sourceBuffers||[])s=an(o,r,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(t={}){let n={};for(let r in t){let s=t[r],o=this._getGltfAttributeName(r),i=this.addBinaryBuffer(s.value,s);n[o]=i}return n}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let o of s)r.min.push(o),r.max.push(o);for(let o=n;o<t.length;o+=n)for(let i=0;i<n;i++)r.min[0+i]=Math.min(r.min[0+i],t[o+i]),r.max[0+i]=Math.max(r.max[0+i],t[o+i]);return r}};function xo(e){return(e%1+1)%1}var Mo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},aa={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},Co={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Yt(e,t){return Co[t]*Mo[e]}function _t(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),o=Tt(s,"SCALAR",n,r+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function Tt(e,t,n,r=1){let s=Mo[t],o=aa[n],i=Co[n],c=r*s,a=c*i,f=e.buffer,l=e.byteOffset;return l%i!==0&&(f=new Uint8Array(f).slice(l,l+a).buffer,l=0),new o(f,l,c)}function yt(e,t,n){let r=`TEXCOORD_${t.texCoord||0}`,s=n.attributes[r],o=e.getTypedArrayForAccessor(s),i=e.gltf.json,c=t.index,a=i.textures?.[c]?.source;if(typeof a<"u"){let f=i.images?.[a]?.mimeType,l=e.gltf.images?.[a];if(l&&typeof l.width<"u"){let h=[];for(let A=0;A<o.length;A+=2){let p=fa(l,f,o,A,t.channels);h.push(p)}return h}}return[]}function ye(e,t,n,r,s){if(!n?.length)return;let o=[];for(let l of n){let h=r.findIndex(A=>A===l);h===-1&&(h=r.push(l)-1),o.push(h)}let i=new Uint32Array(o),c=e.gltf.buffers.push({arrayBuffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength})-1,a=e.addBufferView(i,c,0),f=e.addAccessor(a,{size:1,componentType:Ct(i),count:i.length});s.attributes[t]=f}function fa(e,t,n,r,s=[0]){let o={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},i=n[r],c=n[r+1],a=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(a=4);let f=la(i,c,e,a),l=0;for(let h of s){let A=typeof h=="number"?Object.values(o)[h]:o[h],p=f+A.offset,m=Vt(e);if(m.data.length<=p)throw new Error(`${m.data.length} <= ${p}`);let d=m.data[p];l|=d<<A.shift}return l}function la(e,t,n,r=1){let s=n.width,o=xo(e)*(s-1),i=Math.round(o),c=n.height,a=xo(t)*(c-1),f=Math.round(a),l=n.components?n.components:r;return(f*s+i)*l}function be(e,t,n,r,s){let o=[];for(let i=0;i<t;i++){let c=n[i],a=n[i+1]-n[i];if(a+c>r)break;let f=c/s,l=a/s;o.push(e.slice(f,f+l))}return o}function Re(e,t,n){let r=[];for(let s=0;s<t;s++){let o=s*n;r.push(e.slice(o,o+n))}return r}function Ie(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],o=new TextDecoder("utf8"),i=0;for(let c=0;c<e;c++){let a=r[c+1]-r[c];if(a+i<=t.length){let f=t.subarray(i,a+i),l=o.decode(f);s.push(l),i+=a}}return s}return[]}var Eo="EXT_mesh_features",ha=Eo;async function Aa(e,t){let n=new _(e);pa(n,t)}function pa(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)ma(e,s,t)}function ma(e,t,n){if(!n?.gltf?.loadBuffers)return;let s=t.extensions?.[Eo]?.featureIds;if(s)for(let o of s){let i;if(typeof o.attribute<"u"){let c=`_FEATURE_ID_${o.attribute}`,a=t.attributes[c];i=e.getTypedArrayForAccessor(a)}else typeof o.texture<"u"&&n?.gltf?.loadImages?i=yt(e,o.texture,t):i=[];o.data=i}}var Ln={};N(Ln,{decode:()=>ua,name:()=>da});var In="EXT_structural_metadata",da=In;async function ua(e,t){let n=new _(e);ga(n,t)}function ga(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(In);n&&(t.gltf?.loadImages&&Ba(e,n),xa(e,n))}function Ba(e,t){let n=t.propertyTextures,r=e.gltf.json;if(n&&r.meshes)for(let s of r.meshes)for(let o of s.primitives)Ca(e,n,o,t)}function xa(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.propertyTables;if(r&&s)for(let o in r){let i=Ma(s,o);i&&_a(e,n,i)}}function Ma(e,t){for(let n of e)if(n.class===t)return n;return null}function Ca(e,t,n,r){if(!t)return;let o=n.extensions?.[In]?.propertyTextures;if(o)for(let i of o){let c=t[i];Ea(e,c,n,r)}}function Ea(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){let i=`${s}_${o}`,c=t.properties?.[o];if(!c)continue;c.data||(c.data=[]);let a=c.data,f=yt(e,c,n);f!==null&&(ye(e,i,f,a,n),c.data=a,r.dataAttributeNames.push(i))}}function _a(e,t,n){let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let o in r.properties){let i=r.properties[o],c=n.properties?.[o];if(c){let a=Ta(e,t,i,s,c);c.data=a}}}function Ta(e,t,n,r,s){let o=[],i=s.values,c=e.getTypedArrayForBufferView(i),a=ya(e,n,s,r),f=ba(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=Ra(n,r,c,a);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{o=Ie(r,c,a,f);break}case"ENUM":{o=Ia(t,n,r,c,a);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return o}function ya(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?_t(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function ba(e,t,n){return typeof t.stringOffsets<"u"?_t(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function Ra(e,t,n,r){let s=e.array,o=e.count,i=Yt(e.type,e.componentType),c=n.byteLength/i,a;return e.componentType?a=Tt(n,e.type,e.componentType,c):a=n,s?r?be(a,t,r,n.length,i):o?Re(a,t,o):[]:a}function Ia(e,t,n,r,s){let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let i=e.enums?.[o];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let c=i.valueType||"UINT16",a=Yt(t.type,c),f=r.byteLength/a,l=Tt(r,t.type,c,f);if(l||(l=r),t.array){if(s)return Sa({valuesData:l,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:a,enumEntry:i});let h=t.count;return h?La(l,n,h,i):[]}return Sn(l,0,n,i)}function Sa(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:o,enumEntry:i}=e,c=[];for(let a=0;a<n;a++){let f=r[a],l=r[a+1]-r[a];if(l+f>s)break;let h=f/o,A=l/o,p=Sn(t,h,A,i);c.push(p)}return c}function La(e,t,n,r){let s=[];for(let o=0;o<t;o++){let i=n*o,c=Sn(e,i,n,r);s.push(c)}return s}function Sn(e,t,n,r){let s=[];for(let o=0;o<n;o++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let i=e[t+o],c=Fa(r,i);c?s.push(c.name):s.push("")}return s}function Fa(e,t){for(let n of e.values)if(n.value===t)return n;return null}var Fn={};N(Fn,{decode:()=>Oa,name:()=>Da});var _o="EXT_feature_metadata",Da=_o;async function Oa(e,t){let n=new _(e);Ga(n,t)}function Ga(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(_o);n&&(t.gltf?.loadImages&&va(e,n),Pa(e,n))}function va(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let o in r){let i=r[o],c=Na(s,o);c&&Ha(e,c,i)}}function Pa(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.featureTables;if(r&&s)for(let o in r){let i=wa(s,o);i&&Ua(e,n,i)}}function wa(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function Na(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function Ua(e,t,n){if(!n.class)return;let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let o in r.properties){let i=r.properties[o],c=n.properties?.[o];if(c){let a=Ja(e,t,i,s,c);c.data=a}}}function Ha(e,t,n){let r=t.class;for(let s in n.properties){let o=t?.properties?.[s];if(o){let i=ka(e,o,r);o.data=i}}}function Ja(e,t,n,r,s){let o=[],i=s.bufferView,c=e.getTypedArrayForBufferView(i),a=Ka(e,n,s,r),f=Xa(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?o=Ie(r,c,a,f):Va(n)&&(o=ja(n,r,c,a)),o}function Ka(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?_t(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function Xa(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?_t(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function Va(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function ja(e,t,n,r){let s=e.type==="ARRAY",o=e.componentCount,i="SCALAR",c=e.componentType||e.type,a=Yt(i,c),f=n.byteLength/a,l=Tt(n,i,c,f);return s?r?be(l,t,r,n.length,a):o?Re(l,t,o):[]:l}function ka(e,t,n){let r=e.gltf.json;if(!r.meshes)return[];let s=[];for(let o of r.meshes)for(let i of o.primitives)Ya(e,n,t,s,i);return s}function Ya(e,t,n,r,s){let o={channels:n.channels,...n.texture},i=yt(e,o,s);i&&ye(e,t,i,r,s)}var To="4.2.1";var bt=!0,yo=1735152710,Gn=12,Se=8,za=1313821514,Qa=5130562,Wa=0,qa=0,Za=1;function $a(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function bo(e,t=0,n={}){let r=new DataView(e),{magic:s=yo}=n,o=r.getUint32(t,!1);return o===s||o===yo}function Ro(e,t,n=0,r={}){let s=new DataView(t),o=$a(s,n+0),i=s.getUint32(n+4,bt),c=s.getUint32(n+8,bt);switch(Object.assign(e,{header:{byteOffset:n,byteLength:c,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),n+=Gn,e.version){case 1:return tf(e,s,n);case 2:return ef(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function tf(e,t,n){U(e.header.byteLength>Gn+Se);let r=t.getUint32(n+0,bt),s=t.getUint32(n+4,bt);return n+=Se,U(s===Wa),Dn(e,t,n,r),n+=r,n+=On(e,t,n,e.header.byteLength),n}function ef(e,t,n,r){return U(e.header.byteLength>Gn+Se),nf(e,t,n,r),n+e.header.byteLength}function nf(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,bt),o=t.getUint32(n+4,bt);switch(n+=Se,o){case za:Dn(e,t,n,s);break;case Qa:On(e,t,n,s);break;case qa:r.strict||Dn(e,t,n,s);break;case Za:r.strict||On(e,t,n,s);break;default:break}n+=rt(s,4)}return n}function Dn(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),rt(r,4)}function On(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),rt(r,4)}function vn(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let r=t.baseUri||t.uri;if(!r)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return r.substr(0,r.lastIndexOf("/")+1)+e}var wn={};N(wn,{decode:()=>df,name:()=>mf});var rf="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCI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6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",of=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),cf=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),af={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},ff={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Io(e,t,n,r,s,o="NONE"){let i=await lf();pf(i,i.exports[ff[s]],e,t,n,r,i.exports[af[o||"NONE"]])}var Pn;async function lf(){return Pn||(Pn=hf()),Pn}async function hf(){let e=rf;WebAssembly.validate(of)&&(e=sf,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(Af(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function Af(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);t[r]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let n=0;for(let r=0;r<e.length;++r)t[n++]=t[r]<60?cf[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function pf(e,t,n,r,s,o,i){let c=e.exports.sbrk,a=r+3&-4,f=c(a*s),l=c(o.length),h=new Uint8Array(e.exports.memory.buffer);h.set(o,l);let A=t(f,r,s,l,o.length);if(A===0&&i&&i(f,a,s),n.set(h.subarray(f,f+r*s)),c(f-c(0)),A!==0)throw new Error(`Malformed buffer data: ${A}`)}var Le="EXT_meshopt_compression",mf=Le;async function df(e,t){let n=new _(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let r=[];for(let s of e.json.bufferViews||[])r.push(uf(n,s));await Promise.all(r),n.removeExtension(Le)}async function uf(e,t){let n=e.getObjectExtension(t,Le);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:o,count:i,mode:c,filter:a="NONE",buffer:f}=n,l=e.gltf.buffers[f],h=new Uint8Array(l.arrayBuffer,l.byteOffset+r,s),A=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await Io(A,i,o,h,c,a),e.removeObjectExtension(t,Le)}}var Nn={};N(Nn,{name:()=>gf,preprocess:()=>Bf});var Rt="EXT_texture_webp",gf=Rt;function Bf(e,t){let n=new _(e);if(!Cn("image/webp")){if(n.getRequiredExtensions().includes(Rt))throw new Error(`gltf: Required extension ${Rt} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let o=n.getObjectExtension(s,Rt);o&&(s.source=o.source),n.removeObjectExtension(s,Rt)}n.removeExtension(Rt)}var Un={};N(Un,{name:()=>xf,preprocess:()=>Mf});var Fe="KHR_texture_basisu",xf=Fe;function Mf(e,t){let n=new _(e),{json:r}=n;for(let s of r.textures||[]){let o=n.getObjectExtension(s,Fe);o&&(s.source=o.source,n.removeObjectExtension(s,Fe))}n.removeExtension(Fe)}var Vn={};N(Vn,{decode:()=>Pf,encode:()=>wf,name:()=>Gf,preprocess:()=>vf});var So="4.2.1";var Lo={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:So,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Do(e,t,n){let r=Oo(t.metadata),s=[],o=Cf(t.attributes);for(let i in e){let c=e[i],a=Fo(i,c,o[i]);s.push(a)}if(n){let i=Fo("indices",n);s.push(i)}return{fields:s,metadata:r}}function Cf(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function Fo(e,t,n){let r=n?Oo(n.metadata):void 0;return en(e,t,r)}function Oo(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var Go={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Ef={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},_f=4,zt=class{draco;decoder;metadataQuerier;constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,n={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),o=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(s){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(r,o);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(r,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!o.ptr){let A=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(A)}let c=this._getDracoLoaderData(o,s,n),a=this._getMeshData(o,c,n),f=Nt(a.attributes),l=Do(a.attributes,c,a.indices);return{loader:"draco",loaderData:c,header:{vertexCount:o.num_points(),boundingBox:f},...a,schema:l}}finally{this.draco.destroy(r),o&&this.draco.destroy(o)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),o=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:o}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let o=this.decoder.GetAttribute(t,s),i=this._getAttributeMetadata(t,s);r[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:s,metadata:i};let c=this._getQuantizationTransform(o,n);c&&(r[o.unique_id()].quantization_transform=c);let a=this._getOctahedronTransform(o,n);a&&(r[o.unique_id()].octahedron_transform=a)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,n,r){let s={};for(let o of Object.values(t.attributes)){let i=this._deduceAttributeName(o,r);o.name=i;let c=this._getAttributeValues(n,o);if(c){let{value:a,size:f}=c;s[i]={value:a,size:f,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*_f,o=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,o),new Uint32Array(this.draco.HEAPF32.buffer,o,r).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(t){let n=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,n),bf(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=Ef[n.data_type];if(!r)return console.warn(`DRACO: Unsupported attribute type ${n.data_type}`),null;let s=n.num_components,i=t.num_points()*s,c=i*r.BYTES_PER_ELEMENT,a=Tf(this.draco,r),f,l=this.draco._malloc(c);try{let h=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,h,a,c,l),f=new r(this.draco.HEAPF32.buffer,l,i).slice()}finally{this.draco._free(l)}return{value:f,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[i,c]of Object.entries(n.extraAttributes||{}))if(c===r)return i;let s=t.attribute_type;for(let i in Go)if(this.draco[i]===s)return Go[i];let o=n.attributeNameEntry||"name";return t.metadata[o]?t.metadata[o].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let n=this.decoder.GetMetadata(t);return this._getDracoMetadata(n)}_getAttributeMetadata(t,n){let r=this.decoder.GetAttributeMetadata(t,n);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let n={},r=this.metadataQuerier.NumEntries(t);for(let s=0;s<r;s++){let o=this.metadataQuerier.GetEntryName(t,s);n[o]=this._getDracoMetadataField(t,o)}return n}_getDracoMetadataField(t,n){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,n,r);let s=yf(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let o of s)this.decoder.SkipAttributeTransform(this.draco[o])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(c=>i.min_value(c))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}};function Tf(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function yf(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function bf(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var Rf="1.5.6",If="1.4.1",Hn=`https://www.gstatic.com/draco/versioned/decoders/${Rf}`,D={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Jn={[D.DECODER]:`${Hn}/${D.DECODER}`,[D.DECODER_WASM]:`${Hn}/${D.DECODER_WASM}`,[D.FALLBACK_DECODER]:`${Hn}/${D.FALLBACK_DECODER}`,[D.ENCODER]:`https://raw.githubusercontent.com/google/draco/${If}/javascript/${D.ENCODER}`},Kn;async function vo(e){let t=e.modules||{};return t.draco3d?Kn||=t.draco3d.createDecoderModule({}).then(n=>({draco:n})):Kn||=Sf(e),await Kn}async function Sf(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await z(Jn[D.FALLBACK_DECODER],"draco",e,D.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await z(Jn[D.DECODER],"draco",e,D.DECODER),await z(Jn[D.DECODER_WASM],"draco",e,D.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await Lf(t,n)}function Lf(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var Po={...Lo,parse:Ff};async function Ff(e,t){let{draco:n}=await vo(t),r=new zt(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}function wo(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=Xn(r);t[n]=s}}return t}function Xn(e){let{buffer:t,size:n,count:r}=Df(e);return{value:t,size:n,byteOffset:0,count:r,type:Te(n),componentType:Ct(t)}}function Df(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=Of(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function Of(e,t,n=!1){return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var st="KHR_draco_mesh_compression",Gf=st;function vf(e,t,n){let r=new _(e);for(let s of No(r))r.getObjectExtension(s,st)}async function Pf(e,t,n){if(!t?.gltf?.decompressMeshes)return;let r=new _(e),s=[];for(let o of No(r))r.getObjectExtension(o,st)&&s.push(Nf(r,o,t,n));await Promise.all(s),r.removeExtension(st)}function wf(e,t={}){let n=new _(e);for(let r of n.json.meshes||[])Uf(r,t),n.addRequiredExtension(st)}async function Nf(e,t,n,r){let s=e.getObjectExtension(t,st);if(!s)return;let o=e.getTypedArrayForBufferView(s.bufferView),i=Xt(o.buffer,o.byteOffset),c={...n};delete c["3d-tiles"];let a=await Jt(i,Po,c,r),f=wo(a.attributes);for(let[l,h]of Object.entries(f))if(l in t.attributes){let A=t.attributes[l],p=e.getAccessor(A);p?.min&&p?.max&&(h.min=p.min,h.max=p.max)}t.attributes=f,a.indices&&(t.indices=Xn(a.indices)),e.removeObjectExtension(t,st),Hf(t)}function Uf(e,t,n=4,r,s){if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=r.DracoWriter.encodeSync({attributes:e}),i=s?.parseSync?.({attributes:e}),c=r._addFauxAttributes(i.attributes),a=r.addBufferView(o);return{primitives:[{attributes:c,mode:n,extensions:{[st]:{bufferView:a,attributes:c}}}]}}function Hf(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*No(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var qn={};N(qn,{decode:()=>nl,name:()=>$f});var Hd=1/Math.PI*180,Jd=1/180*Math.PI,Jf={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Jf}};var I=globalThis.mathgl.config;function Uo(e,{precision:t=I.precision}={}){return e=Kf(e),`${parseFloat(e.toPrecision(t))}`}function It(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function jn(e,t,n){let r=I.EPSILON;n&&(I.EPSILON=n);try{if(e===t)return!0;if(It(e)&&It(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!jn(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=I.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{I.EPSILON=r}}function Kf(e){return Math.round(e/I.EPSILON)*I.EPSILON}var St=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:It(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(I)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Uo(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!jn(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof n=="number"?n:n[s];this[s]=o+r*(i-o)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(I.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function Xf(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function L(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Ho(e,t,n=""){if(I.debug&&!Xf(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function kn(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var De=class extends St{get x(){return this[0]}set x(t){this[0]=L(t)}get y(){return this[1]}set y(t){this[1]=L(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return L(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return L(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return kn(t>=0&&t<this.ELEMENTS,"index is out of range"),L(this[t])}setComponent(t,n){return kn(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var Lt=typeof Float32Array<"u"?Float32Array:Array;var Zd=Math.PI/180;function Yf(){let e=new Lt(2);return Lt!=Float32Array&&(e[0]=0,e[1]=0),e}function Ko(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}var $d=function(){let e=Yf();return function(t,n,r,s,o,i){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],o(e,e,i),t[c]=e[0],t[c+1]=e[1];return t}}();function Xo(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o||1;return e[0]=(n[0]*r+n[4]*s+n[8]*o)/i,e[1]=(n[1]*r+n[5]*s+n[9]*o)/i,e[2]=(n[2]*r+n[6]*s+n[10]*o)/i,e}function Vo(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function jo(e,t,n){let r=t[0],s=t[1],o=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*o,e[1]=n[1]*r+n[4]*s+n[7]*o,e[2]=n[2]*r+n[5]*s+n[8]*o,e[3]=t[3],e}function zf(){let e=new Lt(3);return Lt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Qf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ko(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2];return e[0]=s*a-o*c,e[1]=o*i-r*a,e[2]=r*c-s*i,e}function Yo(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*s+n[8]*o+n[12])/i,e[1]=(n[1]*r+n[5]*s+n[9]*o+n[13])/i,e[2]=(n[2]*r+n[6]*s+n[10]*o+n[14])/i,e}function Oe(e,t,n){let r=t[0],s=t[1],o=t[2];return e[0]=r*n[0]+s*n[3]+o*n[6],e[1]=r*n[1]+s*n[4]+o*n[7],e[2]=r*n[2]+s*n[5]+o*n[8],e}function zo(e,t,n){let r=n[0],s=n[1],o=n[2],i=n[3],c=t[0],a=t[1],f=t[2],l=s*f-o*a,h=o*c-r*f,A=r*a-s*c,p=s*A-o*h,m=o*l-r*A,d=r*h-s*l,u=i*2;return l*=u,h*=u,A*=u,p*=2,m*=2,d*=2,e[0]=c+l+p,e[1]=a+h+m,e[2]=f+A+d,e}function Qo(e,t,n,r){let s=[],o=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],o[0]=s[0],o[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),o[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=o[0]+n[0],e[1]=o[1]+n[1],e[2]=o[2]+n[2],e}function Wo(e,t,n,r){let s=[],o=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],o[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),o[1]=s[1],o[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=o[0]+n[0],e[1]=o[1]+n[1],e[2]=o[2]+n[2],e}function qo(e,t,n,r){let s=[],o=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],o[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),o[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),o[2]=s[2],e[0]=o[0]+n[0],e[1]=o[1]+n[1],e[2]=o[2]+n[2],e}function Zo(e,t){let n=e[0],r=e[1],s=e[2],o=t[0],i=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(o*o+i*i+c*c)),f=a&&Qf(e,t)/a;return Math.acos(Math.min(Math.max(f,-1),1))}var nu=function(){let e=zf();return function(t,n,r,s,o,i){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var Yn=[0,0,0],Ge,ft=class extends De{static get ZERO(){return Ge||(Ge=new ft(0,0,0),Object.freeze(Ge)),Ge}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&It(t)?this.copy(t):(I.debug&&(L(t),L(n),L(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return I.debug&&(L(t.x),L(t.y),L(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=L(t)}angle(t){return Zo(this,t)}cross(t){return ko(this,this,t),this.check()}rotateX({radians:t,origin:n=Yn}){return Qo(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Yn}){return Wo(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Yn}){return qo(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Yo(this,this,t),this.check()}transformAsVector(t){return Xo(this,this,t),this.check()}transformByMatrix3(t){return Oe(this,this,t),this.check()}transformByMatrix2(t){return Vo(this,this,t),this.check()}transformByQuaternion(t){return zo(this,this,t),this.check()}};var ve=class extends St{toString(){let t="[";if(I.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=L(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function $o(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function ti(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=t[4],c=t[5],a=t[6],f=t[7],l=t[8],h=l*i-c*f,A=-l*o+c*a,p=f*o-i*a,m=n*h+r*A+s*p;return m?(m=1/m,e[0]=h*m,e[1]=(-l*r+s*f)*m,e[2]=(c*r-s*i)*m,e[3]=A*m,e[4]=(l*n-s*a)*m,e[5]=(-c*n+s*o)*m,e[6]=p*m,e[7]=(-f*n+r*a)*m,e[8]=(i*n-r*o)*m,e):null}function ei(e){let t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],i=e[5],c=e[6],a=e[7],f=e[8];return t*(f*o-i*a)+n*(-f*s+i*c)+r*(a*s-o*c)}function zn(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],A=n[0],p=n[1],m=n[2],d=n[3],u=n[4],B=n[5],E=n[6],g=n[7],x=n[8];return e[0]=A*r+p*i+m*f,e[1]=A*s+p*c+m*l,e[2]=A*o+p*a+m*h,e[3]=d*r+u*i+B*f,e[4]=d*s+u*c+B*l,e[5]=d*o+u*a+B*h,e[6]=E*r+g*i+x*f,e[7]=E*s+g*c+x*l,e[8]=E*o+g*a+x*h,e}function ni(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],A=n[0],p=n[1];return e[0]=r,e[1]=s,e[2]=o,e[3]=i,e[4]=c,e[5]=a,e[6]=A*r+p*i+f,e[7]=A*s+p*c+l,e[8]=A*o+p*a+h,e}function ri(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],A=Math.sin(n),p=Math.cos(n);return e[0]=p*r+A*i,e[1]=p*s+A*c,e[2]=p*o+A*a,e[3]=p*i-A*r,e[4]=p*c-A*s,e[5]=p*a-A*o,e[6]=f,e[7]=l,e[8]=h,e}function Qn(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function si(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n+n,c=r+r,a=s+s,f=n*i,l=r*i,h=r*c,A=s*i,p=s*c,m=s*a,d=o*i,u=o*c,B=o*a;return e[0]=1-h-m,e[3]=l-B,e[6]=A+u,e[1]=l+B,e[4]=1-f-m,e[7]=p-d,e[2]=A-u,e[5]=p+d,e[8]=1-f-h,e}var Wn;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(Wn||(Wn={}));var Wf=Object.freeze([1,0,0,0,1,0,0,0,1]),$=class extends ve{static get IDENTITY(){return Zf()}static get ZERO(){return qf()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Wn}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return 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.check()}identity(){return this.copy(Wf)}fromObject(t){return this.check()}fromQuaternion(t){return si(this,t),this.check()}set(t,n,r,s,o,i,c,a,f){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=o,this[5]=i,this[6]=c,this[7]=a,this[8]=f,this.check()}setRowMajor(t,n,r,s,o,i,c,a,f){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=o,this[5]=a,this[6]=r,this[7]=i,this[8]=f,this.check()}determinant(){return ei(this)}transpose(){return $o(this,this),this.check()}invert(){return ti(this,this),this.check()}multiplyLeft(t){return zn(this,t,this),this.check()}multiplyRight(t){return zn(this,this,t),this.check()}rotate(t){return ri(this,this,t),this.check()}scale(t){return Array.isArray(t)?Qn(this,this,t):Qn(this,this,[t,t]),this.check()}translate(t){return ni(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=Ko(n||[-0,-0],t,this);break;case 3:r=Oe(n||[-0,-0,-0],t,this);break;case 4:r=jo(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ho(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},Pe,we=null;function qf(){return Pe||(Pe=new $([0,0,0,0,0,0,0,0,0]),Object.freeze(Pe)),Pe}function Zf(){return we||(we=new $,Object.freeze(we)),we}var Ue="KHR_texture_transform",$f=Ue,Ne=new ft,tl=new $,el=new $;async function nl(e,t){if(!new _(e).hasExtension(Ue)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let o=0;o<s.length;o++)rl(o,e)}function rl(e,t){let n=t.json.materials?.[e],r=[n?.pbrMetallicRoughness?.baseColorTexture,n?.emissiveTexture,n?.normalTexture,n?.occlusionTexture,n?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let o of r)o&&o?.extensions?.[Ue]&&sl(t,e,o,s)}function sl(e,t,n,r){let s=ol(n,r);if(!s)return;let o=e.json.meshes||[];for(let i of o)for(let c of i.primitives){let a=c.material;Number.isFinite(a)&&t===a&&il(e,c,s)}}function ol(e,t){let n=e.extensions?.[Ue],{texCoord:r=0}=e,{texCoord:s=r}=n;if(!(t.findIndex(([i,c])=>i===r&&c===s)!==-1)){let i=fl(n);return r!==s&&(e.texCoord=s),t.push([r,s]),{originalTexCoord:r,texCoord:s,matrix:i}}return null}function il(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:o}=n,i=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(i)){let c=e.json.accessors?.[i];if(c&&c.bufferView){let a=e.json.bufferViews?.[c.bufferView];if(a){let{arrayBuffer:f,byteOffset:l}=e.buffers[a.buffer],h=(l||0)+(c.byteOffset||0)+(a.byteOffset||0),{ArrayType:A,length:p}=Et(c,a),m=_e[c.componentType],d=Ee[c.type],u=a.byteStride||m*d,B=new Float32Array(p);for(let E=0;E<c.count;E++){let g=new A(f,h+E*u,2);Ne.set(g[0],g[1],1),Ne.transformByMatrix3(o),B.set([Ne[0],Ne[1]],E*d)}r===s?cl(c,a,e.buffers,B):al(s,c,t,e,B)}}}}function cl(e,t,n,r){e.componentType=5126,n.push({arrayBuffer:r.buffer,byteOffset:0,byteLength:r.buffer.byteLength}),t.buffer=n.length-1,t.byteLength=r.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function al(e,t,n,r,s){r.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let o=r.json.bufferViews;if(!o)return;o.push({buffer:r.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let i=r.json.accessors;i&&(i.push({bufferView:o?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),n.attributes[`TEXCOORD_${e}`]=i.length-1)}function fl(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new $().set(1,0,0,0,1,0,t[0],t[1],1),o=tl.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),i=el.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var Zn={};N(Zn,{decode:()=>hl,encode:()=>Al,name:()=>ll});var lt="KHR_lights_punctual",ll=lt;async function hl(e){let t=new _(e),{json:n}=t,r=t.getExtension(lt);r&&(t.json.lights=r.lights,t.removeExtension(lt));for(let s of n.nodes||[]){let o=t.getObjectExtension(s,lt);o&&(s.light=o.light),t.removeObjectExtension(s,lt)}}async function Al(e){let t=new _(e),{json:n}=t;if(n.lights){let r=t.addExtension(lt);b(!r.lights),r.lights=n.lights,delete n.lights}if(t.json.lights){for(let r of t.json.lights){let s=r.node;t.addObjectExtension(s,lt,r)}delete t.json.lights}}var $n={};N($n,{decode:()=>ml,encode:()=>dl,name:()=>pl});var Qt="KHR_materials_unlit",pl=Qt;async function ml(e){let t=new _(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,Qt);t.removeExtension(Qt)}function dl(e){let t=new _(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,Qt,{}),t.addExtension(Qt))}var tr={};N(tr,{decode:()=>gl,encode:()=>Bl,name:()=>ul});var Wt="KHR_techniques_webgl",ul=Wt;async function gl(e){let t=new _(e),{json:n}=t,r=t.getExtension(Wt);if(r){let s=xl(r,t);for(let o of n.materials||[]){let i=t.getObjectExtension(o,Wt);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=Ml(o.technique,t)),t.removeObjectExtension(o,Wt)}t.removeExtension(Wt)}}async function Bl(e,t){}function xl(e,t){let{programs:n=[],shaders:r=[],techniques:s=[]}=e,o=new TextDecoder;return r.forEach(i=>{if(Number.isFinite(i.bufferView))i.code=o.decode(t.getTypedArrayForBufferView(i.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),n.forEach(i=>{i.fragmentShader=r[i.fragmentShader],i.vertexShader=r[i.vertexShader]}),s.forEach(i=>{i.program=n[i.program]}),s}function Ml(e,t){let n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(r=>{e.uniforms[r].value&&!(r in n)&&(n[r]=e.uniforms[r].value)}),Object.keys(n).forEach(r=>{typeof n[r]=="object"&&n[r].index!==void 0&&(n[r].texture=t.getTexture(n[r].index))}),n}var oi=[Ln,Rn,wn,Nn,Un,Vn,Zn,$n,tr,qn,Fn];function ii(e,t={},n){let r=oi.filter(s=>ai(s.name,t));for(let s of r)s.preprocess?.(e,t,n)}async function ci(e,t={},n){let r=oi.filter(s=>ai(s.name,t));for(let s of r)await s.decode?.(e,t,n)}function ai(e,t){let n=t?.gltf?.excludeExtensions||{};return!(e in n&&!n[e])}var er="KHR_binary_glTF";function fi(e){let t=new _(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,er);s&&Object.assign(r,s),t.removeObjectExtension(r,er)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(er)}var li={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},El={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},nr=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),fi(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let n in li)this._convertTopLevelObjectToArray(t,n)}_convertTopLevelObjectToArray(t,n){let r=t[n];if(!(!r||Array.isArray(r))){t[n]=[];for(let s in r){let o=r[s];o.id=o.id||s;let i=t[n].length;t[n].push(o),this.idToIndexMap[n][s]=i}}}_convertObjectIdsToArrayIndices(t){for(let n in li)this._convertIdsToIndices(t,n);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let n of t.textures)this._convertTextureIds(n);for(let n of t.meshes)this._convertMeshIds(n);for(let n of t.nodes)this._convertNodeIds(n);for(let n of t.scenes)this._convertSceneIds(n)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let n of t.primitives){let{attributes:r,indices:s,material:o}=n;for(let i in r)r[i]=this._convertIdToIndex(r[i],"accessor");s&&(n.indices=this._convertIdToIndex(s,"accessor")),o&&(n.material=this._convertIdToIndex(o,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(n=>this._convertIdToIndex(n,"node"))),t.meshes&&(t.meshes=t.meshes.map(n=>this._convertIdToIndex(n,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(n=>this._convertIdToIndex(n,"node")))}_convertIdsToIndices(t,n){t[n]||(console.warn(`gltf v1: json doesn't contain attribute ${n}`),t[n]=[]);for(let r of t[n])for(let s in r){let o=r[s],i=this._convertIdToIndex(o,s);r[s]=i}}_convertIdToIndex(t,n){let r=El[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let n of t.materials){n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let r=n.values?.tex||n.values?.texture2d_0||n.values?.diffuseTex,s=t.textures.findIndex(o=>o.id===r);s!==-1&&(n.pbrMetallicRoughness.baseColorTexture={index:s})}}};function hi(e,t={}){return new nr().normalize(e,t)}async function Ai(e,t,n=0,r,s){return _l(e,t,n,r),hi(e,{normalize:r?.gltf?.normalize}),ii(e,r,s),r?.gltf?.loadBuffers&&e.json.buffers&&await Tl(e,r,s),r?.gltf?.loadImages&&await yl(e,r,s),await ci(e,r,s),e}function _l(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!bo(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=cn(t);else if(t instanceof ArrayBuffer){let i={};n=Ro(i,t,n,r.glb),b(i.type==="glTF",`Invalid GLB magic string ${i.type}`),e._glb=i,e.json=i.json}else b(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:i}=e._glb;e.buffers[0]={arrayBuffer:i[0].arrayBuffer,byteOffset:i[0].byteOffset,byteLength:i[0].byteLength}}let o=e.json.images||[];e.images=new Array(o.length).fill({})}async function Tl(e,t,n){let r=e.json.buffers||[];for(let s=0;s<r.length;++s){let o=r[s];if(o.uri){let{fetch:i}=n;b(i);let c=vn(o.uri,t),f=await(await n?.fetch?.(c))?.arrayBuffer?.();e.buffers[s]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete o.uri}else e.buffers[s]===null&&(e.buffers[s]={arrayBuffer:new ArrayBuffer(o.byteLength),byteOffset:0,byteLength:o.byteLength})}}async function yl(e,t,n){let r=bl(e),s=e.json.images||[],o=[];for(let i of r)o.push(Rl(e,s[i],i,t,n));return await Promise.all(o)}function bl(e){let t=new Set,n=e.json.textures||[];for(let r of n)r.source!==void 0&&t.add(r.source);return Array.from(t).sort()}async function Rl(e,t,n,r,s){let o;if(t.uri&&!t.hasOwnProperty("bufferView")){let c=vn(t.uri,r),{fetch:a}=s;o=await(await a(c)).arrayBuffer(),t.bufferView={data:o}}if(Number.isFinite(t.bufferView)){let c=go(e.json,e.buffers,t.bufferView);o=Xt(c.buffer,c.byteOffset,c.byteLength)}b(o,"glTF image has no data");let i=await Jt(o,[xn,mn],{...r,mimeType:t.mimeType,basis:r.basis||{format:ue()}},s);i&&i[0]&&(i={compressed:!0,mipmaps:!1,width:i[0].width,height:i[0].height,data:i[0]}),e.images=e.images||[],e.images[n]=i}var qt={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:To,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:Il,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function Il(e,t={},n){t={...qt.options,...t},t.gltf={...qt.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await Ai({},e,r,t,n)}var Sl={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ll={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},H={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},Fl={magFilter:H.TEXTURE_MAG_FILTER,minFilter:H.TEXTURE_MIN_FILTER,wrapS:H.TEXTURE_WRAP_S,wrapT:H.TEXTURE_WRAP_T},Dl={[H.TEXTURE_MAG_FILTER]:H.LINEAR,[H.TEXTURE_MIN_FILTER]:H.NEAREST_MIPMAP_LINEAR,[H.TEXTURE_WRAP_S]:H.REPEAT,[H.TEXTURE_WRAP_T]:H.REPEAT};function Ol(){return{id:"default-sampler",parameters:Dl}}function Gl(e){return Ll[e]}function vl(e){return Sl[e]}var rr=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,n={}){let{json:r,buffers:s=[],images:o=[]}=t,{baseUri:i=""}=t;return b(r),this.baseUri=i,this.buffers=s,this.images=o,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t,n={}){let r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,o)=>this._resolveBufferView(s,o))),t.images&&(r.images=t.images.map((s,o)=>this._resolveImage(s,o))),t.samplers&&(r.samplers=t.samplers.map((s,o)=>this._resolveSampler(s,o))),t.textures&&(r.textures=t.textures.map((s,o)=>this._resolveTexture(s,o))),t.accessors&&(r.accessors=t.accessors.map((s,o)=>this._resolveAccessor(s,o))),t.materials&&(r.materials=t.materials.map((s,o)=>this._resolveMaterial(s,o))),t.meshes&&(r.meshes=t.meshes.map((s,o)=>this._resolveMesh(s,o))),t.nodes&&(r.nodes=t.nodes.map((s,o)=>this._resolveNode(s,o)),r.nodes=r.nodes.map((s,o)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,o)=>this._resolveSkin(s,o))),t.scenes&&(r.scenes=t.scenes.map((s,o)=>this._resolveScene(s,o))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,o)=>{let i=this.getMesh(o);return s.id=i.id,s.primitives=s.primitives.concat(i.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let o={...s,attributes:{},indices:void 0,material:void 0},i=s.attributes;for(let c in i)o.attributes[c]=this.getAccessor(i[c]);return s.indices!==void 0&&(o.indices=this.getAccessor(s.indices)),s.material!==void 0&&(o.material=this.getMaterial(s.material)),o})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return r}_resolveAccessor(t,n){let r=Gl(t.componentType),s=vl(t.type),o=r*s,i={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(i.bufferView=this.getBufferView(t.bufferView)),i.bufferView){let c=i.bufferView.buffer,{ArrayType:a,byteLength:f}=Et(i,i.bufferView),l=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+c.byteOffset,h=c.arrayBuffer.slice(l,l+f);i.bufferView.byteStride&&(h=this._getValueFromInterleavedBuffer(c,l,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new a(h)}return i}_getValueFromInterleavedBuffer(t,n,r,s,o){let i=new Uint8Array(o*s);for(let c=0;c<o;c++){let a=n+c*r;i.set(new Uint8Array(t.arrayBuffer.slice(a,a+s)),c*s)}return i.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):Ol(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,n){let r={id:t.id||`sampler-${n}`,...t,parameters:{}};for(let s in r){let o=this._enumSamplerParameter(s);o!==void 0&&(r.parameters[o]=r[s])}return r}_enumSamplerParameter(t){return Fl[t]}_resolveImage(t,n){let r={...t,id:t.id||`image-${n}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[n];return s&&(r.image=s),r}_resolveBufferView(t,n){let r=t.buffer,s=this.buffers[r].arrayBuffer,o=this.buffers[r].byteOffset||0;return t.byteOffset&&(o+=t.byteOffset),{id:`bufferView-${n}`,...t,buffer:this.buffers[r],data:new Uint8Array(s,o,t.byteLength)}}_resolveCamera(t,n){let r={...t,id:t.id||`camera-${n}`};return r.perspective,r.orthographic,r}};function sr(e,t){return new rr().postProcess(e,t)}async function pi(e){let t=[];return e.scenes.forEach(n=>{n.traverse(r=>{Object.values(r.model.uniforms).forEach(s=>{s.loaded===!1&&t.push(s)})})}),await Pl(()=>t.some(n=>!n.loaded))}async function Pl(e){for(;e();)await new Promise(t=>requestAnimationFrame(t))}var mi=`uniform scenegraphUniforms { float sizeScale; float sizeMinPixels; float sizeMaxPixels; mat4 sceneModelMatrix; bool composeModelMatrix; } scenegraph; `,di={name:"scenegraph",vs:mi,fs:mi,uniformTypes:{sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",sceneModelMatrix:"mat4x4<f32>",composeModelMatrix:"f32"}};var ui=`#version 300 es #define SHADER_NAME scenegraph-layer-vertex-shader in vec3 instancePositions; in vec3 instancePositions64Low; in vec4 instanceColors; in vec3 instancePickingColors; in vec3 instanceModelMatrixCol0; in vec3 instanceModelMatrixCol1; in vec3 instanceModelMatrixCol2; in vec3 instanceTranslation; in vec3 positions; #ifdef HAS_UV in vec2 texCoords; #endif #ifdef LIGHTING_PBR #ifdef HAS_NORMALS in vec3 normals; #endif #endif out vec4 vColor; #ifndef LIGHTING_PBR #ifdef HAS_UV out vec2 vTEXCOORD_0; #endif #endif void main(void) { #if defined(HAS_UV) && !defined(LIGHTING_PBR) vTEXCOORD_0 = texCoords; geometry.uv = texCoords; #endif geometry.worldPosition = instancePositions; geometry.pickingColor = instancePickingColors; mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); vec3 normal = vec3(0.0, 0.0, 1.0); #ifdef LIGHTING_PBR #ifdef HAS_NORMALS normal = instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(normals, 0.0)).xyz; #endif #endif float originalSize = project_size_to_pixel(scenegraph.sizeScale); float clampedSize = clamp(originalSize, scenegraph.sizeMinPixels, scenegraph.sizeMaxPixels); vec3 pos = (instanceModelMatrix * (scenegraph.sceneModelMatrix * vec4(positions, 1.0)).xyz) * scenegraph.sizeScale * (clampedSize / originalSize) + instanceTranslation; if(scenegraph.composeModelMatrix) { DECKGL_FILTER_SIZE(pos, geometry); geometry.normal = project_normal(normal); geometry.worldPosition += pos; gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), geometry.position); } else { pos = project_size(pos); DECKGL_FILTER_SIZE(pos, geometry); gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, geometry.position); geometry.normal = project_normal(normal); } DECKGL_FILTER_GL_POSITION(gl_Position, geometry); #ifdef LIGHTING_PBR pbr_vPosition = geometry.position.xyz; #ifdef HAS_NORMALS pbr_vNormal = geometry.normal; #endif #ifdef HAS_UV pbr_vUV = texCoords; #else pbr_vUV = vec2(0., 0.); #endif geometry.uv = pbr_vUV; #endif vColor = instanceColors; DECKGL_FILTER_COLOR(vColor, geometry); } `;var gi=`#version 300 es #define SHADER_NAME scenegraph-layer-fragment-shader in vec4 vColor; out vec4 fragColor; #ifndef LIGHTING_PBR #if defined(HAS_UV) && defined(HAS_BASECOLORMAP) in vec2 vTEXCOORD_0; uniform sampler2D pbr_baseColorSampler; #endif #endif void main(void) { #ifdef LIGHTING_PBR fragColor = vColor * pbr_filterColor(vec4(0)); geometry.uv = pbr_vUV; #else #if defined(HAS_UV) && defined(HAS_BASECOLORMAP) fragColor = vColor * texture(pbr_baseColorSampler, vTEXCOORD_0); geometry.uv = vTEXCOORD_0; #else fragColor = vColor; #endif #endif fragColor.a *= layer.opacity; DECKGL_FILTER_COLOR(fragColor, geometry); } `;var Bi=[255,255,255,255],wl={scenegraph:{type:"object",value:null,async:!0},getScene:e=>e&&e.scenes?typeof e.scene=="object"?e.scene:e.scenes[e.scene||0]:e,getAnimator:e=>e&&e.animator,_animations:null,sizeScale:{type:"number",value:1,min:0},sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},getPosition:{type:"accessor",value:e=>e.position},getColor:{type:"accessor",value:Bi},_lighting:"flat",_imageBasedLightingEnvironment:void 0,getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},loaders:[qt]},Zt=class extends W.Layer{getShaders(){let t={},n;this.props._lighting==="pbr"?(n=wt,t.LIGHTING_PBR=1):n={name:"pbrMaterial"};let r=[W.project32,W.picking,di,n];return super.getShaders({defines:t,vs:ui,fs:gi,modules:r})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),accessor:"getPosition",transition:!0},instanceColors:{type:"unorm8",size:this.props.colorFormat.length,accessor:"getColor",defaultValue:Bi,transition:!0},instanceModelMatrix:he})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.scenegraph!==r.scenegraph?this._updateScenegraph():n._animations!==r._animations&&this._applyAnimationsProp(this.state.animator,n._animations)}finalizeState(t){super.finalizeState(t),this.state.scenegraph?.destroy()}get isLoaded(){return Boolean(this.state?.scenegraph&&super.isLoaded)}_updateScenegraph(){let t=this.props,{device:n}=this.context,r=null;if(t.scenegraph instanceof ht.ScenegraphNode)r={scenes:[t.scenegraph]};else if(t.scenegraph&&typeof t.scenegraph=="object"){let c=t.scenegraph,a=c.json?sr(c):c,f=bn(n,a,this._getModelOptions());r={gltf:a,...f},pi(f).then(()=>{this.setNeedsRedraw()}).catch(l=>{this.raiseError(l,"loading glTF")})}let s={layer:this,device:this.context.device},o=t.getScene(r,s),i=t.getAnimator(r,s);if(o instanceof ht.GroupNode){this.state.scenegraph?.destroy(),this._applyAnimationsProp(i,t._animations);let c=[];o.traverse(a=>{a instanceof ht.ModelNode&&c.push(a.model)}),this.setState({scenegraph:o,animator:i,models:c}),this.getAttributeManager().invalidateAll()}else o!==null&&W.log.warn("invalid scenegraph:",o)()}_applyAnimationsProp(t,n){if(!t||!n)return;let r=t.getAnimations();Object.keys(n).sort().forEach(s=>{let o=n[s];if(s==="*")r.forEach(i=>{Object.assign(i,o)});else if(Number.isFinite(Number(s))){let i=Number(s);i>=0&&i<r.length?Object.assign(r[i],o):W.log.warn(`animation ${s} not found`)()}else{let i=r.find(({name:c})=>c===s);i?Object.assign(i,o):W.log.warn(`animation ${s} not found`)()}})}_getModelOptions(){let{_imageBasedLightingEnvironment:t}=this.props,n;return t&&(typeof t=="function"?n=t({gl:this.context.gl,layer:this}):n=t),{imageBasedLightingEnvironment:n,modelOptions:{id:this.props.id,isInstanced:!0,bufferLayout:this.getAttributeManager().getBufferLayouts(),...this.getShaders()},useTangents:!1}}draw({context:t}){if(!this.state.scenegraph)return;this.props._animations&&this.state.animator&&(this.state.animator.animate(t.timeline.getTime()),this.setNeedsRedraw());let{viewport:n,renderPass:r}=this.context,{sizeScale:s,sizeMinPixels:o,sizeMaxPixels:i,coordinateSystem:c}=this.props,a=this.getNumInstances();this.state.scenegraph.traverse((f,{worldMatrix:l})=>{if(f instanceof ht.ModelNode){let{model:h}=f;h.setInstanceCount(a);let A={camera:h.uniforms.cameraPosition},p={sizeScale:s,sizeMinPixels:o,sizeMaxPixels:i,composeModelMatrix:Ae(n,c),sceneModelMatrix:l};h.shaderInputs.setProps({pbrProjection:A,scenegraph:p}),h.draw(r)}})}};Zt.defaultProps=wl;Zt.layerName="ScenegraphLayer";var xi=Zt;return yi($t);})(); return __exports__; });