@luma.gl/shaders 10.0.0-alpha.6 → 10.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/dist.dev.js +159 -127
  2. package/dist/dist.min.js +110 -105
  3. package/dist/glsl.cjs.map +1 -1
  4. package/dist/index.cjs.map +2 -2
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/lib/glsl-shader-assembler.cjs +1 -1
  9. package/dist/lib/glsl-shader-assembler.js +1 -1
  10. package/dist/lib/glsl-shader-assembler.js.map +1 -1
  11. package/dist/lib/preprocessor/preprocessor.cjs +21 -0
  12. package/dist/lib/preprocessor/preprocessor.js +21 -0
  13. package/dist/lib/preprocessor/preprocessor.js.map +1 -1
  14. package/dist/lib/shader-assembly/assemble-glsl-shaders.cjs +11 -19
  15. package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts +2 -2
  16. package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts.map +1 -1
  17. package/dist/lib/shader-assembly/assemble-glsl-shaders.js +12 -20
  18. package/dist/lib/shader-assembly/assemble-glsl-shaders.js.map +1 -1
  19. package/dist/lib/shader-assembly/assemble-wgsl-shaders.cjs +6 -6
  20. package/dist/lib/shader-assembly/assemble-wgsl-shaders.js +7 -7
  21. package/dist/lib/shader-assembly/assemble-wgsl-shaders.js.map +1 -1
  22. package/dist/lib/shader-assembly/shader-assembly-types.d.ts +7 -7
  23. package/dist/lib/shader-assembly/shader-assembly-types.d.ts.map +1 -1
  24. package/dist/lib/shader-assembly/shader-hooks.cjs +4 -1
  25. package/dist/lib/shader-assembly/shader-hooks.d.ts.map +1 -1
  26. package/dist/lib/shader-assembly/shader-hooks.js +4 -1
  27. package/dist/lib/shader-assembly/shader-hooks.js.map +1 -1
  28. package/dist/lib/shader-assembly/shader-injections.d.ts +2 -0
  29. package/dist/lib/shader-assembly/shader-injections.d.ts.map +1 -1
  30. package/dist/lib/shader-assembly/shader-injections.js.map +1 -1
  31. package/dist/lib/shader-assembly/shader-plugin-varyings.cjs +39 -22
  32. package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts +5 -5
  33. package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts.map +1 -1
  34. package/dist/lib/shader-assembly/shader-plugin-varyings.js +45 -19
  35. package/dist/lib/shader-assembly/shader-plugin-varyings.js.map +1 -1
  36. package/dist/lib/shader-generator/glsl/generate-glsl.d.ts +1 -1
  37. package/dist/lib/shader-generator/glsl/generate-glsl.d.ts.map +1 -1
  38. package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts +1 -1
  39. package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts.map +1 -1
  40. package/dist/lib/shader-plugin.cjs +44 -30
  41. package/dist/lib/shader-plugin.d.ts +33 -32
  42. package/dist/lib/shader-plugin.d.ts.map +1 -1
  43. package/dist/lib/shader-plugin.js +49 -31
  44. package/dist/lib/shader-plugin.js.map +1 -1
  45. package/dist/lib/wgsl-shader-assembler.cjs +1 -1
  46. package/dist/lib/wgsl-shader-assembler.js +1 -1
  47. package/dist/lib/wgsl-shader-assembler.js.map +1 -1
  48. package/dist/modules/engine/clip/clip.cjs +18 -30
  49. package/dist/modules/engine/clip/clip.d.ts.map +1 -1
  50. package/dist/modules/engine/clip/clip.js +19 -31
  51. package/dist/modules/engine/clip/clip.js.map +1 -1
  52. package/dist/modules/engine/filter/filter.cjs +9 -18
  53. package/dist/modules/engine/filter/filter.d.ts.map +1 -1
  54. package/dist/modules/engine/filter/filter.js +9 -18
  55. package/dist/modules/engine/filter/filter.js.map +1 -1
  56. package/dist/modules/math/fp64/fp64.cjs +1 -1
  57. package/dist/modules/math/fp64/fp64.d.ts +1 -1
  58. package/dist/modules/math/fp64/fp64.d.ts.map +1 -1
  59. package/dist/modules/math/fp64/fp64.js +1 -1
  60. package/dist/modules/math/fp64/fp64.js.map +1 -1
  61. package/dist/types.cjs +27 -16
  62. package/dist/types.d.ts +7 -7
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/types.js +2 -7
  65. package/dist/types.js.map +1 -1
  66. package/dist/wgsl.cjs +20 -4
  67. package/dist/wgsl.cjs.map +1 -1
  68. package/dist/wgsl.d.ts +1 -1
  69. package/dist/wgsl.d.ts.map +1 -1
  70. package/dist/wgsl.js +1 -1
  71. package/dist/wgsl.js.map +1 -1
  72. package/package.json +3 -3
  73. package/src/index.ts +3 -4
  74. package/src/lib/glsl-shader-assembler.ts +1 -1
  75. package/src/lib/preprocessor/preprocessor.ts +25 -0
  76. package/src/lib/shader-assembly/assemble-glsl-shaders.ts +17 -22
  77. package/src/lib/shader-assembly/assemble-wgsl-shaders.ts +8 -8
  78. package/src/lib/shader-assembly/shader-assembly-types.ts +7 -7
  79. package/src/lib/shader-assembly/shader-hooks.ts +6 -1
  80. package/src/lib/shader-assembly/shader-injections.ts +2 -0
  81. package/src/lib/shader-assembly/shader-plugin-varyings.ts +58 -27
  82. package/src/lib/shader-generator/glsl/generate-glsl.ts +1 -1
  83. package/src/lib/shader-generator/wgsl/generate-wgsl.ts +1 -1
  84. package/src/lib/shader-module/shader-module-dependencies.ts +1 -1
  85. package/src/lib/shader-plugin.ts +75 -68
  86. package/src/lib/wgsl-shader-assembler.ts +1 -1
  87. package/src/modules/engine/clip/clip.ts +19 -31
  88. package/src/modules/engine/filter/filter.ts +9 -18
  89. package/src/modules/math/fp64/fp64.ts +1 -1
  90. package/src/types.ts +75 -7
  91. package/src/wgsl.ts +12 -1
package/dist/dist.min.js CHANGED
@@ -4,12 +4,12 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var gt=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Hr=Object.prototype.hasOwnProperty;var Wr=(e,t)=>{for(var i in t)gt(e,i,{get:t[i],enumerable:!0})},qr=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Vr(t))!Hr.call(e,r)&&r!==i&&gt(e,r,{get:()=>t[r],enumerable:!(n=zr(t,r))||n.enumerable});return e};var jr=e=>qr(gt({},"__esModule",{value:!0}),e);var Xs={};Wr(Xs,{GLSLShaderAssembler:()=>_e,PBR_TONE_MAP_MODE:()=>ei,SKIN_MAX_JOINTS:()=>H,STORAGE_COLOR_DEFAULT_BYTE_STRIDES:()=>Je,STORAGE_COLOR_FORMAT:()=>U,STORAGE_COLOR_FORMAT_BYTE_LENGTHS:()=>Xe,ShaderAssembler:()=>z,WGSLShaderAssembler:()=>ve,_resolveModules:()=>Ci,areaLighting:()=>ct,assembleGLSLShaderPair:()=>he,atmosphere:()=>Or,capitalize:()=>J,checkShaderModuleDeprecations:()=>ae,clipShaderPlugin:()=>or,clouds:()=>pt,colors:()=>tr,combineInjects:()=>Ii,convertToVec4:()=>Nt,dggs:()=>jn,dirlight:()=>Kt,filterShaderPlugin:()=>rr,firefly:()=>kr,floatColors:()=>fe,fp32:()=>Un,fp64:()=>Wn,fp64LowPart:()=>be,fp64arithmetic:()=>Wt,fp64ify:()=>ce,fp64ifyMatrix4:()=>xe,fromHalfFloat:()=>wn,generateShaderForModule:()=>rn,getGLSLUniformBlocks:()=>Te,getPassthroughFS:()=>Ji,getQualifierDetails:()=>Xi,getShaderInfo:()=>He,getShaderModuleDependencies:()=>k,getShaderModuleSource:()=>Y,getShaderModuleUniformBlockFields:()=>Ct,getShaderModuleUniformBlockName:()=>Ee,getShaderModuleUniformLayoutValidationResult:()=>Lt,getShaderModuleUniforms:()=>yi,globeClouds:()=>Gr,gouraudMaterial:()=>Zt,gpuAnimation:()=>sr,heightFog:()=>wr,heightFogFunctions:()=>ut,ibl:()=>it,initializeShaderModule:()=>Re,initializeShaderModules:()=>$,integrateSurfaceWeather:()=>Br,lambertMaterial:()=>Yt,lighting:()=>O,mergeShaderPluginModules:()=>wi,normalizeByteColor3:()=>te,normalizeByteColor4:()=>Ze,pathDash:()=>Fn,patternFill:()=>Nr,pbrMaterial:()=>Er,pbrScene:()=>ft,phongMaterial:()=>Xt,picking:()=>nr,pointGlow:()=>Dr,precipitation:()=>Fr,preprocess:()=>V,random:()=>On,resolveShaderPlugins:()=>Ei,resolveUseByteColors:()=>ee,riverWaterMaterial:()=>br,scanWGSLInterface:()=>Le,sketchStroke:()=>Dn,skin:()=>ar,storageColors:()=>ir,surfaceWeather:()=>Ur,toHalfFloat:()=>En,typeToChannelCount:()=>en,typeToChannelSuffix:()=>Qi,validateShaderModuleUniformLayout:()=>we,valueNoise:()=>q,volumeRaymarch:()=>Bn,warnIfGLSLUniformBlocksAreNotStd140:()=>Pe,waterMaterial:()=>lt});var B="(?:var<\\s*(uniform|storage(?:\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)?)\\s*>|var)\\s+([A-Za-z_][A-Za-z0-9_]*)";var ne=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*${B}`,"g")],ye=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*${B}`,"g")],si=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g")],$r=[new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)\\s*${B}`,"g"),new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${B}`,"g")];function re(e){let t=e.split(""),i=0,n=0,r=!1,o=!1,a=!1;for(;i<e.length;){let s=e[i],l=e[i+1];if(o){a?a=!1:s==="\\"?a=!0:s==='"'&&(o=!1),i++;continue}if(r){s===`
7
+ "use strict";var __exports__=(()=>{var mt=Object.defineProperty;var qr=Object.getOwnPropertyDescriptor;var jr=Object.getOwnPropertyNames;var $r=Object.prototype.hasOwnProperty;var Kr=(e,t)=>{for(var i in t)mt(e,i,{get:t[i],enumerable:!0})},Yr=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jr(t))!$r.call(e,r)&&r!==i&&mt(e,r,{get:()=>t[r],enumerable:!(n=qr(t,r))||n.enumerable});return e};var Zr=e=>Yr(mt({},"__esModule",{value:!0}),e);var Xs={};Kr(Xs,{GLSLShaderAssembler:()=>_e,PBR_TONE_MAP_MODE:()=>ni,SKIN_MAX_JOINTS:()=>q,STORAGE_COLOR_DEFAULT_BYTE_STRIDES:()=>Qe,STORAGE_COLOR_FORMAT:()=>U,STORAGE_COLOR_FORMAT_BYTE_LENGTHS:()=>Je,ShaderAssembler:()=>V,WGSLShaderAssembler:()=>ve,_resolveModules:()=>Mi,areaLighting:()=>ft,assembleGLSLShaderPair:()=>he,atmosphere:()=>Gr,capitalize:()=>J,checkShaderModuleDeprecations:()=>oe,clipShaderPlugin:()=>cr,clouds:()=>dt,colors:()=>or,combineInjects:()=>Li,convertToVec4:()=>Ot,dggs:()=>Zn,dirlight:()=>Xt,filterShaderPlugin:()=>lr,firefly:()=>Hr,floatColors:()=>fe,fp32:()=>Vn,fp64:()=>Kn,fp64LowPart:()=>be,fp64arithmetic:()=>$t,fp64ify:()=>ce,fp64ifyMatrix4:()=>xe,fromHalfFloat:()=>Dn,generateShaderForModule:()=>ln,getGLSLUniformBlocks:()=>Pe,getPassthroughFS:()=>nn,getQualifierDetails:()=>tn,getShaderInfo:()=>We,getShaderModuleDependencies:()=>k,getShaderModuleSource:()=>Z,getShaderModuleUniformBlockFields:()=>At,getShaderModuleUniformBlockName:()=>we,getShaderModuleUniformLayoutValidationResult:()=>Mt,getShaderModuleUniforms:()=>Ai,globeClouds:()=>Wr,gouraudMaterial:()=>Qt,gpuAnimation:()=>ur,heightFog:()=>Dr,heightFogFunctions:()=>pt,ibl:()=>nt,initializeShaderModule:()=>Re,initializeShaderModules:()=>Y,integrateSurfaceWeather:()=>zr,lambertMaterial:()=>Jt,lighting:()=>O,mergeShaderPluginModules:()=>Fi,normalizeByteColor3:()=>te,normalizeByteColor4:()=>Xe,pathDash:()=>kn,patternFill:()=>Br,pbrMaterial:()=>Nr,pbrScene:()=>ut,phongMaterial:()=>ei,picking:()=>sr,pointGlow:()=>Ur,precipitation:()=>kr,preprocess:()=>W,random:()=>Gn,resolveShaderPlugins:()=>Di,resolveUseByteColors:()=>ee,riverWaterMaterial:()=>yr,scanWGSLInterface:()=>Le,sketchStroke:()=>Un,skin:()=>fr,storageColors:()=>ar,surfaceWeather:()=>Vr,toHalfFloat:()=>Nn,typeToChannelCount:()=>on,typeToChannelSuffix:()=>rn,validateShaderModuleUniformLayout:()=>Te,valueNoise:()=>$,volumeRaymarch:()=>zn,warnIfGLSLUniformBlocksAreNotStd140:()=>Ne,waterMaterial:()=>ct});var B="(?:var<\\s*(uniform|storage(?:\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)?)\\s*>|var)\\s+([A-Za-z_][A-Za-z0-9_]*)";var ne=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*${B}`,"g")],ye=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto|\\d+)\\s*\\)\\s*${B}`,"g")],fi=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g")],Xr=[new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)\\s*${B}`,"g"),new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${B}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${B}`,"g")];function z(e){let t=e.split(""),i=0,n=0,r=!1,o=!1,a=!1;for(;i<e.length;){let s=e[i],l=e[i+1];if(o){a?a=!1:s==="\\"?a=!0:s==='"'&&(o=!1),i++;continue}if(r){s===`
8
8
  `||s==="\r"?r=!1:t[i]=" ",i++;continue}if(n>0){if(s==="/"&&l==="*"){t[i]=" ",t[i+1]=" ",n++,i+=2;continue}if(s==="*"&&l==="/"){t[i]=" ",t[i+1]=" ",n--,i+=2;continue}s!==`
9
- `&&s!=="\r"&&(t[i]=" "),i++;continue}if(s==='"'){o=!0,i++;continue}if(s==="/"&&l==="/"){t[i]=" ",t[i+1]=" ",r=!0,i+=2;continue}if(s==="/"&&l==="*"){t[i]=" ",t[i+1]=" ",n=1,i+=2;continue}i++}return t.join("")}function j(e,t){let i=re(e),n=[];for(let r of t){r.lastIndex=0;let o;for(o=r.exec(i);o;){let a=r===t[0],s=o.index,l=o[0].length;n.push({match:e.slice(s,s+l),index:s,length:l,bindingToken:o[a?1:2],groupToken:o[a?2:1],accessDeclaration:o[3]?.trim(),name:o[4]}),o=r.exec(i)}}return n.sort((r,o)=>r.index-o.index)}function mt(e,t,i){let n=j(e,t);if(!n.length)return e;let r="",o=0;for(let a of n)r+=e.slice(o,a.index),r+=i(a),o=a.index+a.length;return r+=e.slice(o),r}function ht(e){return/@binding\(\s*auto\s*\)/.test(re(e))}function li(e,t){return j(e,t===ne||t===ye?$r:t).find(n=>n.bindingToken==="auto")}function Le(e,t={}){let i=ci(e),n=Kr(i);if(!n)return null;let r=Yr(i,n);if(!r)return null;let o=Xr(i,n,r);if(!o)return null;if(t.scanVertexAttributes===!1)return{attributes:[],bindings:o};let a=Zr(i,n);if(!a)return null;let s=io(i,n,r,a,t.vertexEntryPoint);return s?{attributes:s,bindings:o}:null}function ci(e){let t=re(e),i=/[A-Za-z_][A-Za-z0-9_]*|(?:0[xX][0-9A-Fa-f]+|\d+)|[@(){}<>\[\]:,;=]/g,n=[],r=i.exec(t);for(;r;)n.push({value:r[0],index:r.index}),r=i.exec(t);return n}function Kr(e){let t=[],i=0;for(let n of e){if(n.value==="}"&&i===0)return null;t.push(i),n.value==="{"?i++:n.value==="}"&&i--}return i===0?t:null}function Yr(e,t){let i=new Map;for(let n=0;n<e.length;n++){if(t[n]!==0||e[n].value!=="alias")continue;let r=e[n+1]?.value;if(!ue(r)||e[n+2]?.value!=="="||i.has(r))return null;let o=pi(e,t,n+3,";");if(o<0||o===n+3)return null;i.set(r,Ce(e.slice(n+3,o))),n=o}return i}function Zr(e,t){let i=new Map;for(let n=0;n<e.length;n++){if(t[n]!==0||e[n].value!=="struct")continue;let r=e[n+1]?.value,o=n+2;if(!ue(r)||i.has(r)||e[o]?.value!=="{")return null;let a=xt(e,o,"{","}");if(a<0)return null;i.set(r,e.slice(o+1,a)),n=a}return i}function Xr(e,t,i){let n=[],r=new Set,o=new Set;for(let a=0;a<e.length;a++){if(t[a]!==0||e[a].value!=="var")continue;let s=di(e,t,a),l=e.slice(s,a),c=_t(l,"group"),f=_t(l,"binding");if(c===null||f===null||c===void 0!=(f===void 0))return null;if(c===void 0||f===void 0)continue;let u=a+1,p=[];if(e[u]?.value==="<"){let S=xt(e,u,"<",">");if(S<0)return null;let b=Ae(e.slice(u+1,S),",");if(!b)return null;p=b.map(Ce),u=S+1}let d=e[u]?.value;if(!ue(d)||e[u+1]?.value!==":")return null;let h=pi(e,t,u+2,";");if(h<0||h===u+2)return null;let g=bt(Ce(e.slice(u+2,h)),i);if(!g)return null;let x=Jr({name:d,group:c,location:f,addressSpace:p,resourceType:g}),I=`${c}:${f}`;if(!x||r.has(I)||o.has(d))return null;n.push(x),r.add(I),o.add(d),a=h}return to(n),n.sort((a,s)=>a.group-s.group||a.location-s.location||a.name.localeCompare(s.name))}function Jr(e){let{name:t,group:i,location:n,addressSpace:r,resourceType:o}=e,a={name:t,group:i,location:n};if(r[0]==="uniform"&&r.length===1)return{...a,type:"uniform"};if(r[0]==="storage"&&r.length<=2){let s=r[1]||"read";return s==="read"?{...a,type:"read-only-storage"}:s==="read_write"?{...a,type:"storage"}:null}return r.length>0?null:o==="sampler"||o==="sampler_comparison"?{...a,type:"sampler",...o==="sampler_comparison"?{samplerType:"comparison"}:{}}:o==="texture_external"?{...a,type:"external-texture"}:Qr(a,o)||eo(a,o)}function Qr(e,t){let i=/^texture_storage_(1d|2d|2d_array|3d)<([A-Za-z0-9_]+),(read|write|read_write)>$/.exec(t);if(!i)return null;let n={read:"read-only",write:"write-only",read_write:"read-write"}[i[3]];return{...e,type:"storage",format:i[2],access:n,viewDimension:vt(i[1])}}function eo(e,t){let i=/^texture_(multisampled_)?(1d|2d|2d_array|cube|cube_array|3d)<(f32|i32|u32)>$/.exec(t);if(i){if(i[1]&&i[2]!=="2d")return null;let r={f32:"float",i32:"sint",u32:"uint"}[i[3]];return{...e,type:"texture",viewDimension:vt(i[2]),sampleType:r,multisampled:!!i[1]}}let n=/^texture_depth_(multisampled_)?(2d|2d_array|cube|cube_array)$/.exec(t);return!n||n[1]&&n[2]!=="2d"?null:{...e,type:"texture",viewDimension:vt(n[2]),sampleType:"depth",multisampled:!!n[1]}}function to(e){for(let t of e){if(t.type!=="sampler"||t.samplerType||!t.name.endsWith("Sampler"))continue;let i=t.name.slice(0,-7);e.find(r=>r.type==="texture"&&r.name===i&&r.group===t.group)?.sampleType==="depth"&&(t.samplerType="non-filtering")}}function io(e,t,i,n,r){let o=no(e,t);if(!o)return null;let a=o.filter(d=>d.vertex),s=r?a.find(d=>d.name===r):a.length===1?a[0]:void 0;if(!s)return a.length===0&&!r?[]:null;let l=Ae(s.parameters,",");if(!l)return null;let c=[],f=new Set,u=new Set,p=new Set;for(let d of l)if(d.length>0&&!fi({declaration:d,aliases:i,structures:n,attributes:c,attributeLocations:f,attributeNames:u,visitedStructures:p}))return null;return c.sort((d,h)=>d.location-h.location||d.name.localeCompare(h.name))}function no(e,t){let i=[],n=new Set;for(let r=0;r<e.length;r++){if(t[r]!==0||e[r].value!=="fn")continue;let o=e[r+1]?.value,a=r+2;if(!ue(o)||n.has(o)||e[a]?.value!=="(")return null;let s=xt(e,a,"(",")");if(s<0)return null;let l=di(e,t,r);i.push({name:o,vertex:ui(e.slice(l,r),"vertex"),parameters:e.slice(a+1,s)}),n.add(o),r=s}return i}function fi(e){let{declaration:t,aliases:i,structures:n,attributes:r,attributeLocations:o,attributeNames:a,visitedStructures:s}=e,l=ao(t,":");if(l<1||l===t.length-1)return!1;let c=so(t.slice(0,l)),f=_t(t.slice(0,l),"location"),u=ui(t.slice(0,l),"builtin"),p=bt(Ce(t.slice(l+1)),i);if(!c||f===null||!p||f!==void 0&&u)return!1;if(f!==void 0){let g=oo(p);return!g||o.has(f)||a.has(c)?!1:(r.push({name:c,location:f,type:g}),o.add(f),a.add(c),!0)}if(u)return!0;let d=n.get(p);if(!d||s.has(p))return!1;let h=Ae(d,",");if(!h)return!1;s.add(p);for(let g of h)if(g.length>0&&!fi({...e,declaration:g}))return!1;return s.delete(p),!0}function bt(e,t,i=new Set){let n=ci(e),r="";for(let o of n){let a=t.get(o.value);if(!a){r+=ro(o.value);continue}if(i.has(o.value))return null;let s=new Set(i);s.add(o.value);let l=bt(a,t,s);if(!l)return null;r+=l}return r}function ro(e){let t=/^(vec[234]|mat[234]x[234])([fiuh])$/.exec(e);if(!t)return e;let i={f:"f32",i:"i32",u:"u32",h:"f16"}[t[2]];return`${t[1]}<${i}>`}function oo(e){return/^(?:i32|u32|f32|f16|vec[234]<(?:i32|u32|f32|f16)>)$/.test(e)?e:null}function _t(e,t){let i;for(let n=0;n<e.length;n++)if(!(e[n].value!=="@"||e[n+1]?.value!==t)){if(i!==void 0||e[n+2]?.value!=="("||!/^\d+$/.test(e[n+3]?.value||"")||e[n+4]?.value!==")")return null;i=Number(e[n+3].value)}return i}function ui(e,t){return e.some((i,n)=>i.value==="@"&&e[n+1]?.value===t)}function vt(e){return e.replace("_","-")}function xt(e,t,i,n){let r=0;for(let o=t;o<e.length;o++)if(e[o].value===i)r++;else if(e[o].value===n&&--r===0)return o;return-1}function Ae(e,t){let i=[],n=0,r={"(":0,"<":0,"[":0,"{":0},o=Object.keys(r),a={")":"(",">":"<","]":"[","}":"{"};for(let s=0;s<e.length;s++){let l=e[s].value;if(l===t&&o.every(c=>r[c]===0)){i.push(e.slice(n,s)),n=s+1;continue}if(l in r)r[l]++;else if(l in a){let c=a[l];if(r[c]--,r[c]<0)return null}}return o.every(s=>r[s]===0)?(i.push(e.slice(n)),i):null}function ao(e,t){let i=Ae(e,t);return i&&i.length===2?i[0].length:-1}function pi(e,t,i,n){for(let r=i;r<e.length;r++)if(t[r]===0&&e[r].value===n)return r;return-1}function di(e,t,i){for(let n=i-1;n>=0;n--)if(e[n].value===";"&&t[n]===0||e[n].value==="}"&&t[n]===1)return n+1;return 0}function so(e){for(let t=e.length-1;t>=0;t--)if(ue(e[t].value))return e[t].value;return null}function Ce(e){return e.map(t=>t.value).join("")}function ue(e){return!!(e&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e))}function P(e,t){if(!e){let i=new Error(t||"shaders: assertion failed.");throw Error.captureStackTrace?.(i,P),i}}var St={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function mi(e){let t={};for(let[i,n]of Object.entries(e))t[i]=lo(n);return t}function hi(e,t,i){let n={};for(let[r,o]of Object.entries(t))e&&r in e&&!o.private?(o.validate&&P(o.validate(e[r],o),`${i}: invalid ${r}`),n[r]=e[r]):n[r]=o.value;return n}function lo(e){let t=gi(e);if(t!=="object")return{value:e,...St[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...St[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=gi(e.value),{...e,...St[t],type:t}):{type:"object",value:null};throw new Error("props")}function gi(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var _i=`#ifdef MODULE_LOGDEPTH
9
+ `&&s!=="\r"&&(t[i]=" "),i++;continue}if(s==='"'){o=!0,i++;continue}if(s==="/"&&l==="/"){t[i]=" ",t[i+1]=" ",r=!0,i+=2;continue}if(s==="/"&&l==="*"){t[i]=" ",t[i+1]=" ",n=1,i+=2;continue}i++}return t.join("")}function K(e,t){let i=z(e),n=[];for(let r of t){r.lastIndex=0;let o;for(o=r.exec(i);o;){let a=r===t[0],s=o.index,l=o[0].length;n.push({match:e.slice(s,s+l),index:s,length:l,bindingToken:o[a?1:2],groupToken:o[a?2:1],accessDeclaration:o[3]?.trim(),name:o[4]}),o=r.exec(i)}}return n.sort((r,o)=>r.index-o.index)}function ht(e,t,i){let n=K(e,t);if(!n.length)return e;let r="",o=0;for(let a of n)r+=e.slice(o,a.index),r+=i(a),o=a.index+a.length;return r+=e.slice(o),r}function _t(e){return/@binding\(\s*auto\s*\)/.test(z(e))}function ui(e,t){return K(e,t===ne||t===ye?Xr:t).find(n=>n.bindingToken==="auto")}function Le(e,t={}){let i=pi(e),n=Jr(i);if(!n)return null;let r=Qr(i,n);if(!r)return null;let o=to(i,n,r);if(!o)return null;if(t.scanVertexAttributes===!1)return{attributes:[],bindings:o};let a=eo(i,n);if(!a)return null;let s=ao(i,n,r,a,t.vertexEntryPoint);return s?{attributes:s,bindings:o}:null}function pi(e){let t=z(e),i=/[A-Za-z_][A-Za-z0-9_]*|(?:0[xX][0-9A-Fa-f]+|\d+)|[@(){}<>\[\]:,;=]/g,n=[],r=i.exec(t);for(;r;)n.push({value:r[0],index:r.index}),r=i.exec(t);return n}function Jr(e){let t=[],i=0;for(let n of e){if(n.value==="}"&&i===0)return null;t.push(i),n.value==="{"?i++:n.value==="}"&&i--}return i===0?t:null}function Qr(e,t){let i=new Map;for(let n=0;n<e.length;n++){if(t[n]!==0||e[n].value!=="alias")continue;let r=e[n+1]?.value;if(!ue(r)||e[n+2]?.value!=="="||i.has(r))return null;let o=mi(e,t,n+3,";");if(o<0||o===n+3)return null;i.set(r,Ce(e.slice(n+3,o))),n=o}return i}function eo(e,t){let i=new Map;for(let n=0;n<e.length;n++){if(t[n]!==0||e[n].value!=="struct")continue;let r=e[n+1]?.value,o=n+2;if(!ue(r)||i.has(r)||e[o]?.value!=="{")return null;let a=St(e,o,"{","}");if(a<0)return null;i.set(r,e.slice(o+1,a)),n=a}return i}function to(e,t,i){let n=[],r=new Set,o=new Set;for(let a=0;a<e.length;a++){if(t[a]!==0||e[a].value!=="var")continue;let s=hi(e,t,a),l=e.slice(s,a),c=vt(l,"group"),f=vt(l,"binding");if(c===null||f===null||c===void 0!=(f===void 0))return null;if(c===void 0||f===void 0)continue;let u=a+1,p=[];if(e[u]?.value==="<"){let S=St(e,u,"<",">");if(S<0)return null;let b=Ae(e.slice(u+1,S),",");if(!b)return null;p=b.map(Ce),u=S+1}let d=e[u]?.value;if(!ue(d)||e[u+1]?.value!==":")return null;let v=mi(e,t,u+2,";");if(v<0||v===u+2)return null;let m=xt(Ce(e.slice(u+2,v)),i);if(!m)return null;let x=io({name:d,group:c,location:f,addressSpace:p,resourceType:m}),I=`${c}:${f}`;if(!x||r.has(I)||o.has(d))return null;n.push(x),r.add(I),o.add(d),a=v}return oo(n),n.sort((a,s)=>a.group-s.group||a.location-s.location||a.name.localeCompare(s.name))}function io(e){let{name:t,group:i,location:n,addressSpace:r,resourceType:o}=e,a={name:t,group:i,location:n};if(r[0]==="uniform"&&r.length===1)return{...a,type:"uniform"};if(r[0]==="storage"&&r.length<=2){let s=r[1]||"read";return s==="read"?{...a,type:"read-only-storage"}:s==="read_write"?{...a,type:"storage"}:null}return r.length>0?null:o==="sampler"||o==="sampler_comparison"?{...a,type:"sampler",...o==="sampler_comparison"?{samplerType:"comparison"}:{}}:o==="texture_external"?{...a,type:"external-texture"}:no(a,o)||ro(a,o)}function no(e,t){let i=/^texture_storage_(1d|2d|2d_array|3d)<([A-Za-z0-9_]+),(read|write|read_write)>$/.exec(t);if(!i)return null;let n={read:"read-only",write:"write-only",read_write:"read-write"}[i[3]];return{...e,type:"storage",format:i[2],access:n,viewDimension:bt(i[1])}}function ro(e,t){let i=/^texture_(multisampled_)?(1d|2d|2d_array|cube|cube_array|3d)<(f32|i32|u32)>$/.exec(t);if(i){if(i[1]&&i[2]!=="2d")return null;let r={f32:"float",i32:"sint",u32:"uint"}[i[3]];return{...e,type:"texture",viewDimension:bt(i[2]),sampleType:r,multisampled:!!i[1]}}let n=/^texture_depth_(multisampled_)?(2d|2d_array|cube|cube_array)$/.exec(t);return!n||n[1]&&n[2]!=="2d"?null:{...e,type:"texture",viewDimension:bt(n[2]),sampleType:"depth",multisampled:!!n[1]}}function oo(e){for(let t of e){if(t.type!=="sampler"||t.samplerType||!t.name.endsWith("Sampler"))continue;let i=t.name.slice(0,-7);e.find(r=>r.type==="texture"&&r.name===i&&r.group===t.group)?.sampleType==="depth"&&(t.samplerType="non-filtering")}}function ao(e,t,i,n,r){let o=so(e,t);if(!o)return null;let a=o.filter(d=>d.vertex),s=r?a.find(d=>d.name===r):a.length===1?a[0]:void 0;if(!s)return a.length===0&&!r?[]:null;let l=Ae(s.parameters,",");if(!l)return null;let c=[],f=new Set,u=new Set,p=new Set;for(let d of l)if(d.length>0&&!di({declaration:d,aliases:i,structures:n,attributes:c,attributeLocations:f,attributeNames:u,visitedStructures:p}))return null;return c.sort((d,v)=>d.location-v.location||d.name.localeCompare(v.name))}function so(e,t){let i=[],n=new Set;for(let r=0;r<e.length;r++){if(t[r]!==0||e[r].value!=="fn")continue;let o=e[r+1]?.value,a=r+2;if(!ue(o)||n.has(o)||e[a]?.value!=="(")return null;let s=St(e,a,"(",")");if(s<0)return null;let l=hi(e,t,r);i.push({name:o,vertex:gi(e.slice(l,r),"vertex"),parameters:e.slice(a+1,s)}),n.add(o),r=s}return i}function di(e){let{declaration:t,aliases:i,structures:n,attributes:r,attributeLocations:o,attributeNames:a,visitedStructures:s}=e,l=fo(t,":");if(l<1||l===t.length-1)return!1;let c=uo(t.slice(0,l)),f=vt(t.slice(0,l),"location"),u=gi(t.slice(0,l),"builtin"),p=xt(Ce(t.slice(l+1)),i);if(!c||f===null||!p||f!==void 0&&u)return!1;if(f!==void 0){let m=co(p);return!m||o.has(f)||a.has(c)?!1:(r.push({name:c,location:f,type:m}),o.add(f),a.add(c),!0)}if(u)return!0;let d=n.get(p);if(!d||s.has(p))return!1;let v=Ae(d,",");if(!v)return!1;s.add(p);for(let m of v)if(m.length>0&&!di({...e,declaration:m}))return!1;return s.delete(p),!0}function xt(e,t,i=new Set){let n=pi(e),r="";for(let o of n){let a=t.get(o.value);if(!a){r+=lo(o.value);continue}if(i.has(o.value))return null;let s=new Set(i);s.add(o.value);let l=xt(a,t,s);if(!l)return null;r+=l}return r}function lo(e){let t=/^(vec[234]|mat[234]x[234])([fiuh])$/.exec(e);if(!t)return e;let i={f:"f32",i:"i32",u:"u32",h:"f16"}[t[2]];return`${t[1]}<${i}>`}function co(e){return/^(?:i32|u32|f32|f16|vec[234]<(?:i32|u32|f32|f16)>)$/.test(e)?e:null}function vt(e,t){let i;for(let n=0;n<e.length;n++)if(!(e[n].value!=="@"||e[n+1]?.value!==t)){if(i!==void 0||e[n+2]?.value!=="("||!/^\d+$/.test(e[n+3]?.value||"")||e[n+4]?.value!==")")return null;i=Number(e[n+3].value)}return i}function gi(e,t){return e.some((i,n)=>i.value==="@"&&e[n+1]?.value===t)}function bt(e){return e.replace("_","-")}function St(e,t,i,n){let r=0;for(let o=t;o<e.length;o++)if(e[o].value===i)r++;else if(e[o].value===n&&--r===0)return o;return-1}function Ae(e,t){let i=[],n=0,r={"(":0,"<":0,"[":0,"{":0},o=Object.keys(r),a={")":"(",">":"<","]":"[","}":"{"};for(let s=0;s<e.length;s++){let l=e[s].value;if(l===t&&o.every(c=>r[c]===0)){i.push(e.slice(n,s)),n=s+1;continue}if(l in r)r[l]++;else if(l in a){let c=a[l];if(r[c]--,r[c]<0)return null}}return o.every(s=>r[s]===0)?(i.push(e.slice(n)),i):null}function fo(e,t){let i=Ae(e,t);return i&&i.length===2?i[0].length:-1}function mi(e,t,i,n){for(let r=i;r<e.length;r++)if(t[r]===0&&e[r].value===n)return r;return-1}function hi(e,t,i){for(let n=i-1;n>=0;n--)if(e[n].value===";"&&t[n]===0||e[n].value==="}"&&t[n]===1)return n+1;return 0}function uo(e){for(let t=e.length-1;t>=0;t--)if(ue(e[t].value))return e[t].value;return null}function Ce(e){return e.map(t=>t.value).join("")}function ue(e){return!!(e&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e))}function P(e,t){if(!e){let i=new Error(t||"shaders: assertion failed.");throw Error.captureStackTrace?.(i,P),i}}var It={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function vi(e){let t={};for(let[i,n]of Object.entries(e))t[i]=po(n);return t}function bi(e,t,i){let n={};for(let[r,o]of Object.entries(t))e&&r in e&&!o.private?(o.validate&&P(o.validate(e[r],o),`${i}: invalid ${r}`),n[r]=e[r]):n[r]=o.value;return n}function po(e){let t=_i(e);if(t!=="object")return{value:e,...It[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...It[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=_i(e.value),{...e,...It[t],type:t}):{type:"object",value:null};throw new Error("props")}function _i(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var xi=`#ifdef MODULE_LOGDEPTH
10
10
  logdepth_adjustPosition(gl_Position);
