@luma.gl/core 9.0.11 → 9.0.14
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.
- package/LICENSE +34 -0
- package/dist/adapter/device.js +1 -1
- package/dist/dist.dev.js +4 -3
- package/dist/dist.min.js +4 -4
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +2 -2
- package/dist/init.js +1 -1
- package/dist/lib/luma.js +1 -1
- package/package.json +2 -2
- package/src/adapter/device.ts +1 -1
- package/src/lib/luma.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
luma.gl is provided under the MIT license
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 vis.gl contributors
|
|
4
|
+
|
|
5
|
+
This software includes parts initially developed by Uber and open sourced under MIT license.
|
|
6
|
+
Copyright (c) 2015 Uber Technologies, Inc.
|
|
7
|
+
|
|
8
|
+
This software includes parts of PhiloGL (https://github.com/philogb/philogl)
|
|
9
|
+
under MIT license. PhiloGL parts Copyright © 2013 Sencha Labs.
|
|
10
|
+
|
|
11
|
+
This software includes adaptations of some postprocessing code from
|
|
12
|
+
THREE.js (https://github.com/mrdoob/three.js/) under MIT license.
|
|
13
|
+
THREE.js parts Copyright © 2010-2018 three.js authors.
|
|
14
|
+
|
|
15
|
+
Additional attribution given in specific source files.
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in
|
|
25
|
+
all copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
33
|
+
THE SOFTWARE.
|
|
34
|
+
|
package/dist/adapter/device.js
CHANGED
|
@@ -38,7 +38,7 @@ export class Device {
|
|
|
38
38
|
height: 600,
|
|
39
39
|
requestMaxLimits: true,
|
|
40
40
|
debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)
|
|
41
|
-
spector: Boolean(log.get('spector')), // Initialize the SpectorJS WebGL debugger
|
|
41
|
+
spector: Boolean(log.get('spector') || log.get('spectorjs')), // Initialize the SpectorJS WebGL debugger
|
|
42
42
|
break: [],
|
|
43
43
|
// TODO - Change these after confirming things work as expected
|
|
44
44
|
initalizeFeatures: true,
|
package/dist/dist.dev.js
CHANGED
|
@@ -1346,7 +1346,7 @@ var __exports__ = (() => {
|
|
|
1346
1346
|
requestMaxLimits: true,
|
|
1347
1347
|
debug: Boolean(log.get("debug")),
|
|
1348
1348
|
// Instrument context (at the expense of performance)
|
|
1349
|
-
spector: Boolean(log.get("spector")),
|
|
1349
|
+
spector: Boolean(log.get("spector") || log.get("spectorjs")),
|
|
1350
1350
|
// Initialize the SpectorJS WebGL debugger
|
|
1351
1351
|
break: [],
|
|
1352
1352
|
// TODO - Change these after confirming things work as expected
|
|
@@ -1376,7 +1376,7 @@ var __exports__ = (() => {
|
|
|
1376
1376
|
|
|
1377
1377
|
// src/lib/luma.ts
|
|
1378
1378
|
var deviceMap = /* @__PURE__ */ new Map();
|
|
1379
|
-
var
|
|
1379
|
+
var _luma = class {
|
|
1380
1380
|
static registerDevices(deviceClasses) {
|
|
1381
1381
|
for (const deviceClass of deviceClasses) {
|
|
1382
1382
|
assert2(deviceClass.type && deviceClass.isSupported && deviceClass.create);
|
|
@@ -1413,7 +1413,7 @@ var __exports__ = (() => {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
/** Creates a device. Asynchronously. */
|
|
1415
1415
|
static async createDevice(props = {}) {
|
|
1416
|
-
props = { ...
|
|
1416
|
+
props = { ..._luma.defaultProps, ...props };
|
|
1417
1417
|
if (props.gl) {
|
|
1418
1418
|
props.type = "webgl";
|
|
1419
1419
|
}
|
|
@@ -1468,6 +1468,7 @@ var __exports__ = (() => {
|
|
|
1468
1468
|
};
|
|
1469
1469
|
}
|
|
1470
1470
|
};
|
|
1471
|
+
var luma = _luma;
|
|
1471
1472
|
__publicField(luma, "defaultProps", {
|
|
1472
1473
|
...Device.defaultProps,
|
|
1473
1474
|
type: "best-available",
|
package/dist/dist.min.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
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 et=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Me=Object.prototype.hasOwnProperty;var $e=(r,t,e)=>t in r?et(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Ne=(r,t)=>{for(var e in t)et(r,e,{get:t[e],enumerable:!0})},Fe=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Re(t))!Me.call(r,o)&&o!==e&&et(r,o,{get:()=>t[o],enumerable:!(n=Ie(t,o))||n.enumerable});return r};var De=r=>Fe(et({},"__esModule",{value:!0}),r);var u=(r,t,e)=>($e(r,typeof t!="symbol"?t+"":t,e),e);var Cr={};Ne(Cr,{Buffer:()=>m,CanvasContext:()=>U,CommandBuffer:()=>q,CommandEncoder:()=>X,ComputePass:()=>Y,ComputePipeline:()=>j,Device:()=>b,DeviceFeatures:()=>ct,DeviceLimits:()=>ut,ExternalTexture:()=>k,Framebuffer:()=>V,QuerySet:()=>J,RenderPass:()=>W,RenderPipeline:()=>O,Resource:()=>c,Sampler:()=>z,Shader:()=>H,StatsManager:()=>N,Texture:()=>h,TextureView:()=>G,TransformFeedback:()=>Z,UniformBlock:()=>M,UniformBufferLayout:()=>R,UniformStore:()=>pt,VERSION:()=>it,VertexArray:()=>Q,assert:()=>I,cancelAnimationFrame:()=>Le,cast:()=>xe,checkProps:()=>Te,decodeShaderAttributeType:()=>mt,decodeShaderUniformType:()=>dt,decodeTextureFormat:()=>ne,decodeVertexFormat:()=>K,deepEqual:()=>yt,fillArray:()=>de,formatCompilerLog:()=>lt,formatValue:()=>Ht,getAttributeInfosFromLayouts:()=>Nt,getDataTypeFromTypedArray:()=>Gt,getScratchArray:()=>me,getScratchArrayBuffer:()=>tt,getTypedArrayFromDataType:()=>ye,getVertexFormatFromAttribute:()=>be,glsl:()=>Pr,isNumberArray:()=>y,isObjectEmpty:()=>te,isTypedArray:()=>xt,isUniformValue:()=>kt,loadFile:()=>ve,loadImage:()=>_e,loadImageBitmap:()=>Ee,loadScript:()=>Pe,log:()=>l,luma:()=>E,makeRandomNumberGenerator:()=>zt,mergeShaderLayout:()=>fe,random:()=>Ce,requestAnimationFrame:()=>Be,setPathPrefix:()=>Ae,splitUniformsAndBindings:()=>we,stubRemovedMethods:()=>Se,uid:()=>S});function bt(r){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,e=r||t;return!!(e&&e.indexOf("Electron")>=0)}function d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||bt()}var Ue=globalThis.self||globalThis.window||globalThis.global,_=globalThis.window||globalThis.self||globalThis.global,Ge=globalThis.document||{},T=globalThis.process||{},ke=globalThis.console,Mr=globalThis.navigator||{};var rt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Fr=d();function He(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var nt=class{constructor(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=He(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}};function Wt(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function jt(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}function ot(r,t,e){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=r.src.replace(/\(/g,"%28").replace(/\)/g,"%29");r.width>n&&(e=Math.min(e,n/r.width));let s=r.width*e,i=r.height*e,a=["font-size:1px;",`padding:${Math.floor(i/2)}px ${Math.floor(s/2)}px;`,`line-height:${i}px;`,`background:url(${o});`,`background-size:${s}px ${i}px;`,"color:transparent;"].join("");return[`${t} %c+`,a]}var st;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(st||(st={}));var ze=10;function Yt(r){return typeof r!="string"?r:(r=r.toUpperCase(),st[r]||st.WHITE)}function Xt(r,t,e){return!d&&typeof r=="string"&&(t&&(r=`\x1B[${Yt(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Yt(e)+ze}m${r}\x1B[49m`)),r}function qt(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],e=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(e),o=r;for(let s of n){let i=o[s];typeof i=="function"&&(t.find(a=>s===a)||(o[s]=i.bind(r)))}}function P(r,t){if(!r)throw new Error(t||"Assertion failed")}function A(){let r;if(d()&&_.performance){var t,e;r=_===null||_===void 0||(t=_.performance)===null||t===void 0||(e=t.now)===null||e===void 0?void 0:e.call(t)}else if("hrtime"in T){var n;let o=T===null||T===void 0||(n=T.hrtime)===null||n===void 0?void 0:n.call(T);r=o[0]*1e3+o[1]/1e6}else r=Date.now();return r}var C={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ve={enabled:!0,level:0};function p(){}var Kt={},Qt={once:!0},w=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=rt,this._startTs=A(),this._deltaTs=A(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new nt(`__probe-${this.id}__`,Ve),this.timeStamp(`${this.id} started`),qt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((A()-this._startTs).toPrecision(10))}getDelta(){return Number((A()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){P(t,e)}warn(t){return this._getLogFunction(0,t,C.warn,arguments,Qt)}error(t){return this._getLogFunction(0,t,C.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,C.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,C.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,C.debug||C.info,arguments,Qt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||p,n&&[n],{tag:Ye(e)}):p}image(t){let{logLevel:e,priority:n,image:o,message:s="",scale:i=1}=t;return this._shouldLog(e||n)?d()?je({image:o,message:s,scale:i}):We({image:o,message:s,scale:i}):p}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||p)}group(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Zt({logLevel:t,message:e,opts:n}),{collapsed:s}=n;return o.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||p)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Jt(t)}_getLogFunction(t,e,n,o,s){if(this._shouldLog(t)){s=Zt({logLevel:t,message:e,args:o,opts:s}),n=n||s.method,P(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=A();let i=s.tag||s.message;if(s.once&&i)if(!Kt[i])Kt[i]=A();else return p;return e=Oe(this.id,s.message,s),n.bind(console,e,...s.args)}return p}};w.VERSION=rt;function Jt(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return P(Number.isFinite(t)&&t>=0),t}function Zt(r){let{logLevel:t,message:e}=r;r.logLevel=Jt(t);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&n.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let o=typeof r.message;return P(o==="string"||o==="object"),Object.assign(r,{args:n},r.opts)}function Oe(r,t,e){if(typeof t=="string"){let n=e.time?jt(Wt(e.total)):"";t=e.time?`${r}: ${n} ${t}`:`${r}: ${t}`,t=Xt(t,e.color,e.background)}return t}function We(r){let{image:t,message:e="",scale:n=1}=r;return console.warn("removed"),p}function je(r){let{image:t,message:e="",scale:n=1}=r;if(typeof t=="string"){let s=new Image;return s.onload=()=>{let i=ot(s,e,n);console.log(...i)},s.src=t,p}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...ot(t,e,n)),p;if(o.toLowerCase()==="canvas"){let s=new Image;return s.onload=()=>console.log(...ot(s,e,n)),s.src=t.toDataURL(),p}return p}function Ye(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}var un=new w({id:"@probe.gl/log"});var l=new w({id:"luma.gl"});function $(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var v=class{constructor(t,e){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=$(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime($()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var B=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:n}=t,o=this.stats[e];return o||(t instanceof v?o=t:o=new v(e,n),this.stats[e]=o),o}};var N=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new B({id:t})),this.stats.get(t)}},L=new N;function Xe(){let r="9.0.11",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==r)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${r}`);return globalThis.luma||(d()&&l.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:l,stats:L}),r}var it=Xe();function xt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function y(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:xt(r)}var wt={};function S(r="id"){wt[r]=wt[r]||1;let t=wt[r]++;return`${r}-${t}`}function te(r){let t=!0;for(let e in r){t=!1;break}return t}var c=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,n){if(!t)throw new Error("no device");this._device=t,this.props=qe(e,n);let o=this.props.id!=="undefined"?this.props.id:S(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t,e=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}};u(c,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function qe(r,t){let e={...t};for(let n in r)r[n]!==void 0&&(e[n]=r[n]);return e}var F=class extends c{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let n={...e};(e.usage||0)&F.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?n.indexType="uint32":e.data instanceof Uint16Array&&(n.indexType="uint16")),super(t,n,F.defaultProps),this.usage=e.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,n){let o=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:n,F.DEBUG_DATA_MAX_LENGTH);t===null?this.debugData=new ArrayBuffer(s):e===0&&n===t.byteLength?this.debugData=o.slice(0,s):this.debugData=o.slice(e,e+s)}},m=F;u(m,"defaultProps",{...c.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),u(m,"MAP_READ",1),u(m,"MAP_WRITE",2),u(m,"COPY_SRC",4),u(m,"COPY_DST",8),u(m,"INDEX",16),u(m,"VERTEX",32),u(m,"UNIFORM",64),u(m,"STORAGE",128),u(m,"INDIRECT",256),u(m,"QUERY_RESOLVE",512),u(m,"DEBUG_DATA_MAX_LENGTH",32);function at(r){let t=ee[r],e=Ke(t),n=r.includes("norm"),o=!n&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:ee[r],byteLength:e,integer:o,signed:s,normalized:n}}function Ke(r){return Qe[r]}var ee={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Qe={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Ze=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Je=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function re(r){return Ze.some(t=>r.startsWith(t))}function ne(r){let t=Je.exec(r);if(t){let[,e,n,o,s,i]=t;if(e){let a=`${o}${n}`,f=at(a);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...f}}}return er(r)}var tr={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function er(r){let t=tr[r];if(!t)throw new Error(`Unknown format ${r}`);return{format:t.format||"",components:t.components||t.format?.length||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}var ut=class{},ct=class{features;disabledFeatures;constructor(t=[],e){this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}},St=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...St.defaultProps,...t},this.id=this.props.id||S(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=L;_lumaData={};isTextureFormatCompressed(t){return re(t)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||typeof t=="string")&&(t={data:t}),this._createTexture(t)}createCommandEncoder(t={}){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e={...t};return(t.usage||0)&m.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":l.warn("indices buffer content must be of integer type")()),e}},b=St;u(b,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(l.get("debug")),spector:Boolean(l.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>l.error(t.message)}),u(b,"VERSION",it);function I(r,t){if(!r)throw new Error(t||"luma.gl: assertion failed.")}var D=new Map,E=class{static registerDevices(t){for(let e of t)I(e.type&&e.isSupported&&e.create),D.set(e.type,e)}static getAvailableDevices(){return Array.from(D).map(t=>t.type)}static getSupportedDevices(){return Array.from(D).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(b.defaultProps,t)}static async attachDevice(t){let e=oe(t.devices)||D;if(t.handle instanceof WebGL2RenderingContext){let n=e.get("webgl");if(n)return await n.attach(t.handle)}if(t.handle===null){let n=e.get("unknown");if(n)return await n.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(t={}){t={...b.defaultProps,...t},t.gl&&(t.type="webgl");let e=oe(t.devices)||D;switch(t.type){case"webgpu":let n=e.get("webgpu");if(n)return await n.create(t);break;case"webgl":let o=e.get("webgl");if(o)return await o.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(n=e.get("webgpu"),n?.isSupported?.())return await n.create(t);if(o=e.get("webgl"),o?.isSupported?.())return await o.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(n,o){return n==="webgl"||n==="experimental-webgl"?this.originalGetContext("webgl2",o):this.originalGetContext(n,o)}}};u(E,"defaultProps",{...b.defaultProps,type:"best-available",devices:void 0}),u(E,"stats",L),u(E,"log",l);function oe(r){if(!r||r?.length===0)return null;let t=new Map;for(let e of r)t.set(e.type,e);return t}var rr=d()&&typeof document<"u",ft=()=>rr&&document.readyState==="complete",nr={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},U=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ft()}constructor(t){if(this.props={...nr,...t},t=this.props,!d()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=ir(t.canvas):this.canvas=t.canvas;else{let e=ar(t),n=sr(t?.container||null);n.insertBefore(e,n.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let n of e)n.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t,e=!0){let n=this.cssToDeviceRatio(),[o,s]=this.getDrawingBufferSize();return ur(t,n,o,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let n="width"in e?e.width:this.htmlCanvas.clientWidth,o="height"in e?e.height:this.htmlCanvas.clientHeight;(!n||!o)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,n=this.htmlCanvas.width||1,o=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==n||s.clientHeight!==o||s.devicePixelRatio!==t){let i=t,a=Math.floor(n*i),f=Math.floor(o*i);this.htmlCanvas.width=a,this.htmlCanvas.height=f;let[g,x]=this.getDrawingBufferSize();(g!==a||x!==f)&&(i=Math.min(g/n,x/o),this.htmlCanvas.width=Math.floor(n*i),this.htmlCanvas.height=Math.floor(o*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=o,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}};u(U,"pageLoaded",or());function or(){return ft()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function sr(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ft())throw new Error(`Accessing '${r}' before page was loaded`);if(!t)throw new Error(`${r} is not an HTML element`);return t}else if(r)return r;return document.body}function ir(r){let t=document.getElementById(r);if(!t&&!ft())throw new Error(`Accessing '${r}' before page was loaded`);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function ar(r){let{width:t,height:e}=r,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=e||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(e)?`${e}px`:"100%",n}function ur(r,t,e,n,o){let s=r,i=se(s[0],t,e),a=ie(s[1],t,n,o),f=se(s[0]+1,t,e),g=f===e-1?f:f-1;f=ie(s[1]+1,t,n,o);let x;return o?(f=f===0?f:f+1,x=a,a=f):x=f===n-1?f:f-1,{x:i,y:a,width:Math.max(g-i+1,1),height:Math.max(x-a+1,1)}}function se(r,t,e){return Math.min(Math.round(r*t),e-1)}function ie(r,t,e,n){return n?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var Tt=class extends c{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e,n=Tt.defaultProps){super(t,e,n),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=t.incrementTimestamp()}},h=Tt;u(h,"defaultProps",{...c.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),u(h,"COPY_SRC",1),u(h,"COPY_DST",2),u(h,"TEXTURE_BINDING",4),u(h,"STORAGE_BINDING",8),u(h,"RENDER_ATTACHMENT",16);var At=class extends c{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,At.defaultProps)}},G=At;u(G,"defaultProps",{...c.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var vt=class extends c{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,vt.defaultProps)}},k=vt;u(k,"defaultProps",{...c.defaultProps,source:null,colorSpace:"srgb"});function lt(r,t,e){let n="",o=t.split(/\r?\n/),s=r.slice().sort((i,a)=>i.lineNum-a.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let a=1;a<=o.length;a++)for(n+=ue(o[a-1],a,e);s.length>i&&s[i].lineNum===a;){let f=s[i++];n+=ae(f,o,f.lineNum,{...e,inlineSource:!1})}return n;case"issues":case"no":for(let a of r)n+=ae(a,o,a.lineNum,{inlineSource:e?.showSourceCode!=="no"});return n}}function ae(r,t,e,n){if(n?.inlineSource){let o=cr(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
|
|
7
|
+
"use strict";var __exports__=(()=>{var et=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var Ne=(r,t,e)=>t in r?et(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Fe=(r,t)=>{for(var e in t)et(r,e,{get:t[e],enumerable:!0})},De=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Me(t))!$e.call(r,o)&&o!==e&&et(r,o,{get:()=>t[o],enumerable:!(n=Re(t,o))||n.enumerable});return r};var Ue=r=>De(et({},"__esModule",{value:!0}),r);var u=(r,t,e)=>(Ne(r,typeof t!="symbol"?t+"":t,e),e);var Br={};Fe(Br,{Buffer:()=>m,CanvasContext:()=>U,CommandBuffer:()=>q,CommandEncoder:()=>X,ComputePass:()=>Y,ComputePipeline:()=>j,Device:()=>x,DeviceFeatures:()=>ct,DeviceLimits:()=>ut,ExternalTexture:()=>k,Framebuffer:()=>V,QuerySet:()=>J,RenderPass:()=>W,RenderPipeline:()=>O,Resource:()=>c,Sampler:()=>z,Shader:()=>H,StatsManager:()=>N,Texture:()=>h,TextureView:()=>G,TransformFeedback:()=>Z,UniformBlock:()=>M,UniformBufferLayout:()=>R,UniformStore:()=>pt,VERSION:()=>it,VertexArray:()=>Q,assert:()=>I,cancelAnimationFrame:()=>Ie,cast:()=>we,checkProps:()=>Ae,decodeShaderAttributeType:()=>mt,decodeShaderUniformType:()=>dt,decodeTextureFormat:()=>oe,decodeVertexFormat:()=>K,deepEqual:()=>yt,fillArray:()=>he,formatCompilerLog:()=>lt,formatValue:()=>zt,getAttributeInfosFromLayouts:()=>Ft,getDataTypeFromTypedArray:()=>kt,getScratchArray:()=>de,getScratchArrayBuffer:()=>tt,getTypedArrayFromDataType:()=>be,getVertexFormatFromAttribute:()=>xe,glsl:()=>Cr,isNumberArray:()=>y,isObjectEmpty:()=>ee,isTypedArray:()=>xt,isUniformValue:()=>Ht,loadFile:()=>Ee,loadImage:()=>Pe,loadImageBitmap:()=>_e,loadScript:()=>Ce,log:()=>l,luma:()=>E,makeRandomNumberGenerator:()=>Vt,mergeShaderLayout:()=>le,random:()=>Be,requestAnimationFrame:()=>Le,setPathPrefix:()=>ve,splitUniformsAndBindings:()=>Se,stubRemovedMethods:()=>Te,uid:()=>S});function bt(r){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,e=r||t;return!!(e&&e.indexOf("Electron")>=0)}function d(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||bt()}var Ge=globalThis.self||globalThis.window||globalThis.global,_=globalThis.window||globalThis.self||globalThis.global,ke=globalThis.document||{},T=globalThis.process||{},He=globalThis.console,$r=globalThis.navigator||{};var rt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Dr=d();function ze(r){try{let t=window[r],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}var nt=class{constructor(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=ze(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){let e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}};function jt(r){let t;return r<10?t=`${r.toFixed(2)}ms`:r<100?t=`${r.toFixed(1)}ms`:r<1e3?t=`${r.toFixed(0)}ms`:t=`${(r/1e3).toFixed(2)}s`,t}function Yt(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,e=Math.max(t-r.length,0);return`${" ".repeat(e)}${r}`}function ot(r,t,e){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=r.src.replace(/\(/g,"%28").replace(/\)/g,"%29");r.width>n&&(e=Math.min(e,n/r.width));let s=r.width*e,i=r.height*e,a=["font-size:1px;",`padding:${Math.floor(i/2)}px ${Math.floor(s/2)}px;`,`line-height:${i}px;`,`background:url(${o});`,`background-size:${s}px ${i}px;`,"color:transparent;"].join("");return[`${t} %c+`,a]}var st;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(st||(st={}));var Ve=10;function Xt(r){return typeof r!="string"?r:(r=r.toUpperCase(),st[r]||st.WHITE)}function qt(r,t,e){return!d&&typeof r=="string"&&(t&&(r=`\x1B[${Xt(t)}m${r}\x1B[39m`),e&&(r=`\x1B[${Xt(e)+Ve}m${r}\x1B[49m`)),r}function Kt(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],e=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(e),o=r;for(let s of n){let i=o[s];typeof i=="function"&&(t.find(a=>s===a)||(o[s]=i.bind(r)))}}function P(r,t){if(!r)throw new Error(t||"Assertion failed")}function A(){let r;if(d()&&_.performance){var t,e;r=_===null||_===void 0||(t=_.performance)===null||t===void 0||(e=t.now)===null||e===void 0?void 0:e.call(t)}else if("hrtime"in T){var n;let o=T===null||T===void 0||(n=T.hrtime)===null||n===void 0?void 0:n.call(T);r=o[0]*1e3+o[1]/1e6}else r=Date.now();return r}var C={debug:d()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Oe={enabled:!0,level:0};function p(){}var Qt={},Zt={once:!0},w=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=rt,this._startTs=A(),this._deltaTs=A(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new nt(`__probe-${this.id}__`,Oe),this.timeStamp(`${this.id} started`),Kt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((A()-this._startTs).toPrecision(10))}getDelta(){return Number((A()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){P(t,e)}warn(t){return this._getLogFunction(0,t,C.warn,arguments,Zt)}error(t){return this._getLogFunction(0,t,C.error,arguments)}deprecated(t,e){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${e}\` instead`)}removed(t,e){return this.error(`\`${t}\` has been removed. Use \`${e}\` instead`)}probe(t,e){return this._getLogFunction(t,e,C.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,C.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,C.debug||C.info,arguments,Zt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||p,n&&[n],{tag:Xe(e)}):p}image(t){let{logLevel:e,priority:n,image:o,message:s="",scale:i=1}=t;return this._shouldLog(e||n)?d()?Ye({image:o,message:s,scale:i}):je({image:o,message:s,scale:i}):p}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||p)}group(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Jt({logLevel:t,message:e,opts:n}),{collapsed:s}=n;return o.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||p)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=te(t)}_getLogFunction(t,e,n,o,s){if(this._shouldLog(t)){s=Jt({logLevel:t,message:e,args:o,opts:s}),n=n||s.method,P(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=A();let i=s.tag||s.message;if(s.once&&i)if(!Qt[i])Qt[i]=A();else return p;return e=We(this.id,s.message,s),n.bind(console,e,...s.args)}return p}};w.VERSION=rt;function te(r){if(!r)return 0;let t;switch(typeof r){case"number":t=r;break;case"object":t=r.logLevel||r.priority||0;break;default:return 0}return P(Number.isFinite(t)&&t>=0),t}function Jt(r){let{logLevel:t,message:e}=r;r.logLevel=te(t);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&n.unshift(e),r.message=t;break;case"object":Object.assign(r,t);break;default:}typeof r.message=="function"&&(r.message=r.message());let o=typeof r.message;return P(o==="string"||o==="object"),Object.assign(r,{args:n},r.opts)}function We(r,t,e){if(typeof t=="string"){let n=e.time?Yt(jt(e.total)):"";t=e.time?`${r}: ${n} ${t}`:`${r}: ${t}`,t=qt(t,e.color,e.background)}return t}function je(r){let{image:t,message:e="",scale:n=1}=r;return console.warn("removed"),p}function Ye(r){let{image:t,message:e="",scale:n=1}=r;if(typeof t=="string"){let s=new Image;return s.onload=()=>{let i=ot(s,e,n);console.log(...i)},s.src=t,p}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...ot(t,e,n)),p;if(o.toLowerCase()==="canvas"){let s=new Image;return s.onload=()=>console.log(...ot(s,e,n)),s.src=t.toDataURL(),p}return p}function Xe(r){for(let t in r)for(let e in r[t])return e||"untitled";return"empty"}var cn=new w({id:"@probe.gl/log"});var l=new w({id:"luma.gl"});function $(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();r=t[0]*1e3+t[1]/1e6}else r=Date.now();return r}var v=class{constructor(t,e){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=$(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime($()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var B=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let e of Object.values(this.stats))t(e)}getTable(){let t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(e=>this._getOrCreate(e))}_getOrCreate(t){let{name:e,type:n}=t,o=this.stats[e];return o||(t instanceof v?o=t:o=new v(e,n),this.stats[e]=o),o}};var N=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new B({id:t})),this.stats.get(t)}},L=new N;function qe(){let r="9.0.14",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==r)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${r}`);return globalThis.luma||(d()&&l.log(1,`${r} - ${t}`)(),globalThis.luma=globalThis.luma||{VERSION:r,version:r,log:l,stats:L}),r}var it=qe();function xt(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)?r:null}function y(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number"?r:null:xt(r)}var wt={};function S(r="id"){wt[r]=wt[r]||1;let t=wt[r]++;return`${r}-${t}`}function ee(r){let t=!0;for(let e in r){t=!1;break}return t}var c=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,e,n){if(!t)throw new Error("no device");this._device=t,this.props=Ke(e,n);let o=this.props.id!=="undefined"?this.props.id:S(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get(`${e}s Active`).decrementCount()}trackAllocatedMemory(t,e=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.get(`${e} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let e=this._device.statsManager.getStats("Resource Counts");e.get("GPU Memory").subtractCount(this.allocatedBytes),e.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),e=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${e}s Created`).incrementCount(),t.get(`${e}s Active`).incrementCount()}};u(c,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Ke(r,t){let e={...t};for(let n in r)r[n]!==void 0&&(e[n]=r[n]);return e}var F=class extends c{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,e){let n={...e};(e.usage||0)&F.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?n.indexType="uint32":e.data instanceof Uint16Array&&(n.indexType="uint16")),super(t,n,F.defaultProps),this.usage=e.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}readSyncWebGL(t,e){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(t,e,n){let o=ArrayBuffer.isView(t)?t.buffer:t,s=Math.min(t?t.byteLength:n,F.DEBUG_DATA_MAX_LENGTH);t===null?this.debugData=new ArrayBuffer(s):e===0&&n===t.byteLength?this.debugData=o.slice(0,s):this.debugData=o.slice(e,e+s)}},m=F;u(m,"defaultProps",{...c.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),u(m,"MAP_READ",1),u(m,"MAP_WRITE",2),u(m,"COPY_SRC",4),u(m,"COPY_DST",8),u(m,"INDEX",16),u(m,"VERTEX",32),u(m,"UNIFORM",64),u(m,"STORAGE",128),u(m,"INDIRECT",256),u(m,"QUERY_RESOLVE",512),u(m,"DEBUG_DATA_MAX_LENGTH",32);function at(r){let t=re[r],e=Qe(t),n=r.includes("norm"),o=!n&&!r.startsWith("float"),s=r.startsWith("s");return{dataType:re[r],byteLength:e,integer:o,signed:s,normalized:n}}function Qe(r){return Ze[r]}var re={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Ze={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Je=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],tr=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function ne(r){return Je.some(t=>r.startsWith(t))}function oe(r){let t=tr.exec(r);if(t){let[,e,n,o,s,i]=t;if(e){let a=`${o}${n}`,f=at(a);return{format:e,components:e.length,srgb:s==="-srgb",unsized:i==="-unsized",webgl:i==="-webgl",...f}}}return rr(r)}var er={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function rr(r){let t=er[r];if(!t)throw new Error(`Unknown format ${r}`);return{format:t.format||"",components:t.components||t.format?.length||1,byteLength:t.bpp||1,srgb:!1,unsized:!1}}var ut=class{},ct=class{features;disabledFeatures;constructor(t=[],e){this.features=new Set(t),this.disabledFeatures=e||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures[t]&&this.features.has(t)}},St=class{get[Symbol.toStringTag](){return"Device"}constructor(t){this.props={...St.defaultProps,...t},this.id=this.props.id||S(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=L;_lumaData={};isTextureFormatCompressed(t){return ne(t)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(t){return(t instanceof Promise||typeof t=="string")&&(t={data:t}),this._createTexture(t)}createCommandEncoder(t={}){throw new Error("not implemented")}readPixelsToArrayWebGL(t,e){throw new Error("not implemented")}readPixelsToBufferWebGL(t,e){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,e){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(t){this.props.onError(t)}_getBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e={...t};return(t.usage||0)&m.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?e.indexType="uint32":t.data instanceof Uint16Array?e.indexType="uint16":l.warn("indices buffer content must be of integer type")()),e}},x=St;u(x,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(l.get("debug")),spector:Boolean(l.get("spector")||l.get("spectorjs")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:t=>l.error(t.message)}),u(x,"VERSION",it);function I(r,t){if(!r)throw new Error(t||"luma.gl: assertion failed.")}var D=new Map,Tt=class{static registerDevices(t){for(let e of t)I(e.type&&e.isSupported&&e.create),D.set(e.type,e)}static getAvailableDevices(){return Array.from(D).map(t=>t.type)}static getSupportedDevices(){return Array.from(D).filter(t=>t.isSupported()).map(t=>t.type)}static setDefaultDeviceProps(t){Object.assign(x.defaultProps,t)}static async attachDevice(t){let e=se(t.devices)||D;if(t.handle instanceof WebGL2RenderingContext){let n=e.get("webgl");if(n)return await n.attach(t.handle)}if(t.handle===null){let n=e.get("unknown");if(n)return await n.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(t={}){t={...Tt.defaultProps,...t},t.gl&&(t.type="webgl");let e=se(t.devices)||D;switch(t.type){case"webgpu":let n=e.get("webgpu");if(n)return await n.create(t);break;case"webgl":let o=e.get("webgl");if(o)return await o.create(t);break;case"unknown":let s=e.get("unknown");if(s)return await s.create(t);break;case"best-available":if(n=e.get("webgpu"),n?.isSupported?.())return await n.create(t);if(o=e.get("webgl"),o?.isSupported?.())return await o.create(t);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(n,o){return n==="webgl"||n==="experimental-webgl"?this.originalGetContext("webgl2",o):this.originalGetContext(n,o)}}},E=Tt;u(E,"defaultProps",{...x.defaultProps,type:"best-available",devices:void 0}),u(E,"stats",L),u(E,"log",l);function se(r){if(!r||r?.length===0)return null;let t=new Map;for(let e of r)t.set(e.type,e);return t}var nr=d()&&typeof document<"u",ft=()=>nr&&document.readyState==="complete",or={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},U=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return ft()}constructor(t){if(this.props={...or,...t},t=this.props,!d()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(t.canvas)typeof t.canvas=="string"?this.canvas=ar(t.canvas):this.canvas=t.canvas;else{let e=ur(t),n=ir(t?.container||null);n.insertBefore(e,n.firstChild),this.canvas=e,t?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&t.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let n of e)n.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(t){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(t=t===void 0?this.props.useDevicePixels:t,!t||t<=0)?1:t===!0?typeof window<"u"&&window.devicePixelRatio||1:t}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let t=this.getDevicePixelRatio(),e=this.canvas;return e.parentElement?[e.clientWidth*t,e.clientHeight*t]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[t,e]=this.getPixelSize();return t/e}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),{clientWidth:e}=this._canvasSizeInfo;return e?t/e:1}catch{return 1}}cssToDevicePixels(t,e=!0){let n=this.cssToDeviceRatio(),[o,s]=this.getDrawingBufferSize();return cr(t,n,o,s,e)}setDevicePixelRatio(t,e={}){if(!this.htmlCanvas)return;let n="width"in e?e.width:this.htmlCanvas.clientWidth,o="height"in e?e.height:this.htmlCanvas.clientHeight;(!n||!o)&&(l.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,n=this.htmlCanvas.width||1,o=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==n||s.clientHeight!==o||s.devicePixelRatio!==t){let i=t,a=Math.floor(n*i),f=Math.floor(o*i);this.htmlCanvas.width=a,this.htmlCanvas.height=f;let[g,b]=this.getDrawingBufferSize();(g!==a||b!==f)&&(i=Math.min(g/n,b/o),this.htmlCanvas.width=Math.floor(n*i),this.htmlCanvas.height=Math.floor(o*i),l.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=o,this._canvasSizeInfo.devicePixelRatio=t}}getDrawingBufferSize(){let t=this.device.gl;if(!t)throw new Error("canvas size");return[t.drawingBufferWidth,t.drawingBufferHeight]}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}};u(U,"pageLoaded",sr());function sr(){return ft()||typeof window>"u"?Promise.resolve():new Promise(r=>{window.addEventListener("load",()=>r())})}function ir(r){if(typeof r=="string"){let t=document.getElementById(r);if(!t&&!ft())throw new Error(`Accessing '${r}' before page was loaded`);if(!t)throw new Error(`${r} is not an HTML element`);return t}else if(r)return r;return document.body}function ar(r){let t=document.getElementById(r);if(!t&&!ft())throw new Error(`Accessing '${r}' before page was loaded`);if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function ur(r){let{width:t,height:e}=r,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=e||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(e)?`${e}px`:"100%",n}function cr(r,t,e,n,o){let s=r,i=ie(s[0],t,e),a=ae(s[1],t,n,o),f=ie(s[0]+1,t,e),g=f===e-1?f:f-1;f=ae(s[1]+1,t,n,o);let b;return o?(f=f===0?f:f+1,b=a,a=f):b=f===n-1?f:f-1,{x:i,y:a,width:Math.max(g-i+1,1),height:Math.max(b-a+1,1)}}function ie(r,t,e){return Math.min(Math.round(r*t),e-1)}function ae(r,t,e,n){return n?Math.max(0,e-1-Math.round(r*t)):Math.min(Math.round(r*t),e-1)}var At=class extends c{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(t,e,n=At.defaultProps){super(t,e,n),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=t.incrementTimestamp()}},h=At;u(h,"defaultProps",{...c.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),u(h,"COPY_SRC",1),u(h,"COPY_DST",2),u(h,"TEXTURE_BINDING",4),u(h,"STORAGE_BINDING",8),u(h,"RENDER_ATTACHMENT",16);var vt=class extends c{get[Symbol.toStringTag](){return"TextureView"}constructor(t,e){super(t,e,vt.defaultProps)}},G=vt;u(G,"defaultProps",{...c.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var Et=class extends c{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(t,e){super(t,e,Et.defaultProps)}},k=Et;u(k,"defaultProps",{...c.defaultProps,source:null,colorSpace:"srgb"});function lt(r,t,e){let n="",o=t.split(/\r?\n/),s=r.slice().sort((i,a)=>i.lineNum-a.lineNum);switch(e?.showSourceCode||"no"){case"all":let i=0;for(let a=1;a<=o.length;a++)for(n+=ce(o[a-1],a,e);s.length>i&&s[i].lineNum===a;){let f=s[i++];n+=ue(f,o,f.lineNum,{...e,inlineSource:!1})}return n;case"issues":case"no":for(let a of r)n+=ue(a,o,a.lineNum,{inlineSource:e?.showSourceCode!=="no"});return n}}function ue(r,t,e,n){if(n?.inlineSource){let o=fr(t,e),s=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
|
|
8
8
|
`:"";return`
|
|
9
9
|
${o}${s}${r.type.toUpperCase()}: ${r.message}
|
|
10
10
|
|
|
11
|
-
`}return n?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function
|
|
12
|
-
`}`}function
|
|
11
|
+
`}return n?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function fr(r,t,e){let n="";for(let o=t-2;o<=t;o++){let s=r[o-1];s!==void 0&&(n+=ce(s,t,e))}return n}function ce(r,t,e){let n=e?.html?mr(r):r;return`${lr(String(t),4)}: ${n}${e?.html?"<br/>":`
|
|
12
|
+
`}`}function lr(r,t){let e="";for(let n=r.length;n<t;++n)e+=" ";return e+r}function mr(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function _t(r,t){return{name:dr(r,t),language:"glsl",version:hr(r)}}function dr(r,t="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return n?n[1]:t}function hr(r){let t=100,e=r.match(/[^\s]+/g);if(e&&e.length>=2&&e[0]==="#version"){let n=parseInt(e[1],10);Number.isFinite(n)&&(t=n)}return t}var Pt=class extends c{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(t,e){super(t,{id:pr(e),...e},Pt.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(t=this.props.debug){switch(t){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let e=await this.getCompilationInfo();this.props.debug==="warnings"&&e?.length===0||this._displayShaderLog(e)}_displayShaderLog(t){if(typeof document>"u"||!document?.createElement)return;let e=_t(this.source).name,n=`${this.stage} ${e}`,o=lt(t,this.source,{showSourceCode:"all",html:!0}),s=this.getTranslatedSource();s&&(o+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${s}</pre></code>`);let i=document.createElement("Button");i.innerHTML=`
|
|
13
13
|
<h1>Shader Compilation Error in ${n}</h1><br /><br />
|
|
14
14
|
<code style="user-select:text;"><pre>
|
|
15
15
|
${o}
|
|
16
|
-
</pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i);let a=document.getElementsByClassName("luma-compiler-log-error");a[0]?.scrollIntoView&&a[0].scrollIntoView(),i.onclick=()=>{let f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}},H=_t;u(H,"defaultProps",{...c.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function hr(r){return Et(r.source).name||r.id||S(`unnamed ${r.stage}-shader`)}var Pt=class extends c{get[Symbol.toStringTag](){return"Sampler"}constructor(t,e){super(t,e,Pt.defaultProps)}},z=Pt;u(z,"defaultProps",{...c.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var Ct=class extends c{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(t,e={}){super(t,e,Ct.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(t){let e=!t;if(t){let[n,o]=Array.isArray(t)?t:[t.width,t.height];e=e||o!==this.height||n!==this.width,this.width=n,this.height=o}e&&(l.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(e=>{if(typeof e=="string"){let n=this.createColorTexture(e);return this.attachResource(n),n.view}return e instanceof h?e.view:e});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let e=this.createDepthStencilTexture(t);this.attachResource(e),this.depthStencilAttachment=e.view}else t instanceof h?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t){return this.device.createTexture({id:"color-attachment",usage:h.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}createDepthStencilTexture(t){return this.device.createTexture({id:"depth-stencil-attachment",usage:h.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,e){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let o=this.device._createTexture({...this.colorAttachments[n].props,width:t,height:e});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=o.view,this.attachResource(o.view)}if(this.depthStencilAttachment){let n=this.device._createTexture({...this.depthStencilAttachment.props,width:t,height:e});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}}},V=Ct;u(V,"defaultProps",{...c.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Bt=class extends c{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,e){super(t,e,Bt.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(t){throw new Error("Use uniform blocks")}},O=Bt;u(O,"defaultProps",{...c.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var Lt=class extends c{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,e){super(t,e,Lt.defaultProps)}},W=Lt;u(W,"defaultProps",{...c.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var It=class extends c{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(t,e){super(t,e,It.defaultProps)}},j=It;u(j,"defaultProps",{...c.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Rt=class extends c{get[Symbol.toStringTag](){return"ComputePass"}constructor(t,e){super(t,e,Rt.defaultProps)}},Y=Rt;u(Y,"defaultProps",{...c.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Mt=class extends c{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,e){super(t,e,Mt.defaultProps)}},X=Mt;u(X,"defaultProps",{...c.defaultProps,measureExecutionTime:void 0});var $t=class extends c{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,e){super(t,e,$t.defaultProps)}},q=$t;u(q,"defaultProps",{...c.defaultProps});function mt(r){let[t,e]=gr[r],n=t==="i32"||t==="u32",o=t!=="u32",s=yr[t]*e,i=pr(t,e);return{dataType:t,components:e,defaultVertexFormat:i,byteLength:s,integer:n,signed:o}}function pr(r,t){let e;switch(r){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?e:`${e}x${t}`}var gr={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]},yr={f32:4,f16:2,i32:4,u32:4};function K(r){let t;r.endsWith("-webgl")&&(r.replace("-webgl",""),t=!0);let[e,n]=r.split("x"),o=e,s=n?parseInt(n):1,i=at(o),a={type:o,components:s,byteLength:i.byteLength*s,integer:i.integer,signed:i.signed,normalized:i.normalized};return t&&(a.webglOnly=!0),a}function Nt(r,t){let e={};for(let n of r.attributes)e[n.name]=br(r,t,n.name);return e}function ce(r,t,e=16){let n=Nt(r,t),o=new Array(e).fill(null);for(let s of Object.values(n))o[s.location]=s;return o}function br(r,t,e){let n=xr(r,e),o=wr(t,e);if(!n)return null;let s=mt(n.type),i=o?.vertexFormat||s.defaultVertexFormat,a=K(i);return{attributeName:o?.attributeName||n.name,bufferName:o?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:i,bufferDataType:a.type,bufferComponents:a.components,normalized:a.normalized,integer:s.integer,stepMode:o?.stepMode||n.stepMode,byteOffset:o?.byteOffset||0,byteStride:o?.byteStride||0}}function xr(r,t){let e=r.attributes.find(n=>n.name===t);return e||l.warn(`shader layout attribute "${t}" not present in shader`),e||null}function wr(r,t){Sr(r);let e=Tr(r,t);return e||(e=Ar(r,t),e)?e:(l.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function Sr(r){for(let t of r)(t.attributes&&t.format||!t.attributes&&!t.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Tr(r,t){for(let e of r)if(e.format&&e.name===t)return{attributeName:e.name,bufferName:t,stepMode:e.stepMode,vertexFormat:e.format,byteOffset:0,byteStride:e.byteStride||0};return null}function Ar(r,t){for(let e of r){let n=e.byteStride;if(typeof e.byteStride!="number")for(let s of e.attributes||[]){let i=K(s.format);n+=i.byteLength}let o=e.attributes?.find(s=>s.attribute===t);if(o)return{attributeName:o.attribute,bufferName:e.name,stepMode:e.stepMode,vertexFormat:o.format,byteOffset:o.byteOffset,byteStride:n}}return null}function fe(r,t){let e={...r,attributes:r.attributes.map(n=>({...n}))};for(let n of t?.attributes||[]){let o=e.attributes.find(s=>s.name===n.name);o?(o.type=n.type||o.type,o.stepMode=n.stepMode||o.stepMode):l.warn(`shader layout attribute ${n.name} not present in shader`)}return e}var Ft=class extends c{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,e){super(t,e,Ft.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=ce(e.renderPipeline.shaderLayout,e.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,e){throw new Error("constant attributes not supported")}},Q=Ft;u(Q,"defaultProps",{...c.defaultProps,renderPipeline:null});var Dt=class extends c{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,e){super(t,e,Dt.defaultProps)}},Z=Dt;u(Z,"defaultProps",{...c.defaultProps,layout:void 0,buffers:{}});var Ut=class extends c{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,e){super(t,e,Ut.defaultProps)}},J=Ut;u(J,"defaultProps",{...c.defaultProps,type:void 0,count:void 0});var vr={f32:{type:"f32",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<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}};function dt(r){let t=vr[r];return I(r),t}function le(r,t){switch(t){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var ht;function tt(r){return(!ht||ht.byteLength<r)&&(ht=new ArrayBuffer(r)),ht}function me(r,t){let e=tt(r.BYTES_PER_ELEMENT*t);return new r(e,0,t)}function de(r){let{target:t,source:e,start:n=0,count:o=1}=r,s=e.length,i=o*s,a=0;for(let f=n;a<s;a++)t[f++]=e[a];for(;a<i;)a<i-a?(t.copyWithin(n+a,n,n+a),a*=2):(t.copyWithin(n+a,n,n+i-a),a=i);return r.target}var he=1024,R=class{layout={};byteLength;constructor(t){let e=0;for(let[o,s]of Object.entries(t)){let i=dt(s),{type:a,components:f}=i;e=le(e,f);let g=e;e+=f,this.layout[o]={type:a,size:f,offset:g}}e+=(4-e%4)%4;let n=e*4;this.byteLength=Math.max(n,he)}getData(t){let e=Math.max(this.byteLength,he),n=tt(e),o={i32:new Int32Array(n),u32:new Uint32Array(n),f32:new Float32Array(n),f16:new Uint16Array(n)};for(let[s,i]of Object.entries(t)){let a=this.layout[s];if(!a){l.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:f,size:g,offset:x}=a,Vt=o[f];if(g===1){if(typeof i!="number"&&typeof i!="boolean"){l.warn(`Supplied value for single component uniform ${s} is not a number: ${i}`)();continue}Vt[x]=Number(i)}else{let Ot=y(i);if(!Ot){l.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${i}`)();continue}Vt.set(Ot,x)}}return new Uint8Array(n)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}};function pe(r,t,e=16){if(r!==t)return!1;let n=y(r);if(!n)return!1;let o=y(t);if(o&&n.length===o.length){for(let s=0;s<n.length;++s)if(o[s]!==n[s])return!1}return!0}function ge(r){let t=y(r);return t?t.slice():r}var M=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name,t?.name&&t?.shaderLayout){let e=t?.shaderLayout.bindings?.find(o=>o.type==="uniform"&&o.name===t?.name);if(!e)throw new Error(t?.name);let n=e;for(let o of n.uniforms||[])this.bindingLayout[o.name]=o}}setUniforms(t){for(let[e,n]of Object.entries(t))this._setUniform(e,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${e}=${n}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,e){pe(this.uniforms[t],e)||(this.uniforms[t]=ge(e),this.modifiedUniforms[t]=!0,this.modified=!0)}};var pt=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(t){for(let[e,n]of Object.entries(t)){let o=e,s=new R(n.uniformTypes||{});this.uniformBufferLayouts.set(o,s);let i=new M({name:e});i.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(o,i)}}destroy(){for(let t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(let[e,n]of Object.entries(t))this.uniformBlocks.get(e).setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t).byteLength}getUniformBufferData(t){let e=this.uniformBlocks.get(t).getAllUniforms();return this.uniformBufferLayouts.get(t).getData(e)}createUniformBuffer(t,e,n){n&&this.setUniforms(n);let o=this.getUniformBufferByteLength(e),s=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:o}),i=this.getUniformBufferData(e);return s.write(i),s}getManagedUniformBuffer(t,e){if(!this.uniformBuffers.get(e)){let n=this.getUniformBufferByteLength(e),o=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:n});this.uniformBuffers.set(e,o)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let t=!1;for(let e of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(e);t||=n}return t&&l.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){let e=this.uniformBlocks.get(t),n=this.uniformBuffers.get(t),o=!1;if(n&&e.needsRedraw){o||=e.needsRedraw;let s=this.getUniformBufferData(t);this.uniformBuffers.get(t).write(s);let a=this.uniformBlocks.get(t).getAllUniforms();l.log(4,`Writing to uniform buffer ${String(t)}`,s,a)()}return o}};function Gt(r){let t=ArrayBuffer.isView(r)?r.constructor:r;switch(t){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(t.constructor.name)}}function ye(r){switch(r){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(r)}}function be(r,t,e){if(!t||t>4)throw new Error(`size ${t}`);let n=t,o=Gt(r);if(o==="uint8"||o==="sint8"){if(n===1||n===3)throw new Error(`size: ${t}`);return e&&(o=o.replace("int","norm")),`${o}x${n}`}if(o==="uint16"||o==="sint16"){if(n===1||n===3)throw new Error(`size: ${t}`);return e&&(o=o.replace("int","norm")),`${o}x${n}`}return n===1?o:`${o}x${n}`}function xe(r){return r}function kt(r){return y(r)!==null||typeof r=="number"||typeof r=="boolean"}function we(r){let t={bindings:{},uniforms:{}};return Object.keys(r).forEach(e=>{let n=r[e];kt(n)?t.uniforms[e]=n:t.bindings[e]=n}),t}function Er(r,t={}){let{maxElts:e=16,size:n=1}=t,o="[";for(let i=0;i<r.length&&i<e;++i)i>0&&(o+=`,${i%n===0?" ":""}`),o+=Ht(r[i],t);let s=r.length>e?"...":"]";return`${o}${s}`}function Ht(r,t={}){let{isInteger:n=!1}=t;if(Array.isArray(r)||ArrayBuffer.isView(r))return Er(r,t);if(typeof r!="number")return String(r);if(Math.abs(r)<1e-16)return n?"0":"0.";if(n||Math.abs(r)>100&&Math.abs(r)<1e4)return r.toFixed(0);let o=r.toPrecision(2);return o.indexOf(".0")===o.length-2?o.slice(0,-1):o}function Se(r,t,e,n){let o=`See luma.gl ${e} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);n.forEach(i=>{s.methodName||(s[i]=()=>{throw l.removed(`Calling removed method ${t}.${i}: `,o)(),new Error(i)})})}function Te(r,t,e){let{removedProps:n={},deprecatedProps:o={},replacedProps:s={}}=e;for(let a in n)if(a in t){let g=n[a]?`${r}.${n[a]}`:"N/A";l.removed(`${r}.${a}`,g)()}for(let a in o)if(a in t){let f=o[a];l.deprecated(`${r}.${a}`,`${r}.${f}`)()}let i=null;for(let[a,f]of Object.entries(s))a in t&&(l.deprecated(`${r}.${a}`,`${r}.${f}`)(),i=i||Object.assign({},t),i[f]=t[a],delete i[a]);return i||t}var gt="";function Ae(r){gt=r}async function ve(r,t){r=r.startsWith("http")?r:gt+r;let e=t?.dataType||"text";return await(await fetch(r,t))[e]()}async function Ee(r,t){let e=new Image;return e.crossOrigin=t?.crossOrigin||"anonymous",e.src=r.startsWith("http")?r:gt+r,await e.decode(),await createImageBitmap(e)}async function _e(r,t){return await new Promise((e,n)=>{try{let o=new Image;o.onload=()=>e(o),o.onerror=()=>n(new Error(`Could not load image ${r}.`)),o.crossOrigin=t?.crossOrigin||"anonymous",o.src=r.startsWith("http")?r:gt+r}catch(o){n(o)}})}async function Pe(r,t){let e=document.getElementsByTagName("head")[0];if(!e)throw new Error("loadScript");let n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",r),t&&(n.id=t),new Promise((o,s)=>{n.onload=o,n.onerror=i=>s(new Error(`Unable to load script '${r}': ${i}`)),e.appendChild(n)})}function zt(){let r=1,t=1;return()=>(r=Math.sin(t*17.23),t=Math.cos(r*27.92),_r(Math.abs(r*t)*1432.71))}function _r(r){return r-Math.floor(r)}var Ce=zt();function yt(r,t,e){if(r===t)return!0;if(!e||!r||!t)return!1;if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!yt(r[n],t[n],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof r=="object"&&typeof t=="object"){let n=Object.keys(r),o=Object.keys(t);if(n.length!==o.length)return!1;for(let s of n)if(!t.hasOwnProperty(s)||!yt(r[s],t[s],e-1))return!1;return!0}return!1}function Be(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Le(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var Pr=r=>`${r}`;return De(Cr);})();
|
|
16
|
+
</pre></code>`,i.style.top="10px",i.style.left="10px",i.style.position="absolute",i.style.zIndex="9999",i.style.width="100%",i.style.textAlign="left",document.body.appendChild(i);let a=document.getElementsByClassName("luma-compiler-log-error");a[0]?.scrollIntoView&&a[0].scrollIntoView(),i.onclick=()=>{let f=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(f)}}},H=Pt;u(H,"defaultProps",{...c.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function pr(r){return _t(r.source).name||r.id||S(`unnamed ${r.stage}-shader`)}var Ct=class extends c{get[Symbol.toStringTag](){return"Sampler"}constructor(t,e){super(t,e,Ct.defaultProps)}},z=Ct;u(z,"defaultProps",{...c.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var Bt=class extends c{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(t,e={}){super(t,e,Bt.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(t){let e=!t;if(t){let[n,o]=Array.isArray(t)?t:[t.width,t.height];e=e||o!==this.height||n!==this.width,this.width=n,this.height=o}e&&(l.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(e=>{if(typeof e=="string"){let n=this.createColorTexture(e);return this.attachResource(n),n.view}return e instanceof h?e.view:e});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let e=this.createDepthStencilTexture(t);this.attachResource(e),this.depthStencilAttachment=e.view}else t instanceof h?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t){return this.device.createTexture({id:"color-attachment",usage:h.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}createDepthStencilTexture(t){return this.device.createTexture({id:"depth-stencil-attachment",usage:h.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,e){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let o=this.device._createTexture({...this.colorAttachments[n].props,width:t,height:e});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=o.view,this.attachResource(o.view)}if(this.depthStencilAttachment){let n=this.device._createTexture({...this.depthStencilAttachment.props,width:t,height:e});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}}},V=Bt;u(V,"defaultProps",{...c.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Lt=class extends c{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,e){super(t,e,Lt.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(t){throw new Error("Use uniform blocks")}},O=Lt;u(O,"defaultProps",{...c.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var It=class extends c{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,e){super(t,e,It.defaultProps)}},W=It;u(W,"defaultProps",{...c.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Rt=class extends c{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(t,e){super(t,e,Rt.defaultProps)}},j=Rt;u(j,"defaultProps",{...c.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Mt=class extends c{get[Symbol.toStringTag](){return"ComputePass"}constructor(t,e){super(t,e,Mt.defaultProps)}},Y=Mt;u(Y,"defaultProps",{...c.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var $t=class extends c{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,e){super(t,e,$t.defaultProps)}},X=$t;u(X,"defaultProps",{...c.defaultProps,measureExecutionTime:void 0});var Nt=class extends c{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,e){super(t,e,Nt.defaultProps)}},q=Nt;u(q,"defaultProps",{...c.defaultProps});function mt(r){let[t,e]=yr[r],n=t==="i32"||t==="u32",o=t!=="u32",s=br[t]*e,i=gr(t,e);return{dataType:t,components:e,defaultVertexFormat:i,byteLength:s,integer:n,signed:o}}function gr(r,t){let e;switch(r){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?e:`${e}x${t}`}var yr={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]},br={f32:4,f16:2,i32:4,u32:4};function K(r){let t;r.endsWith("-webgl")&&(r.replace("-webgl",""),t=!0);let[e,n]=r.split("x"),o=e,s=n?parseInt(n):1,i=at(o),a={type:o,components:s,byteLength:i.byteLength*s,integer:i.integer,signed:i.signed,normalized:i.normalized};return t&&(a.webglOnly=!0),a}function Ft(r,t){let e={};for(let n of r.attributes)e[n.name]=xr(r,t,n.name);return e}function fe(r,t,e=16){let n=Ft(r,t),o=new Array(e).fill(null);for(let s of Object.values(n))o[s.location]=s;return o}function xr(r,t,e){let n=wr(r,e),o=Sr(t,e);if(!n)return null;let s=mt(n.type),i=o?.vertexFormat||s.defaultVertexFormat,a=K(i);return{attributeName:o?.attributeName||n.name,bufferName:o?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:i,bufferDataType:a.type,bufferComponents:a.components,normalized:a.normalized,integer:s.integer,stepMode:o?.stepMode||n.stepMode,byteOffset:o?.byteOffset||0,byteStride:o?.byteStride||0}}function wr(r,t){let e=r.attributes.find(n=>n.name===t);return e||l.warn(`shader layout attribute "${t}" not present in shader`),e||null}function Sr(r,t){Tr(r);let e=Ar(r,t);return e||(e=vr(r,t),e)?e:(l.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function Tr(r){for(let t of r)(t.attributes&&t.format||!t.attributes&&!t.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Ar(r,t){for(let e of r)if(e.format&&e.name===t)return{attributeName:e.name,bufferName:t,stepMode:e.stepMode,vertexFormat:e.format,byteOffset:0,byteStride:e.byteStride||0};return null}function vr(r,t){for(let e of r){let n=e.byteStride;if(typeof e.byteStride!="number")for(let s of e.attributes||[]){let i=K(s.format);n+=i.byteLength}let o=e.attributes?.find(s=>s.attribute===t);if(o)return{attributeName:o.attribute,bufferName:e.name,stepMode:e.stepMode,vertexFormat:o.format,byteOffset:o.byteOffset,byteStride:n}}return null}function le(r,t){let e={...r,attributes:r.attributes.map(n=>({...n}))};for(let n of t?.attributes||[]){let o=e.attributes.find(s=>s.name===n.name);o?(o.type=n.type||o.type,o.stepMode=n.stepMode||o.stepMode):l.warn(`shader layout attribute ${n.name} not present in shader`)}return e}var Dt=class extends c{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,e){super(t,e,Dt.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=fe(e.renderPipeline.shaderLayout,e.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,e){throw new Error("constant attributes not supported")}},Q=Dt;u(Q,"defaultProps",{...c.defaultProps,renderPipeline:null});var Ut=class extends c{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,e){super(t,e,Ut.defaultProps)}},Z=Ut;u(Z,"defaultProps",{...c.defaultProps,layout:void 0,buffers:{}});var Gt=class extends c{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,e){super(t,e,Gt.defaultProps)}},J=Gt;u(J,"defaultProps",{...c.defaultProps,type:void 0,count:void 0});var Er={f32:{type:"f32",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<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}};function dt(r){let t=Er[r];return I(r),t}function me(r,t){switch(t){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}var ht;function tt(r){return(!ht||ht.byteLength<r)&&(ht=new ArrayBuffer(r)),ht}function de(r,t){let e=tt(r.BYTES_PER_ELEMENT*t);return new r(e,0,t)}function he(r){let{target:t,source:e,start:n=0,count:o=1}=r,s=e.length,i=o*s,a=0;for(let f=n;a<s;a++)t[f++]=e[a];for(;a<i;)a<i-a?(t.copyWithin(n+a,n,n+a),a*=2):(t.copyWithin(n+a,n,n+i-a),a=i);return r.target}var pe=1024,R=class{layout={};byteLength;constructor(t){let e=0;for(let[o,s]of Object.entries(t)){let i=dt(s),{type:a,components:f}=i;e=me(e,f);let g=e;e+=f,this.layout[o]={type:a,size:f,offset:g}}e+=(4-e%4)%4;let n=e*4;this.byteLength=Math.max(n,pe)}getData(t){let e=Math.max(this.byteLength,pe),n=tt(e),o={i32:new Int32Array(n),u32:new Uint32Array(n),f32:new Float32Array(n),f16:new Uint16Array(n)};for(let[s,i]of Object.entries(t)){let a=this.layout[s];if(!a){l.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:f,size:g,offset:b}=a,Ot=o[f];if(g===1){if(typeof i!="number"&&typeof i!="boolean"){l.warn(`Supplied value for single component uniform ${s} is not a number: ${i}`)();continue}Ot[b]=Number(i)}else{let Wt=y(i);if(!Wt){l.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${i}`)();continue}Ot.set(Wt,b)}}return new Uint8Array(n)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}};function ge(r,t,e=16){if(r!==t)return!1;let n=y(r);if(!n)return!1;let o=y(t);if(o&&n.length===o.length){for(let s=0;s<n.length;++s)if(o[s]!==n[s])return!1}return!0}function ye(r){let t=y(r);return t?t.slice():r}var M=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name,t?.name&&t?.shaderLayout){let e=t?.shaderLayout.bindings?.find(o=>o.type==="uniform"&&o.name===t?.name);if(!e)throw new Error(t?.name);let n=e;for(let o of n.uniforms||[])this.bindingLayout[o.name]=o}}setUniforms(t){for(let[e,n]of Object.entries(t))this._setUniform(e,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${e}=${n}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,e){ge(this.uniforms[t],e)||(this.uniforms[t]=ye(e),this.modifiedUniforms[t]=!0,this.modified=!0)}};var pt=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(t){for(let[e,n]of Object.entries(t)){let o=e,s=new R(n.uniformTypes||{});this.uniformBufferLayouts.set(o,s);let i=new M({name:e});i.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(o,i)}}destroy(){for(let t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(let[e,n]of Object.entries(t))this.uniformBlocks.get(e).setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t).byteLength}getUniformBufferData(t){let e=this.uniformBlocks.get(t).getAllUniforms();return this.uniformBufferLayouts.get(t).getData(e)}createUniformBuffer(t,e,n){n&&this.setUniforms(n);let o=this.getUniformBufferByteLength(e),s=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:o}),i=this.getUniformBufferData(e);return s.write(i),s}getManagedUniformBuffer(t,e){if(!this.uniformBuffers.get(e)){let n=this.getUniformBufferByteLength(e),o=t.createBuffer({usage:m.UNIFORM|m.COPY_DST,byteLength:n});this.uniformBuffers.set(e,o)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let t=!1;for(let e of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(e);t||=n}return t&&l.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){let e=this.uniformBlocks.get(t),n=this.uniformBuffers.get(t),o=!1;if(n&&e.needsRedraw){o||=e.needsRedraw;let s=this.getUniformBufferData(t);this.uniformBuffers.get(t).write(s);let a=this.uniformBlocks.get(t).getAllUniforms();l.log(4,`Writing to uniform buffer ${String(t)}`,s,a)()}return o}};function kt(r){let t=ArrayBuffer.isView(r)?r.constructor:r;switch(t){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(t.constructor.name)}}function be(r){switch(r){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(r)}}function xe(r,t,e){if(!t||t>4)throw new Error(`size ${t}`);let n=t,o=kt(r);if(o==="uint8"||o==="sint8"){if(n===1||n===3)throw new Error(`size: ${t}`);return e&&(o=o.replace("int","norm")),`${o}x${n}`}if(o==="uint16"||o==="sint16"){if(n===1||n===3)throw new Error(`size: ${t}`);return e&&(o=o.replace("int","norm")),`${o}x${n}`}return n===1?o:`${o}x${n}`}function we(r){return r}function Ht(r){return y(r)!==null||typeof r=="number"||typeof r=="boolean"}function Se(r){let t={bindings:{},uniforms:{}};return Object.keys(r).forEach(e=>{let n=r[e];Ht(n)?t.uniforms[e]=n:t.bindings[e]=n}),t}function _r(r,t={}){let{maxElts:e=16,size:n=1}=t,o="[";for(let i=0;i<r.length&&i<e;++i)i>0&&(o+=`,${i%n===0?" ":""}`),o+=zt(r[i],t);let s=r.length>e?"...":"]";return`${o}${s}`}function zt(r,t={}){let{isInteger:n=!1}=t;if(Array.isArray(r)||ArrayBuffer.isView(r))return _r(r,t);if(typeof r!="number")return String(r);if(Math.abs(r)<1e-16)return n?"0":"0.";if(n||Math.abs(r)>100&&Math.abs(r)<1e4)return r.toFixed(0);let o=r.toPrecision(2);return o.indexOf(".0")===o.length-2?o.slice(0,-1):o}function Te(r,t,e,n){let o=`See luma.gl ${e} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(r);n.forEach(i=>{s.methodName||(s[i]=()=>{throw l.removed(`Calling removed method ${t}.${i}: `,o)(),new Error(i)})})}function Ae(r,t,e){let{removedProps:n={},deprecatedProps:o={},replacedProps:s={}}=e;for(let a in n)if(a in t){let g=n[a]?`${r}.${n[a]}`:"N/A";l.removed(`${r}.${a}`,g)()}for(let a in o)if(a in t){let f=o[a];l.deprecated(`${r}.${a}`,`${r}.${f}`)()}let i=null;for(let[a,f]of Object.entries(s))a in t&&(l.deprecated(`${r}.${a}`,`${r}.${f}`)(),i=i||Object.assign({},t),i[f]=t[a],delete i[a]);return i||t}var gt="";function ve(r){gt=r}async function Ee(r,t){r=r.startsWith("http")?r:gt+r;let e=t?.dataType||"text";return await(await fetch(r,t))[e]()}async function _e(r,t){let e=new Image;return e.crossOrigin=t?.crossOrigin||"anonymous",e.src=r.startsWith("http")?r:gt+r,await e.decode(),await createImageBitmap(e)}async function Pe(r,t){return await new Promise((e,n)=>{try{let o=new Image;o.onload=()=>e(o),o.onerror=()=>n(new Error(`Could not load image ${r}.`)),o.crossOrigin=t?.crossOrigin||"anonymous",o.src=r.startsWith("http")?r:gt+r}catch(o){n(o)}})}async function Ce(r,t){let e=document.getElementsByTagName("head")[0];if(!e)throw new Error("loadScript");let n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",r),t&&(n.id=t),new Promise((o,s)=>{n.onload=o,n.onerror=i=>s(new Error(`Unable to load script '${r}': ${i}`)),e.appendChild(n)})}function Vt(){let r=1,t=1;return()=>(r=Math.sin(t*17.23),t=Math.cos(r*27.92),Pr(Math.abs(r*t)*1432.71))}function Pr(r){return r-Math.floor(r)}var Be=Vt();function yt(r,t,e){if(r===t)return!0;if(!e||!r||!t)return!1;if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!yt(r[n],t[n],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof r=="object"&&typeof t=="object"){let n=Object.keys(r),o=Object.keys(t);if(n.length!==o.length)return!1;for(let s of n)if(!t.hasOwnProperty(s)||!yt(r[s],t[s],e-1))return!1;return!0}return!1}function Le(r){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,1e3/60)}function Ie(r){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(r):clearTimeout(r)}var Cr=r=>`${r}`;return Ue(Br);})();
|
|
17
17
|
return __exports__;
|
|
18
18
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -116,7 +116,7 @@ var lumaStats = new StatsManager();
|
|
|
116
116
|
|
|
117
117
|
// dist/init.js
|
|
118
118
|
function initializeLuma() {
|
|
119
|
-
const VERSION2 = true ? "9.0.
|
|
119
|
+
const VERSION2 = true ? "9.0.14" : "running from source";
|
|
120
120
|
const STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
|
|
121
121
|
if (globalThis.luma && globalThis.luma.VERSION !== VERSION2) {
|
|
122
122
|
throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION2}`);
|
|
@@ -622,7 +622,7 @@ __publicField(Device, "defaultProps", {
|
|
|
622
622
|
requestMaxLimits: true,
|
|
623
623
|
debug: Boolean(log.get("debug")),
|
|
624
624
|
// Instrument context (at the expense of performance)
|
|
625
|
-
spector: Boolean(log.get("spector")),
|
|
625
|
+
spector: Boolean(log.get("spector") || log.get("spectorjs")),
|
|
626
626
|
// Initialize the SpectorJS WebGL debugger
|
|
627
627
|
break: [],
|
|
628
628
|
// TODO - Change these after confirming things work as expected
|
|
@@ -652,7 +652,7 @@ function assert(condition, message) {
|
|
|
652
652
|
|
|
653
653
|
// dist/lib/luma.js
|
|
654
654
|
var deviceMap = /* @__PURE__ */ new Map();
|
|
655
|
-
var
|
|
655
|
+
var _luma = class {
|
|
656
656
|
static registerDevices(deviceClasses) {
|
|
657
657
|
for (const deviceClass of deviceClasses) {
|
|
658
658
|
assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);
|
|
@@ -688,7 +688,7 @@ var luma = class {
|
|
|
688
688
|
/** Creates a device. Asynchronously. */
|
|
689
689
|
static async createDevice(props = {}) {
|
|
690
690
|
var _a, _b;
|
|
691
|
-
props = { ...
|
|
691
|
+
props = { ..._luma.defaultProps, ...props };
|
|
692
692
|
if (props.gl) {
|
|
693
693
|
props.type = "webgl";
|
|
694
694
|
}
|
|
@@ -741,6 +741,7 @@ var luma = class {
|
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
743
|
};
|
|
744
|
+
var luma = _luma;
|
|
744
745
|
__publicField(luma, "defaultProps", {
|
|
745
746
|
...Device.defaultProps,
|
|
746
747
|
type: "best-available",
|