@luma.gl/core 9.2.0-alpha.3 → 9.2.0-alpha.6
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/dist/adapter/canvas-context.d.ts +8 -2
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/canvas-context.js +17 -3
- package/dist/adapter/canvas-context.js.map +1 -1
- package/dist/adapter/luma.js +1 -1
- package/dist/dist.dev.js +24 -8
- package/dist/dist.min.js +5 -5
- package/dist/index.cjs +22 -9
- package/dist/index.cjs.map +2 -2
- package/dist/portable/uniform-buffer-layout.d.ts +1 -1
- package/dist/portable/uniform-buffer-layout.d.ts.map +1 -1
- package/dist/portable/uniform-buffer-layout.js +6 -7
- package/dist/portable/uniform-buffer-layout.js.map +1 -1
- package/dist/portable/uniform-store.d.ts +1 -0
- package/dist/portable/uniform-store.d.ts.map +1 -1
- package/dist/portable/uniform-store.js +1 -1
- package/dist/portable/uniform-store.js.map +1 -1
- package/package.json +2 -2
- package/src/adapter/canvas-context.ts +26 -6
- package/src/portable/uniform-buffer-layout.ts +9 -8
- package/src/portable/uniform-store.ts +5 -1
|
@@ -15,8 +15,8 @@ export type CanvasContextProps = {
|
|
|
15
15
|
height?: number;
|
|
16
16
|
/** Visibility (only used if new canvas is created). */
|
|
17
17
|
visible?: boolean;
|
|
18
|
-
/** Whether to size the drawing buffer to the pixel size during auto resize */
|
|
19
|
-
useDevicePixels?: boolean;
|
|
18
|
+
/** Whether to size the drawing buffer to the pixel size during auto resize. If a number is provided it is used as a static pixel ratio */
|
|
19
|
+
useDevicePixels?: boolean | number;
|
|
20
20
|
/** Whether to track window resizes. */
|
|
21
21
|
autoResize?: boolean;
|
|
22
22
|
/** @see https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/configure#alphamode */
|
|
@@ -26,6 +26,10 @@ export type CanvasContextProps = {
|
|
|
26
26
|
/** Whether to track position changes. Calls this.device.onPositionChange */
|
|
27
27
|
trackPosition?: boolean;
|
|
28
28
|
};
|
|
29
|
+
export type MutableCanvasContextProps = {
|
|
30
|
+
/** Whether to size the drawing buffer to the pixel size during auto resize. If a number is provided it is used as a static pixel ratio */
|
|
31
|
+
useDevicePixels?: boolean | number;
|
|
32
|
+
};
|
|
29
33
|
/**
|
|
30
34
|
* Manages a canvas. Supports both HTML or offscreen canvas
|
|
31
35
|
* - Creates a new canvas or looks up a canvas from the DOM
|
|
@@ -79,6 +83,7 @@ export declare abstract class CanvasContext {
|
|
|
79
83
|
toString(): string;
|
|
80
84
|
constructor(props?: CanvasContextProps);
|
|
81
85
|
destroy(): void;
|
|
86
|
+
setProps(props: MutableCanvasContextProps): this;
|
|
82
87
|
/** Returns a framebuffer with properly resized current 'swap chain' textures */
|
|
83
88
|
abstract getCurrentFramebuffer(options?: {
|
|
84
89
|
depthStencilFormat?: TextureFormatDepthStencil | false;
|
|
@@ -147,6 +152,7 @@ export declare abstract class CanvasContext {
|
|
|
147
152
|
* @see https://webgpufundamentals.org/webgpu/lessons/webgpu-resizing-the-canvas.html
|
|
148
153
|
*/
|
|
149
154
|
protected _handleResize(entries: ResizeObserverEntry[]): void;
|
|
155
|
+
protected _updateDrawingBufferSize(): void;
|
|
150
156
|
/** Monitor DPR changes */
|
|
151
157
|
_observeDevicePixelRatio(): void;
|
|
152
158
|
/** Start tracking positions with a timer */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/canvas-context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,KAAK,EAAC,WAAW,EAAC,mCAAgC;AACzD,OAAO,KAAK,EAAC,yBAAyB,EAAC,mDAAgD;AAIvF,qCAAqC;AACrC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gCAAgC;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0IAA0I;IAC1I,MAAM,CAAC,EAAE,iBA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CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB;IAMD,8CAA8C;IAC9C,YAAY;IAIZ,+DAA+D;IAC/D,SAAS,IAAI,MAAM;IAKnB,6EAA6E;IAC7E,gBAAgB,IAAI,MAAM;IAU1B,2DAA2D;IAC3D,MAAM,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI;IAMnD;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,IAAI;IAIxC;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAAC,EAAE,EAAE,MAAM;IAM5C,yCAAyC;IACzC,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,yBAAyB,EAAE;IAalE;;;;OAIG;IACH,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,mBAAmB,EAAE;IAmCtD,SAAS,CAAC,wBAAwB;IAuBlC,0BAA0B;IAC1B,wBAAwB;IAgBxB,4CAA4C;IAC5C,cAAc,CAAC,UAAU,GAAE,MAAY,GAAG,IAAI;IAU9C;;;;OAIG;IACH,cAAc;CAef"}
|
|
@@ -133,6 +133,13 @@ export class CanvasContext {
|
|
|
133
133
|
destroy() {
|
|
134
134
|
this.destroyed = true;
|
|
135
135
|
}
|
|
136
|
+
setProps(props) {
|
|
137
|
+
if ('useDevicePixels' in props) {
|
|
138
|
+
this.props.useDevicePixels = props.useDevicePixels || false;
|
|
139
|
+
this._updateDrawingBufferSize();
|
|
140
|
+
}
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
136
143
|
// SIZE METHODS
|
|
137
144
|
/**
|
|
138
145
|
* Returns the size covered by the canvas in CSS pixels
|
|
@@ -260,9 +267,18 @@ export class CanvasContext {
|
|
|
260
267
|
const [maxDevicePixelWidth, maxDevicePixelHeight] = this.getMaxDrawingBufferSize();
|
|
261
268
|
this.devicePixelWidth = Math.max(1, Math.min(devicePixelWidth, maxDevicePixelWidth));
|
|
262
269
|
this.devicePixelHeight = Math.max(1, Math.min(devicePixelHeight, maxDevicePixelHeight));
|
|
270
|
+
this._updateDrawingBufferSize();
|
|
271
|
+
// Inform the device
|
|
272
|
+
this.device.props.onResize(this, { oldPixelSize });
|
|
273
|
+
}
|
|
274
|
+
_updateDrawingBufferSize() {
|
|
263
275
|
// Update the canvas drawing buffer size
|
|
264
276
|
if (this.props.autoResize) {
|
|
265
|
-
if (this.props.useDevicePixels) {
|
|
277
|
+
if (typeof this.props.useDevicePixels === 'number') {
|
|
278
|
+
const dpr = this.props.useDevicePixels;
|
|
279
|
+
this.setDrawingBufferSize(this.cssWidth * dpr, this.cssHeight * dpr);
|
|
280
|
+
}
|
|
281
|
+
else if (this.props.useDevicePixels) {
|
|
266
282
|
this.setDrawingBufferSize(this.devicePixelWidth, this.devicePixelHeight);
|
|
267
283
|
}
|
|
268
284
|
else {
|
|
@@ -275,8 +291,6 @@ export class CanvasContext {
|
|
|
275
291
|
this._initializedResolvers.resolve();
|
|
276
292
|
this.isInitialized = true;
|
|
277
293
|
this.updatePosition();
|
|
278
|
-
// Inform the device
|
|
279
|
-
this.device.props.onResize(this, { oldPixelSize });
|
|
280
294
|
}
|
|
281
295
|
/** Monitor DPR changes */
|
|
282
296
|
_observeDevicePixelRatio() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-context.js","sourceRoot":"","sources":["../../src/adapter/canvas-context.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAC,GAAG,EAAC,wBAAqB;AACjC,OAAO,EAAC,aAAa,EAAC,kCAA+B;AA4BrD;;;;;;GAMG;AACH,MAAM,OAAgB,aAAa;IACjC,MAAM,CAAC,YAAY,CAAC,MAAe;QACjC,OAAO,OAAO,iBAAiB,KAAK,WAAW,IAAI,MAAM,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CAAC,CAAC;QACrC,iBAAiB;IACnB,CAAC;IACD,OAAO;QACL,CAAC;QACD,CAAC;QACD,6HAA6H;QAC7H,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;KACnC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,CAAS,EAAE,KAAa,EAAE,KAAa;IACrD,qHAAqH;IACrH,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,MAAM,CAAC,CAAS,EAAE,KAAa,EAAE,MAAc,EAAE,OAAgB;IACxE,qHAAqH;IACrH,OAAO,OAAO;QACZ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;QACjD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/adapter/luma.js
CHANGED
|
@@ -32,7 +32,7 @@ export class Luma {
|
|
|
32
32
|
VERSION =
|
|
33
33
|
// Version detection using build plugin
|
|
34
34
|
// @ts-expect-error no-undef
|
|
35
|
-
typeof "9.2.0-alpha.
|
|
35
|
+
typeof "9.2.0-alpha.6" !== 'undefined' ? "9.2.0-alpha.6" : 'running from source';
|
|
36
36
|
spector;
|
|
37
37
|
preregisteredAdapters = new Map();
|
|
38
38
|
constructor() {
|
package/dist/dist.dev.js
CHANGED
|
@@ -2003,6 +2003,13 @@ or create a device with the 'debug: true' prop.`;
|
|
|
2003
2003
|
destroy() {
|
|
2004
2004
|
this.destroyed = true;
|
|
2005
2005
|
}
|
|
2006
|
+
setProps(props) {
|
|
2007
|
+
if ("useDevicePixels" in props) {
|
|
2008
|
+
this.props.useDevicePixels = props.useDevicePixels || false;
|
|
2009
|
+
this._updateDrawingBufferSize();
|
|
2010
|
+
}
|
|
2011
|
+
return this;
|
|
2012
|
+
}
|
|
2006
2013
|
// SIZE METHODS
|
|
2007
2014
|
/**
|
|
2008
2015
|
* Returns the size covered by the canvas in CSS pixels
|
|
@@ -2120,8 +2127,15 @@ or create a device with the 'debug: true' prop.`;
|
|
|
2120
2127
|
const [maxDevicePixelWidth, maxDevicePixelHeight] = this.getMaxDrawingBufferSize();
|
|
2121
2128
|
this.devicePixelWidth = Math.max(1, Math.min(devicePixelWidth, maxDevicePixelWidth));
|
|
2122
2129
|
this.devicePixelHeight = Math.max(1, Math.min(devicePixelHeight, maxDevicePixelHeight));
|
|
2130
|
+
this._updateDrawingBufferSize();
|
|
2131
|
+
this.device.props.onResize(this, { oldPixelSize });
|
|
2132
|
+
}
|
|
2133
|
+
_updateDrawingBufferSize() {
|
|
2123
2134
|
if (this.props.autoResize) {
|
|
2124
|
-
if (this.props.useDevicePixels) {
|
|
2135
|
+
if (typeof this.props.useDevicePixels === "number") {
|
|
2136
|
+
const dpr = this.props.useDevicePixels;
|
|
2137
|
+
this.setDrawingBufferSize(this.cssWidth * dpr, this.cssHeight * dpr);
|
|
2138
|
+
} else if (this.props.useDevicePixels) {
|
|
2125
2139
|
this.setDrawingBufferSize(this.devicePixelWidth, this.devicePixelHeight);
|
|
2126
2140
|
} else {
|
|
2127
2141
|
this.setDrawingBufferSize(this.cssWidth, this.cssHeight);
|
|
@@ -2131,7 +2145,6 @@ or create a device with the 'debug: true' prop.`;
|
|
|
2131
2145
|
this._initializedResolvers.resolve();
|
|
2132
2146
|
this.isInitialized = true;
|
|
2133
2147
|
this.updatePosition();
|
|
2134
|
-
this.device.props.onResize(this, { oldPixelSize });
|
|
2135
2148
|
}
|
|
2136
2149
|
/** Monitor DPR changes */
|
|
2137
2150
|
_observeDevicePixelRatio() {
|
|
@@ -3363,11 +3376,12 @@ ${htmlLog}
|
|
|
3363
3376
|
/** number of bytes needed for buffer allocation */
|
|
3364
3377
|
byteLength;
|
|
3365
3378
|
/** Create a new UniformBufferLayout given a map of attributes. */
|
|
3366
|
-
constructor(uniformTypes) {
|
|
3379
|
+
constructor(uniformTypes, uniformSizes = {}) {
|
|
3367
3380
|
let size = 0;
|
|
3368
3381
|
for (const [key, uniformType] of Object.entries(uniformTypes)) {
|
|
3369
3382
|
const typeAndComponents = getVariableShaderTypeInfo(uniformType);
|
|
3370
|
-
const { type, components
|
|
3383
|
+
const { type, components } = typeAndComponents;
|
|
3384
|
+
const count = components * (uniformSizes?.[key] ?? 1);
|
|
3371
3385
|
size = alignTo(size, count);
|
|
3372
3386
|
const offset = size;
|
|
3373
3387
|
size += count;
|
|
@@ -3379,8 +3393,7 @@ ${htmlLog}
|
|
|
3379
3393
|
}
|
|
3380
3394
|
/** Get the data for the complete buffer */
|
|
3381
3395
|
getData(uniformValues) {
|
|
3382
|
-
const
|
|
3383
|
-
const arrayBuffer2 = getScratchArrayBuffer(bufferSize);
|
|
3396
|
+
const arrayBuffer2 = getScratchArrayBuffer(this.byteLength);
|
|
3384
3397
|
const typedArrays = {
|
|
3385
3398
|
i32: new Int32Array(arrayBuffer2),
|
|
3386
3399
|
u32: new Uint32Array(arrayBuffer2),
|
|
@@ -3414,7 +3427,7 @@ ${htmlLog}
|
|
|
3414
3427
|
typedArray.set(value, offset);
|
|
3415
3428
|
}
|
|
3416
3429
|
}
|
|
3417
|
-
return new Uint8Array(arrayBuffer2);
|
|
3430
|
+
return new Uint8Array(arrayBuffer2, 0, this.byteLength);
|
|
3418
3431
|
}
|
|
3419
3432
|
/** Does this layout have a field with specified name */
|
|
3420
3433
|
has(name2) {
|
|
@@ -3520,7 +3533,10 @@ ${htmlLog}
|
|
|
3520
3533
|
constructor(blocks) {
|
|
3521
3534
|
for (const [bufferName, block] of Object.entries(blocks)) {
|
|
3522
3535
|
const uniformBufferName = bufferName;
|
|
3523
|
-
const uniformBufferLayout = new UniformBufferLayout(
|
|
3536
|
+
const uniformBufferLayout = new UniformBufferLayout(
|
|
3537
|
+
block.uniformTypes ?? {},
|
|
3538
|
+
block.uniformSizes ?? {}
|
|
3539
|
+
);
|
|
3524
3540
|
this.uniformBufferLayouts.set(uniformBufferName, uniformBufferLayout);
|
|
3525
3541
|
const uniformBlock = new UniformBlock({ name: bufferName });
|
|
3526
3542
|
uniformBlock.setUniforms(block.defaultUniforms || {});
|
package/dist/dist.min.js
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
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 oe=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var $t=Object.getOwnPropertyNames;var zt=Object.prototype.hasOwnProperty;var Ut=(r,e,t)=>e in r?oe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ht=(r,e)=>{for(var t in e)oe(r,t,{get:e[t],enumerable:!0})},Nt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $t(e))!zt.call(r,n)&&n!==t&&oe(r,n,{get:()=>e[n],enumerable:!(i=Ft(e,n))||i.enumerable});return r};var kt=r=>Nt(oe({},"__esModule",{value:!0}),r);var a=(r,e,t)=>(Ut(r,typeof e!="symbol"?e+"":e,t),t);var Br={};Ht(Br,{Adapter:()=>Te,Buffer:()=>d,CanvasContext:()=>z,CommandBuffer:()=>te,CommandEncoder:()=>ee,ComputePass:()=>Z,ComputePipeline:()=>Q,Device:()=>I,DeviceFeatures:()=>xe,DeviceLimits:()=>be,ExternalTexture:()=>X,Framebuffer:()=>K,PipelineLayout:()=>se,QuerySet:()=>ne,RenderPass:()=>S,RenderPipeline:()=>J,Resource:()=>u,Sampler:()=>R,Shader:()=>q,Texture:()=>p,TextureFormatDecoder:()=>j,TextureView:()=>Y,TransformFeedback:()=>ie,UniformBlock:()=>N,UniformBufferLayout:()=>H,UniformStore:()=>_e,VertexArray:()=>re,_getTextureFormatDefinition:()=>O,_getTextureFormatTable:()=>pt,getAttributeInfosFromLayouts:()=>Xe,getAttributeShaderTypeInfo:()=>Ae,getDataType:()=>de,getDataTypeInfo:()=>F,getNormalizedDataType:()=>me,getScratchArray:()=>Ct,getTypedArrayConstructor:()=>lt,getVariableShaderTypeInfo:()=>Pe,getVertexFormatFromAttribute:()=>mt,getVertexFormatInfo:()=>_,log:()=>l,luma:()=>vt,makeVertexFormat:()=>Be,readPixel:()=>Bt,textureFormatDecoder:()=>C,writePixel:()=>Dt});function k(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var A=class{constructor(e,t){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=e,this.type=t,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(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=k(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(k()-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(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:i}=e,n=this.stats[t];return n||(e instanceof A?n=e:n=new A(t,i),this.stats[t]=n),n}};var Ce=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new B({id:e})),this.stats.get(e)}},ae=new Ce;var ce=globalThis,Wt=globalThis.document||{},ue=globalThis.process||{},Gt=globalThis.console,Or=globalThis.navigator||{};function et(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}function x(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||et()}var Ie="4.1.0";function Ot(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var fe=class{constructor(e,t,i="sessionStorage"){this.storage=Ot(i),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function tt(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function rt(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var le;(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"})(le||(le={}));var jt=10;function it(r){return typeof r!="string"?r:(r=r.toUpperCase(),le[r]||le.WHITE)}function nt(r,e,t){return!x&&typeof r=="string"&&(e&&(r=`\x1B[${it(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${it(t)+jt}m${r}\x1B[49m`)),r}function st(r,e=["constructor"]){let t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),n=r;for(let s of i){let o=n[s];typeof o=="function"&&(e.find(c=>s===c)||(n[s]=o.bind(r)))}}function W(r,e){if(!r)throw new Error(e||"Assertion failed")}function E(){let r;if(x()&&ce.performance)r=ce?.performance?.now?.();else if("hrtime"in ue){let e=ue?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var D={debug:x()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Yt={enabled:!0,level:0};function M(){}var ot={},at={once:!0},v=class{constructor({id:e}={id:""}){this.VERSION=Ie,this._startTs=E(),this._deltaTs=E(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new fe(`__probe-${this.id}__`,Yt),this.timeStamp(`${this.id} started`),st(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((E()-this._startTs).toPrecision(10))}getDelta(){return Number((E()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,D.warn,arguments,at)}error(e){return this._getLogFunction(0,e,D.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,D.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,D.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,D.debug||D.info,arguments,at)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||M,i&&[i],{tag:qt(t)}):M}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||M)}group(e,t,i={collapsed:!1}){let n=ct({logLevel:e,message:t,opts:i}),{collapsed:s}=i;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||M)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=ut(e)}_getLogFunction(e,t,i,n,s){if(this._shouldLog(e)){s=ct({logLevel:e,message:t,args:n,opts:s}),i=i||s.method,W(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=E();let o=s.tag||s.message;if(s.once&&o)if(!ot[o])ot[o]=E();else return M;return t=Xt(this.id,s.message,s),i.bind(console,t,...s.args)}return M}};v.VERSION=Ie;function ut(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return W(Number.isFinite(e)&&e>=0),e}function ct(r){let{logLevel:e,message:t}=r;r.logLevel=ut(e);let i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return W(n==="string"||n==="object"),Object.assign(r,{args:i},r.opts)}function Xt(r,e,t){if(typeof e=="string"){let i=t.time?rt(tt(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=nt(e,t.color,t.background)}return e}function qt(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var gi=new v({id:"@probe.gl/log"});var l=new v({id:"luma.gl"});var Re={};function T(r="id"){Re[r]=Re[r]||1;let e=Re[r]++;return`${r}-${e}`}var u=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,i){if(!e)throw new Error("no device");this._device=e,this.props=Kt(t,i);let n=this.props.id!=="undefined"?this.props.id:T(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};a(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Kt(r,e){let t={...e};for(let i in r)r[i]!==void 0&&(t[i]=r[i]);return t}var G=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let i={...t};(t.usage||0)&G.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array&&(i.indexType="uint16")),delete i.data,super(e,i,G.defaultProps),this.usage=i.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,i){let n=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:i,G.DEBUG_DATA_MAX_LENGTH);n===null?this.debugData=new ArrayBuffer(s):t===0&&i===n.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(t,t+s)}},d=G;a(d,"INDEX",16),a(d,"VERTEX",32),a(d,"UNIFORM",64),a(d,"STORAGE",128),a(d,"INDIRECT",256),a(d,"QUERY_RESOLVE",512),a(d,"MAP_READ",1),a(d,"MAP_WRITE",2),a(d,"COPY_SRC",4),a(d,"COPY_DST",8),a(d,"DEBUG_DATA_MAX_LENGTH",32),a(d,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0});function F(r){let[e,t,i]=Le[r],n=r.includes("norm"),s=!n&&!r.startsWith("float"),o=r.startsWith("s");return{signedType:e,primitiveType:t,byteLength:i,normalized:n,integer:s,signed:o}}function me(r){let e=r;switch(e){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return e}}function ft(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function de(r){let e=ArrayBuffer.isView(r)?r.constructor:r;if(e===Uint8ClampedArray)return"uint8";let t=Object.values(Le).find(i=>e===i[4]);if(!t)throw new Error(e.name);return t[0]}function lt(r){let[,,,,e]=Le[r];return e}var Le={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};function _(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,i]=r.split("x"),n=t,s=i?parseInt(i):1,o=F(n),c={type:n,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(c.webglOnly=!0),c}function Be(r,e,t){let i=t?me(r):r;switch(i){case"unorm8":return e===1?"unorm8":e===3?"unorm8x3-webgl":`${i}x${e}`;case"snorm8":case"uint8":case"sint8":case"uint16":case"sint16":case"unorm16":case"snorm16":case"float16":if(e===1||e===3)throw new Error(`size: ${e}`);return`${i}x${e}`;default:return e===1?i:`${i}x${e}`}}function mt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=de(r);return Be(n,i,t)}function dt(r){let e;switch(r.primitiveType){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return r.components<=2?"float16x2":"float16x4"}return r.components===1?e:`${e}x${r.components}`}var b="texture-compression-bc",m="texture-compression-astc",y="texture-compression-etc2",Jt="texture-compression-etc1-webgl",he="texture-compression-pvrtc-webgl",De="texture-compression-atc-webgl",pe="float32-renderable-webgl",Me="float16-renderable-webgl",Qt="rgb9e5ufloat-renderable-webgl",Fe="snorm8-renderable-webgl",V="norm16-renderable-webgl",$e="snorm16-renderable-webgl",ge="float32-filterable",ht="float16-filterable-webgl";function O(r){let e=gt[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}function pt(){return gt}var Zt={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:Fe},rg8snorm:{render:Fe},"rgb8snorm-webgl":{},rgba8snorm:{render:Fe},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:V},rg16unorm:{render:V},"rgb16unorm-webgl":{f:V},rgba16unorm:{render:V},r16snorm:{f:$e},rg16snorm:{render:$e},"rgb16snorm-webgl":{f:V},rgba16snorm:{render:$e},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:Me,filter:"float16-filterable-webgl"},rg16float:{render:Me,filter:ht},rgba16float:{render:Me,filter:ht},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:pe,filter:ge},rg32float:{render:!1,filter:ge},"rgb32float-webgl":{render:pe,filter:ge},rgba32float:{render:pe,filter:ge},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:Qt},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:pe},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},er={"bc1-rgb-unorm-webgl":{f:b},"bc1-rgb-unorm-srgb-webgl":{f:b},"bc1-rgba-unorm":{f:b},"bc1-rgba-unorm-srgb":{f:b},"bc2-rgba-unorm":{f:b},"bc2-rgba-unorm-srgb":{f:b},"bc3-rgba-unorm":{f:b},"bc3-rgba-unorm-srgb":{f:b},"bc4-r-unorm":{f:b},"bc4-r-snorm":{f:b},"bc5-rg-unorm":{f:b},"bc5-rg-snorm":{f:b},"bc6h-rgb-ufloat":{f:b},"bc6h-rgb-float":{f:b},"bc7-rgba-unorm":{f:b},"bc7-rgba-unorm-srgb":{f:b},"etc2-rgb8unorm":{f:y},"etc2-rgb8unorm-srgb":{f:y},"etc2-rgb8a1unorm":{f:y},"etc2-rgb8a1unorm-srgb":{f:y},"etc2-rgba8unorm":{f:y},"etc2-rgba8unorm-srgb":{f:y},"eac-r11unorm":{f:y},"eac-r11snorm":{f:y},"eac-rg11unorm":{f:y},"eac-rg11snorm":{f:y},"astc-4x4-unorm":{f:m},"astc-4x4-unorm-srgb":{f:m},"astc-5x4-unorm":{f:m},"astc-5x4-unorm-srgb":{f:m},"astc-5x5-unorm":{f:m},"astc-5x5-unorm-srgb":{f:m},"astc-6x5-unorm":{f:m},"astc-6x5-unorm-srgb":{f:m},"astc-6x6-unorm":{f:m},"astc-6x6-unorm-srgb":{f:m},"astc-8x5-unorm":{f:m},"astc-8x5-unorm-srgb":{f:m},"astc-8x6-unorm":{f:m},"astc-8x6-unorm-srgb":{f:m},"astc-8x8-unorm":{f:m},"astc-8x8-unorm-srgb":{f:m},"astc-10x5-unorm":{f:m},"astc-10x5-unorm-srgb":{f:m},"astc-10x6-unorm":{f:m},"astc-10x6-unorm-srgb":{f:m},"astc-10x8-unorm":{f:m},"astc-10x8-unorm-srgb":{f:m},"astc-10x10-unorm":{f:m},"astc-10x10-unorm-srgb":{f:m},"astc-12x10-unorm":{f:m},"astc-12x10-unorm-srgb":{f:m},"astc-12x12-unorm":{f:m},"astc-12x12-unorm-srgb":{f:m},"pvrtc-rgb4unorm-webgl":{f:he},"pvrtc-rgba4unorm-webgl":{f:he},"pvrtc-rbg2unorm-webgl":{f:he},"pvrtc-rgba2unorm-webgl":{f:he},"etc1-rbg-unorm-webgl":{f:Jt},"atc-rgb-unorm-webgl":{f:De},"atc-rgba-unorm-webgl":{f:De},"atc-rgbai-unorm-webgl":{f:De}},gt={...Zt,...er};var tr=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],rr=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,j=class{getInfo(e){return bt(e)}isColor(e){return e.startsWith("rgba")||e.startsWith("bgra")||e.startsWith("rgb")}isDepthStencil(e){return e.startsWith("depth")||e.startsWith("stencil")}isCompressed(e){return tr.some(t=>e.startsWith(t))}getCapabilities(e){let t=O(e),i={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},n=bt(e),s=e.startsWith("depth")||e.startsWith("stencil"),o=n?.signed,c=n?.integer,f=n?.webgl;return i.render&&=!o,i.filter&&=!s&&!o&&!c&&!f,i}},C=new j;function bt(r){let e=ir(r);if(C.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;let i=nr(r);i&&(e.blockWidth=i.blockWidth,e.blockHeight=i.blockHeight)}let t=rr.exec(r);if(t){let[,i,n,s,o,c]=t,f=`${s}${n}`,h=F(f),g=h.byteLength*8,P=i.length,Mt=[g,P>=2?g:0,P>=3?g:0,P>=4?g:0];e={format:r,attachment:e.attachment,dataType:h.signedType,components:P,channels:i,integer:h.integer,signed:h.signed,normalized:h.normalized,bitsPerChannel:Mt,bytesPerPixel:h.byteLength*i.length,packed:e.packed,srgb:e.srgb},c==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function ir(r){let e=O(r),t=e.bytesPerPixel||1,i=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:r,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||e.channels?.length||1,bytesPerPixel:t,bitsPerChannel:i,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function nr(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,i,n]=t;return{blockWidth:Number(i),blockHeight:Number(n)}}return null}function xt(r){return typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof VideoFrame<"u"&&r instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas}function yt(r){if(typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height};if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement)return{width:r.naturalWidth,height:r.naturalHeight};if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement)return{width:r.videoWidth,height:r.videoHeight};if(typeof VideoFrame<"u"&&r instanceof VideoFrame)return{width:r.displayWidth,height:r.displayHeight};throw new Error("Unknown image type")}var be=class{},xe=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},ze=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=ae;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(e){this.props={...ze.defaultProps,...e},this.id=this.props.id||T(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return _(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return C.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let i=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(i),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,i=1){let n=Math.max(e,t,i);return 1+Math.floor(Math.log2(n))}isExternalImage(e){return xt(e)}getExternalImageSize(e){return yt(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return C.isCompressed(e)}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...i){return this.props.onError(e,t)?()=>{}:l.error(e.message,t,...i)}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
|
|
8
|
-
or create a device with the 'debug: true' prop.`;l.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=C.getCapabilities(e),i=s=>(typeof s=="string"?this.features.has(s):s)??!0,n=i(t.create);return{format:e,create:n,render:n&&i(t.render),filter:n&&i(t.filter),blend:n&&i(t.blend),store:n&&i(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&d.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array&&(t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},I=ze;a(I,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[i,n]=e.getDevicePixelSize();l.log(1,`${e} resized => ${i}x${n}px`)()},onPositionChange:(e,t)=>{let[i,n]=e.getPosition();l.log(1,`${e} repositioned => ${i},${n}`)()},onVisibilityChange:e=>l.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>l.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:l.get("debug")||void 0,debugShaders:l.get("debug-shaders")||void 0,debugFramebuffers:Boolean(l.get("debug-framebuffers")),debugFactories:Boolean(l.get("debug-factories")),debugWebGL:Boolean(l.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!1,_cachePipelines:!1,_cacheDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0});var sr="set luma.log.level=1 (or higher) to trace rendering",wt="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",we=class{stats=ae;log=l;VERSION="9.2.0-alpha.3";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw l.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),l.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");l.error("This version of luma.gl has already been initialized")()}l.log(1,`${this.VERSION} - ${sr}`)(),globalThis.luma=this}async createDevice(e={}){let t={...we.defaultProps,...e},i=this.selectAdapter(t.type,t.adapters);if(!i)throw new Error(wt);return t.waitForPageLoad&&await i.pageLoaded,await i.create(t)}async attachDevice(e,t){let i=this._getTypeFromHandle(e,t.adapters),n=i&&this.selectAdapter(i,t.adapters);if(!n)throw new Error(wt);return await n?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this._getAdapterMap(e);return Array.from(t).map(([,i])=>i).filter(i=>i.isSupported?.()).map(i=>i.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],i=this._getAdapterMap(e);for(let n of t)if(i.get(n)?.isSupported?.())return n;return null}selectAdapter(e,t=[]){let i=e;e==="best-available"&&(i=this.getBestAvailableAdapterType(t));let n=this._getAdapterMap(t);return i&&n.get(i)||null}enforceWebGL2(e=!0,t=[]){let n=this._getAdapterMap(t).get("webgl");n||l.warn("enforceWebGL2: webgl adapter not found")(),n?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(we.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let i of e)t.set(i.type,i);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e?.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?l.warn("WebGL1 is not supported",e)():l.warn("Unknown handle type",e)(),null)}},ye=we;a(ye,"defaultProps",{...I.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});var vt=new ye;var Te=class{get pageLoaded(){return cr()}},or=x()&&typeof document<"u",ar=()=>or&&document.readyState==="complete",ve=null;function cr(){return ve||(ar()||typeof window>"u"?ve=Promise.resolve():ve=new Promise(r=>window.addEventListener("load",()=>r()))),ve}function Tt(){let r,e;return{promise:new Promise((i,n)=>{r=i,e=n}),resolve:r,reject:e}}var $=class{static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=Tt();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...$.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,x()?e.canvas?typeof e.canvas=="string"?this.canvas=fr(e.canvas):this.canvas=e.canvas:this.canvas=lr(e):this.canvas={width:e.width||1,height:e.height||1},$.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):$.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],$.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(t=>this._handleIntersection(t)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(t=>this._handleResize(t));try{this._resizeObserver.observe(this.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.canvas,{box:"content-box"})}setTimeout(()=>this._observeDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}destroy(){this.destroyed=!0}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){this.canvas.width=e,this.canvas.height=t,this.drawingBufferWidth=e,this.drawingBufferHeight=t}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let i=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return mr(e,i,n,s,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDevicePixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_handleIntersection(e){let t=e.find(n=>n.target===this.canvas);if(!t)return;let i=t.isIntersecting;this.isVisible!==i&&(this.isVisible=i,this.device.props.onVisibilityChange(this))}_handleResize(e){let t=e.find(f=>f.target===this.canvas);if(!t)return;this.cssWidth=t.contentBoxSize[0].inlineSize,this.cssHeight=t.contentBoxSize[0].blockSize;let i=this.getDevicePixelSize(),n=t.devicePixelContentBoxSize?.[0].inlineSize||t.contentBoxSize[0].inlineSize*devicePixelRatio,s=t.devicePixelContentBoxSize?.[0].blockSize||t.contentBoxSize[0].blockSize*devicePixelRatio,[o,c]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(n,o)),this.devicePixelHeight=Math.max(1,Math.min(s,c)),this.props.autoResize&&(this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight),this._updateDevice()),this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition(),this.device.props.onResize(this,{oldPixelSize:i})}_observeDevicePixelRatio(){let e=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:e}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(e=100){let t=setInterval(()=>{this.destroyed?clearInterval(t):this.updatePosition()},e)}updatePosition(){let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let n=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:n})}}}},z=$;a(z,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1});function ur(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}return r||document.body}function fr(r){let e=document.getElementById(r);if(!z.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function lr(r){let{width:e,height:t}=r,i=document.createElement("canvas");i.id=T("lumagl-auto-created-canvas"),i.width=e||1,i.height=t||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(i.style.visibility="hidden");let n=ur(r?.container||null);return n.insertBefore(i,n.firstChild),i}function mr(r,e,t,i,n){let s=r,o=St(s[0],e,t),c=Pt(s[1],e,i,n),f=St(s[0]+1,e,t),h=f===t-1?f:f-1;f=Pt(s[1]+1,e,i,n);let g;return n?(f=f===0?f:f+1,g=c,c=f):g=f===i-1?f:f-1,{x:o,y:c,width:Math.max(h-o+1,1),height:Math.max(g-c+1,1)}}function St(r,e,t){return Math.min(Math.round(r*e),t-1)}function Pt(r,e,t,i){return i?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Se=class extends u{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Se.normalizeProps(e,t),super(e,t,Se.defaultProps)}static normalizeProps(e,t){return t}},R=Se;a(R,"defaultProps",{...u.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var dr={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},w=class extends u{dimension;baseDimension;format;width;height;depth;mipLevels;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t){if(t=w.normalizeProps(e,t),super(e,t,w.defaultProps),this.dimension=this.props.dimension,this.baseDimension=dr[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.props.width===void 0||this.props.height===void 0)if(e.isExternalImage(t.data)){let i=e.getExternalImageSize(t.data);this.width=i?.width||1,this.height=i?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&l.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=e.incrementTimestamp()}setSampler(e){this.sampler=e instanceof R?e:this.device.createSampler(e)}clone(e){return this.device.createTexture({...this.props,...e})}static normalizeProps(e,t){let i={...t},{width:n,height:s}=i;return typeof n=="number"&&(i.width=Math.max(1,Math.ceil(n))),typeof s=="number"&&(i.height=Math.max(1,Math.ceil(s))),i}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{width:t,height:i,depth:n}=this,s={...w.defaultCopyDataOptions,width:t,height:i,depth:n,...e},o=this.device.getTextureFormatInfo(this.format);if(!e.bytesPerRow&&!o.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return s.bytesPerRow=e.bytesPerRow||t*(o.bytesPerPixel||4),s.rowsPerImage=e.rowsPerImage||i,s}_normalizeCopyExternalImageOptions(e){let t=this.device.getExternalImageSize(e.image),i={...w.defaultCopyExternalImageOptions,...t,...e};return i.width=Math.min(i.width,this.width-i.x),i.height=Math.min(i.height,this.height-i.y),i}},p=w;a(p,"SAMPLE",4),a(p,"STORAGE",8),a(p,"RENDER",16),a(p,"COPY_SRC",1),a(p,"COPY_DST",2),a(p,"TEXTURE",4),a(p,"RENDER_ATTACHMENT",16),a(p,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:w.TEXTURE|w.RENDER_ATTACHMENT|w.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),a(p,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),a(p,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1});var Ue=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,Ue.defaultProps)}},Y=Ue;a(Y,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var He=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,He.defaultProps)}},X=He;a(X,"defaultProps",{...u.defaultProps,source:void 0,colorSpace:"srgb"});function At(r,e,t){let i="",n=e.split(/\r?\n/),s=r.slice().sort((o,c)=>o.lineNum-c.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let c=1;c<=n.length;c++)for(i+=Et(n[c-1],c,t);s.length>o&&s[o].lineNum===c;){let f=s[o++];i+=Ne(f,n,f.lineNum,{...t,inlineSource:!1})}for(;s.length>o;){let c=s[o++];i+=Ne(c,[],0,{...t,inlineSource:!1})}return i;case"issues":case"no":for(let c of r)i+=Ne(c,n,c.lineNum,{inlineSource:t?.showSourceCode!=="no"});return i}}function Ne(r,e,t,i){if(i?.inlineSource){let s=hr(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
|
|
7
|
+
"use strict";var __exports__=(()=>{var oe=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var zt=Object.prototype.hasOwnProperty;var $t=(r,e,t)=>e in r?oe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ut=(r,e)=>{for(var t in e)oe(r,t,{get:e[t],enumerable:!0})},Ht=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ft(e))!zt.call(r,n)&&n!==t&&oe(r,n,{get:()=>e[n],enumerable:!(i=Mt(e,n))||i.enumerable});return r};var Nt=r=>Ht(oe({},"__esModule",{value:!0}),r);var a=(r,e,t)=>($t(r,typeof e!="symbol"?e+"":e,t),t);var Dr={};Ut(Dr,{Adapter:()=>Se,Buffer:()=>h,CanvasContext:()=>$,CommandBuffer:()=>te,CommandEncoder:()=>ee,ComputePass:()=>Z,ComputePipeline:()=>Q,Device:()=>C,DeviceFeatures:()=>xe,DeviceLimits:()=>be,ExternalTexture:()=>X,Framebuffer:()=>K,PipelineLayout:()=>se,QuerySet:()=>ne,RenderPass:()=>T,RenderPipeline:()=>J,Resource:()=>u,Sampler:()=>I,Shader:()=>q,Texture:()=>g,TextureFormatDecoder:()=>j,TextureView:()=>Y,TransformFeedback:()=>ie,UniformBlock:()=>N,UniformBufferLayout:()=>H,UniformStore:()=>_e,VertexArray:()=>re,_getTextureFormatDefinition:()=>O,_getTextureFormatTable:()=>pt,getAttributeInfosFromLayouts:()=>Xe,getAttributeShaderTypeInfo:()=>Ae,getDataType:()=>de,getDataTypeInfo:()=>F,getNormalizedDataType:()=>me,getScratchArray:()=>Ct,getTypedArrayConstructor:()=>lt,getVariableShaderTypeInfo:()=>Pe,getVertexFormatFromAttribute:()=>mt,getVertexFormatInfo:()=>E,log:()=>l,luma:()=>vt,makeVertexFormat:()=>De,readPixel:()=>Lt,textureFormatDecoder:()=>_,writePixel:()=>Dt});function k(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var P=class{constructor(e,t){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=e,this.type=t,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(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=k(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(k()-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 D=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:i}=e,n=this.stats[t];return n||(e instanceof P?n=e:n=new P(t,i),this.stats[t]=n),n}};var Ce=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new D({id:e})),this.stats.get(e)}},ae=new Ce;var ce=globalThis,kt=globalThis.document||{},ue=globalThis.process||{},Wt=globalThis.console,Or=globalThis.navigator||{};function et(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}function x(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||et()}var Ie="4.1.0";function Vt(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var fe=class{constructor(e,t,i="sessionStorage"){this.storage=Vt(i),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}};function tt(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function rt(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var le;(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"})(le||(le={}));var Ot=10;function it(r){return typeof r!="string"?r:(r=r.toUpperCase(),le[r]||le.WHITE)}function nt(r,e,t){return!x&&typeof r=="string"&&(e&&(r=`\x1B[${it(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${it(t)+Ot}m${r}\x1B[49m`)),r}function st(r,e=["constructor"]){let t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),n=r;for(let s of i){let o=n[s];typeof o=="function"&&(e.find(c=>s===c)||(n[s]=o.bind(r)))}}function W(r,e){if(!r)throw new Error(e||"Assertion failed")}function A(){let r;if(x()&&ce.performance)r=ce?.performance?.now?.();else if("hrtime"in ue){let e=ue?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var B={debug:x()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},jt={enabled:!0,level:0};function M(){}var ot={},at={once:!0},v=class{constructor({id:e}={id:""}){this.VERSION=Ie,this._startTs=A(),this._deltaTs=A(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new fe(`__probe-${this.id}__`,jt),this.timeStamp(`${this.id} started`),st(this),Object.seal(this)}set level(e){this.setLevel(e)}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(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,B.warn,arguments,at)}error(e){return this._getLogFunction(0,e,B.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,B.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,B.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,B.debug||B.info,arguments,at)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||M,i&&[i],{tag:Xt(t)}):M}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||M)}group(e,t,i={collapsed:!1}){let n=ct({logLevel:e,message:t,opts:i}),{collapsed:s}=i;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||M)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=ut(e)}_getLogFunction(e,t,i,n,s){if(this._shouldLog(e)){s=ct({logLevel:e,message:t,args:n,opts:s}),i=i||s.method,W(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=A();let o=s.tag||s.message;if(s.once&&o)if(!ot[o])ot[o]=A();else return M;return t=Yt(this.id,s.message,s),i.bind(console,t,...s.args)}return M}};v.VERSION=Ie;function ut(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return W(Number.isFinite(e)&&e>=0),e}function ct(r){let{logLevel:e,message:t}=r;r.logLevel=ut(e);let i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return W(n==="string"||n==="object"),Object.assign(r,{args:i},r.opts)}function Yt(r,e,t){if(typeof e=="string"){let i=t.time?rt(tt(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=nt(e,t.color,t.background)}return e}function Xt(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var gi=new v({id:"@probe.gl/log"});var l=new v({id:"luma.gl"});var Re={};function S(r="id"){Re[r]=Re[r]||1;let e=Re[r]++;return`${r}-${e}`}var u=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,i){if(!e)throw new Error("no device");this._device=e,this.props=qt(t,i);let n=this.props.id!=="undefined"?this.props.id:S(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};a(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function qt(r,e){let t={...e};for(let i in r)r[i]!==void 0&&(t[i]=r[i]);return t}var G=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let i={...t};(t.usage||0)&G.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array&&(i.indexType="uint16")),delete i.data,super(e,i,G.defaultProps),this.usage=i.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,i){let n=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:i,G.DEBUG_DATA_MAX_LENGTH);n===null?this.debugData=new ArrayBuffer(s):t===0&&i===n.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(t,t+s)}},h=G;a(h,"INDEX",16),a(h,"VERTEX",32),a(h,"UNIFORM",64),a(h,"STORAGE",128),a(h,"INDIRECT",256),a(h,"QUERY_RESOLVE",512),a(h,"MAP_READ",1),a(h,"MAP_WRITE",2),a(h,"COPY_SRC",4),a(h,"COPY_DST",8),a(h,"DEBUG_DATA_MAX_LENGTH",32),a(h,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0});function F(r){let[e,t,i]=Le[r],n=r.includes("norm"),s=!n&&!r.startsWith("float"),o=r.startsWith("s");return{signedType:e,primitiveType:t,byteLength:i,normalized:n,integer:s,signed:o}}function me(r){let e=r;switch(e){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return e}}function ft(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function de(r){let e=ArrayBuffer.isView(r)?r.constructor:r;if(e===Uint8ClampedArray)return"uint8";let t=Object.values(Le).find(i=>e===i[4]);if(!t)throw new Error(e.name);return t[0]}function lt(r){let[,,,,e]=Le[r];return e}var Le={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};function E(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,i]=r.split("x"),n=t,s=i?parseInt(i):1,o=F(n),c={type:n,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(c.webglOnly=!0),c}function De(r,e,t){let i=t?me(r):r;switch(i){case"unorm8":return e===1?"unorm8":e===3?"unorm8x3-webgl":`${i}x${e}`;case"snorm8":case"uint8":case"sint8":case"uint16":case"sint16":case"unorm16":case"snorm16":case"float16":if(e===1||e===3)throw new Error(`size: ${e}`);return`${i}x${e}`;default:return e===1?i:`${i}x${e}`}}function mt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=de(r);return De(n,i,t)}function dt(r){let e;switch(r.primitiveType){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return r.components<=2?"float16x2":"float16x4"}return r.components===1?e:`${e}x${r.components}`}var b="texture-compression-bc",m="texture-compression-astc",y="texture-compression-etc2",Kt="texture-compression-etc1-webgl",he="texture-compression-pvrtc-webgl",Be="texture-compression-atc-webgl",pe="float32-renderable-webgl",Me="float16-renderable-webgl",Jt="rgb9e5ufloat-renderable-webgl",Fe="snorm8-renderable-webgl",V="norm16-renderable-webgl",ze="snorm16-renderable-webgl",ge="float32-filterable",ht="float16-filterable-webgl";function O(r){let e=gt[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}function pt(){return gt}var Qt={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:Fe},rg8snorm:{render:Fe},"rgb8snorm-webgl":{},rgba8snorm:{render:Fe},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:V},rg16unorm:{render:V},"rgb16unorm-webgl":{f:V},rgba16unorm:{render:V},r16snorm:{f:ze},rg16snorm:{render:ze},"rgb16snorm-webgl":{f:V},rgba16snorm:{render:ze},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:Me,filter:"float16-filterable-webgl"},rg16float:{render:Me,filter:ht},rgba16float:{render:Me,filter:ht},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:pe,filter:ge},rg32float:{render:!1,filter:ge},"rgb32float-webgl":{render:pe,filter:ge},rgba32float:{render:pe,filter:ge},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:Jt},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:pe},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},Zt={"bc1-rgb-unorm-webgl":{f:b},"bc1-rgb-unorm-srgb-webgl":{f:b},"bc1-rgba-unorm":{f:b},"bc1-rgba-unorm-srgb":{f:b},"bc2-rgba-unorm":{f:b},"bc2-rgba-unorm-srgb":{f:b},"bc3-rgba-unorm":{f:b},"bc3-rgba-unorm-srgb":{f:b},"bc4-r-unorm":{f:b},"bc4-r-snorm":{f:b},"bc5-rg-unorm":{f:b},"bc5-rg-snorm":{f:b},"bc6h-rgb-ufloat":{f:b},"bc6h-rgb-float":{f:b},"bc7-rgba-unorm":{f:b},"bc7-rgba-unorm-srgb":{f:b},"etc2-rgb8unorm":{f:y},"etc2-rgb8unorm-srgb":{f:y},"etc2-rgb8a1unorm":{f:y},"etc2-rgb8a1unorm-srgb":{f:y},"etc2-rgba8unorm":{f:y},"etc2-rgba8unorm-srgb":{f:y},"eac-r11unorm":{f:y},"eac-r11snorm":{f:y},"eac-rg11unorm":{f:y},"eac-rg11snorm":{f:y},"astc-4x4-unorm":{f:m},"astc-4x4-unorm-srgb":{f:m},"astc-5x4-unorm":{f:m},"astc-5x4-unorm-srgb":{f:m},"astc-5x5-unorm":{f:m},"astc-5x5-unorm-srgb":{f:m},"astc-6x5-unorm":{f:m},"astc-6x5-unorm-srgb":{f:m},"astc-6x6-unorm":{f:m},"astc-6x6-unorm-srgb":{f:m},"astc-8x5-unorm":{f:m},"astc-8x5-unorm-srgb":{f:m},"astc-8x6-unorm":{f:m},"astc-8x6-unorm-srgb":{f:m},"astc-8x8-unorm":{f:m},"astc-8x8-unorm-srgb":{f:m},"astc-10x5-unorm":{f:m},"astc-10x5-unorm-srgb":{f:m},"astc-10x6-unorm":{f:m},"astc-10x6-unorm-srgb":{f:m},"astc-10x8-unorm":{f:m},"astc-10x8-unorm-srgb":{f:m},"astc-10x10-unorm":{f:m},"astc-10x10-unorm-srgb":{f:m},"astc-12x10-unorm":{f:m},"astc-12x10-unorm-srgb":{f:m},"astc-12x12-unorm":{f:m},"astc-12x12-unorm-srgb":{f:m},"pvrtc-rgb4unorm-webgl":{f:he},"pvrtc-rgba4unorm-webgl":{f:he},"pvrtc-rbg2unorm-webgl":{f:he},"pvrtc-rgba2unorm-webgl":{f:he},"etc1-rbg-unorm-webgl":{f:Kt},"atc-rgb-unorm-webgl":{f:Be},"atc-rgba-unorm-webgl":{f:Be},"atc-rgbai-unorm-webgl":{f:Be}},gt={...Qt,...Zt};var er=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],tr=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,j=class{getInfo(e){return bt(e)}isColor(e){return e.startsWith("rgba")||e.startsWith("bgra")||e.startsWith("rgb")}isDepthStencil(e){return e.startsWith("depth")||e.startsWith("stencil")}isCompressed(e){return er.some(t=>e.startsWith(t))}getCapabilities(e){let t=O(e),i={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},n=bt(e),s=e.startsWith("depth")||e.startsWith("stencil"),o=n?.signed,c=n?.integer,f=n?.webgl;return i.render&&=!o,i.filter&&=!s&&!o&&!c&&!f,i}},_=new j;function bt(r){let e=rr(r);if(_.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;let i=ir(r);i&&(e.blockWidth=i.blockWidth,e.blockHeight=i.blockHeight)}let t=tr.exec(r);if(t){let[,i,n,s,o,c]=t,f=`${s}${n}`,d=F(f),p=d.byteLength*8,L=i.length,Bt=[p,L>=2?p:0,L>=3?p:0,L>=4?p:0];e={format:r,attachment:e.attachment,dataType:d.signedType,components:L,channels:i,integer:d.integer,signed:d.signed,normalized:d.normalized,bitsPerChannel:Bt,bytesPerPixel:d.byteLength*i.length,packed:e.packed,srgb:e.srgb},c==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function rr(r){let e=O(r),t=e.bytesPerPixel||1,i=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:r,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||e.channels?.length||1,bytesPerPixel:t,bitsPerChannel:i,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function ir(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,i,n]=t;return{blockWidth:Number(i),blockHeight:Number(n)}}return null}function xt(r){return typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof VideoFrame<"u"&&r instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas}function yt(r){if(typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height};if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement)return{width:r.naturalWidth,height:r.naturalHeight};if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement)return{width:r.videoWidth,height:r.videoHeight};if(typeof VideoFrame<"u"&&r instanceof VideoFrame)return{width:r.displayWidth,height:r.displayHeight};throw new Error("Unknown image type")}var be=class{},xe=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},$e=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=ae;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(e){this.props={...$e.defaultProps,...e},this.id=this.props.id||S(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return E(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return _.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let i=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(i),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,i=1){let n=Math.max(e,t,i);return 1+Math.floor(Math.log2(n))}isExternalImage(e){return xt(e)}getExternalImageSize(e){return yt(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return _.isCompressed(e)}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...i){return this.props.onError(e,t)?()=>{}:l.error(e.message,t,...i)}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
|
|
8
|
+
or create a device with the 'debug: true' prop.`;l.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=_.getCapabilities(e),i=s=>(typeof s=="string"?this.features.has(s):s)??!0,n=i(t.create);return{format:e,create:n,render:n&&i(t.render),filter:n&&i(t.filter),blend:n&&i(t.blend),store:n&&i(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&h.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array&&(t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},C=$e;a(C,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[i,n]=e.getDevicePixelSize();l.log(1,`${e} resized => ${i}x${n}px`)()},onPositionChange:(e,t)=>{let[i,n]=e.getPosition();l.log(1,`${e} repositioned => ${i},${n}`)()},onVisibilityChange:e=>l.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>l.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:l.get("debug")||void 0,debugShaders:l.get("debug-shaders")||void 0,debugFramebuffers:Boolean(l.get("debug-framebuffers")),debugFactories:Boolean(l.get("debug-factories")),debugWebGL:Boolean(l.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!1,_cachePipelines:!1,_cacheDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0});var nr="set luma.log.level=1 (or higher) to trace rendering",wt="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",we=class{stats=ae;log=l;VERSION="9.2.0-alpha.6";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw l.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),l.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");l.error("This version of luma.gl has already been initialized")()}l.log(1,`${this.VERSION} - ${nr}`)(),globalThis.luma=this}async createDevice(e={}){let t={...we.defaultProps,...e},i=this.selectAdapter(t.type,t.adapters);if(!i)throw new Error(wt);return t.waitForPageLoad&&await i.pageLoaded,await i.create(t)}async attachDevice(e,t){let i=this._getTypeFromHandle(e,t.adapters),n=i&&this.selectAdapter(i,t.adapters);if(!n)throw new Error(wt);return await n?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this._getAdapterMap(e);return Array.from(t).map(([,i])=>i).filter(i=>i.isSupported?.()).map(i=>i.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],i=this._getAdapterMap(e);for(let n of t)if(i.get(n)?.isSupported?.())return n;return null}selectAdapter(e,t=[]){let i=e;e==="best-available"&&(i=this.getBestAvailableAdapterType(t));let n=this._getAdapterMap(t);return i&&n.get(i)||null}enforceWebGL2(e=!0,t=[]){let n=this._getAdapterMap(t).get("webgl");n||l.warn("enforceWebGL2: webgl adapter not found")(),n?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(we.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let i of e)t.set(i.type,i);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e?.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?l.warn("WebGL1 is not supported",e)():l.warn("Unknown handle type",e)(),null)}},ye=we;a(ye,"defaultProps",{...C.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});var vt=new ye;var Se=class{get pageLoaded(){return ar()}},sr=x()&&typeof document<"u",or=()=>sr&&document.readyState==="complete",ve=null;function ar(){return ve||(or()||typeof window>"u"?ve=Promise.resolve():ve=new Promise(r=>window.addEventListener("load",()=>r()))),ve}function St(){let r,e;return{promise:new Promise((i,n)=>{r=i,e=n}),resolve:r,reject:e}}var z=class{static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=St();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...z.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,x()?e.canvas?typeof e.canvas=="string"?this.canvas=ur(e.canvas):this.canvas=e.canvas:this.canvas=fr(e):this.canvas={width:e.width||1,height:e.height||1},z.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):z.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],z.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(t=>this._handleIntersection(t)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(t=>this._handleResize(t));try{this._resizeObserver.observe(this.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.canvas,{box:"content-box"})}setTimeout(()=>this._observeDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}destroy(){this.destroyed=!0}setProps(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){this.canvas.width=e,this.canvas.height=t,this.drawingBufferWidth=e,this.drawingBufferHeight=t}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let i=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return lr(e,i,n,s,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDevicePixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_handleIntersection(e){let t=e.find(n=>n.target===this.canvas);if(!t)return;let i=t.isIntersecting;this.isVisible!==i&&(this.isVisible=i,this.device.props.onVisibilityChange(this))}_handleResize(e){let t=e.find(f=>f.target===this.canvas);if(!t)return;this.cssWidth=t.contentBoxSize[0].inlineSize,this.cssHeight=t.contentBoxSize[0].blockSize;let i=this.getDevicePixelSize(),n=t.devicePixelContentBoxSize?.[0].inlineSize||t.contentBoxSize[0].inlineSize*devicePixelRatio,s=t.devicePixelContentBoxSize?.[0].blockSize||t.contentBoxSize[0].blockSize*devicePixelRatio,[o,c]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(n,o)),this.devicePixelHeight=Math.max(1,Math.min(s,c)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:i})}_updateDrawingBufferSize(){if(this.props.autoResize){if(typeof this.props.useDevicePixels=="number"){let e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._updateDevice()}this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_observeDevicePixelRatio(){let e=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:e}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(e=100){let t=setInterval(()=>{this.destroyed?clearInterval(t):this.updatePosition()},e)}updatePosition(){let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let n=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:n})}}}},$=z;a($,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1});function cr(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}return r||document.body}function ur(r){let e=document.getElementById(r);if(!$.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function fr(r){let{width:e,height:t}=r,i=document.createElement("canvas");i.id=S("lumagl-auto-created-canvas"),i.width=e||1,i.height=t||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(i.style.visibility="hidden");let n=cr(r?.container||null);return n.insertBefore(i,n.firstChild),i}function lr(r,e,t,i,n){let s=r,o=Tt(s[0],e,t),c=Pt(s[1],e,i,n),f=Tt(s[0]+1,e,t),d=f===t-1?f:f-1;f=Pt(s[1]+1,e,i,n);let p;return n?(f=f===0?f:f+1,p=c,c=f):p=f===i-1?f:f-1,{x:o,y:c,width:Math.max(d-o+1,1),height:Math.max(p-c+1,1)}}function Tt(r,e,t){return Math.min(Math.round(r*e),t-1)}function Pt(r,e,t,i){return i?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Te=class extends u{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Te.normalizeProps(e,t),super(e,t,Te.defaultProps)}static normalizeProps(e,t){return t}},I=Te;a(I,"defaultProps",{...u.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var mr={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},w=class extends u{dimension;baseDimension;format;width;height;depth;mipLevels;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(e,t){if(t=w.normalizeProps(e,t),super(e,t,w.defaultProps),this.dimension=this.props.dimension,this.baseDimension=mr[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.props.width===void 0||this.props.height===void 0)if(e.isExternalImage(t.data)){let i=e.getExternalImageSize(t.data);this.width=i?.width||1,this.height=i?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&l.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=e.incrementTimestamp()}setSampler(e){this.sampler=e instanceof I?e:this.device.createSampler(e)}clone(e){return this.device.createTexture({...this.props,...e})}static normalizeProps(e,t){let i={...t},{width:n,height:s}=i;return typeof n=="number"&&(i.width=Math.max(1,Math.ceil(n))),typeof s=="number"&&(i.height=Math.max(1,Math.ceil(s))),i}_initializeData(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{width:t,height:i,depth:n}=this,s={...w.defaultCopyDataOptions,width:t,height:i,depth:n,...e},o=this.device.getTextureFormatInfo(this.format);if(!e.bytesPerRow&&!o.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return s.bytesPerRow=e.bytesPerRow||t*(o.bytesPerPixel||4),s.rowsPerImage=e.rowsPerImage||i,s}_normalizeCopyExternalImageOptions(e){let t=this.device.getExternalImageSize(e.image),i={...w.defaultCopyExternalImageOptions,...t,...e};return i.width=Math.min(i.width,this.width-i.x),i.height=Math.min(i.height,this.height-i.y),i}},g=w;a(g,"SAMPLE",4),a(g,"STORAGE",8),a(g,"RENDER",16),a(g,"COPY_SRC",1),a(g,"COPY_DST",2),a(g,"TEXTURE",4),a(g,"RENDER_ATTACHMENT",16),a(g,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:w.TEXTURE|w.RENDER_ATTACHMENT|w.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),a(g,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),a(g,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1});var Ue=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,Ue.defaultProps)}},Y=Ue;a(Y,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var He=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,He.defaultProps)}},X=He;a(X,"defaultProps",{...u.defaultProps,source:void 0,colorSpace:"srgb"});function At(r,e,t){let i="",n=e.split(/\r?\n/),s=r.slice().sort((o,c)=>o.lineNum-c.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let c=1;c<=n.length;c++)for(i+=Et(n[c-1],c,t);s.length>o&&s[o].lineNum===c;){let f=s[o++];i+=Ne(f,n,f.lineNum,{...t,inlineSource:!1})}for(;s.length>o;){let c=s[o++];i+=Ne(c,[],0,{...t,inlineSource:!1})}return i;case"issues":case"no":for(let c of r)i+=Ne(c,n,c.lineNum,{inlineSource:t?.showSourceCode!=="no"});return i}}function Ne(r,e,t,i){if(i?.inlineSource){let s=dr(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
|
|
9
9
|
`:"";return`
|
|
10
10
|
${s}${o}${r.type.toUpperCase()}: ${r.message}
|
|
11
11
|
|
|
12
|
-
`}let n=r.type==="error"?"red":"#8B4000";return i?.html?`<div class='luma-compiler-log-error' style="color:${n};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function
|
|
13
|
-
`}`}function
|
|
12
|
+
`}let n=r.type==="error"?"red":"#8B4000";return i?.html?`<div class='luma-compiler-log-error' style="color:${n};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function dr(r,e,t){let i="";for(let n=e-2;n<=e;n++){let s=r[n-1];s!==void 0&&(i+=Et(s,e,t))}return i}function Et(r,e,t){let i=t?.html?pr(r):r;return`${hr(String(e),4)}: ${i}${t?.html?"<br/>":`
|
|
13
|
+
`}`}function hr(r,e){let t="";for(let i=r.length;i<e;++i)t+=" ";return t+r}function pr(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}var ke=class extends u{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:gr(t),...t},ke.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t,this.id)}_displayShaderLog(e,t){if(typeof document>"u"||!document?.createElement)return;let i=t,n=`${this.stage} shader "${i}"`,s=At(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(s+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let c=document.createElement("Button");c.innerHTML=`
|
|
14
14
|
<h1>Compilation error in ${n}</h1><br /><br />
|
|
15
15
|
<code style="user-select:text;"><pre>
|
|
16
16
|
${s}
|
|
17
|
-
</pre></code>`,c.style.top="10px",c.style.left="10px",c.style.position="absolute",c.style.zIndex="9999",c.style.width="100%",c.style.textAlign="left",document.body.appendChild(c),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),c.onclick=()=>{let h=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(h)}}},q=ke;a(q,"defaultProps",{...u.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function br(r){return xr(r.source)||r.id||T(`unnamed ${r.stage}-shader`)}function xr(r,e="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return i?i[1]:e}var We=class extends u{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,We.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(n=>n.texture.clone(e)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:i})}resize(e){let t=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||i!==this.width,this.width=i,this.height=n}t&&(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((t,i)=>{if(typeof t=="string"){let n=this.createColorTexture(t,i);return this.attachResource(n),n.view}return t instanceof p?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof p?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:p.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:p.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.colorAttachments[i].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}this.updateAttachments()}},K=We;a(K,"defaultProps",{...u.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Ge=class extends u{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Ge.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},J=Ge;a(J,"defaultProps",{...u.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}});var L=class extends u{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=L.normalizeProps(e,t),super(e,t,L.defaultProps)}static normalizeProps(e,t){return t}},S=L;a(S,"defaultClearColor",[0,0,0,1]),a(S,"defaultClearDepth",1),a(S,"defaultClearStencil",0),a(S,"defaultProps",{...u.defaultProps,framebuffer:null,parameters:void 0,clearColor:L.defaultClearColor,clearColors:void 0,clearDepth:L.defaultClearDepth,clearStencil:L.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ve=class extends u{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Ve.defaultProps),this.shaderLayout=t.shaderLayout}},Q=Ve;a(Q,"defaultProps",{...u.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Oe=class extends u{constructor(e,t){super(e,t,Oe.defaultProps)}get[Symbol.toStringTag](){return"ComputePass"}},Z=Oe;a(Z,"defaultProps",{...u.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var je=class extends u{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,je.defaultProps)}},ee=je;a(ee,"defaultProps",{...u.defaultProps,measureExecutionTime:void 0});var Ye=class extends u{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,Ye.defaultProps)}},te=Ye;a(te,"defaultProps",{...u.defaultProps});function Pe(r){return vr[r]}function Ae(r){let[e,t]=wr[r],i=e==="i32"||e==="u32",n=e!=="u32",s=yr[e]*t;return{primitiveType:e,components:t,byteLength:s,integer:i,signed:n}}var yr={f32:4,f16:2,i32:4,u32:4},wr={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]},vr={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},Tr={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},qn={...Tr,mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"};function Xe(r,e){let t={};for(let i of r.attributes){let n=Sr(r,e,i.name);n&&(t[i.name]=n)}return t}function _t(r,e,t=16){let i=Xe(r,e),n=new Array(t).fill(null);for(let s of Object.values(i))n[s.location]=s;return n}function Sr(r,e,t){let i=Pr(r,t),n=Ar(e,t);if(!i)return null;let s=Ae(i.type),o=dt(s),c=n?.vertexFormat||o,f=_(c);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,primitiveType:s.primitiveType,shaderComponents:s.components,vertexFormat:c,bufferDataType:f.type,bufferComponents:f.components,normalized:f.normalized,integer:s.integer,stepMode:n?.stepMode||i.stepMode||"vertex",byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Pr(r,e){let t=r.attributes.find(i=>i.name===e);return t||l.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Ar(r,e){Er(r);let t=_r(r,e);return t||(t=Cr(r,e),t)?t:(l.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Er(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function _r(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function Cr(r,e){for(let t of r){let i=t.byteStride;if(typeof t.byteStride!="number")for(let s of t.attributes||[]){let o=_(s.format);i+=o.byteLength}let n=t.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}var qe=class extends u{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,qe.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=_t(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"),this)()}},re=qe;a(re,"defaultProps",{...u.defaultProps,shaderLayout:void 0,bufferLayout:[]});var Ke=class extends u{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ke.defaultProps)}},ie=Ke;a(ie,"defaultProps",{...u.defaultProps,layout:void 0,buffers:{}});var Je=class extends u{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,Je.defaultProps)}},ne=Je;a(ne,"defaultProps",{...u.defaultProps,type:void 0,count:void 0});var Qe=class extends u{get[Symbol.toStringTag](){return"PipelineLayout"}constructor(e,t){super(e,t,Qe.defaultProps)}},se=Qe;a(se,"defaultProps",{...u.defaultProps,shaderLayout:{attributes:[],bindings:[]}});var Ee;function Ze(r){return(!Ee||Ee.byteLength<r)&&(Ee=new ArrayBuffer(r)),Ee}function Ct(r,e){let t=Ze(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function Ir(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function U(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":Ir(r)}var It=1024,H=class{layout={};byteLength;constructor(e){let t=0;for(let[n,s]of Object.entries(e)){let o=Pe(s),{type:c,components:f}=o;t=ft(t,f);let h=t;t+=f,this.layout[n]={type:c,size:f,offset:h}}t+=(4-t%4)%4;let i=t*4;this.byteLength=Math.max(i,It)}getData(e){let t=Math.max(this.byteLength,It),i=Ze(t),n={i32:new Int32Array(i),u32:new Uint32Array(i),f32:new Float32Array(i),f16:new Uint16Array(i)};for(let[s,o]of Object.entries(e)){let c=this.layout[s];if(!c){l.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:f,size:h,offset:g}=c,P=n[f];if(h===1){if(typeof o!="number"&&typeof o!="boolean"){l.warn(`Supplied value for single component uniform ${s} is not a number: ${o}`)();continue}P[g]=Number(o)}else{if(!U(o)){l.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${o}`)();continue}P.set(o,g)}}return new Uint8Array(i)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function Rt(r,e,t=16){if(r!==e)return!1;let i=r,n=e;if(!U(i))return!1;if(U(n)&&i.length===n.length){for(let s=0;s<i.length;++s)if(n[s]!==i[s])return!1}return!0}function Lt(r){return U(r)?r.slice():r}var N=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!t)throw new Error(e?.name);let i=t;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,i]of Object.entries(e))this._setUniform(t,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){Rt(this.uniforms[e],t)||(this.uniforms[e]=Lt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var _e=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,i]of Object.entries(e)){let n=t,s=new H(i.uniformTypes||{});this.uniformBufferLayouts.set(n,s);let o=new N({name:t});o.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,i]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:d.UNIFORM|d.COPY_DST,byteLength:n}),o=this.getUniformBufferData(t);return s.write(o),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let i=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:d.UNIFORM|d.COPY_DST,byteLength:i});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(t);e||=i}return e&&l.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&t?.needsRedraw){n||=t.needsRedraw;let s=this.getUniformBufferData(e);i=this.uniformBuffers.get(e),i?.write(s);let o=this.uniformBlocks.get(e)?.getAllUniforms();l.log(4,`Writing to uniform buffer ${String(e)}`,s,o)()}return n}};function Bt(r,e,t,i){if(e<0||e>=r.width||t<0||t>=r.height)throw new Error("Coordinates out of bounds.");let n=t*r.bytesPerRow+e*r.bytesPerPixel,s=new DataView(r.arrayBuffer,n,r.bytesPerPixel),o=0,c=[];for(let f=0;f<4;f++){let h=i[f];if(h<=0)c.push(0);else{let g=Rr(s,o,h);c.push(g),o+=h}}return[c[0],c[1],c[2],c[3]]}function Dt(r,e,t,i){let n=e;for(let s=0;s<4;s++){let o=t[s],c=(1<<o)-1,f=i[s]&c;Lr(r,n,o,f),n+=o}}function Rr(r,e,t){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength)return r.getUint8(n);if(t===16&&n+2<=r.byteLength)return r.getUint16(n,!1);if(t===32&&n+4<=r.byteLength)return r.getUint32(n,!1)}let i=0;for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),c=s%8,h=r.getUint8(o)>>7-c&1;i=i<<1|h}return i}function Lr(r,e,t,i){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength){r.setUint8(n,i&255);return}else if(t===16&&n+2<=r.byteLength){r.setUint16(n,i&65535,!1);return}else if(t===32&&n+4<=r.byteLength){r.setUint32(n,i,!1);return}}for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),f=1<<7-s%8,h=i>>t-1-n&1,g=r.getUint8(o);g&=~f,h&&(g|=f),r.setUint8(o,g)}}return kt(Br);})();
|
|
17
|
+
</pre></code>`,c.style.top="10px",c.style.left="10px",c.style.position="absolute",c.style.zIndex="9999",c.style.width="100%",c.style.textAlign="left",document.body.appendChild(c),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),c.onclick=()=>{let d=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(d)}}},q=ke;a(q,"defaultProps",{...u.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function gr(r){return br(r.source)||r.id||S(`unnamed ${r.stage}-shader`)}function br(r,e="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return i?i[1]:e}var We=class extends u{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,We.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(n=>n.texture.clone(e)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:i})}resize(e){let t=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||i!==this.width,this.width=i,this.height=n}t&&(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((t,i)=>{if(typeof t=="string"){let n=this.createColorTexture(t,i);return this.attachResource(n),n.view}return t instanceof g?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof g?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.colorAttachments[i].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}this.updateAttachments()}},K=We;a(K,"defaultProps",{...u.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var Ge=class extends u{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,Ge.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},J=Ge;a(J,"defaultProps",{...u.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}});var R=class extends u{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=R.normalizeProps(e,t),super(e,t,R.defaultProps)}static normalizeProps(e,t){return t}},T=R;a(T,"defaultClearColor",[0,0,0,1]),a(T,"defaultClearDepth",1),a(T,"defaultClearStencil",0),a(T,"defaultProps",{...u.defaultProps,framebuffer:null,parameters:void 0,clearColor:R.defaultClearColor,clearColors:void 0,clearDepth:R.defaultClearDepth,clearStencil:R.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ve=class extends u{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Ve.defaultProps),this.shaderLayout=t.shaderLayout}},Q=Ve;a(Q,"defaultProps",{...u.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Oe=class extends u{constructor(e,t){super(e,t,Oe.defaultProps)}get[Symbol.toStringTag](){return"ComputePass"}},Z=Oe;a(Z,"defaultProps",{...u.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var je=class extends u{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,je.defaultProps)}},ee=je;a(ee,"defaultProps",{...u.defaultProps,measureExecutionTime:void 0});var Ye=class extends u{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,Ye.defaultProps)}},te=Ye;a(te,"defaultProps",{...u.defaultProps});function Pe(r){return wr[r]}function Ae(r){let[e,t]=yr[r],i=e==="i32"||e==="u32",n=e!=="u32",s=xr[e]*t;return{primitiveType:e,components:t,byteLength:s,integer:i,signed:n}}var xr={f32:4,f16:2,i32:4,u32:4},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]},wr={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},vr={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},qn={...vr,mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"};function Xe(r,e){let t={};for(let i of r.attributes){let n=Sr(r,e,i.name);n&&(t[i.name]=n)}return t}function _t(r,e,t=16){let i=Xe(r,e),n=new Array(t).fill(null);for(let s of Object.values(i))n[s.location]=s;return n}function Sr(r,e,t){let i=Tr(r,t),n=Pr(e,t);if(!i)return null;let s=Ae(i.type),o=dt(s),c=n?.vertexFormat||o,f=E(c);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,primitiveType:s.primitiveType,shaderComponents:s.components,vertexFormat:c,bufferDataType:f.type,bufferComponents:f.components,normalized:f.normalized,integer:s.integer,stepMode:n?.stepMode||i.stepMode||"vertex",byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Tr(r,e){let t=r.attributes.find(i=>i.name===e);return t||l.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Pr(r,e){Ar(r);let t=Er(r,e);return t||(t=_r(r,e),t)?t:(l.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Ar(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Er(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function _r(r,e){for(let t of r){let i=t.byteStride;if(typeof t.byteStride!="number")for(let s of t.attributes||[]){let o=E(s.format);i+=o.byteLength}let n=t.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}var qe=class extends u{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,qe.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=_t(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"),this)()}},re=qe;a(re,"defaultProps",{...u.defaultProps,shaderLayout:void 0,bufferLayout:[]});var Ke=class extends u{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ke.defaultProps)}},ie=Ke;a(ie,"defaultProps",{...u.defaultProps,layout:void 0,buffers:{}});var Je=class extends u{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,Je.defaultProps)}},ne=Je;a(ne,"defaultProps",{...u.defaultProps,type:void 0,count:void 0});var Qe=class extends u{get[Symbol.toStringTag](){return"PipelineLayout"}constructor(e,t){super(e,t,Qe.defaultProps)}},se=Qe;a(se,"defaultProps",{...u.defaultProps,shaderLayout:{attributes:[],bindings:[]}});var Ee;function Ze(r){return(!Ee||Ee.byteLength<r)&&(Ee=new ArrayBuffer(r)),Ee}function Ct(r,e){let t=Ze(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function Cr(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function U(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":Cr(r)}var Ir=1024,H=class{layout={};byteLength;constructor(e,t={}){let i=0;for(let[s,o]of Object.entries(e)){let c=Pe(o),{type:f,components:d}=c,p=d*(t?.[s]??1);i=ft(i,p);let L=i;i+=p,this.layout[s]={type:f,size:p,offset:L}}i+=(4-i%4)%4;let n=i*4;this.byteLength=Math.max(n,Ir)}getData(e){let t=Ze(this.byteLength),i={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)};for(let[n,s]of Object.entries(e)){let o=this.layout[n];if(!o){l.warn(`Supplied uniform value ${n} not present in uniform block layout`)();continue}let{type:c,size:f,offset:d}=o,p=i[c];if(f===1){if(typeof s!="number"&&typeof s!="boolean"){l.warn(`Supplied value for single component uniform ${n} is not a number: ${s}`)();continue}p[d]=Number(s)}else{if(!U(s)){l.warn(`Supplied value for multi component / array uniform ${n} is not a numeric array: ${s}`)();continue}p.set(s,d)}}return new Uint8Array(t,0,this.byteLength)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function It(r,e,t=16){if(r!==e)return!1;let i=r,n=e;if(!U(i))return!1;if(U(n)&&i.length===n.length){for(let s=0;s<i.length;++s)if(n[s]!==i[s])return!1}return!0}function Rt(r){return U(r)?r.slice():r}var N=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!t)throw new Error(e?.name);let i=t;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,i]of Object.entries(e))this._setUniform(t,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){It(this.uniforms[e],t)||(this.uniforms[e]=Rt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var _e=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,i]of Object.entries(e)){let n=t,s=new H(i.uniformTypes??{},i.uniformSizes??{});this.uniformBufferLayouts.set(n,s);let o=new N({name:t});o.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,i]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:h.UNIFORM|h.COPY_DST,byteLength:n}),o=this.getUniformBufferData(t);return s.write(o),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let i=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:h.UNIFORM|h.COPY_DST,byteLength:i});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(t);e||=i}return e&&l.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&t?.needsRedraw){n||=t.needsRedraw;let s=this.getUniformBufferData(e);i=this.uniformBuffers.get(e),i?.write(s);let o=this.uniformBlocks.get(e)?.getAllUniforms();l.log(4,`Writing to uniform buffer ${String(e)}`,s,o)()}return n}};function Lt(r,e,t,i){if(e<0||e>=r.width||t<0||t>=r.height)throw new Error("Coordinates out of bounds.");let n=t*r.bytesPerRow+e*r.bytesPerPixel,s=new DataView(r.arrayBuffer,n,r.bytesPerPixel),o=0,c=[];for(let f=0;f<4;f++){let d=i[f];if(d<=0)c.push(0);else{let p=Rr(s,o,d);c.push(p),o+=d}}return[c[0],c[1],c[2],c[3]]}function Dt(r,e,t,i){let n=e;for(let s=0;s<4;s++){let o=t[s],c=(1<<o)-1,f=i[s]&c;Lr(r,n,o,f),n+=o}}function Rr(r,e,t){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength)return r.getUint8(n);if(t===16&&n+2<=r.byteLength)return r.getUint16(n,!1);if(t===32&&n+4<=r.byteLength)return r.getUint32(n,!1)}let i=0;for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),c=s%8,d=r.getUint8(o)>>7-c&1;i=i<<1|d}return i}function Lr(r,e,t,i){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength){r.setUint8(n,i&255);return}else if(t===16&&n+2<=r.byteLength){r.setUint16(n,i&65535,!1);return}else if(t===32&&n+4<=r.byteLength){r.setUint32(n,i,!1);return}}for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),f=1<<7-s%8,d=i>>t-1-n&1,p=r.getUint8(o);p&=~f,d&&(p|=f),r.setUint8(o,p)}}return Nt(Dr);})();
|
|
18
18
|
return __exports__;
|
|
19
19
|
});
|