11
11
  #endif
12
- `,vi=`#ifdef MODULE_MATERIAL
12
+ `,Si=`#ifdef MODULE_MATERIAL
13
13
  fragColor = material_filterColor(fragColor);
14
14
  #endif
15
15
 
@@ -29,50 +29,53 @@
29
29
  #ifdef MODULE_LOGDEPTH
30
30
  logdepth_setFragDepth();
31
31
  #endif
32
- `;var co={vertex:_i,fragment:vi},bi=/void\s+main\s*\([^)]*\)\s*\{\n?/,xi=/}\n?[^{}]*$/,It=[],pe="__LUMA_INJECT_DECLARATIONS__";function Si(e){let t={vertex:{},fragment:{}};for(let i in e){let n=e[i],r=fo(i);typeof n=="string"&&(n={order:0,injection:n}),t[r][i]=n}return t}function fo(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function oe(e,t,i,n=!1,r="glsl",o={}){let a=t==="vertex";for(let s in i){let l=i[s];l.sort((f,u)=>f.order-u.order),It.length=l.length;for(let f=0,u=l.length;f<u;++f)It[f]=l[f].injection;let c=`${It.join(`
32
+ `;var go={vertex:xi,fragment:Si},Ii=/void\s+main\s*\([^)]*\)\s*\{\n?/,yi=/}\n?[^{}]*$/,yt=[],pe="__LUMA_INJECT_DECLARATIONS__";function Ci(e){let t={vertex:{},fragment:{}};for(let i in e){let n=e[i],r=mo(i);typeof n=="string"&&(n={order:0,injection:n}),t[r][i]=n}return t}function mo(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function re(e,t,i,n=!1,r="glsl",o={}){let a=t==="vertex";for(let s in i){let l=i[s];l.sort((f,u)=>f.order-u.order),yt.length=l.length;for(let f=0,u=l.length;f<u;++f)yt[f]=l[f].injection;let c=`${yt.join(`
33
33
  `)}
34
- `;switch(s){case"vs:#decl":(r==="wgsl"||a)&&(e=e.replace(pe,c));break;case"vs:#main-start":(r==="wgsl"||a)&&(e=r==="wgsl"?Me(e,"vertex",c,"start",o.vertex):e.replace(bi,f=>f+c));break;case"vs:#main-end":(r==="wgsl"||a)&&(e=r==="wgsl"?Me(e,"vertex",c,"end",o.vertex):e.replace(xi,f=>c+f));break;case"fs:#decl":(r==="wgsl"||!a)&&(e=e.replace(pe,c));break;case"fs:#main-start":(r==="wgsl"||!a)&&(e=r==="wgsl"?Me(e,"fragment",c,"start",o.fragment):e.replace(bi,f=>f+c));break;case"fs:#main-end":(r==="wgsl"||!a)&&(e=r==="wgsl"?Me(e,"fragment",c,"end",o.fragment):e.replace(xi,f=>c+f));break;default:e=e.replace(s,f=>f+c)}}return e=e.replace(pe,""),n&&(e=e.replace(/\}\s*$/,s=>s+co[t])),e}function Ii(e){let t={};return P(Array.isArray(e)&&e.length>1),e.forEach(i=>{for(let n in i)t[n]=t[n]?`${t[n]}
35
- ${i[n]}`:i[n]}),t}function Me(e,t,i,n,r){let o=uo(e,t,r);if(!o)return e;if(n==="start"){let a=o.openBraceIndex+1;return`${e.slice(0,a)}
36
- ${i}${e.slice(a)}`}return`${e.slice(0,o.closeBraceIndex)}${i}${e.slice(o.closeBraceIndex)}`}function uo(e,t,i){let n=t==="vertex"?"@vertex":"@fragment",r=e.indexOf(n);if(r<0)return null;let o=i?e.search(new RegExp(`\\bfn\\s+${po(i)}\\s*\\(`)):e.indexOf("fn",r);if(o<0)return null;let a=e.indexOf("{",o);if(a<0)return null;let s=0;for(let l=a;l<e.length;l++){let c=e[l];if(c==="{")s++;else if(c==="}"&&(s--,s===0))return{openBraceIndex:a,closeBraceIndex:l}}return null}function po(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(e){e.map(t=>Re(t))}function Re(e){if(e.instance)return;$(e.dependencies||[]);let{propTypes:t={},deprecations:i=[],inject:n={}}=e,r={normalizedInjections:Si(n),parsedDeprecations:go(i)};t&&(r.propValidators=mi(t)),e.instance=r;let o={};t&&(o=Object.entries(t).reduce((a,[s,l])=>{let c=l?.value;return c&&(a[s]=c),a},{})),e.defaultUniforms={...e.defaultUniforms,...o}}function yi(e,t,i){Re(e);let n=i||{...e.defaultUniforms};return t&&e.getUniforms?e.getUniforms(t,n):hi(t,e.instance?.propValidators,e.name)}function ae(e,t,i){e.deprecations?.forEach(n=>{n.regex?.test(t)&&(n.deprecated?i.deprecated(n.old,n.new)():i.removed(n.old,n.new)())})}function go(e){return e.forEach(t=>{t.type==="function"?t.regex=new RegExp(`\\b${t.old}\\(`):t.regex=new RegExp(`${t.type} ${t.old};`)}),e}function k(e){let t=new Set,i=new Set,n=[],r=new Map;function o(l){let c=r.get(l.name);if(c&&c!==l)throw new Error(`Shader module name collision: Multiple different module objects share the name "${l.name}". Each module object must have a unique name.`);r.set(l.name,l)}function a(l,c){if(i.has(l)){let u=[...c,l.name].join(" -> ");throw new Error(`Shader module dependency cycle detected: ${u}`)}if(t.has(l))return;o(l),i.add(l);let f=[...c,l.name];if(l.dependencies)for(let u of l.dependencies)a(u,f);i.delete(l),t.add(l),n.push(l)}for(let l of e)a(l,[]);let s=new Set;for(let l of n)l.implements!==void 0&&(P(!s.has(l.implements)),s.add(l.implements));return $(n),n}function mo(e){return k(e)}function Ci(e){return mo(e)}function ho(e){let t=Ai(e),i=So[t];if(!i)throw new Error(`Unsupported variable shader type: ${e}`);return i}function _o(e){let t=Li(e),i=xo[t];if(!i)throw new Error(`Unsupported attribute shader type: ${e}`);let[n,r]=i,o=n==="i32"||n==="u32",a=n!=="u32",s=bo[n]*r;return{primitiveType:n,components:r,byteLength:s,integer:o,signed:a}}var yt=class{getVariableShaderTypeInfo(t){return ho(t)}getAttributeShaderTypeInfo(t){return _o(t)}makeShaderAttributeType(t,i){return vo(t,i)}resolveAttributeShaderTypeAlias(t){return Li(t)}resolveVariableShaderTypeAlias(t){return Ai(t)}};function vo(e,t){return t===1?e:`vec${t}<${e}>`}function Li(e){return Io[e]||e}function Ai(e){return yo[e]||e}var K=new yt,bo={f32:4,f16:2,i32:4,u32:4},xo={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},So={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},Io={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},yo={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>",mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"};var Co=/^(vs|fs):(?:#(?:decl|main-start|main-end)|[A-Za-z_][\w-]*)$/;function Ei(e=[],t){let i=[],n={},r={},o={},a={};for(let s of e)Mi({modules:i,defines:n,injections:r,vertexInputs:o,varyings:a},s),Mi({modules:i,defines:n,injections:r,vertexInputs:o,varyings:a},s[t]);for(let s of Object.keys(a))if(o[s])throw new Error(`ShaderPlugin name "${s}" cannot be both a vertex input and a varying`);return{modules:i,defines:n,injections:r,vertexInputs:o,varyings:a}}function wi(e=[],t=[]){let i=[...e],n=new Set(i.map(r=>r.name));for(let r of t)n.has(r.name)||(i.push(r),n.add(r.name));return i}function Mi(e,t){if(t){t.modules?.length&&e.modules.push(...t.modules),t.defines&&Object.assign(e.defines,t.defines);for(let[i,n]of Object.entries(t.vertexInputs||{})){Ri(i,"vertex input");let r=e.vertexInputs[i];if(r&&r!==n)throw new Error(`ShaderPlugin vertex input "${i}" has conflicting types "${r}" and "${n}"`);e.vertexInputs[i]=n}for(let[i,n]of Object.entries(t.varyings||{})){Ri(i,"varying");let r=Lo(i,n),o=e.varyings[i];if(o&&(o.type!==r.type||o.interpolation!==r.interpolation))throw new Error(`ShaderPlugin varying "${i}" has conflicting declarations "${o.type}/${o.interpolation}" and "${r.type}/${r.interpolation}"`);e.varyings[i]=r}for(let i of t.injections||[])Ao(i.target),e.injections[i.target]||(e.injections[i.target]=[]),e.injections[i.target].push({injection:i.injection,order:i.order??0})}}function Ri(e,t){if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)||e.startsWith("_luma_"))throw new Error(`ShaderPlugin ${t} "${e}" must be a valid non-reserved identifier`)}function Lo(e,t){let{primitiveType:i}=K.getAttributeShaderTypeInfo(t.type),n=i==="i32"||i==="u32",r=t.interpolation||(n?"flat":"smooth");if(n&&r==="smooth")throw new Error(`ShaderPlugin integer varying "${e}" must use flat interpolation`);return{type:t.type,interpolation:r}}function Ao(e){if(!Co.test(e))throw new Error(`ShaderPlugin injection target "${e}" must be a named shader anchor or hook`)}var Mo=/^(?:uniform\s+)?(?:(?:lowp|mediump|highp)\s+)?[A-Za-z0-9_]+(?:<[^>]+>)?\s+([A-Za-z0-9_]+)(?:\s*\[[^\]]+\])?\s*;/,Ro=/((?:layout\s*\([^)]*\)\s*)*)uniform\s+([A-Za-z_][A-Za-z0-9_]*)\s*\{([\s\S]*?)\}\s*([A-Za-z_][A-Za-z0-9_]*)?\s*;/g;function Ee(e){return`${e.name}Uniforms`}function Ct(e,t){let i=t==="wgsl"?e.source:t==="vertex"?e.vs:e.fs;if(!i)return null;let n=Ee(e);return Eo(i,t==="wgsl"?"wgsl":"glsl",n)}function Lt(e,t){let i=Object.keys(e.uniformTypes||{});if(!i.length)return null;let n=Ct(e,t);return n?{moduleName:e.name,uniformBlockName:Ee(e),stage:t,expectedUniformNames:i,actualUniformNames:n,matches:Po(i,n)}:null}function we(e,t,i={}){let n=Lt(e,t);if(!n||n.matches)return n;let r=No(n);return i.log?.error?.(r,n)(),i.throwOnError!==!1&&P(!1,r),n}function Te(e){let t=[],i=Do(e);for(let n of i.matchAll(Ro)){let r=n[1]?.trim()||null;t.push({blockName:n[2],body:n[3],instanceName:n[4]||null,layoutQualifier:r,hasLayoutQualifier:!!r,isStd140:!!(r&&/\blayout\s*\([^)]*\bstd140\b[^)]*\)/.exec(r))})}return t}function Pe(e,t,i,n){let r=Te(e).filter(a=>!a.isStd140),o=new Set;for(let a of r){if(o.has(a.blockName))continue;o.add(a.blockName);let s=n?.label?`${n.label} `:"",l=a.hasLayoutQualifier?`declares ${Fo(a.layoutQualifier)} instead of layout(std140)`:"does not declare layout(std140)",c=`${s}${t} shader uniform block ${a.blockName} ${l}. luma.gl host-side shader block packing assumes explicit layout(std140) for GLSL uniform blocks. Add \`layout(std140)\` to the block declaration.`;i?.warn?.(c,a)()}return r}function Eo(e,t,i){let n=t==="wgsl"?wo(e,i):To(e,i);if(!n)return null;let r=[];for(let o of n.split(`
37
- `)){let a=o.replace(/\/\/.*$/,"").trim();if(!a||a.startsWith("#"))continue;let s=t==="wgsl"?a.match(/^([A-Za-z0-9_]+)\s*:/):a.match(Mo);s&&r.push(s[1])}return r}function wo(e,t){let i=new RegExp(`\\bstruct\\s+${t}\\b`,"m").exec(e);if(!i)return null;let n=e.indexOf("{",i.index);if(n<0)return null;let r=0;for(let o=n;o<e.length;o++){let a=e[o];if(a==="{"){r++;continue}if(a==="}"&&(r--,r===0))return e.slice(n+1,o)}return null}function To(e,t){return Te(e).find(n=>n.blockName===t)?.body||null}function Po(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function No(e){let{expectedUniformNames:t,actualUniformNames:i}=e,n=t.filter(s=>!i.includes(s)),r=i.filter(s=>!t.includes(s)),o=[`Expected ${t.length} fields, found ${i.length}.`],a=Oo(t,i);return a&&o.push(a),n.length&&o.push(`Missing from shader block (${n.length}): ${Ti(n)}.`),r.length&&o.push(`Unexpected in shader block (${r.length}): ${Ti(r)}.`),t.length<=12&&i.length<=12&&(n.length||r.length)&&(o.push(`Expected: ${t.join(", ")}.`),o.push(`Actual: ${i.join(", ")}.`)),`${e.moduleName}: ${e.stage} shader uniform block ${e.uniformBlockName} does not match module.uniformTypes. ${o.join(" ")}`}function Do(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"")}function Fo(e){return e.replace(/\s+/g," ").trim()}function Oo(e,t){let i=Math.min(e.length,t.length);for(let n=0;n<i;n++)if(e[n]!==t[n])return`First mismatch at field ${n+1}: expected ${e[n]}, found ${t[n]}.`;return e.length>t.length?`Shader block ends after field ${t.length}; expected next field ${e[t.length]}.`:t.length>e.length?`Shader block has extra field ${t.length}: ${t[e.length]}.`:null}function Ti(e,t=8){if(e.length<=t)return e.join(", ");let i=e.length-t;return`${e.slice(0,t).join(", ")}, ... (${i} more)`}var Pi=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}\\s*:\\s*([^;]+);`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${B}\\s*:\\s*([^;]+);`,"g")];function Fi(e,t=[]){let i=re(e),n=new Map;for(let o of t)n.set(Ni(o.name,o.group,o.location),o.moduleName);let r=[];for(let o of Pi){o.lastIndex=0;let a;for(a=o.exec(i);a;){let s=o===Pi[0],l=Number(a[s?1:2]),c=Number(a[s?2:1]),f=a[3]?.trim(),u=a[4],p=a[5].trim(),d=n.get(Ni(u,c,l));r.push(Bo({name:u,group:c,binding:l,owner:d?"module":"application",moduleName:d,accessDeclaration:f,resourceType:p})),a=o.exec(i)}}return r.sort((o,a)=>o.group!==a.group?o.group-a.group:o.binding!==a.binding?o.binding-a.binding:o.name.localeCompare(a.name))}function Bo(e){let t={name:e.name,group:e.group,binding:e.binding,owner:e.owner,kind:"unknown",moduleName:e.moduleName,resourceType:e.resourceType};if(e.accessDeclaration){let i=e.accessDeclaration.split(",").map(n=>n.trim());if(i[0]==="uniform")return{...t,kind:"uniform",access:"uniform"};if(i[0]==="storage"){let n=i[1]||"read_write";return{...t,kind:n==="read"?"read-only-storage":"storage",access:n}}}return e.resourceType==="sampler"||e.resourceType==="sampler_comparison"?{...t,kind:"sampler",samplerKind:e.resourceType==="sampler_comparison"?"comparison":"filtering"}:e.resourceType.startsWith("texture_storage_")?{...t,kind:"storage-texture",access:ko(e.resourceType),viewDimension:Di(e.resourceType)}:e.resourceType.startsWith("texture_")?{...t,kind:"texture",viewDimension:Di(e.resourceType),sampleType:Uo(e.resourceType),multisampled:e.resourceType.startsWith("texture_multisampled_")}:t}function Ni(e,t,i){return`${t}:${i}:${e}`}function Di(e){if(e.includes("cube_array"))return"cube-array";if(e.includes("2d_array"))return"2d-array";if(e.includes("cube"))return"cube";if(e.includes("3d"))return"3d";if(e.includes("2d"))return"2d";if(e.includes("1d"))return"1d"}function Uo(e){if(e.startsWith("texture_depth_"))return"depth";if(e.includes("<i32>"))return"sint";if(e.includes("<u32>"))return"uint";if(e.includes("<f32>"))return"float"}function ko(e){return/,\s*([A-Za-z_][A-Za-z0-9_]*)\s*>$/.exec(e)?.[1]}var de=`
34
+ `;switch(s){case"vs:#decl":(r==="wgsl"||a)&&(e=e.replace(pe,c));break;case"vs:#main-start":(r==="wgsl"||a)&&(e=r==="wgsl"?Me(e,"vertex",c,"start",o.vertex):e.replace(Ii,f=>f+c));break;case"vs:#main-end":(r==="wgsl"||a)&&(e=r==="wgsl"?Me(e,"vertex",c,"end",o.vertex):e.replace(yi,f=>c+f));break;case"fs:#decl":(r==="wgsl"||!a)&&(e=e.replace(pe,c));break;case"fs:#main-start":(r==="wgsl"||!a)&&(e=r==="wgsl"?Me(e,"fragment",c,"start",o.fragment):e.replace(Ii,f=>f+c));break;case"fs:#main-end":(r==="wgsl"||!a)&&(e=r==="wgsl"?Me(e,"fragment",c,"end",o.fragment):e.replace(yi,f=>c+f));break;default:e=e.replace(s,f=>f+c)}}return e=e.replace(pe,""),n&&(e=e.replace(/\}\s*$/,s=>s+go[t])),e}function Li(e){let t={};return P(Array.isArray(e)&&e.length>1),e.forEach(i=>{for(let n in i)t[n]=t[n]?`${t[n]}
35
+ ${i[n]}`:i[n]}),t}function Me(e,t,i,n,r){let o=ho(e,t,r);if(!o)return e;if(n==="start"){let a=o.openBraceIndex+1;return`${e.slice(0,a)}
36
+ ${i}${e.slice(a)}`}return`${e.slice(0,o.closeBraceIndex)}${i}${e.slice(o.closeBraceIndex)}`}function ho(e,t,i){let n=t==="vertex"?"@vertex":"@fragment",r=e.indexOf(n);if(r<0)return null;let o=i?e.search(new RegExp(`\\bfn\\s+${_o(i)}\\s*\\(`)):e.indexOf("fn",r);if(o<0)return null;let a=e.indexOf("{",o);if(a<0)return null;let s=0;for(let l=a;l<e.length;l++){let c=e[l];if(c==="{")s++;else if(c==="}"&&(s--,s===0))return{openBraceIndex:a,closeBraceIndex:l}}return null}function _o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(e){e.map(t=>Re(t))}function Re(e){if(e.instance)return;Y(e.dependencies||[]);let{propTypes:t={},deprecations:i=[],inject:n={}}=e,r={normalizedInjections:Ci(n),parsedDeprecations:vo(i)};t&&(r.propValidators=vi(t)),e.instance=r;let o={};t&&(o=Object.entries(t).reduce((a,[s,l])=>{let c=l?.value;return c&&(a[s]=c),a},{})),e.defaultUniforms={...e.defaultUniforms,...o}}function Ai(e,t,i){Re(e);let n=i||{...e.defaultUniforms};return t&&e.getUniforms?e.getUniforms(t,n):bi(t,e.instance?.propValidators,e.name)}function oe(e,t,i){e.deprecations?.forEach(n=>{n.regex?.test(t)&&(n.deprecated?i.deprecated(n.old,n.new)():i.removed(n.old,n.new)())})}function vo(e){return e.forEach(t=>{t.type==="function"?t.regex=new RegExp(`\\b${t.old}\\(`):t.regex=new RegExp(`${t.type} ${t.old};`)}),e}function k(e){let t=new Set,i=new Set,n=[],r=new Map;function o(l){let c=r.get(l.name);if(c&&c!==l)throw new Error(`Shader module name collision: Multiple different module objects share the name "${l.name}". Each module object must have a unique name.`);r.set(l.name,l)}function a(l,c){if(i.has(l)){let u=[...c,l.name].join(" -> ");throw new Error(`Shader module dependency cycle detected: ${u}`)}if(t.has(l))return;o(l),i.add(l);let f=[...c,l.name];if(l.dependencies)for(let u of l.dependencies)a(u,f);i.delete(l),t.add(l),n.push(l)}for(let l of e)a(l,[]);let s=new Set;for(let l of n)l.implements!==void 0&&(P(!s.has(l.implements)),s.add(l.implements));return Y(n),n}function bo(e){return k(e)}function Mi(e){return bo(e)}function Ri(e){let t=Lt(e),i=Io[t];if(!i)throw new Error(`Unsupported variable shader type: ${e}`);return i}function Ei(e){let t=Ct(e),i=So[t];if(!i)throw new Error(`Unsupported attribute shader type: ${e}`);let[n,r]=i,o=n==="i32"||n==="u32",a=n!=="u32",s=xo[n]*r;return{primitiveType:n,components:r,byteLength:s,integer:o,signed:a}}var Ee=class{getVariableShaderTypeInfo(t){return Ri(t)}getAttributeShaderTypeInfo(t){return Ei(t)}makeShaderAttributeType(t,i){return wi(t,i)}resolveAttributeShaderTypeAlias(t){return Ct(t)}resolveVariableShaderTypeAlias(t){return Lt(t)}};function wi(e,t){return t===1?e:`vec${t}<${e}>`}function Ct(e){return Ti[e]||e}function Lt(e){return Pi[e]||e}var H=new Ee,xo={f32:4,f16:2,i32:4,u32:4},So={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},Io={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},Ti={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},Pi={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>",mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"};var yo=/^(vs|fs):(?:#(?:decl|main-start|main-end)|[A-Za-z_][\w-]*)$/;function Di(e=[],t){let i={modules:[],defines:{},injections:{},vertexInputs:{},interStageVariables:{}};for(let o of e)Co(i,o,t);let{vertexInputs:n,interStageVariables:r}=i;for(let o of Object.keys(r))if(n[o])throw new Error(`ShaderPlugin name "${o}" cannot be both a vertex input and a varying`);return i}function Fi(e=[],t=[],i={}){let n=[...e],r=new Map;for(let o of n){let a=r.get(o.name);a&&a!==o&&i.onConflict?.(o.name,a,o),a||r.set(o.name,o)}for(let o of t){let a=r.get(o.name);a&&a!==o&&i.onConflict?.(o.name,a,o),a||(n.push(o),r.set(o.name,o))}return n}function Co(e,t,i){t.module&&e.modules.push(t.module),t.defines&&Object.assign(e.defines,t.defines);for(let[n,r]of Object.entries(t.vertexInputs||{})){Ni(n,"vertex input");let o=e.vertexInputs[n];if(o&&o!==r)throw new Error(`ShaderPlugin vertex input "${n}" has conflicting types "${o}" and "${r}"`);e.vertexInputs[n]=r}for(let[n,r]of Object.entries(t.interStageVariables||{})){Ni(n,"varying");let o=Lo(n,r),a=e.interStageVariables[n];if(a&&(a.type!==o.type||a.interpolation!==o.interpolation))throw new Error(`ShaderPlugin varying "${n}" has conflicting declarations "${a.type}/${a.interpolation}" and "${o.type}/${o.interpolation}"`);e.interStageVariables[n]=o}for(let n of t.injections||[]){let r=n[i];if(r===void 0)continue;Ao(n.target),e.injections[n.target]||(e.injections[n.target]=[]),e.injections[n.target].push({pluginName:t.name,injection:r,order:n.order??0})}}function Ni(e,t){if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)||e.startsWith("_luma_"))throw new Error(`ShaderPlugin ${t} "${e}" must be a valid non-reserved identifier`)}function Lo(e,t){let{primitiveType:i}=H.getAttributeShaderTypeInfo(t.type),n=i==="i32"||i==="u32",r=t.interpolation||(n?"flat":"smooth");if(n&&r==="smooth")throw new Error(`ShaderPlugin integer varying "${e}" must use flat interpolation`);return{type:t.type,interpolation:r}}function Ao(e){if(!yo.test(e))throw new Error(`ShaderPlugin injection target "${e}" must be a named shader anchor or hook`)}var Mo=/^(?:uniform\s+)?(?:(?:lowp|mediump|highp)\s+)?[A-Za-z0-9_]+(?:<[^>]+>)?\s+([A-Za-z0-9_]+)(?:\s*\[[^\]]+\])?\s*;/,Ro=/((?:layout\s*\([^)]*\)\s*)*)uniform\s+([A-Za-z_][A-Za-z0-9_]*)\s*\{([\s\S]*?)\}\s*([A-Za-z_][A-Za-z0-9_]*)?\s*;/g;function we(e){return`${e.name}Uniforms`}function At(e,t){let i=t==="wgsl"?e.source:t==="vertex"?e.vs:e.fs;if(!i)return null;let n=we(e);return Eo(i,t==="wgsl"?"wgsl":"glsl",n)}function Mt(e,t){let i=Object.keys(e.uniformTypes||{});if(!i.length)return null;let n=At(e,t);return n?{moduleName:e.name,uniformBlockName:we(e),stage:t,expectedUniformNames:i,actualUniformNames:n,matches:Po(i,n)}:null}function Te(e,t,i={}){let n=Mt(e,t);if(!n||n.matches)return n;let r=No(n);return i.log?.error?.(r,n)(),i.throwOnError!==!1&&P(!1,r),n}function Pe(e){let t=[],i=Do(e);for(let n of i.matchAll(Ro)){let r=n[1]?.trim()||null;t.push({blockName:n[2],body:n[3],instanceName:n[4]||null,layoutQualifier:r,hasLayoutQualifier:!!r,isStd140:!!(r&&/\blayout\s*\([^)]*\bstd140\b[^)]*\)/.exec(r))})}return t}function Ne(e,t,i,n){let r=Pe(e).filter(a=>!a.isStd140),o=new Set;for(let a of r){if(o.has(a.blockName))continue;o.add(a.blockName);let s=n?.label?`${n.label} `:"",l=a.hasLayoutQualifier?`declares ${Fo(a.layoutQualifier)} instead of layout(std140)`:"does not declare layout(std140)",c=`${s}${t} shader uniform block ${a.blockName} ${l}. luma.gl host-side shader block packing assumes explicit layout(std140) for GLSL uniform blocks. Add \`layout(std140)\` to the block declaration.`;i?.warn?.(c,a)()}return r}function Eo(e,t,i){let n=t==="wgsl"?wo(e,i):To(e,i);if(!n)return null;let r=[];for(let o of n.split(`
37
+ `)){let a=o.replace(/\/\/.*$/,"").trim();if(!a||a.startsWith("#"))continue;let s=t==="wgsl"?a.match(/^([A-Za-z0-9_]+)\s*:/):a.match(Mo);s&&r.push(s[1])}return r}function wo(e,t){let i=new RegExp(`\\bstruct\\s+${t}\\b`,"m").exec(e);if(!i)return null;let n=e.indexOf("{",i.index);if(n<0)return null;let r=0;for(let o=n;o<e.length;o++){let a=e[o];if(a==="{"){r++;continue}if(a==="}"&&(r--,r===0))return e.slice(n+1,o)}return null}function To(e,t){return Pe(e).find(n=>n.blockName===t)?.body||null}function Po(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function No(e){let{expectedUniformNames:t,actualUniformNames:i}=e,n=t.filter(s=>!i.includes(s)),r=i.filter(s=>!t.includes(s)),o=[`Expected ${t.length} fields, found ${i.length}.`],a=Oo(t,i);return a&&o.push(a),n.length&&o.push(`Missing from shader block (${n.length}): ${Oi(n)}.`),r.length&&o.push(`Unexpected in shader block (${r.length}): ${Oi(r)}.`),t.length<=12&&i.length<=12&&(n.length||r.length)&&(o.push(`Expected: ${t.join(", ")}.`),o.push(`Actual: ${i.join(", ")}.`)),`${e.moduleName}: ${e.stage} shader uniform block ${e.uniformBlockName} does not match module.uniformTypes. ${o.join(" ")}`}function Do(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"")}function Fo(e){return e.replace(/\s+/g," ").trim()}function Oo(e,t){let i=Math.min(e.length,t.length);for(let n=0;n<i;n++)if(e[n]!==t[n])return`First mismatch at field ${n+1}: expected ${e[n]}, found ${t[n]}.`;return e.length>t.length?`Shader block ends after field ${t.length}; expected next field ${e[t.length]}.`:t.length>e.length?`Shader block has extra field ${t.length}: ${t[e.length]}.`:null}function Oi(e,t=8){if(e.length<=t)return e.join(", ");let i=e.length-t;return`${e.slice(0,t).join(", ")}, ... (${i} more)`}var Bi=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${B}\\s*:\\s*([^;]+);`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${B}\\s*:\\s*([^;]+);`,"g")];function Gi(e,t=[]){let i=z(e),n=new Map;for(let o of t)n.set(Ui(o.name,o.group,o.location),o.moduleName);let r=[];for(let o of Bi){o.lastIndex=0;let a;for(a=o.exec(i);a;){let s=o===Bi[0],l=Number(a[s?1:2]),c=Number(a[s?2:1]),f=a[3]?.trim(),u=a[4],p=a[5].trim(),d=n.get(Ui(u,c,l));r.push(Bo({name:u,group:c,binding:l,owner:d?"module":"application",moduleName:d,accessDeclaration:f,resourceType:p})),a=o.exec(i)}}return r.sort((o,a)=>o.group!==a.group?o.group-a.group:o.binding!==a.binding?o.binding-a.binding:o.name.localeCompare(a.name))}function Bo(e){let t={name:e.name,group:e.group,binding:e.binding,owner:e.owner,kind:"unknown",moduleName:e.moduleName,resourceType:e.resourceType};if(e.accessDeclaration){let i=e.accessDeclaration.split(",").map(n=>n.trim());if(i[0]==="uniform")return{...t,kind:"uniform",access:"uniform"};if(i[0]==="storage"){let n=i[1]||"read_write";return{...t,kind:n==="read"?"read-only-storage":"storage",access:n}}}return e.resourceType==="sampler"||e.resourceType==="sampler_comparison"?{...t,kind:"sampler",samplerKind:e.resourceType==="sampler_comparison"?"comparison":"filtering"}:e.resourceType.startsWith("texture_storage_")?{...t,kind:"storage-texture",access:ko(e.resourceType),viewDimension:ki(e.resourceType)}:e.resourceType.startsWith("texture_")?{...t,kind:"texture",viewDimension:ki(e.resourceType),sampleType:Uo(e.resourceType),multisampled:e.resourceType.startsWith("texture_multisampled_")}:t}function Ui(e,t,i){return`${t}:${i}:${e}`}function ki(e){if(e.includes("cube_array"))return"cube-array";if(e.includes("2d_array"))return"2d-array";if(e.includes("cube"))return"cube";if(e.includes("3d"))return"3d";if(e.includes("2d"))return"2d";if(e.includes("1d"))return"1d"}function Uo(e){if(e.startsWith("texture_depth_"))return"depth";if(e.includes("<i32>"))return"sint";if(e.includes("<u32>"))return"uint";if(e.includes("<f32>"))return"float"}function ko(e){return/,\s*([A-Za-z_][A-Za-z0-9_]*)\s*>$/.exec(e)?.[1]}var de=`
38
38
 
39
39
  ${pe}
40
- `;function Ne(e){return function(i){let n={};for(let r of e){let o=r.getUniforms?.(i,n);Object.assign(n,o)}return n}}function De(e,t,i,n){for(let r in e){let o=/^(v|f)s:(#)?([\w-]+)$/.exec(r);if(o){let a=o[2],s=o[3],l=a?s==="decl"?i:n:t;l[r]=l[r]||[],l[r].push(...e[r])}else n[r]=n[r]||[],n[r].push(...e[r])}}function Y(e,t,i){let n;switch(t){case"vertex":n=e.vs||"";break;case"fragment":n=e.fs||"";break;case"wgsl":n=e.source||"";break;default:P(!1)}if(!e.name)throw new Error("Shader module must have a name");we(e,t,{log:i});let r=e.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),o=`// ----- MODULE ${e.name} ---------------
40
+ `;function De(e){return function(i){let n={};for(let r of e){let o=r.getUniforms?.(i,n);Object.assign(n,o)}return n}}function Fe(e,t,i,n){for(let r in e){let o=/^(v|f)s:(#)?([\w-]+)$/.exec(r);if(o){let a=o[2],s=o[3],l=a?s==="decl"?i:n:t;l[r]=l[r]||[],l[r].push(...e[r])}else n[r]=n[r]||[],n[r].push(...e[r])}}function Z(e,t,i){let n;switch(t){case"vertex":n=e.vs||"";break;case"fragment":n=e.fs||"";break;case"wgsl":n=e.source||"";break;default:P(!1)}if(!e.name)throw new Error("Shader module must have a name");Te(e,t,{log:i});let r=e.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),o=`// ----- MODULE ${e.name} ---------------
41
41
 
42
42
  `;return t!=="wgsl"&&(o+=`#define MODULE_${r}
43
43
  `),o+=`${n}
44
- `,o}var Z="([a-zA-Z_][a-zA-Z0-9_]*)",Go=/^\s*\#\s*if\s+(.+?)\s*(?:\/\/.*)?$/,zo=new RegExp(`^\\s*\\#\\s*ifdef\\s*${Z}\\s*$`),Vo=new RegExp(`^\\s*\\#\\s*ifndef\\s*${Z}\\s*(?:\\/\\/.*)?$`),Ho=/^\s*\#\s*else\s*(?:\/\/.*)?$/,Wo=/^\s*\#\s*endif\s*$/,qo=new RegExp(`^\\s*\\#\\s*ifdef\\s*${Z}\\s*(?:\\/\\/.*)?$`),jo=/^\s*\#\s*endif\s*(?:\/\/.*)?$/;function V(e,t){let i=e.split(`
45
- `),n=[],r=[],o=!0;for(let a of i){let s=a.match(Go),l=a.match(qo)||a.match(zo),c=a.match(Vo),f=a.match(Ho),u=a.match(jo)||a.match(Wo);if(s){let p=$o(s[1],t?.defines||{}),d=o&&p;r.push({parentActive:o,branchTaken:p,active:d}),o=d}else if(l||c){let p=(l||c)?.[1],d=!!t?.defines?.[p],h=l?d:!d,g=o&&h;r.push({parentActive:o,branchTaken:h,active:g}),o=g}else if(f){let p=r[r.length-1];if(!p)throw new Error("Encountered #else without matching #if, #ifdef or #ifndef");p.active=p.parentActive&&!p.branchTaken,p.branchTaken=!0,o=p.active}else u?(r.pop(),o=r.length?r[r.length-1].active:!0):o&&n.push(a)}if(r.length>0)throw new Error("Unterminated conditional block in shader source");return n.join(`
46
- `)}function $o(e,t){let i=e.trim();if(/^[+-]?\d+(?:\.\d+)?$/.test(i))return Number(i)!==0;if(i==="true")return!0;if(i==="false")return!1;let n=i.match(new RegExp(`^!\\s*${Z}$`));if(n)return!t[n[1]];let r=i.match(new RegExp(`^${Z}$`));if(r)return!!t[r[1]];let o=i.match(new RegExp(`^defined\\s*\\(\\s*${Z}\\s*\\)$`));if(o)return t[o[1]]!==void 0;let a=i.match(new RegExp(`^!\\s*defined\\s*\\(\\s*${Z}\\s*\\)$`));if(a)return t[a[1]]===void 0;throw new Error(`Unsupported #if expression "${e}"`)}function Ui(e,t){let i=[];for(let[n,r]of Object.entries(t))Ko(e,n),i.push(`in ${Fe(r)} ${n};`);return i.join(`
47
- `)}function ki(e,t,i){let n=Object.entries(i);if(n.length===0)return{source:e,declarations:"",initialization:""};let r=Yo(e,t),o=e.slice(r.openParenthesis+1,r.closeParenthesis),a=Zo(e,o),s=new Set(a.locations),l=[],c=[],f=[];for(let[g,x]of n){if(a.names.has(g)||Qo(e,g))throw new Error(`ShaderPlugin vertex input "${g}" conflicts with an existing WGSL shader input or variable`);let I=ea(s);s.add(I);let S=`_luma_${g}`;l.push(`@location(${I}) ${S}: ${x}`),c.push(`var<private> ${g}: ${x};`),f.push(`${g} = ${S};`)}let u=o.trim()?`,
44
+ `,o}var X="([a-zA-Z_][a-zA-Z0-9_]*)",Go=/^\s*\#\s*if\s+(.+?)\s*(?:\/\/.*)?$/,zo=new RegExp(`^\\s*\\#\\s*ifdef\\s*${X}\\s*$`),Vo=new RegExp(`^\\s*\\#\\s*ifndef\\s*${X}\\s*(?:\\/\\/.*)?$`),Ho=/^\s*\#\s*else\s*(?:\/\/.*)?$/,Wo=/^\s*\#\s*endif\s*$/,qo=new RegExp(`^\\s*\\#\\s*ifdef\\s*${X}\\s*(?:\\/\\/.*)?$`),jo=/^\s*\#\s*endif\s*(?:\/\/.*)?$/;function W(e,t){let i=e.split(`
45
+ `),n=[],r=[],o=!0;for(let a of i){let s=a.match(Go),l=a.match(qo)||a.match(zo),c=a.match(Vo),f=a.match(Ho),u=a.match(jo)||a.match(Wo);if(s){let p=$o(s[1],t?.defines||{}),d=o&&p;r.push({parentActive:o,branchTaken:p,active:d}),o=d}else if(l||c){let p=(l||c)?.[1],d=!!t?.defines?.[p],v=l?d:!d,m=o&&v;r.push({parentActive:o,branchTaken:v,active:m}),o=m}else if(f){let p=r[r.length-1];if(!p)throw new Error("Encountered #else without matching #if, #ifdef or #ifndef");p.active=p.parentActive&&!p.branchTaken,p.branchTaken=!0,o=p.active}else u?(r.pop(),o=r.length?r[r.length-1].active:!0):o&&n.push(a)}if(r.length>0)throw new Error("Unterminated conditional block in shader source");return n.join(`
46
+ `)}function $o(e,t){let i=e.trim();if(/^[+-]?\d+(?:\.\d+)?$/.test(i))return Number(i)!==0;if(i==="true")return!0;if(i==="false")return!1;let n="(?:[A-Za-z_][A-Za-z0-9_]*|[+-]?\\d+(?:\\.\\d+)?)",r=i.match(new RegExp(`^(${n})\\s*(==|!=|<=|>=|<|>)\\s*(${n})$`));if(r){let c=p=>/^[A-Za-z_]/.test(p)?Number(t[p]??0):Number(p),f=c(r[1]),u=c(r[3]);switch(r[2]){case"==":return f===u;case"!=":return f!==u;case"<=":return f<=u;case">=":return f>=u;case"<":return f<u;case">":return f>u}}let o=i.match(new RegExp(`^!\\s*${X}$`));if(o)return!t[o[1]];let a=i.match(new RegExp(`^${X}$`));if(a)return!!t[a[1]];let s=i.match(new RegExp(`^defined\\s*\\(\\s*${X}\\s*\\)$`));if(s)return t[s[1]]!==void 0;let l=i.match(new RegExp(`^!\\s*defined\\s*\\(\\s*${X}\\s*\\)$`));if(l)return t[l[1]]===void 0;throw new Error(`Unsupported #if expression "${e}"`)}function Hi(e,t){let i=[];for(let[n,r]of Object.entries(t))Ko(e,n),i.push(`in ${Oe(r)} ${n};`);return i.join(`
47
+ `)}function Wi(e,t,i){let n=Object.entries(i);if(n.length===0)return{source:e,declarations:"",initialization:""};let r=Yo(e,t),o=e.slice(r.openParenthesis+1,r.closeParenthesis),a=Zo(e,o),s=new Set(a.locations),l=[],c=[],f=[];for(let[m,x]of n){if(a.names.has(m)||Qo(e,m))throw new Error(`ShaderPlugin vertex input "${m}" conflicts with an existing WGSL shader input or variable`);let I=ea(s);s.add(I);let S=`_luma_${m}`;l.push(`@location(${I}) ${S}: ${x}`),c.push(`var<private> ${m}: ${x};`),f.push(`${m} = ${S};`)}let u=o.trim()?`,
48
48
  `:`
49
49
  `,p=o.trim()?"":`
50
50
  `,d=`${o}${u}${l.join(`,
51
51
  `)}${p}`;return{source:e.slice(0,r.openParenthesis+1)+d+e.slice(r.closeParenthesis),declarations:c.join(`
52
52
  `),initialization:f.join(`
53
- `)}}function Fe(e){let{primitiveType:t,components:i}=K.getAttributeShaderTypeInfo(e),n=t==="i32"?"int":t==="u32"?"uint":"float";return i===1?n:`${n==="int"?"i":n==="uint"?"u":""}vec${i}`}function Ko(e,t){let i=Oe(t);if(new RegExp(`\\b(?:in|attribute)\\s+(?:(?:lowp|mediump|highp)\\s+)?[A-Za-z_][A-Za-z0-9_]*\\s+${i}\\s*(?:\\[|;)`).test(e))throw new Error(`ShaderPlugin vertex input "${t}" conflicts with an existing GLSL input`)}function Yo(e,t){let n=new RegExp(`\\bfn\\s+${Oe(t)}\\s*\\(`,"g").exec(e);if(!n)throw new Error(`ShaderPlugin vertex inputs require WGSL vertex entry point "${t}"`);let r=e.indexOf("(",n.index),o=Gi(e,r,"(",")");if(o<0)throw new Error(`Unable to parse WGSL vertex entry point "${t}" parameters`);return{openParenthesis:r,closeParenthesis:o}}function Zo(e,t){let i=Oi(t),n=new Set(Bi(t)),r=Xo(t);for(let o of r){let a=Jo(e,o);if(a!==null){i.push(...Oi(a));for(let s of Bi(a))n.add(s)}}return{locations:i,names:n}}function Oi(e){let t=[],i=/@location\s*\(\s*(\d+)\s*\)/g,n=i.exec(e);for(;n;)t.push(Number(n[1])),n=i.exec(e);return t}function Bi(e){let t=[],i=/(?:^|,)\s*(?:@[A-Za-z_][\w]*(?:\([^)]*\))?\s*)*([A-Za-z_][\w]*)\s*:/gm,n=i.exec(e);for(;n;)t.push(n[1]),n=i.exec(e);return t}function Xo(e){let t=[],i=/:\s*([A-Za-z_][\w]*)\b/g,n=i.exec(e);for(;n;)t.push(n[1]),n=i.exec(e);return t}function Jo(e,t){let n=new RegExp(`\\bstruct\\s+${Oe(t)}\\s*\\{`,"g").exec(e);if(!n)return null;let r=e.indexOf("{",n.index),o=Gi(e,r,"{","}");return o<0?null:e.slice(r+1,o)}function Qo(e,t){let i=Oe(t),n=new RegExp(`\\b(?:var(?:<[^>]+>)?|let|const)\\s+${i}\\b`,"g"),r=n.exec(e);for(;r;){if(ta(e,r.index)===0)return!0;r=n.exec(e)}return!1}function ea(e){let t=0;for(;e.has(t);)t++;return t}function Gi(e,t,i,n){let r=0,o=0,a=!1;for(let s=t;s<e.length;s++){let l=e[s],c=e[s+1];if(a){l===`
53
+ `)}}function Oe(e){let{primitiveType:t,components:i}=H.getAttributeShaderTypeInfo(e),n=t==="i32"?"int":t==="u32"?"uint":"float";return i===1?n:`${n==="int"?"i":n==="uint"?"u":""}vec${i}`}function Ko(e,t){let i=Be(t);if(new RegExp(`\\b(?:in|attribute)\\s+(?:(?:lowp|mediump|highp)\\s+)?[A-Za-z_][A-Za-z0-9_]*\\s+${i}\\s*(?:\\[|;)`).test(e))throw new Error(`ShaderPlugin vertex input "${t}" conflicts with an existing GLSL input`)}function Yo(e,t){let n=new RegExp(`\\bfn\\s+${Be(t)}\\s*\\(`,"g").exec(e);if(!n)throw new Error(`ShaderPlugin vertex inputs require WGSL vertex entry point "${t}"`);let r=e.indexOf("(",n.index),o=qi(e,r,"(",")");if(o<0)throw new Error(`Unable to parse WGSL vertex entry point "${t}" parameters`);return{openParenthesis:r,closeParenthesis:o}}function Zo(e,t){let i=zi(t),n=new Set(Vi(t)),r=Xo(t);for(let o of r){let a=Jo(e,o);if(a!==null){i.push(...zi(a));for(let s of Vi(a))n.add(s)}}return{locations:i,names:n}}function zi(e){let t=[],i=/@location\s*\(\s*(\d+)\s*\)/g,n=i.exec(e);for(;n;)t.push(Number(n[1])),n=i.exec(e);return t}function Vi(e){let t=[],i=/(?:^|,)\s*(?:@[A-Za-z_][\w]*(?:\([^)]*\))?\s*)*([A-Za-z_][\w]*)\s*:/gm,n=i.exec(e);for(;n;)t.push(n[1]),n=i.exec(e);return t}function Xo(e){let t=[],i=/:\s*([A-Za-z_][\w]*)\b/g,n=i.exec(e);for(;n;)t.push(n[1]),n=i.exec(e);return t}function Jo(e,t){let n=new RegExp(`\\bstruct\\s+${Be(t)}\\s*\\{`,"g").exec(e);if(!n)return null;let r=e.indexOf("{",n.index),o=qi(e,r,"{","}");return o<0?null:e.slice(r+1,o)}function Qo(e,t){let i=Be(t),n=new RegExp(`\\b(?:var(?:<[^>]+>)?|let|const)\\s+${i}\\b`,"g"),r=n.exec(e);for(;r;){if(ta(e,r.index)===0)return!0;r=n.exec(e)}return!1}function ea(e){let t=0;for(;e.has(t);)t++;return t}function qi(e,t,i,n){let r=0,o=0,a=!1;for(let s=t;s<e.length;s++){let l=e[s],c=e[s+1];if(a){l===`
54
54
  `&&(a=!1);continue}if(o>0){l==="/"&&c==="*"?(o++,s++):l==="*"&&c==="/"&&(o--,s++);continue}if(l==="/"&&c==="/"){a=!0,s++;continue}if(l==="/"&&c==="*"){o=1,s++;continue}if(l===i&&r++,l===n&&--r===0)return s}return-1}function ta(e,t){let i=0,n=0,r=!1;for(let o=0;o<t;o++){let a=e[o],s=e[o+1];if(r){a===`
55
- `&&(r=!1);continue}if(n>0){a==="/"&&s==="*"?(n++,o++):a==="*"&&s==="/"&&(n--,o++);continue}a==="/"&&s==="/"?(r=!0,o++):a==="/"&&s==="*"?(n=1,o++):a==="{"?i++:a==="}"&&i--}return i}function Oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vi(e,t,i){let n=[],r=[];for(let[o,a]of Object.entries(i)){ga(e,o);let s=a.interpolation==="flat"?"flat ":"",l=t==="vertex"?"out":"in";n.push(`${s}${l} ${Fe(a.type)} ${o};`),t==="vertex"&&r.push(`${o} = ${pa(a.type)};`)}return{declarations:n.join(`
55
+ `&&(r=!1);continue}if(n>0){a==="/"&&s==="*"?(n++,o++):a==="*"&&s==="/"&&(n--,o++);continue}a==="/"&&s==="/"?(r=!0,o++):a==="/"&&s==="*"?(n=1,o++):a==="{"?i++:a==="}"&&i--}return i}function Be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ji(e,t,i){let n=[],r=[];for(let[o,a]of Object.entries(i)){ga(e,o);let s=a.interpolation==="flat"?"flat ":"",l=t==="vertex"?"out":"in";n.push(`${s}${l} ${Oe(a.type)} ${o};`),t==="vertex"&&r.push(`${o} = ${pa(a.type)};`)}return{declarations:n.join(`
56
56
  `),initialization:r.join(`
57
- `)}}function Hi(e,t,i,n){let r=Object.entries(n);if(r.length===0)return{source:e,declarations:"",vertexInitialization:"",fragmentInitialization:""};let o=e,a=Be(o,t,"vertex"),s=ia(o,a),l=Be(o,i,"fragment"),c=na(o,l),f=At(o,s),u=At(o,c.type),p=new Set([...Ue(a.parameters),...Ue(f.body),...Ue(l.parameters),...Ue(u.body)]),d=new Set([...zi(f.body),...zi(u.body)]),h=[],g=[],x=[],I=[];for(let[m,v]of r){if(p.has(m)||fa(o,m))throw new Error(`ShaderPlugin varying "${m}" conflicts with existing WGSL stage I/O or a module variable`);let A=ua(d);d.add(A);let M=v.interpolation==="flat"?" @interpolate(flat)":"";h.push(` @location(${A})${M} ${m}: ${v.type},`),g.push(`var<private> ${m}: ${v.type};`),x.push(`${m} = ${da(v.type)};`),I.push(`${m} = ${c.name}.${m};`)}ra(o,s,a.openBrace,a.closeBrace),o=oa(o,s,a,r.map(([m])=>m)),a=Be(o,t,"vertex"),o=aa(o,a,r.map(([m])=>m));let b=(s===c.type?[s]:[s,c.type]).map(m=>At(o,m).closeBrace).sort((m,v)=>v-m);for(let m of b)o=o.slice(0,m)+`${h.join(`
57
+ `)}}function $i(e,t,i,n){let r=Object.entries(n);if(r.length===0)return{source:e,declarations:"",vertexInitialization:"",fragmentInitialization:""};let o=e,a=Ue(o,t,"vertex"),s=ia(o,a),l=Ue(o,i,"fragment"),c=na(o,l),f=Rt(o,s),u=c?Rt(o,c.type):null,p=new Set([...ke(a.parameters),...ke(f.body),...ke(l.parameters),...ke(u?.body||"")]),d=new Set([...Et(f.body),...Et(u?.body||""),...Et(l.parameters)]),v=[],m=[],x=[],I=[],S=[];for(let[g,_]of r){if(p.has(g)||fa(o,g))throw new Error(`ShaderPlugin varying "${g}" conflicts with existing WGSL stage I/O or a module variable`);let M=ua(d);d.add(M);let A=_.interpolation==="flat"?" @interpolate(flat)":"";if(v.push(` @location(${M})${A} ${g}: ${_.type},`),x.push(`var<private> ${g}: ${_.type};`),I.push(`${g} = ${da(_.type)};`),c)S.push(`${g} = ${c.name}.${g};`);else{let R=`_luma_${g}`;if(p.has(R))throw new Error(`ShaderPlugin varying "${g}" conflicts with a generated fragment parameter`);m.push(`@location(${M})${A} ${R}: ${_.type}`),S.push(`${g} = ${R};`)}}ra(o,s,a.openBrace,a.closeBrace),o=oa(o,s,a,r.map(([g])=>g)),a=Ue(o,t,"vertex"),o=aa(o,a,r.map(([g])=>g));let h=(!c||s===c.type?[s]:[s,c.type]).map(g=>Rt(o,g).closeBrace).sort((g,_)=>_-g);for(let g of h)o=o.slice(0,g)+`${v.join(`
58
58
  `)}
59
- `+o.slice(m);if(l=Be(o,i,"fragment"),!new RegExp(`\\b${X(c.name)}\\s*:`).test(l.parameters))throw new Error(`Unable to preserve WGSL fragment input "${c.name}"`);return{source:o,declarations:g.join(`
60
- `),vertexInitialization:x.join(`
61
- `),fragmentInitialization:I.join(`
62
- `)}}function Be(e,t,i){let r=new RegExp(`\\bfn\\s+${X(t)}\\s*\\(`,"g").exec(e);if(!r)throw new Error(`ShaderPlugin varyings require WGSL ${i} entry point "${t}"`);let o=e.indexOf("(",r.index),a=ke(e,o,"(",")"),s=e.indexOf("{",a),l=ke(e,s,"{","}");if(a<0||s<0||l<0)throw new Error(`Unable to parse WGSL ${i} entry point "${t}"`);return{openParenthesis:o,closeParenthesis:a,openBrace:s,closeBrace:l,parameters:e.slice(o+1,a)}}function ia(e,t){let i=e.slice(t.closeParenthesis+1,t.openBrace),n=/->\s*([A-Za-z_][\w]*)\s*$/.exec(i.trim());if(!n||Mt(e,n[1])===null)throw new Error("ShaderPlugin varyings require the WGSL vertex entry point to return a named struct");return n[1]}function na(e,t){let i=[];for(let n of ca(t.parameters,",")){let r=/(?:@[A-Za-z_][\w]*(?:\([^)]*\))?\s*)*([A-Za-z_][\w]*)\s*:\s*([A-Za-z_][\w]*)\s*$/.exec(n.trim());r&&Mt(e,r[2])&&i.push({name:r[1],type:r[2]})}if(i.length!==1)throw new Error(`ShaderPlugin varyings require exactly one named WGSL fragment input struct; found ${i.length}`);return i[0]}function At(e,t){let i=Mt(e,t);if(!i)throw new Error(`Unable to find WGSL stage I/O struct "${t}"`);return i}function Mt(e,t){let n=new RegExp(`\\bstruct\\s+${X(t)}\\s*\\{`,"g").exec(e);if(!n)return null;let r=e.indexOf("{",n.index),o=ke(e,r,"{","}");return o<0?null:{openBrace:r,closeBrace:o,body:e.slice(r+1,o)}}function ra(e,t,i,n){let r=new RegExp(`\\b${X(t)}\\s*\\(`,"g"),o=r.exec(e);for(;o;){if(o.index<i||o.index>n)throw new Error(`ShaderPlugin varying output struct "${t}" is constructed outside the selected vertex entry point`);o=r.exec(e)}}function oa(e,t,i,n){let r=new RegExp(`\\b${X(t)}\\s*\\(`,"g"),o=[],a=r.exec(e);for(;a;){if(a.index>i.openBrace&&a.index<i.closeBrace){let s=e.indexOf("(",a.index),l=ke(e,s,"(",")");if(l<0||l>i.closeBrace)throw new Error(`Unable to parse WGSL output constructor "${t}"`);o.push({openParenthesis:s,closeParenthesis:l})}a=r.exec(e)}for(let s of o.sort((l,c)=>c.closeParenthesis-l.closeParenthesis)){let c=e.slice(s.openParenthesis+1,s.closeParenthesis).trim()?", ":"";e=e.slice(0,s.closeParenthesis)+c+n.join(", ")+e.slice(s.closeParenthesis)}return e}function aa(e,t,i){let n=sa(e,t.openBrace+1,t.closeBrace);for(let r=n.length-1;r>=0;r--){let o=n[r],a=e.slice(o.expressionStart,o.semicolon).trim();if(!a)throw new Error("ShaderPlugin varying vertex entry point cannot use an empty return");let s=`_luma_vertexOutput${r}`,l=i.map(f=>`${s}.${f} = ${f};`).join(`
59
+ `+o.slice(g);if(l=Ue(o,i,"fragment"),m.length){let g=l.parameters,_=z(g).trimEnd();if(_.trim()&&!_.endsWith(",")){let M=_.length;g=`${g.slice(0,M)},${g.slice(M)}`}o=o.slice(0,l.openParenthesis+1)+g+`
60
+ `+m.join(`,
61
+ `)+`
62
+ `+o.slice(l.closeParenthesis)}return{source:o,declarations:x.join(`
63
+ `),vertexInitialization:I.join(`
64
+ `),fragmentInitialization:S.join(`
65
+ `)}}function Ue(e,t,i){let r=new RegExp(`\\bfn\\s+${ae(t)}\\s*\\(`,"g").exec(e);if(!r)throw new Error(`ShaderPlugin interStageVariables require WGSL ${i} entry point "${t}"`);let o=e.indexOf("(",r.index),a=Ge(e,o,"(",")"),s=e.indexOf("{",a),l=Ge(e,s,"{","}");if(a<0||s<0||l<0)throw new Error(`Unable to parse WGSL ${i} entry point "${t}"`);return{openParenthesis:o,closeParenthesis:a,openBrace:s,closeBrace:l,parameters:e.slice(o+1,a)}}function ia(e,t){let i=e.slice(t.closeParenthesis+1,t.openBrace),n=/->\s*([A-Za-z_][\w]*)\s*$/.exec(i.trim());if(!n||wt(e,n[1])===null)throw new Error("ShaderPlugin interStageVariables require the WGSL vertex entry point to return a named struct");return n[1]}function na(e,t){let i=[];for(let n of ca(z(t.parameters),",")){let r=/(?:@[A-Za-z_][\w]*(?:\([^)]*\))?\s*)*([A-Za-z_][\w]*)\s*:\s*([A-Za-z_][\w]*)\s*$/.exec(n.trim());r&&wt(e,r[2])&&i.push({name:r[1],type:r[2]})}if(i.length>1)throw new Error(`ShaderPlugin interStageVariables require exactly one named WGSL fragment input struct; found ${i.length}`);return i[0]||null}function Rt(e,t){let i=wt(e,t);if(!i)throw new Error(`Unable to find WGSL stage I/O struct "${t}"`);return i}function wt(e,t){let n=new RegExp(`\\bstruct\\s+${ae(t)}\\s*\\{`,"g").exec(e);if(!n)return null;let r=e.indexOf("{",n.index),o=Ge(e,r,"{","}");return o<0?null:{openBrace:r,closeBrace:o,body:e.slice(r+1,o)}}function ra(e,t,i,n){let r=new RegExp(`\\b${ae(t)}\\s*\\(`,"g"),o=r.exec(e);for(;o;){if(o.index<i||o.index>n)throw new Error(`ShaderPlugin varying output struct "${t}" is constructed outside the selected vertex entry point`);o=r.exec(e)}}function oa(e,t,i,n){let r=new RegExp(`\\b${ae(t)}\\s*\\(`,"g"),o=[],a=r.exec(e);for(;a;){if(a.index>i.openBrace&&a.index<i.closeBrace){let s=e.indexOf("(",a.index),l=Ge(e,s,"(",")");if(l<0||l>i.closeBrace)throw new Error(`Unable to parse WGSL output constructor "${t}"`);o.push({openParenthesis:s,closeParenthesis:l})}a=r.exec(e)}for(let s of o.sort((l,c)=>c.closeParenthesis-l.closeParenthesis)){let c=e.slice(s.openParenthesis+1,s.closeParenthesis).trim()?", ":"";e=e.slice(0,s.closeParenthesis)+c+n.join(", ")+e.slice(s.closeParenthesis)}return e}function aa(e,t,i){let n=sa(e,t.openBrace+1,t.closeBrace);for(let r=n.length-1;r>=0;r--){let o=n[r],a=e.slice(o.expressionStart,o.semicolon).trim();if(!a)throw new Error("ShaderPlugin varying vertex entry point cannot use an empty return");let s=`_luma_vertexOutput${r}`,l=i.map(f=>`${s}.${f} = ${f};`).join(`
63
66
  `),c=`{
64
67
  var ${s} = ${a};
65
68
  ${l}
66
69
  return ${s};
67
- }`;e=e.slice(0,o.start)+c+e.slice(o.semicolon+1)}return e}function sa(e,t,i){let n=[],r=t;for(;r<i;)if(r=Rt(e,r,i),e.slice(r,r+6)==="return"&&!/[A-Za-z0-9_]/.test(e[r+6]||"")){let o=r+6,a=la(e,o,i);if(a<0)throw new Error("Unable to parse WGSL return statement in selected vertex entry point");n.push({start:r,expressionStart:o,semicolon:a}),r=a+1}else r++;return n}function la(e,t,i){let n=0,r=0;for(let o=t;o<i;o++){let a=Rt(e,o,i);if(a!==o){o=a-1;continue}let s=e[o];if(s==="("&&n++,s===")"&&n--,s==="["&&r++,s==="]"&&r--,s===";"&&n===0&&r===0)return o}return-1}function Rt(e,t,i){let n=t;if(e[n]==="/"&&e[n+1]==="/"){let r=e.indexOf(`
68
- `,n+2);return r<0||r>i?i:r+1}if(e[n]==="/"&&e[n+1]==="*"){let r=1;for(n+=2;n<i&&r>0;)e[n]==="/"&&e[n+1]==="*"?(r++,n+=2):e[n]==="*"&&e[n+1]==="/"?(r--,n+=2):n++}return n}function ca(e,t){let i=[],n=0,r=0,o=0;for(let a=0;a<e.length;a++){let s=e[a];s==="("&&r++,s===")"&&r--,s==="<"&&o++,s===">"&&o--,s===t&&r===0&&o===0&&(i.push(e.slice(n,a)),n=a+1)}return i.push(e.slice(n)),i}function zi(e){let t=[],i=/@location\s*\(\s*(\d+)\s*\)/g,n=i.exec(e);for(;n;)t.push(Number(n[1])),n=i.exec(e);return t}function Ue(e){let t=[],i=/(?:^|,)\s*(?:@[A-Za-z_][\w]*(?:\([^)]*\))?\s*)*([A-Za-z_][\w]*)\s*:/gm,n=i.exec(e);for(;n;)t.push(n[1]),n=i.exec(e);return t}function fa(e,t){let i=new RegExp(`\\b(?:var(?:<[^>]+>)?|let|const)\\s+${X(t)}\\b`,"g"),n=i.exec(e);for(;n;){if(ma(e,n.index)===0)return!0;n=i.exec(e)}return!1}function ua(e){let t=0;for(;e.has(t);)t++;return t}function pa(e){let{primitiveType:t,components:i}=K.getAttributeShaderTypeInfo(e),n=t==="u32"?"0u":t==="i32"?"0":"0.0";return i===1?n:`${Fe(e)}(${n})`}function da(e){let{primitiveType:t,components:i}=K.getAttributeShaderTypeInfo(e),n=`${t}(0)`;return i===1?n:`${e}(${n})`}function ga(e,t){if(new RegExp(`\\b(?:flat\\s+|smooth\\s+)?(?:in|out|varying)\\s+(?:(?:lowp|mediump|highp)\\s+)?[A-Za-z_][A-Za-z0-9_]*\\s+${X(t)}\\s*(?:\\[|;)`).test(e))throw new Error(`ShaderPlugin varying "${t}" conflicts with existing GLSL stage I/O`)}function ke(e,t,i,n){let r=0,o=0,a=!1;for(let s=t;s<e.length;s++){let l=e[s],c=e[s+1];if(a){l===`
69
- `&&(a=!1);continue}if(o>0){l==="/"&&c==="*"?(o++,s++):l==="*"&&c==="/"&&(o--,s++);continue}if(l==="/"&&c==="/"){a=!0,s++;continue}if(l==="/"&&c==="*"){o=1,s++;continue}if(l===i&&r++,l===n&&--r===0)return s}return-1}function ma(e,t){let i=0;for(let n=0;n<t;n++){let r=Rt(e,n,t);if(r!==n){n=r-1;continue}e[n]==="{"&&i++,e[n]==="}"&&i--}return i}function X(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ge(e,t,i="glsl"){let n="";for(let r in e){let o=e[r];if(n+=`${i==="wgsl"?"fn":"void"} ${o.signature} {
70
+ }`;e=e.slice(0,o.start)+c+e.slice(o.semicolon+1)}return e}function sa(e,t,i){let n=[],r=t;for(;r<i;)if(r=Tt(e,r,i),e.slice(r,r+6)==="return"&&!/[A-Za-z0-9_]/.test(e[r+6]||"")){let o=r+6,a=la(e,o,i);if(a<0)throw new Error("Unable to parse WGSL return statement in selected vertex entry point");n.push({start:r,expressionStart:o,semicolon:a}),r=a+1}else r++;return n}function la(e,t,i){let n=0,r=0;for(let o=t;o<i;o++){let a=Tt(e,o,i);if(a!==o){o=a-1;continue}let s=e[o];if(s==="("&&n++,s===")"&&n--,s==="["&&r++,s==="]"&&r--,s===";"&&n===0&&r===0)return o}return-1}function Tt(e,t,i){let n=t;if(e[n]==="/"&&e[n+1]==="/"){let r=e.indexOf(`
71
+ `,n+2);return r<0||r>i?i:r+1}if(e[n]==="/"&&e[n+1]==="*"){let r=1;for(n+=2;n<i&&r>0;)e[n]==="/"&&e[n+1]==="*"?(r++,n+=2):e[n]==="*"&&e[n+1]==="/"?(r--,n+=2):n++}return n}function ca(e,t){let i=[],n=0,r=0,o=0;for(let a=0;a<e.length;a++){let s=e[a];s==="("&&r++,s===")"&&r--,s==="<"&&o++,s===">"&&o--,s===t&&r===0&&o===0&&(i.push(e.slice(n,a)),n=a+1)}return i.push(e.slice(n)),i}function Et(e){let t=[],i=/@location\s*\(\s*(\d+)\s*\)/g,n=i.exec(e);for(;n;)t.push(Number(n[1])),n=i.exec(e);return t}function ke(e){let t=[],i=/(?:^|,)\s*(?:@[A-Za-z_][\w]*(?:\([^)]*\))?\s*)*([A-Za-z_][\w]*)\s*:/gm,n=i.exec(e);for(;n;)t.push(n[1]),n=i.exec(e);return t}function fa(e,t){let i=new RegExp(`\\b(?:var(?:<[^>]+>)?|let|const)\\s+${ae(t)}\\b`,"g"),n=i.exec(e);for(;n;){if(ma(e,n.index)===0)return!0;n=i.exec(e)}return!1}function ua(e){let t=0;for(;e.has(t);)t++;return t}function pa(e){let{primitiveType:t,components:i}=H.getAttributeShaderTypeInfo(e),n=t==="u32"?"0u":t==="i32"?"0":"0.0";return i===1?n:`${Oe(e)}(${n})`}function da(e){let{primitiveType:t,components:i}=H.getAttributeShaderTypeInfo(e),n=`${t}(0)`;return i===1?n:`${e}(${n})`}function ga(e,t){if(new RegExp(`\\b(?:flat\\s+|smooth\\s+)?(?:in|out|varying)\\s+(?:(?:lowp|mediump|highp)\\s+)?[A-Za-z_][A-Za-z0-9_]*\\s+${ae(t)}\\s*(?:\\[|;)`).test(e))throw new Error(`ShaderPlugin varying "${t}" conflicts with existing GLSL stage I/O`)}function Ge(e,t,i,n){let r=0,o=0,a=!1;for(let s=t;s<e.length;s++){let l=e[s],c=e[s+1];if(a){l===`
72
+ `&&(a=!1);continue}if(o>0){l==="/"&&c==="*"?(o++,s++):l==="*"&&c==="/"&&(o--,s++);continue}if(l==="/"&&c==="/"){a=!0,s++;continue}if(l==="/"&&c==="*"){o=1,s++;continue}if(l===i&&r++,l===n&&--r===0)return s}return-1}function ma(e,t){let i=0;for(let n=0;n<t;n++){let r=Tt(e,n,t);if(r!==n){n=r-1;continue}e[n]==="{"&&i++,e[n]==="}"&&i--}return i}function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ge(e,t,i="glsl"){let n="";for(let r in e){let o=e[r];if(n+=`${i==="wgsl"?"fn":"void"} ${o.signature} {
70
73
  `,o.header&&(n+=` ${o.header}`),t[r]){let s=t[r];s.sort((l,c)=>l.order-c.order);for(let l of s)n+=` ${l.injection}
71
74
  `}o.footer&&(n+=` ${o.footer}`),n+=`}
72
- `}return n}function Ge(e){let t={vertex:{},fragment:{}};for(let i of e)ha(t,i);return t}function Et(e,t){return!!(t.startsWith("vs:")?e.vertex:e.fragment)[t]}function ze(e,t,i){let n=i==="vertex"?"vs:":i==="fragment"?"fs:":null;for(let r in t)if(!(n&&!r.startsWith(n))&&!Et(e,r))throw new Error(`Unknown shader hook ${r}`)}function ha(e,t){let i=typeof t=="string"?{}:t,n=(typeof t=="string"?t:t.hook).trim(),r=n.indexOf(":"),o=n.slice(0,r),a=n.slice(r+1),s=n.replace(/\(.+/,""),l={hook:s,signature:a,header:i.header||"",footer:i.footer||""};switch(o){case"vs":e.vertex[s]=l;break;case"fs":e.fragment[s]=l;break;default:throw new Error(o)}}var me=100;function qi(e){let t=k(e.modules||[]),{source:i,bindingAssignments:n}=_a(e.platformInfo,{...e,source:e.source,stage:"vertex",modules:t});return{source:i,getUniforms:Ne(t),bindingAssignments:n}}function _a(e,t){let{source:i,stage:n,modules:r,defines:o={},hookFunctions:a=[],inject:s={},pluginInjections:l={},pluginVertexInputs:c={},pluginVaryings:f={},vertexEntryPoint:u="vertexMain",fragmentEntryPoint:p="fragmentMain",log:d}=t;P(typeof i=="string","shader source must be a string");let h=V(i,{defines:o}),g=ki(h,u,c),x=Hi(g.source,u,p,f),I=x.source,S="",b=Ge(a),_={},m={},v={};De(l,_,m,v);for(let y in s){let C=typeof s[y]=="string"?{injection:s[y],order:0}:s[y],N=/^(v|f)s:(#)?([\w-]+)$/.exec(y);if(N){let D=N[2],Ie=N[3];D?Ie==="decl"?m[y]=[C]:v[y]=[C]:_[y]=[C]}else v[y]=[C]}va(g.declarations,g.initialization,m,v),ba(x,m,v),ze(b,_);let A=r.map(y=>({module:y,source:V(Y(y,"wgsl",d),{defines:o})})),M=Ca(I),E=ya(M.source),L=Ra(A,t._bindingRegistry,E),R=[],w=A.map(({module:y,source:C})=>{let N=La(C,y,{usedBindingsByGroup:E,bindingRegistry:t._bindingRegistry,reservedBindingKeysByGroup:L});return R.push(...N.bindingAssignments),{module:y,source:N.source}});for(let{module:y,source:C}of w){d&&ae(y,I,d),S+=C;let N=xa(y);for(let D in N){let Ie=/^(v|f)s:#([\w-]+)$/.exec(D);if(Ie){let dt=Ie[2]==="decl"?m:v;dt[D]=dt[D]||[],dt[D].push(N[D])}else Et(b,D)&&(_[D]=_[D]||[],_[D].push(N[D]))}}return S+=de,S=oe(S,n,Sa(m),!1,"wgsl",{vertex:u,fragment:p}),S+=Ia(b,_),S+=Pa(R),S+=M.source,S=oe(S,n,v,!1,"wgsl",{vertex:u,fragment:p}),Ta(S),{source:S,bindingAssignments:R}}function va(e,t,i,n){e&&(i["vs:#decl"]=i["vs:#decl"]||[],i["vs:#decl"].push({injection:e,order:Number.MIN_SAFE_INTEGER})),t&&(n["vs:#main-start"]=n["vs:#main-start"]||[],n["vs:#main-start"].push({injection:t,order:Number.MIN_SAFE_INTEGER}))}function ba(e,t,i){e.declarations&&(t["vs:#decl"]=t["vs:#decl"]||[],t["vs:#decl"].push({injection:e.declarations,order:Number.MIN_SAFE_INTEGER})),e.vertexInitialization&&(i["vs:#main-start"]=i["vs:#main-start"]||[],i["vs:#main-start"].push({injection:e.vertexInitialization,order:Number.MIN_SAFE_INTEGER})),e.fragmentInitialization&&(i["fs:#main-start"]=i["fs:#main-start"]||[],i["fs:#main-start"].push({injection:e.fragmentInitialization,order:Number.MIN_SAFE_INTEGER}))}function xa(e){return{...e.instance?.normalizedInjections.vertex||{},...e.instance?.normalizedInjections.fragment||{}}}function Sa(e){let t=[...e["vs:#decl"]||[],...e["fs:#decl"]||[]];return t.length?{"vs:#decl":t}:{}}function Ia(e,t){return ge(e.vertex,t,"wgsl")+ge(e.fragment,t,"wgsl")}function ya(e){let t=new Map;for(let i of j(e,si)){let n=Number(i.bindingToken),r=Number(i.groupToken);Tt(r,n,i.name),se(t,r,n,`application binding "${i.name}"`)}return t}function Ca(e){let t=j(e,ye),i=new Map;for(let o of t){if(o.bindingToken==="auto")continue;let a=Number(o.bindingToken),s=Number(o.groupToken);Tt(s,a,o.name),se(i,s,a,`application binding "${o.name}"`)}let n={sawSupportedBindingDeclaration:t.length>0},r=mt(e,ye,o=>Ma(o,i,n));if(ht(e)&&!n.sawSupportedBindingDeclaration)throw new Error('Unsupported @binding(auto) declaration form in application WGSL. Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.');return{source:r}}function La(e,t,i){let n=[],o={sawSupportedBindingDeclaration:j(e,ne).length>0,nextHintedBindingLocation:typeof t.firstBindingSlot=="number"?t.firstBindingSlot:null},a=mt(e,ne,s=>Aa(s,{module:t,context:i,bindingAssignments:n,relocationState:o}));if(ht(e)&&!o.sawSupportedBindingDeclaration)throw new Error(`Unsupported @binding(auto) declaration form in module "${t.name}". Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.`);return{source:a,bindingAssignments:n}}function Aa(e,t){let{module:i,context:n,bindingAssignments:r,relocationState:o}=t,{match:a,bindingToken:s,groupToken:l,name:c}=e,f=Number(l);if(s==="auto"){let d=Ve(f,i.name,c),h=n.bindingRegistry?.get(d),g=h!==void 0?h:Ea(f,n.usedBindingsByGroup,i.name,o.nextHintedBindingLocation??void 0,n.bindingRegistry);return wt(i.name,f,g,c),h!==void 0&&Wi(n.reservedBindingKeysByGroup,f,g,d)?(r.push({moduleName:i.name,name:c,group:f,location:g}),a.replace(/@binding\(\s*auto\s*\)/,`@binding(${g})`)):(se(n.usedBindingsByGroup,f,g,`module "${i.name}" binding "${c}"`),n.bindingRegistry?.set(d,g),r.push({moduleName:i.name,name:c,group:f,location:g}),o.nextHintedBindingLocation!==null&&h===void 0&&(o.nextHintedBindingLocation=g+1),a.replace(/@binding\(\s*auto\s*\)/,`@binding(${g})`))}let u=Number(s);wt(i.name,f,u,c);let p=Ve(f,i.name,c);return Wi(n.reservedBindingKeysByGroup,f,u,p)||se(n.usedBindingsByGroup,f,u,`module "${i.name}" binding "${c}"`),r.push({moduleName:i.name,name:c,group:f,location:u}),a}function Ma(e,t,i){let{match:n,bindingToken:r,groupToken:o,name:a}=e,s=Number(o);if(r==="auto"){let l=wa(s,t);return Tt(s,l,a),se(t,s,l,`application binding "${a}"`),n.replace(/@binding\(\s*auto\s*\)/,`@binding(${l})`)}return i.sawSupportedBindingDeclaration=!0,n}function Ra(e,t,i){let n=new Map,r=[];function o(a,s,l,c){se(i,a,s,c);let f=n.get(a)||new Map;f.set(s,l),n.set(a,f)}for(let{module:a,source:s}of e)for(let l of j(s,ne)){let c=Number(l.groupToken);if(l.bindingToken==="auto"){r.push({module:a,name:l.name,group:c});continue}let f=Number(l.bindingToken);wt(a.name,c,f,l.name),o(c,f,Ve(c,a.name,l.name),`module "${a.name}" binding "${l.name}"`)}for(let{module:a,name:s,group:l}of r){let c=Ve(l,a.name,s),f=t?.get(c);f!==void 0&&o(l,f,c,`registered module binding "${c}"`)}return n}function Wi(e,t,i,n){let r=e.get(t);if(!r)return!1;let o=r.get(i);if(!o)return!1;if(o!==n)throw new Error(`Registered module binding "${n}" collided with "${o}": group ${t}, binding ${i}.`);return r.delete(i),!0}function Tt(e,t,i){if(e===0&&t>=me)throw new Error(`Application binding "${i}" in group 0 uses reserved binding ${t}. Application-owned explicit group-0 bindings must stay below ${me}.`)}function wt(e,t,i,n){if(t===0&&i<me)throw new Error(`Module "${e}" binding "${n}" in group 0 uses reserved application binding ${i}. Module-owned explicit group-0 bindings must be ${me} or higher.`)}function se(e,t,i,n){let r=e.get(t)||new Set;if(r.has(i))throw new Error(`Duplicate WGSL binding assignment for ${n}: group ${t}, binding ${i}.`);r.add(i),e.set(t,r)}function Ea(e,t,i,n,r){let o=t.get(e)||new Set,a=new Set,s=`${e}:`,l=`${s}${i}:`;for(let[f,u]of r||[])f.startsWith(l)&&a.add(u);let c=n??(e===0?me:o.size>0?Math.max(...o)+1:0);for(;o.has(c)||a.has(c);)c++;for(let[f,u]of r||[])u===c&&f.startsWith(s)&&r?.delete(f);return c}function wa(e,t){let i=t.get(e)||new Set,n=0;for(;i.has(n);)n++;return n}function Ta(e){let t=li(e,ne);if(!t)return;let i=Na(e,t.index);throw i?new Error(`Unresolved @binding(auto) for module "${i}" binding "${t.name}" remained in assembled WGSL source.`):Da(e,t.index)?new Error(`Unresolved @binding(auto) for application binding "${t.name}" remained in assembled WGSL source.`):new Error(`Unresolved @binding(auto) remained in assembled WGSL source near "${Fa(t.match)}".`)}function Pa(e){if(e.length===0)return"";let t=`// ----- MODULE WGSL BINDING ASSIGNMENTS ---------------
75
+ `}return n}function ze(e){let t={vertex:{},fragment:{}};for(let i of e)ha(t,i);return t}function Pt(e,t){return!!(t.startsWith("vs:")?e.vertex:e.fragment)[t]}function Ve(e,t,i){let n=i==="vertex"?"vs:":i==="fragment"?"fs:":null;for(let r in t)if(!(n&&!r.startsWith(n))&&!Pt(e,r)){let o=[...new Set(t[r].map(a=>a.pluginName).filter(Boolean))];throw new Error(`Unknown shader hook ${r}${o.length?` (plugins: ${o.join(", ")})`:""}`)}}function ha(e,t){let i=typeof t=="string"?{}:t,n=(typeof t=="string"?t:t.hook).trim(),r=n.indexOf(":"),o=n.slice(0,r),a=n.slice(r+1),s=n.replace(/\(.+/,""),l={hook:s,signature:a,header:i.header||"",footer:i.footer||""};switch(o){case"vs":e.vertex[s]=l;break;case"fs":e.fragment[s]=l;break;default:throw new Error(o)}}var me=100;function Yi(e){let t=k(e.modules||[]),{source:i,bindingAssignments:n}=_a(e.platformInfo,{...e,source:e.source,stage:"vertex",modules:t});return{source:i,getUniforms:De(t),bindingAssignments:n}}function _a(e,t){let{source:i,stage:n,modules:r,defines:o={},hookFunctions:a=[],inject:s={},pluginInjections:l={},pluginVertexInputs:c={},pluginInterStageVariables:f={},vertexEntryPoint:u="vertexMain",fragmentEntryPoint:p="fragmentMain",log:d}=t;P(typeof i=="string","shader source must be a string");let v=W(i,{defines:o}),m=Wi(v,u,c),x=$i(m.source,u,p,f),I=x.source,S="",b=ze(a),h={},g={},_={};Fe(l,h,g,_);for(let y in s){let C=typeof s[y]=="string"?{injection:s[y],order:0}:s[y],N=/^(v|f)s:(#)?([\w-]+)$/.exec(y);if(N){let D=N[2],Ie=N[3];D?Ie==="decl"?g[y]=[...g[y]||[],C]:_[y]=[..._[y]||[],C]:h[y]=[...h[y]||[],C]}else _[y]=[..._[y]||[],C]}va(m.declarations,m.initialization,g,_),ba(x,g,_),Ve(b,h);let M=r.map(y=>({module:y,source:W(Z(y,"wgsl",d),{defines:o})})),A=Ca(I),R=ya(A.source),L=Ra(M,t._bindingRegistry,R),E=[],w=M.map(({module:y,source:C})=>{let N=La(C,y,{usedBindingsByGroup:R,bindingRegistry:t._bindingRegistry,reservedBindingKeysByGroup:L});return E.push(...N.bindingAssignments),{module:y,source:N.source}});for(let{module:y,source:C}of w){d&&oe(y,I,d),S+=C;let N=xa(y);for(let D in N){let Ie=/^(v|f)s:#([\w-]+)$/.exec(D);if(Ie){let gt=Ie[2]==="decl"?g:_;gt[D]=gt[D]||[],gt[D].push(N[D])}else Pt(b,D)&&(h[D]=h[D]||[],h[D].push(N[D]))}}return S+=de,S=re(S,n,Sa(g),!1,"wgsl",{vertex:u,fragment:p}),S+=Ia(b,h),S+=Pa(E),S+=A.source,S=re(S,n,_,!1,"wgsl",{vertex:u,fragment:p}),Ta(S),{source:S,bindingAssignments:E}}function va(e,t,i,n){e&&(i["vs:#decl"]=i["vs:#decl"]||[],i["vs:#decl"].push({injection:e,order:Number.MIN_SAFE_INTEGER})),t&&(n["vs:#main-start"]=n["vs:#main-start"]||[],n["vs:#main-start"].push({injection:t,order:Number.MIN_SAFE_INTEGER}))}function ba(e,t,i){e.declarations&&(t["vs:#decl"]=t["vs:#decl"]||[],t["vs:#decl"].push({injection:e.declarations,order:Number.MIN_SAFE_INTEGER})),e.vertexInitialization&&(i["vs:#main-start"]=i["vs:#main-start"]||[],i["vs:#main-start"].push({injection:e.vertexInitialization,order:Number.MIN_SAFE_INTEGER})),e.fragmentInitialization&&(i["fs:#main-start"]=i["fs:#main-start"]||[],i["fs:#main-start"].push({injection:e.fragmentInitialization,order:Number.MIN_SAFE_INTEGER}))}function xa(e){return{...e.instance?.normalizedInjections.vertex||{},...e.instance?.normalizedInjections.fragment||{}}}function Sa(e){let t=[...e["vs:#decl"]||[],...e["fs:#decl"]||[]];return t.length?{"vs:#decl":t}:{}}function Ia(e,t){return ge(e.vertex,t,"wgsl")+ge(e.fragment,t,"wgsl")}function ya(e){let t=new Map;for(let i of K(e,fi)){let n=Number(i.bindingToken),r=Number(i.groupToken);Dt(r,n,i.name),se(t,r,n,`application binding "${i.name}"`)}return t}function Ca(e){let t=K(e,ye),i=new Map;for(let o of t){if(o.bindingToken==="auto")continue;let a=Number(o.bindingToken),s=Number(o.groupToken);Dt(s,a,o.name),se(i,s,a,`application binding "${o.name}"`)}let n={sawSupportedBindingDeclaration:t.length>0},r=ht(e,ye,o=>Ma(o,i,n));if(_t(e)&&!n.sawSupportedBindingDeclaration)throw new Error('Unsupported @binding(auto) declaration form in application WGSL. Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.');return{source:r}}function La(e,t,i){let n=[],o={sawSupportedBindingDeclaration:K(e,ne).length>0,nextHintedBindingLocation:typeof t.firstBindingSlot=="number"?t.firstBindingSlot:null},a=ht(e,ne,s=>Aa(s,{module:t,context:i,bindingAssignments:n,relocationState:o}));if(_t(e)&&!o.sawSupportedBindingDeclaration)throw new Error(`Unsupported @binding(auto) declaration form in module "${t.name}". Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.`);return{source:a,bindingAssignments:n}}function Aa(e,t){let{module:i,context:n,bindingAssignments:r,relocationState:o}=t,{match:a,bindingToken:s,groupToken:l,name:c}=e,f=Number(l);if(s==="auto"){let d=He(f,i.name,c),v=n.bindingRegistry?.get(d),m=v!==void 0?v:Ea(f,n.usedBindingsByGroup,i.name,o.nextHintedBindingLocation??void 0,n.bindingRegistry);return Nt(i.name,f,m,c),v!==void 0&&Ki(n.reservedBindingKeysByGroup,f,m,d)?(r.push({moduleName:i.name,name:c,group:f,location:m}),a.replace(/@binding\(\s*auto\s*\)/,`@binding(${m})`)):(se(n.usedBindingsByGroup,f,m,`module "${i.name}" binding "${c}"`),n.bindingRegistry?.set(d,m),r.push({moduleName:i.name,name:c,group:f,location:m}),o.nextHintedBindingLocation!==null&&v===void 0&&(o.nextHintedBindingLocation=m+1),a.replace(/@binding\(\s*auto\s*\)/,`@binding(${m})`))}let u=Number(s);Nt(i.name,f,u,c);let p=He(f,i.name,c);return Ki(n.reservedBindingKeysByGroup,f,u,p)||se(n.usedBindingsByGroup,f,u,`module "${i.name}" binding "${c}"`),r.push({moduleName:i.name,name:c,group:f,location:u}),a}function Ma(e,t,i){let{match:n,bindingToken:r,groupToken:o,name:a}=e,s=Number(o);if(r==="auto"){let l=wa(s,t);return Dt(s,l,a),se(t,s,l,`application binding "${a}"`),n.replace(/@binding\(\s*auto\s*\)/,`@binding(${l})`)}return i.sawSupportedBindingDeclaration=!0,n}function Ra(e,t,i){let n=new Map,r=[];function o(a,s,l,c){se(i,a,s,c);let f=n.get(a)||new Map;f.set(s,l),n.set(a,f)}for(let{module:a,source:s}of e)for(let l of K(s,ne)){let c=Number(l.groupToken);if(l.bindingToken==="auto"){r.push({module:a,name:l.name,group:c});continue}let f=Number(l.bindingToken);Nt(a.name,c,f,l.name),o(c,f,He(c,a.name,l.name),`module "${a.name}" binding "${l.name}"`)}for(let{module:a,name:s,group:l}of r){let c=He(l,a.name,s),f=t?.get(c);f!==void 0&&o(l,f,c,`registered module binding "${c}"`)}return n}function Ki(e,t,i,n){let r=e.get(t);if(!r)return!1;let o=r.get(i);if(!o)return!1;if(o!==n)throw new Error(`Registered module binding "${n}" collided with "${o}": group ${t}, binding ${i}.`);return r.delete(i),!0}function Dt(e,t,i){if(e===0&&t>=me)throw new Error(`Application binding "${i}" in group 0 uses reserved binding ${t}. Application-owned explicit group-0 bindings must stay below ${me}.`)}function Nt(e,t,i,n){if(t===0&&i<me)throw new Error(`Module "${e}" binding "${n}" in group 0 uses reserved application binding ${i}. Module-owned explicit group-0 bindings must be ${me} or higher.`)}function se(e,t,i,n){let r=e.get(t)||new Set;if(r.has(i))throw new Error(`Duplicate WGSL binding assignment for ${n}: group ${t}, binding ${i}.`);r.add(i),e.set(t,r)}function Ea(e,t,i,n,r){let o=t.get(e)||new Set,a=new Set,s=`${e}:`,l=`${s}${i}:`;for(let[f,u]of r||[])f.startsWith(l)&&a.add(u);let c=n??(e===0?me:o.size>0?Math.max(...o)+1:0);for(;o.has(c)||a.has(c);)c++;for(let[f,u]of r||[])u===c&&f.startsWith(s)&&r?.delete(f);return c}function wa(e,t){let i=t.get(e)||new Set,n=0;for(;i.has(n);)n++;return n}function Ta(e){let t=ui(e,ne);if(!t)return;let i=Na(e,t.index);throw i?new Error(`Unresolved @binding(auto) for module "${i}" binding "${t.name}" remained in assembled WGSL source.`):Da(e,t.index)?new Error(`Unresolved @binding(auto) for application binding "${t.name}" remained in assembled WGSL source.`):new Error(`Unresolved @binding(auto) remained in assembled WGSL source near "${Fa(t.match)}".`)}function Pa(e){if(e.length===0)return"";let t=`// ----- MODULE WGSL BINDING ASSIGNMENTS ---------------
73
76
  `;for(let i of e)t+=`// ${i.moduleName}.${i.name} -> @group(${i.group}) @binding(${i.location})
74
77
  `;return t+=`
75
- `,t}function Ve(e,t,i){return`${e}:${t}:${i}`}function Na(e,t){let i=/^\/\/ ----- MODULE ([^\n]+) ---------------$/gm,n,r;for(r=i.exec(e);r&&r.index<=t;)n=r[1],r=i.exec(e);return n}function Da(e,t){let i=e.indexOf(de);return i>=0?t>i:!0}function Fa(e){return e.replace(/\s+/g," ").trim()}function He(e,t){return{name:Oa(e,t),language:"glsl",version:Ba(e)}}function Oa(e,t="unnamed"){let n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return n?n[1]:t}function Ba(e){let t=100,i=e.match(/[^\s]+/g);if(i&&i.length>=2&&i[0]==="#version"){let n=parseInt(i[1],10);Number.isFinite(n)&&(t=n)}if(t!==100&&t!==300)throw new Error(`Invalid GLSL version ${t}`);return t}function ji(e){switch(e?.gpu.toLowerCase()){case"apple":return`#define APPLE_GPU
78
+ `,t}function He(e,t,i){return`${e}:${t}:${i}`}function Na(e,t){let i=/^\/\/ ----- MODULE ([^\n]+) ---------------$/gm,n,r;for(r=i.exec(e);r&&r.index<=t;)n=r[1],r=i.exec(e);return n}function Da(e,t){let i=e.indexOf(de);return i>=0?t>i:!0}function Fa(e){return e.replace(/\s+/g," ").trim()}function We(e,t){return{name:Oa(e,t),language:"glsl",version:Ba(e)}}function Oa(e,t="unnamed"){let n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return n?n[1]:t}function Ba(e){let t=100,i=e.match(/[^\s]+/g);if(i&&i.length>=2&&i[0]==="#version"){let n=parseInt(i[1],10);Number.isFinite(n)&&(t=n)}if(t!==100&&t!==300)throw new Error(`Invalid GLSL version ${t}`);return t}function Zi(e){switch(e?.gpu.toLowerCase()){case"apple":return`#define APPLE_GPU
76
79
  // Apple optimizes away the calculation necessary for emulated fp64
77
80
  #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
78
81
  #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
@@ -96,16 +99,16 @@ return ${s};
96
99
  #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
97
100
  // If the GPU doesn't have full 32 bits precision, will causes overflow
98
101
  #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
99
- `}}function Ki(e,t){if(Number(e.match(/^#version[ \t]+(\d+)/m)?.[1]||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case"vertex":return e=$i(e,Ua),e;case"fragment":return e=$i(e,ka),e;default:throw new Error(t)}}var Yi=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
100
- `],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Ua=[...Yi,[Pt("attribute"),"in $1"],[Pt("varying"),"out $1"]],ka=[...Yi,[Pt("varying"),"in $1"]];function $i(e,t){for(let[i,n]of t)e=e.replace(i,n);return e}function Pt(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}var Ga=`precision highp float;
101
- `;function he(e){let{vs:t,fs:i}=e,n=k(e.modules||[]);return{vs:Zi(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:Zi(e.platformInfo,{...e,source:i,stage:"fragment",modules:n}),getUniforms:Ne(n)}}function Zi(e,t){let{source:i,stage:n,language:r="glsl",modules:o,defines:a={},hookFunctions:s=[],inject:l={},pluginInjections:c={},pluginVertexInputs:f={},pluginVaryings:u={},prologue:p=!0,log:d}=t;P(typeof i=="string","shader source must be a string");let h=r==="glsl"?He(i).version:-1,g=e.shaderLanguageVersion,x=h===100?"#version 100":"#version 300 es",S=i.split(`
102
+ `}}function Ji(e,t){if(Number(e.match(/^#version[ \t]+(\d+)/m)?.[1]||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case"vertex":return e=Xi(e,Ua),e;case"fragment":return e=Xi(e,ka),e;default:throw new Error(t)}}var Qi=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
103
+ `],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Ua=[...Qi,[Ft("attribute"),"in $1"],[Ft("varying"),"out $1"]],ka=[...Qi,[Ft("varying"),"in $1"]];function Xi(e,t){for(let[i,n]of t)e=e.replace(i,n);return e}function Ft(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}var Ga=`precision highp float;
104
+ `;function he(e){let{vs:t,fs:i}=e,n=k(e.modules||[]);return{vs:en(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:en(e.platformInfo,{...e,source:i,stage:"fragment",modules:n}),getUniforms:De(n)}}function en(e,t){let{source:i,stage:n,language:r="glsl",modules:o,defines:a={},hookFunctions:s=[],inject:l={},pluginInjections:c={},pluginVertexInputs:f={},pluginInterStageVariables:u={},prologue:p=!0,log:d}=t;P(typeof i=="string","shader source must be a string");let v=r==="glsl"?We(i).version:-1,m=e.shaderLanguageVersion,x=v===100?"#version 100":"#version 300 es",S=i.split(`
102
105
  `).slice(1).join(`
103
- `),b={};o.forEach(L=>{Object.assign(b,L.defines)}),Object.assign(b,a);let _="";switch(r){case"wgsl":break;case"glsl":_=p?`${x}
106
+ `),b={};o.forEach(L=>{Object.assign(b,L.defines)}),Object.assign(b,a);let h="";switch(r){case"wgsl":break;case"glsl":h=p?`${x}
104
107
 
105
108
  // ----- PROLOGUE -------------------------
106
109
  ${`#define SHADER_TYPE_${n.toUpperCase()}`}
107
110
 
108
- ${ji(e)}
111
+ ${Zi(e)}
109
112
  ${n==="fragment"?Ga:""}
110
113
 
111
114
  // ----- APPLICATION DEFINES -------------------------
@@ -113,21 +116,23 @@ ${n==="fragment"?Ga:""}
113
116
  ${za(b)}
114
117
 
115
118
  `:`${x}
116
- `;break}let m=Ge(s),v={},A={},M={};De(c,v,A,M);for(let L in l){let R=typeof l[L]=="string"?{injection:l[L],order:0}:l[L],w=/^(v|f)s:(#)?([\w-]+)$/.exec(L);if(w){let y=w[2],C=w[3];y?C==="decl"?A[L]=[R]:M[L]=[R]:v[L]=[R]}else M[L]=[R]}if(n==="vertex"){let L=Ui(S,f);L&&(A["vs:#decl"]=A["vs:#decl"]||[],A["vs:#decl"].push({injection:L,order:Number.MIN_SAFE_INTEGER}))}let E=Vi(S,n,u);if(E.declarations){let L=n==="vertex"?"vs:#decl":"fs:#decl";A[L]=A[L]||[],A[L].push({injection:E.declarations,order:Number.MIN_SAFE_INTEGER})}E.initialization&&(M["vs:#main-start"]=M["vs:#main-start"]||[],M["vs:#main-start"].push({injection:E.initialization,order:Number.MIN_SAFE_INTEGER}));for(let L of o){d&&ae(L,S,d);let R=Y(L,n,d);_+=R;let w=L.instance?.normalizedInjections[n]||{};for(let y in w){let C=/^(v|f)s:#([\w-]+)$/.exec(y);if(C){let D=C[2]==="decl"?A:M;D[y]=D[y]||[],D[y].push(w[y])}else v[y]=v[y]||[],v[y].push(w[y])}}return ze(m,v,n),_+="// ----- MAIN SHADER SOURCE -------------------------",_+=de,_=oe(_,n,A),_+=ge(m[n],v),_+=S,_=oe(_,n,M),r==="glsl"&&h!==g&&(_=Ki(_,n)),r==="glsl"&&Pe(_,n,d),_.trim()}function za(e={}){let t="";for(let i in e){let n=e[i];(n||Number.isFinite(n))&&(t+=`#define ${i.toUpperCase()} ${e[i]}
117
- `)}return t}var z=class{_shaderTranspilers=new Map;_hookFunctions=[];_defaultModules=[];addShaderTranspiler(t){this._shaderTranspilers.set(t.sourceLanguage,t)}removeShaderTranspiler(t){this._shaderTranspilers.delete(t)}_transpileShader(t,i,n,r){let o=t.sourceLanguage||this.shaderLanguage;if(o===this.shaderLanguage)return P(!k(i).some(p=>p.sourceLanguage&&p.sourceLanguage!==this.shaderLanguage)),{code:n||"",modules:i};let a=this._shaderTranspilers.get(o);P(a);let s=k(i);P(!s.some(p=>p.sourceLanguage&&p.sourceLanguage!==o&&p.sourceLanguage!==this.shaderLanguage));let l=s.filter(p=>p.sourceLanguage===o).map(p=>p.source||"").join(`
119
+ `;break}let g=ze(s),_={},M={},A={};Fe(c,_,M,A);for(let L in l){let E=typeof l[L]=="string"?{injection:l[L],order:0}:l[L],w=/^(v|f)s:(#)?([\w-]+)$/.exec(L);if(w){let y=w[2],C=w[3];y?C==="decl"?M[L]=[...M[L]||[],E]:A[L]=[...A[L]||[],E]:_[L]=[..._[L]||[],E]}else A[L]=[...A[L]||[],E]}if(n==="vertex"){let L=Hi(S,f);L&&(h+=`${L}
120
+ `)}let R=ji(S,n,u);R.declarations&&(h+=`${R.declarations}
121
+ `),R.initialization&&(A["vs:#main-start"]=A["vs:#main-start"]||[],A["vs:#main-start"].push({injection:R.initialization,order:Number.MIN_SAFE_INTEGER}));for(let L of o){d&&oe(L,S,d);let E=Z(L,n,d);h+=E;let w=L.instance?.normalizedInjections[n]||{};for(let y in w){let C=/^(v|f)s:#([\w-]+)$/.exec(y);if(C){let D=C[2]==="decl"?M:A;D[y]=D[y]||[],D[y].push(w[y])}else _[y]=_[y]||[],_[y].push(w[y])}}return Ve(g,_,n),h+="// ----- MAIN SHADER SOURCE -------------------------",h+=de,h=re(h,n,M),h+=ge(g[n],_),h+=S,h=re(h,n,A),r==="glsl"&&v!==m&&(h=Ji(h,n)),r==="glsl"&&Ne(h,n,d),h.trim()}function za(e={}){let t="";for(let i in e){let n=e[i];(n||Number.isFinite(n))&&(t+=`#define ${i.toUpperCase()} ${e[i]}
122
+ `)}return t}var V=class{_shaderTranspilers=new Map;_hookFunctions=[];_defaultModules=[];addShaderTranspiler(t){this._shaderTranspilers.set(t.sourceLanguage,t)}removeShaderTranspiler(t){this._shaderTranspilers.delete(t)}_transpileShader(t,i,n,r){let o=t.sourceLanguage||this.shaderLanguage;if(o===this.shaderLanguage)return P(!k(i).some(p=>p.sourceLanguage&&p.sourceLanguage!==this.shaderLanguage)),{code:n||"",modules:i};let a=this._shaderTranspilers.get(o);P(a);let s=k(i);P(!s.some(p=>p.sourceLanguage&&p.sourceLanguage!==o&&p.sourceLanguage!==this.shaderLanguage));let l=s.filter(p=>p.sourceLanguage===o).map(p=>p.source||"").join(`
118
123
  `),c={vertex:t.vertexEntryPoint,fragment:t.fragmentEntryPoint,compute:t.computeEntryPoint},f=n==null?{code:""}:a.transpile({source:[l,n].filter(Boolean).join(`
119
- `),target:this.shaderLanguage,stage:r,entryPoints:c,platformInfo:t.platformInfo}),u=s.map(p=>({...p,dependencies:void 0,...p.sourceLanguage===o?{source:void 0,vs:void 0,fs:void 0}:{}}));return{...f,modules:u}}addDefaultModule(t){this._defaultModules.find(i=>i.name===(typeof t=="string"?t:t.name))||this._defaultModules.push(t)}removeDefaultModule(t){let i=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==i)}addShaderHook(t,i){this._hookFunctions.push(i?{...i,hook:t}:t)}resetShaderHooks(){this._hookFunctions.length=0}_getModuleList(t=[]){let i=new Array(this._defaultModules.length+t.length),n={},r=0;for(let o=0,a=this._defaultModules.length;o<a;++o){let s=this._defaultModules[o],l=s.name;i[r++]=s,n[l]=!0}for(let o=0,a=t.length;o<a;++o){let s=t[o],l=s.name;n[l]||(i[r++]=s,n[l]=!0)}return i.length=r,$(i),i}};var _e=class extends z{shaderLanguage="glsl";assembleGLSLShaderPair(t){let i=this._getModuleList(t.modules),n=this._hookFunctions,r=this._transpileShader(t,i,t.vs,"vertex"),o=this._transpileShader(t,i,t.fs,"fragment");return{...he({...t,vs:r.code,fs:t.fs==null?void 0:o.code,modules:r.modules,hookFunctions:n}),modules:i}}};var ve=class e extends z{shaderLanguage="wgsl";_wgslBindingRegistry=new Map;assembleWGSLShader(t){let i=this._getModuleList(t.modules),n=this._hookFunctions,r=this._transpileShader(t,i,t.source,t.shaderStage??(t.computeEntryPoint?"compute":void 0)),o={vertex:r.entryPoints?.vertex??t.vertexEntryPoint,fragment:r.entryPoints?.fragment??t.fragmentEntryPoint,compute:r.entryPoints?.compute??t.computeEntryPoint},a=e.getShaderPreprocessorDefines(t,i),s=t.platformInfo.shaderLanguage==="wgsl"&&r.code?V(r.code,{defines:a}):r.code,{source:l,getUniforms:c,bindingAssignments:f}=qi({...t,source:s,vertexEntryPoint:o.vertex,fragmentEntryPoint:o.fragment,defines:a,_bindingRegistry:this._wgslBindingRegistry,modules:r.modules,hookFunctions:n}),u=t.platformInfo.shaderLanguage==="wgsl"?V(l,{defines:a}):l;return{source:u,entryPoints:o,getUniforms:c,modules:i,bindingAssignments:f,bindingTable:Fi(u,f),shaderLayout:Le(u,{vertexEntryPoint:o.vertex,scanVertexAttributes:t.scanVertexAttributes})}}static getShaderPreprocessorDefines(t,i){return{...e.getPlatformPreprocessorDefines(t.platformInfo),...i.reduce((n,r)=>(Object.assign(n,r.defines),n),{}),...t.defines}}static getPlatformPreprocessorDefines(t){let i=t.limits||{};return{LUMA_SUPPORTS_VERTEX_STORAGE_BUFFERS:t.type==="webgpu"&&(i.maxStorageBuffersInVertexStage||0)>0,LUMA_FP32_TAN_PRECISION_WORKAROUND:t.type==="webgpu"&&t.gpu.toLowerCase()!=="nvidia"&&t.gpu.toLowerCase()!=="amd",LUMA_FP64_INTEGER_ARITHMETIC:t.type==="webgpu"&&t.gpu.toLowerCase()==="apple"}}};var Va=`out vec4 transform_output;
124
+ `),target:this.shaderLanguage,stage:r,entryPoints:c,platformInfo:t.platformInfo}),u=s.map(p=>({...p,dependencies:void 0,...p.sourceLanguage===o?{source:void 0,vs:void 0,fs:void 0}:{}}));return{...f,modules:u}}addDefaultModule(t){this._defaultModules.find(i=>i.name===(typeof t=="string"?t:t.name))||this._defaultModules.push(t)}removeDefaultModule(t){let i=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==i)}addShaderHook(t,i){this._hookFunctions.push(i?{...i,hook:t}:t)}resetShaderHooks(){this._hookFunctions.length=0}_getModuleList(t=[]){let i=new Array(this._defaultModules.length+t.length),n={},r=0;for(let o=0,a=this._defaultModules.length;o<a;++o){let s=this._defaultModules[o],l=s.name;i[r++]=s,n[l]=!0}for(let o=0,a=t.length;o<a;++o){let s=t[o],l=s.name;n[l]||(i[r++]=s,n[l]=!0)}return i.length=r,Y(i),i}};var _e=class extends V{shaderLanguage="glsl";assembleGLSLShaderPair(t){let i=this._getModuleList(t.modules),n=[...this._hookFunctions,...t.hookFunctions||[]],r=this._transpileShader(t,i,t.vs,"vertex"),o=this._transpileShader(t,i,t.fs,"fragment");return{...he({...t,vs:r.code,fs:t.fs==null?void 0:o.code,modules:r.modules,hookFunctions:n}),modules:i}}};var ve=class e extends V{shaderLanguage="wgsl";_wgslBindingRegistry=new Map;assembleWGSLShader(t){let i=this._getModuleList(t.modules),n=[...this._hookFunctions,...t.hookFunctions||[]],r=this._transpileShader(t,i,t.source,t.shaderStage??(t.computeEntryPoint?"compute":void 0)),o={vertex:r.entryPoints?.vertex??t.vertexEntryPoint,fragment:r.entryPoints?.fragment??t.fragmentEntryPoint,compute:r.entryPoints?.compute??t.computeEntryPoint},a=e.getShaderPreprocessorDefines(t,i),s=t.platformInfo.shaderLanguage==="wgsl"&&r.code?W(r.code,{defines:a}):r.code,{source:l,getUniforms:c,bindingAssignments:f}=Yi({...t,source:s,vertexEntryPoint:o.vertex,fragmentEntryPoint:o.fragment,defines:a,_bindingRegistry:this._wgslBindingRegistry,modules:r.modules,hookFunctions:n}),u=t.platformInfo.shaderLanguage==="wgsl"?W(l,{defines:a}):l;return{source:u,entryPoints:o,getUniforms:c,modules:i,bindingAssignments:f,bindingTable:Gi(u,f),shaderLayout:Le(u,{vertexEntryPoint:o.vertex,scanVertexAttributes:t.scanVertexAttributes})}}static getShaderPreprocessorDefines(t,i){return{...e.getPlatformPreprocessorDefines(t.platformInfo),...i.reduce((n,r)=>(Object.assign(n,r.defines),n),{}),...t.defines}}static getPlatformPreprocessorDefines(t){let i=t.limits||{};return{LUMA_SUPPORTS_VERTEX_STORAGE_BUFFERS:t.type==="webgpu"&&(i.maxStorageBuffersInVertexStage||0)>0,LUMA_FP32_TAN_PRECISION_WORKAROUND:t.type==="webgpu"&&t.gpu.toLowerCase()!=="nvidia"&&t.gpu.toLowerCase()!=="amd",LUMA_FP64_INTEGER_ARITHMETIC:t.type==="webgpu"&&t.gpu.toLowerCase()==="apple"}}};var Va=`out vec4 transform_output;
120
125
  void main() {
121
126
  transform_output = vec4(0);
122
127
  }`,Ha=`#version 300 es
123
- ${Va}`;function Xi(e,t){t=Array.isArray(t)?t:[t];let i=e.replace(/^\s+/,"").split(/\s+/),[n,r,o]=i;if(!t.includes(n)||!r||!o)return null;let a=o.split(";")[0];return{qualifier:n,type:r,name:a}}function Ji(e){let{input:t,inputChannels:i,output:n}=e||{};if(!t)return Ha;if(!i)throw new Error("inputChannels");let r=Wa(i),o=Nt(t,i);return`#version 300 es
128
+ ${Va}`;function tn(e,t){t=Array.isArray(t)?t:[t];let i=e.replace(/^\s+/,"").split(/\s+/),[n,r,o]=i;if(!t.includes(n)||!r||!o)return null;let a=o.split(";")[0];return{qualifier:n,type:r,name:a}}function nn(e){let{input:t,inputChannels:i,output:n}=e||{};if(!t)return Ha;if(!i)throw new Error("inputChannels");let r=Wa(i),o=Ot(t,i);return`#version 300 es
124
129
  in ${r} ${t};
125
130
  out vec4 ${n};
126
131
  void main() {
127
132
  ${n} = ${o};
128
- }`}function Qi(e){switch(e){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:throw new Error(e)}}function en(e){switch(e){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:throw new Error(e)}}function Wa(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${e}`)}}function Nt(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw new Error(`invalid channels: ${t}`)}}function J(e){return typeof e=="string"?e.charAt(0).toUpperCase()+e.slice(1):e}function tn(e,t){return qa(e,t)}function qa(e,t){let i=[];switch(t.uniforms){case"scoped-interface-blocks":case"unscoped-interface-blocks":i.push(`layout(std140) uniform ${J(e.name)} {`);break;case"uniforms":}for(let[n,r]of Object.entries(e.uniformTypes||{})){if(typeof r!="string")throw new Error(`Composite uniform types are not supported by GLSL shader generation: ${e.name}.${n}`);let o=ja(r);switch(t.uniforms){case"scoped-interface-blocks":i.push(` ${o} ${n};`);break;case"unscoped-interface-blocks":i.push(` ${o} ${e.name}_${n};`);break;case"uniforms":i.push(`uniform ${o} ${e.name}_${n};`)}}switch(t.uniforms){case"scoped-interface-blocks":i.push(`} ${e.name};`);break;case"unscoped-interface-blocks":i.push("};");break;case"uniforms":}return i.push(""),i.join(`
129
- `)}function ja(e){return{f32:"float",i32:"int",u32:"uint","vec2<f32>":"vec2","vec3<f32>":"vec3","vec4<f32>":"vec4","vec2<i32>":"ivec2","vec3<i32>":"ivec3","vec4<i32>":"ivec4","vec2<u32>":"uvec2","vec3<u32>":"uvec3","vec4<u32>":"uvec4","mat2x2<f32>":"mat2","mat2x3<f32>":"mat2x3","mat2x4<f32>":"mat2x4","mat3x2<f32>":"mat3x2","mat3x3<f32>":"mat3","mat3x4<f32>":"mat3x4","mat4x2<f32>":"mat4x2","mat4x3<f32>":"mat4x3","mat4x4<f32>":"mat4"}[e]}function nn(e,t){return $a(e,t)}function $a(e,t){let i=[];i.push(`struct ${J(e.name)} {`);for(let[n,r]of Object.entries(e?.uniformTypes||{})){if(typeof r!="string")throw new Error(`Composite uniform types are not supported by WGSL shader generation: ${e.name}.${n}`);let o=r;i.push(` ${n} : ${o};`)}return i.push("};"),i.push(`var<uniform> ${e.name} : ${J(e.name)};`),i.join(`
130
- `)}function rn(e,t){switch(t.shaderLanguage){case"glsl":return tn(e,t);case"wgsl":return nn(e,t)}}var Oc=1/Math.PI*180,Bc=1/180*Math.PI,Ka={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Ka}};var F=globalThis.mathgl.config;function Dt(e,{precision:t=F.precision}={}){return e=Ya(e),`${parseFloat(e.toPrecision(t))}`}function le(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ft(e,t,i){return Xa(e,n=>Math.max(t,Math.min(i,n)))}function We(e,t,i){let n=F.EPSILON;i&&(F.EPSILON=i);try{if(e===t)return!0;if(le(e)&&le(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!We(e[r],t[r]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=F.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{F.EPSILON=n}}function Ya(e){return Math.round(e/F.EPSILON)*F.EPSILON}function Za(e){return e.clone?e.clone():new Array(e.length)}function Xa(e,t,i){if(le(e)){let n=e;i=i||Za(n);for(let r=0;r<i.length&&r<n.length;++r){let o=typeof e=="number"?e:e[r];i[r]=t(o,r,i)}return i}return t(e)}var qe=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,i=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+i];return this.check()}toArray(t=[],i=0){for(let n=0;n<this.ELEMENTS;++n)t[i+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:le(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(F)}formatString(t){let i="";for(let n=0;n<this.ELEMENTS;++n)i+=(n>0?", ":"")+Dt(this[n],t);return`${t.printTypes?this.constructor.name:""}[${i}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(!We(this[i],t[i]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(this[i]!==t[i])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,i,n){if(n===void 0)return this.lerp(this,t,i);for(let r=0;r<this.ELEMENTS;++r){let o=t[r],a=typeof i=="number"?i:i[r];this[r]=o+n*(a-o)}return this.check()}min(t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(t[i],this[i]);return this.check()}max(t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.max(t[i],this[i]);return this.check()}clamp(t,i){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),i[n]);return this.check()}add(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=i[n];return this.check()}subtract(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=i[n];return this.check()}scale(t){if(typeof t=="number")for(let i=0;i<this.ELEMENTS;++i)this[i]*=t;else for(let i=0;i<this.ELEMENTS&&i<t.length;++i)this[i]*=t[i];return this.check()}multiplyByScalar(t){for(let i=0;i<this.ELEMENTS;++i)this[i]*=t;return this.check()}check(){if(F.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let i=0;i<this.ELEMENTS;++i)t=t&&Number.isFinite(this[i]);return t}};function Ja(e,t){if(e.length!==t)return!1;for(let i=0;i<e.length;++i)if(!Number.isFinite(e[i]))return!1;return!0}function on(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function je(e,t,i=""){if(F.debug&&!Ja(e,t))throw new Error(`math.gl: ${i} some fields set to invalid numbers'`);return e}var $e=class extends qe{toString(){let t="[";if(F.printRowMajor){t+="row-major:";for(let i=0;i<this.RANK;++i)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+i]}`}else{t+="column-major:";for(let i=0;i<this.ELEMENTS;++i)t+=` ${this[i]}`}return t+="]",t}getElementIndex(t,i){return i*this.RANK+t}getElement(t,i){return this[i*this.RANK+t]}setElement(t,i,n){return this[i*this.RANK+t]=on(n),this}getColumn(t,i=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let r=0;r<this.RANK;++r)i[r]=this[n+r];return i}setColumn(t,i){let n=t*this.RANK;for(let r=0;r<this.RANK;++r)this[n+r]=i[r];return this}};function an(e,t,i){let n=t[0],r=t[1];return e[0]=i[0]*n+i[4]*r+i[12],e[1]=i[1]*n+i[5]*r+i[13],e}function sn(e,t,i){let n=t[0],r=t[1],o=i[3]*n+i[7]*r||1;return e[0]=(i[0]*n+i[4]*r)/o,e[1]=(i[1]*n+i[5]*r)/o,e}function ln(e,t,i){let n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o||1;return e[0]=(i[0]*n+i[4]*r+i[8]*o)/a,e[1]=(i[1]*n+i[5]*r+i[9]*o)/a,e[2]=(i[2]*n+i[6]*r+i[10]*o)/a,e}function cn(e,t,i){let n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o+i[15];return a=a||1,e[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/a,e[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/a,e[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/a,e}function Qa(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function fn(e,t){if(e===t){let i=t[1],n=t[2],r=t[3],o=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=r,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function un(e,t){let i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],f=t[8],u=t[9],p=t[10],d=t[11],h=t[12],g=t[13],x=t[14],I=t[15],S=i*s-n*a,b=i*l-r*a,_=i*c-o*a,m=n*l-r*s,v=n*c-o*s,A=r*c-o*l,M=f*g-u*h,E=f*x-p*h,L=f*I-d*h,R=u*x-p*g,w=u*I-d*g,y=p*I-d*x,C=S*y-b*w+_*R+m*L-v*E+A*M;return C?(C=1/C,e[0]=(s*y-l*w+c*R)*C,e[1]=(r*w-n*y-o*R)*C,e[2]=(g*A-x*v+I*m)*C,e[3]=(p*v-u*A-d*m)*C,e[4]=(l*L-a*y-c*E)*C,e[5]=(i*y-r*L+o*E)*C,e[6]=(x*_-h*A-I*b)*C,e[7]=(f*A-p*_+d*b)*C,e[8]=(a*w-s*L+c*M)*C,e[9]=(n*L-i*w-o*M)*C,e[10]=(h*v-g*_+I*S)*C,e[11]=(u*_-f*v-d*S)*C,e[12]=(s*E-a*R-l*M)*C,e[13]=(i*R-n*E+r*M)*C,e[14]=(g*b-h*m-x*S)*C,e[15]=(f*m-u*b+p*S)*C,e):null}function pn(e){let t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],f=e[9],u=e[10],p=e[11],d=e[12],h=e[13],g=e[14],x=e[15],I=t*a-i*o,S=t*s-n*o,b=i*s-n*a,_=c*h-f*d,m=c*g-u*d,v=f*g-u*h,A=t*v-i*m+n*_,M=o*v-a*m+s*_,E=c*b-f*S+u*I,L=d*b-h*S+g*I;return l*A-r*M+x*E-p*L}function Bt(e,t,i){let n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],f=t[7],u=t[8],p=t[9],d=t[10],h=t[11],g=t[12],x=t[13],I=t[14],S=t[15],b=i[0],_=i[1],m=i[2],v=i[3];return e[0]=b*n+_*s+m*u+v*g,e[1]=b*r+_*l+m*p+v*x,e[2]=b*o+_*c+m*d+v*I,e[3]=b*a+_*f+m*h+v*S,b=i[4],_=i[5],m=i[6],v=i[7],e[4]=b*n+_*s+m*u+v*g,e[5]=b*r+_*l+m*p+v*x,e[6]=b*o+_*c+m*d+v*I,e[7]=b*a+_*f+m*h+v*S,b=i[8],_=i[9],m=i[10],v=i[11],e[8]=b*n+_*s+m*u+v*g,e[9]=b*r+_*l+m*p+v*x,e[10]=b*o+_*c+m*d+v*I,e[11]=b*a+_*f+m*h+v*S,b=i[12],_=i[13],m=i[14],v=i[15],e[12]=b*n+_*s+m*u+v*g,e[13]=b*r+_*l+m*p+v*x,e[14]=b*o+_*c+m*d+v*I,e[15]=b*a+_*f+m*h+v*S,e}function dn(e,t,i){let n=i[0],r=i[1],o=i[2],a,s,l,c,f,u,p,d,h,g,x,I;return t===e?(e[12]=t[0]*n+t[4]*r+t[8]*o+t[12],e[13]=t[1]*n+t[5]*r+t[9]*o+t[13],e[14]=t[2]*n+t[6]*r+t[10]*o+t[14],e[15]=t[3]*n+t[7]*r+t[11]*o+t[15]):(a=t[0],s=t[1],l=t[2],c=t[3],f=t[4],u=t[5],p=t[6],d=t[7],h=t[8],g=t[9],x=t[10],I=t[11],e[0]=a,e[1]=s,e[2]=l,e[3]=c,e[4]=f,e[5]=u,e[6]=p,e[7]=d,e[8]=h,e[9]=g,e[10]=x,e[11]=I,e[12]=a*n+f*r+h*o+t[12],e[13]=s*n+u*r+g*o+t[13],e[14]=l*n+p*r+x*o+t[14],e[15]=c*n+d*r+I*o+t[15]),e}function gn(e,t,i){let n=i[0],r=i[1],o=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function mn(e,t,i,n){let r=n[0],o=n[1],a=n[2],s=Math.sqrt(r*r+o*o+a*a),l,c,f,u,p,d,h,g,x,I,S,b,_,m,v,A,M,E,L,R,w,y,C,N;return s<1e-6?null:(s=1/s,r*=s,o*=s,a*=s,c=Math.sin(i),l=Math.cos(i),f=1-l,u=t[0],p=t[1],d=t[2],h=t[3],g=t[4],x=t[5],I=t[6],S=t[7],b=t[8],_=t[9],m=t[10],v=t[11],A=r*r*f+l,M=o*r*f+a*c,E=a*r*f-o*c,L=r*o*f-a*c,R=o*o*f+l,w=a*o*f+r*c,y=r*a*f+o*c,C=o*a*f-r*c,N=a*a*f+l,e[0]=u*A+g*M+b*E,e[1]=p*A+x*M+_*E,e[2]=d*A+I*M+m*E,e[3]=h*A+S*M+v*E,e[4]=u*L+g*R+b*w,e[5]=p*L+x*R+_*w,e[6]=d*L+I*R+m*w,e[7]=h*L+S*R+v*w,e[8]=u*y+g*C+b*N,e[9]=p*y+x*C+_*N,e[10]=d*y+I*C+m*N,e[11]=h*y+S*C+v*N,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function hn(e,t,i){let n=Math.sin(i),r=Math.cos(i),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],f=t[9],u=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*r+c*n,e[5]=a*r+f*n,e[6]=s*r+u*n,e[7]=l*r+p*n,e[8]=c*r-o*n,e[9]=f*r-a*n,e[10]=u*r-s*n,e[11]=p*r-l*n,e}function _n(e,t,i){let n=Math.sin(i),r=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],f=t[9],u=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r-c*n,e[1]=a*r-f*n,e[2]=s*r-u*n,e[3]=l*r-p*n,e[8]=o*n+c*r,e[9]=a*n+f*r,e[10]=s*n+u*r,e[11]=l*n+p*r,e}function vn(e,t,i){let n=Math.sin(i),r=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],f=t[5],u=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r+c*n,e[1]=a*r+f*n,e[2]=s*r+u*n,e[3]=l*r+p*n,e[4]=c*r-o*n,e[5]=f*r-a*n,e[6]=u*r-s*n,e[7]=p*r-l*n,e}function bn(e,t){let i=t[0],n=t[1],r=t[2],o=t[3],a=i+i,s=n+n,l=r+r,c=i*a,f=n*a,u=n*s,p=r*a,d=r*s,h=r*l,g=o*a,x=o*s,I=o*l;return e[0]=1-u-h,e[1]=f+I,e[2]=p-x,e[3]=0,e[4]=f-I,e[5]=1-c-h,e[6]=d+g,e[7]=0,e[8]=p+x,e[9]=d-g,e[10]=1-c-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function xn(e,t,i,n,r,o,a){let s=1/(i-t),l=1/(r-n),c=1/(o-a);return e[0]=o*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*l,e[6]=0,e[7]=0,e[8]=(i+t)*s,e[9]=(r+n)*l,e[10]=(a+o)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*o*2*c,e[15]=0,e}function es(e,t,i,n,r){let o=1/Math.tan(t/2);if(e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let a=1/(n-r);e[10]=(r+n)*a,e[14]=2*r*n*a}else e[10]=-1,e[14]=-2*n;return e}var Sn=es;function ts(e,t,i,n,r,o,a){let s=1/(t-i),l=1/(n-r),c=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*s,e[13]=(r+n)*l,e[14]=(a+o)*c,e[15]=1,e}var In=ts;function yn(e,t,i,n){let r,o,a,s,l,c,f,u,p,d,h=t[0],g=t[1],x=t[2],I=n[0],S=n[1],b=n[2],_=i[0],m=i[1],v=i[2];return Math.abs(h-_)<1e-6&&Math.abs(g-m)<1e-6&&Math.abs(x-v)<1e-6?Qa(e):(u=h-_,p=g-m,d=x-v,r=1/Math.sqrt(u*u+p*p+d*d),u*=r,p*=r,d*=r,o=S*d-b*p,a=b*u-I*d,s=I*p-S*u,r=Math.sqrt(o*o+a*a+s*s),r?(r=1/r,o*=r,a*=r,s*=r):(o=0,a=0,s=0),l=p*s-d*a,c=d*o-u*s,f=u*a-p*o,r=Math.sqrt(l*l+c*c+f*f),r?(r=1/r,l*=r,c*=r,f*=r):(l=0,c=0,f=0),e[0]=o,e[1]=l,e[2]=u,e[3]=0,e[4]=a,e[5]=c,e[6]=p,e[7]=0,e[8]=s,e[9]=f,e[10]=d,e[11]=0,e[12]=-(o*h+a*g+s*x),e[13]=-(l*h+c*g+f*x),e[14]=-(u*h+p*g+d*x),e[15]=1,e)}function Cn(e,t,i){let n=t[0],r=t[1],o=t[2],a=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,e[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,e[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,e[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,e}var Gt;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Gt||(Gt={}));var is=45*Math.PI/180,ns=1,Ut=.1,kt=500,rs=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),G=class extends $e{static get IDENTITY(){return as()}static get ZERO(){return os()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Gt}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,i,n,r,o,a,s,l,c,f,u,p,d,h,g,x){return this[0]=t,this[1]=i,this[2]=n,this[3]=r,this[4]=o,this[5]=a,this[6]=s,this[7]=l,this[8]=c,this[9]=f,this[10]=u,this[11]=p,this[12]=d,this[13]=h,this[14]=g,this[15]=x,this.check()}setRowMajor(t,i,n,r,o,a,s,l,c,f,u,p,d,h,g,x){return this[0]=t,this[1]=o,this[2]=c,this[3]=d,this[4]=i,this[5]=a,this[6]=f,this[7]=h,this[8]=n,this[9]=s,this[10]=u,this[11]=g,this[12]=r,this[13]=l,this[14]=p,this[15]=x,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(rs)}fromObject(t){return this.check()}fromQuaternion(t){return bn(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:i,right:n,bottom:r,top:o,near:a=Ut,far:s=kt}=t;return s===1/0?ss(this,i,n,r,o,a):xn(this,i,n,r,o,a,s),this.check()}lookAt(t){let{eye:i,center:n=[0,0,0],up:r=[0,1,0]}=t;return yn(this,i,n,r),this.check()}ortho(t){let{left:i,right:n,bottom:r,top:o,near:a=Ut,far:s=kt}=t;return In(this,i,n,r,o,a,s),this.check()}orthographic(t){let{fovy:i=is,aspect:n=ns,focalDistance:r=1,near:o=Ut,far:a=kt}=t;Ln(i);let s=i/2,l=r*Math.tan(s),c=l*n;return this.ortho({left:-c,right:c,bottom:-l,top:l,near:o,far:a})}perspective(t){let{fovy:i=45*Math.PI/180,aspect:n=1,near:r=.1,far:o=500}=t;return Ln(i),Sn(this,i,n,r,o),this.check()}determinant(){return pn(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,i){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];let n=this.getScale(i),r=1/n[0],o=1/n[1],a=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*o,t[2]=this[2]*a,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*o,t[6]=this[6]*a,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*o,t[10]=this[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,i){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];let n=this.getScale(i),r=1/n[0],o=1/n[1],a=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*o,t[2]=this[2]*a,t[3]=this[4]*r,t[4]=this[5]*o,t[5]=this[6]*a,t[6]=this[8]*r,t[7]=this[9]*o,t[8]=this[10]*a,t}transpose(){return fn(this,this),this.check()}invert(){return un(this,this),this.check()}multiplyLeft(t){return Bt(this,t,this),this.check()}multiplyRight(t){return Bt(this,this,t),this.check()}rotateX(t){return hn(this,this,t),this.check()}rotateY(t){return _n(this,this,t),this.check()}rotateZ(t){return vn(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,i){return mn(this,this,t,i),this.check()}scale(t){return gn(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return dn(this,this,t),this.check()}transform(t,i){return t.length===4?(i=Cn(i||[-0,-0,-0,-0],t,this),je(i,4),i):this.transformAsPoint(t,i)}transformAsPoint(t,i){let{length:n}=t,r;switch(n){case 2:r=an(i||[-0,-0],t,this);break;case 3:r=cn(i||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return je(r,t.length),r}transformAsVector(t,i){let n;switch(t.length){case 2:n=sn(i||[-0,-0],t,this);break;case 3:n=ln(i||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return je(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,i,n){return this.identity().translate([t,i,n])}},Ke,Ye;function os(){return Ke||(Ke=new G([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ke)),Ke}function as(){return Ye||(Ye=new G,Object.freeze(Ye)),Ye}function Ln(e){if(e>Math.PI*2)throw Error("expected radians")}function ss(e,t,i,n,r,o){let a=2*o/(i-t),s=2*o/(r-n),l=(i+t)/(i-t),c=(r+n)/(r-n),f=-1,u=-1,p=-2*o;return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=l,e[9]=c,e[10]=f,e[11]=u,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}var Q=null,An=new ArrayBuffer(4),Mn=new Float32Array(An),Rn=new Uint32Array(An);function En(e){Q||=Tn(),e=Ft(e,-65504,65504),Mn[0]=e;let t=Rn[0],i=t>>23&511;return Q.baseTable[i]+((t&8388607)>>Q.shiftTable[i])}function wn(e){Q||=Tn();let t=e>>10;return Rn[0]=Q.mantissaTable[Q.offsetTable[t]+(e&1023)]+Q.exponentTable[t],Mn[0]}function Tn(){let e=new Uint32Array(512),t=new Uint32Array(512);for(let o=0;o<256;++o){let a=o-127;a<-27?(e[o]=0,e[o|256]=32768,t[o]=24,t[o|256]=24):a<-14?(e[o]=1024>>-a-14,e[o|256]=1024>>-a-14|32768,t[o]=-a-1,t[o|256]=-a-1):a<=15?(e[o]=a+15<<10,e[o|256]=a+15<<10|32768,t[o]=13,t[o|256]=13):a<128?(e[o]=31744,e[o|256]=64512,t[o]=24,t[o|256]=24):(e[o]=31744,e[o|256]=64512,t[o]=13,t[o|256]=13)}let i=new Uint32Array(2048),n=new Uint32Array(64),r=new Uint32Array(64);for(let o=1;o<1024;++o){let a=o<<13,s=0;for(;(a&8388608)===0;)a<<=1,s-=8388608;a&=-8388609,s+=947912704,i[o]=a|s}for(let o=1024;o<2048;++o)i[o]=939524096+(o-1024<<13);for(let o=1;o<31;++o)n[o]=o<<23;n[31]=1199570944,n[32]=2147483648;for(let o=33;o<63;++o)n[o]=2147483648+(o-32<<23);n[63]=3347054592;for(let o=1;o<64;++o)o!==32&&(r[o]=1024);return{baseTable:e,shiftTable:t,mantissaTable:i,exponentTable:n,offsetTable:r}}function ce(e,t=[],i=0){let n=Math.fround(e),r=e-n;return t[i]=n,t[i+1]=r,t}function be(e){return e-Math.fround(e)}function xe(e){let t=new Float32Array(32);for(let i=0;i<4;++i)for(let n=0;n<4;++n){let r=i*4+n;ce(e[n*4+i],t,r*2)}return t}function ee(e,t=!0){return e??t}function te(e=[0,0,0],t=!0){return t?e.map(i=>i/255):[...e]}function Ze(e,t=!0){let i=te(e.slice(0,3),t),n=Number.isFinite(e[3]),r=n?e[3]:1;return[i[0],i[1],i[2],t&&n?r/255:r]}var Pn={width:2,jitter:.7,variation:.35,grain:.45,offset:0,extension:3,sketch:1,minimumAntialias:.7},Nn=`
133
+ }`}function rn(e){switch(e){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:throw new Error(e)}}function on(e){switch(e){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:throw new Error(e)}}function Wa(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${e}`)}}function Ot(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw new Error(`invalid channels: ${t}`)}}function J(e){return typeof e=="string"?e.charAt(0).toUpperCase()+e.slice(1):e}function an(e,t){return qa(e,t)}function qa(e,t){let i=[];switch(t.uniforms){case"scoped-interface-blocks":case"unscoped-interface-blocks":i.push(`layout(std140) uniform ${J(e.name)} {`);break;case"uniforms":}for(let[n,r]of Object.entries(e.uniformTypes||{})){if(typeof r!="string")throw new Error(`Composite uniform types are not supported by GLSL shader generation: ${e.name}.${n}`);let o=ja(r);switch(t.uniforms){case"scoped-interface-blocks":i.push(` ${o} ${n};`);break;case"unscoped-interface-blocks":i.push(` ${o} ${e.name}_${n};`);break;case"uniforms":i.push(`uniform ${o} ${e.name}_${n};`)}}switch(t.uniforms){case"scoped-interface-blocks":i.push(`} ${e.name};`);break;case"unscoped-interface-blocks":i.push("};");break;case"uniforms":}return i.push(""),i.join(`
134
+ `)}function ja(e){return{f32:"float",i32:"int",u32:"uint","vec2<f32>":"vec2","vec3<f32>":"vec3","vec4<f32>":"vec4","vec2<i32>":"ivec2","vec3<i32>":"ivec3","vec4<i32>":"ivec4","vec2<u32>":"uvec2","vec3<u32>":"uvec3","vec4<u32>":"uvec4","mat2x2<f32>":"mat2","mat2x3<f32>":"mat2x3","mat2x4<f32>":"mat2x4","mat3x2<f32>":"mat3x2","mat3x3<f32>":"mat3","mat3x4<f32>":"mat3x4","mat4x2<f32>":"mat4x2","mat4x3<f32>":"mat4x3","mat4x4<f32>":"mat4"}[e]}function sn(e,t){return $a(e,t)}function $a(e,t){let i=[];i.push(`struct ${J(e.name)} {`);for(let[n,r]of Object.entries(e?.uniformTypes||{})){if(typeof r!="string")throw new Error(`Composite uniform types are not supported by WGSL shader generation: ${e.name}.${n}`);let o=r;i.push(` ${n} : ${o};`)}return i.push("};"),i.push(`var<uniform> ${e.name} : ${J(e.name)};`),i.join(`
135
+ `)}function ln(e,t){switch(t.shaderLanguage){case"glsl":return an(e,t);case"wgsl":return sn(e,t)}}var kc=1/Math.PI*180,Gc=1/180*Math.PI,Ka={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Ka}};var F=globalThis.mathgl.config;function Bt(e,{precision:t=F.precision}={}){return e=Ya(e),`${parseFloat(e.toPrecision(t))}`}function le(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ut(e,t,i){return Xa(e,n=>Math.max(t,Math.min(i,n)))}function qe(e,t,i){let n=F.EPSILON;i&&(F.EPSILON=i);try{if(e===t)return!0;if(le(e)&&le(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!qe(e[r],t[r]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=F.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{F.EPSILON=n}}function Ya(e){return Math.round(e/F.EPSILON)*F.EPSILON}function Za(e){return e.clone?e.clone():new Array(e.length)}function Xa(e,t,i){if(le(e)){let n=e;i=i||Za(n);for(let r=0;r<i.length&&r<n.length;++r){let o=typeof e=="number"?e:e[r];i[r]=t(o,r,i)}return i}return t(e)}var je=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,i=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+i];return this.check()}toArray(t=[],i=0){for(let n=0;n<this.ELEMENTS;++n)t[i+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:le(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(F)}formatString(t){let i="";for(let n=0;n<this.ELEMENTS;++n)i+=(n>0?", ":"")+Bt(this[n],t);return`${t.printTypes?this.constructor.name:""}[${i}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(!qe(this[i],t[i]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(this[i]!==t[i])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,i,n){if(n===void 0)return this.lerp(this,t,i);for(let r=0;r<this.ELEMENTS;++r){let o=t[r],a=typeof i=="number"?i:i[r];this[r]=o+n*(a-o)}return this.check()}min(t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(t[i],this[i]);return this.check()}max(t){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.max(t[i],this[i]);return this.check()}clamp(t,i){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),i[n]);return this.check()}add(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=i[n];return this.check()}subtract(...t){for(let i of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=i[n];return this.check()}scale(t){if(typeof t=="number")for(let i=0;i<this.ELEMENTS;++i)this[i]*=t;else for(let i=0;i<this.ELEMENTS&&i<t.length;++i)this[i]*=t[i];return this.check()}multiplyByScalar(t){for(let i=0;i<this.ELEMENTS;++i)this[i]*=t;return this.check()}check(){if(F.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let i=0;i<this.ELEMENTS;++i)t=t&&Number.isFinite(this[i]);return t}};function Ja(e,t){if(e.length!==t)return!1;for(let i=0;i<e.length;++i)if(!Number.isFinite(e[i]))return!1;return!0}function cn(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function $e(e,t,i=""){if(F.debug&&!Ja(e,t))throw new Error(`math.gl: ${i} some fields set to invalid numbers'`);return e}var Ke=class extends je{toString(){let t="[";if(F.printRowMajor){t+="row-major:";for(let i=0;i<this.RANK;++i)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+i]}`}else{t+="column-major:";for(let i=0;i<this.ELEMENTS;++i)t+=` ${this[i]}`}return t+="]",t}getElementIndex(t,i){return i*this.RANK+t}getElement(t,i){return this[i*this.RANK+t]}setElement(t,i,n){return this[i*this.RANK+t]=cn(n),this}getColumn(t,i=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let r=0;r<this.RANK;++r)i[r]=this[n+r];return i}setColumn(t,i){let n=t*this.RANK;for(let r=0;r<this.RANK;++r)this[n+r]=i[r];return this}};function fn(e,t,i){let n=t[0],r=t[1];return e[0]=i[0]*n+i[4]*r+i[12],e[1]=i[1]*n+i[5]*r+i[13],e}function un(e,t,i){let n=t[0],r=t[1],o=i[3]*n+i[7]*r||1;return e[0]=(i[0]*n+i[4]*r)/o,e[1]=(i[1]*n+i[5]*r)/o,e}function pn(e,t,i){let n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o||1;return e[0]=(i[0]*n+i[4]*r+i[8]*o)/a,e[1]=(i[1]*n+i[5]*r+i[9]*o)/a,e[2]=(i[2]*n+i[6]*r+i[10]*o)/a,e}function dn(e,t,i){let n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o+i[15];return a=a||1,e[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/a,e[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/a,e[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/a,e}function Qa(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function gn(e,t){if(e===t){let i=t[1],n=t[2],r=t[3],o=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=r,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function mn(e,t){let i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],f=t[8],u=t[9],p=t[10],d=t[11],v=t[12],m=t[13],x=t[14],I=t[15],S=i*s-n*a,b=i*l-r*a,h=i*c-o*a,g=n*l-r*s,_=n*c-o*s,M=r*c-o*l,A=f*m-u*v,R=f*x-p*v,L=f*I-d*v,E=u*x-p*m,w=u*I-d*m,y=p*I-d*x,C=S*y-b*w+h*E+g*L-_*R+M*A;return C?(C=1/C,e[0]=(s*y-l*w+c*E)*C,e[1]=(r*w-n*y-o*E)*C,e[2]=(m*M-x*_+I*g)*C,e[3]=(p*_-u*M-d*g)*C,e[4]=(l*L-a*y-c*R)*C,e[5]=(i*y-r*L+o*R)*C,e[6]=(x*h-v*M-I*b)*C,e[7]=(f*M-p*h+d*b)*C,e[8]=(a*w-s*L+c*A)*C,e[9]=(n*L-i*w-o*A)*C,e[10]=(v*_-m*h+I*S)*C,e[11]=(u*h-f*_-d*S)*C,e[12]=(s*R-a*E-l*A)*C,e[13]=(i*E-n*R+r*A)*C,e[14]=(m*b-v*g-x*S)*C,e[15]=(f*g-u*b+p*S)*C,e):null}function hn(e){let t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],f=e[9],u=e[10],p=e[11],d=e[12],v=e[13],m=e[14],x=e[15],I=t*a-i*o,S=t*s-n*o,b=i*s-n*a,h=c*v-f*d,g=c*m-u*d,_=f*m-u*v,M=t*_-i*g+n*h,A=o*_-a*g+s*h,R=c*b-f*S+u*I,L=d*b-v*S+m*I;return l*M-r*A+x*R-p*L}function Gt(e,t,i){let n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],f=t[7],u=t[8],p=t[9],d=t[10],v=t[11],m=t[12],x=t[13],I=t[14],S=t[15],b=i[0],h=i[1],g=i[2],_=i[3];return e[0]=b*n+h*s+g*u+_*m,e[1]=b*r+h*l+g*p+_*x,e[2]=b*o+h*c+g*d+_*I,e[3]=b*a+h*f+g*v+_*S,b=i[4],h=i[5],g=i[6],_=i[7],e[4]=b*n+h*s+g*u+_*m,e[5]=b*r+h*l+g*p+_*x,e[6]=b*o+h*c+g*d+_*I,e[7]=b*a+h*f+g*v+_*S,b=i[8],h=i[9],g=i[10],_=i[11],e[8]=b*n+h*s+g*u+_*m,e[9]=b*r+h*l+g*p+_*x,e[10]=b*o+h*c+g*d+_*I,e[11]=b*a+h*f+g*v+_*S,b=i[12],h=i[13],g=i[14],_=i[15],e[12]=b*n+h*s+g*u+_*m,e[13]=b*r+h*l+g*p+_*x,e[14]=b*o+h*c+g*d+_*I,e[15]=b*a+h*f+g*v+_*S,e}function _n(e,t,i){let n=i[0],r=i[1],o=i[2],a,s,l,c,f,u,p,d,v,m,x,I;return t===e?(e[12]=t[0]*n+t[4]*r+t[8]*o+t[12],e[13]=t[1]*n+t[5]*r+t[9]*o+t[13],e[14]=t[2]*n+t[6]*r+t[10]*o+t[14],e[15]=t[3]*n+t[7]*r+t[11]*o+t[15]):(a=t[0],s=t[1],l=t[2],c=t[3],f=t[4],u=t[5],p=t[6],d=t[7],v=t[8],m=t[9],x=t[10],I=t[11],e[0]=a,e[1]=s,e[2]=l,e[3]=c,e[4]=f,e[5]=u,e[6]=p,e[7]=d,e[8]=v,e[9]=m,e[10]=x,e[11]=I,e[12]=a*n+f*r+v*o+t[12],e[13]=s*n+u*r+m*o+t[13],e[14]=l*n+p*r+x*o+t[14],e[15]=c*n+d*r+I*o+t[15]),e}function vn(e,t,i){let n=i[0],r=i[1],o=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function bn(e,t,i,n){let r=n[0],o=n[1],a=n[2],s=Math.sqrt(r*r+o*o+a*a),l,c,f,u,p,d,v,m,x,I,S,b,h,g,_,M,A,R,L,E,w,y,C,N;return s<1e-6?null:(s=1/s,r*=s,o*=s,a*=s,c=Math.sin(i),l=Math.cos(i),f=1-l,u=t[0],p=t[1],d=t[2],v=t[3],m=t[4],x=t[5],I=t[6],S=t[7],b=t[8],h=t[9],g=t[10],_=t[11],M=r*r*f+l,A=o*r*f+a*c,R=a*r*f-o*c,L=r*o*f-a*c,E=o*o*f+l,w=a*o*f+r*c,y=r*a*f+o*c,C=o*a*f-r*c,N=a*a*f+l,e[0]=u*M+m*A+b*R,e[1]=p*M+x*A+h*R,e[2]=d*M+I*A+g*R,e[3]=v*M+S*A+_*R,e[4]=u*L+m*E+b*w,e[5]=p*L+x*E+h*w,e[6]=d*L+I*E+g*w,e[7]=v*L+S*E+_*w,e[8]=u*y+m*C+b*N,e[9]=p*y+x*C+h*N,e[10]=d*y+I*C+g*N,e[11]=v*y+S*C+_*N,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function xn(e,t,i){let n=Math.sin(i),r=Math.cos(i),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],f=t[9],u=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*r+c*n,e[5]=a*r+f*n,e[6]=s*r+u*n,e[7]=l*r+p*n,e[8]=c*r-o*n,e[9]=f*r-a*n,e[10]=u*r-s*n,e[11]=p*r-l*n,e}function Sn(e,t,i){let n=Math.sin(i),r=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],f=t[9],u=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r-c*n,e[1]=a*r-f*n,e[2]=s*r-u*n,e[3]=l*r-p*n,e[8]=o*n+c*r,e[9]=a*n+f*r,e[10]=s*n+u*r,e[11]=l*n+p*r,e}function In(e,t,i){let n=Math.sin(i),r=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],f=t[5],u=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r+c*n,e[1]=a*r+f*n,e[2]=s*r+u*n,e[3]=l*r+p*n,e[4]=c*r-o*n,e[5]=f*r-a*n,e[6]=u*r-s*n,e[7]=p*r-l*n,e}function yn(e,t){let i=t[0],n=t[1],r=t[2],o=t[3],a=i+i,s=n+n,l=r+r,c=i*a,f=n*a,u=n*s,p=r*a,d=r*s,v=r*l,m=o*a,x=o*s,I=o*l;return e[0]=1-u-v,e[1]=f+I,e[2]=p-x,e[3]=0,e[4]=f-I,e[5]=1-c-v,e[6]=d+m,e[7]=0,e[8]=p+x,e[9]=d-m,e[10]=1-c-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Cn(e,t,i,n,r,o,a){let s=1/(i-t),l=1/(r-n),c=1/(o-a);return e[0]=o*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*l,e[6]=0,e[7]=0,e[8]=(i+t)*s,e[9]=(r+n)*l,e[10]=(a+o)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*o*2*c,e[15]=0,e}function es(e,t,i,n,r){let o=1/Math.tan(t/2);if(e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let a=1/(n-r);e[10]=(r+n)*a,e[14]=2*r*n*a}else e[10]=-1,e[14]=-2*n;return e}var Ln=es;function ts(e,t,i,n,r,o,a){let s=1/(t-i),l=1/(n-r),c=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*s,e[13]=(r+n)*l,e[14]=(a+o)*c,e[15]=1,e}var An=ts;function Mn(e,t,i,n){let r,o,a,s,l,c,f,u,p,d,v=t[0],m=t[1],x=t[2],I=n[0],S=n[1],b=n[2],h=i[0],g=i[1],_=i[2];return Math.abs(v-h)<1e-6&&Math.abs(m-g)<1e-6&&Math.abs(x-_)<1e-6?Qa(e):(u=v-h,p=m-g,d=x-_,r=1/Math.sqrt(u*u+p*p+d*d),u*=r,p*=r,d*=r,o=S*d-b*p,a=b*u-I*d,s=I*p-S*u,r=Math.sqrt(o*o+a*a+s*s),r?(r=1/r,o*=r,a*=r,s*=r):(o=0,a=0,s=0),l=p*s-d*a,c=d*o-u*s,f=u*a-p*o,r=Math.sqrt(l*l+c*c+f*f),r?(r=1/r,l*=r,c*=r,f*=r):(l=0,c=0,f=0),e[0]=o,e[1]=l,e[2]=u,e[3]=0,e[4]=a,e[5]=c,e[6]=p,e[7]=0,e[8]=s,e[9]=f,e[10]=d,e[11]=0,e[12]=-(o*v+a*m+s*x),e[13]=-(l*v+c*m+f*x),e[14]=-(u*v+p*m+d*x),e[15]=1,e)}function Rn(e,t,i){let n=t[0],r=t[1],o=t[2],a=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,e[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,e[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,e[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,e}var Ht;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Ht||(Ht={}));var is=45*Math.PI/180,ns=1,zt=.1,Vt=500,rs=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),G=class extends Ke{static get IDENTITY(){return as()}static get ZERO(){return os()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Ht}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,i,n,r,o,a,s,l,c,f,u,p,d,v,m,x){return this[0]=t,this[1]=i,this[2]=n,this[3]=r,this[4]=o,this[5]=a,this[6]=s,this[7]=l,this[8]=c,this[9]=f,this[10]=u,this[11]=p,this[12]=d,this[13]=v,this[14]=m,this[15]=x,this.check()}setRowMajor(t,i,n,r,o,a,s,l,c,f,u,p,d,v,m,x){return this[0]=t,this[1]=o,this[2]=c,this[3]=d,this[4]=i,this[5]=a,this[6]=f,this[7]=v,this[8]=n,this[9]=s,this[10]=u,this[11]=m,this[12]=r,this[13]=l,this[14]=p,this[15]=x,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(rs)}fromObject(t){return this.check()}fromQuaternion(t){return yn(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:i,right:n,bottom:r,top:o,near:a=zt,far:s=Vt}=t;return s===1/0?ss(this,i,n,r,o,a):Cn(this,i,n,r,o,a,s),this.check()}lookAt(t){let{eye:i,center:n=[0,0,0],up:r=[0,1,0]}=t;return Mn(this,i,n,r),this.check()}ortho(t){let{left:i,right:n,bottom:r,top:o,near:a=zt,far:s=Vt}=t;return An(this,i,n,r,o,a,s),this.check()}orthographic(t){let{fovy:i=is,aspect:n=ns,focalDistance:r=1,near:o=zt,far:a=Vt}=t;En(i);let s=i/2,l=r*Math.tan(s),c=l*n;return this.ortho({left:-c,right:c,bottom:-l,top:l,near:o,far:a})}perspective(t){let{fovy:i=45*Math.PI/180,aspect:n=1,near:r=.1,far:o=500}=t;return En(i),Ln(this,i,n,r,o),this.check()}determinant(){return hn(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,i){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];let n=this.getScale(i),r=1/n[0],o=1/n[1],a=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*o,t[2]=this[2]*a,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*o,t[6]=this[6]*a,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*o,t[10]=this[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,i){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];let n=this.getScale(i),r=1/n[0],o=1/n[1],a=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*o,t[2]=this[2]*a,t[3]=this[4]*r,t[4]=this[5]*o,t[5]=this[6]*a,t[6]=this[8]*r,t[7]=this[9]*o,t[8]=this[10]*a,t}transpose(){return gn(this,this),this.check()}invert(){return mn(this,this),this.check()}multiplyLeft(t){return Gt(this,t,this),this.check()}multiplyRight(t){return Gt(this,this,t),this.check()}rotateX(t){return xn(this,this,t),this.check()}rotateY(t){return Sn(this,this,t),this.check()}rotateZ(t){return In(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,i){return bn(this,this,t,i),this.check()}scale(t){return vn(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return _n(this,this,t),this.check()}transform(t,i){return t.length===4?(i=Rn(i||[-0,-0,-0,-0],t,this),$e(i,4),i):this.transformAsPoint(t,i)}transformAsPoint(t,i){let{length:n}=t,r;switch(n){case 2:r=fn(i||[-0,-0],t,this);break;case 3:r=dn(i||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return $e(r,t.length),r}transformAsVector(t,i){let n;switch(t.length){case 2:n=un(i||[-0,-0],t,this);break;case 3:n=pn(i||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return $e(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,i,n){return this.identity().translate([t,i,n])}},Ye,Ze;function os(){return Ye||(Ye=new G([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ye)),Ye}function as(){return Ze||(Ze=new G,Object.freeze(Ze)),Ze}function En(e){if(e>Math.PI*2)throw Error("expected radians")}function ss(e,t,i,n,r,o){let a=2*o/(i-t),s=2*o/(r-n),l=(i+t)/(i-t),c=(r+n)/(r-n),f=-1,u=-1,p=-2*o;return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=l,e[9]=c,e[10]=f,e[11]=u,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}var Q=null,wn=new ArrayBuffer(4),Tn=new Float32Array(wn),Pn=new Uint32Array(wn);function Nn(e){Q||=Fn(),e=Ut(e,-65504,65504),Tn[0]=e;let t=Pn[0],i=t>>23&511;return Q.baseTable[i]+((t&8388607)>>Q.shiftTable[i])}function Dn(e){Q||=Fn();let t=e>>10;return Pn[0]=Q.mantissaTable[Q.offsetTable[t]+(e&1023)]+Q.exponentTable[t],Tn[0]}function Fn(){let e=new Uint32Array(512),t=new Uint32Array(512);for(let o=0;o<256;++o){let a=o-127;a<-27?(e[o]=0,e[o|256]=32768,t[o]=24,t[o|256]=24):a<-14?(e[o]=1024>>-a-14,e[o|256]=1024>>-a-14|32768,t[o]=-a-1,t[o|256]=-a-1):a<=15?(e[o]=a+15<<10,e[o|256]=a+15<<10|32768,t[o]=13,t[o|256]=13):a<128?(e[o]=31744,e[o|256]=64512,t[o]=24,t[o|256]=24):(e[o]=31744,e[o|256]=64512,t[o]=13,t[o|256]=13)}let i=new Uint32Array(2048),n=new Uint32Array(64),r=new Uint32Array(64);for(let o=1;o<1024;++o){let a=o<<13,s=0;for(;(a&8388608)===0;)a<<=1,s-=8388608;a&=-8388609,s+=947912704,i[o]=a|s}for(let o=1024;o<2048;++o)i[o]=939524096+(o-1024<<13);for(let o=1;o<31;++o)n[o]=o<<23;n[31]=1199570944,n[32]=2147483648;for(let o=33;o<63;++o)n[o]=2147483648+(o-32<<23);n[63]=3347054592;for(let o=1;o<64;++o)o!==32&&(r[o]=1024);return{baseTable:e,shiftTable:t,mantissaTable:i,exponentTable:n,offsetTable:r}}function ce(e,t=[],i=0){let n=Math.fround(e),r=e-n;return t[i]=n,t[i+1]=r,t}function be(e){return e-Math.fround(e)}function xe(e){let t=new Float32Array(32);for(let i=0;i<4;++i)for(let n=0;n<4;++n){let r=i*4+n;ce(e[n*4+i],t,r*2)}return t}function ee(e,t=!0){return e??t}function te(e=[0,0,0],t=!0){return t?e.map(i=>i/255):[...e]}function Xe(e,t=!0){let i=te(e.slice(0,3),t),n=Number.isFinite(e[3]),r=n?e[3]:1;return[i[0],i[1],i[2],t&&n?r/255:r]}var On={width:2,jitter:.7,variation:.35,grain:.45,offset:0,extension:3,sketch:1,minimumAntialias:.7},Bn=`
131
136
  layout(std140) uniform sketchStrokeUniforms {
132
137
  float width;
133
138
  float jitter;
@@ -225,7 +230,7 @@ fn sketchStroke_getCoverage(coordinates: vec2<f32>, strokeLength: f32, seed: f32
225
230
  // Keep the pigment opaque; grain changes the stroke edge so the paper does not show through as white flecks.
226
231
  return coverage;
227
232
  }
228
- `,Dn={name:"sketchStroke",bindingLayout:[{name:"sketchStroke",group:3}],source:cs,vs:Nn,fs:Nn+ls,uniformTypes:{width:"f32",jitter:"f32",variation:"f32",grain:"f32",offset:"f32",extension:"f32",sketch:"f32",minimumAntialias:"f32"},defaultUniforms:Pn,getUniforms(e={}){return{...Pn,...e}}};var zt={dashLength:12,gapLength:8,offset:0},Fn={name:"pathDash",bindingLayout:[{name:"pathDash",group:3}],firstBindingSlot:0,uniformTypes:{dashLength:"f32",gapLength:"f32",offset:"f32"},defaultUniforms:zt,getUniforms(e={},t=zt){let i={...zt,...t};return e.dashLength!==void 0&&(i.dashLength=Math.max(0,e.dashLength)),e.gapLength!==void 0&&(i.gapLength=Math.max(0,e.gapLength)),e.offset!==void 0&&(i.offset=e.offset),i},fs:`
233
+ `,Un={name:"sketchStroke",bindingLayout:[{name:"sketchStroke",group:3}],source:cs,vs:Bn,fs:Bn+ls,uniformTypes:{width:"f32",jitter:"f32",variation:"f32",grain:"f32",offset:"f32",extension:"f32",sketch:"f32",minimumAntialias:"f32"},defaultUniforms:On,getUniforms(e={}){return{...On,...e}}};var Wt={dashLength:12,gapLength:8,offset:0},kn={name:"pathDash",bindingLayout:[{name:"pathDash",group:3}],firstBindingSlot:0,uniformTypes:{dashLength:"f32",gapLength:"f32",offset:"f32"},defaultUniforms:Wt,getUniforms(e={},t=Wt){let i={...Wt,...t};return e.dashLength!==void 0&&(i.dashLength=Math.max(0,e.dashLength)),e.gapLength!==void 0&&(i.gapLength=Math.max(0,e.gapLength)),e.offset!==void 0&&(i.offset=e.offset),i},fs:`
229
234
  layout(std140) uniform pathDashUniforms {
230
235
  float dashLength;
231
236
  float gapLength;
@@ -273,7 +278,7 @@ fn pathDash_getCoverage(distanceAlongPath: f32) -> f32 {
273
278
  /* use the fragment position for a different seed per-pixel */
274
279
  return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
275
280
  }
276
- `,On={name:"random",source:fs,fs:us};var ps=`fn volumeRaymarch_intersectBox(origin: vec3f, direction: vec3f, minimum: vec3f, maximum: vec3f) -> vec2f {
281
+ `,Gn={name:"random",source:fs,fs:us};var ps=`fn volumeRaymarch_intersectBox(origin: vec3f, direction: vec3f, minimum: vec3f, maximum: vec3f) -> vec2f {
277
282
  let safeDirection = select(vec3f(0.000001), direction, abs(direction) > vec3f(0.000001));
278
283
  let first = (minimum - origin) / safeDirection;
279
284
  let second = (maximum - origin) / safeDirection;
@@ -346,7 +351,7 @@ fn volumeRaymarch_composite(accumulated: vec4f, color: vec3f, alpha: f32) -> vec
346
351
  let contribution = (1.0 - accumulated.a) * clamp(alpha, 0.0, 1.0);
347
352
  return vec4f(accumulated.rgb + color * contribution, accumulated.a + contribution);
348
353
  }
349
- `,Bn={name:"volumeRaymarch",source:ps};var ds=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
354
+ `,zn={name:"volumeRaymarch",source:ps};var ds=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
350
355
 
351
356
  // All these functions are for substituting tan() function from Intel GPU only
352
357
  const float TWO_PI = 6.2831854820251465;
@@ -617,7 +622,7 @@ fn tan_fp32(a: f32) -> f32 {
617
622
  return tan(a);
618
623
  }
619
624
  #endif
620
- `,Un={name:"fp32",source:gs,vs:ds};var Vt=`
625
+ `,Vn={name:"fp32",source:gs,vs:ds};var qt=`
621
626
  layout(std140) uniform fp64arithmeticUniforms {
622
627
  uniform float ONE;
623
628
  uniform float SPLIT;
@@ -816,7 +821,7 @@ vec2 sqrt_fp64(vec2 a) {
816
821
  return sum_fp64(vec2(yn, 0.0), prod);
817
822
  #endif
818
823
  }
819
- `;var Ht=`struct Fp64F32Bits {
824
+ `;var jt=`struct Fp64F32Bits {
820
825
  sign: u32,
821
826
  baseExponent: i32,
822
827
  significand: u32,
@@ -1095,7 +1100,7 @@ fn fp64_divide_f32_integer(aValue: f32, bValue: f32) -> f32 {
1095
1100
  }
1096
1101
  #endif
1097
1102
 
1098
- `,kn=`${Ht}
1103
+ `,Hn=`${jt}
1099
1104
 
1100
1105
  #ifndef LUMA_FP64_PREDICATE_ONLY
1101
1106
  fn split(a: f32) -> vec2f {
@@ -1363,7 +1368,7 @@ fn sqrt_fp64(a: vec2f) -> vec2f {
1363
1368
  return fp64_scale_fp64_integer(normalizedRoot, evenExponent / 2);
1364
1369
  }
1365
1370
  #endif
1366
- `;var Gn=`${Ht}
1371
+ `;var Wn=`${jt}
1367
1372
 
1368
1373
  #ifndef LUMA_FP64_PREDICATE_ONLY
1369
1374
  fn split(a: f32) -> vec2f {
@@ -1476,7 +1481,7 @@ fn sqrt_fp64(a: vec2f) -> vec2f {
1476
1481
  return sum_fp64(vec2f(estimate, 0.0), correction);
1477
1482
  }
1478
1483
  #endif
1479
- `;var zn=`struct Fp64ArithmeticUniforms {
1484
+ `;var qn=`struct Fp64ArithmeticUniforms {
1480
1485
  ONE: f32,
1481
1486
  SPLIT: f32,
1482
1487
  };
@@ -2109,10 +2114,10 @@ fn prevent_fp64_optimization(value: f32) -> f32 {
2109
2114
  #endif
2110
2115
 
2111
2116
  #ifdef LUMA_FP64_INTEGER_ARITHMETIC
2112
- ${kn}
2117
+ ${Hn}
2113
2118
  #else
2114
2119
  #ifdef LUMA_FP64_HYBRID_ARITHMETIC
2115
- ${Gn}
2120
+ ${Wn}
2116
2121
  #else
2117
2122
  fn split(a: f32) -> vec2f {
2118
2123
  let splitValue = prevent_fp64_optimization(fp64arithmetic.SPLIT + fp64_runtime_zero());
@@ -2390,7 +2395,7 @@ fn fp64_scale_fp64(value: vec2f, exponent: i32) -> vec2f {
2390
2395
  #endif
2391
2396
  }
2392
2397
  #endif
2393
- `;var Vn=`const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);
2398
+ `;var jn=`const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);
2394
2399
  const vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09);
2395
2400
  const vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8);
2396
2401
  const vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7);
@@ -3059,7 +3064,7 @@ void mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {
3059
3064
  vec4_dot_fp64(a, tmp, out_val[i]);
3060
3065
  }
3061
3066
  }
3062
- `;var Hn=`const E_FP64 = vec2f(2.7182817459106445, 8.254840366817007e-8);
3067
+ `;var $n=`const E_FP64 = vec2f(2.7182817459106445, 8.254840366817007e-8);
3063
3068
  const LOG2_FP64 = vec2f(0.6931471824645996, -1.9046542121259336e-9);
3064
3069
  const PI_FP64 = vec2f(3.1415927410125732, -8.742278012618954e-8);
3065
3070
  const TWO_PI_FP64 = vec2f(6.2831854820251465, -1.7484556025237907e-7);
@@ -3209,7 +3214,7 @@ fn mat4_vec4_mul_fp64(matrix: array<vec2f, 16>, a: array<vec2f, 4>) -> array<vec
3209
3214
  }
3210
3215
  return result;
3211
3216
  }
3212
- `;var ms={ONE:1,SPLIT:4097},Wt={name:"fp64arithmetic",source:zn,fs:Vt,vs:Vt,defaultUniforms:ms,uniformTypes:{ONE:"f32",SPLIT:"f32"},fp64ify:ce,fp64LowPart:be,fp64ifyMatrix4:xe},Wn={name:"fp64",source:Hn,vs:Vn,dependencies:[Wt],fp64ify:ce,fp64LowPart:be,fp64ifyMatrix4:xe};var qn=`const DGGS_H3_CELL_MODE: u32 = 1u;
3217
+ `;var ms={ONE:1,SPLIT:4097},$t={name:"fp64arithmetic",source:qn,fs:qt,vs:qt,defaultUniforms:ms,uniformTypes:{ONE:"f32",SPLIT:"f32"},fp64ify:ce,fp64LowPart:be,fp64ifyMatrix4:xe},Kn={name:"fp64",source:$n,vs:jn,dependencies:[$t],fp64ify:ce,fp64LowPart:be,fp64ifyMatrix4:xe};var Yn=`const DGGS_H3_CELL_MODE: u32 = 1u;
3213
3218
  const DGGS_H3_MAX_RESOLUTION: u32 = 15u;
3214
3219
  const DGGS_H3_MAX_BASE_CELL: u32 = 121u;
3215
3220
  const DGGS_H3_UNUSED_DIGIT: u32 = 7u;
@@ -5483,7 +5488,7 @@ fn dggs_s2_get_boundary_point(index: vec2u, vertexIndex: u32) -> vec2f {
5483
5488
  fn dggs_s2_get_boundary_point_fp64_split(index: vec2u, vertexIndex: u32) -> vec4f {
5484
5489
  return dggs_boundary_point_to_fp64_split(dggs_s2_get_boundary_point(index, vertexIndex));
5485
5490
  }
5486
- `;var jn={name:"dggs",source:qn};var U={RGBA8UNORM:0,RGBA16FLOAT:1,RGBA32FLOAT:2},Xe={rgba8unorm:4,rgba16float:8,rgba32float:16},Je={...Xe},qt={rgba8unorm:U.RGBA8UNORM,rgba16float:U.RGBA16FLOAT,rgba32float:U.RGBA32FLOAT},Zn={[U.RGBA8UNORM]:"rgba8unorm",[U.RGBA16FLOAT]:"rgba16float",[U.RGBA32FLOAT]:"rgba32float"},Xn={useByteColors:"f32"},Jn={useByteColors:!0},hs={format:"u32",wordStride:"u32",wordOffset:"u32",_padding:"u32"},_s={format:U.RGBA8UNORM,wordStride:Je.rgba8unorm/Uint32Array.BYTES_PER_ELEMENT,wordOffset:0,_padding:0},$n=Qn("colors"),Kn=Qn("floatColors"),vs=er("colors"),bs=er("floatColors"),xs=`struct storageColorsUniforms {
5491
+ `;var Zn={name:"dggs",source:Yn};var U={RGBA8UNORM:0,RGBA16FLOAT:1,RGBA32FLOAT:2},Je={rgba8unorm:4,rgba16float:8,rgba32float:16},Qe={...Je},Kt={rgba8unorm:U.RGBA8UNORM,rgba16float:U.RGBA16FLOAT,rgba32float:U.RGBA32FLOAT},er={[U.RGBA8UNORM]:"rgba8unorm",[U.RGBA16FLOAT]:"rgba16float",[U.RGBA32FLOAT]:"rgba32float"},tr={useByteColors:"f32"},ir={useByteColors:!0},hs={format:"u32",wordStride:"u32",wordOffset:"u32",_padding:"u32"},_s={format:U.RGBA8UNORM,wordStride:Qe.rgba8unorm/Uint32Array.BYTES_PER_ELEMENT,wordOffset:0,_padding:0},Xn=nr("colors"),Jn=nr("floatColors"),vs=rr("colors"),bs=rr("floatColors"),xs=`struct storageColorsUniforms {
5487
5492
  format: u32,
5488
5493
  wordStride: u32,
5489
5494
  wordOffset: u32,
@@ -5529,7 +5534,7 @@ fn storageColors_readColor(rowIndex: u32) -> vec4<f32> {
5529
5534
  }
5530
5535
  return storageColors_readRgba32FloatColor(wordIndex);
5531
5536
  }
5532
- `;function Qn(e){return`layout(std140) uniform ${e}Uniforms {
5537
+ `;function nr(e){return`layout(std140) uniform ${e}Uniforms {
5533
5538
  float useByteColors;
5534
5539
  } ${e};
5535
5540
 
@@ -5556,7 +5561,7 @@ vec4 ${e}_premultiply_alpha(vec4 inputColor) {
5556
5561
  vec4 ${e}_unpremultiply_alpha(vec4 inputColor) {
5557
5562
  return ${e}_unpremultiplyAlpha(inputColor);
5558
5563
  }
5559
- `}function er(e){return`struct ${e}Uniforms {
5564
+ `}function rr(e){return`struct ${e}Uniforms {
5560
5565
  useByteColors: f32
5561
5566
  };
5562
5567
 
@@ -5589,7 +5594,7 @@ fn ${e}_premultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> {
5589
5594
  fn ${e}_unpremultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> {
5590
5595
  return ${e}_unpremultiplyAlpha(inputColor);
5591
5596
  }
5592
- `}function Ss(e={}){let t=Is(e.format),i=Zn[t],n=e.byteStride??Je[i],r=e.byteOffset??0,o=Xe[i];if(Yn("byteStride",n),Yn("byteOffset",r),n<o)throw new Error(`storageColors byteStride must be at least ${o} for ${i}`);return{format:t,wordStride:n/Uint32Array.BYTES_PER_ELEMENT,wordOffset:r/Uint32Array.BYTES_PER_ELEMENT,_padding:0}}function Is(e="rgba8unorm"){if(typeof e=="number"){if(e in Zn)return e}else if(e in qt)return qt[e];throw new Error(`storageColors format must be one of ${Object.keys(qt).join(", ")}`)}function Yn(e,t){if(!Number.isInteger(t)||t<0||t%Uint32Array.BYTES_PER_ELEMENT!==0)throw new Error(`storageColors ${e} must be a non-negative 4-byte aligned integer`)}var tr={name:"colors",props:{},uniforms:{},vs:$n,fs:$n,source:vs,uniformTypes:Xn,defaultUniforms:Jn},fe={name:"floatColors",props:{},uniforms:{},vs:Kn,fs:Kn,source:bs,uniformTypes:Xn,defaultUniforms:Jn},ir={name:"storageColors",props:{},uniforms:{},bindings:{},source:xs,uniformTypes:hs,defaultUniforms:_s,bindingLayout:[{name:"storageColors",group:0},{name:"storageColorsBuffer",group:0}],getUniforms(e={}){return{...Ss(e),...e.colorBuffer?{storageColorsBuffer:e.colorBuffer}:{}}}};var ys=[0,1,1,1],Cs=`layout(std140) uniform pickingUniforms {
5597
+ `}function Ss(e={}){let t=Is(e.format),i=er[t],n=e.byteStride??Qe[i],r=e.byteOffset??0,o=Je[i];if(Qn("byteStride",n),Qn("byteOffset",r),n<o)throw new Error(`storageColors byteStride must be at least ${o} for ${i}`);return{format:t,wordStride:n/Uint32Array.BYTES_PER_ELEMENT,wordOffset:r/Uint32Array.BYTES_PER_ELEMENT,_padding:0}}function Is(e="rgba8unorm"){if(typeof e=="number"){if(e in er)return e}else if(e in Kt)return Kt[e];throw new Error(`storageColors format must be one of ${Object.keys(Kt).join(", ")}`)}function Qn(e,t){if(!Number.isInteger(t)||t<0||t%Uint32Array.BYTES_PER_ELEMENT!==0)throw new Error(`storageColors ${e} must be a non-negative 4-byte aligned integer`)}var or={name:"colors",props:{},uniforms:{},vs:Xn,fs:Xn,source:vs,uniformTypes:tr,defaultUniforms:ir},fe={name:"floatColors",props:{},uniforms:{},vs:Jn,fs:Jn,source:bs,uniformTypes:tr,defaultUniforms:ir},ar={name:"storageColors",props:{},uniforms:{},bindings:{},source:xs,uniformTypes:hs,defaultUniforms:_s,bindingLayout:[{name:"storageColors",group:0},{name:"storageColorsBuffer",group:0}],getUniforms(e={}){return{...Ss(e),...e.colorBuffer?{storageColorsBuffer:e.colorBuffer}:{}}}};var ys=[0,1,1,1],Cs=`layout(std140) uniform pickingUniforms {
5593
5598
  float isActive;
5594
5599
  float isAttribute;
5595
5600
  float isHighlightActive;
@@ -5716,7 +5721,7 @@ vec4 picking_filterColor(vec4 color) {
5716
5721
  vec4 highlightColor = picking_filterHighlightColor(color);
5717
5722
  return picking_filterPickingColor(highlightColor);
5718
5723
  }
5719
- `,nr={props:{},uniforms:{},name:"picking",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useByteColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useByteColors:!0,highlightedObjectColor:[0,0,0],highlightColor:ys},vs:Cs,fs:Ls,getUniforms:As};function As(e={},t){let i={},n=ee(e.useByteColors,!0);if(e.highlightedObjectColor!==void 0)if(e.highlightedObjectColor===null)i.isHighlightActive=!1;else{i.isHighlightActive=!0;let r=e.highlightedObjectColor.slice(0,3);i.highlightedObjectColor=r}return e.highlightColor&&(i.highlightColor=Ze(e.highlightColor,n)),e.isActive!==void 0&&(i.isActive=!!e.isActive,i.isAttribute=!!e.isAttribute),e.useByteColors!==void 0&&(i.useByteColors=!!e.useByteColors),i}var Ms={name:"filter",props:{},uniforms:{},bindingLayout:[{name:"filter",group:2}],uniformTypes:{enabled:"i32",min:"f32",max:"f32"},defaultUniforms:{enabled:1,min:0,max:1},vs:`layout(std140) uniform filterUniforms {
5724
+ `,sr={props:{},uniforms:{},name:"picking",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useByteColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useByteColors:!0,highlightedObjectColor:[0,0,0],highlightColor:ys},vs:Cs,fs:Ls,getUniforms:As};function As(e={},t){let i={},n=ee(e.useByteColors,!0);if(e.highlightedObjectColor!==void 0)if(e.highlightedObjectColor===null)i.isHighlightActive=!1;else{i.isHighlightActive=!0;let r=e.highlightedObjectColor.slice(0,3);i.highlightedObjectColor=r}return e.highlightColor&&(i.highlightColor=Xe(e.highlightColor,n)),e.isActive!==void 0&&(i.isActive=!!e.isActive,i.isAttribute=!!e.isAttribute),e.useByteColors!==void 0&&(i.useByteColors=!!e.useByteColors),i}var Ms={name:"filter",props:{},uniforms:{},bindingLayout:[{name:"filter",group:2}],uniformTypes:{enabled:"i32",min:"f32",max:"f32"},defaultUniforms:{enabled:1,min:0,max:1},vs:`layout(std140) uniform filterUniforms {
5720
5725
  int enabled;
5721
5726
  float min;
5722
5727
  float max;
@@ -5737,11 +5742,11 @@ fn filter_isVisible(value: f32) -> bool {
5737
5742
  return filterUniforms.enabled == 0 ||
5738
5743
  (value >= filterUniforms.min && value <= filterUniforms.max);
5739
5744
  }
5740
- `,getUniforms(e={}){let t={};return e.enabled!==void 0&&(t.enabled=Number(e.enabled)),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t}},rr={name:"filter",modules:[Ms],vertexInputs:{filterValues:"f32"},glsl:{injections:[{target:"vs:FILTER_POSITION",injection:`if (!filter_isVisible(filterValues)) {
5745
+ `,getUniforms(e={}){let t={};return e.enabled!==void 0&&(t.enabled=Number(e.enabled)),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t}},lr={name:"filter",module:Ms,vertexInputs:{filterValues:"f32"},injections:[{target:"vs:FILTER_POSITION",glsl:`if (!filter_isVisible(filterValues)) {
5741
5746
  position = vec4(2.0, 2.0, 2.0, 1.0);
5742
- }`}]},wgsl:{injections:[{target:"vs:FILTER_POSITION",injection:`if (!filter_isVisible(filterValues)) {
5747
+ }`,wgsl:`if (!filter_isVisible(filterValues)) {
5743
5748
  *position = vec4<f32>(2.0, 2.0, 2.0, 1.0);
5744
- }`}]}};var Rs={name:"clip",props:{},uniforms:{},bindingLayout:[{name:"clip",group:2}],uniformTypes:{enabled:"i32",mode:"i32",bounds:"vec4<f32>"},defaultUniforms:{enabled:1,mode:0,bounds:[0,0,1,1]},vs:`layout(std140) uniform clipUniforms {
5749
+ }`}]};var Rs={name:"clip",props:{},uniforms:{},bindingLayout:[{name:"clip",group:2}],uniformTypes:{enabled:"i32",mode:"i32",bounds:"vec4<f32>"},defaultUniforms:{enabled:1,mode:0,bounds:[0,0,1,1]},vs:`layout(std140) uniform clipUniforms {
5745
5750
  highp int enabled;
5746
5751
  highp int mode;
5747
5752
  highp vec4 bounds;
@@ -5779,23 +5784,23 @@ fn clip_isInBounds(coordinates: vec2<f32>) -> bool {
5779
5784
  coordinates.x < clipUniforms.bounds.z &&
5780
5785
  coordinates.y < clipUniforms.bounds.w;
5781
5786
  }
5782
- `,getUniforms(e={}){let t={};return e.enabled!==void 0&&(t.enabled=Number(e.enabled)),e.mode!==void 0&&(t.mode=e.mode==="instance"?1:0),e.bounds!==void 0&&(t.bounds=e.bounds),t}},or={name:"clip",modules:[Rs],varyings:{clipCoordinates:{type:"vec2<f32>",interpolation:"smooth"}},glsl:{injections:[{target:"vs:CLIP_POSITION",injection:`clipCoordinates = geometryCoordinates;
5787
+ `,getUniforms(e={}){let t={};return e.enabled!==void 0&&(t.enabled=Number(e.enabled)),e.mode!==void 0&&(t.mode=e.mode==="instance"?1:0),e.bounds!==void 0&&(t.bounds=e.bounds),t}},cr={name:"clip",module:Rs,interStageVariables:{clipCoordinates:{type:"vec2<f32>",interpolation:"smooth"}},injections:[{target:"vs:CLIP_POSITION",glsl:`clipCoordinates = geometryCoordinates;
5783
5788
  if (clipState.enabled != 0 && clipState.mode == 1 &&
5784
5789
  !clip_isInBounds(instanceCoordinates)) {
5785
5790
  position = vec4(2.0, 2.0, 2.0, 1.0);
5786
- }`},{target:"fs:CLIP_COLOR",injection:`if (clipState.enabled != 0 && clipState.mode == 0 &&
5787
- !clip_isInBounds(clipCoordinates)) {
5788
- discard;
5789
- }`}]},wgsl:{injections:[{target:"vs:CLIP_POSITION",injection:`clipCoordinates = geometryCoordinates;
5791
+ }`,wgsl:`clipCoordinates = geometryCoordinates;
5790
5792
  if (clipUniforms.enabled != 0 && clipUniforms.mode == 1 &&
5791
5793
  !clip_isInBounds(instanceCoordinates)) {
5792
5794
  *position = vec4<f32>(2.0, 2.0, 2.0, 1.0);
5793
- }`},{target:"fs:CLIP_COLOR",injection:`if (clipUniforms.enabled != 0 && clipUniforms.mode == 0 &&
5795
+ }`},{target:"fs:CLIP_COLOR",glsl:`if (clipState.enabled != 0 && clipState.mode == 0 &&
5796
+ !clip_isInBounds(clipCoordinates)) {
5797
+ discard;
5798
+ }`,wgsl:`if (clipUniforms.enabled != 0 && clipUniforms.mode == 0 &&
5794
5799
  !clip_isInBounds(clipCoordinates)) {
5795
5800
  discard;
5796
- }`}]}};var H=64,Es=`
5801
+ }`}]};var q=64,Es=`
5797
5802
  struct skinUniforms {
5798
- jointMatrix: array<mat4x4<f32>, ${H}>,
5803
+ jointMatrix: array<mat4x4<f32>, ${q}>,
5799
5804
  };
5800
5805
 
5801
5806
  @group(0) @binding(auto) var<uniform> skin: skinUniforms;
@@ -5894,7 +5899,7 @@ mat4 getSkinMatrix(vec4 weights, uvec4 joints) {
5894
5899
  #endif
5895
5900
  }
5896
5901
 
5897
- `,Ts="",ar={props:{},uniforms:{},bindings:{},name:"skin",bindingLayout:[{name:"skin",group:0},{name:"skinJointMatrices",group:0,visibility:1}],dependencies:[],source:Es,vs:ws,fs:Ts,defines:{SKIN_MAX_JOINTS:H},getUniforms:(e={},t)=>{let{jointMatrices:i,skinJointMatrices:n,scenegraphsFromGLTF:r,skinIndex:o=0,meshWorldMatrix:a}=e,s=n?{skinJointMatrices:n}:{};if(i)return{jointMatrix:Ps(i),...s};let l=r?.gltf?.skins?.[o];if(!l)return{jointMatrix:[],...s};let{inverseBindMatrices:c,joints:f,skeleton:u}=l,p=r.gltfNodeIndexToNodeMap,d=new Map,h=u===void 0?void 0:p?.get(u),g=h?[h]:r.scenes||[];for(let b of g)b.preorderTraversal((_,{worldMatrix:m})=>{d.set(_.id,m)});let x=a?new G(a).invert():null,I=new Float32Array(H*16),S=c?.value;for(let b=0;b<Math.min(f.length,H);b++){let _=p?.get(f[b]);if(!_)continue;let m=d.get(_.id)||_.matrix,v=x?new G(x).multiplyRight(m):new G(m);S&&S.length>=(b+1)*16&&v.multiplyRight(new G(Array.from(S.slice(b*16,(b+1)*16)))),I.set(v,b*16)}return{jointMatrix:I,...s}},uniformTypes:{jointMatrix:["mat4x4<f32>",H]}};function Ps(e){let t=new Float32Array(H*16);return t.set(e instanceof Float32Array?e.subarray(0,t.length):e.slice(0,t.length)),t}var Ns=`
5902
+ `,Ts="",fr={props:{},uniforms:{},bindings:{},name:"skin",bindingLayout:[{name:"skin",group:0},{name:"skinJointMatrices",group:0,visibility:1}],dependencies:[],source:Es,vs:ws,fs:Ts,defines:{SKIN_MAX_JOINTS:q},getUniforms:(e={},t)=>{let{jointMatrices:i,skinJointMatrices:n,scenegraphsFromGLTF:r,skinIndex:o=0,meshWorldMatrix:a}=e,s=n?{skinJointMatrices:n}:{};if(i)return{jointMatrix:Ps(i),...s};let l=r?.gltf?.skins?.[o];if(!l)return{jointMatrix:[],...s};let{inverseBindMatrices:c,joints:f,skeleton:u}=l,p=r.gltfNodeIndexToNodeMap,d=new Map,v=u===void 0?void 0:p?.get(u),m=v?[v]:r.scenes||[];for(let b of m)b.preorderTraversal((h,{worldMatrix:g})=>{d.set(h.id,g)});let x=a?new G(a).invert():null,I=new Float32Array(q*16),S=c?.value;for(let b=0;b<Math.min(f.length,q);b++){let h=p?.get(f[b]);if(!h)continue;let g=d.get(h.id)||h.matrix,_=x?new G(x).multiplyRight(g):new G(g);S&&S.length>=(b+1)*16&&_.multiplyRight(new G(Array.from(S.slice(b*16,(b+1)*16)))),I.set(_,b*16)}return{jointMatrix:I,...s}},uniformTypes:{jointMatrix:["mat4x4<f32>",q]}};function Ps(e){let t=new Float32Array(q*16);return t.set(e instanceof Float32Array?e.subarray(0,t.length):e.slice(0,t.length)),t}var Ns=`
5898
5903
  #ifdef HAS_GPU_CROWD_ANIMATION
5899
5904
  @group(0) @binding(auto) var<storage, read> gpuAnimationFrames: array<vec4f>;
5900
5905
 
@@ -6098,7 +6103,7 @@ vec3 getGPUCrowdMorphDelta(
6098
6103
  return result;
6099
6104
  }
6100
6105
  #endif
6101
- `,sr={name:"gpuAnimation",props:{},uniforms:{},bindings:{},source:Ns,vs:Ds,fs:"",bindingLayout:[{name:"gpuAnimationFrames",group:0,visibility:1},{name:"gpuMorphTargets",group:0,visibility:1},{name:"gpuMorphWeights",group:0,visibility:1}],getUniforms(e={}){return e}};var W=4;function jt(){return{color:[0,0,0],position:[0,0,0],halfAxisX:[0,0,0],halfAxisY:[0,0,0],normal:[0,0,-1],disk:0}}var Qe={color:"vec3<f32>",position:"vec3<f32>",halfAxisX:"vec3<f32>",halfAxisY:"vec3<f32>",normal:"vec3<f32>",disk:"i32"};function Se(e,t=!1){return Array.from({length:W},(i,n)=>{let r=e[n];if(!r)return jt();let o=te(r.color||(t?[255,255,255]:[1,1,1]),t);return{position:r.position,halfAxisX:r.halfAxisX,halfAxisY:r.halfAxisY,normal:r.normal,disk:r.type==="disk"?1:0,color:o.map(a=>a*(r.intensity??1e3))}})}var $t=`precision highp int;
6106
+ `,ur={name:"gpuAnimation",props:{},uniforms:{},bindings:{},source:Ns,vs:Ds,fs:"",bindingLayout:[{name:"gpuAnimationFrames",group:0,visibility:1},{name:"gpuMorphTargets",group:0,visibility:1},{name:"gpuMorphWeights",group:0,visibility:1}],getUniforms(e={}){return e}};var j=4;function Yt(){return{color:[0,0,0],position:[0,0,0],halfAxisX:[0,0,0],halfAxisY:[0,0,0],normal:[0,0,-1],disk:0}}var et={color:"vec3<f32>",position:"vec3<f32>",halfAxisX:"vec3<f32>",halfAxisY:"vec3<f32>",normal:"vec3<f32>",disk:"i32"};function Se(e,t=!1){return Array.from({length:j},(i,n)=>{let r=e[n];if(!r)return Yt();let o=te(r.color||(t?[255,255,255]:[1,1,1]),t);return{position:r.position,halfAxisX:r.halfAxisX,halfAxisY:r.halfAxisY,normal:r.normal,disk:r.type==="disk"?1:0,color:o.map(a=>a*(r.intensity??1e3))}})}var Zt=`precision highp int;
6102
6107
 
6103
6108
  // #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
6104
6109
  struct AmbientLight {
@@ -6184,7 +6189,7 @@ float getSpotLightAttenuation(SpotLight spotLight, vec3 positionWorldspace) {
6184
6189
  }
6185
6190
 
6186
6191
  // #endif
6187
- `;var lr=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
6192
+ `;var pr=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
6188
6193
  const MAX_LIGHTS: i32 = 5;
6189
6194
 
6190
6195
  struct AmbientLight {
@@ -6269,7 +6274,7 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
6269
6274
  );
6270
6275
  return distanceAttenuation / max(coneFactor, 0.0001);
6271
6276
  }
6272
- `;var ie=5,Fs={color:"vec3<f32>",position:"vec3<f32>",direction:"vec3<f32>",attenuation:"vec3<f32>",coneCos:"vec2<f32>"},O={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",directionalLightCount:"i32",pointLightCount:"i32",spotLightCount:"i32",ambientColor:"vec3<f32>",lights:[Fs,ie],areaLightCount:"i32",areaLights:[Qe,W]},defaultUniforms:tt(),bindingLayout:[{name:"lighting",group:2}],firstBindingSlot:0,source:lr,vs:$t,fs:$t,getUniforms:Os};function Os(e,t={}){e=e&&{...e};let i=(e?.lights||[]).filter(f=>f.type==="rect"||f.type==="disk");if(!e)return tt();e.lights&&(e={...e,...Us(e.lights),lights:void 0});let{useByteColors:n,ambientLight:r,pointLights:o,spotLights:a,directionalLights:s}=e||{};if(!(r||o&&o.length>0||a&&a.length>0||s&&s.length>0)&&i.length===0)return{...tt(),enabled:0};let c={...tt(),...Bs({useByteColors:n,ambientLight:r,pointLights:o,spotLights:a,directionalLights:s})};return c.areaLightCount=Math.min(i.length,W),c.areaLights=Se(i,ee(e.useByteColors,!0)),e.enabled!==void 0&&(c.enabled=e.enabled?1:0),c}function Bs({useByteColors:e,ambientLight:t,pointLights:i=[],spotLights:n=[],directionalLights:r=[]}){let o=cr(),a=0,s=0,l=0,c=0;for(let f of i){if(a>=ie)break;o[a]={...o[a],color:et(f,e),position:f.position,attenuation:f.attenuation||[1,0,0]},a++,s++}for(let f of n){if(a>=ie)break;o[a]={...o[a],color:et(f,e),position:f.position,direction:f.direction,attenuation:f.attenuation||[1,0,0],coneCos:Gs(f)},a++,l++}for(let f of r){if(a>=ie)break;o[a]={...o[a],color:et(f,e),direction:f.direction},a++,c++}return i.length+n.length+r.length>ie&&console.warn(`MAX_LIGHTS exceeded, truncating to ${ie}`),{ambientColor:et(t,e),directionalLightCount:c,pointLightCount:s,spotLightCount:l,lights:o}}function Us(e){let t={pointLights:[],spotLights:[],directionalLights:[]};for(let i of e||[])switch(i.type){case"ambient":t.ambientLight=i;break;case"directional":t.directionalLights?.push(i);break;case"point":t.pointLights?.push(i);break;case"spot":t.spotLights?.push(i);break;default:}return t}function et(e={},t){let{color:i=[0,0,0],intensity:n=1}=e;return te(i,ee(t,!0)).map(o=>o*n)}function tt(){return{enabled:1,directionalLightCount:0,pointLightCount:0,spotLightCount:0,ambientColor:[.1,.1,.1],lights:cr(),areaLightCount:0,areaLights:Se([])}}function cr(){return Array.from({length:ie},()=>ks())}function ks(){return{color:[1,1,1],position:[1,1,2],direction:[1,1,1],attenuation:[1,0,0],coneCos:[1,0]}}function Gs(e){let t=e.innerConeAngle??0,i=e.outerConeAngle??Math.PI/4;return[Math.cos(t),Math.cos(i)]}var zs=`#ifdef USE_IBL
6277
+ `;var ie=5,Fs={color:"vec3<f32>",position:"vec3<f32>",direction:"vec3<f32>",attenuation:"vec3<f32>",coneCos:"vec2<f32>"},O={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",directionalLightCount:"i32",pointLightCount:"i32",spotLightCount:"i32",ambientColor:"vec3<f32>",lights:[Fs,ie],areaLightCount:"i32",areaLights:[et,j]},defaultUniforms:it(),bindingLayout:[{name:"lighting",group:2}],firstBindingSlot:0,source:pr,vs:Zt,fs:Zt,getUniforms:Os};function Os(e,t={}){e=e&&{...e};let i=(e?.lights||[]).filter(f=>f.type==="rect"||f.type==="disk");if(!e)return it();e.lights&&(e={...e,...Us(e.lights),lights:void 0});let{useByteColors:n,ambientLight:r,pointLights:o,spotLights:a,directionalLights:s}=e||{};if(!(r||o&&o.length>0||a&&a.length>0||s&&s.length>0)&&i.length===0)return{...it(),enabled:0};let c={...it(),...Bs({useByteColors:n,ambientLight:r,pointLights:o,spotLights:a,directionalLights:s})};return c.areaLightCount=Math.min(i.length,j),c.areaLights=Se(i,ee(e.useByteColors,!0)),e.enabled!==void 0&&(c.enabled=e.enabled?1:0),c}function Bs({useByteColors:e,ambientLight:t,pointLights:i=[],spotLights:n=[],directionalLights:r=[]}){let o=dr(),a=0,s=0,l=0,c=0;for(let f of i){if(a>=ie)break;o[a]={...o[a],color:tt(f,e),position:f.position,attenuation:f.attenuation||[1,0,0]},a++,s++}for(let f of n){if(a>=ie)break;o[a]={...o[a],color:tt(f,e),position:f.position,direction:f.direction,attenuation:f.attenuation||[1,0,0],coneCos:Gs(f)},a++,l++}for(let f of r){if(a>=ie)break;o[a]={...o[a],color:tt(f,e),direction:f.direction},a++,c++}return i.length+n.length+r.length>ie&&console.warn(`MAX_LIGHTS exceeded, truncating to ${ie}`),{ambientColor:tt(t,e),directionalLightCount:c,pointLightCount:s,spotLightCount:l,lights:o}}function Us(e){let t={pointLights:[],spotLights:[],directionalLights:[]};for(let i of e||[])switch(i.type){case"ambient":t.ambientLight=i;break;case"directional":t.directionalLights?.push(i);break;case"point":t.pointLights?.push(i);break;case"spot":t.spotLights?.push(i);break;default:}return t}function tt(e={},t){let{color:i=[0,0,0],intensity:n=1}=e;return te(i,ee(t,!0)).map(o=>o*n)}function it(){return{enabled:1,directionalLightCount:0,pointLightCount:0,spotLightCount:0,ambientColor:[.1,.1,.1],lights:dr(),areaLightCount:0,areaLights:Se([])}}function dr(){return Array.from({length:ie},()=>ks())}function ks(){return{color:[1,1,1],position:[1,1,2],direction:[1,1,1],attenuation:[1,0,0],coneCos:[1,0]}}function Gs(e){let t=e.innerConeAngle??0,i=e.outerConeAngle??Math.PI/4;return[Math.cos(t),Math.cos(i)]}var zs=`#ifdef USE_IBL
6273
6278
  @group(2) @binding(auto) var pbr_diffuseEnvSampler: texture_cube<f32>;
6274
6279
  @group(2) @binding(auto) var pbr_diffuseEnvSamplerSampler: sampler;
6275
6280
  @group(2) @binding(auto) var pbr_specularEnvSampler: texture_cube<f32>;
@@ -6277,12 +6282,12 @@ fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>)
6277
6282
  @group(2) @binding(auto) var pbr_brdfLUT: texture_2d<f32>;
6278
6283
  @group(2) @binding(auto) var pbr_brdfLUTSampler: sampler;
6279
6284
  #endif
6280
- `,fr=`#ifdef USE_IBL
6285
+ `,gr=`#ifdef USE_IBL
6281
6286
  uniform samplerCube pbr_diffuseEnvSampler;
6282
6287
  uniform samplerCube pbr_specularEnvSampler;
6283
6288
  uniform sampler2D pbr_brdfLUT;
6284
6289
  #endif
6285
- `,it={name:"ibl",firstBindingSlot:32,bindingLayout:[{name:"pbr_diffuseEnvSampler",group:2},{name:"pbr_specularEnvSampler",group:2},{name:"pbr_brdfLUT",group:2}],source:zs,vs:fr,fs:fr};var Vs=`struct dirlightUniforms {
6290
+ `,nt={name:"ibl",firstBindingSlot:32,bindingLayout:[{name:"pbr_diffuseEnvSampler",group:2},{name:"pbr_specularEnvSampler",group:2},{name:"pbr_brdfLUT",group:2}],source:zs,vs:gr,fs:gr};var Vs=`struct dirlightUniforms {
6286
6291
  lightDirection: vec3<f32>,
6287
6292
  };
6288
6293
 
@@ -6323,7 +6328,7 @@ vec4 dirlight_filterColor(vec4 color) {
6323
6328
  float d = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection)));
6324
6329
  return vec4(color.rgb * d, color.a);
6325
6330
  }
6326
- `,Kt={props:{},uniforms:{},name:"dirlight",bindingLayout:[{name:"dirlight",group:2}],firstBindingSlot:16,dependencies:[],source:Vs,vs:Hs,fs:Ws,uniformTypes:{lightDirection:"vec3<f32>"},defaultUniforms:{lightDirection:[1,1,2]},getUniforms:qs};function qs(e=Kt.defaultUniforms){let t={};return e.lightDirection&&(t.lightDirection=e.lightDirection),t}var ur=`struct lambertMaterialUniforms {
6331
+ `,Xt={props:{},uniforms:{},name:"dirlight",bindingLayout:[{name:"dirlight",group:2}],firstBindingSlot:16,dependencies:[],source:Vs,vs:Hs,fs:Ws,uniformTypes:{lightDirection:"vec3<f32>"},defaultUniforms:{lightDirection:[1,1,2]},getUniforms:qs};function qs(e=Xt.defaultUniforms){let t={};return e.lightDirection&&(t.lightDirection=e.lightDirection),t}var mr=`struct lambertMaterialUniforms {
6327
6332
  unlit: u32,
6328
6333
  ambient: f32,
6329
6334
  diffuse: f32,
@@ -6390,12 +6395,12 @@ fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, p
6390
6395
 
6391
6396
  return lightColor;
6392
6397
  }
6393
- `;var pr=`layout(std140) uniform lambertMaterialUniforms {
6398
+ `;var hr=`layout(std140) uniform lambertMaterialUniforms {
6394
6399
  uniform bool unlit;
6395
6400
  uniform float ambient;
6396
6401
  uniform float diffuse;
6397
6402
  } material;
6398
- `,dr=`layout(std140) uniform lambertMaterialUniforms {
6403
+ `,_r=`layout(std140) uniform lambertMaterialUniforms {
6399
6404
  uniform bool unlit;
6400
6405
  uniform float ambient;
6401
6406
  uniform float diffuse;
@@ -6442,14 +6447,14 @@ vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 positio
6442
6447
 
6443
6448
  return lightColor;
6444
6449
  }
6445
- `;var Yt={name:"lambertMaterial",firstBindingSlot:0,bindingLayout:[{name:"lambertMaterial",group:3}],dependencies:[O],source:ur,vs:pr,fs:dr,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6},getUniforms(e){return{...Yt.defaultUniforms,...e}}};var nt=`layout(std140) uniform phongMaterialUniforms {
6450
+ `;var Jt={name:"lambertMaterial",firstBindingSlot:0,bindingLayout:[{name:"lambertMaterial",group:3}],dependencies:[O],source:mr,vs:hr,fs:_r,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6},getUniforms(e){return{...Jt.defaultUniforms,...e}}};var rt=`layout(std140) uniform phongMaterialUniforms {
6446
6451
  uniform bool unlit;
6447
6452
  uniform float ambient;
6448
6453
  uniform float diffuse;
6449
6454
  uniform float shininess;
6450
6455
  uniform vec3 specularColor;
6451
6456
  } material;
6452
- `,rt=`layout(std140) uniform phongMaterialUniforms {
6457
+ `,ot=`layout(std140) uniform phongMaterialUniforms {
6453
6458
  uniform bool unlit;
6454
6459
  uniform float ambient;
6455
6460
  uniform float diffuse;
@@ -6506,7 +6511,7 @@ vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 positio
6506
6511
 
6507
6512
  return lightColor;
6508
6513
  }
6509
- `;var ot=`struct phongMaterialUniforms {
6514
+ `;var at=`struct phongMaterialUniforms {
6510
6515
  unlit: u32,
6511
6516
  ambient: f32,
6512
6517
  diffuse: f32,
@@ -6629,7 +6634,7 @@ fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace
6629
6634
  }
6630
6635
  return lightColor;
6631
6636
  }
6632
- `;var js=[38.25,38.25,38.25],Zt={props:{},name:"gouraudMaterial",bindingLayout:[{name:"gouraudMaterial",group:3}],vs:rt.replace("phongMaterial","gouraudMaterial"),fs:nt.replace("phongMaterial","gouraudMaterial"),source:ot.replaceAll("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:!0},dependencies:[O,fe],uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:js},getUniforms(e){return{...Zt.defaultUniforms,...e}}};var $s=[38.25,38.25,38.25],Xt={name:"phongMaterial",firstBindingSlot:0,bindingLayout:[{name:"phongMaterial",group:3}],dependencies:[O,fe],source:ot,vs:nt,fs:rt,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:$s},getUniforms(e){return{...Xt.defaultUniforms,...e}}};var gr=`layout(std140) uniform waterMaterialUniforms {
6637
+ `;var js=[38.25,38.25,38.25],Qt={props:{},name:"gouraudMaterial",bindingLayout:[{name:"gouraudMaterial",group:3}],vs:ot.replace("phongMaterial","gouraudMaterial"),fs:rt.replace("phongMaterial","gouraudMaterial"),source:at.replaceAll("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:!0},dependencies:[O,fe],uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:js},getUniforms(e){return{...Qt.defaultUniforms,...e}}};var $s=[38.25,38.25,38.25],ei={name:"phongMaterial",firstBindingSlot:0,bindingLayout:[{name:"phongMaterial",group:3}],dependencies:[O,fe],source:at,vs:rt,fs:ot,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:$s},getUniforms(e){return{...ei.defaultUniforms,...e}}};var vr=`layout(std140) uniform waterMaterialUniforms {
6633
6638
  uniform float time;
6634
6639
  uniform vec3 baseColor;
6635
6640
  uniform float opacity;
@@ -6649,7 +6654,7 @@ fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace
6649
6654
  uniform float waveBFrequency;
6650
6655
  uniform float waveBAmplitude;
6651
6656
  } waterMaterial;
6652
- `,mr=`layout(std140) uniform waterMaterialUniforms {
6657
+ `,br=`layout(std140) uniform waterMaterialUniforms {
6653
6658
  uniform float time;
6654
6659
  uniform vec3 baseColor;
6655
6660
  uniform float opacity;
@@ -6853,7 +6858,7 @@ vec4 water_getColor(
6853
6858
  uv
6854
6859
  );
6855
6860
  }
6856
- `;var hr=`struct waterMaterialUniforms {
6861
+ `;var xr=`struct waterMaterialUniforms {
6857
6862
  time: f32,
6858
6863
  baseColor: vec3<f32>,
6859
6864
  opacity: f32,
@@ -7077,7 +7082,7 @@ fn water_getColor(
7077
7082
  uv
7078
7083
  );
7079
7084
  }
7080
- `;var T={time:0,baseColor:[.04,.18,.31],opacity:.82,fresnelColor:[.86,.95,1],fresnelPower:5,specularIntensity:1.4,normalStrength:.35,mappingMode:0,coordinateScale:[1,1],coordinateOffset:[0,0],waveADirection:[.9805806756909201,.19611613513818402],waveASpeed:.6,waveAFrequency:4,waveAAmplitude:.08,waveBDirection:[.09950371902099893,.9950371902099893],waveBSpeed:-.45,waveBFrequency:7,waveBAmplitude:.04},lt={name:"waterMaterial",firstBindingSlot:0,bindingLayout:[{name:"waterMaterial",group:3}],dependencies:[O],source:hr,vs:gr,fs:mr,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{time:"f32",baseColor:"vec3<f32>",opacity:"f32",fresnelColor:"vec3<f32>",fresnelPower:"f32",specularIntensity:"f32",normalStrength:"f32",mappingMode:"i32",coordinateScale:"vec2<f32>",coordinateOffset:"vec2<f32>",waveADirection:"vec2<f32>",waveASpeed:"f32",waveAFrequency:"f32",waveAAmplitude:"f32",waveBDirection:"vec2<f32>",waveBSpeed:"f32",waveBFrequency:"f32",waveBAmplitude:"f32"},defaultUniforms:T,getUniforms(e,t=T){let{mapping:i,...n}=e||{},r=Ks(t);return n.time!==void 0&&(r.time=n.time),n.opacity!==void 0&&(r.opacity=n.opacity),n.fresnelPower!==void 0&&(r.fresnelPower=n.fresnelPower),n.specularIntensity!==void 0&&(r.specularIntensity=n.specularIntensity),n.normalStrength!==void 0&&(r.normalStrength=n.normalStrength),n.coordinateScale!==void 0&&(r.coordinateScale=[Number(n.coordinateScale[0]),Number(n.coordinateScale[1])]),n.coordinateOffset!==void 0&&(r.coordinateOffset=[Number(n.coordinateOffset[0]),Number(n.coordinateOffset[1])]),n.waveASpeed!==void 0&&(r.waveASpeed=n.waveASpeed),n.waveAFrequency!==void 0&&(r.waveAFrequency=n.waveAFrequency),n.waveAAmplitude!==void 0&&(r.waveAAmplitude=n.waveAAmplitude),n.waveBSpeed!==void 0&&(r.waveBSpeed=n.waveBSpeed),n.waveBFrequency!==void 0&&(r.waveBFrequency=n.waveBFrequency),n.waveBAmplitude!==void 0&&(r.waveBAmplitude=n.waveBAmplitude),n.baseColor&&(r.baseColor=at(n.baseColor)),n.fresnelColor&&(r.fresnelColor=at(n.fresnelColor)),n.waveADirection&&(r.waveADirection=st(n.waveADirection)),n.waveBDirection&&(r.waveBDirection=st(n.waveBDirection)),i!==void 0&&(r.mappingMode=i==="world"?1:i==="object"?2:0),r}};function Ks(e){return{time:e.time??T.time,baseColor:e.baseColor?at(e.baseColor):T.baseColor,opacity:e.opacity??T.opacity,fresnelColor:e.fresnelColor?at(e.fresnelColor):T.fresnelColor,fresnelPower:e.fresnelPower??T.fresnelPower,specularIntensity:e.specularIntensity??T.specularIntensity,normalStrength:e.normalStrength??T.normalStrength,mappingMode:e.mappingMode??T.mappingMode,coordinateScale:e.coordinateScale?[Number(e.coordinateScale[0]),Number(e.coordinateScale[1])]:T.coordinateScale,coordinateOffset:e.coordinateOffset?[Number(e.coordinateOffset[0]),Number(e.coordinateOffset[1])]:T.coordinateOffset,waveADirection:e.waveADirection?st(e.waveADirection):T.waveADirection,waveASpeed:e.waveASpeed??T.waveASpeed,waveAFrequency:e.waveAFrequency??T.waveAFrequency,waveAAmplitude:e.waveAAmplitude??T.waveAAmplitude,waveBDirection:e.waveBDirection?st(e.waveBDirection):T.waveBDirection,waveBSpeed:e.waveBSpeed??T.waveBSpeed,waveBFrequency:e.waveBFrequency??T.waveBFrequency,waveBAmplitude:e.waveBAmplitude??T.waveBAmplitude}}function at(e){let t=[Number(e[0]),Number(e[1]),Number(e[2])];return Math.max(...t.map(n=>Math.abs(n)))>1&&(t[0]/=255,t[1]/=255,t[2]/=255),t}function st(e){let t=Number(e[0]),i=Number(e[1]),n=Math.hypot(t,i);return n===0?[1,0]:[t/n,i/n]}var _r=`struct riverWaterMaterialUniforms {
7085
+ `;var T={time:0,baseColor:[.04,.18,.31],opacity:.82,fresnelColor:[.86,.95,1],fresnelPower:5,specularIntensity:1.4,normalStrength:.35,mappingMode:0,coordinateScale:[1,1],coordinateOffset:[0,0],waveADirection:[.9805806756909201,.19611613513818402],waveASpeed:.6,waveAFrequency:4,waveAAmplitude:.08,waveBDirection:[.09950371902099893,.9950371902099893],waveBSpeed:-.45,waveBFrequency:7,waveBAmplitude:.04},ct={name:"waterMaterial",firstBindingSlot:0,bindingLayout:[{name:"waterMaterial",group:3}],dependencies:[O],source:xr,vs:vr,fs:br,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{time:"f32",baseColor:"vec3<f32>",opacity:"f32",fresnelColor:"vec3<f32>",fresnelPower:"f32",specularIntensity:"f32",normalStrength:"f32",mappingMode:"i32",coordinateScale:"vec2<f32>",coordinateOffset:"vec2<f32>",waveADirection:"vec2<f32>",waveASpeed:"f32",waveAFrequency:"f32",waveAAmplitude:"f32",waveBDirection:"vec2<f32>",waveBSpeed:"f32",waveBFrequency:"f32",waveBAmplitude:"f32"},defaultUniforms:T,getUniforms(e,t=T){let{mapping:i,...n}=e||{},r=Ks(t);return n.time!==void 0&&(r.time=n.time),n.opacity!==void 0&&(r.opacity=n.opacity),n.fresnelPower!==void 0&&(r.fresnelPower=n.fresnelPower),n.specularIntensity!==void 0&&(r.specularIntensity=n.specularIntensity),n.normalStrength!==void 0&&(r.normalStrength=n.normalStrength),n.coordinateScale!==void 0&&(r.coordinateScale=[Number(n.coordinateScale[0]),Number(n.coordinateScale[1])]),n.coordinateOffset!==void 0&&(r.coordinateOffset=[Number(n.coordinateOffset[0]),Number(n.coordinateOffset[1])]),n.waveASpeed!==void 0&&(r.waveASpeed=n.waveASpeed),n.waveAFrequency!==void 0&&(r.waveAFrequency=n.waveAFrequency),n.waveAAmplitude!==void 0&&(r.waveAAmplitude=n.waveAAmplitude),n.waveBSpeed!==void 0&&(r.waveBSpeed=n.waveBSpeed),n.waveBFrequency!==void 0&&(r.waveBFrequency=n.waveBFrequency),n.waveBAmplitude!==void 0&&(r.waveBAmplitude=n.waveBAmplitude),n.baseColor&&(r.baseColor=st(n.baseColor)),n.fresnelColor&&(r.fresnelColor=st(n.fresnelColor)),n.waveADirection&&(r.waveADirection=lt(n.waveADirection)),n.waveBDirection&&(r.waveBDirection=lt(n.waveBDirection)),i!==void 0&&(r.mappingMode=i==="world"?1:i==="object"?2:0),r}};function Ks(e){return{time:e.time??T.time,baseColor:e.baseColor?st(e.baseColor):T.baseColor,opacity:e.opacity??T.opacity,fresnelColor:e.fresnelColor?st(e.fresnelColor):T.fresnelColor,fresnelPower:e.fresnelPower??T.fresnelPower,specularIntensity:e.specularIntensity??T.specularIntensity,normalStrength:e.normalStrength??T.normalStrength,mappingMode:e.mappingMode??T.mappingMode,coordinateScale:e.coordinateScale?[Number(e.coordinateScale[0]),Number(e.coordinateScale[1])]:T.coordinateScale,coordinateOffset:e.coordinateOffset?[Number(e.coordinateOffset[0]),Number(e.coordinateOffset[1])]:T.coordinateOffset,waveADirection:e.waveADirection?lt(e.waveADirection):T.waveADirection,waveASpeed:e.waveASpeed??T.waveASpeed,waveAFrequency:e.waveAFrequency??T.waveAFrequency,waveAAmplitude:e.waveAAmplitude??T.waveAAmplitude,waveBDirection:e.waveBDirection?lt(e.waveBDirection):T.waveBDirection,waveBSpeed:e.waveBSpeed??T.waveBSpeed,waveBFrequency:e.waveBFrequency??T.waveBFrequency,waveBAmplitude:e.waveBAmplitude??T.waveBAmplitude}}function st(e){let t=[Number(e[0]),Number(e[1]),Number(e[2])];return Math.max(...t.map(n=>Math.abs(n)))>1&&(t[0]/=255,t[1]/=255,t[2]/=255),t}function lt(e){let t=Number(e[0]),i=Number(e[1]),n=Math.hypot(t,i);return n===0?[1,0]:[t/n,i/n]}var Sr=`struct riverWaterMaterialUniforms {
7081
7086
  enabled: i32,
7082
7087
  flowDirection: vec2<f32>,
7083
7088
  skyZenithColor: vec3<f32>,
@@ -7193,7 +7198,7 @@ fn riverWater_getColorMapped(
7193
7198
  color = mix(color, reflectedColor, clamp(fresnel * 0.3, 0.0, 0.3));
7194
7199
  return vec4<f32>(color, waterMaterial.opacity);
7195
7200
  }
7196
- `,vr=`layout(std140) uniform riverWaterMaterialUniforms {
7201
+ `,Ir=`layout(std140) uniform riverWaterMaterialUniforms {
7197
7202
  uniform int enabled;
7198
7203
  uniform vec2 flowDirection;
7199
7204
  uniform vec3 skyZenithColor;
@@ -7302,7 +7307,7 @@ vec4 riverWater_getColorMapped(
7302
7307
  color = mix(color, reflectedColor, clamp(fresnel * 0.3, 0.0, 0.3));
7303
7308
  return vec4(color, waterMaterial.opacity);
7304
7309
  }
7305
- `;var br={name:"riverWaterMaterial",firstBindingSlot:1,bindingLayout:[{name:"riverWaterMaterial",group:3}],dependencies:[lt],source:_r,fs:vr,uniformTypes:{enabled:"i32",flowDirection:"vec2<f32>",skyZenithColor:"vec3<f32>",skyUpDirection:"vec3<f32>"},defaultUniforms:{enabled:0,flowDirection:[0,1],skyZenithColor:[.22,.48,.57],skyUpDirection:[0,0,1]},getUniforms(e={},t={}){return{enabled:e.enabled??t.enabled??0,flowDirection:e.flowDirection??t.flowDirection??[0,1],skyZenithColor:e.skyZenithColor??t.skyZenithColor??[.22,.48,.57],skyUpDirection:e.skyUpDirection??t.skyUpDirection??[0,0,1]}}};var Jt=`
7310
+ `;var yr={name:"riverWaterMaterial",firstBindingSlot:1,bindingLayout:[{name:"riverWaterMaterial",group:3}],dependencies:[ct],source:Sr,fs:Ir,uniformTypes:{enabled:"i32",flowDirection:"vec2<f32>",skyZenithColor:"vec3<f32>",skyUpDirection:"vec3<f32>"},defaultUniforms:{enabled:0,flowDirection:[0,1],skyZenithColor:[.22,.48,.57],skyUpDirection:[0,0,1]},getUniforms(e={},t={}){return{enabled:e.enabled??t.enabled??0,flowDirection:e.flowDirection??t.flowDirection??[0,1],skyZenithColor:e.skyZenithColor??t.skyZenithColor??[.22,.48,.57],skyUpDirection:e.skyUpDirection??t.skyUpDirection??[0,0,1]}}};var ti=`
7306
7311
  #ifdef USE_AREA_LIGHT_LTC
7307
7312
  uniform sampler2D areaLTCMatrix;
7308
7313
  uniform sampler2D areaLTCAmplitude;
@@ -7382,7 +7387,7 @@ vec3 areaLTC_evaluate(int index, vec3 receiver, vec3 normal, vec3 view, float ro
7382
7387
  areaLTC_specular(light, receiver, normal, view, roughness, reflectance0, reflectance90);
7383
7388
  }
7384
7389
  #endif
7385
- `,xr=`
7390
+ `,Cr=`
7386
7391
  #ifdef USE_AREA_LIGHT_LTC
7387
7392
  @group(2) @binding(auto) var areaLTCMatrix: texture_2d<f32>;
7388
7393
  @group(2) @binding(auto) var areaLTCAmplitude: texture_2d<f32>;
@@ -7458,7 +7463,7 @@ fn areaLTC_evaluate(index: i32, receiver: vec3f, normal: vec3f, view: vec3f, rou
7458
7463
  areaLTC_specular(light, receiver, normal, view, roughness, reflectance0, reflectance90);
7459
7464
  }
7460
7465
  #endif
7461
- `;var Qt=`
7466
+ `;var ii=`
7462
7467
  layout(std140) uniform areaLightingUniforms {
7463
7468
  int lightCount;
7464
7469
  int sampleCount;
@@ -7490,7 +7495,7 @@ PointLight areaLighting_getSample(int lightIndex, int sampleIndex, vec3 receiver
7490
7495
  float emissionCosine = max(dot(light.normal, displacement * inversesqrt(distanceSquared)), 0.0);
7491
7496
  return PointLight(light.color * (area * emissionCosine / (float(areaLighting.sampleCount) * distanceSquared)), position, vec3(1.0, 0.0, 0.0));
7492
7497
  }
7493
- `,Sr=`
7498
+ `,Lr=`
7494
7499
  struct AreaLightingUniforms {
7495
7500
  lightCount: i32,
7496
7501
  sampleCount: i32,
@@ -7523,7 +7528,7 @@ fn areaLighting_getSample(lightIndex: i32, sampleIndex: i32, receiver: vec3f) ->
7523
7528
  let emissionCosine = max(dot(light.normal, displacement * inverseSqrt(distanceSquared)), 0.0);
7524
7529
  return PointLight(light.color * (area * emissionCosine / (f32(areaLighting.sampleCount) * distanceSquared)), position, vec3f(1.0, 0.0, 0.0));
7525
7530
  }
7526
- `;var ct={name:"areaLighting",props:{},uniforms:{},dependencies:[O],defaultUniforms:{lightCount:0,sampleCount:64,lights:Array.from({length:W},jt)},uniformTypes:{lightCount:"i32",sampleCount:"i32",lights:[Qe,W]},bindingLayout:[{name:"areaLighting",group:2},{name:"areaLTCMatrix",group:2},{name:"areaLTCAmplitude",group:2}],source:Sr+xr,vs:Qt+Jt,fs:Qt+Jt,getUniforms(e={}){let t=e.lights||[];return{lightCount:Math.min(t.length,W),sampleCount:e.sampleCount||64,lights:Se(t,e.useByteColors)}}};var Ir=`out vec3 pbr_vPosition;
7531
+ `;var ft={name:"areaLighting",props:{},uniforms:{},dependencies:[O],defaultUniforms:{lightCount:0,sampleCount:64,lights:Array.from({length:j},Yt)},uniformTypes:{lightCount:"i32",sampleCount:"i32",lights:[et,j]},bindingLayout:[{name:"areaLighting",group:2},{name:"areaLTCMatrix",group:2},{name:"areaLTCAmplitude",group:2}],source:Lr+Cr,vs:ii+ti,fs:ii+ti,getUniforms(e={}){let t=e.lights||[];return{lightCount:Math.min(t.length,j),sampleCount:e.sampleCount||64,lights:Se(t,e.useByteColors)}}};var Ar=`out vec3 pbr_vPosition;
7527
7532
  out vec2 pbr_vUV0;
7528
7533
  out vec2 pbr_vUV1;
7529
7534
 
@@ -7565,7 +7570,7 @@ void pbr_setPositionNormalTangentUV(
7565
7570
 
7566
7571
  pbr_vUV1 = uv1;
7567
7572
  }
7568
- `,yr=`precision highp float;
7573
+ `,Mr=`precision highp float;
7569
7574
 
7570
7575
  layout(std140) uniform pbrMaterialUniforms {
7571
7576
  // Material is unlit
@@ -9254,7 +9259,7 @@ vec4 pbr_filterColorWithSpotShadows(vec4 vertexColor, vec4 spotVisibility)
9254
9259
  vec4 pbr_filterColor(vec4 vertexColor) {
9255
9260
  return pbr_filterColorWithSpotShadows(vertexColor, vec4(1.0));
9256
9261
  }
9257
- `;var Cr=`#ifdef DOUBLE_SIDED
9262
+ `;var Rr=`#ifdef DOUBLE_SIDED
9258
9263
  var<private> pbr_frontFacing: bool = true;
9259
9264
  #endif
9260
9265
  struct PBRFragmentInputs {
@@ -11141,7 +11146,7 @@ fn pbr_filterColorWithSpotShadows(vertexColor: vec4<f32>, spotVisibility: vec4f)
11141
11146
  fn pbr_filterColor(vertexColor: vec4<f32>) -> vec4<f32> {
11142
11147
  return pbr_filterColorWithSpotShadows(vertexColor, vec4f(1.0));
11143
11148
  }
11144
- `;var Lr=`layout(std140) uniform pbrProjectionUniforms {
11149
+ `;var Er=`layout(std140) uniform pbrProjectionUniforms {
11145
11150
  mat4 modelViewProjectionMatrix;
11146
11151
  mat4 modelMatrix;
11147
11152
  mat4 normalMatrix;
@@ -11155,7 +11160,7 @@ fn pbr_filterColor(vertexColor: vec4<f32>) -> vec4<f32> {
11155
11160
  };
11156
11161
 
11157
11162
  @group(0) @binding(auto) var<uniform> pbrProjection: pbrProjectionUniforms;
11158
- `,Ar={name:"pbrProjection",bindingLayout:[{name:"pbrProjection",group:0}],source:Ys,vs:Lr,fs:Lr,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<f32>"}};var ei={NONE:0,REINHARD:1,KHRONOS_PBR_NEUTRAL:2,ACES:3},Mr=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Rr=`layout(std140) uniform pbrSceneUniforms {
11163
+ `,wr={name:"pbrProjection",bindingLayout:[{name:"pbrProjection",group:0}],source:Ys,vs:Er,fs:Er,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<f32>"}};var ni={NONE:0,REINHARD:1,KHRONOS_PBR_NEUTRAL:2,ACES:3},Tr=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Pr=`layout(std140) uniform pbrSceneUniforms {
11159
11164
  float exposure;
11160
11165
  highp int toneMapMode;
11161
11166
  float environmentIntensity;
@@ -11188,7 +11193,7 @@ uniform sampler2D pbr_transmissionFramebufferSampler;
11188
11193
  @group(1) @binding(auto) var pbr_transmissionFramebufferSampler: texture_2d<f32>;
11189
11194
  @group(1) @binding(auto) var pbr_transmissionFramebufferSamplerSampler: sampler;
11190
11195
  #endif
11191
- `,ft={name:"pbrScene",bindingLayout:[{name:"pbrScene",group:1},{name:"pbr_transmissionFramebufferSampler",group:1}],source:Zs,vs:Rr,fs:Rr,getUniforms:e=>e,uniformTypes:{exposure:"f32",toneMapMode:"i32",environmentIntensity:"f32",environmentRotation:"f32",environmentMipCount:"f32",outputEncoding:"i32",framebufferSize:"vec2<f32>",viewMatrix:"mat4x4<f32>",projectionMatrix:"mat4x4<f32>"},defaultUniforms:{exposure:1,toneMapMode:ei.KHRONOS_PBR_NEUTRAL,environmentIntensity:1,environmentRotation:Math.PI*.5,environmentMipCount:1,outputEncoding:1,framebufferSize:[1,1],viewMatrix:Mr,projectionMatrix:Mr}};var Er={props:{},uniforms:{},defaultUniforms:{unlit:!1,baseColorMapEnabled:!1,baseColorFactor:[1,1,1,1],normalMapEnabled:!1,normalScale:1,emissiveMapEnabled:!1,lightmapMapEnabled:!1,emissiveFactor:[0,0,0],metallicRoughnessValues:[1,1],metallicRoughnessMapEnabled:!1,occlusionMapEnabled:!1,occlusionStrength:1,alphaCutoffEnabled:!1,alphaCutoff:.5,IBLenabled:!1,scaleIBLAmbient:[1,1],scaleDiffBaseMR:[0,0,0,0],scaleFGDSpec:[0,0,0,0],specularColorFactor:[1,1,1],specularIntensityFactor:1,specularColorMapEnabled:!1,specularIntensityMapEnabled:!1,ior:1.5,transmissionFactor:0,transmissionMapEnabled:!1,thicknessFactor:0,attenuationDistance:1e9,attenuationColor:[1,1,1],clearcoatFactor:0,clearcoatRoughnessFactor:0,clearcoatMapEnabled:!1,clearcoatRoughnessMapEnabled:!1,sheenColorFactor:[0,0,0],sheenRoughnessFactor:0,sheenColorMapEnabled:!1,sheenRoughnessMapEnabled:!1,iridescenceFactor:0,iridescenceIor:1.3,iridescenceThicknessRange:[100,400],iridescenceMapEnabled:!1,anisotropyStrength:0,anisotropyRotation:0,anisotropyDirection:[1,0],anisotropyMapEnabled:!1,emissiveStrength:1,lightmapIntensity:1,scatterStrengthFactor:0,dispersion:0,baseColorUVSet:0,baseColorUVTransform:[1,0,0,0,1,0,0,0,1],metallicRoughnessUVSet:0,metallicRoughnessUVTransform:[1,0,0,0,1,0,0,0,1],normalUVSet:0,normalUVTransform:[1,0,0,0,1,0,0,0,1],occlusionUVSet:0,occlusionUVTransform:[1,0,0,0,1,0,0,0,1],emissiveUVSet:0,lightmapUVSet:0,emissiveUVTransform:[1,0,0,0,1,0,0,0,1],lightmapUVTransform:[1,0,0,0,1,0,0,0,1],specularColorUVSet:0,specularColorUVTransform:[1,0,0,0,1,0,0,0,1],specularIntensityUVSet:0,specularIntensityUVTransform:[1,0,0,0,1,0,0,0,1],transmissionUVSet:0,transmissionUVTransform:[1,0,0,0,1,0,0,0,1],thicknessUVSet:0,thicknessUVTransform:[1,0,0,0,1,0,0,0,1],clearcoatUVSet:0,clearcoatUVTransform:[1,0,0,0,1,0,0,0,1],clearcoatRoughnessUVSet:0,clearcoatRoughnessUVTransform:[1,0,0,0,1,0,0,0,1],clearcoatNormalUVSet:0,clearcoatNormalUVTransform:[1,0,0,0,1,0,0,0,1],sheenColorUVSet:0,sheenColorUVTransform:[1,0,0,0,1,0,0,0,1],sheenRoughnessUVSet:0,sheenRoughnessUVTransform:[1,0,0,0,1,0,0,0,1],iridescenceUVSet:0,iridescenceUVTransform:[1,0,0,0,1,0,0,0,1],iridescenceThicknessUVSet:0,iridescenceThicknessUVTransform:[1,0,0,0,1,0,0,0,1],anisotropyUVSet:0,anisotropyUVTransform:[1,0,0,0,1,0,0,0,1],bumpFactor:1,bumpMapEnabled:!1,diffuseTransmissionFactor:0,diffuseTransmissionMapEnabled:!1,diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorMapEnabled:!1,multiscatterColorFactor:[0,0,0],multiscatterColorMapEnabled:!1,scatterAnisotropy:0,bumpUVSet:0,bumpUVTransform:[1,0,0,0,1,0,0,0,1],diffuseTransmissionUVSet:0,diffuseTransmissionUVTransform:[1,0,0,0,1,0,0,0,1],diffuseTransmissionColorUVSet:0,diffuseTransmissionColorUVTransform:[1,0,0,0,1,0,0,0,1],multiscatterColorUVSet:0,multiscatterColorUVTransform:[1,0,0,0,1,0,0,0,1]},name:"pbrMaterial",firstBindingSlot:0,bindingLayout:[{name:"pbrMaterial",group:3},{name:"pbr_baseColorSampler",group:3},{name:"pbr_normalSampler",group:3},{name:"pbr_emissiveSampler",group:3},{name:"pbr_lightmapSampler",group:3},{name:"pbr_metallicRoughnessSampler",group:3},{name:"pbr_occlusionSampler",group:3},{name:"pbr_specularColorSampler",group:3},{name:"pbr_specularIntensitySampler",group:3},{name:"pbr_transmissionSampler",group:3},{name:"pbr_thicknessSampler",group:3},{name:"pbr_clearcoatSampler",group:3},{name:"pbr_clearcoatRoughnessSampler",group:3},{name:"pbr_clearcoatNormalSampler",group:3},{name:"pbr_sheenColorSampler",group:3},{name:"pbr_sheenRoughnessSampler",group:3},{name:"pbr_iridescenceSampler",group:3},{name:"pbr_iridescenceThicknessSampler",group:3},{name:"pbr_anisotropySampler",group:3},{name:"pbr_bumpSampler",group:3},{name:"pbr_diffuseTransmissionSampler",group:3},{name:"pbr_diffuseTransmissionColorSampler",group:3},{name:"pbr_multiscatterColorSampler",group:3}],dependencies:[O,ct,it,Ar,ft],source:Cr,vs:Ir,fs:yr,defines:{LIGHTING_FRAGMENT:!0,HAS_NORMALMAP:!1,HAS_EMISSIVEMAP:!1,HAS_LIGHTMAP:!1,HAS_OCCLUSIONMAP:!1,HAS_BASECOLORMAP:!1,HAS_METALROUGHNESSMAP:!1,HAS_SPECULARCOLORMAP:!1,HAS_SPECULARINTENSITYMAP:!1,HAS_TRANSMISSIONMAP:!1,HAS_THICKNESSMAP:!1,HAS_CLEARCOATMAP:!1,HAS_CLEARCOATROUGHNESSMAP:!1,HAS_CLEARCOATNORMALMAP:!1,HAS_SHEENCOLORMAP:!1,HAS_SHEENROUGHNESSMAP:!1,HAS_IRIDESCENCEMAP:!1,HAS_IRIDESCENCETHICKNESSMAP:!1,HAS_ANISOTROPYMAP:!1,HAS_BUMPMAP:!1,HAS_DIFFUSETRANSMISSIONMAP:!1,HAS_DIFFUSETRANSMISSIONCOLORMAP:!1,HAS_MULTISCATTERCOLORMAP:!1,USE_MATERIAL_EXTENSIONS:!1,ALPHA_CUTOFF:!1,USE_IBL:!1,PBR_DEBUG:!1},getUniforms:e=>e,uniformTypes:{unlit:"i32",baseColorMapEnabled:"i32",baseColorFactor:"vec4<f32>",normalMapEnabled:"i32",normalScale:"f32",emissiveMapEnabled:"i32",emissiveFactor:"vec3<f32>",metallicRoughnessValues:"vec2<f32>",metallicRoughnessMapEnabled:"i32",occlusionMapEnabled:"i32",occlusionStrength:"f32",alphaCutoffEnabled:"i32",alphaCutoff:"f32",specularColorFactor:"vec3<f32>",specularIntensityFactor:"f32",specularColorMapEnabled:"i32",specularIntensityMapEnabled:"i32",ior:"f32",transmissionFactor:"f32",transmissionMapEnabled:"i32",thicknessFactor:"f32",attenuationDistance:"f32",attenuationColor:"vec3<f32>",clearcoatFactor:"f32",clearcoatRoughnessFactor:"f32",clearcoatMapEnabled:"i32",clearcoatRoughnessMapEnabled:"i32",sheenColorFactor:"vec3<f32>",sheenRoughnessFactor:"f32",sheenColorMapEnabled:"i32",sheenRoughnessMapEnabled:"i32",iridescenceFactor:"f32",iridescenceIor:"f32",iridescenceThicknessRange:"vec2<f32>",iridescenceMapEnabled:"i32",anisotropyStrength:"f32",anisotropyRotation:"f32",anisotropyDirection:"vec2<f32>",anisotropyMapEnabled:"i32",emissiveStrength:"f32",dispersion:"f32",IBLenabled:"i32",scaleIBLAmbient:"vec2<f32>",scaleDiffBaseMR:"vec4<f32>",scaleFGDSpec:"vec4<f32>",baseColorUVSet:"i32",baseColorUVTransform:"mat3x3<f32>",metallicRoughnessUVSet:"i32",metallicRoughnessUVTransform:"mat3x3<f32>",normalUVSet:"i32",normalUVTransform:"mat3x3<f32>",occlusionUVSet:"i32",occlusionUVTransform:"mat3x3<f32>",emissiveUVSet:"i32",emissiveUVTransform:"mat3x3<f32>",specularColorUVSet:"i32",specularColorUVTransform:"mat3x3<f32>",specularIntensityUVSet:"i32",specularIntensityUVTransform:"mat3x3<f32>",transmissionUVSet:"i32",transmissionUVTransform:"mat3x3<f32>",thicknessUVSet:"i32",thicknessUVTransform:"mat3x3<f32>",clearcoatUVSet:"i32",clearcoatUVTransform:"mat3x3<f32>",clearcoatRoughnessUVSet:"i32",clearcoatRoughnessUVTransform:"mat3x3<f32>",clearcoatNormalUVSet:"i32",clearcoatNormalUVTransform:"mat3x3<f32>",sheenColorUVSet:"i32",sheenColorUVTransform:"mat3x3<f32>",sheenRoughnessUVSet:"i32",sheenRoughnessUVTransform:"mat3x3<f32>",iridescenceUVSet:"i32",iridescenceUVTransform:"mat3x3<f32>",iridescenceThicknessUVSet:"i32",iridescenceThicknessUVTransform:"mat3x3<f32>",anisotropyUVSet:"i32",anisotropyUVTransform:"mat3x3<f32>",bumpFactor:"f32",bumpMapEnabled:"i32",diffuseTransmissionFactor:"f32",diffuseTransmissionMapEnabled:"i32",diffuseTransmissionColorFactor:"vec3<f32>",diffuseTransmissionColorMapEnabled:"i32",multiscatterColorFactor:"vec3<f32>",multiscatterColorMapEnabled:"i32",scatterAnisotropy:"f32",bumpUVSet:"i32",bumpUVTransform:"mat3x3<f32>",diffuseTransmissionUVSet:"i32",diffuseTransmissionUVTransform:"mat3x3<f32>",diffuseTransmissionColorUVSet:"i32",diffuseTransmissionColorUVTransform:"mat3x3<f32>",multiscatterColorUVSet:"i32",multiscatterColorUVTransform:"mat3x3<f32>",lightmapMapEnabled:"i32",lightmapIntensity:"f32",lightmapUVSet:"i32",lightmapUVTransform:"mat3x3<f32>",scatterStrengthFactor:"f32"}};var q={name:"valueNoise",fs:`
11196
+ `,ut={name:"pbrScene",bindingLayout:[{name:"pbrScene",group:1},{name:"pbr_transmissionFramebufferSampler",group:1}],source:Zs,vs:Pr,fs:Pr,getUniforms:e=>e,uniformTypes:{exposure:"f32",toneMapMode:"i32",environmentIntensity:"f32",environmentRotation:"f32",environmentMipCount:"f32",outputEncoding:"i32",framebufferSize:"vec2<f32>",viewMatrix:"mat4x4<f32>",projectionMatrix:"mat4x4<f32>"},defaultUniforms:{exposure:1,toneMapMode:ni.KHRONOS_PBR_NEUTRAL,environmentIntensity:1,environmentRotation:Math.PI*.5,environmentMipCount:1,outputEncoding:1,framebufferSize:[1,1],viewMatrix:Tr,projectionMatrix:Tr}};var Nr={props:{},uniforms:{},defaultUniforms:{unlit:!1,baseColorMapEnabled:!1,baseColorFactor:[1,1,1,1],normalMapEnabled:!1,normalScale:1,emissiveMapEnabled:!1,lightmapMapEnabled:!1,emissiveFactor:[0,0,0],metallicRoughnessValues:[1,1],metallicRoughnessMapEnabled:!1,occlusionMapEnabled:!1,occlusionStrength:1,alphaCutoffEnabled:!1,alphaCutoff:.5,IBLenabled:!1,scaleIBLAmbient:[1,1],scaleDiffBaseMR:[0,0,0,0],scaleFGDSpec:[0,0,0,0],specularColorFactor:[1,1,1],specularIntensityFactor:1,specularColorMapEnabled:!1,specularIntensityMapEnabled:!1,ior:1.5,transmissionFactor:0,transmissionMapEnabled:!1,thicknessFactor:0,attenuationDistance:1e9,attenuationColor:[1,1,1],clearcoatFactor:0,clearcoatRoughnessFactor:0,clearcoatMapEnabled:!1,clearcoatRoughnessMapEnabled:!1,sheenColorFactor:[0,0,0],sheenRoughnessFactor:0,sheenColorMapEnabled:!1,sheenRoughnessMapEnabled:!1,iridescenceFactor:0,iridescenceIor:1.3,iridescenceThicknessRange:[100,400],iridescenceMapEnabled:!1,anisotropyStrength:0,anisotropyRotation:0,anisotropyDirection:[1,0],anisotropyMapEnabled:!1,emissiveStrength:1,lightmapIntensity:1,scatterStrengthFactor:0,dispersion:0,baseColorUVSet:0,baseColorUVTransform:[1,0,0,0,1,0,0,0,1],metallicRoughnessUVSet:0,metallicRoughnessUVTransform:[1,0,0,0,1,0,0,0,1],normalUVSet:0,normalUVTransform:[1,0,0,0,1,0,0,0,1],occlusionUVSet:0,occlusionUVTransform:[1,0,0,0,1,0,0,0,1],emissiveUVSet:0,lightmapUVSet:0,emissiveUVTransform:[1,0,0,0,1,0,0,0,1],lightmapUVTransform:[1,0,0,0,1,0,0,0,1],specularColorUVSet:0,specularColorUVTransform:[1,0,0,0,1,0,0,0,1],specularIntensityUVSet:0,specularIntensityUVTransform:[1,0,0,0,1,0,0,0,1],transmissionUVSet:0,transmissionUVTransform:[1,0,0,0,1,0,0,0,1],thicknessUVSet:0,thicknessUVTransform:[1,0,0,0,1,0,0,0,1],clearcoatUVSet:0,clearcoatUVTransform:[1,0,0,0,1,0,0,0,1],clearcoatRoughnessUVSet:0,clearcoatRoughnessUVTransform:[1,0,0,0,1,0,0,0,1],clearcoatNormalUVSet:0,clearcoatNormalUVTransform:[1,0,0,0,1,0,0,0,1],sheenColorUVSet:0,sheenColorUVTransform:[1,0,0,0,1,0,0,0,1],sheenRoughnessUVSet:0,sheenRoughnessUVTransform:[1,0,0,0,1,0,0,0,1],iridescenceUVSet:0,iridescenceUVTransform:[1,0,0,0,1,0,0,0,1],iridescenceThicknessUVSet:0,iridescenceThicknessUVTransform:[1,0,0,0,1,0,0,0,1],anisotropyUVSet:0,anisotropyUVTransform:[1,0,0,0,1,0,0,0,1],bumpFactor:1,bumpMapEnabled:!1,diffuseTransmissionFactor:0,diffuseTransmissionMapEnabled:!1,diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorMapEnabled:!1,multiscatterColorFactor:[0,0,0],multiscatterColorMapEnabled:!1,scatterAnisotropy:0,bumpUVSet:0,bumpUVTransform:[1,0,0,0,1,0,0,0,1],diffuseTransmissionUVSet:0,diffuseTransmissionUVTransform:[1,0,0,0,1,0,0,0,1],diffuseTransmissionColorUVSet:0,diffuseTransmissionColorUVTransform:[1,0,0,0,1,0,0,0,1],multiscatterColorUVSet:0,multiscatterColorUVTransform:[1,0,0,0,1,0,0,0,1]},name:"pbrMaterial",firstBindingSlot:0,bindingLayout:[{name:"pbrMaterial",group:3},{name:"pbr_baseColorSampler",group:3},{name:"pbr_normalSampler",group:3},{name:"pbr_emissiveSampler",group:3},{name:"pbr_lightmapSampler",group:3},{name:"pbr_metallicRoughnessSampler",group:3},{name:"pbr_occlusionSampler",group:3},{name:"pbr_specularColorSampler",group:3},{name:"pbr_specularIntensitySampler",group:3},{name:"pbr_transmissionSampler",group:3},{name:"pbr_thicknessSampler",group:3},{name:"pbr_clearcoatSampler",group:3},{name:"pbr_clearcoatRoughnessSampler",group:3},{name:"pbr_clearcoatNormalSampler",group:3},{name:"pbr_sheenColorSampler",group:3},{name:"pbr_sheenRoughnessSampler",group:3},{name:"pbr_iridescenceSampler",group:3},{name:"pbr_iridescenceThicknessSampler",group:3},{name:"pbr_anisotropySampler",group:3},{name:"pbr_bumpSampler",group:3},{name:"pbr_diffuseTransmissionSampler",group:3},{name:"pbr_diffuseTransmissionColorSampler",group:3},{name:"pbr_multiscatterColorSampler",group:3}],dependencies:[O,ft,nt,wr,ut],source:Rr,vs:Ar,fs:Mr,defines:{LIGHTING_FRAGMENT:!0,HAS_NORMALMAP:!1,HAS_EMISSIVEMAP:!1,HAS_LIGHTMAP:!1,HAS_OCCLUSIONMAP:!1,HAS_BASECOLORMAP:!1,HAS_METALROUGHNESSMAP:!1,HAS_SPECULARCOLORMAP:!1,HAS_SPECULARINTENSITYMAP:!1,HAS_TRANSMISSIONMAP:!1,HAS_THICKNESSMAP:!1,HAS_CLEARCOATMAP:!1,HAS_CLEARCOATROUGHNESSMAP:!1,HAS_CLEARCOATNORMALMAP:!1,HAS_SHEENCOLORMAP:!1,HAS_SHEENROUGHNESSMAP:!1,HAS_IRIDESCENCEMAP:!1,HAS_IRIDESCENCETHICKNESSMAP:!1,HAS_ANISOTROPYMAP:!1,HAS_BUMPMAP:!1,HAS_DIFFUSETRANSMISSIONMAP:!1,HAS_DIFFUSETRANSMISSIONCOLORMAP:!1,HAS_MULTISCATTERCOLORMAP:!1,USE_MATERIAL_EXTENSIONS:!1,ALPHA_CUTOFF:!1,USE_IBL:!1,PBR_DEBUG:!1},getUniforms:e=>e,uniformTypes:{unlit:"i32",baseColorMapEnabled:"i32",baseColorFactor:"vec4<f32>",normalMapEnabled:"i32",normalScale:"f32",emissiveMapEnabled:"i32",emissiveFactor:"vec3<f32>",metallicRoughnessValues:"vec2<f32>",metallicRoughnessMapEnabled:"i32",occlusionMapEnabled:"i32",occlusionStrength:"f32",alphaCutoffEnabled:"i32",alphaCutoff:"f32",specularColorFactor:"vec3<f32>",specularIntensityFactor:"f32",specularColorMapEnabled:"i32",specularIntensityMapEnabled:"i32",ior:"f32",transmissionFactor:"f32",transmissionMapEnabled:"i32",thicknessFactor:"f32",attenuationDistance:"f32",attenuationColor:"vec3<f32>",clearcoatFactor:"f32",clearcoatRoughnessFactor:"f32",clearcoatMapEnabled:"i32",clearcoatRoughnessMapEnabled:"i32",sheenColorFactor:"vec3<f32>",sheenRoughnessFactor:"f32",sheenColorMapEnabled:"i32",sheenRoughnessMapEnabled:"i32",iridescenceFactor:"f32",iridescenceIor:"f32",iridescenceThicknessRange:"vec2<f32>",iridescenceMapEnabled:"i32",anisotropyStrength:"f32",anisotropyRotation:"f32",anisotropyDirection:"vec2<f32>",anisotropyMapEnabled:"i32",emissiveStrength:"f32",dispersion:"f32",IBLenabled:"i32",scaleIBLAmbient:"vec2<f32>",scaleDiffBaseMR:"vec4<f32>",scaleFGDSpec:"vec4<f32>",baseColorUVSet:"i32",baseColorUVTransform:"mat3x3<f32>",metallicRoughnessUVSet:"i32",metallicRoughnessUVTransform:"mat3x3<f32>",normalUVSet:"i32",normalUVTransform:"mat3x3<f32>",occlusionUVSet:"i32",occlusionUVTransform:"mat3x3<f32>",emissiveUVSet:"i32",emissiveUVTransform:"mat3x3<f32>",specularColorUVSet:"i32",specularColorUVTransform:"mat3x3<f32>",specularIntensityUVSet:"i32",specularIntensityUVTransform:"mat3x3<f32>",transmissionUVSet:"i32",transmissionUVTransform:"mat3x3<f32>",thicknessUVSet:"i32",thicknessUVTransform:"mat3x3<f32>",clearcoatUVSet:"i32",clearcoatUVTransform:"mat3x3<f32>",clearcoatRoughnessUVSet:"i32",clearcoatRoughnessUVTransform:"mat3x3<f32>",clearcoatNormalUVSet:"i32",clearcoatNormalUVTransform:"mat3x3<f32>",sheenColorUVSet:"i32",sheenColorUVTransform:"mat3x3<f32>",sheenRoughnessUVSet:"i32",sheenRoughnessUVTransform:"mat3x3<f32>",iridescenceUVSet:"i32",iridescenceUVTransform:"mat3x3<f32>",iridescenceThicknessUVSet:"i32",iridescenceThicknessUVTransform:"mat3x3<f32>",anisotropyUVSet:"i32",anisotropyUVTransform:"mat3x3<f32>",bumpFactor:"f32",bumpMapEnabled:"i32",diffuseTransmissionFactor:"f32",diffuseTransmissionMapEnabled:"i32",diffuseTransmissionColorFactor:"vec3<f32>",diffuseTransmissionColorMapEnabled:"i32",multiscatterColorFactor:"vec3<f32>",multiscatterColorMapEnabled:"i32",scatterAnisotropy:"f32",bumpUVSet:"i32",bumpUVTransform:"mat3x3<f32>",diffuseTransmissionUVSet:"i32",diffuseTransmissionUVTransform:"mat3x3<f32>",diffuseTransmissionColorUVSet:"i32",diffuseTransmissionColorUVTransform:"mat3x3<f32>",multiscatterColorUVSet:"i32",multiscatterColorUVTransform:"mat3x3<f32>",lightmapMapEnabled:"i32",lightmapIntensity:"f32",lightmapUVSet:"i32",lightmapUVTransform:"mat3x3<f32>",scatterStrengthFactor:"f32"}};var $={name:"valueNoise",fs:`
11192
11197
  float valueNoise_hash(vec2 cell) {
11193
11198
  vec3 value = fract(vec3(cell.x, cell.y, cell.x) * 0.1031);
11194
11199
  value += dot(value, value.yzx + 33.33);
@@ -11246,7 +11251,7 @@ fn valueNoise_noise3(position: vec3f) -> f32 {
11246
11251
  mix(valueNoise_hash3(cell + vec3f(0.0, 1.0, 1.0)), valueNoise_hash3(cell + vec3f(1.0)), blend.x), blend.y);
11247
11252
  return mix(bottom, top, blend.z);
11248
11253
  }
11249
- `};var ut={name:"heightFogFunctions",dependencies:[q],fs:`
11254
+ `};var pt={name:"heightFogFunctions",dependencies:[$],fs:`
11250
11255
  float heightFog_getRayTransmittance(float rayLength, float cameraHeight, float fragmentHeight, float density, float baseHeight, float heightFalloff) {
11251
11256
  float startHeight = (cameraHeight - baseHeight) * max(heightFalloff, 0.0);
11252
11257
  float endHeight = (fragmentHeight - baseHeight) * max(heightFalloff, 0.0);
@@ -11346,7 +11351,7 @@ fn heightFog_getSpatialTransmittance(camera: vec3f, position: vec3f, upDirection
11346
11351
  return transmittance;
11347
11352
  }
11348
11353
 
11349
- `};var wr={name:"heightFog",dependencies:[ut],bindingLayout:[{name:"heightFog",group:3}],uniformTypes:{color:"vec3<f32>",density:"f32",baseHeight:"f32",heightFalloff:"f32",variation:"f32",wispScale:"f32",velocity:"vec3<f32>",time:"f32",evolutionSpeed:"f32"},defaultUniforms:{color:[.65,.72,.78],density:0,baseHeight:0,heightFalloff:.01,variation:0,wispScale:160,velocity:[0,0,0],time:0,evolutionSpeed:0},getUniforms(e={}){return e},fs:`
11354
+ `};var Dr={name:"heightFog",dependencies:[pt],bindingLayout:[{name:"heightFog",group:3}],uniformTypes:{color:"vec3<f32>",density:"f32",baseHeight:"f32",heightFalloff:"f32",variation:"f32",wispScale:"f32",velocity:"vec3<f32>",time:"f32",evolutionSpeed:"f32"},defaultUniforms:{color:[.65,.72,.78],density:0,baseHeight:0,heightFalloff:.01,variation:0,wispScale:160,velocity:[0,0,0],time:0,evolutionSpeed:0},getUniforms(e={}){return e},fs:`
11350
11355
  layout(std140) uniform heightFogUniforms {
11351
11356
  vec3 color;
11352
11357
  float density;
@@ -11385,7 +11390,7 @@ fn heightFog_getTransmittance(position: vec3<f32>, cameraPosition: vec3<f32>) ->
11385
11390
  fn heightFog_getColor(color: vec4<f32>, position: vec3<f32>, cameraPosition: vec3<f32>) -> vec4<f32> {
11386
11391
  return vec4<f32>(mix(heightFog.color, color.rgb, heightFog_getTransmittance(position, cameraPosition)), color.a);
11387
11392
  }
11388
- `};var Tr=`
11393
+ `};var Fr=`
11389
11394
  layout(std140) uniform patternFillUniforms {
11390
11395
  int patternType;
11391
11396
  float spacing;
@@ -11426,7 +11431,7 @@ float patternFill_getCoverage(vec2 coordinates) {
11426
11431
  if (patternFill.patternType == 1) return first + second - first * second;
11427
11432
  return first;
11428
11433
  }
11429
- `,Pr=`
11434
+ `,Or=`
11430
11435
  struct patternFillUniforms {
11431
11436
  patternType: i32,
11432
11437
  spacing: f32,
@@ -11466,7 +11471,7 @@ fn patternFill_getCoverage(coordinates: vec2<f32>) -> f32 {
11466
11471
  if (patternFill.patternType == 1) { return first + second - first * second; }
11467
11472
  return first;
11468
11473
  }
11469
- `;var ti={patternType:0,spacing:8,width:.12,angle:Math.PI/4,offset:[0,0]},Nr={name:"patternFill",firstBindingSlot:0,bindingLayout:[{name:"patternFill",group:3}],source:Pr,fs:Tr,uniformTypes:{patternType:"i32",spacing:"f32",width:"f32",angle:"f32",offset:"vec2<f32>"},defaultUniforms:ti,getUniforms(e={},t=ti){let i={...ti,...t};return e.pattern!==void 0&&(i.patternType={hatch:0,crosshatch:1,dots:2}[e.pattern]),e.spacing!==void 0&&(i.spacing=Math.max(e.spacing,1e-4)),e.width!==void 0&&(i.width=Math.min(1,Math.max(0,e.width))),e.angle!==void 0&&(i.angle=e.angle),e.offset!==void 0&&(i.offset=e.offset),i}};var ii={coreRadius:.12,coreIntensity:1,haloIntensity:.6,falloff:5},Dr={name:"pointGlow",firstBindingSlot:0,bindingLayout:[{name:"pointGlow",group:3}],uniformTypes:{coreRadius:"f32",coreIntensity:"f32",haloIntensity:"f32",falloff:"f32"},defaultUniforms:ii,getUniforms(e={},t=ii){let i={...ii,...t};return e.coreRadius!==void 0&&(i.coreRadius=Math.min(1,Math.max(0,e.coreRadius))),e.coreIntensity!==void 0&&(i.coreIntensity=Math.max(0,e.coreIntensity)),e.haloIntensity!==void 0&&(i.haloIntensity=Math.max(0,e.haloIntensity)),e.falloff!==void 0&&(i.falloff=Math.max(.01,e.falloff)),i},fs:`
11474
+ `;var ri={patternType:0,spacing:8,width:.12,angle:Math.PI/4,offset:[0,0]},Br={name:"patternFill",firstBindingSlot:0,bindingLayout:[{name:"patternFill",group:3}],source:Or,fs:Fr,uniformTypes:{patternType:"i32",spacing:"f32",width:"f32",angle:"f32",offset:"vec2<f32>"},defaultUniforms:ri,getUniforms(e={},t=ri){let i={...ri,...t};return e.pattern!==void 0&&(i.patternType={hatch:0,crosshatch:1,dots:2}[e.pattern]),e.spacing!==void 0&&(i.spacing=Math.max(e.spacing,1e-4)),e.width!==void 0&&(i.width=Math.min(1,Math.max(0,e.width))),e.angle!==void 0&&(i.angle=e.angle),e.offset!==void 0&&(i.offset=e.offset),i}};var oi={coreRadius:.12,coreIntensity:1,haloIntensity:.6,falloff:5},Ur={name:"pointGlow",firstBindingSlot:0,bindingLayout:[{name:"pointGlow",group:3}],uniformTypes:{coreRadius:"f32",coreIntensity:"f32",haloIntensity:"f32",falloff:"f32"},defaultUniforms:oi,getUniforms(e={},t=oi){let i={...oi,...t};return e.coreRadius!==void 0&&(i.coreRadius=Math.min(1,Math.max(0,e.coreRadius))),e.coreIntensity!==void 0&&(i.coreIntensity=Math.max(0,e.coreIntensity)),e.haloIntensity!==void 0&&(i.haloIntensity=Math.max(0,e.haloIntensity)),e.falloff!==void 0&&(i.falloff=Math.max(.01,e.falloff)),i},fs:`
11470
11475
  layout(std140) uniform pointGlowUniforms {
11471
11476
  float coreRadius;
11472
11477
  float coreIntensity;
@@ -11506,7 +11511,7 @@ fn pointGlow_getColor(coordinates: vec2<f32>, tint: vec3<f32>) -> vec3<f32> {
11506
11511
  let halo = max(0.0, (exp(-pointGlow.falloff * radius * radius) - outer) / (1.0 - outer));
11507
11512
  return (vec3<f32>(core * pointGlow.coreIntensity) + tint * halo * pointGlow.haloIntensity) * envelope;
11508
11513
  }
11509
- `};var Fr={name:"precipitation",bindingLayout:[{name:"precipitation",group:3}],uniformTypes:{time:"f32",fallSpeed:"f32",turbulence:"f32",seed:"f32",volumeCenter:"vec3<f32>",volumeSize:"vec3<f32>",wind:"vec2<f32>"},defaultUniforms:{time:0,fallSpeed:20,turbulence:0,seed:29,volumeCenter:[0,0,150],volumeSize:[1200,1600,300],wind:[2,0]},getUniforms(e={}){return e},vs:`
11514
+ `};var kr={name:"precipitation",bindingLayout:[{name:"precipitation",group:3}],uniformTypes:{time:"f32",fallSpeed:"f32",turbulence:"f32",seed:"f32",volumeCenter:"vec3<f32>",volumeSize:"vec3<f32>",wind:"vec2<f32>"},defaultUniforms:{time:0,fallSpeed:20,turbulence:0,seed:29,volumeCenter:[0,0,150],volumeSize:[1200,1600,300],wind:[2,0]},getUniforms(e={}){return e},vs:`
11510
11515
  layout(std140) uniform precipitationUniforms {
11511
11516
  float time;
11512
11517
  float fallSpeed;
@@ -11569,7 +11574,7 @@ fn precipitation_getFade(position: vec3<f32>) -> f32 {
11569
11574
  let edge = 0.5 - abs((position - precipitation.volumeCenter) / max(precipitation.volumeSize, vec3<f32>(0.001)));
11570
11575
  return smoothstep(0.0, 0.08, min(edge.x, min(edge.y, edge.z)));
11571
11576
  }
11572
- `};var ni={cover:.45,altitude:1e3,thickness:1200,scale:1400,density:.005,time:0,velocity:[14,4],sunDirection:[0,.8,.6],sunColor:[1,.95,.85]},pt={name:"clouds",dependencies:[q],uniformTypes:{cover:"f32",altitude:"f32",thickness:"f32",scale:"f32",density:"f32",time:"f32",velocity:"vec2<f32>",sunDirection:"vec3<f32>",sunColor:"vec3<f32>"},defaultUniforms:ni,getUniforms(e={},t=ni){return{...ni,...t,...e}},fs:`
11577
+ `};var ai={cover:.45,altitude:1e3,thickness:1200,scale:1400,density:.005,time:0,velocity:[14,4],sunDirection:[0,.8,.6],sunColor:[1,.95,.85]},dt={name:"clouds",dependencies:[$],uniformTypes:{cover:"f32",altitude:"f32",thickness:"f32",scale:"f32",density:"f32",time:"f32",velocity:"vec2<f32>",sunDirection:"vec3<f32>",sunColor:"vec3<f32>"},defaultUniforms:ai,getUniforms(e={},t=ai){return{...ai,...t,...e}},fs:`
11573
11578
  layout(std140) uniform cloudsUniforms {
11574
11579
  float cover;
11575
11580
  float altitude;
@@ -11720,7 +11725,7 @@ fn clouds_getColor(camera: vec3f, rayDirection: vec3f) -> vec4f {
11720
11725
  let distanceFade = 1.0 - smoothstep(10000.0, 20000.0, start);
11721
11726
  return vec4f(radiance, 1.0 - transmittance) * distanceFade;
11722
11727
  }
11723
- `};var ri={enabled:1,sunDirection:[0,.8,.6],sunIntensity:20,haze:1,rayleigh:1,planetRadius:6371e3,exposure:1,groundColor:[.18,.17,.14]},Or={name:"atmosphere",uniformTypes:{enabled:"f32",sunDirection:"vec3<f32>",sunIntensity:"f32",haze:"f32",rayleigh:"f32",planetRadius:"f32",exposure:"f32",groundColor:"vec3<f32>"},defaultUniforms:ri,getUniforms(e={},t=ri){return{...ri,...t,...e}},fs:`
11728
+ `};var si={enabled:1,sunDirection:[0,.8,.6],sunIntensity:20,haze:1,rayleigh:1,planetRadius:6371e3,exposure:1,groundColor:[.18,.17,.14]},Gr={name:"atmosphere",uniformTypes:{enabled:"f32",sunDirection:"vec3<f32>",sunIntensity:"f32",haze:"f32",rayleigh:"f32",planetRadius:"f32",exposure:"f32",groundColor:"vec3<f32>"},defaultUniforms:si,getUniforms(e={},t=si){return{...si,...t,...e}},fs:`
11724
11729
  layout(std140) uniform atmosphereUniforms {
11725
11730
  float enabled;
11726
11731
  vec3 sunDirection;
@@ -11912,7 +11917,7 @@ fn atmosphere_getColor(color: vec4f,
11912
11917
  var scattering: vec3f = vec3f(1.0) - exp(-scatteringSample.radiance * atmosphere.exposure);
11913
11918
  return vec4f(color.rgb * scatteringSample.transmittance + scattering, color.a);
11914
11919
  }
11915
- `};function Br(e,t,i){function n(r,o,a){let s=Math.max(o,0)+Math.max(a,0),l=Math.min(1,Math.max(0,r));if(s===0||i<=0)return l;let c=Math.max(o,0)/s;return c+(l-c)*Math.exp(-s*Math.max(i,0))}return{wetness:n(e.wetness,t.rainfall,t.evaporation),snow:n(e.snow,t.snowfall,t.snowmelt)}}var oi={wetness:0,snow:0,puddles:.8,scale:20,snowColor:[.9,.94,.98],skyColor:[.48,.6,.72]},Ur={name:"surfaceWeather",dependencies:[q],uniformTypes:{wetness:"f32",snow:"f32",puddles:"f32",scale:"f32",snowColor:"vec3<f32>",skyColor:"vec3<f32>"},defaultUniforms:oi,getUniforms(e={},t=oi){return{...oi,...t,...e}},fs:`
11920
+ `};function zr(e,t,i){function n(r,o,a){let s=Math.max(o,0)+Math.max(a,0),l=Math.min(1,Math.max(0,r));if(s===0||i<=0)return l;let c=Math.max(o,0)/s;return c+(l-c)*Math.exp(-s*Math.max(i,0))}return{wetness:n(e.wetness,t.rainfall,t.evaporation),snow:n(e.snow,t.snowfall,t.snowmelt)}}var li={wetness:0,snow:0,puddles:.8,scale:20,snowColor:[.9,.94,.98],skyColor:[.48,.6,.72]},Vr={name:"surfaceWeather",dependencies:[$],uniformTypes:{wetness:"f32",snow:"f32",puddles:"f32",scale:"f32",snowColor:"vec3<f32>",skyColor:"vec3<f32>"},defaultUniforms:li,getUniforms(e={},t=li){return{...li,...t,...e}},fs:`
11916
11921
  layout(std140) uniform surfaceWeatherUniforms {
11917
11922
  float wetness;
11918
11923
  float snow;
@@ -12036,7 +12041,7 @@ fn surfaceWeather_getReflection(position: vec3f,
12036
12041
  var highlight: f32 = pow(max(dot(surfaceNormal, halfway), 0.0), mix(36.0, 160.0, puddle)) * max(dot(surfaceNormal, normalize(lightDirection)), 0.0);
12037
12042
  return wetness * (surfaceWeather.skyColor * fresnel * (0.15 + puddle * 0.85) + lightColor * highlight * 0.6);
12038
12043
  }
12039
- `};var ai={enabled:0,time:0,radius:8,speed:.6,pulse:.85},kr={name:"firefly",uniformTypes:{enabled:"f32",time:"f32",radius:"f32",speed:"f32",pulse:"f32"},defaultUniforms:ai,getUniforms(e={},t=ai){return{...ai,...t,...e}},source:`struct FireflyUniforms {enabled: f32, time: f32, radius: f32, speed: f32, pulse: f32};
12044
+ `};var ci={enabled:0,time:0,radius:8,speed:.6,pulse:.85},Hr={name:"firefly",uniformTypes:{enabled:"f32",time:"f32",radius:"f32",speed:"f32",pulse:"f32"},defaultUniforms:ci,getUniforms(e={},t=ci){return{...ci,...t,...e}},source:`struct FireflyUniforms {enabled: f32, time: f32, radius: f32, speed: f32, pulse: f32};
12040
12045
  @group(3) @binding(auto) var<uniform> firefly: FireflyUniforms;
12041
12046
  fn firefly_getPosition(position: vec3f, seed: f32, time: f32) -> vec3f {
12042
12047
  if (firefly.enabled <= 0.0) { return position; }
@@ -12073,7 +12078,7 @@ fn surfaceWeather_getReflection(position: vec3f,
12073
12078
  float phase = seed * 2.399963;
12074
12079
  float pulse = pow(0.5 + 0.5 * sin(time * firefly.speed * (1.6 + fract(seed * 0.37)) + phase), 3.0);
12075
12080
  return mix(1.0, mix(0.08, 1.0, pulse), firefly.pulse * firefly.enabled);
12076
- }`};var Gr={name:"globeClouds",dependencies:[pt],uniformTypes:{planetRadius:"f32"},defaultUniforms:{planetRadius:6370972},fs:`
12081
+ }`};var Wr={name:"globeClouds",dependencies:[dt],uniformTypes:{planetRadius:"f32"},defaultUniforms:{planetRadius:6370972},fs:`
12077
12082
  layout(std140) uniform globeCloudsUniforms { float planetRadius; } globeClouds;
12078
12083
  vec2 globeClouds_intersectSphere(vec3 camera, vec3 direction, float radius) {
12079
12084
  float projected = dot(camera, direction);
@@ -12175,6 +12180,6 @@ fn globeClouds_getColor(camera: vec3f, direction: vec3f) -> vec4f {
12175
12180
  }
12176
12181
  return vec4f(radiance, 1.0 - transmittance);
12177
12182
  }
12178
- `};return jr(Xs);})();
12183
+ `};return Zr(Xs);})();
12179
12184
  return __exports__;
12180
12185
  });