(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 Xo=Object.create;var $e=Object.defineProperty;var jo=Object.getOwnPropertyDescriptor;var Vo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,Qo=Object.prototype.hasOwnProperty;var Gt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),w=(t,e)=>{for(var n in e)$e(t,n,{get:e[n],enumerable:!0})},Ze=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vo(e))!Qo.call(t,s)&&s!==n&&$e(t,s,{get:()=>e[s],enumerable:!(r=jo(e,s))||r.enumerable});return t},ee=(t,e,n)=>(Ze(t,e,"default"),n&&Ze(n,e,"default")),G=(t,e,n)=>(n=t!=null?Xo(ko(t)):{},Ze(e||!t||!t.__esModule?$e(n,"default",{value:t,enumerable:!0}):n,t)),Yo=t=>Ze($e({},"__esModule",{value:!0}),t);var Ae=Gt((qf,zn)=>{zn.exports=globalThis.deck});var Se=Gt(($f,Zn)=>{Zn.exports=globalThis.luma});var Fe=Gt((el,$n)=>{$n.exports=globalThis.luma});var qe={};w(qe,{ScenegraphLayer:()=>Ko,SimpleMeshLayer:()=>fr});var X={},qn=G(Ae(),1);ee(X,G(Ae(),1));if(!qn.Layer)throw new Error("@deck.gl/core is not found");ee(qe,X);var j=G(Ae(),1),ar=G(Se(),1),he=G(Fe(),1);var me=G(Ae(),1),Pt=Math.PI/180,et=new Float32Array(16),er=new Float32Array(12);function tr(t,e,n){let r=e[0]*Pt,s=e[1]*Pt,o=e[2]*Pt,i=Math.sin(o),c=Math.sin(r),a=Math.sin(s),f=Math.cos(o),l=Math.cos(r),A=Math.cos(s),m=n[0],h=n[1],u=n[2];t[0]=m*A*l,t[1]=m*a*l,t[2]=m*-c,t[3]=h*(-a*f+A*c*i),t[4]=h*(A*f+a*c*i),t[5]=h*l*i,t[6]=u*(a*i+A*c*f),t[7]=u*(-A*i+a*c*f),t[8]=u*l*f}function nr(t){return t[0]=t[0],t[1]=t[1],t[2]=t[2],t[3]=t[4],t[4]=t[5],t[5]=t[6],t[6]=t[8],t[7]=t[9],t[8]=t[10],t[9]=t[12],t[10]=t[13],t[11]=t[14],t.subarray(0,12)}var tt={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(t,{startRow:e,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),A=Array.isArray(s),m=Array.isArray(i),h=f||!a&&Boolean(c(r[0]));h?t.constant=f:t.constant=A&&l&&m;let u=t.value;if(t.constant){let p;h?(et.set(c),p=nr(et)):(p=er,tr(p,s,o),p.set(i,9)),t.value=new Float32Array(p)}else{let p=e*t.size,{iterable:B,objectInfo:g}=(0,me.createIterable)(r,e,n);for(let M of B){g.index++;let d;if(h)et.set(f?c:c(M,g)),d=nr(et);else{d=er;let x=A?s:s(M,g),C=l?o:o(M,g);tr(d,x,C),d.set(m?i:i(M,g),9)}u[p++]=d[0],u[p++]=d[1],u[p++]=d[2],u[p++]=d[3],u[p++]=d[4],u[p++]=d[5],u[p++]=d[6],u[p++]=d[7],u[p++]=d[8],u[p++]=d[9],u[p++]=d[10],u[p++]=d[11]}}}};function nt(t,e){return e===me.COORDINATE_SYSTEM.CARTESIAN||e===me.COORDINATE_SYSTEM.METER_OFFSETS||e===me.COORDINATE_SYSTEM.DEFAULT&&!t.isGeospatial}var rr=`#version 300 es #define SHADER_NAME simple-mesh-layer-vs uniform float sizeScale; uniform bool composeModelMatrix; 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_uCameraPosition; vColor = vec4(colors * instanceColors.rgb, instanceColors.a); mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2); vec3 pos = (instanceModelMatrix * positions) * sizeScale + instanceTranslation; if (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 sr=`#version 300 es #define SHADER_NAME simple-mesh-layer-fs precision highp float; uniform bool hasTexture; uniform sampler2D sampler; uniform bool flatShading; uniform float opacity; 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 (flatShading) { normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); } else { normal = normals_commonspace; } vec4 color = 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 * opacity); } `;function or(t){switch(t.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 De(t){let e=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,i=-1/0,c=t.POSITION?t.POSITION.value:[],a=c&&c.length;for(let f=0;fs?l:s,o=A>o?A:o,i=m>i?m:i}return[[e,n,r],[s,o,i]]}function wt(t,e,n){let r=or(e.value),s=n||ir(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function ir(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function Ut(t){let e=t.positions||t.POSITION;j.log.assert(e,'no "postions" or "POSITION" attribute in mesh');let n=e.value.length/e.size,r=t.COLOR_0||t.colors;r||(r={size:3,value:new Float32Array(n*3).fill(1)});let s=t.NORMAL||t.normals;s||(s={size:3,value:new Float32Array(n*3).fill(0)});let o=t.TEXCOORD_0||t.texCoords;return o||(o={size:2,value:new Float32Array(n*2).fill(0)}),{positions:e,colors:r,normals:s,texCoords:o}}function cr(t){return t instanceof he.Geometry?(t.attributes=Ut(t.attributes),t):t.attributes?new he.Geometry({...t,topology:"triangle-list",attributes:Ut(t.attributes)}):new he.Geometry({topology:"triangle-list",attributes:Ut(t)})}var Wo=[0,0,0,255],zo={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:t=>t.position},getColor:{type:"accessor",value:Wo},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}},Oe=class extends j.Layer{getShaders(){return super.getShaders({vs:rr,fs:sr,modules:[j.project32,j.phongLighting,j.picking]})}getBounds(){if(this.props._instanced)return super.getBounds();let e=this.state.positionBounds;if(e)return e;let{mesh:n}=this.props;if(!n)return null;if(e=n.header?.boundingBox,!e){let{attributes:r}=cr(n);r.POSITION=r.POSITION||r.positions,e=De(r)}return this.state.positionBounds=e,e}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:tt}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(e){super.updateState(e);let{props:n,oldProps:r,changeFlags:s}=e;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 ar.Texture&&this.setTexture(n.texture),this.state.model&&this.state.model.setTopology(this.props.wireframe?"line-strip":"triangle-list")}finalizeState(e){super.finalizeState(e),this.state.emptyTexture.delete()}draw({uniforms:e}){let{model:n}=this.state;if(!n)return;let{viewport:r,renderPass:s}=this.context,{sizeScale:o,coordinateSystem:i,_instanced:c}=this.props;n.setUniforms(e),n.setUniforms({sizeScale:o,composeModelMatrix:!c||nt(r,i),flatShading:!this.state.hasNormals}),n.draw(s)}get isLoaded(){return Boolean(this.state?.model&&super.isLoaded)}getModel(e){let n=new he.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:cr(e),isInstanced:!0}),{texture:r}=this.props,{emptyTexture:s}=this.state;return n.setBindings({sampler:r||s}),n.setUniforms({hasTexture:Boolean(r)}),n}setTexture(e){let{emptyTexture:n,model:r}=this.state;r&&(r.setBindings({sampler:e||n}),r.setUniforms({hasTexture:Boolean(e)}))}};Oe.defaultProps=zo;Oe.layerName="SimpleMeshLayer";var fr=Oe;var W=G(Ae(),1);var gl=1/Math.PI*180,xl=1/180*Math.PI,qo={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...qo}};var b=globalThis.mathgl.config;function lr(t,{precision:e=b.precision}={}){return t=Zo(t),`${parseFloat(t.toPrecision(e))}`}function te(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function vt(t,e,n){let r=b.EPSILON;n&&(b.EPSILON=n);try{if(t===e)return!0;if(te(t)&&te(e)){if(t.length!==e.length)return!1;for(let s=0;s0?", ":"")+lr(this[r],e);return`${e.printTypes?this.constructor.name:""}[${n}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let n=0;n=0&&e=0&&e0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Kt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function pe(t,e,n){let r=e[0],s=e[1],o=e[2],i=n[0],c=n[1],a=n[2];return t[0]=s*a-o*c,t[1]=o*i-r*a,t[2]=r*c-s*i,t}function de(t,e,n){let r=e[0],s=e[1],o=e[2],i=n[3]*r+n[7]*s+n[11]*o+n[15];return i=i||1,t[0]=(n[0]*r+n[4]*s+n[8]*o+n[12])/i,t[1]=(n[1]*r+n[5]*s+n[9]*o+n[13])/i,t[2]=(n[2]*r+n[6]*s+n[10]*o+n[14])/i,t}function ot(t,e,n){let r=e[0],s=e[1],o=e[2];return t[0]=r*n[0]+s*n[3]+o*n[6],t[1]=r*n[1]+s*n[4]+o*n[7],t[2]=r*n[2]+s*n[5]+o*n[8],t}function it(t,e,n){let r=n[0],s=n[1],o=n[2],i=n[3],c=e[0],a=e[1],f=e[2],l=s*f-o*a,A=o*c-r*f,m=r*a-s*c,h=s*m-o*A,u=o*l-r*m,p=r*A-s*l,B=i*2;return l*=B,A*=B,m*=B,h*=2,u*=2,p*=2,t[0]=c+l+h,t[1]=a+A+u,t[2]=f+m+p,t}function xr(t,e,n,r){let s=[],o=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[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),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function Cr(t,e,n,r){let s=[],o=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[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),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function Er(t,e,n,r){let s=[],o=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[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],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function Mr(t,e){let n=t[0],r=t[1],s=t[2],o=e[0],i=e[1],c=e[2],a=Math.sqrt((n*n+r*r+s*s)*(o*o+i*i+c*c)),f=a&&Kt(t,e)/a;return Math.acos(Math.min(Math.max(f,-1),1))}var _r=ti;var Gl=function(){let t=Ht();return function(e,n,r,s,o,i){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,e.length):a=e.length,c=r;c0?this.copy([e,...n]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(si)}fromObject(e){return this.check()}fromQuaternion(e){return Fr(this,e),this.check()}set(e,n,r,s,o,i,c,a,f){return this[0]=e,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(e,n,r,s,o,i,c,a,f){return this[0]=e,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 Rr(this)}transpose(){return yr(this,this),this.check()}invert(){return br(this,this),this.check()}multiplyLeft(e){return jt(this,e,this),this.check()}multiplyRight(e){return jt(this,this,e),this.check()}rotate(e){return Sr(this,this,e),this.check()}scale(e){return Array.isArray(e)?Vt(this,this,e):Vt(this,this,[e,e]),this.check()}translate(e){return Ir(this,this,e),this.check()}transform(e,n){let r;switch(e.length){case 2:r=hr(n||[-0,-0],e,this);break;case 3:r=ot(n||[-0,-0,-0],e,this);break;case 4:r=st(n||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return re(r,e.length),r}transformVector(e,n){return this.transform(e,n)}transformVector2(e,n){return this.transform(e,n)}transformVector3(e,n){return this.transform(e,n)}},ft,lt=null;function oi(){return ft||(ft=new q([0,0,0,0,0,0,0,0,0]),Object.freeze(ft)),ft}function ii(){return lt||(lt=new q,Object.freeze(lt)),lt}function ci(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Dr(t,e){if(t===e){let n=e[1],r=e[2],s=e[3],o=e[6],i=e[7],c=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=s,t[13]=i,t[14]=c}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Or(t,e){let n=e[0],r=e[1],s=e[2],o=e[3],i=e[4],c=e[5],a=e[6],f=e[7],l=e[8],A=e[9],m=e[10],h=e[11],u=e[12],p=e[13],B=e[14],g=e[15],M=n*c-r*i,d=n*a-s*i,x=n*f-o*i,C=r*a-s*c,E=r*f-o*c,F=s*f-o*a,D=l*p-A*u,O=l*B-m*u,L=l*g-h*u,N=A*B-m*p,H=A*g-h*p,J=m*g-h*B,y=M*J-d*H+x*N+C*L-E*O+F*D;return y?(y=1/y,t[0]=(c*J-a*H+f*N)*y,t[1]=(s*H-r*J-o*N)*y,t[2]=(p*F-B*E+g*C)*y,t[3]=(m*E-A*F-h*C)*y,t[4]=(a*L-i*J-f*O)*y,t[5]=(n*J-s*L+o*O)*y,t[6]=(B*x-u*F-g*d)*y,t[7]=(l*F-m*x+h*d)*y,t[8]=(i*H-c*L+f*D)*y,t[9]=(r*L-n*H-o*D)*y,t[10]=(u*E-p*x+g*M)*y,t[11]=(A*x-l*E-h*M)*y,t[12]=(c*O-i*N-a*D)*y,t[13]=(n*N-r*O+s*D)*y,t[14]=(p*d-u*C-B*M)*y,t[15]=(l*C-A*d+m*M)*y,t):null}function Lr(t){let e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],i=t[5],c=t[6],a=t[7],f=t[8],l=t[9],A=t[10],m=t[11],h=t[12],u=t[13],p=t[14],B=t[15],g=e*i-n*o,M=e*c-r*o,d=n*c-r*i,x=f*u-l*h,C=f*p-A*h,E=l*p-A*u,F=e*E-n*C+r*x,D=o*E-i*C+c*x,O=f*d-l*M+A*g,L=h*d-u*M+p*g;return a*F-s*D+B*O-m*L}function Qt(t,e,n){let r=e[0],s=e[1],o=e[2],i=e[3],c=e[4],a=e[5],f=e[6],l=e[7],A=e[8],m=e[9],h=e[10],u=e[11],p=e[12],B=e[13],g=e[14],M=e[15],d=n[0],x=n[1],C=n[2],E=n[3];return t[0]=d*r+x*c+C*A+E*p,t[1]=d*s+x*a+C*m+E*B,t[2]=d*o+x*f+C*h+E*g,t[3]=d*i+x*l+C*u+E*M,d=n[4],x=n[5],C=n[6],E=n[7],t[4]=d*r+x*c+C*A+E*p,t[5]=d*s+x*a+C*m+E*B,t[6]=d*o+x*f+C*h+E*g,t[7]=d*i+x*l+C*u+E*M,d=n[8],x=n[9],C=n[10],E=n[11],t[8]=d*r+x*c+C*A+E*p,t[9]=d*s+x*a+C*m+E*B,t[10]=d*o+x*f+C*h+E*g,t[11]=d*i+x*l+C*u+E*M,d=n[12],x=n[13],C=n[14],E=n[15],t[12]=d*r+x*c+C*A+E*p,t[13]=d*s+x*a+C*m+E*B,t[14]=d*o+x*f+C*h+E*g,t[15]=d*i+x*l+C*u+E*M,t}function Gr(t,e,n){let r=n[0],s=n[1],o=n[2],i,c,a,f,l,A,m,h,u,p,B,g;return e===t?(t[12]=e[0]*r+e[4]*s+e[8]*o+e[12],t[13]=e[1]*r+e[5]*s+e[9]*o+e[13],t[14]=e[2]*r+e[6]*s+e[10]*o+e[14],t[15]=e[3]*r+e[7]*s+e[11]*o+e[15]):(i=e[0],c=e[1],a=e[2],f=e[3],l=e[4],A=e[5],m=e[6],h=e[7],u=e[8],p=e[9],B=e[10],g=e[11],t[0]=i,t[1]=c,t[2]=a,t[3]=f,t[4]=l,t[5]=A,t[6]=m,t[7]=h,t[8]=u,t[9]=p,t[10]=B,t[11]=g,t[12]=i*r+l*s+u*o+e[12],t[13]=c*r+A*s+p*o+e[13],t[14]=a*r+m*s+B*o+e[14],t[15]=f*r+h*s+g*o+e[15]),t}function Pr(t,e,n){let r=n[0],s=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function wr(t,e,n,r){let s=r[0],o=r[1],i=r[2],c=Math.sqrt(s*s+o*o+i*i),a,f,l,A,m,h,u,p,B,g,M,d,x,C,E,F,D,O,L,N,H,J,y,Ie;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,A=e[0],m=e[1],h=e[2],u=e[3],p=e[4],B=e[5],g=e[6],M=e[7],d=e[8],x=e[9],C=e[10],E=e[11],F=s*s*l+a,D=o*s*l+i*f,O=i*s*l-o*f,L=s*o*l-i*f,N=o*o*l+a,H=i*o*l+s*f,J=s*i*l+o*f,y=o*i*l-s*f,Ie=i*i*l+a,t[0]=A*F+p*D+d*O,t[1]=m*F+B*D+x*O,t[2]=h*F+g*D+C*O,t[3]=u*F+M*D+E*O,t[4]=A*L+p*N+d*H,t[5]=m*L+B*N+x*H,t[6]=h*L+g*N+C*H,t[7]=u*L+M*N+E*H,t[8]=A*J+p*y+d*Ie,t[9]=m*J+B*y+x*Ie,t[10]=h*J+g*y+C*Ie,t[11]=u*J+M*y+E*Ie,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Ur(t,e,n){let r=Math.sin(n),s=Math.cos(n),o=e[4],i=e[5],c=e[6],a=e[7],f=e[8],l=e[9],A=e[10],m=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*s+f*r,t[5]=i*s+l*r,t[6]=c*s+A*r,t[7]=a*s+m*r,t[8]=f*s-o*r,t[9]=l*s-i*r,t[10]=A*s-c*r,t[11]=m*s-a*r,t}function vr(t,e,n){let r=Math.sin(n),s=Math.cos(n),o=e[0],i=e[1],c=e[2],a=e[3],f=e[8],l=e[9],A=e[10],m=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s-f*r,t[1]=i*s-l*r,t[2]=c*s-A*r,t[3]=a*s-m*r,t[8]=o*r+f*s,t[9]=i*r+l*s,t[10]=c*r+A*s,t[11]=a*r+m*s,t}function Nr(t,e,n){let r=Math.sin(n),s=Math.cos(n),o=e[0],i=e[1],c=e[2],a=e[3],f=e[4],l=e[5],A=e[6],m=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s+f*r,t[1]=i*s+l*r,t[2]=c*s+A*r,t[3]=a*s+m*r,t[4]=f*s-o*r,t[5]=l*s-i*r,t[6]=A*s-c*r,t[7]=m*s-a*r,t}function Hr(t,e){let n=e[0],r=e[1],s=e[2],o=e[3],i=n+n,c=r+r,a=s+s,f=n*i,l=r*i,A=r*c,m=s*i,h=s*c,u=s*a,p=o*i,B=o*c,g=o*a;return t[0]=1-A-u,t[1]=l+g,t[2]=m-B,t[3]=0,t[4]=l-g,t[5]=1-f-u,t[6]=h+p,t[7]=0,t[8]=m+B,t[9]=h-p,t[10]=1-f-A,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jr(t,e,n,r,s,o,i){let c=1/(n-e),a=1/(s-r),f=1/(o-i);return t[0]=o*2*c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*a,t[6]=0,t[7]=0,t[8]=(n+e)*c,t[9]=(s+r)*a,t[10]=(i+o)*f,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*o*2*f,t[15]=0,t}function ai(t,e,n,r,s){let o=1/Math.tan(e/2);if(t[0]=o/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let i=1/(r-s);t[10]=(s+r)*i,t[14]=2*s*r*i}else t[10]=-1,t[14]=-2*r;return t}var Kr=ai;function fi(t,e,n,r,s,o,i){let c=1/(e-n),a=1/(r-s),f=1/(o-i);return t[0]=-2*c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(e+n)*c,t[13]=(s+r)*a,t[14]=(i+o)*f,t[15]=1,t}var Xr=fi;function jr(t,e,n,r){let s,o,i,c,a,f,l,A,m,h,u=e[0],p=e[1],B=e[2],g=r[0],M=r[1],d=r[2],x=n[0],C=n[1],E=n[2];return Math.abs(u-x)<1e-6&&Math.abs(p-C)<1e-6&&Math.abs(B-E)<1e-6?ci(t):(A=u-x,m=p-C,h=B-E,s=1/Math.sqrt(A*A+m*m+h*h),A*=s,m*=s,h*=s,o=M*h-d*m,i=d*A-g*h,c=g*m-M*A,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=m*c-h*i,f=h*o-A*c,l=A*i-m*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),t[0]=o,t[1]=a,t[2]=A,t[3]=0,t[4]=i,t[5]=f,t[6]=m,t[7]=0,t[8]=c,t[9]=l,t[10]=h,t[11]=0,t[12]=-(o*u+i*p+c*B),t[13]=-(a*u+f*p+l*B),t[14]=-(A*u+m*p+h*B),t[15]=1,t)}function li(){let t=new I(4);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Vr(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function kr(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function Qr(t){let e=t[0],n=t[1],r=t[2],s=t[3];return Math.sqrt(e*e+n*n+r*r+s*s)}function Yr(t){let e=t[0],n=t[1],r=t[2],s=t[3];return e*e+n*n+r*r+s*s}function Wr(t,e){let n=e[0],r=e[1],s=e[2],o=e[3],i=n*n+r*r+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=n*i,t[1]=r*i,t[2]=s*i,t[3]=o*i,t}function zr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function qr(t,e,n,r){let s=e[0],o=e[1],i=e[2],c=e[3];return t[0]=s+r*(n[0]-s),t[1]=o+r*(n[1]-o),t[2]=i+r*(n[2]-i),t[3]=c+r*(n[3]-c),t}function Zr(t,e,n){let r=e[0],s=e[1],o=e[2],i=e[3];return t[0]=n[0]*r+n[4]*s+n[8]*o+n[12]*i,t[1]=n[1]*r+n[5]*s+n[9]*o+n[13]*i,t[2]=n[2]*r+n[6]*s+n[10]*o+n[14]*i,t[3]=n[3]*r+n[7]*s+n[11]*o+n[15]*i,t}function $r(t,e,n){let r=e[0],s=e[1],o=e[2],i=n[0],c=n[1],a=n[2],f=n[3],l=f*r+c*o-a*s,A=f*s+a*r-i*o,m=f*o+i*s-c*r,h=-i*r-c*s-a*o;return t[0]=l*f+h*-i+A*-a-m*-c,t[1]=A*f+h*-c+m*-i-l*-a,t[2]=m*f+h*-a+l*-c-A*-i,t[3]=e[3],t}var oA=function(){let t=li();return function(e,n,r,s,o,i){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,e.length):a=e.length,c=r;cMath.PI*2)throw Error("expected radians")}function Bi(t,e,n,r,s,o){let i=2*o/(n-e),c=2*o/(s-r),a=(n+e)/(n-e),f=(s+r)/(s-r),l=-1,A=-1,m=-2*o;return t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=a,t[9]=f,t[10]=l,t[11]=A,t[12]=0,t[13]=0,t[14]=m,t[15]=0,t}function ts(){let t=new I(4);return I!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function ns(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function qt(t,e,n){n=n*.5;let r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Zt(t,e,n){let r=e[0],s=e[1],o=e[2],i=e[3],c=n[0],a=n[1],f=n[2],l=n[3];return t[0]=r*l+i*c+s*f-o*a,t[1]=s*l+i*a+o*c-r*f,t[2]=o*l+i*f+r*a-s*c,t[3]=i*l-r*c-s*a-o*f,t}function rs(t,e,n){n*=.5;let r=e[0],s=e[1],o=e[2],i=e[3],c=Math.sin(n),a=Math.cos(n);return t[0]=r*a+i*c,t[1]=s*a+o*c,t[2]=o*a-s*c,t[3]=i*a-r*c,t}function ss(t,e,n){n*=.5;let r=e[0],s=e[1],o=e[2],i=e[3],c=Math.sin(n),a=Math.cos(n);return t[0]=r*a-o*c,t[1]=s*a+i*c,t[2]=o*a+r*c,t[3]=i*a-s*c,t}function os(t,e,n){n*=.5;let r=e[0],s=e[1],o=e[2],i=e[3],c=Math.sin(n),a=Math.cos(n);return t[0]=r*a+s*c,t[1]=s*a-r*c,t[2]=o*a+i*c,t[3]=i*a-o*c,t}function is(t,e){let n=e[0],r=e[1],s=e[2];return t[0]=n,t[1]=r,t[2]=s,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),t}function Ge(t,e,n,r){let s=e[0],o=e[1],i=e[2],c=e[3],a=n[0],f=n[1],l=n[2],A=n[3],m,h,u,p,B;return m=s*a+o*f+i*l+c*A,m<0&&(m=-m,a=-a,f=-f,l=-l,A=-A),1-m>1e-6?(h=Math.acos(m),B=Math.sin(h),u=Math.sin((1-r)*h)/B,p=Math.sin(r*h)/B):(u=1-r,p=r),t[0]=u*s+p*a,t[1]=u*o+p*f,t[2]=u*i+p*l,t[3]=u*c+p*A,t}function cs(t,e){let n=e[0],r=e[1],s=e[2],o=e[3],i=n*n+r*r+s*s+o*o,c=i?1/i:0;return t[0]=-n*c,t[1]=-r*c,t[2]=-s*c,t[3]=o*c,t}function as(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function $t(t,e){let n=e[0]+e[4]+e[8],r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;r=Math.sqrt(e[s*3+s]-e[o*3+o]-e[i*3+i]+1),t[s]=.5*r,r=.5/r,t[3]=(e[o*3+i]-e[i*3+o])*r,t[o]=(e[o*3+s]+e[s*3+o])*r,t[i]=(e[i*3+s]+e[s*3+i])*r}return t}var fs=Vr;var ls=kr,As=zr,ms=qr,hs=Qr;var us=Yr;var ps=Wr;var ds=function(){let t=Ht(),e=Jt(1,0,0),n=Jt(0,1,0);return function(r,s,o){let i=Kt(s,o);return i<-.999999?(pe(t,e,s),_r(t)<1e-6&&pe(t,n,s),gr(t,t),qt(r,t,Math.PI),r):i>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(pe(t,s,o),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+i,ps(r,r))}}(),xA=function(){let t=ts(),e=ts();return function(n,r,s,o,i,c){return Ge(t,r,i,c),Ge(e,s,o,c),Ge(n,t,e,2*c*(1-c)),n}}(),CA=function(){let t=Tr();return function(e,n,r,s){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],ps(e,$t(e,t))}}();var gi=[0,0,0,1],Pe=class extends ne{constructor(e=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,n,r,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,n,r,s){return this[0]=e,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return $t(this,e),this.check()}fromAxisRotation(e,n){return qt(this,e,n),this.check()}identity(){return ns(this),this.check()}setAxisAngle(e,n){return this.fromAxisRotation(e,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=_(e)}get y(){return this[1]}set y(e){this[1]=_(e)}get z(){return this[2]}set z(e){this[2]=_(e)}get w(){return this[3]}set w(e){this[3]=_(e)}len(){return hs(this)}lengthSquared(){return us(this)}dot(e){return As(this,e)}rotationTo(e,n){return ds(this,e,n),this.check()}add(e){return fs(this,this,e),this.check()}calculateW(){return is(this,this),this.check()}conjugate(){return as(this,this),this.check()}invert(){return cs(this,this),this.check()}lerp(e,n,r){return r===void 0?this.lerp(this,e,n):(ms(this,e,n,r),this.check())}multiplyRight(e){return Zt(this,this,e),this.check()}multiplyLeft(e){return Zt(this,e,this),this.check()}normalize(){let e=this.len(),n=e>0?1/e:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,e===0&&(this[3]=1),this.check()}rotateX(e){return rs(this,this,e),this.check()}rotateY(e){return ss(this,this,e),this.check()}rotateZ(e){return os(this,this,e),this.check()}scale(e){return ls(this,this,e),this.check()}slerp(e,n,r){let s,o,i;switch(arguments.length){case 1:({start:s=gi,target:o,ratio:i}=e);break;case 2:s=this,o=e,i=n;break;default:s=e,o=n,i=r}return Ge(this,s,o,i),this.check()}transformVector4(e,n=new Be){return $r(n,e,this),re(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,n){return this.setAxisAngle(e,n)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var en=`#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; }; struct DirectionalLight { vec3 color; vec3 direction; }; uniform AmbientLight lighting_uAmbientLight; uniform PointLight lighting_uPointLight[MAX_LIGHTS]; uniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS]; uniform int lighting_uPointLightCount; uniform int lighting_uDirectionalLightCount; uniform bool lighting_uEnabled; float getPointLightAttenuation(PointLight pointLight, float distance) { return pointLight.attenuation.x + pointLight.attenuation.y * distance + pointLight.attenuation.z * distance * distance; } #endif `;var xi={lightSources:{}};function tn(t={}){let{color:e=[0,0,0],intensity:n=1}=t;return e.map(r=>r*n/255)}function Ci({ambientLight:t,pointLights:e=[],directionalLights:n=[]}){let r={};return t?r["lighting_uAmbientLight.color"]=tn(t):r["lighting_uAmbientLight.color"]=[0,0,0],e.forEach((s,o)=>{r[`lighting_uPointLight[${o}].color`]=tn(s),r[`lighting_uPointLight[${o}].position`]=s.position,r[`lighting_uPointLight[${o}].attenuation`]=s.attenuation||[1,0,0]}),r.lighting_uPointLightCount=e.length,n.forEach((s,o)=>{r[`lighting_uDirectionalLight[${o}].color`]=tn(s),r[`lighting_uDirectionalLight[${o}].direction`]=s.direction}),r.lighting_uDirectionalLightCount=n.length,r}function Bs(t=xi){if("lightSources"in t){let{ambientLight:e,pointLights:n,directionalLights:r}=t.lightSources||{};return e||n&&n.length>0||r&&r.length>0?Object.assign({},Ci({ambientLight:e,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){let e={pointLights:[],directionalLights:[]};for(let n of t.lights||[])switch(n.type){case"ambient":e.ambientLight=n;break;case"directional":e.directionalLights?.push(n);break;case"point":e.pointLights?.push(n);break;default:}return Bs({lightSources:e})}return{}}var gs={name:"lights",vs:en,fs:en,getUniforms:Bs,defines:{MAX_LIGHTS:3}};var xs=`uniform mat4 u_MVPMatrix; uniform mat4 u_ModelMatrix; uniform mat4 u_NormalMatrix; 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 = u_ModelMatrix * position; pbr_vPosition = vec3(pos.xyz) / pos.w; #ifdef HAS_NORMALS #ifdef HAS_TANGENTS vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0))); vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0))); vec3 bitangentW = cross(normalW, tangentW) * tangent.w; pbr_vTBN = mat3(tangentW, bitangentW, normalW); #else pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0))); #endif #endif #ifdef HAS_UV pbr_vUV = uv; #else pbr_vUV = vec2(0.,0.); #endif } `;var Cs=`precision highp float; uniform bool pbr_uUnlit; #ifdef USE_IBL uniform samplerCube u_DiffuseEnvSampler; uniform samplerCube u_SpecularEnvSampler; uniform sampler2D u_brdfLUT; uniform vec2 u_ScaleIBLAmbient; #endif #ifdef HAS_BASECOLORMAP uniform sampler2D u_BaseColorSampler; #endif #ifdef HAS_NORMALMAP uniform sampler2D u_NormalSampler; uniform float u_NormalScale; #endif #ifdef HAS_EMISSIVEMAP uniform sampler2D u_EmissiveSampler; uniform vec3 u_EmissiveFactor; #endif #ifdef HAS_METALROUGHNESSMAP uniform sampler2D u_MetallicRoughnessSampler; #endif #ifdef HAS_OCCLUSIONMAP uniform sampler2D u_OcclusionSampler; uniform float u_OcclusionStrength; #endif #ifdef ALPHA_CUTOFF uniform float u_AlphaCutoff; #endif uniform vec2 u_MetallicRoughnessValues; uniform vec4 u_BaseColorFactor; uniform vec3 u_Camera; #ifdef PBR_DEBUG uniform vec4 u_ScaleDiffBaseMR; uniform vec4 u_ScaleFGDSpec; #endif 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 struct PBRInfo { float NdotL; float NdotV; float NdotH; float LdotH; float VdotH; float perceptualRoughness; float metalness; vec3 reflectance0; vec3 reflectance90; float alphaRoughness; vec3 diffuseColor; vec3 specularColor; vec3 n; vec3 v; }; 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 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 return vec4(linOut,srgbIn.w);; #else return srgbIn; #endif } vec3 getNormal() { #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 mat3 tbn = pbr_vTBN; #endif #ifdef HAS_NORMALMAP vec3 n = texture(u_NormalSampler, pbr_vUV).rgb; n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0))); #else vec3 n = normalize(tbn[2].xyz); #endif return n; } #ifdef USE_IBL vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection) { float mipCount = 9.0; float lod = (pbrInputs.perceptualRoughness * mipCount); vec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT, vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb; vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb; #ifdef USE_TEX_LOD vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb; #else vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb; #endif vec3 diffuse = diffuseLight * pbrInputs.diffuseColor; vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y); diffuse *= u_ScaleIBLAmbient.x; specular *= u_ScaleIBLAmbient.y; return diffuse + specular; } #endif vec3 diffuse(PBRInfo pbrInputs) { return pbrInputs.diffuseColor / M_PI; } vec3 specularReflection(PBRInfo pbrInputs) { return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0); } float geometricOcclusion(PBRInfo pbrInputs) { float NdotL = pbrInputs.NdotL; float NdotV = pbrInputs.NdotV; float r = pbrInputs.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; } float microfacetDistribution(PBRInfo pbrInputs) { float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness; float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0; return roughnessSq / (M_PI * f * f); } void PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) { pbrInputs.NdotL = 1.0; pbrInputs.NdotH = 0.0; pbrInputs.LdotH = 0.0; pbrInputs.VdotH = 1.0; } void PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) { vec3 n = pbrInputs.n; vec3 v = pbrInputs.v; vec3 l = normalize(lightDirection); vec3 h = normalize(l+v); pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0); pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0); pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0); pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0); } void PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) { vec3 light_direction = normalize(pointLight.position - pbr_vPosition); PBRInfo_setDirectionalLight(pbrInputs, light_direction); } vec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) { vec3 F = specularReflection(pbrInputs); float G = geometricOcclusion(pbrInputs); float D = microfacetDistribution(pbrInputs); vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs); vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV); return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib); } vec4 pbr_filterColor(vec4 colorUnused) { #ifdef HAS_BASECOLORMAP vec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor; #else vec4 baseColor = u_BaseColorFactor; #endif #ifdef ALPHA_CUTOFF if (baseColor.a < u_AlphaCutoff) { discard; } #endif vec3 color = vec3(0, 0, 0); if(pbr_uUnlit){ color.rgb = baseColor.rgb; } else{ float perceptualRoughness = u_MetallicRoughnessValues.y; float metallic = u_MetallicRoughnessValues.x; #ifdef HAS_METALROUGHNESSMAP vec4 mrSample = texture(u_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); 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); float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b); 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(); vec3 v = normalize(u_Camera - pbr_vPosition); float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0); vec3 reflection = -normalize(reflect(v, n)); PBRInfo pbrInputs = PBRInfo( 0.0, NdotV, 0.0, 0.0, 0.0, perceptualRoughness, metallic, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, specularColor, n, v ); #ifdef USE_LIGHTS PBRInfo_setAmbientLight(pbrInputs); color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color); for(int i = 0; i < lighting_uDirectionalLightCount; i++) { if (i < lighting_uDirectionalLightCount) { PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction); color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color); } } for(int i = 0; i < lighting_uPointLightCount; i++) { if (i < lighting_uPointLightCount) { PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]); float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition)); color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation); } } #endif #ifdef USE_IBL color += getIBLContribution(pbrInputs, n, reflection); #endif #ifdef HAS_OCCLUSIONMAP float ao = texture(u_OcclusionSampler, pbr_vUV).r; color = mix(color, color * ao, u_OcclusionStrength); #endif #ifdef HAS_EMISSIVEMAP vec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor; color += emissive; #endif #ifdef PBR_DEBUG color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y); color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z); color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w); #endif } return vec4(pow(color,vec3(1.0/2.2)), baseColor.a); } `;var we={name:"pbr",vs:xs,fs:Cs,defines:{LIGHTING_FRAGMENT:1},dependencies:[gs]};var le=G(Fe(),1);var Es=G(Se(),1),K;(function(t){t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.LINEAR=9729]="LINEAR",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(K||(K={}));function Ms(t,e,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=r;return o&&(s.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=o.specularEnvSampler,s.bindings.u_brdfLUT=o.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_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),e&&Ei(t,e,s),s}function Ei(t,e,n){if(n.uniforms.pbr_uUnlit=Boolean(e.unlit),e.pbrMetallicRoughness&&Mi(t,e.pbrMetallicRoughness,n),e.normalTexture){Ue(t,e.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=e.normalTexture;n.uniforms.u_NormalScale=r}if(e.occlusionTexture){Ue(t,e.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=e.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(e.emissiveTexture&&(Ue(t,e.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode){case"MASK":let{alphaCutoff:r=.5}=e;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Es.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=K.FUNC_ADD,n.glParameters.blendFunc=[K.SRC_ALPHA,K.ONE_MINUS_SRC_ALPHA,K.ONE,K.ONE_MINUS_SRC_ALPHA];break}}function Mi(t,e,n){e.baseColorTexture&&Ue(t,e.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&Ue(t,e.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=e;n.uniforms.u_MetallicRoughnessValues=[r,s]}function Ue(t,e,n,r=null,s){let o=e?.texture?.sampler?.parameters||{},i=e.texture.source.image,c,a={};i.compressed?(c=i,a={[K.TEXTURE_MIN_FILTER]:i.data.length>1?K.LINEAR_MIPMAP_NEAREST:K.LINEAR}):c={data:i};let f=t.createTexture({id:e.uniformName||e.id,parameters:{...o,...a},pixelStore:{[K.UNPACK_FLIP_Y_WEBGL]:!1},...c});s.bindings[n]=f,r&&(s.defines[r]=1),s.generatedTextures.push(f)}var _s="4.2.0-beta.2";async function ve(t,e,n,r){return r._parse(t,e,n,r)}function U(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var V={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},_i=V.self||V.window||V.global||{},Ti=V.window||V.self||V.global||{},yi=V.global||V.self||V.window||{},bi=V.document||{};var Ne=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Ts=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ri=Ts&&parseFloat(Ts[1])||0;function nn(t){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,t)}function rn(t){return globalThis.loaders?.modules?.[t]||null}function Ii(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-beta.2"),globalThis._loadersgl_.version}var ys=Ii();function bs(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var k={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ZA=k.self||k.window||k.global||{},$A=k.window||k.self||k.global||{},em=k.global||k.self||k.window||{},tm=k.document||{};var xe=typeof process!="object"||String(process)!=="[object process]"||process.browser,ht=typeof importScripts=="function",nm=typeof window<"u"&&typeof window.orientation<"u",Rs=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),rm=Rs&&parseFloat(Rs[1])||0;var sn={};async function Q(t,e=null,n={},r=null){return e&&(t=Is(t,e,n,r)),sn[t]=sn[t]||Si(t),await sn[t]}function Is(t,e,n={},r=null){if(!n.useLocalLibraries&&t.startsWith("http"))return t;r=r||t;let s=n.modules||{};return s[r]?s[r]:xe?n.CDN?(bs(n.CDN.startsWith("http")),`${n.CDN}/${e}@${ys}/dist/libs/${r}`):ht?`../src/libs/${r}`:`modules/${e}/src/libs/${r}`:`modules/${e}/dist/libs/${r}`}async function Si(t){if(t.endsWith("wasm"))return await Di(t);if(!xe)try{let{requireFromFile:n}=globalThis.loaders||{};return await n?.(t)}catch(n){return console.error(n),null}if(ht)return importScripts(t);let e=await Oi(t);return Fi(e,t)}function Fi(t,e){if(!xe){let{requireFromString:r}=globalThis.loaders||{};return r?.(t,e)}if(ht)return eval.call(globalThis,t),null;let n=document.createElement("script");n.id=e;try{n.appendChild(document.createTextNode(t))}catch{n.text=t}return document.body.appendChild(n),null}async function Di(t){let{readFileAsArrayBuffer:e}=globalThis.loaders||{};return xe||!e||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await e(t)}async function Oi(t){let{readFileAsText:e}=globalThis.loaders||{};return xe||!e||t.startsWith("http")?await(await fetch(t)).text():await e(t)}function Fs(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?Ss(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?Ss(t,0,e):""}function Ss(t,e,n){if(t.byteLength<=e+n)return"";let r=new DataView(t),s="";for(let o=0;o=0),U(e>0),t+(e-1)&~(e-1)}function cn(t,e,n){let r;if(t instanceof ArrayBuffer)r=new Uint8Array(t);else{let s=t.byteOffset,o=t.byteLength;r=new Uint8Array(t.buffer||t.arrayBuffer,s,o)}return e.set(r,n),n+se(r.byteLength,4)}var ut={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Ds;async function fn(t){nn(t.modules);let e=rn("basis");return e||(Ds||=Li(t),await Ds)}async function Li(t){let e=null,n=null;return[e,n]=await Promise.all([await Q(ut.TRANSCODER,"textures",t),await Q(ut.TRANSCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await Gi(e,n)}function Gi(t,e){let n={};return e&&(n.wasmBinary=e),new Promise(r=>{t(n).then(s=>{let{BasisFile:o,initializeBasis:i}=s;i(),r({BasisFile:o})})})}var an;async function ln(t){let e=t.modules||{};return e.basisEncoder?e.basisEncoder:(an=an||Pi(t),await an)}async function Pi(t){let e=null,n=null;return[e,n]=await Promise.all([await Q(ut.ENCODER,"textures",t),await Q(ut.ENCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await wi(e,n)}function wi(t,e){let n={};return e&&(n.wasmBinary=e),new Promise(r=>{t(n).then(s=>{let{BasisFile:o,KTX2File:i,initializeBasis:c,BasisEncoder:a}=s;c(),r({BasisFile:o,KTX2File:i,BasisEncoder:a})})})}var ce={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 Ui=["","WEBKIT_","MOZ_"],Os={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"},pt=null;function Ls(t){if(!pt){t=t||vi()||void 0,pt=new Set;for(let e of Ui)for(let n in Os)if(t&&t.getExtension(`${e}${n}`)){let r=Os[n];pt.add(r)}}return pt}function vi(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Jm=new Uint8Array([0]);var Gs,Ps,ws,Us,vs,Ns,Hs,Js;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(Gs||(Gs={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Ps||(Ps={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(ws||(ws={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(Us||(Us={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}(vs||(vs={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Ns||(Ns={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(Hs||(Hs={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(Js||(Js={}));var P=[171,75,84,88,32,50,48,187,13,10,26,10];function Ks(t){let e=new Uint8Array(t);return!(e.byteLength{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 Yi={},qs=!0;async function Zs(t,e,n){let r;Bt(n)?r=await gt(t,e,n):r=Bn(t,n);let s=e&&e.imagebitmap;return await Wi(r,s)}async function Wi(t,e=null){if((zi(e)||!qs)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(n){console.warn(n),qs=!1}return await createImageBitmap(t)}function zi(t){for(let e in t||Yi)return!1;return!0}function $s(t){return!ec(t,"ftyp",4)||!(t[8]&96)?null:qi(t)}function qi(t){switch(Zi(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Zi(t,e,n){return String.fromCharCode(...t.slice(e,n))}function $i(t){return[...t].map(e=>e.charCodeAt(0))}function ec(t,e,n=0){let r=$i(e);for(let s=0;s=24&&e.getUint32(0,Y)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Y),height:e.getUint32(20,Y)}:null}function rc(t){let e=Xe(t);return e.byteLength>=10&&e.getUint32(0,Y)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Ke),height:e.getUint16(8,Ke)}:null}function sc(t){let e=Xe(t);return e.byteLength>=14&&e.getUint16(0,Y)===16973&&e.getUint32(2,Ke)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Ke),height:e.getUint32(22,Ke)}:null}function oc(t){let e=Xe(t);if(!(e.byteLength>=3&&e.getUint16(0,Y)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=ic(),o=2;for(;o+9Boolean(ae(new DataView(t)))],options:lc};var xn={};function Cn(t){if(xn[t]===void 0){let e=Ne?mc(t):Ac(t);xn[t]=e}return xn[t]}function Ac(t){let e=["image/png","image/jpeg","image/gif"],n=globalThis.loaders?.imageFormatsNode||e,r=globalThis.loaders?.parseImageNode;return Boolean(r)&&n.includes(t)}function mc(t){switch(t){case"image/avif":case"image/webp":return hc(t);default:return!0}}function hc(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Ce=G(Fe(),1);var je=G(Se(),1);var uc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Mn=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(e){Object.assign(this,e)}animate(e){if(!this.playing)return;let r=(e/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:s,target:o,path:i})=>{Ec(r,s,o,i),Bc(o,o._node)})}},xt=class{animations;constructor(e){this.animations=e.animations.map((n,r)=>{let s=n.name||`Animation-${r}`,o=n.samplers.map(({input:c,interpolation:a="LINEAR",output:f})=>({input:no(e.accessors[c]),interpolation:a,output:no(e.accessors[f])})),i=n.channels.map(({sampler:c,target:a})=>({sampler:o[c],target:e.nodes[a.node],path:a.path}));return new Mn({name:s,channels:i})})}animate(e){this.setTime(e)}setTime(e){this.animations.forEach(n=>n.animate(e))}getAnimations(){return this.animations}};function no(t){if(!t._animation){let e=pc[t.componentType],n=uc[t.type],r=n*t.count,{buffer:s,byteOffset:o}=t.bufferView.data,i=new e(s,o+(t.byteOffset||0),r);if(n===1)t._animation=Array.from(i);else{let c=[];for(let a=0;am>=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:je.log.warn(`Bad animation path ${o}`)()}(0,je.assert)(s[o].length===r[f].length);let l=e[f],A=e[a];switch(n){case"STEP":Cc(s,o,r[f]);break;case"LINEAR":if(A>l){let m=(c-l)/(A-l);gc(s,o,r[f],r[a],m)}break;case"CUBICSPLINE":if(A>l){let m=(c-l)/(A-l),h=A-l,u=r[3*f+1],p=r[3*f+2],B=r[3*a+0],g=r[3*a+1];xc(s,o,{p0:u,outTangent0:p,inTangent1:B,p1:g,tDiff:h,ratio:m})}break;default:je.log.warn(`Interpolation ${n} not supported`)();break}}var so=G(Se(),1);var Ct=G(Fe(),1);var Mc=` #pragma vscode_glsllint_stage: vert #if (__VERSION__ < 300) #define _attr attribute #else #define _attr in #endif // _attr vec4 POSITION; _attr vec4 positions; #ifdef HAS_NORMALS // _attr vec4 NORMAL; _attr vec4 normals; #endif #ifdef HAS_TANGENTS _attr vec4 TANGENT; #endif #ifdef HAS_UV // _attr vec2 TEXCOORD_0; _attr 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 = u_MVPMatrix * positions; } `,_c=` #pragma vscode_glsllint_stage: frag #if (__VERSION__ < 300) #define fragmentColor gl_FragColor #else out vec4 fragmentColor; #endif void main(void) { vec3 pos = pbr_vPosition; fragmentColor = pbr_filterColor(vec4(1.0)); } `;function oo(t,e){let{id:n,geometry:r,material:s,vertexCount:o,materialOptions:i,modelOptions:c}=e,a=Ms(t,s,r.attributes,i);so.log.info(4,"createGLTFModel defines: ",a.defines)();let f=[],l={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},A={id:n,geometry:r,topology:r.topology,vertexCount:o,modules:[we],vs:ro(t,Mc),fs:ro(t,_c),...c,bindings:{...a.bindings,...c.bindings},defines:{...a.defines,...c.defines},parameters:{...l,...a.parameters,...c.parameters},uniforms:{...a.uniforms,...c.uniforms}},m=new Ct.Model(t,A);return new Ct.ModelNode({managedResources:f,model:m})}function ro(t,e){return`#version 300 es ${e}`}var Tc={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},Et=class{device;options;gltf;constructor(e,n={}){this.device=e,this.options={...Tc,...n}}instantiate(e){return this.gltf=e,(e.scenes||[]).map(r=>this.createScene(r))}createAnimator(){return Array.isArray(this.gltf.animations)?new xt(this.gltf):null}createScene(e){let r=(e.nodes||[]).map(o=>this.createNode(o));return new Ce.GroupNode({id:e.name||e.id,children:r})}createNode(e){if(!e._node){let r=(e.children||[]).map(o=>this.createNode(o));e.mesh&&r.push(this.createMesh(e.mesh));let s=new Ce.GroupNode({id:e.name||e.id,children:r});if(e.matrix)s.setMatrix(e.matrix);else{if(s.matrix.identity(),e.translation&&s.matrix.translate(e.translation),e.rotation){let o=new Z().fromQuaternion(e.rotation);s.matrix.multiplyRight(o)}e.scale&&s.matrix.scale(e.scale)}e._node=s}return e._node}createMesh(e){if(!e._mesh){let r=(e.primitives||[]).map((o,i)=>this.createPrimitive(o,i,e)),s=new Ce.GroupNode({id:e.name||e.id,children:r});e._mesh=s}return e._mesh}createPrimitive(e,n,r){let s=e.name||`${r.name||r.id}-primitive-${n}`,o=yc(e.mode||4),i=e.indices?e.indices.count:this.getVertexCount(e.attributes),c=oo(this.device,{id:s,geometry:this.createGeometry(s,e,o),material:e.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:i});return c.bounds=[e.attributes.POSITION.min,e.attributes.POSITION.max],c}getVertexCount(e){throw new Error("getVertexCount not implemented")}createGeometry(e,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 Ce.Geometry({id:e,topology:r,indices:n.indices.value,attributes:s})}createBuffer(e,n){e.bufferView||(e.bufferView={});let{bufferView:r}=e;return r.lumaBuffers||(r.lumaBuffers={}),r.lumaBuffers[n]||(r.lumaBuffers[n]=this.device.createBuffer({id:`from-${r.id}`,data:r.data||e.value})),r.lumaBuffers[n]}createSampler(e){return e}needsPOT(){return!1}},$;(function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"})($||($={}));function yc(t){switch(t){case $.POINTS:return"point-list";case $.LINES:return"line-list";case $.LINE_STRIP:return"line-strip";case $.LINE_LOOP:return"line-loop-webgl";case $.TRIANGLES:return"triangle-list";case $.TRIANGLE_STRIP:return"triangle-strip";case $.TRIANGLE_FAN:return"triangle-fan-webgl";default:throw new Error(t)}}function _n(t,e,n){let r=new Et(t,n),s=r.instantiate(e),o=r.createAnimator();return{scenes:s,animator:o}}var Tn={};w(Tn,{decode:()=>wc,name:()=>Pc});function R(t,e){if(!t)throw new Error(e||"assert failed: gltf")}var Mt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},_t={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var io=["SCALAR","VEC2","VEC3","VEC4"],bc=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Rc=new Map(bc),Ic={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Sc={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Fc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Tt(t){return io[t-1]||io[0]}function Ee(t){let e=Rc.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function Me(t,e){let n=Fc[t.componentType],r=Ic[t.type],s=Sc[t.componentType],o=t.count*r,i=t.count*r*s;R(i>=0&&i<=e.byteLength);let c=_t[t.componentType],a=Mt[t.type];return{ArrayType:n,length:o,byteLength:i,componentByteSize:c,numberOfComponentsInElement:a}}function co(t,e,n){let r=t.bufferViews[n];R(r);let s=r.buffer,o=e[s];R(o);let i=(r.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,r.byteLength)}function ao(t,e,n){let r=typeof n=="number"?t.accessors?.[n]:n;if(!r)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let s=t.bufferViews?.[r.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:o,byteOffset:i}=e[s.buffer],c=(i||0)+(r.byteOffset||0)+(s.byteOffset||0),{ArrayType:a,length:f,componentByteSize:l,numberOfComponentsInElement:A}=Me(r,s),m=l*A,h=s.byteStride||m;if(typeof s.byteStride>"u"||s.byteStride===m)return new a(o,c,f);let u=new a(f);for(let p=0;ps===e),r=this.getRequiredExtensions().find(s=>s===e);return typeof n=="string"||typeof r=="string"}getExtension(e){let n=this.getUsedExtensions().find(s=>s===e),r=this.json.extensions||{};return n?r[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(r=>r===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,n){return(e.extensions||{})[n]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,n){if(typeof n=="object")return n;let r=this.json[e]&&this.json[e][n];if(!r)throw new Error(`glTF file error: Could not find ${e}[${n}]`);return r}getTypedArrayForBufferView(e){e=this.getBufferView(e);let n=e.buffer,r=this.gltf.buffers[n];R(r);let s=(e.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){let n=this.getAccessor(e);return ao(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(e){e=this.getAccessor(e);let n=this.getBufferView(e.bufferView),s=this.getBuffer(n.buffer).data,o=n.byteOffset||0;return new Uint8Array(s,o,n.byteLength)}addApplicationData(e,n){return this.json[e]=n,this}addExtraData(e,n){return this.json.extras=this.json.extras||{},this.json.extras[e]=n,this}addObjectExtension(e,n,r){return e.extensions=e.extensions||{},e.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(e,n,r){let s=e.extensions||{};s[n]=r}removeObjectExtension(e,n){let r=e?.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(e,n={}){return R(n),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=n,this.registerUsedExtension(e),n}addRequiredExtension(e,n={}){return R(n),this.addExtension(e,n),this.registerRequiredExtension(e),n}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(e)||n.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:n}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(e){let{meshIndex:n,matrix:r}=e;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(e){let{attributes:n,indices:r,material:s,mode:o=4}=e,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(e){let r={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(e,n){let r=ae(e),s=n||r?.mimeType,i={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(e,n=0,r=this.byteLength){let s=e.byteLength;R(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let o={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=se(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(e,n){let r={bufferView:e,type:Tt(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(e,n={size:3}){let r=this.addBufferView(e),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,n.size));let o={size:n.size,componentType:Ee(e),count:Math.round(e.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(o,n))}addTexture(e){let{imageIndex:n}=e,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){this.gltf.buffers=[];let e=this.byteLength,n=new ArrayBuffer(e),r=new Uint8Array(n),s=0;for(let o of this.sourceBuffers||[])s=cn(o,r,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=e:this.json.buffers=[{byteLength:e}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(e,n){let r=!0;for(;r;){let s=e.indexOf(n);s>-1?e.splice(s,1):r=!1}}_addAttributes(e={}){let n={};for(let r in e){let s=e[r],o=this._getGltfAttributeName(r),i=this.addBinaryBuffer(s.value,s);n[o]=i}return n}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.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 e}}_getAccessorMinMax(e,n){let r={min:null,max:null};if(e.lengthm===l);A===-1&&(A=r.push(l)-1),o.push(A)}let i=new Uint32Array(o),c=t.gltf.buffers.push({arrayBuffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength})-1,a=t.addBufferView(i,c,0),f=t.addAccessor(a,{size:1,componentType:Ee(i),count:i.length});s.attributes[e]=f}function Lc(t,e,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;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(a=4);let f=Gc(i,c,t,a),l=0;for(let A of s){let m=typeof A=="number"?Object.values(o)[A]:o[A],h=f+m.offset,u=Je(t);if(u.data.length<=h)throw new Error(`${u.data.length} <= ${h}`);let p=u.data[h];l|=p<r)break;let f=c/s,l=a/s;o.push(t.slice(f,f+l))}return o}function Rt(t,e,n){let r=[];for(let s=0;sHc,name:()=>Nc});var yn="EXT_structural_metadata",Nc=yn;async function Hc(t,e){let n=new T(t);Jc(n,e)}function Jc(t,e){if(!e.gltf?.loadBuffers)return;let n=t.getExtension(yn);n&&(e.gltf?.loadImages&&Kc(t,n),Xc(t,n))}function Kc(t,e){let n=e.propertyTextures,r=t.gltf.json;if(n&&r.meshes)for(let s of r.meshes)for(let o of s.primitives)Vc(t,n,o,e)}function Xc(t,e){let n=e.schema;if(!n)return;let r=n.classes,s=e.propertyTables;if(r&&s)for(let o in r){let i=jc(s,o);i&&Qc(t,n,i)}}function jc(t,e){for(let n of t)if(n.class===e)return n;return null}function Vc(t,e,n,r){if(!e)return;let o=n.extensions?.[yn]?.propertyTextures;if(o)for(let i of o){let c=e[i];kc(t,c,n,r)}}function kc(t,e,n,r){if(!e.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=e.class;for(let o in e.properties){let i=`${s}_${o}`,c=e.properties?.[o];if(!c)continue;c.data||(c.data=[]);let a=c.data,f=ye(t,c,n);f!==null&&(yt(t,i,f,a,n),c.data=a,r.dataAttributeNames.push(i))}}function Qc(t,e,n){let r=e.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=Yc(t,e,i,s,c);c.data=a}}}function Yc(t,e,n,r,s){let o=[],i=s.values,c=t.getTypedArrayForBufferView(i),a=Wc(t,n,s,r),f=zc(t,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=qc(n,r,c,a);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{o=It(r,c,a,f);break}case"ENUM":{o=Zc(e,n,r,c,a);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return o}function Wc(t,e,n,r){return e.array&&typeof e.count>"u"&&typeof n.arrayOffsets<"u"?_e(t,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function zc(t,e,n){return typeof e.stringOffsets<"u"?_e(t,e.stringOffsets,e.stringOffsetType||"UINT32",n):null}function qc(t,e,n,r){let s=t.array,o=t.count,i=Ve(t.type,t.componentType),c=n.byteLength/i,a;return t.componentType?a=Te(n,t.type,t.componentType,c):a=n,s?r?bt(a,e,r,n.length,i):o?Rt(a,e,o):[]:a}function Zc(t,e,n,r,s){let o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let i=t.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=Ve(e.type,c),f=r.byteLength/a,l=Te(r,e.type,c,f);if(l||(l=r),e.array){if(s)return $c({valuesData:l,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:a,enumEntry:i});let A=e.count;return A?ea(l,n,A,i):[]}return bn(l,0,n,i)}function $c(t){let{valuesData:e,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:o,enumEntry:i}=t,c=[];for(let a=0;as)break;let A=f/o,m=l/o,h=bn(e,A,m,i);c.push(h)}return c}function ea(t,e,n,r){let s=[];for(let o=0;ora,name:()=>na});var ho="EXT_feature_metadata",na=ho;async function ra(t,e){let n=new T(t);sa(n,e)}function sa(t,e){if(!e.gltf?.loadBuffers)return;let n=t.getExtension(ho);n&&(e.gltf?.loadImages&&oa(t,n),ia(t,n))}function oa(t,e){let n=e.schema;if(!n)return;let r=n.classes,{featureTextures:s}=e;if(r&&s)for(let o in r){let i=r[o],c=aa(s,o);c&&la(t,c,i)}}function ia(t,e){let n=e.schema;if(!n)return;let r=n.classes,s=e.featureTables;if(r&&s)for(let o in r){let i=ca(s,o);i&&fa(t,n,i)}}function ca(t,e){for(let n in t){let r=t[n];if(r.class===e)return r}return null}function aa(t,e){for(let n in t){let r=t[n];if(r.class===e)return r}return null}function fa(t,e,n){if(!n.class)return;let r=e.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=Aa(t,e,i,s,c);c.data=a}}}function la(t,e,n){let r=e.class;for(let s in n.properties){let o=e?.properties?.[s];if(o){let i=da(t,o,r);o.data=i}}}function Aa(t,e,n,r,s){let o=[],i=s.bufferView,c=t.getTypedArrayForBufferView(i),a=ma(t,n,s,r),f=ha(t,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?o=It(r,c,a,f):ua(n)&&(o=pa(n,r,c,a)),o}function ma(t,e,n,r){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?_e(t,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function ha(t,e,n,r){return typeof n.stringOffsetBufferView<"u"?_e(t,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function ua(t){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}function pa(t,e,n,r){let s=t.type==="ARRAY",o=t.componentCount,i="SCALAR",c=t.componentType||t.type,a=Ve(i,c),f=n.byteLength/a,l=Te(n,i,c,f);return s?r?bt(l,e,r,n.length,a):o?Rt(l,e,o):[]:l}function da(t,e,n){let r=t.gltf.json;if(!r.meshes)return[];let s=[];for(let o of r.meshes)for(let i of o.primitives)Ba(t,n,e,s,i);return s}function Ba(t,e,n,r,s){let o={channels:n.channels,...n.texture},i=ye(t,o,s);i&&yt(t,e,i,r,s)}var uo="4.2.0-beta.2";var be=!0,po=1735152710,Dn=12,St=8,ga=1313821514,xa=5130562,Ca=0,Ea=0,Ma=1;function _a(t,e=0){return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function Bo(t,e=0,n={}){let r=new DataView(t),{magic:s=po}=n,o=r.getUint32(e,!1);return o===s||o===po}function go(t,e,n=0,r={}){let s=new DataView(e),o=_a(s,n+0),i=s.getUint32(n+4,be),c=s.getUint32(n+8,be);switch(Object.assign(t,{header:{byteOffset:n,byteLength:c,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),n+=Dn,t.version){case 1:return Ta(t,s,n);case 2:return ya(t,s,n,r={});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}function Ta(t,e,n){U(t.header.byteLength>Dn+St);let r=e.getUint32(n+0,be),s=e.getUint32(n+4,be);return n+=St,U(s===Ca),Sn(t,e,n,r),n+=r,n+=Fn(t,e,n,t.header.byteLength),n}function ya(t,e,n,r){return U(t.header.byteLength>Dn+St),ba(t,e,n,r),n+t.header.byteLength}function ba(t,e,n,r){for(;n+8<=t.header.byteLength;){let s=e.getUint32(n+0,be),o=e.getUint32(n+4,be);switch(n+=St,o){case ga:Sn(t,e,n,s);break;case xa:Fn(t,e,n,s);break;case Ea:r.strict||Sn(t,e,n,s);break;case Ma:r.strict||Fn(t,e,n,s);break;default:break}n+=se(s,4)}return n}function Sn(t,e,n,r){let s=new Uint8Array(e.buffer,n,r),i=new TextDecoder("utf8").decode(s);return t.json=JSON.parse(i),se(r,4)}function Fn(t,e,n,r){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:e.buffer}),se(r,4)}function On(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;let r=e.baseUri||e.uri;if(!r)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return r.substr(0,r.lastIndexOf("/")+1)+t}var Gn={};w(Gn,{decode:()=>va,name:()=>Ua});var Ra="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv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/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",Sa=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]),Fa=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]),Da={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Oa={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function xo(t,e,n,r,s,o="NONE"){let i=await La();wa(i,i.exports[Oa[s]],t,e,n,r,i.exports[Da[o||"NONE"]])}var Ln;async function La(){return Ln||(Ln=Ga()),Ln}async function Ga(){let t=Ra;WebAssembly.validate(Sa)&&(t=Ia,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let e=await WebAssembly.instantiate(Pa(t),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function Pa(t){let e=new Uint8Array(t.length);for(let r=0;r96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let n=0;for(let r=0;rHa,preprocess:()=>Ja});var Re="EXT_texture_webp",Ha=Re;function Ja(t,e){let n=new T(t);if(!Cn("image/webp")){if(n.getRequiredExtensions().includes(Re))throw new Error(`gltf: Required extension ${Re} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let o=n.getObjectExtension(s,Re);o&&(s.source=o.source),n.removeObjectExtension(s,Re)}n.removeExtension(Re)}var wn={};w(wn,{name:()=>Ka,preprocess:()=>Xa});var Dt="KHR_texture_basisu",Ka=Dt;function Xa(t,e){let n=new T(t),{json:r}=n;for(let s of r.textures||[]){let o=n.getObjectExtension(s,Dt);o&&(s.source=o.source,n.removeObjectExtension(s,Dt))}n.removeExtension(Dt)}var Jn={};w(Jn,{decode:()=>of,encode:()=>cf,name:()=>rf,preprocess:()=>sf});var Co="4.2.0-beta.2";var Eo={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:Co,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 _o(t,e,n){let r=To(e.metadata),s=[],o=ja(e.attributes);for(let i in t){let c=t[i],a=Mo(i,c,o[i]);s.push(a)}if(n){let i=Mo("indices",n);s.push(i)}return{fields:s,metadata:r}}function ja(t){let e={};for(let n in t){let r=t[n];e[r.name||"undefined"]=r}return e}function Mo(t,e,n){let r=n?To(n.metadata):void 0;return wt(t,e,r)}function To(t){Object.entries(t);let e={};for(let n in t)e[`${n}.string`]=JSON.stringify(t[n]);return e}var yo={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Va={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},ka=4,ke=class{draco;decoder;metadataQuerier;constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,n={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(e),e.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 m=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(m)}let c=this._getDracoLoaderData(o,s,n),a=this._getMeshData(o,c,n),f=De(a.attributes),l=_o(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(e,n,r){let s=this._getTopLevelMetadata(e),o=this._getDracoAttributes(e,r);return{geometry_type:n,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:o}}_getDracoAttributes(e,n){let r={};for(let s=0;sthis.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(e))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(e,n){let{octahedronAttributes:r=[]}=n,s=e.attribute_type();if(r.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(e))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}};function Qa(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function Ya(t){let e=t.size(),n=new Int32Array(e);for(let r=0;r({draco:n})):Nn||=Za(t),await Nn}async function Za(t){let e,n;switch(t.draco&&t.draco.decoderType){case"js":e=await Q(vn[S.FALLBACK_DECODER],"draco",t,S.FALLBACK_DECODER);break;case"wasm":default:[e,n]=await Promise.all([await Q(vn[S.DECODER],"draco",t,S.DECODER),await Q(vn[S.DECODER_WASM],"draco",t,S.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await $a(e,n)}function $a(t,e){let n={};return e&&(n.wasmBinary=e),new Promise(r=>{t({...n,onModuleLoaded:s=>r({draco:s})})})}var Ro={...Eo,parse:ef};async function ef(t,e){let{draco:n}=await bo(e),r=new ke(n);try{return r.parseSync(t,e?.draco)}finally{r.destroy()}}function Io(t){let e={};for(let n in t){let r=t[n];if(n!=="indices"){let s=Hn(r);e[n]=s}}return e}function Hn(t){let{buffer:e,size:n,count:r}=tf(t);return{value:e,size:n,byteOffset:0,count:r,type:Tt(n),componentType:Ee(e)}}function tf(t){let e=t,n=1,r=0;return t&&t.value&&(e=t.value,n=t.size||1),e&&(ArrayBuffer.isView(e)||(e=nf(e,Float32Array)),r=e.length/n),{buffer:e,size:n,count:r}}function nf(t,e,n=!1){return t?Array.isArray(t)?new e(t):n&&!(t instanceof e)?new e(t):t:null}var oe="KHR_draco_mesh_compression",rf=oe;function sf(t,e,n){let r=new T(t);for(let s of So(r))r.getObjectExtension(s,oe)}async function of(t,e,n){if(!e?.gltf?.decompressMeshes)return;let r=new T(t),s=[];for(let o of So(r))r.getObjectExtension(o,oe)&&s.push(af(r,o,e,n));await Promise.all(s),r.removeExtension(oe)}function cf(t,e={}){let n=new T(t);for(let r of n.json.meshes||[])ff(r,e),n.addRequiredExtension(oe)}async function af(t,e,n,r){let s=t.getObjectExtension(e,oe);if(!s)return;let o=t.getTypedArrayForBufferView(s.bufferView),i=He(o.buffer,o.byteOffset),c={...n};delete c["3d-tiles"];let a=await ve(i,Ro,c,r),f=Io(a.attributes);for(let[l,A]of Object.entries(f))if(l in e.attributes){let m=e.attributes[l],h=t.getAccessor(m);h?.min&&h?.max&&(A.min=h.min,A.max=h.max)}e.attributes=f,a.indices&&(e.indices=Hn(a.indices)),t.removeObjectExtension(e,oe),lf(e)}function ff(t,e,n=4,r,s){if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=r.DracoWriter.encodeSync({attributes:t}),i=s?.parseSync?.({attributes:t}),c=r._addFauxAttributes(i.attributes),a=r.addBufferView(o);return{primitives:[{attributes:c,mode:n,extensions:{[oe]:{bufferView:a,attributes:c}}}]}}function lf(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*So(t){for(let e of t.json.meshes||[])for(let n of e.primitives)yield n}var Kn={};w(Kn,{decode:()=>uf,name:()=>Af});var Lt="KHR_texture_transform",Af=Lt,Ot=new ie,mf=new q,hf=new q;async function uf(t,e){if(!new T(t).hasExtension(Lt)||!e.gltf?.loadBuffers)return;let s=t.json.materials||[];for(let o=0;oi===r&&c===s)!==-1)){let i=Ef(n);return r!==s&&(t.texCoord=s),e.push([r,s]),{originalTexCoord:r,texCoord:s,matrix:i}}return null}function gf(t,e,n){let{originalTexCoord:r,texCoord:s,matrix:o}=n,i=e.attributes[`TEXCOORD_${r}`];if(Number.isFinite(i)){let c=t.json.accessors?.[i];if(c&&c.bufferView){let a=t.json.bufferViews?.[c.bufferView];if(a){let{arrayBuffer:f,byteOffset:l}=t.buffers[a.buffer],A=(l||0)+(c.byteOffset||0)+(a.byteOffset||0),{ArrayType:m,length:h}=Me(c,a),u=_t[c.componentType],p=Mt[c.type],B=a.byteStride||u*p,g=new Float32Array(h);for(let M=0;M_f,encode:()=>Tf,name:()=>Mf});var fe="KHR_lights_punctual",Mf=fe;async function _f(t){let e=new T(t),{json:n}=e,r=e.getExtension(fe);r&&(e.json.lights=r.lights,e.removeExtension(fe));for(let s of n.nodes||[]){let o=e.getObjectExtension(s,fe);o&&(s.light=o.light),e.removeObjectExtension(s,fe)}}async function Tf(t){let e=new T(t),{json:n}=e;if(n.lights){let r=e.addExtension(fe);R(!r.lights),r.lights=n.lights,delete n.lights}if(e.json.lights){for(let r of e.json.lights){let s=r.node;e.addObjectExtension(s,fe,r)}delete e.json.lights}}var jn={};w(jn,{decode:()=>bf,encode:()=>Rf,name:()=>yf});var Qe="KHR_materials_unlit",yf=Qe;async function bf(t){let e=new T(t),{json:n}=e;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),e.removeObjectExtension(r,Qe);e.removeExtension(Qe)}function Rf(t){let e=new T(t),{json:n}=e;if(e.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,e.addObjectExtension(r,Qe,{}),e.addExtension(Qe))}var Vn={};w(Vn,{decode:()=>Sf,encode:()=>Ff,name:()=>If});var Ye="KHR_techniques_webgl",If=Ye;async function Sf(t){let e=new T(t),{json:n}=e,r=e.getExtension(Ye);if(r){let s=Df(r,e);for(let o of n.materials||[]){let i=e.getObjectExtension(o,Ye);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=Of(o.technique,e)),e.removeObjectExtension(o,Ye)}e.removeExtension(Ye)}}async function Ff(t,e){}function Df(t,e){let{programs:n=[],shaders:r=[],techniques:s=[]}=t,o=new TextDecoder;return r.forEach(i=>{if(Number.isFinite(i.bufferView))i.code=o.decode(e.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 Of(t,e){let n=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(r=>{t.uniforms[r].value&&!(r in n)&&(n[r]=t.uniforms[r].value)}),Object.keys(n).forEach(r=>{typeof n[r]=="object"&&n[r].index!==void 0&&(n[r].texture=e.getTexture(n[r].index))}),n}var Fo=[Rn,Tn,Gn,Pn,wn,Jn,Xn,jn,Vn,Kn,In];function Do(t,e={},n){let r=Fo.filter(s=>Lo(s.name,e));for(let s of r)s.preprocess?.(t,e,n)}async function Oo(t,e={},n){let r=Fo.filter(s=>Lo(s.name,e));for(let s of r)await s.decode?.(t,e,n)}function Lo(t,e){let n=e?.gltf?.excludeExtensions||{};return!(t in n&&!n[t])}var kn="KHR_binary_glTF";function Go(t){let e=new T(t),{json:n}=e;for(let r of n.images||[]){let s=e.getObjectExtension(r,kn);s&&Object.assign(r,s),e.removeObjectExtension(r,kn)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,e.removeExtension(kn)}var Po={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Gf={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Qn=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(e,n){this.json=e.json;let r=e.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),Go(e),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(let n in Po)this._convertTopLevelObjectToArray(e,n)}_convertTopLevelObjectToArray(e,n){let r=e[n];if(!(!r||Array.isArray(r))){e[n]=[];for(let s in r){let o=r[s];o.id=o.id||s;let i=e[n].length;e[n].push(o),this.idToIndexMap[n][s]=i}}}_convertObjectIdsToArrayIndices(e){for(let n in Po)this._convertIdsToIndices(e,n);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let n of e.textures)this._convertTextureIds(n);for(let n of e.meshes)this._convertMeshIds(n);for(let n of e.nodes)this._convertNodeIds(n);for(let n of e.scenes)this._convertSceneIds(n)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let n of e.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(e){e.children&&(e.children=e.children.map(n=>this._convertIdToIndex(n,"node"))),e.meshes&&(e.meshes=e.meshes.map(n=>this._convertIdToIndex(n,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(n=>this._convertIdToIndex(n,"node")))}_convertIdsToIndices(e,n){e[n]||(console.warn(`gltf v1: json doesn't contain attribute ${n}`),e[n]=[]);for(let r of e[n])for(let s in r){let o=r[s],i=this._convertIdToIndex(o,s);r[s]=i}}_convertIdToIndex(e,n){let r=Gf[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][e];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${e}`);return s}return e}_updateObjects(e){for(let n of this.json.buffers)delete n.type}_updateMaterial(e){for(let n of e.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=e.textures.findIndex(o=>o.id===r);s!==-1&&(n.pbrMetallicRoughness.baseColorTexture={index:s})}}};function wo(t,e={}){return new Qn().normalize(t,e)}async function Uo(t,e,n=0,r,s){return Pf(t,e,n,r),wo(t,{normalize:r?.gltf?.normalize}),Do(t,r,s),r?.gltf?.loadBuffers&&t.json.buffers&&await wf(t,r,s),r?.gltf?.loadImages&&await Uf(t,r,s),await Oo(t,r,s),t}function Pf(t,e,n,r){if(r.uri&&(t.baseUri=r.uri),e instanceof ArrayBuffer&&!Bo(e,n,r)&&(e=new TextDecoder().decode(e)),typeof e=="string")t.json=on(e);else if(e instanceof ArrayBuffer){let i={};n=go(i,e,n,r.glb),R(i.type==="glTF",`Invalid GLB magic string ${i.type}`),t._glb=i,t.json=i.json}else R(!1,"GLTF: must be ArrayBuffer or string");let s=t.json.buffers||[];if(t.buffers=new Array(s.length).fill(null),t._glb&&t._glb.header.hasBinChunk){let{binChunks:i}=t._glb;t.buffers[0]={arrayBuffer:i[0].arrayBuffer,byteOffset:i[0].byteOffset,byteLength:i[0].byteLength}}let o=t.json.images||[];t.images=new Array(o.length).fill({})}async function wf(t,e,n){let r=t.json.buffers||[];for(let s=0;sthis._resolveBufferView(s,o))),e.images&&(r.images=e.images.map((s,o)=>this._resolveImage(s,o))),e.samplers&&(r.samplers=e.samplers.map((s,o)=>this._resolveSampler(s,o))),e.textures&&(r.textures=e.textures.map((s,o)=>this._resolveTexture(s,o))),e.accessors&&(r.accessors=e.accessors.map((s,o)=>this._resolveAccessor(s,o))),e.materials&&(r.materials=e.materials.map((s,o)=>this._resolveMaterial(s,o))),e.meshes&&(r.meshes=e.meshes.map((s,o)=>this._resolveMesh(s,o))),e.nodes&&(r.nodes=e.nodes.map((s,o)=>this._resolveNode(s,o)),r.nodes=r.nodes.map((s,o)=>this._resolveNodeChildren(s))),e.skins&&(r.skins=e.skins.map((s,o)=>this._resolveSkin(s,o))),e.scenes&&(r.scenes=e.scenes.map((s,o)=>this._resolveScene(s,o))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}getScene(e){return this._get(this.json.scenes,e)}getNode(e){return this._get(this.json.nodes,e)}getSkin(e){return this._get(this.json.skins,e)}getMesh(e){return this._get(this.json.meshes,e)}getMaterial(e){return this._get(this.json.materials,e)}getAccessor(e){return this._get(this.json.accessors,e)}getCamera(e){return this._get(this.json.cameras,e)}getTexture(e){return this._get(this.json.textures,e)}getSampler(e){return this._get(this.json.samplers,e)}getImage(e){return this._get(this.json.images,e)}getBufferView(e){return this._get(this.json.bufferViews,e)}getBuffer(e){return this._get(this.json.buffers,e)}_get(e,n){if(typeof n=="object")return n;let r=e&&e[n];return r||console.warn(`glTF file error: Could not find ${e}[${n}]`),r}_resolveScene(e,n){return{...e,id:e.id||`scene-${n}`,nodes:(e.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(e,n){let r={...e,id:e?.id||`node-${n}`};return e.mesh!==void 0&&(r.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(r.camera=this.getCamera(e.camera)),e.skin!==void 0&&(r.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(r.mesh=e.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(e){return e.children&&(e.children=e.children.map(n=>this.getNode(n))),e}_resolveSkin(e,n){let r=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(e,n){let r={...e,id:e.id||`mesh-${n}`,primitives:[]};return e.primitives&&(r.primitives=e.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(e,n){let r={...e,id:e.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(e,n){let r=kf(e.componentType),s=Qf(e.type),o=r*s,i={...e,id:e.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(i.bufferView=this.getBufferView(e.bufferView)),i.bufferView){let c=i.bufferView.buffer,{ArrayType:a,byteLength:f}=Me(i,i.bufferView),l=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+c.byteOffset,A=c.arrayBuffer.slice(l,l+f);i.bufferView.byteStride&&(A=this._getValueFromInterleavedBuffer(c,l,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new a(A)}return i}_getValueFromInterleavedBuffer(e,n,r,s,o){let i=new Uint8Array(o*s);for(let c=0;c{n.traverse(r=>{Object.values(r.model.uniforms).forEach(s=>{s.loaded===!1&&e.push(s)})})}),await Yf(()=>e.some(n=>!n.loaded))}async function Yf(t){for(;t();)await new Promise(e=>requestAnimationFrame(e))}var No=`#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; uniform float sizeScale; uniform float sizeMinPixels; uniform float sizeMaxPixels; uniform mat4 sceneModelMatrix; uniform bool composeModelMatrix; in vec3 positions; #ifdef HAS_UV in vec2 texCoords; #endif #ifdef MODULE_PBR #ifdef HAS_NORMALS in vec3 normals; #endif #endif out vec4 vColor; #ifndef MODULE_PBR #ifdef HAS_UV out vec2 vTEXCOORD_0; #endif #endif void main(void) { #if defined(HAS_UV) && !defined(MODULE_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 MODULE_PBR #ifdef HAS_NORMALS normal = instanceModelMatrix * (sceneModelMatrix * vec4(normals, 0.0)).xyz; #endif #endif float originalSize = project_size_to_pixel(sizeScale); float clampedSize = clamp(originalSize, sizeMinPixels, sizeMaxPixels); vec3 pos = (instanceModelMatrix * (sceneModelMatrix * vec4(positions, 1.0)).xyz) * sizeScale * (clampedSize / originalSize) + instanceTranslation; if(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 MODULE_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 Ho=`#version 300 es #define SHADER_NAME scenegraph-layer-fragment-shader uniform float opacity; in vec4 vColor; out vec4 fragColor; #ifndef MODULE_PBR #if defined(HAS_UV) && defined(HAS_BASECOLORMAP) in vec2 vTEXCOORD_0; uniform sampler2D u_BaseColorSampler; #endif #endif void main(void) { #ifdef MODULE_PBR fragColor = vColor * pbr_filterColor(vec4(0)); geometry.uv = pbr_vUV; #else #if defined(HAS_UV) && defined(HAS_BASECOLORMAP) fragColor = vColor * texture(u_BaseColorSampler, vTEXCOORD_0); geometry.uv = vTEXCOORD_0; #else fragColor = vColor; #endif #endif fragColor.a *= opacity; DECKGL_FILTER_COLOR(fragColor, geometry); } `;var Jo=[255,255,255,255],Wf={scenegraph:{type:"object",value:null,async:!0},getScene:t=>t&&t.scenes?typeof t.scene=="object"?t.scene:t.scenes[t.scene||0]:t,getAnimator:t=>t&&t.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:t=>t.position},getColor:{type:"accessor",value:Jo},_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:[We]},ze=class extends W.Layer{getShaders(){let e=[W.project32,W.picking];return this.props._lighting==="pbr"&&e.push(we),super.getShaders({vs:No,fs:Ho,modules:e})}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:Jo,transition:!0},instanceModelMatrix:tt})}updateState(e){super.updateState(e);let{props:n,oldProps:r}=e;n.scenegraph!==r.scenegraph?this._updateScenegraph():n._animations!==r._animations&&this._applyAnimationsProp(this.state.animator,n._animations)}finalizeState(e){super.finalizeState(e),this.state.scenegraph?.destroy()}get isLoaded(){return Boolean(this.state?.scenegraph&&super.isLoaded)}_updateScenegraph(){let e=this.props,{device:n}=this.context,r=null;if(e.scenegraph instanceof le.ScenegraphNode)r={scenes:[e.scenegraph]};else if(e.scenegraph&&typeof e.scenegraph=="object"){let c=e.scenegraph,a=c.json?Wn(c):c,f=_n(n,a,this._getModelOptions());r={gltf:a,...f},vo(f).then(()=>{this.setNeedsRedraw()}).catch(l=>{this.raiseError(l,"loading glTF")})}let s={layer:this,device:this.context.device},o=e.getScene(r,s),i=e.getAnimator(r,s);if(o instanceof le.GroupNode){this.state.scenegraph?.destroy(),this._applyAnimationsProp(i,e._animations);let c=[];o.traverse(a=>{a instanceof le.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(e,n){if(!e||!n)return;let r=e.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&&ic===s);i?Object.assign(i,o):W.log.warn(`animation ${s} not found`)()}})}_getModelOptions(){let{_imageBasedLightingEnvironment:e}=this.props,n;return e&&(typeof e=="function"?n=e({gl:this.context.gl,layer:this}):n=e),{imageBasedLightingEnvironment:n,modelOptions:{id:this.props.id,isInstanced:!0,bufferLayout:this.getAttributeManager().getBufferLayouts(),...this.getShaders()},useTangents:!1}}draw({context:e}){if(!this.state.scenegraph)return;this.props._animations&&this.state.animator&&(this.state.animator.animate(e.timeline.getTime()),this.setNeedsRedraw());let{viewport:n,renderPass:r}=this.context,{sizeScale:s,sizeMinPixels:o,sizeMaxPixels:i,opacity:c,coordinateSystem:a}=this.props,f=this.getNumInstances();this.state.scenegraph.traverse((l,{worldMatrix:A})=>{if(l instanceof le.ModelNode){let{model:m}=l;m.setInstanceCount(f),m.setUniforms({sizeScale:s,opacity:c,sizeMinPixels:o,sizeMaxPixels:i,composeModelMatrix:nt(n,a),sceneModelMatrix:A,u_Camera:m.uniforms.project_uCameraPosition}),m.draw(r)}})}};ze.defaultProps=Wf;ze.layerName="ScenegraphLayer";var Ko=ze;return Yo(qe);})(); return __exports__; });