@blueking/monitor-trace-log 1.0.0-beta.4 → 1.0.0-beta.5

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/151.js ADDED
@@ -0,0 +1,4047 @@
1
+ export const __webpack_id__ = 151;
2
+ export const __webpack_ids__ = [151];
3
+ export const __webpack_modules__ = {
4
+
5
+ /***/ 3151:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+
9
+ // EXPORTS
10
+ __webpack_require__.d(__webpack_exports__, {
11
+ WebGLRenderer: () => (/* binding */ WebGLRenderer)
12
+ });
13
+
14
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/extensions/Extensions.mjs
15
+ var Extensions = __webpack_require__(8507);
16
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/maths/matrix/Matrix.mjs
17
+ var Matrix = __webpack_require__(9313);
18
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/batcher/gl/utils/maxRecommendedTextures.mjs + 1 modules
19
+ var maxRecommendedTextures = __webpack_require__(6563);
20
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/high-shader/compileHighShaderToProgram.mjs + 8 modules
21
+ var compileHighShaderToProgram = __webpack_require__(5611);
22
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/high-shader/shader-bits/colorBit.mjs
23
+ var colorBit = __webpack_require__(4459);
24
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/high-shader/shader-bits/generateTextureBatchBit.mjs
25
+ var generateTextureBatchBit = __webpack_require__(4000);
26
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/high-shader/shader-bits/localUniformBit.mjs
27
+ var localUniformBit = __webpack_require__(2067);
28
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/high-shader/shader-bits/roundPixelsBit.mjs
29
+ var roundPixelsBit = __webpack_require__(6665);
30
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/getBatchSamplersUniformGroup.mjs
31
+ var getBatchSamplersUniformGroup = __webpack_require__(6040);
32
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/shader/Shader.mjs
33
+ var Shader = __webpack_require__(8475);
34
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/shader/UniformGroup.mjs + 2 modules
35
+ var UniformGroup = __webpack_require__(5811);
36
+ ;// ./node_modules/pixi.js/lib/scene/graphics/gl/GlGraphicsAdaptor.mjs
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+ "use strict";
50
+ class GlGraphicsAdaptor {
51
+ init() {
52
+ const uniforms = new UniformGroup.UniformGroup({
53
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
54
+ uTransformMatrix: { value: new Matrix.Matrix(), type: "mat3x3<f32>" },
55
+ uRound: { value: 0, type: "f32" }
56
+ });
57
+ const maxTextures = (0,maxRecommendedTextures.getMaxTexturesPerBatch)();
58
+ const glProgram = (0,compileHighShaderToProgram.compileHighShaderGlProgram)({
59
+ name: "graphics",
60
+ bits: [
61
+ colorBit.colorBitGl,
62
+ (0,generateTextureBatchBit.generateTextureBatchBitGl)(maxTextures),
63
+ localUniformBit.localUniformBitGl,
64
+ roundPixelsBit.roundPixelsBitGl
65
+ ]
66
+ });
67
+ this.shader = new Shader.Shader({
68
+ glProgram,
69
+ resources: {
70
+ localUniforms: uniforms,
71
+ batchSamplers: (0,getBatchSamplersUniformGroup.getBatchSamplersUniformGroup)(maxTextures)
72
+ }
73
+ });
74
+ }
75
+ execute(graphicsPipe, renderable) {
76
+ const context = renderable.context;
77
+ const shader = context.customShader || this.shader;
78
+ const renderer = graphicsPipe.renderer;
79
+ const contextSystem = renderer.graphicsContext;
80
+ const {
81
+ batcher,
82
+ instructions
83
+ } = contextSystem.getContextRenderData(context);
84
+ shader.groups[0] = renderer.globalUniforms.bindGroup;
85
+ renderer.state.set(graphicsPipe.state);
86
+ renderer.shader.bind(shader);
87
+ renderer.geometry.bind(batcher.geometry, shader.glProgram);
88
+ const batches = instructions.instructions;
89
+ for (let i = 0; i < instructions.instructionSize; i++) {
90
+ const batch = batches[i];
91
+ if (batch.size) {
92
+ for (let j = 0; j < batch.textures.count; j++) {
93
+ renderer.texture.bind(batch.textures.textures[j], j);
94
+ }
95
+ renderer.geometry.draw(batch.topology, batch.size, batch.start);
96
+ }
97
+ }
98
+ }
99
+ destroy() {
100
+ this.shader.destroy(true);
101
+ this.shader = null;
102
+ }
103
+ }
104
+ /** @ignore */
105
+ GlGraphicsAdaptor.extension = {
106
+ type: [
107
+ Extensions.ExtensionType.WebGLPipesAdaptor
108
+ ],
109
+ name: "graphics"
110
+ };
111
+
112
+
113
+ //# sourceMappingURL=GlGraphicsAdaptor.mjs.map
114
+
115
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/high-shader/shader-bits/textureBit.mjs
116
+ var textureBit = __webpack_require__(3391);
117
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.mjs + 2 modules
118
+ var Texture = __webpack_require__(4492);
119
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/utils/logging/warn.mjs
120
+ var warn = __webpack_require__(268);
121
+ ;// ./node_modules/pixi.js/lib/scene/mesh/gl/GlMeshAdaptor.mjs
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+ "use strict";
133
+ class GlMeshAdaptor {
134
+ init() {
135
+ const glProgram = (0,compileHighShaderToProgram.compileHighShaderGlProgram)({
136
+ name: "mesh",
137
+ bits: [
138
+ localUniformBit.localUniformBitGl,
139
+ textureBit.textureBitGl,
140
+ roundPixelsBit.roundPixelsBitGl
141
+ ]
142
+ });
143
+ this._shader = new Shader.Shader({
144
+ glProgram,
145
+ resources: {
146
+ uTexture: Texture.Texture.EMPTY.source,
147
+ textureUniforms: {
148
+ uTextureMatrix: { type: "mat3x3<f32>", value: new Matrix.Matrix() }
149
+ }
150
+ }
151
+ });
152
+ }
153
+ execute(meshPipe, mesh) {
154
+ const renderer = meshPipe.renderer;
155
+ let shader = mesh._shader;
156
+ if (!shader) {
157
+ shader = this._shader;
158
+ const texture = mesh.texture;
159
+ const source = texture.source;
160
+ shader.resources.uTexture = source;
161
+ shader.resources.uSampler = source.style;
162
+ shader.resources.textureUniforms.uniforms.uTextureMatrix = texture.textureMatrix.mapCoord;
163
+ } else if (!shader.glProgram) {
164
+ (0,warn.warn)("Mesh shader has no glProgram", mesh.shader);
165
+ return;
166
+ }
167
+ shader.groups[100] = renderer.globalUniforms.bindGroup;
168
+ shader.groups[101] = meshPipe.localUniformsBindGroup;
169
+ renderer.encoder.draw({
170
+ geometry: mesh._geometry,
171
+ shader,
172
+ state: mesh.state
173
+ });
174
+ }
175
+ destroy() {
176
+ this._shader.destroy(true);
177
+ this._shader = null;
178
+ }
179
+ }
180
+ GlMeshAdaptor.extension = {
181
+ type: [
182
+ Extensions.ExtensionType.WebGLPipesAdaptor
183
+ ],
184
+ name: "mesh"
185
+ };
186
+
187
+
188
+ //# sourceMappingURL=GlMeshAdaptor.mjs.map
189
+
190
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/state/State.mjs
191
+ var State = __webpack_require__(7547);
192
+ ;// ./node_modules/pixi.js/lib/rendering/batcher/gl/GlBatchAdaptor.mjs
193
+
194
+
195
+
196
+ "use strict";
197
+ class GlBatchAdaptor {
198
+ constructor() {
199
+ this._didUpload = false;
200
+ this._tempState = State.State.for2d();
201
+ }
202
+ init(batcherPipe) {
203
+ batcherPipe.renderer.runners.contextChange.add(this);
204
+ }
205
+ contextChange() {
206
+ this._didUpload = false;
207
+ }
208
+ start(batchPipe, geometry, shader) {
209
+ const renderer = batchPipe.renderer;
210
+ renderer.shader.bind(shader, this._didUpload);
211
+ renderer.shader.updateUniformGroup(renderer.globalUniforms.uniformGroup);
212
+ renderer.geometry.bind(geometry, shader.glProgram);
213
+ }
214
+ execute(batchPipe, batch) {
215
+ const renderer = batchPipe.renderer;
216
+ this._didUpload = true;
217
+ this._tempState.blendMode = batch.blendMode;
218
+ renderer.state.set(this._tempState);
219
+ const textures = batch.textures.textures;
220
+ for (let i = 0; i < batch.textures.count; i++) {
221
+ renderer.texture.bind(textures[i], i);
222
+ }
223
+ renderer.geometry.draw(batch.topology, batch.size, batch.start);
224
+ }
225
+ }
226
+ /** @ignore */
227
+ GlBatchAdaptor.extension = {
228
+ type: [
229
+ Extensions.ExtensionType.WebGLPipesAdaptor
230
+ ],
231
+ name: "batch"
232
+ };
233
+
234
+
235
+ //# sourceMappingURL=GlBatchAdaptor.mjs.map
236
+
237
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/system/AbstractRenderer.mjs + 1 modules
238
+ var AbstractRenderer = __webpack_require__(800);
239
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/system/SharedSystems.mjs + 31 modules
240
+ var SharedSystems = __webpack_require__(3996);
241
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/types.mjs
242
+ var types = __webpack_require__(5099);
243
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/buffer/const.mjs
244
+ var buffer_const = __webpack_require__(1132);
245
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/buffer/const.mjs
246
+
247
+ var BUFFER_TYPE = /* @__PURE__ */ ((BUFFER_TYPE2) => {
248
+ BUFFER_TYPE2[BUFFER_TYPE2["ELEMENT_ARRAY_BUFFER"] = 34963] = "ELEMENT_ARRAY_BUFFER";
249
+ BUFFER_TYPE2[BUFFER_TYPE2["ARRAY_BUFFER"] = 34962] = "ARRAY_BUFFER";
250
+ BUFFER_TYPE2[BUFFER_TYPE2["UNIFORM_BUFFER"] = 35345] = "UNIFORM_BUFFER";
251
+ return BUFFER_TYPE2;
252
+ })(BUFFER_TYPE || {});
253
+
254
+
255
+ //# sourceMappingURL=const.mjs.map
256
+
257
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBuffer.mjs
258
+
259
+ class GlBuffer {
260
+ constructor(buffer, type) {
261
+ this._lastBindBaseLocation = -1;
262
+ this._lastBindCallId = -1;
263
+ this.buffer = buffer || null;
264
+ this.updateID = -1;
265
+ this.byteLength = -1;
266
+ this.type = type;
267
+ }
268
+ }
269
+
270
+
271
+ //# sourceMappingURL=GlBuffer.mjs.map
272
+
273
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.mjs
274
+
275
+
276
+
277
+
278
+
279
+ "use strict";
280
+ class GlBufferSystem {
281
+ /**
282
+ * @param {Renderer} renderer - The renderer this System works for.
283
+ */
284
+ constructor(renderer) {
285
+ this._gpuBuffers = /* @__PURE__ */ Object.create(null);
286
+ /** Cache keeping track of the base bound buffer bases */
287
+ this._boundBufferBases = /* @__PURE__ */ Object.create(null);
288
+ this._minBaseLocation = 0;
289
+ this._nextBindBaseIndex = this._minBaseLocation;
290
+ this._bindCallId = 0;
291
+ this._renderer = renderer;
292
+ this._renderer.renderableGC.addManagedHash(this, "_gpuBuffers");
293
+ }
294
+ /**
295
+ * @ignore
296
+ */
297
+ destroy() {
298
+ this._renderer = null;
299
+ this._gl = null;
300
+ this._gpuBuffers = null;
301
+ this._boundBufferBases = null;
302
+ }
303
+ /** Sets up the renderer context and necessary buffers. */
304
+ contextChange() {
305
+ const gl = this._gl = this._renderer.gl;
306
+ this._gpuBuffers = /* @__PURE__ */ Object.create(null);
307
+ this._maxBindings = gl.MAX_UNIFORM_BUFFER_BINDINGS ? gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS) : 0;
308
+ }
309
+ getGlBuffer(buffer) {
310
+ return this._gpuBuffers[buffer.uid] || this.createGLBuffer(buffer);
311
+ }
312
+ /**
313
+ * This binds specified buffer. On first run, it will create the webGL buffers for the context too
314
+ * @param buffer - the buffer to bind to the renderer
315
+ */
316
+ bind(buffer) {
317
+ const { _gl: gl } = this;
318
+ const glBuffer = this.getGlBuffer(buffer);
319
+ gl.bindBuffer(glBuffer.type, glBuffer.buffer);
320
+ }
321
+ /**
322
+ * Binds an uniform buffer to at the given index.
323
+ *
324
+ * A cache is used so a buffer will not be bound again if already bound.
325
+ * @param glBuffer - the buffer to bind
326
+ * @param index - the base index to bind it to.
327
+ */
328
+ bindBufferBase(glBuffer, index) {
329
+ const { _gl: gl } = this;
330
+ if (this._boundBufferBases[index] !== glBuffer) {
331
+ this._boundBufferBases[index] = glBuffer;
332
+ glBuffer._lastBindBaseLocation = index;
333
+ gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);
334
+ }
335
+ }
336
+ nextBindBase(hasTransformFeedback) {
337
+ this._bindCallId++;
338
+ this._minBaseLocation = 0;
339
+ if (hasTransformFeedback) {
340
+ this._boundBufferBases[0] = null;
341
+ this._minBaseLocation = 1;
342
+ if (this._nextBindBaseIndex < 1) {
343
+ this._nextBindBaseIndex = 1;
344
+ }
345
+ }
346
+ }
347
+ freeLocationForBufferBase(glBuffer) {
348
+ let freeIndex = this.getLastBindBaseLocation(glBuffer);
349
+ if (freeIndex >= this._minBaseLocation) {
350
+ glBuffer._lastBindCallId = this._bindCallId;
351
+ return freeIndex;
352
+ }
353
+ let loop = 0;
354
+ let nextIndex = this._nextBindBaseIndex;
355
+ while (loop < 2) {
356
+ if (nextIndex >= this._maxBindings) {
357
+ nextIndex = this._minBaseLocation;
358
+ loop++;
359
+ }
360
+ const curBuf = this._boundBufferBases[nextIndex];
361
+ if (curBuf && curBuf._lastBindCallId === this._bindCallId) {
362
+ nextIndex++;
363
+ continue;
364
+ }
365
+ break;
366
+ }
367
+ freeIndex = nextIndex;
368
+ this._nextBindBaseIndex = nextIndex + 1;
369
+ if (loop >= 2) {
370
+ return -1;
371
+ }
372
+ glBuffer._lastBindCallId = this._bindCallId;
373
+ this._boundBufferBases[freeIndex] = null;
374
+ return freeIndex;
375
+ }
376
+ getLastBindBaseLocation(glBuffer) {
377
+ const index = glBuffer._lastBindBaseLocation;
378
+ if (this._boundBufferBases[index] === glBuffer) {
379
+ return index;
380
+ }
381
+ return -1;
382
+ }
383
+ /**
384
+ * Binds a buffer whilst also binding its range.
385
+ * This will make the buffer start from the offset supplied rather than 0 when it is read.
386
+ * @param glBuffer - the buffer to bind
387
+ * @param index - the base index to bind at, defaults to 0
388
+ * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc
389
+ * @param size - the size to bind at (this is blocks of 256).
390
+ */
391
+ bindBufferRange(glBuffer, index, offset, size) {
392
+ const { _gl: gl } = this;
393
+ offset || (offset = 0);
394
+ index || (index = 0);
395
+ this._boundBufferBases[index] = null;
396
+ gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, size || 256);
397
+ }
398
+ /**
399
+ * Will ensure the data in the buffer is uploaded to the GPU.
400
+ * @param {Buffer} buffer - the buffer to update
401
+ */
402
+ updateBuffer(buffer) {
403
+ const { _gl: gl } = this;
404
+ const glBuffer = this.getGlBuffer(buffer);
405
+ if (buffer._updateID === glBuffer.updateID) {
406
+ return glBuffer;
407
+ }
408
+ glBuffer.updateID = buffer._updateID;
409
+ gl.bindBuffer(glBuffer.type, glBuffer.buffer);
410
+ const data = buffer.data;
411
+ const drawType = buffer.descriptor.usage & buffer_const.BufferUsage.STATIC ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;
412
+ if (data) {
413
+ if (glBuffer.byteLength >= data.byteLength) {
414
+ gl.bufferSubData(glBuffer.type, 0, data, 0, buffer._updateSize / data.BYTES_PER_ELEMENT);
415
+ } else {
416
+ glBuffer.byteLength = data.byteLength;
417
+ gl.bufferData(glBuffer.type, data, drawType);
418
+ }
419
+ } else {
420
+ glBuffer.byteLength = buffer.descriptor.size;
421
+ gl.bufferData(glBuffer.type, glBuffer.byteLength, drawType);
422
+ }
423
+ return glBuffer;
424
+ }
425
+ /** dispose all WebGL resources of all managed buffers */
426
+ destroyAll() {
427
+ const gl = this._gl;
428
+ for (const id in this._gpuBuffers) {
429
+ gl.deleteBuffer(this._gpuBuffers[id].buffer);
430
+ }
431
+ this._gpuBuffers = /* @__PURE__ */ Object.create(null);
432
+ }
433
+ /**
434
+ * Disposes buffer
435
+ * @param {Buffer} buffer - buffer with data
436
+ * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray
437
+ */
438
+ onBufferDestroy(buffer, contextLost) {
439
+ const glBuffer = this._gpuBuffers[buffer.uid];
440
+ const gl = this._gl;
441
+ if (!contextLost) {
442
+ gl.deleteBuffer(glBuffer.buffer);
443
+ }
444
+ this._gpuBuffers[buffer.uid] = null;
445
+ }
446
+ /**
447
+ * creates and attaches a GLBuffer object tied to the current context.
448
+ * @param buffer
449
+ * @protected
450
+ */
451
+ createGLBuffer(buffer) {
452
+ const { _gl: gl } = this;
453
+ let type = BUFFER_TYPE.ARRAY_BUFFER;
454
+ if (buffer.descriptor.usage & buffer_const.BufferUsage.INDEX) {
455
+ type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;
456
+ } else if (buffer.descriptor.usage & buffer_const.BufferUsage.UNIFORM) {
457
+ type = BUFFER_TYPE.UNIFORM_BUFFER;
458
+ }
459
+ const glBuffer = new GlBuffer(gl.createBuffer(), type);
460
+ this._gpuBuffers[buffer.uid] = glBuffer;
461
+ buffer.on("destroy", this.onBufferDestroy, this);
462
+ return glBuffer;
463
+ }
464
+ }
465
+ /** @ignore */
466
+ GlBufferSystem.extension = {
467
+ type: [
468
+ Extensions.ExtensionType.WebGLSystem
469
+ ],
470
+ name: "buffer"
471
+ };
472
+
473
+
474
+ //# sourceMappingURL=GlBufferSystem.mjs.map
475
+
476
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/environment/adapter.mjs + 1 modules
477
+ var adapter = __webpack_require__(1761);
478
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/context/GlContextSystem.mjs
479
+
480
+
481
+
482
+
483
+ "use strict";
484
+ const _GlContextSystem = class _GlContextSystem {
485
+ /** @param renderer - The renderer this System works for. */
486
+ constructor(renderer) {
487
+ /**
488
+ * Features supported by current renderer.
489
+ * @type {object}
490
+ * @readonly
491
+ */
492
+ this.supports = {
493
+ /** Support for 32-bit indices buffer. */
494
+ uint32Indices: true,
495
+ /** Support for UniformBufferObjects */
496
+ uniformBufferObject: true,
497
+ /** Support for VertexArrayObjects */
498
+ vertexArrayObject: true,
499
+ /** Support for SRGB texture format */
500
+ srgbTextures: true,
501
+ /** Support for wrapping modes if a texture is non-power of two */
502
+ nonPowOf2wrapping: true,
503
+ /** Support for MSAA (antialiasing of dynamic textures) */
504
+ msaa: true,
505
+ /** Support for mipmaps if a texture is non-power of two */
506
+ nonPowOf2mipmaps: true
507
+ };
508
+ this._renderer = renderer;
509
+ this.extensions = /* @__PURE__ */ Object.create(null);
510
+ this.handleContextLost = this.handleContextLost.bind(this);
511
+ this.handleContextRestored = this.handleContextRestored.bind(this);
512
+ }
513
+ /**
514
+ * `true` if the context is lost
515
+ * @readonly
516
+ */
517
+ get isLost() {
518
+ return !this.gl || this.gl.isContextLost();
519
+ }
520
+ /**
521
+ * Handles the context change event.
522
+ * @param {WebGLRenderingContext} gl - New WebGL context.
523
+ */
524
+ contextChange(gl) {
525
+ this.gl = gl;
526
+ this._renderer.gl = gl;
527
+ }
528
+ init(options) {
529
+ options = { ..._GlContextSystem.defaultOptions, ...options };
530
+ let multiView = this.multiView = options.multiView;
531
+ if (options.context && multiView) {
532
+ (0,warn.warn)("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together.");
533
+ multiView = false;
534
+ }
535
+ if (multiView) {
536
+ this.canvas = adapter.DOMAdapter.get().createCanvas(this._renderer.canvas.width, this._renderer.canvas.height);
537
+ } else {
538
+ this.canvas = this._renderer.view.canvas;
539
+ }
540
+ if (options.context) {
541
+ this.initFromContext(options.context);
542
+ } else {
543
+ const alpha = this._renderer.background.alpha < 1;
544
+ const premultipliedAlpha = options.premultipliedAlpha ?? true;
545
+ const antialias = options.antialias && !this._renderer.backBuffer.useBackBuffer;
546
+ this.createContext(options.preferWebGLVersion, {
547
+ alpha,
548
+ premultipliedAlpha,
549
+ antialias,
550
+ stencil: true,
551
+ preserveDrawingBuffer: options.preserveDrawingBuffer,
552
+ powerPreference: options.powerPreference ?? "default"
553
+ });
554
+ }
555
+ }
556
+ ensureCanvasSize(targetCanvas) {
557
+ if (!this.multiView) {
558
+ if (targetCanvas !== this.canvas) {
559
+ (0,warn.warn)("multiView is disabled, but targetCanvas is not the main canvas");
560
+ }
561
+ return;
562
+ }
563
+ const { canvas } = this;
564
+ if (canvas.width < targetCanvas.width || canvas.height < targetCanvas.height) {
565
+ canvas.width = Math.max(targetCanvas.width, targetCanvas.width);
566
+ canvas.height = Math.max(targetCanvas.height, targetCanvas.height);
567
+ }
568
+ }
569
+ /**
570
+ * Initializes the context.
571
+ * @protected
572
+ * @param {WebGLRenderingContext} gl - WebGL context
573
+ */
574
+ initFromContext(gl) {
575
+ this.gl = gl;
576
+ this.webGLVersion = gl instanceof adapter.DOMAdapter.get().getWebGLRenderingContext() ? 1 : 2;
577
+ this.getExtensions();
578
+ this.validateContext(gl);
579
+ this._renderer.runners.contextChange.emit(gl);
580
+ const element = this._renderer.view.canvas;
581
+ element.addEventListener("webglcontextlost", this.handleContextLost, false);
582
+ element.addEventListener("webglcontextrestored", this.handleContextRestored, false);
583
+ }
584
+ /**
585
+ * Initialize from context options
586
+ * @protected
587
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
588
+ * @param preferWebGLVersion
589
+ * @param {object} options - context attributes
590
+ */
591
+ createContext(preferWebGLVersion, options) {
592
+ let gl;
593
+ const canvas = this.canvas;
594
+ if (preferWebGLVersion === 2) {
595
+ gl = canvas.getContext("webgl2", options);
596
+ }
597
+ if (!gl) {
598
+ gl = canvas.getContext("webgl", options);
599
+ if (!gl) {
600
+ throw new Error("This browser does not support WebGL. Try using the canvas renderer");
601
+ }
602
+ }
603
+ this.gl = gl;
604
+ this.initFromContext(this.gl);
605
+ }
606
+ /** Auto-populate the {@link GlContextSystem.extensions extensions}. */
607
+ getExtensions() {
608
+ const { gl } = this;
609
+ const common = {
610
+ anisotropicFiltering: gl.getExtension("EXT_texture_filter_anisotropic"),
611
+ floatTextureLinear: gl.getExtension("OES_texture_float_linear"),
612
+ s3tc: gl.getExtension("WEBGL_compressed_texture_s3tc"),
613
+ s3tc_sRGB: gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
614
+ // eslint-disable-line camelcase
615
+ etc: gl.getExtension("WEBGL_compressed_texture_etc"),
616
+ etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
617
+ pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
618
+ atc: gl.getExtension("WEBGL_compressed_texture_atc"),
619
+ astc: gl.getExtension("WEBGL_compressed_texture_astc"),
620
+ bptc: gl.getExtension("EXT_texture_compression_bptc"),
621
+ rgtc: gl.getExtension("EXT_texture_compression_rgtc"),
622
+ loseContext: gl.getExtension("WEBGL_lose_context")
623
+ };
624
+ if (this.webGLVersion === 1) {
625
+ this.extensions = {
626
+ ...common,
627
+ drawBuffers: gl.getExtension("WEBGL_draw_buffers"),
628
+ depthTexture: gl.getExtension("WEBGL_depth_texture"),
629
+ vertexArrayObject: gl.getExtension("OES_vertex_array_object") || gl.getExtension("MOZ_OES_vertex_array_object") || gl.getExtension("WEBKIT_OES_vertex_array_object"),
630
+ uint32ElementIndex: gl.getExtension("OES_element_index_uint"),
631
+ // Floats and half-floats
632
+ floatTexture: gl.getExtension("OES_texture_float"),
633
+ floatTextureLinear: gl.getExtension("OES_texture_float_linear"),
634
+ textureHalfFloat: gl.getExtension("OES_texture_half_float"),
635
+ textureHalfFloatLinear: gl.getExtension("OES_texture_half_float_linear"),
636
+ vertexAttribDivisorANGLE: gl.getExtension("ANGLE_instanced_arrays"),
637
+ srgb: gl.getExtension("EXT_sRGB")
638
+ };
639
+ } else {
640
+ this.extensions = {
641
+ ...common,
642
+ colorBufferFloat: gl.getExtension("EXT_color_buffer_float")
643
+ };
644
+ const provokeExt = gl.getExtension("WEBGL_provoking_vertex");
645
+ if (provokeExt) {
646
+ provokeExt.provokingVertexWEBGL(provokeExt.FIRST_VERTEX_CONVENTION_WEBGL);
647
+ }
648
+ }
649
+ }
650
+ /**
651
+ * Handles a lost webgl context
652
+ * @param {WebGLContextEvent} event - The context lost event.
653
+ */
654
+ handleContextLost(event) {
655
+ event.preventDefault();
656
+ if (this._contextLossForced) {
657
+ this._contextLossForced = false;
658
+ setTimeout(() => {
659
+ if (this.gl.isContextLost()) {
660
+ this.extensions.loseContext?.restoreContext();
661
+ }
662
+ }, 0);
663
+ }
664
+ }
665
+ /** Handles a restored webgl context. */
666
+ handleContextRestored() {
667
+ this._renderer.runners.contextChange.emit(this.gl);
668
+ }
669
+ destroy() {
670
+ const element = this._renderer.view.canvas;
671
+ this._renderer = null;
672
+ element.removeEventListener("webglcontextlost", this.handleContextLost);
673
+ element.removeEventListener("webglcontextrestored", this.handleContextRestored);
674
+ this.gl.useProgram(null);
675
+ this.extensions.loseContext?.loseContext();
676
+ }
677
+ /**
678
+ * this function can be called to force a webGL context loss
679
+ * this will release all resources on the GPU.
680
+ * Useful if you need to put Pixi to sleep, and save some GPU memory
681
+ *
682
+ * As soon as render is called - all resources will be created again.
683
+ */
684
+ forceContextLoss() {
685
+ this.extensions.loseContext?.loseContext();
686
+ this._contextLossForced = true;
687
+ }
688
+ /**
689
+ * Validate context.
690
+ * @param {WebGLRenderingContext} gl - Render context.
691
+ */
692
+ validateContext(gl) {
693
+ const attributes = gl.getContextAttributes();
694
+ if (attributes && !attributes.stencil) {
695
+ (0,warn.warn)("Provided WebGL context does not have a stencil buffer, masks may not render correctly");
696
+ }
697
+ const supports = this.supports;
698
+ const isWebGl2 = this.webGLVersion === 2;
699
+ const extensions = this.extensions;
700
+ supports.uint32Indices = isWebGl2 || !!extensions.uint32ElementIndex;
701
+ supports.uniformBufferObject = isWebGl2;
702
+ supports.vertexArrayObject = isWebGl2 || !!extensions.vertexArrayObject;
703
+ supports.srgbTextures = isWebGl2 || !!extensions.srgb;
704
+ supports.nonPowOf2wrapping = isWebGl2;
705
+ supports.nonPowOf2mipmaps = isWebGl2;
706
+ supports.msaa = isWebGl2;
707
+ if (!supports.uint32Indices) {
708
+ (0,warn.warn)("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly");
709
+ }
710
+ }
711
+ };
712
+ /** @ignore */
713
+ _GlContextSystem.extension = {
714
+ type: [
715
+ Extensions.ExtensionType.WebGLSystem
716
+ ],
717
+ name: "context"
718
+ };
719
+ /** The default options for the system. */
720
+ _GlContextSystem.defaultOptions = {
721
+ /**
722
+ * {@link WebGLOptions.context}
723
+ * @default null
724
+ */
725
+ context: null,
726
+ /**
727
+ * {@link WebGLOptions.premultipliedAlpha}
728
+ * @default true
729
+ */
730
+ premultipliedAlpha: true,
731
+ /**
732
+ * {@link WebGLOptions.preserveDrawingBuffer}
733
+ * @default false
734
+ */
735
+ preserveDrawingBuffer: false,
736
+ /**
737
+ * {@link WebGLOptions.powerPreference}
738
+ * @default default
739
+ */
740
+ powerPreference: void 0,
741
+ /**
742
+ * {@link WebGLOptions.webGLVersion}
743
+ * @default 2
744
+ */
745
+ preferWebGLVersion: 2,
746
+ /**
747
+ * {@link WebGLOptions.multiView}
748
+ * @default false
749
+ */
750
+ multiView: false
751
+ };
752
+ let GlContextSystem = _GlContextSystem;
753
+
754
+
755
+ //# sourceMappingURL=GlContextSystem.mjs.map
756
+
757
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/geometry/utils/getAttributeInfoFromFormat.mjs
758
+ var getAttributeInfoFromFormat = __webpack_require__(8306);
759
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/ensureAttributes.mjs
760
+ var ensureAttributes = __webpack_require__(7084);
761
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/const.mjs
762
+
763
+ var GL_FORMATS = /* @__PURE__ */ ((GL_FORMATS2) => {
764
+ GL_FORMATS2[GL_FORMATS2["RGBA"] = 6408] = "RGBA";
765
+ GL_FORMATS2[GL_FORMATS2["RGB"] = 6407] = "RGB";
766
+ GL_FORMATS2[GL_FORMATS2["RG"] = 33319] = "RG";
767
+ GL_FORMATS2[GL_FORMATS2["RED"] = 6403] = "RED";
768
+ GL_FORMATS2[GL_FORMATS2["RGBA_INTEGER"] = 36249] = "RGBA_INTEGER";
769
+ GL_FORMATS2[GL_FORMATS2["RGB_INTEGER"] = 36248] = "RGB_INTEGER";
770
+ GL_FORMATS2[GL_FORMATS2["RG_INTEGER"] = 33320] = "RG_INTEGER";
771
+ GL_FORMATS2[GL_FORMATS2["RED_INTEGER"] = 36244] = "RED_INTEGER";
772
+ GL_FORMATS2[GL_FORMATS2["ALPHA"] = 6406] = "ALPHA";
773
+ GL_FORMATS2[GL_FORMATS2["LUMINANCE"] = 6409] = "LUMINANCE";
774
+ GL_FORMATS2[GL_FORMATS2["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA";
775
+ GL_FORMATS2[GL_FORMATS2["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT";
776
+ GL_FORMATS2[GL_FORMATS2["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL";
777
+ return GL_FORMATS2;
778
+ })(GL_FORMATS || {});
779
+ var GL_TARGETS = /* @__PURE__ */ ((GL_TARGETS2) => {
780
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_2D"] = 3553] = "TEXTURE_2D";
781
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP";
782
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY";
783
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X";
784
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X";
785
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y";
786
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y";
787
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z";
788
+ GL_TARGETS2[GL_TARGETS2["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z";
789
+ return GL_TARGETS2;
790
+ })(GL_TARGETS || {});
791
+ var GL_WRAP_MODES = /* @__PURE__ */ ((GL_WRAP_MODES2) => {
792
+ GL_WRAP_MODES2[GL_WRAP_MODES2["CLAMP"] = 33071] = "CLAMP";
793
+ GL_WRAP_MODES2[GL_WRAP_MODES2["REPEAT"] = 10497] = "REPEAT";
794
+ GL_WRAP_MODES2[GL_WRAP_MODES2["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT";
795
+ return GL_WRAP_MODES2;
796
+ })(GL_WRAP_MODES || {});
797
+ var GL_TYPES = /* @__PURE__ */ ((GL_TYPES2) => {
798
+ GL_TYPES2[GL_TYPES2["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE";
799
+ GL_TYPES2[GL_TYPES2["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT";
800
+ GL_TYPES2[GL_TYPES2["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5";
801
+ GL_TYPES2[GL_TYPES2["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4";
802
+ GL_TYPES2[GL_TYPES2["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1";
803
+ GL_TYPES2[GL_TYPES2["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT";
804
+ GL_TYPES2[GL_TYPES2["UNSIGNED_INT_10F_11F_11F_REV"] = 35899] = "UNSIGNED_INT_10F_11F_11F_REV";
805
+ GL_TYPES2[GL_TYPES2["UNSIGNED_INT_2_10_10_10_REV"] = 33640] = "UNSIGNED_INT_2_10_10_10_REV";
806
+ GL_TYPES2[GL_TYPES2["UNSIGNED_INT_24_8"] = 34042] = "UNSIGNED_INT_24_8";
807
+ GL_TYPES2[GL_TYPES2["UNSIGNED_INT_5_9_9_9_REV"] = 35902] = "UNSIGNED_INT_5_9_9_9_REV";
808
+ GL_TYPES2[GL_TYPES2["BYTE"] = 5120] = "BYTE";
809
+ GL_TYPES2[GL_TYPES2["SHORT"] = 5122] = "SHORT";
810
+ GL_TYPES2[GL_TYPES2["INT"] = 5124] = "INT";
811
+ GL_TYPES2[GL_TYPES2["FLOAT"] = 5126] = "FLOAT";
812
+ GL_TYPES2[GL_TYPES2["FLOAT_32_UNSIGNED_INT_24_8_REV"] = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV";
813
+ GL_TYPES2[GL_TYPES2["HALF_FLOAT"] = 36193] = "HALF_FLOAT";
814
+ return GL_TYPES2;
815
+ })(GL_TYPES || {});
816
+
817
+
818
+ //# sourceMappingURL=const.mjs.map
819
+
820
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/geometry/utils/getGlTypeFromFormat.mjs
821
+
822
+
823
+ "use strict";
824
+ const infoMap = {
825
+ uint8x2: GL_TYPES.UNSIGNED_BYTE,
826
+ uint8x4: GL_TYPES.UNSIGNED_BYTE,
827
+ sint8x2: GL_TYPES.BYTE,
828
+ sint8x4: GL_TYPES.BYTE,
829
+ unorm8x2: GL_TYPES.UNSIGNED_BYTE,
830
+ unorm8x4: GL_TYPES.UNSIGNED_BYTE,
831
+ snorm8x2: GL_TYPES.BYTE,
832
+ snorm8x4: GL_TYPES.BYTE,
833
+ uint16x2: GL_TYPES.UNSIGNED_SHORT,
834
+ uint16x4: GL_TYPES.UNSIGNED_SHORT,
835
+ sint16x2: GL_TYPES.SHORT,
836
+ sint16x4: GL_TYPES.SHORT,
837
+ unorm16x2: GL_TYPES.UNSIGNED_SHORT,
838
+ unorm16x4: GL_TYPES.UNSIGNED_SHORT,
839
+ snorm16x2: GL_TYPES.SHORT,
840
+ snorm16x4: GL_TYPES.SHORT,
841
+ float16x2: GL_TYPES.HALF_FLOAT,
842
+ float16x4: GL_TYPES.HALF_FLOAT,
843
+ float32: GL_TYPES.FLOAT,
844
+ float32x2: GL_TYPES.FLOAT,
845
+ float32x3: GL_TYPES.FLOAT,
846
+ float32x4: GL_TYPES.FLOAT,
847
+ uint32: GL_TYPES.UNSIGNED_INT,
848
+ uint32x2: GL_TYPES.UNSIGNED_INT,
849
+ uint32x3: GL_TYPES.UNSIGNED_INT,
850
+ uint32x4: GL_TYPES.UNSIGNED_INT,
851
+ sint32: GL_TYPES.INT,
852
+ sint32x2: GL_TYPES.INT,
853
+ sint32x3: GL_TYPES.INT,
854
+ sint32x4: GL_TYPES.INT
855
+ };
856
+ function getGlTypeFromFormat(format) {
857
+ return infoMap[format] ?? infoMap.float32;
858
+ }
859
+
860
+
861
+ //# sourceMappingURL=getGlTypeFromFormat.mjs.map
862
+
863
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/geometry/GlGeometrySystem.mjs
864
+
865
+
866
+
867
+
868
+
869
+ "use strict";
870
+ const topologyToGlMap = {
871
+ "point-list": 0,
872
+ "line-list": 1,
873
+ "line-strip": 3,
874
+ "triangle-list": 4,
875
+ "triangle-strip": 5
876
+ };
877
+ class GlGeometrySystem {
878
+ /** @param renderer - The renderer this System works for. */
879
+ constructor(renderer) {
880
+ this._geometryVaoHash = /* @__PURE__ */ Object.create(null);
881
+ this._renderer = renderer;
882
+ this._activeGeometry = null;
883
+ this._activeVao = null;
884
+ this.hasVao = true;
885
+ this.hasInstance = true;
886
+ this._renderer.renderableGC.addManagedHash(this, "_geometryVaoHash");
887
+ }
888
+ /** Sets up the renderer context and necessary buffers. */
889
+ contextChange() {
890
+ const gl = this.gl = this._renderer.gl;
891
+ if (!this._renderer.context.supports.vertexArrayObject) {
892
+ throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");
893
+ }
894
+ const nativeVaoExtension = this._renderer.context.extensions.vertexArrayObject;
895
+ if (nativeVaoExtension) {
896
+ gl.createVertexArray = () => nativeVaoExtension.createVertexArrayOES();
897
+ gl.bindVertexArray = (vao) => nativeVaoExtension.bindVertexArrayOES(vao);
898
+ gl.deleteVertexArray = (vao) => nativeVaoExtension.deleteVertexArrayOES(vao);
899
+ }
900
+ const nativeInstancedExtension = this._renderer.context.extensions.vertexAttribDivisorANGLE;
901
+ if (nativeInstancedExtension) {
902
+ gl.drawArraysInstanced = (a, b, c, d) => {
903
+ nativeInstancedExtension.drawArraysInstancedANGLE(a, b, c, d);
904
+ };
905
+ gl.drawElementsInstanced = (a, b, c, d, e) => {
906
+ nativeInstancedExtension.drawElementsInstancedANGLE(a, b, c, d, e);
907
+ };
908
+ gl.vertexAttribDivisor = (a, b) => nativeInstancedExtension.vertexAttribDivisorANGLE(a, b);
909
+ }
910
+ this._activeGeometry = null;
911
+ this._activeVao = null;
912
+ this._geometryVaoHash = /* @__PURE__ */ Object.create(null);
913
+ }
914
+ /**
915
+ * Binds geometry so that is can be drawn. Creating a Vao if required
916
+ * @param geometry - Instance of geometry to bind.
917
+ * @param program - Instance of program to use vao for.
918
+ */
919
+ bind(geometry, program) {
920
+ const gl = this.gl;
921
+ this._activeGeometry = geometry;
922
+ const vao = this.getVao(geometry, program);
923
+ if (this._activeVao !== vao) {
924
+ this._activeVao = vao;
925
+ gl.bindVertexArray(vao);
926
+ }
927
+ this.updateBuffers();
928
+ }
929
+ /** Reset and unbind any active VAO and geometry. */
930
+ reset() {
931
+ this.unbind();
932
+ }
933
+ /** Update buffers of the currently bound geometry. */
934
+ updateBuffers() {
935
+ const geometry = this._activeGeometry;
936
+ const bufferSystem = this._renderer.buffer;
937
+ for (let i = 0; i < geometry.buffers.length; i++) {
938
+ const buffer = geometry.buffers[i];
939
+ bufferSystem.updateBuffer(buffer);
940
+ }
941
+ }
942
+ /**
943
+ * Check compatibility between a geometry and a program
944
+ * @param geometry - Geometry instance.
945
+ * @param program - Program instance.
946
+ */
947
+ checkCompatibility(geometry, program) {
948
+ const geometryAttributes = geometry.attributes;
949
+ const shaderAttributes = program._attributeData;
950
+ for (const j in shaderAttributes) {
951
+ if (!geometryAttributes[j]) {
952
+ throw new Error(`shader and geometry incompatible, geometry missing the "${j}" attribute`);
953
+ }
954
+ }
955
+ }
956
+ /**
957
+ * Takes a geometry and program and generates a unique signature for them.
958
+ * @param geometry - To get signature from.
959
+ * @param program - To test geometry against.
960
+ * @returns - Unique signature of the geometry and program
961
+ */
962
+ getSignature(geometry, program) {
963
+ const attribs = geometry.attributes;
964
+ const shaderAttributes = program._attributeData;
965
+ const strings = ["g", geometry.uid];
966
+ for (const i in attribs) {
967
+ if (shaderAttributes[i]) {
968
+ strings.push(i, shaderAttributes[i].location);
969
+ }
970
+ }
971
+ return strings.join("-");
972
+ }
973
+ getVao(geometry, program) {
974
+ return this._geometryVaoHash[geometry.uid]?.[program._key] || this.initGeometryVao(geometry, program);
975
+ }
976
+ /**
977
+ * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.
978
+ * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the
979
+ * attribute locations.
980
+ * @param geometry - Instance of geometry to to generate Vao for.
981
+ * @param program
982
+ * @param _incRefCount - Increment refCount of all geometry buffers.
983
+ */
984
+ initGeometryVao(geometry, program, _incRefCount = true) {
985
+ const gl = this._renderer.gl;
986
+ const bufferSystem = this._renderer.buffer;
987
+ this._renderer.shader._getProgramData(program);
988
+ this.checkCompatibility(geometry, program);
989
+ const signature = this.getSignature(geometry, program);
990
+ if (!this._geometryVaoHash[geometry.uid]) {
991
+ this._geometryVaoHash[geometry.uid] = /* @__PURE__ */ Object.create(null);
992
+ geometry.on("destroy", this.onGeometryDestroy, this);
993
+ }
994
+ const vaoObjectHash = this._geometryVaoHash[geometry.uid];
995
+ let vao = vaoObjectHash[signature];
996
+ if (vao) {
997
+ vaoObjectHash[program._key] = vao;
998
+ return vao;
999
+ }
1000
+ (0,ensureAttributes.ensureAttributes)(geometry, program._attributeData);
1001
+ const buffers = geometry.buffers;
1002
+ vao = gl.createVertexArray();
1003
+ gl.bindVertexArray(vao);
1004
+ for (let i = 0; i < buffers.length; i++) {
1005
+ const buffer = buffers[i];
1006
+ bufferSystem.bind(buffer);
1007
+ }
1008
+ this.activateVao(geometry, program);
1009
+ vaoObjectHash[program._key] = vao;
1010
+ vaoObjectHash[signature] = vao;
1011
+ gl.bindVertexArray(null);
1012
+ return vao;
1013
+ }
1014
+ /**
1015
+ * Disposes geometry.
1016
+ * @param geometry - Geometry with buffers. Only VAO will be disposed
1017
+ * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray
1018
+ */
1019
+ onGeometryDestroy(geometry, contextLost) {
1020
+ const vaoObjectHash = this._geometryVaoHash[geometry.uid];
1021
+ const gl = this.gl;
1022
+ if (vaoObjectHash) {
1023
+ if (contextLost) {
1024
+ for (const i in vaoObjectHash) {
1025
+ if (this._activeVao !== vaoObjectHash[i]) {
1026
+ this.unbind();
1027
+ }
1028
+ gl.deleteVertexArray(vaoObjectHash[i]);
1029
+ }
1030
+ }
1031
+ this._geometryVaoHash[geometry.uid] = null;
1032
+ }
1033
+ }
1034
+ /**
1035
+ * Dispose all WebGL resources of all managed geometries.
1036
+ * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls
1037
+ */
1038
+ destroyAll(contextLost = false) {
1039
+ const gl = this.gl;
1040
+ for (const i in this._geometryVaoHash) {
1041
+ if (contextLost) {
1042
+ for (const j in this._geometryVaoHash[i]) {
1043
+ const vaoObjectHash = this._geometryVaoHash[i];
1044
+ if (this._activeVao !== vaoObjectHash) {
1045
+ this.unbind();
1046
+ }
1047
+ gl.deleteVertexArray(vaoObjectHash[j]);
1048
+ }
1049
+ }
1050
+ this._geometryVaoHash[i] = null;
1051
+ }
1052
+ }
1053
+ /**
1054
+ * Activate vertex array object.
1055
+ * @param geometry - Geometry instance.
1056
+ * @param program - Shader program instance.
1057
+ */
1058
+ activateVao(geometry, program) {
1059
+ const gl = this._renderer.gl;
1060
+ const bufferSystem = this._renderer.buffer;
1061
+ const attributes = geometry.attributes;
1062
+ if (geometry.indexBuffer) {
1063
+ bufferSystem.bind(geometry.indexBuffer);
1064
+ }
1065
+ let lastBuffer = null;
1066
+ for (const j in attributes) {
1067
+ const attribute = attributes[j];
1068
+ const buffer = attribute.buffer;
1069
+ const glBuffer = bufferSystem.getGlBuffer(buffer);
1070
+ const programAttrib = program._attributeData[j];
1071
+ if (programAttrib) {
1072
+ if (lastBuffer !== glBuffer) {
1073
+ bufferSystem.bind(buffer);
1074
+ lastBuffer = glBuffer;
1075
+ }
1076
+ const location = programAttrib.location;
1077
+ gl.enableVertexAttribArray(location);
1078
+ const attributeInfo = (0,getAttributeInfoFromFormat.getAttributeInfoFromFormat)(attribute.format);
1079
+ const type = getGlTypeFromFormat(attribute.format);
1080
+ if (programAttrib.format?.substring(1, 4) === "int") {
1081
+ gl.vertexAttribIPointer(
1082
+ location,
1083
+ attributeInfo.size,
1084
+ type,
1085
+ attribute.stride,
1086
+ attribute.offset
1087
+ );
1088
+ } else {
1089
+ gl.vertexAttribPointer(
1090
+ location,
1091
+ attributeInfo.size,
1092
+ type,
1093
+ attributeInfo.normalised,
1094
+ attribute.stride,
1095
+ attribute.offset
1096
+ );
1097
+ }
1098
+ if (attribute.instance) {
1099
+ if (this.hasInstance) {
1100
+ const divisor = attribute.divisor ?? 1;
1101
+ gl.vertexAttribDivisor(location, divisor);
1102
+ } else {
1103
+ throw new Error("geometry error, GPU Instancing is not supported on this device");
1104
+ }
1105
+ }
1106
+ }
1107
+ }
1108
+ }
1109
+ /**
1110
+ * Draws the currently bound geometry.
1111
+ * @param topology - The type primitive to render.
1112
+ * @param size - The number of elements to be rendered. If not specified, all vertices after the
1113
+ * starting vertex will be drawn.
1114
+ * @param start - The starting vertex in the geometry to start drawing from. If not specified,
1115
+ * drawing will start from the first vertex.
1116
+ * @param instanceCount - The number of instances of the set of elements to execute. If not specified,
1117
+ * all instances will be drawn.
1118
+ */
1119
+ draw(topology, size, start, instanceCount) {
1120
+ const { gl } = this._renderer;
1121
+ const geometry = this._activeGeometry;
1122
+ const glTopology = topologyToGlMap[topology || geometry.topology];
1123
+ instanceCount ?? (instanceCount = geometry.instanceCount);
1124
+ if (geometry.indexBuffer) {
1125
+ const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;
1126
+ const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;
1127
+ if (instanceCount > 1) {
1128
+ gl.drawElementsInstanced(glTopology, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount);
1129
+ } else {
1130
+ gl.drawElements(glTopology, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);
1131
+ }
1132
+ } else if (instanceCount > 1) {
1133
+ gl.drawArraysInstanced(glTopology, start || 0, size || geometry.getSize(), instanceCount);
1134
+ } else {
1135
+ gl.drawArrays(glTopology, start || 0, size || geometry.getSize());
1136
+ }
1137
+ return this;
1138
+ }
1139
+ /** Unbind/reset everything. */
1140
+ unbind() {
1141
+ this.gl.bindVertexArray(null);
1142
+ this._activeVao = null;
1143
+ this._activeGeometry = null;
1144
+ }
1145
+ destroy() {
1146
+ this._renderer = null;
1147
+ this.gl = null;
1148
+ this._activeVao = null;
1149
+ this._activeGeometry = null;
1150
+ }
1151
+ }
1152
+ /** @ignore */
1153
+ GlGeometrySystem.extension = {
1154
+ type: [
1155
+ Extensions.ExtensionType.WebGLSystem
1156
+ ],
1157
+ name: "geometry"
1158
+ };
1159
+
1160
+
1161
+ //# sourceMappingURL=GlGeometrySystem.mjs.map
1162
+
1163
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/geometry/Geometry.mjs + 2 modules
1164
+ var Geometry = __webpack_require__(6011);
1165
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.mjs + 1 modules
1166
+ var TextureSource = __webpack_require__(1285);
1167
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlProgram.mjs + 6 modules
1168
+ var GlProgram = __webpack_require__(9113);
1169
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/GlBackBufferSystem.mjs
1170
+
1171
+
1172
+
1173
+
1174
+
1175
+
1176
+
1177
+
1178
+
1179
+ "use strict";
1180
+ const bigTriangleGeometry = new Geometry.Geometry({
1181
+ attributes: {
1182
+ aPosition: [
1183
+ -1,
1184
+ -1,
1185
+ // Bottom left corner
1186
+ 3,
1187
+ -1,
1188
+ // Bottom right corner, extending beyond right edge
1189
+ -1,
1190
+ 3
1191
+ // Top left corner, extending beyond top edge
1192
+ ]
1193
+ }
1194
+ });
1195
+ const _GlBackBufferSystem = class _GlBackBufferSystem {
1196
+ constructor(renderer) {
1197
+ /** if true, the back buffer is used */
1198
+ this.useBackBuffer = false;
1199
+ this._useBackBufferThisRender = false;
1200
+ this._renderer = renderer;
1201
+ }
1202
+ init(options = {}) {
1203
+ const { useBackBuffer, antialias } = { ..._GlBackBufferSystem.defaultOptions, ...options };
1204
+ this.useBackBuffer = useBackBuffer;
1205
+ this._antialias = antialias;
1206
+ if (!this._renderer.context.supports.msaa) {
1207
+ (0,warn.warn)("antialiasing, is not supported on when using the back buffer");
1208
+ this._antialias = false;
1209
+ }
1210
+ this._state = State.State.for2d();
1211
+ const bigTriangleProgram = new GlProgram.GlProgram({
1212
+ vertex: `
1213
+ attribute vec2 aPosition;
1214
+ out vec2 vUv;
1215
+
1216
+ void main() {
1217
+ gl_Position = vec4(aPosition, 0.0, 1.0);
1218
+
1219
+ vUv = (aPosition + 1.0) / 2.0;
1220
+
1221
+ // flip dem UVs
1222
+ vUv.y = 1.0 - vUv.y;
1223
+ }`,
1224
+ fragment: `
1225
+ in vec2 vUv;
1226
+ out vec4 finalColor;
1227
+
1228
+ uniform sampler2D uTexture;
1229
+
1230
+ void main() {
1231
+ finalColor = texture(uTexture, vUv);
1232
+ }`,
1233
+ name: "big-triangle"
1234
+ });
1235
+ this._bigTriangleShader = new Shader.Shader({
1236
+ glProgram: bigTriangleProgram,
1237
+ resources: {
1238
+ uTexture: Texture.Texture.WHITE.source
1239
+ }
1240
+ });
1241
+ }
1242
+ /**
1243
+ * This is called before the RenderTargetSystem is started. This is where
1244
+ * we replace the target with the back buffer if required.
1245
+ * @param options - The options for this render.
1246
+ */
1247
+ renderStart(options) {
1248
+ const renderTarget = this._renderer.renderTarget.getRenderTarget(options.target);
1249
+ this._useBackBufferThisRender = this.useBackBuffer && !!renderTarget.isRoot;
1250
+ if (this._useBackBufferThisRender) {
1251
+ const renderTarget2 = this._renderer.renderTarget.getRenderTarget(options.target);
1252
+ this._targetTexture = renderTarget2.colorTexture;
1253
+ options.target = this._getBackBufferTexture(renderTarget2.colorTexture);
1254
+ }
1255
+ }
1256
+ renderEnd() {
1257
+ this._presentBackBuffer();
1258
+ }
1259
+ _presentBackBuffer() {
1260
+ const renderer = this._renderer;
1261
+ renderer.renderTarget.finishRenderPass();
1262
+ if (!this._useBackBufferThisRender)
1263
+ return;
1264
+ renderer.renderTarget.bind(this._targetTexture, false);
1265
+ this._bigTriangleShader.resources.uTexture = this._backBufferTexture.source;
1266
+ renderer.encoder.draw({
1267
+ geometry: bigTriangleGeometry,
1268
+ shader: this._bigTriangleShader,
1269
+ state: this._state
1270
+ });
1271
+ }
1272
+ _getBackBufferTexture(targetSourceTexture) {
1273
+ this._backBufferTexture = this._backBufferTexture || new Texture.Texture({
1274
+ source: new TextureSource.TextureSource({
1275
+ width: targetSourceTexture.width,
1276
+ height: targetSourceTexture.height,
1277
+ resolution: targetSourceTexture._resolution,
1278
+ antialias: this._antialias
1279
+ })
1280
+ });
1281
+ this._backBufferTexture.source.resize(
1282
+ targetSourceTexture.width,
1283
+ targetSourceTexture.height,
1284
+ targetSourceTexture._resolution
1285
+ );
1286
+ return this._backBufferTexture;
1287
+ }
1288
+ /** destroys the back buffer */
1289
+ destroy() {
1290
+ if (this._backBufferTexture) {
1291
+ this._backBufferTexture.destroy();
1292
+ this._backBufferTexture = null;
1293
+ }
1294
+ }
1295
+ };
1296
+ /** @ignore */
1297
+ _GlBackBufferSystem.extension = {
1298
+ type: [
1299
+ Extensions.ExtensionType.WebGLSystem
1300
+ ],
1301
+ name: "backBuffer",
1302
+ priority: 1
1303
+ };
1304
+ /** default options for the back buffer system */
1305
+ _GlBackBufferSystem.defaultOptions = {
1306
+ /** if true will use the back buffer where required */
1307
+ useBackBuffer: false
1308
+ };
1309
+ let GlBackBufferSystem = _GlBackBufferSystem;
1310
+
1311
+
1312
+ //# sourceMappingURL=GlBackBufferSystem.mjs.map
1313
+
1314
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/GlColorMaskSystem.mjs
1315
+
1316
+
1317
+ "use strict";
1318
+ class GlColorMaskSystem {
1319
+ constructor(renderer) {
1320
+ this._colorMaskCache = 15;
1321
+ this._renderer = renderer;
1322
+ }
1323
+ setMask(colorMask) {
1324
+ if (this._colorMaskCache === colorMask)
1325
+ return;
1326
+ this._colorMaskCache = colorMask;
1327
+ this._renderer.gl.colorMask(
1328
+ !!(colorMask & 8),
1329
+ !!(colorMask & 4),
1330
+ !!(colorMask & 2),
1331
+ !!(colorMask & 1)
1332
+ );
1333
+ }
1334
+ }
1335
+ /** @ignore */
1336
+ GlColorMaskSystem.extension = {
1337
+ type: [
1338
+ Extensions.ExtensionType.WebGLSystem
1339
+ ],
1340
+ name: "colorMask"
1341
+ };
1342
+
1343
+
1344
+ //# sourceMappingURL=GlColorMaskSystem.mjs.map
1345
+
1346
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/GlEncoderSystem.mjs
1347
+
1348
+
1349
+ "use strict";
1350
+ class GlEncoderSystem {
1351
+ constructor(renderer) {
1352
+ this.commandFinished = Promise.resolve();
1353
+ this._renderer = renderer;
1354
+ }
1355
+ setGeometry(geometry, shader) {
1356
+ this._renderer.geometry.bind(geometry, shader.glProgram);
1357
+ }
1358
+ finishRenderPass() {
1359
+ }
1360
+ draw(options) {
1361
+ const renderer = this._renderer;
1362
+ const { geometry, shader, state, skipSync, topology: type, size, start, instanceCount } = options;
1363
+ renderer.shader.bind(shader, skipSync);
1364
+ renderer.geometry.bind(geometry, renderer.shader._activeProgram);
1365
+ if (state) {
1366
+ renderer.state.set(state);
1367
+ }
1368
+ renderer.geometry.draw(type, size, start, instanceCount ?? geometry.instanceCount);
1369
+ }
1370
+ destroy() {
1371
+ this._renderer = null;
1372
+ }
1373
+ }
1374
+ /** @ignore */
1375
+ GlEncoderSystem.extension = {
1376
+ type: [
1377
+ Extensions.ExtensionType.WebGLSystem
1378
+ ],
1379
+ name: "encoder"
1380
+ };
1381
+
1382
+
1383
+ //# sourceMappingURL=GlEncoderSystem.mjs.map
1384
+
1385
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/gpu/state/GpuStencilModesToPixi.mjs
1386
+ var GpuStencilModesToPixi = __webpack_require__(1172);
1387
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/state/const.mjs
1388
+ var state_const = __webpack_require__(1957);
1389
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/GlStencilSystem.mjs
1390
+
1391
+
1392
+
1393
+
1394
+ "use strict";
1395
+ class GlStencilSystem {
1396
+ constructor(renderer) {
1397
+ this._stencilCache = {
1398
+ enabled: false,
1399
+ stencilReference: 0,
1400
+ stencilMode: state_const.STENCIL_MODES.NONE
1401
+ };
1402
+ this._renderTargetStencilState = /* @__PURE__ */ Object.create(null);
1403
+ renderer.renderTarget.onRenderTargetChange.add(this);
1404
+ }
1405
+ contextChange(gl) {
1406
+ this._gl = gl;
1407
+ this._comparisonFuncMapping = {
1408
+ always: gl.ALWAYS,
1409
+ never: gl.NEVER,
1410
+ equal: gl.EQUAL,
1411
+ "not-equal": gl.NOTEQUAL,
1412
+ less: gl.LESS,
1413
+ "less-equal": gl.LEQUAL,
1414
+ greater: gl.GREATER,
1415
+ "greater-equal": gl.GEQUAL
1416
+ };
1417
+ this._stencilOpsMapping = {
1418
+ keep: gl.KEEP,
1419
+ zero: gl.ZERO,
1420
+ replace: gl.REPLACE,
1421
+ invert: gl.INVERT,
1422
+ "increment-clamp": gl.INCR,
1423
+ "decrement-clamp": gl.DECR,
1424
+ "increment-wrap": gl.INCR_WRAP,
1425
+ "decrement-wrap": gl.DECR_WRAP
1426
+ };
1427
+ this._stencilCache.enabled = false;
1428
+ this._stencilCache.stencilMode = state_const.STENCIL_MODES.NONE;
1429
+ this._stencilCache.stencilReference = 0;
1430
+ }
1431
+ onRenderTargetChange(renderTarget) {
1432
+ if (this._activeRenderTarget === renderTarget)
1433
+ return;
1434
+ this._activeRenderTarget = renderTarget;
1435
+ let stencilState = this._renderTargetStencilState[renderTarget.uid];
1436
+ if (!stencilState) {
1437
+ stencilState = this._renderTargetStencilState[renderTarget.uid] = {
1438
+ stencilMode: state_const.STENCIL_MODES.DISABLED,
1439
+ stencilReference: 0
1440
+ };
1441
+ }
1442
+ this.setStencilMode(stencilState.stencilMode, stencilState.stencilReference);
1443
+ }
1444
+ setStencilMode(stencilMode, stencilReference) {
1445
+ const stencilState = this._renderTargetStencilState[this._activeRenderTarget.uid];
1446
+ const gl = this._gl;
1447
+ const mode = GpuStencilModesToPixi.GpuStencilModesToPixi[stencilMode];
1448
+ const _stencilCache = this._stencilCache;
1449
+ stencilState.stencilMode = stencilMode;
1450
+ stencilState.stencilReference = stencilReference;
1451
+ if (stencilMode === state_const.STENCIL_MODES.DISABLED) {
1452
+ if (this._stencilCache.enabled) {
1453
+ this._stencilCache.enabled = false;
1454
+ gl.disable(gl.STENCIL_TEST);
1455
+ }
1456
+ return;
1457
+ }
1458
+ if (!this._stencilCache.enabled) {
1459
+ this._stencilCache.enabled = true;
1460
+ gl.enable(gl.STENCIL_TEST);
1461
+ }
1462
+ if (stencilMode !== _stencilCache.stencilMode || _stencilCache.stencilReference !== stencilReference) {
1463
+ _stencilCache.stencilMode = stencilMode;
1464
+ _stencilCache.stencilReference = stencilReference;
1465
+ gl.stencilFunc(this._comparisonFuncMapping[mode.stencilBack.compare], stencilReference, 255);
1466
+ gl.stencilOp(gl.KEEP, gl.KEEP, this._stencilOpsMapping[mode.stencilBack.passOp]);
1467
+ }
1468
+ }
1469
+ }
1470
+ /** @ignore */
1471
+ GlStencilSystem.extension = {
1472
+ type: [
1473
+ Extensions.ExtensionType.WebGLSystem
1474
+ ],
1475
+ name: "stencil"
1476
+ };
1477
+
1478
+
1479
+ //# sourceMappingURL=GlStencilSystem.mjs.map
1480
+
1481
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/shader/UboSystem.mjs
1482
+ var UboSystem = __webpack_require__(7047);
1483
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/createUboElementsSTD40.mjs
1484
+
1485
+ const WGSL_TO_STD40_SIZE = {
1486
+ f32: 4,
1487
+ i32: 4,
1488
+ "vec2<f32>": 8,
1489
+ "vec3<f32>": 12,
1490
+ "vec4<f32>": 16,
1491
+ "vec2<i32>": 8,
1492
+ "vec3<i32>": 12,
1493
+ "vec4<i32>": 16,
1494
+ "mat2x2<f32>": 16 * 2,
1495
+ "mat3x3<f32>": 16 * 3,
1496
+ "mat4x4<f32>": 16 * 4
1497
+ // TODO - not essential for now but support these in the future
1498
+ // int: 4,
1499
+ // ivec2: 8,
1500
+ // ivec3: 12,
1501
+ // ivec4: 16,
1502
+ // uint: 4,
1503
+ // uvec2: 8,
1504
+ // uvec3: 12,
1505
+ // uvec4: 16,
1506
+ // bool: 4,
1507
+ // bvec2: 8,
1508
+ // bvec3: 12,
1509
+ // bvec4: 16,
1510
+ // mat2: 16 * 2,
1511
+ // mat3: 16 * 3,
1512
+ // mat4: 16 * 4,
1513
+ };
1514
+ function createUboElementsSTD40(uniformData) {
1515
+ const uboElements = uniformData.map((data) => ({
1516
+ data,
1517
+ offset: 0,
1518
+ size: 0
1519
+ }));
1520
+ const chunkSize = 16;
1521
+ let size = 0;
1522
+ let offset = 0;
1523
+ for (let i = 0; i < uboElements.length; i++) {
1524
+ const uboElement = uboElements[i];
1525
+ size = WGSL_TO_STD40_SIZE[uboElement.data.type];
1526
+ if (!size) {
1527
+ throw new Error(`Unknown type ${uboElement.data.type}`);
1528
+ }
1529
+ if (uboElement.data.size > 1) {
1530
+ size = Math.max(size, chunkSize) * uboElement.data.size;
1531
+ }
1532
+ const boundary = size === 12 ? 16 : size;
1533
+ uboElement.size = size;
1534
+ const curOffset = offset % chunkSize;
1535
+ if (curOffset > 0 && chunkSize - curOffset < boundary) {
1536
+ offset += (chunkSize - curOffset) % 16;
1537
+ } else {
1538
+ offset += (size - curOffset % size) % size;
1539
+ }
1540
+ uboElement.offset = offset;
1541
+ offset += size;
1542
+ }
1543
+ offset = Math.ceil(offset / 16) * 16;
1544
+ return { uboElements, size: offset };
1545
+ }
1546
+
1547
+
1548
+ //# sourceMappingURL=createUboElementsSTD40.mjs.map
1549
+
1550
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/shader/utils/createUboSyncFunction.mjs
1551
+ var createUboSyncFunction = __webpack_require__(6423);
1552
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/shader/utils/uboSyncFunctions.mjs
1553
+ var uboSyncFunctions = __webpack_require__(1266);
1554
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/generateArraySyncSTD40.mjs
1555
+
1556
+
1557
+ "use strict";
1558
+ function generateArraySyncSTD40(uboElement, offsetToAdd) {
1559
+ const rowSize = Math.max(WGSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);
1560
+ const elementSize = uboElement.data.value.length / uboElement.data.size;
1561
+ const remainder = (4 - elementSize % 4) % 4;
1562
+ const data = uboElement.data.type.indexOf("i32") >= 0 ? "dataInt32" : "data";
1563
+ return `
1564
+ v = uv.${uboElement.data.name};
1565
+ offset += ${offsetToAdd};
1566
+
1567
+ arrayOffset = offset;
1568
+
1569
+ t = 0;
1570
+
1571
+ for(var i=0; i < ${uboElement.data.size * rowSize}; i++)
1572
+ {
1573
+ for(var j = 0; j < ${elementSize}; j++)
1574
+ {
1575
+ ${data}[arrayOffset++] = v[t++];
1576
+ }
1577
+ ${remainder !== 0 ? `arrayOffset += ${remainder};` : ""}
1578
+ }
1579
+ `;
1580
+ }
1581
+
1582
+
1583
+ //# sourceMappingURL=generateArraySyncSTD40.mjs.map
1584
+
1585
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/createUboSyncSTD40.mjs
1586
+
1587
+
1588
+
1589
+
1590
+ "use strict";
1591
+ function createUboSyncFunctionSTD40(uboElements) {
1592
+ return (0,createUboSyncFunction.createUboSyncFunction)(
1593
+ uboElements,
1594
+ "uboStd40",
1595
+ generateArraySyncSTD40,
1596
+ uboSyncFunctions.uboSyncFunctionsSTD40
1597
+ );
1598
+ }
1599
+
1600
+
1601
+ //# sourceMappingURL=createUboSyncSTD40.mjs.map
1602
+
1603
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/GlUboSystem.mjs
1604
+
1605
+
1606
+
1607
+
1608
+
1609
+ "use strict";
1610
+ class GlUboSystem extends UboSystem.UboSystem {
1611
+ constructor() {
1612
+ super({
1613
+ createUboElements: createUboElementsSTD40,
1614
+ generateUboSync: createUboSyncFunctionSTD40
1615
+ });
1616
+ }
1617
+ }
1618
+ /** @ignore */
1619
+ GlUboSystem.extension = {
1620
+ type: [Extensions.ExtensionType.WebGLSystem],
1621
+ name: "ubo"
1622
+ };
1623
+
1624
+
1625
+ //# sourceMappingURL=GlUboSystem.mjs.map
1626
+
1627
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/renderTarget/RenderTargetSystem.mjs + 2 modules
1628
+ var RenderTargetSystem = __webpack_require__(7238);
1629
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/maths/shapes/Rectangle.mjs
1630
+ var Rectangle = __webpack_require__(9252);
1631
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/CanvasSource.mjs
1632
+ var CanvasSource = __webpack_require__(4884);
1633
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/gl/const.mjs
1634
+ var gl_const = __webpack_require__(1257);
1635
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/GlRenderTarget.mjs
1636
+
1637
+ class GlRenderTarget {
1638
+ constructor() {
1639
+ this.width = -1;
1640
+ this.height = -1;
1641
+ this.msaa = false;
1642
+ this.msaaRenderBuffer = [];
1643
+ }
1644
+ }
1645
+
1646
+
1647
+ //# sourceMappingURL=GlRenderTarget.mjs.map
1648
+
1649
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/renderTarget/GlRenderTargetAdaptor.mjs
1650
+
1651
+
1652
+
1653
+
1654
+
1655
+
1656
+ "use strict";
1657
+ class GlRenderTargetAdaptor {
1658
+ constructor() {
1659
+ this._clearColorCache = [0, 0, 0, 0];
1660
+ this._viewPortCache = new Rectangle.Rectangle();
1661
+ }
1662
+ init(renderer, renderTargetSystem) {
1663
+ this._renderer = renderer;
1664
+ this._renderTargetSystem = renderTargetSystem;
1665
+ renderer.runners.contextChange.add(this);
1666
+ }
1667
+ contextChange() {
1668
+ this._clearColorCache = [0, 0, 0, 0];
1669
+ this._viewPortCache = new Rectangle.Rectangle();
1670
+ }
1671
+ copyToTexture(sourceRenderSurfaceTexture, destinationTexture, originSrc, size, originDest) {
1672
+ const renderTargetSystem = this._renderTargetSystem;
1673
+ const renderer = this._renderer;
1674
+ const glRenderTarget = renderTargetSystem.getGpuRenderTarget(sourceRenderSurfaceTexture);
1675
+ const gl = renderer.gl;
1676
+ this.finishRenderPass(sourceRenderSurfaceTexture);
1677
+ gl.bindFramebuffer(gl.FRAMEBUFFER, glRenderTarget.resolveTargetFramebuffer);
1678
+ renderer.texture.bind(destinationTexture, 0);
1679
+ gl.copyTexSubImage2D(
1680
+ gl.TEXTURE_2D,
1681
+ 0,
1682
+ originDest.x,
1683
+ originDest.y,
1684
+ originSrc.x,
1685
+ originSrc.y,
1686
+ size.width,
1687
+ size.height
1688
+ );
1689
+ return destinationTexture;
1690
+ }
1691
+ startRenderPass(renderTarget, clear = true, clearColor, viewport) {
1692
+ const renderTargetSystem = this._renderTargetSystem;
1693
+ const source = renderTarget.colorTexture;
1694
+ const gpuRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);
1695
+ let viewPortY = viewport.y;
1696
+ if (renderTarget.isRoot) {
1697
+ viewPortY = source.pixelHeight - viewport.height;
1698
+ }
1699
+ renderTarget.colorTextures.forEach((texture) => {
1700
+ this._renderer.texture.unbind(texture);
1701
+ });
1702
+ const gl = this._renderer.gl;
1703
+ gl.bindFramebuffer(gl.FRAMEBUFFER, gpuRenderTarget.framebuffer);
1704
+ const viewPortCache = this._viewPortCache;
1705
+ if (viewPortCache.x !== viewport.x || viewPortCache.y !== viewPortY || viewPortCache.width !== viewport.width || viewPortCache.height !== viewport.height) {
1706
+ viewPortCache.x = viewport.x;
1707
+ viewPortCache.y = viewPortY;
1708
+ viewPortCache.width = viewport.width;
1709
+ viewPortCache.height = viewport.height;
1710
+ gl.viewport(
1711
+ viewport.x,
1712
+ viewPortY,
1713
+ viewport.width,
1714
+ viewport.height
1715
+ );
1716
+ }
1717
+ if (!gpuRenderTarget.depthStencilRenderBuffer && (renderTarget.stencil || renderTarget.depth)) {
1718
+ this._initStencil(gpuRenderTarget);
1719
+ }
1720
+ this.clear(renderTarget, clear, clearColor);
1721
+ }
1722
+ finishRenderPass(renderTarget) {
1723
+ const renderTargetSystem = this._renderTargetSystem;
1724
+ const glRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);
1725
+ if (!glRenderTarget.msaa)
1726
+ return;
1727
+ const gl = this._renderer.gl;
1728
+ gl.bindFramebuffer(gl.FRAMEBUFFER, glRenderTarget.resolveTargetFramebuffer);
1729
+ gl.bindFramebuffer(gl.READ_FRAMEBUFFER, glRenderTarget.framebuffer);
1730
+ gl.blitFramebuffer(
1731
+ 0,
1732
+ 0,
1733
+ glRenderTarget.width,
1734
+ glRenderTarget.height,
1735
+ 0,
1736
+ 0,
1737
+ glRenderTarget.width,
1738
+ glRenderTarget.height,
1739
+ gl.COLOR_BUFFER_BIT,
1740
+ gl.NEAREST
1741
+ );
1742
+ gl.bindFramebuffer(gl.FRAMEBUFFER, glRenderTarget.framebuffer);
1743
+ }
1744
+ initGpuRenderTarget(renderTarget) {
1745
+ const renderer = this._renderer;
1746
+ const gl = renderer.gl;
1747
+ const glRenderTarget = new GlRenderTarget();
1748
+ const colorTexture = renderTarget.colorTexture;
1749
+ if (colorTexture.resource === renderer.canvas) {
1750
+ this._renderer.context.ensureCanvasSize(renderTarget.colorTexture.resource);
1751
+ glRenderTarget.framebuffer = null;
1752
+ return glRenderTarget;
1753
+ }
1754
+ this._initColor(renderTarget, glRenderTarget);
1755
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
1756
+ return glRenderTarget;
1757
+ }
1758
+ destroyGpuRenderTarget(gpuRenderTarget) {
1759
+ const gl = this._renderer.gl;
1760
+ if (gpuRenderTarget.framebuffer) {
1761
+ gl.deleteFramebuffer(gpuRenderTarget.framebuffer);
1762
+ gpuRenderTarget.framebuffer = null;
1763
+ }
1764
+ if (gpuRenderTarget.resolveTargetFramebuffer) {
1765
+ gl.deleteFramebuffer(gpuRenderTarget.resolveTargetFramebuffer);
1766
+ gpuRenderTarget.resolveTargetFramebuffer = null;
1767
+ }
1768
+ if (gpuRenderTarget.depthStencilRenderBuffer) {
1769
+ gl.deleteRenderbuffer(gpuRenderTarget.depthStencilRenderBuffer);
1770
+ gpuRenderTarget.depthStencilRenderBuffer = null;
1771
+ }
1772
+ gpuRenderTarget.msaaRenderBuffer.forEach((renderBuffer) => {
1773
+ gl.deleteRenderbuffer(renderBuffer);
1774
+ });
1775
+ gpuRenderTarget.msaaRenderBuffer = null;
1776
+ }
1777
+ clear(_renderTarget, clear, clearColor) {
1778
+ if (!clear)
1779
+ return;
1780
+ const renderTargetSystem = this._renderTargetSystem;
1781
+ if (typeof clear === "boolean") {
1782
+ clear = clear ? gl_const.CLEAR.ALL : gl_const.CLEAR.NONE;
1783
+ }
1784
+ const gl = this._renderer.gl;
1785
+ if (clear & gl_const.CLEAR.COLOR) {
1786
+ clearColor ?? (clearColor = renderTargetSystem.defaultClearColor);
1787
+ const clearColorCache = this._clearColorCache;
1788
+ const clearColorArray = clearColor;
1789
+ if (clearColorCache[0] !== clearColorArray[0] || clearColorCache[1] !== clearColorArray[1] || clearColorCache[2] !== clearColorArray[2] || clearColorCache[3] !== clearColorArray[3]) {
1790
+ clearColorCache[0] = clearColorArray[0];
1791
+ clearColorCache[1] = clearColorArray[1];
1792
+ clearColorCache[2] = clearColorArray[2];
1793
+ clearColorCache[3] = clearColorArray[3];
1794
+ gl.clearColor(clearColorArray[0], clearColorArray[1], clearColorArray[2], clearColorArray[3]);
1795
+ }
1796
+ }
1797
+ gl.clear(clear);
1798
+ }
1799
+ resizeGpuRenderTarget(renderTarget) {
1800
+ if (renderTarget.isRoot)
1801
+ return;
1802
+ const renderTargetSystem = this._renderTargetSystem;
1803
+ const glRenderTarget = renderTargetSystem.getGpuRenderTarget(renderTarget);
1804
+ this._resizeColor(renderTarget, glRenderTarget);
1805
+ if (renderTarget.stencil || renderTarget.depth) {
1806
+ this._resizeStencil(glRenderTarget);
1807
+ }
1808
+ }
1809
+ _initColor(renderTarget, glRenderTarget) {
1810
+ const renderer = this._renderer;
1811
+ const gl = renderer.gl;
1812
+ const resolveTargetFramebuffer = gl.createFramebuffer();
1813
+ glRenderTarget.resolveTargetFramebuffer = resolveTargetFramebuffer;
1814
+ gl.bindFramebuffer(gl.FRAMEBUFFER, resolveTargetFramebuffer);
1815
+ glRenderTarget.width = renderTarget.colorTexture.source.pixelWidth;
1816
+ glRenderTarget.height = renderTarget.colorTexture.source.pixelHeight;
1817
+ renderTarget.colorTextures.forEach((colorTexture, i) => {
1818
+ const source = colorTexture.source;
1819
+ if (source.antialias) {
1820
+ if (renderer.context.supports.msaa) {
1821
+ glRenderTarget.msaa = true;
1822
+ } else {
1823
+ (0,warn.warn)("[RenderTexture] Antialiasing on textures is not supported in WebGL1");
1824
+ }
1825
+ }
1826
+ renderer.texture.bindSource(source, 0);
1827
+ const glSource = renderer.texture.getGlSource(source);
1828
+ const glTexture = glSource.texture;
1829
+ gl.framebufferTexture2D(
1830
+ gl.FRAMEBUFFER,
1831
+ gl.COLOR_ATTACHMENT0 + i,
1832
+ 3553,
1833
+ // texture.target,
1834
+ glTexture,
1835
+ 0
1836
+ );
1837
+ });
1838
+ if (glRenderTarget.msaa) {
1839
+ const viewFramebuffer = gl.createFramebuffer();
1840
+ glRenderTarget.framebuffer = viewFramebuffer;
1841
+ gl.bindFramebuffer(gl.FRAMEBUFFER, viewFramebuffer);
1842
+ renderTarget.colorTextures.forEach((_, i) => {
1843
+ const msaaRenderBuffer = gl.createRenderbuffer();
1844
+ glRenderTarget.msaaRenderBuffer[i] = msaaRenderBuffer;
1845
+ });
1846
+ } else {
1847
+ glRenderTarget.framebuffer = resolveTargetFramebuffer;
1848
+ }
1849
+ this._resizeColor(renderTarget, glRenderTarget);
1850
+ }
1851
+ _resizeColor(renderTarget, glRenderTarget) {
1852
+ const source = renderTarget.colorTexture.source;
1853
+ glRenderTarget.width = source.pixelWidth;
1854
+ glRenderTarget.height = source.pixelHeight;
1855
+ renderTarget.colorTextures.forEach((colorTexture, i) => {
1856
+ if (i === 0)
1857
+ return;
1858
+ colorTexture.source.resize(source.width, source.height, source._resolution);
1859
+ });
1860
+ if (glRenderTarget.msaa) {
1861
+ const renderer = this._renderer;
1862
+ const gl = renderer.gl;
1863
+ const viewFramebuffer = glRenderTarget.framebuffer;
1864
+ gl.bindFramebuffer(gl.FRAMEBUFFER, viewFramebuffer);
1865
+ renderTarget.colorTextures.forEach((colorTexture, i) => {
1866
+ const source2 = colorTexture.source;
1867
+ renderer.texture.bindSource(source2, 0);
1868
+ const glSource = renderer.texture.getGlSource(source2);
1869
+ const glInternalFormat = glSource.internalFormat;
1870
+ const msaaRenderBuffer = glRenderTarget.msaaRenderBuffer[i];
1871
+ gl.bindRenderbuffer(
1872
+ gl.RENDERBUFFER,
1873
+ msaaRenderBuffer
1874
+ );
1875
+ gl.renderbufferStorageMultisample(
1876
+ gl.RENDERBUFFER,
1877
+ 4,
1878
+ glInternalFormat,
1879
+ source2.pixelWidth,
1880
+ source2.pixelHeight
1881
+ );
1882
+ gl.framebufferRenderbuffer(
1883
+ gl.FRAMEBUFFER,
1884
+ gl.COLOR_ATTACHMENT0 + i,
1885
+ gl.RENDERBUFFER,
1886
+ msaaRenderBuffer
1887
+ );
1888
+ });
1889
+ }
1890
+ }
1891
+ _initStencil(glRenderTarget) {
1892
+ if (glRenderTarget.framebuffer === null)
1893
+ return;
1894
+ const gl = this._renderer.gl;
1895
+ const depthStencilRenderBuffer = gl.createRenderbuffer();
1896
+ glRenderTarget.depthStencilRenderBuffer = depthStencilRenderBuffer;
1897
+ gl.bindRenderbuffer(
1898
+ gl.RENDERBUFFER,
1899
+ depthStencilRenderBuffer
1900
+ );
1901
+ gl.framebufferRenderbuffer(
1902
+ gl.FRAMEBUFFER,
1903
+ gl.DEPTH_STENCIL_ATTACHMENT,
1904
+ gl.RENDERBUFFER,
1905
+ depthStencilRenderBuffer
1906
+ );
1907
+ this._resizeStencil(glRenderTarget);
1908
+ }
1909
+ _resizeStencil(glRenderTarget) {
1910
+ const gl = this._renderer.gl;
1911
+ gl.bindRenderbuffer(
1912
+ gl.RENDERBUFFER,
1913
+ glRenderTarget.depthStencilRenderBuffer
1914
+ );
1915
+ if (glRenderTarget.msaa) {
1916
+ gl.renderbufferStorageMultisample(
1917
+ gl.RENDERBUFFER,
1918
+ 4,
1919
+ gl.DEPTH24_STENCIL8,
1920
+ glRenderTarget.width,
1921
+ glRenderTarget.height
1922
+ );
1923
+ } else {
1924
+ gl.renderbufferStorage(
1925
+ gl.RENDERBUFFER,
1926
+ this._renderer.context.webGLVersion === 2 ? gl.DEPTH24_STENCIL8 : gl.DEPTH_STENCIL,
1927
+ glRenderTarget.width,
1928
+ glRenderTarget.height
1929
+ );
1930
+ }
1931
+ }
1932
+ prerender(renderTarget) {
1933
+ const resource = renderTarget.colorTexture.resource;
1934
+ if (this._renderer.context.multiView && CanvasSource.CanvasSource.test(resource)) {
1935
+ this._renderer.context.ensureCanvasSize(resource);
1936
+ }
1937
+ }
1938
+ postrender(renderTarget) {
1939
+ if (!this._renderer.context.multiView)
1940
+ return;
1941
+ if (CanvasSource.CanvasSource.test(renderTarget.colorTexture.resource)) {
1942
+ const contextCanvas = this._renderer.context.canvas;
1943
+ const canvasSource = renderTarget.colorTexture;
1944
+ canvasSource.context2D.drawImage(
1945
+ contextCanvas,
1946
+ 0,
1947
+ canvasSource.pixelHeight - contextCanvas.height
1948
+ );
1949
+ }
1950
+ }
1951
+ }
1952
+
1953
+
1954
+ //# sourceMappingURL=GlRenderTargetAdaptor.mjs.map
1955
+
1956
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/renderTarget/GlRenderTargetSystem.mjs
1957
+
1958
+
1959
+
1960
+
1961
+ "use strict";
1962
+ class GlRenderTargetSystem extends RenderTargetSystem.RenderTargetSystem {
1963
+ constructor(renderer) {
1964
+ super(renderer);
1965
+ this.adaptor = new GlRenderTargetAdaptor();
1966
+ this.adaptor.init(renderer, this);
1967
+ }
1968
+ }
1969
+ /** @ignore */
1970
+ GlRenderTargetSystem.extension = {
1971
+ type: [Extensions.ExtensionType.WebGLSystem],
1972
+ name: "renderTarget"
1973
+ };
1974
+
1975
+
1976
+ //# sourceMappingURL=GlRenderTargetSystem.mjs.map
1977
+
1978
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/buffer/BufferResource.mjs
1979
+ var BufferResource = __webpack_require__(581);
1980
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/GenerateShaderSyncCode.mjs
1981
+
1982
+
1983
+
1984
+
1985
+ "use strict";
1986
+ function generateShaderSyncCode(shader, shaderSystem) {
1987
+ const funcFragments = [];
1988
+ const headerFragments = [`
1989
+ var g = s.groups;
1990
+ var sS = r.shader;
1991
+ var p = s.glProgram;
1992
+ var ugS = r.uniformGroup;
1993
+ var resources;
1994
+ `];
1995
+ let addedTextreSystem = false;
1996
+ let textureCount = 0;
1997
+ const programData = shaderSystem._getProgramData(shader.glProgram);
1998
+ for (const i in shader.groups) {
1999
+ const group = shader.groups[i];
2000
+ funcFragments.push(`
2001
+ resources = g[${i}].resources;
2002
+ `);
2003
+ for (const j in group.resources) {
2004
+ const resource = group.resources[j];
2005
+ if (resource instanceof UniformGroup.UniformGroup) {
2006
+ if (resource.ubo) {
2007
+ const resName = shader._uniformBindMap[i][Number(j)];
2008
+ funcFragments.push(`
2009
+ sS.bindUniformBlock(
2010
+ resources[${j}],
2011
+ '${resName}',
2012
+ ${shader.glProgram._uniformBlockData[resName].index}
2013
+ );
2014
+ `);
2015
+ } else {
2016
+ funcFragments.push(`
2017
+ ugS.updateUniformGroup(resources[${j}], p, sD);
2018
+ `);
2019
+ }
2020
+ } else if (resource instanceof BufferResource.BufferResource) {
2021
+ const resName = shader._uniformBindMap[i][Number(j)];
2022
+ funcFragments.push(`
2023
+ sS.bindUniformBlock(
2024
+ resources[${j}],
2025
+ '${resName}',
2026
+ ${shader.glProgram._uniformBlockData[resName].index}
2027
+ );
2028
+ `);
2029
+ } else if (resource instanceof TextureSource.TextureSource) {
2030
+ const uniformName = shader._uniformBindMap[i][j];
2031
+ const uniformData = programData.uniformData[uniformName];
2032
+ if (uniformData) {
2033
+ if (!addedTextreSystem) {
2034
+ addedTextreSystem = true;
2035
+ headerFragments.push(`
2036
+ var tS = r.texture;
2037
+ `);
2038
+ }
2039
+ shaderSystem._gl.uniform1i(uniformData.location, textureCount);
2040
+ funcFragments.push(`
2041
+ tS.bind(resources[${j}], ${textureCount});
2042
+ `);
2043
+ textureCount++;
2044
+ }
2045
+ }
2046
+ }
2047
+ }
2048
+ const functionSource = [...headerFragments, ...funcFragments].join("\n");
2049
+ return new Function("r", "s", "sD", functionSource);
2050
+ }
2051
+
2052
+
2053
+ //# sourceMappingURL=GenerateShaderSyncCode.mjs.map
2054
+
2055
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlProgramData.mjs
2056
+
2057
+ class IGLUniformData {
2058
+ }
2059
+ class GlProgramData {
2060
+ /**
2061
+ * Makes a new Pixi program.
2062
+ * @param program - webgl program
2063
+ * @param uniformData - uniforms
2064
+ */
2065
+ constructor(program, uniformData) {
2066
+ this.program = program;
2067
+ this.uniformData = uniformData;
2068
+ this.uniformGroups = {};
2069
+ this.uniformDirtyGroups = {};
2070
+ this.uniformBlockBindings = {};
2071
+ }
2072
+ /** Destroys this program. */
2073
+ destroy() {
2074
+ this.uniformData = null;
2075
+ this.uniformGroups = null;
2076
+ this.uniformDirtyGroups = null;
2077
+ this.uniformBlockBindings = null;
2078
+ this.program = null;
2079
+ }
2080
+ }
2081
+
2082
+
2083
+ //# sourceMappingURL=GlProgramData.mjs.map
2084
+
2085
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/compileShader.mjs
2086
+
2087
+ function compileShader(gl, type, src) {
2088
+ const shader = gl.createShader(type);
2089
+ gl.shaderSource(shader, src);
2090
+ gl.compileShader(shader);
2091
+ return shader;
2092
+ }
2093
+
2094
+
2095
+ //# sourceMappingURL=compileShader.mjs.map
2096
+
2097
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/defaultValue.mjs
2098
+
2099
+ function booleanArray(size) {
2100
+ const array = new Array(size);
2101
+ for (let i = 0; i < array.length; i++) {
2102
+ array[i] = false;
2103
+ }
2104
+ return array;
2105
+ }
2106
+ function defaultValue(type, size) {
2107
+ switch (type) {
2108
+ case "float":
2109
+ return 0;
2110
+ case "vec2":
2111
+ return new Float32Array(2 * size);
2112
+ case "vec3":
2113
+ return new Float32Array(3 * size);
2114
+ case "vec4":
2115
+ return new Float32Array(4 * size);
2116
+ case "int":
2117
+ case "uint":
2118
+ case "sampler2D":
2119
+ case "sampler2DArray":
2120
+ return 0;
2121
+ case "ivec2":
2122
+ return new Int32Array(2 * size);
2123
+ case "ivec3":
2124
+ return new Int32Array(3 * size);
2125
+ case "ivec4":
2126
+ return new Int32Array(4 * size);
2127
+ case "uvec2":
2128
+ return new Uint32Array(2 * size);
2129
+ case "uvec3":
2130
+ return new Uint32Array(3 * size);
2131
+ case "uvec4":
2132
+ return new Uint32Array(4 * size);
2133
+ case "bool":
2134
+ return false;
2135
+ case "bvec2":
2136
+ return booleanArray(2 * size);
2137
+ case "bvec3":
2138
+ return booleanArray(3 * size);
2139
+ case "bvec4":
2140
+ return booleanArray(4 * size);
2141
+ case "mat2":
2142
+ return new Float32Array([
2143
+ 1,
2144
+ 0,
2145
+ 0,
2146
+ 1
2147
+ ]);
2148
+ case "mat3":
2149
+ return new Float32Array([
2150
+ 1,
2151
+ 0,
2152
+ 0,
2153
+ 0,
2154
+ 1,
2155
+ 0,
2156
+ 0,
2157
+ 0,
2158
+ 1
2159
+ ]);
2160
+ case "mat4":
2161
+ return new Float32Array([
2162
+ 1,
2163
+ 0,
2164
+ 0,
2165
+ 0,
2166
+ 0,
2167
+ 1,
2168
+ 0,
2169
+ 0,
2170
+ 0,
2171
+ 0,
2172
+ 1,
2173
+ 0,
2174
+ 0,
2175
+ 0,
2176
+ 0,
2177
+ 1
2178
+ ]);
2179
+ }
2180
+ return null;
2181
+ }
2182
+
2183
+
2184
+ //# sourceMappingURL=defaultValue.mjs.map
2185
+
2186
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/mapType.mjs
2187
+
2188
+ let GL_TABLE = null;
2189
+ const GL_TO_GLSL_TYPES = {
2190
+ FLOAT: "float",
2191
+ FLOAT_VEC2: "vec2",
2192
+ FLOAT_VEC3: "vec3",
2193
+ FLOAT_VEC4: "vec4",
2194
+ INT: "int",
2195
+ INT_VEC2: "ivec2",
2196
+ INT_VEC3: "ivec3",
2197
+ INT_VEC4: "ivec4",
2198
+ UNSIGNED_INT: "uint",
2199
+ UNSIGNED_INT_VEC2: "uvec2",
2200
+ UNSIGNED_INT_VEC3: "uvec3",
2201
+ UNSIGNED_INT_VEC4: "uvec4",
2202
+ BOOL: "bool",
2203
+ BOOL_VEC2: "bvec2",
2204
+ BOOL_VEC3: "bvec3",
2205
+ BOOL_VEC4: "bvec4",
2206
+ FLOAT_MAT2: "mat2",
2207
+ FLOAT_MAT3: "mat3",
2208
+ FLOAT_MAT4: "mat4",
2209
+ SAMPLER_2D: "sampler2D",
2210
+ INT_SAMPLER_2D: "sampler2D",
2211
+ UNSIGNED_INT_SAMPLER_2D: "sampler2D",
2212
+ SAMPLER_CUBE: "samplerCube",
2213
+ INT_SAMPLER_CUBE: "samplerCube",
2214
+ UNSIGNED_INT_SAMPLER_CUBE: "samplerCube",
2215
+ SAMPLER_2D_ARRAY: "sampler2DArray",
2216
+ INT_SAMPLER_2D_ARRAY: "sampler2DArray",
2217
+ UNSIGNED_INT_SAMPLER_2D_ARRAY: "sampler2DArray"
2218
+ };
2219
+ const GLSL_TO_VERTEX_TYPES = {
2220
+ float: "float32",
2221
+ vec2: "float32x2",
2222
+ vec3: "float32x3",
2223
+ vec4: "float32x4",
2224
+ int: "sint32",
2225
+ ivec2: "sint32x2",
2226
+ ivec3: "sint32x3",
2227
+ ivec4: "sint32x4",
2228
+ uint: "uint32",
2229
+ uvec2: "uint32x2",
2230
+ uvec3: "uint32x3",
2231
+ uvec4: "uint32x4",
2232
+ bool: "uint32",
2233
+ bvec2: "uint32x2",
2234
+ bvec3: "uint32x3",
2235
+ bvec4: "uint32x4"
2236
+ };
2237
+ function mapType(gl, type) {
2238
+ if (!GL_TABLE) {
2239
+ const typeNames = Object.keys(GL_TO_GLSL_TYPES);
2240
+ GL_TABLE = {};
2241
+ for (let i = 0; i < typeNames.length; ++i) {
2242
+ const tn = typeNames[i];
2243
+ GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];
2244
+ }
2245
+ }
2246
+ return GL_TABLE[type];
2247
+ }
2248
+ function mapGlToVertexFormat(gl, type) {
2249
+ const typeValue = mapType(gl, type);
2250
+ return GLSL_TO_VERTEX_TYPES[typeValue] || "float32";
2251
+ }
2252
+
2253
+
2254
+ //# sourceMappingURL=mapType.mjs.map
2255
+
2256
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/extractAttributesFromGlProgram.mjs
2257
+
2258
+
2259
+
2260
+ "use strict";
2261
+ function extractAttributesFromGlProgram(program, gl, sortAttributes = false) {
2262
+ const attributes = {};
2263
+ const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
2264
+ for (let i = 0; i < totalAttributes; i++) {
2265
+ const attribData = gl.getActiveAttrib(program, i);
2266
+ if (attribData.name.startsWith("gl_")) {
2267
+ continue;
2268
+ }
2269
+ const format = mapGlToVertexFormat(gl, attribData.type);
2270
+ attributes[attribData.name] = {
2271
+ location: 0,
2272
+ // set further down..
2273
+ format,
2274
+ stride: (0,getAttributeInfoFromFormat.getAttributeInfoFromFormat)(format).stride,
2275
+ offset: 0,
2276
+ instance: false,
2277
+ start: 0
2278
+ };
2279
+ }
2280
+ const keys = Object.keys(attributes);
2281
+ if (sortAttributes) {
2282
+ keys.sort((a, b) => a > b ? 1 : -1);
2283
+ for (let i = 0; i < keys.length; i++) {
2284
+ attributes[keys[i]].location = i;
2285
+ gl.bindAttribLocation(program, i, keys[i]);
2286
+ }
2287
+ gl.linkProgram(program);
2288
+ } else {
2289
+ for (let i = 0; i < keys.length; i++) {
2290
+ attributes[keys[i]].location = gl.getAttribLocation(program, keys[i]);
2291
+ }
2292
+ }
2293
+ return attributes;
2294
+ }
2295
+
2296
+
2297
+ //# sourceMappingURL=extractAttributesFromGlProgram.mjs.map
2298
+
2299
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/getUboData.mjs
2300
+
2301
+ function getUboData(program, gl) {
2302
+ if (!gl.ACTIVE_UNIFORM_BLOCKS)
2303
+ return {};
2304
+ const uniformBlocks = {};
2305
+ const totalUniformsBlocks = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);
2306
+ for (let i = 0; i < totalUniformsBlocks; i++) {
2307
+ const name = gl.getActiveUniformBlockName(program, i);
2308
+ const uniformBlockIndex = gl.getUniformBlockIndex(program, name);
2309
+ const size = gl.getActiveUniformBlockParameter(program, i, gl.UNIFORM_BLOCK_DATA_SIZE);
2310
+ uniformBlocks[name] = {
2311
+ name,
2312
+ index: uniformBlockIndex,
2313
+ size
2314
+ };
2315
+ }
2316
+ return uniformBlocks;
2317
+ }
2318
+
2319
+
2320
+ //# sourceMappingURL=getUboData.mjs.map
2321
+
2322
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/getUniformData.mjs
2323
+
2324
+
2325
+
2326
+ "use strict";
2327
+ function getUniformData(program, gl) {
2328
+ const uniforms = {};
2329
+ const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
2330
+ for (let i = 0; i < totalUniforms; i++) {
2331
+ const uniformData = gl.getActiveUniform(program, i);
2332
+ const name = uniformData.name.replace(/\[.*?\]$/, "");
2333
+ const isArray = !!uniformData.name.match(/\[.*?\]$/);
2334
+ const type = mapType(gl, uniformData.type);
2335
+ uniforms[name] = {
2336
+ name,
2337
+ index: i,
2338
+ type,
2339
+ size: uniformData.size,
2340
+ isArray,
2341
+ value: defaultValue(type, uniformData.size)
2342
+ };
2343
+ }
2344
+ return uniforms;
2345
+ }
2346
+
2347
+
2348
+ //# sourceMappingURL=getUniformData.mjs.map
2349
+
2350
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/logProgramError.mjs
2351
+
2352
+ function logPrettyShaderError(gl, shader) {
2353
+ const shaderSrc = gl.getShaderSource(shader).split("\n").map((line, index) => `${index}: ${line}`);
2354
+ const shaderLog = gl.getShaderInfoLog(shader);
2355
+ const splitShader = shaderLog.split("\n");
2356
+ const dedupe = {};
2357
+ const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\: 0\:([\d]+)\:.*$/, "$1"))).filter((n) => {
2358
+ if (n && !dedupe[n]) {
2359
+ dedupe[n] = true;
2360
+ return true;
2361
+ }
2362
+ return false;
2363
+ });
2364
+ const logArgs = [""];
2365
+ lineNumbers.forEach((number) => {
2366
+ shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;
2367
+ logArgs.push("background: #FF0000; color:#FFFFFF; font-size: 10px", "font-size: 10px");
2368
+ });
2369
+ const fragmentSourceToLog = shaderSrc.join("\n");
2370
+ logArgs[0] = fragmentSourceToLog;
2371
+ console.error(shaderLog);
2372
+ console.groupCollapsed("click to view full shader code");
2373
+ console.warn(...logArgs);
2374
+ console.groupEnd();
2375
+ }
2376
+ function logProgramError(gl, program, vertexShader, fragmentShader) {
2377
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
2378
+ if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
2379
+ logPrettyShaderError(gl, vertexShader);
2380
+ }
2381
+ if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
2382
+ logPrettyShaderError(gl, fragmentShader);
2383
+ }
2384
+ console.error("PixiJS Error: Could not initialize shader.");
2385
+ if (gl.getProgramInfoLog(program) !== "") {
2386
+ console.warn("PixiJS Warning: gl.getProgramInfoLog()", gl.getProgramInfoLog(program));
2387
+ }
2388
+ }
2389
+ }
2390
+
2391
+
2392
+ //# sourceMappingURL=logProgramError.mjs.map
2393
+
2394
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/program/generateProgram.mjs
2395
+
2396
+
2397
+
2398
+
2399
+
2400
+
2401
+
2402
+
2403
+
2404
+ "use strict";
2405
+ function generateProgram(gl, program) {
2406
+ const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertex);
2407
+ const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragment);
2408
+ const webGLProgram = gl.createProgram();
2409
+ gl.attachShader(webGLProgram, glVertShader);
2410
+ gl.attachShader(webGLProgram, glFragShader);
2411
+ const transformFeedbackVaryings = program.transformFeedbackVaryings;
2412
+ if (transformFeedbackVaryings) {
2413
+ if (typeof gl.transformFeedbackVaryings !== "function") {
2414
+ (0,warn.warn)(`TransformFeedback is not supported but TransformFeedbackVaryings are given.`);
2415
+ } else {
2416
+ gl.transformFeedbackVaryings(
2417
+ webGLProgram,
2418
+ transformFeedbackVaryings.names,
2419
+ transformFeedbackVaryings.bufferMode === "separate" ? gl.SEPARATE_ATTRIBS : gl.INTERLEAVED_ATTRIBS
2420
+ );
2421
+ }
2422
+ }
2423
+ gl.linkProgram(webGLProgram);
2424
+ if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS)) {
2425
+ logProgramError(gl, webGLProgram, glVertShader, glFragShader);
2426
+ }
2427
+ program._attributeData = extractAttributesFromGlProgram(
2428
+ webGLProgram,
2429
+ gl,
2430
+ !/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(program.vertex)
2431
+ );
2432
+ program._uniformData = getUniformData(webGLProgram, gl);
2433
+ program._uniformBlockData = getUboData(webGLProgram, gl);
2434
+ gl.deleteShader(glVertShader);
2435
+ gl.deleteShader(glFragShader);
2436
+ const uniformData = {};
2437
+ for (const i in program._uniformData) {
2438
+ const data = program._uniformData[i];
2439
+ uniformData[i] = {
2440
+ location: gl.getUniformLocation(webGLProgram, i),
2441
+ value: defaultValue(data.type, data.size)
2442
+ };
2443
+ }
2444
+ const glProgram = new GlProgramData(webGLProgram, uniformData);
2445
+ return glProgram;
2446
+ }
2447
+
2448
+
2449
+ //# sourceMappingURL=generateProgram.mjs.map
2450
+
2451
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlShaderSystem.mjs
2452
+
2453
+
2454
+
2455
+
2456
+
2457
+ "use strict";
2458
+ const defaultSyncData = {
2459
+ textureCount: 0,
2460
+ blockIndex: 0
2461
+ };
2462
+ class GlShaderSystem {
2463
+ constructor(renderer) {
2464
+ /**
2465
+ * @internal
2466
+ * @private
2467
+ */
2468
+ this._activeProgram = null;
2469
+ this._programDataHash = /* @__PURE__ */ Object.create(null);
2470
+ this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null);
2471
+ this._renderer = renderer;
2472
+ this._renderer.renderableGC.addManagedHash(this, "_programDataHash");
2473
+ }
2474
+ contextChange(gl) {
2475
+ this._gl = gl;
2476
+ this._programDataHash = /* @__PURE__ */ Object.create(null);
2477
+ this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null);
2478
+ this._activeProgram = null;
2479
+ this.maxTextures = (0,maxRecommendedTextures.getMaxTexturesPerBatch)();
2480
+ }
2481
+ /**
2482
+ * Changes the current shader to the one given in parameter.
2483
+ * @param shader - the new shader
2484
+ * @param skipSync - false if the shader should automatically sync its uniforms.
2485
+ * @returns the glProgram that belongs to the shader.
2486
+ */
2487
+ bind(shader, skipSync) {
2488
+ this._setProgram(shader.glProgram);
2489
+ if (skipSync)
2490
+ return;
2491
+ defaultSyncData.textureCount = 0;
2492
+ defaultSyncData.blockIndex = 0;
2493
+ let syncFunction = this._shaderSyncFunctions[shader.glProgram._key];
2494
+ if (!syncFunction) {
2495
+ syncFunction = this._shaderSyncFunctions[shader.glProgram._key] = this._generateShaderSync(shader, this);
2496
+ }
2497
+ this._renderer.buffer.nextBindBase(!!shader.glProgram.transformFeedbackVaryings);
2498
+ syncFunction(this._renderer, shader, defaultSyncData);
2499
+ }
2500
+ /**
2501
+ * Updates the uniform group.
2502
+ * @param uniformGroup - the uniform group to update
2503
+ */
2504
+ updateUniformGroup(uniformGroup) {
2505
+ this._renderer.uniformGroup.updateUniformGroup(uniformGroup, this._activeProgram, defaultSyncData);
2506
+ }
2507
+ /**
2508
+ * Binds a uniform block to the shader.
2509
+ * @param uniformGroup - the uniform group to bind
2510
+ * @param name - the name of the uniform block
2511
+ * @param index - the index of the uniform block
2512
+ */
2513
+ bindUniformBlock(uniformGroup, name, index = 0) {
2514
+ const bufferSystem = this._renderer.buffer;
2515
+ const programData = this._getProgramData(this._activeProgram);
2516
+ const isBufferResource = uniformGroup._bufferResource;
2517
+ if (!isBufferResource) {
2518
+ this._renderer.ubo.updateUniformGroup(uniformGroup);
2519
+ }
2520
+ const buffer = uniformGroup.buffer;
2521
+ const glBuffer = bufferSystem.updateBuffer(buffer);
2522
+ const boundLocation = bufferSystem.freeLocationForBufferBase(glBuffer);
2523
+ if (isBufferResource) {
2524
+ const { offset, size } = uniformGroup;
2525
+ if (offset === 0 && size === buffer.data.byteLength) {
2526
+ bufferSystem.bindBufferBase(glBuffer, boundLocation);
2527
+ } else {
2528
+ bufferSystem.bindBufferRange(glBuffer, boundLocation, offset);
2529
+ }
2530
+ } else if (bufferSystem.getLastBindBaseLocation(glBuffer) !== boundLocation) {
2531
+ bufferSystem.bindBufferBase(glBuffer, boundLocation);
2532
+ }
2533
+ const uniformBlockIndex = this._activeProgram._uniformBlockData[name].index;
2534
+ if (programData.uniformBlockBindings[index] === boundLocation)
2535
+ return;
2536
+ programData.uniformBlockBindings[index] = boundLocation;
2537
+ this._renderer.gl.uniformBlockBinding(programData.program, uniformBlockIndex, boundLocation);
2538
+ }
2539
+ _setProgram(program) {
2540
+ if (this._activeProgram === program)
2541
+ return;
2542
+ this._activeProgram = program;
2543
+ const programData = this._getProgramData(program);
2544
+ this._gl.useProgram(programData.program);
2545
+ }
2546
+ /**
2547
+ * @param program - the program to get the data for
2548
+ * @internal
2549
+ * @private
2550
+ */
2551
+ _getProgramData(program) {
2552
+ return this._programDataHash[program._key] || this._createProgramData(program);
2553
+ }
2554
+ _createProgramData(program) {
2555
+ const key = program._key;
2556
+ this._programDataHash[key] = generateProgram(this._gl, program);
2557
+ return this._programDataHash[key];
2558
+ }
2559
+ destroy() {
2560
+ for (const key of Object.keys(this._programDataHash)) {
2561
+ const programData = this._programDataHash[key];
2562
+ programData.destroy();
2563
+ this._programDataHash[key] = null;
2564
+ }
2565
+ this._programDataHash = null;
2566
+ }
2567
+ /**
2568
+ * Creates a function that can be executed that will sync the shader as efficiently as possible.
2569
+ * Overridden by the unsafe eval package if you don't want eval used in your project.
2570
+ * @param shader - the shader to generate the sync function for
2571
+ * @param shaderSystem - the shader system to use
2572
+ * @returns - the generated sync function
2573
+ * @ignore
2574
+ */
2575
+ _generateShaderSync(shader, shaderSystem) {
2576
+ return generateShaderSyncCode(shader, shaderSystem);
2577
+ }
2578
+ }
2579
+ /** @ignore */
2580
+ GlShaderSystem.extension = {
2581
+ type: [
2582
+ Extensions.ExtensionType.WebGLSystem
2583
+ ],
2584
+ name: "shader"
2585
+ };
2586
+
2587
+
2588
+ //# sourceMappingURL=GlShaderSystem.mjs.map
2589
+
2590
+ // EXTERNAL MODULE: ./node_modules/pixi.js/lib/rendering/renderers/shared/shader/utils/uniformParsers.mjs
2591
+ var uniformParsers = __webpack_require__(8166);
2592
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/generateUniformsSyncTypes.mjs
2593
+
2594
+ const UNIFORM_TO_SINGLE_SETTERS = {
2595
+ f32: `if (cv !== v) {
2596
+ cu.value = v;
2597
+ gl.uniform1f(location, v);
2598
+ }`,
2599
+ "vec2<f32>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
2600
+ cv[0] = v[0];
2601
+ cv[1] = v[1];
2602
+ gl.uniform2f(location, v[0], v[1]);
2603
+ }`,
2604
+ "vec3<f32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
2605
+ cv[0] = v[0];
2606
+ cv[1] = v[1];
2607
+ cv[2] = v[2];
2608
+ gl.uniform3f(location, v[0], v[1], v[2]);
2609
+ }`,
2610
+ "vec4<f32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
2611
+ cv[0] = v[0];
2612
+ cv[1] = v[1];
2613
+ cv[2] = v[2];
2614
+ cv[3] = v[3];
2615
+ gl.uniform4f(location, v[0], v[1], v[2], v[3]);
2616
+ }`,
2617
+ i32: `if (cv !== v) {
2618
+ cu.value = v;
2619
+ gl.uniform1i(location, v);
2620
+ }`,
2621
+ "vec2<i32>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
2622
+ cv[0] = v[0];
2623
+ cv[1] = v[1];
2624
+ gl.uniform2i(location, v[0], v[1]);
2625
+ }`,
2626
+ "vec3<i32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
2627
+ cv[0] = v[0];
2628
+ cv[1] = v[1];
2629
+ cv[2] = v[2];
2630
+ gl.uniform3i(location, v[0], v[1], v[2]);
2631
+ }`,
2632
+ "vec4<i32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
2633
+ cv[0] = v[0];
2634
+ cv[1] = v[1];
2635
+ cv[2] = v[2];
2636
+ cv[3] = v[3];
2637
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
2638
+ }`,
2639
+ u32: `if (cv !== v) {
2640
+ cu.value = v;
2641
+ gl.uniform1ui(location, v);
2642
+ }`,
2643
+ "vec2<u32>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
2644
+ cv[0] = v[0];
2645
+ cv[1] = v[1];
2646
+ gl.uniform2ui(location, v[0], v[1]);
2647
+ }`,
2648
+ "vec3<u32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
2649
+ cv[0] = v[0];
2650
+ cv[1] = v[1];
2651
+ cv[2] = v[2];
2652
+ gl.uniform3ui(location, v[0], v[1], v[2]);
2653
+ }`,
2654
+ "vec4<u32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
2655
+ cv[0] = v[0];
2656
+ cv[1] = v[1];
2657
+ cv[2] = v[2];
2658
+ cv[3] = v[3];
2659
+ gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
2660
+ }`,
2661
+ bool: `if (cv !== v) {
2662
+ cu.value = v;
2663
+ gl.uniform1i(location, v);
2664
+ }`,
2665
+ "vec2<bool>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
2666
+ cv[0] = v[0];
2667
+ cv[1] = v[1];
2668
+ gl.uniform2i(location, v[0], v[1]);
2669
+ }`,
2670
+ "vec3<bool>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
2671
+ cv[0] = v[0];
2672
+ cv[1] = v[1];
2673
+ cv[2] = v[2];
2674
+ gl.uniform3i(location, v[0], v[1], v[2]);
2675
+ }`,
2676
+ "vec4<bool>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
2677
+ cv[0] = v[0];
2678
+ cv[1] = v[1];
2679
+ cv[2] = v[2];
2680
+ cv[3] = v[3];
2681
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
2682
+ }`,
2683
+ "mat2x2<f32>": `gl.uniformMatrix2fv(location, false, v);`,
2684
+ "mat3x3<f32>": `gl.uniformMatrix3fv(location, false, v);`,
2685
+ "mat4x4<f32>": `gl.uniformMatrix4fv(location, false, v);`
2686
+ };
2687
+ const UNIFORM_TO_ARRAY_SETTERS = {
2688
+ f32: `gl.uniform1fv(location, v);`,
2689
+ "vec2<f32>": `gl.uniform2fv(location, v);`,
2690
+ "vec3<f32>": `gl.uniform3fv(location, v);`,
2691
+ "vec4<f32>": `gl.uniform4fv(location, v);`,
2692
+ "mat2x2<f32>": `gl.uniformMatrix2fv(location, false, v);`,
2693
+ "mat3x3<f32>": `gl.uniformMatrix3fv(location, false, v);`,
2694
+ "mat4x4<f32>": `gl.uniformMatrix4fv(location, false, v);`,
2695
+ i32: `gl.uniform1iv(location, v);`,
2696
+ "vec2<i32>": `gl.uniform2iv(location, v);`,
2697
+ "vec3<i32>": `gl.uniform3iv(location, v);`,
2698
+ "vec4<i32>": `gl.uniform4iv(location, v);`,
2699
+ u32: `gl.uniform1iv(location, v);`,
2700
+ "vec2<u32>": `gl.uniform2iv(location, v);`,
2701
+ "vec3<u32>": `gl.uniform3iv(location, v);`,
2702
+ "vec4<u32>": `gl.uniform4iv(location, v);`,
2703
+ bool: `gl.uniform1iv(location, v);`,
2704
+ "vec2<bool>": `gl.uniform2iv(location, v);`,
2705
+ "vec3<bool>": `gl.uniform3iv(location, v);`,
2706
+ "vec4<bool>": `gl.uniform4iv(location, v);`
2707
+ };
2708
+
2709
+
2710
+ //# sourceMappingURL=generateUniformsSyncTypes.mjs.map
2711
+
2712
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/utils/generateUniformsSync.mjs
2713
+
2714
+
2715
+
2716
+
2717
+
2718
+ "use strict";
2719
+ function generateUniformsSync(group, uniformData) {
2720
+ const funcFragments = [`
2721
+ var v = null;
2722
+ var cv = null;
2723
+ var cu = null;
2724
+ var t = 0;
2725
+ var gl = renderer.gl;
2726
+ var name = null;
2727
+ `];
2728
+ for (const i in group.uniforms) {
2729
+ if (!uniformData[i]) {
2730
+ if (group.uniforms[i] instanceof UniformGroup.UniformGroup) {
2731
+ if (group.uniforms[i].ubo) {
2732
+ funcFragments.push(`
2733
+ renderer.shader.bindUniformBlock(uv.${i}, "${i}");
2734
+ `);
2735
+ } else {
2736
+ funcFragments.push(`
2737
+ renderer.shader.updateUniformGroup(uv.${i});
2738
+ `);
2739
+ }
2740
+ } else if (group.uniforms[i] instanceof BufferResource.BufferResource) {
2741
+ funcFragments.push(`
2742
+ renderer.shader.bindBufferResource(uv.${i}, "${i}");
2743
+ `);
2744
+ }
2745
+ continue;
2746
+ }
2747
+ const uniform = group.uniformStructures[i];
2748
+ let parsed = false;
2749
+ for (let j = 0; j < uniformParsers.uniformParsers.length; j++) {
2750
+ const parser = uniformParsers.uniformParsers[j];
2751
+ if (uniform.type === parser.type && parser.test(uniform)) {
2752
+ funcFragments.push(`name = "${i}";`, uniformParsers.uniformParsers[j].uniform);
2753
+ parsed = true;
2754
+ break;
2755
+ }
2756
+ }
2757
+ if (!parsed) {
2758
+ const templateType = uniform.size === 1 ? UNIFORM_TO_SINGLE_SETTERS : UNIFORM_TO_ARRAY_SETTERS;
2759
+ const template = templateType[uniform.type].replace("location", `ud["${i}"].location`);
2760
+ funcFragments.push(`
2761
+ cu = ud["${i}"];
2762
+ cv = cu.value;
2763
+ v = uv["${i}"];
2764
+ ${template};`);
2765
+ }
2766
+ }
2767
+ return new Function("ud", "uv", "renderer", "syncData", funcFragments.join("\n"));
2768
+ }
2769
+
2770
+
2771
+ //# sourceMappingURL=generateUniformsSync.mjs.map
2772
+
2773
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/shader/GlUniformGroupSystem.mjs
2774
+
2775
+
2776
+
2777
+ "use strict";
2778
+ class GlUniformGroupSystem {
2779
+ /** @param renderer - The renderer this System works for. */
2780
+ constructor(renderer) {
2781
+ /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */
2782
+ this._cache = {};
2783
+ this._uniformGroupSyncHash = {};
2784
+ this._renderer = renderer;
2785
+ this.gl = null;
2786
+ this._cache = {};
2787
+ }
2788
+ contextChange(gl) {
2789
+ this.gl = gl;
2790
+ }
2791
+ /**
2792
+ * Uploads the uniforms values to the currently bound shader.
2793
+ * @param group - the uniforms values that be applied to the current shader
2794
+ * @param program
2795
+ * @param syncData
2796
+ * @param syncData.textureCount
2797
+ */
2798
+ updateUniformGroup(group, program, syncData) {
2799
+ const programData = this._renderer.shader._getProgramData(program);
2800
+ if (!group.isStatic || group._dirtyId !== programData.uniformDirtyGroups[group.uid]) {
2801
+ programData.uniformDirtyGroups[group.uid] = group._dirtyId;
2802
+ const syncFunc = this._getUniformSyncFunction(group, program);
2803
+ syncFunc(programData.uniformData, group.uniforms, this._renderer, syncData);
2804
+ }
2805
+ }
2806
+ /**
2807
+ * Overridable by the pixi.js/unsafe-eval package to use static syncUniforms instead.
2808
+ * @param group
2809
+ * @param program
2810
+ */
2811
+ _getUniformSyncFunction(group, program) {
2812
+ return this._uniformGroupSyncHash[group._signature]?.[program._key] || this._createUniformSyncFunction(group, program);
2813
+ }
2814
+ _createUniformSyncFunction(group, program) {
2815
+ const uniformGroupSyncHash = this._uniformGroupSyncHash[group._signature] || (this._uniformGroupSyncHash[group._signature] = {});
2816
+ const id = this._getSignature(group, program._uniformData, "u");
2817
+ if (!this._cache[id]) {
2818
+ this._cache[id] = this._generateUniformsSync(group, program._uniformData);
2819
+ }
2820
+ uniformGroupSyncHash[program._key] = this._cache[id];
2821
+ return uniformGroupSyncHash[program._key];
2822
+ }
2823
+ _generateUniformsSync(group, uniformData) {
2824
+ return generateUniformsSync(group, uniformData);
2825
+ }
2826
+ /**
2827
+ * Takes a uniform group and data and generates a unique signature for them.
2828
+ * @param group - The uniform group to get signature of
2829
+ * @param group.uniforms
2830
+ * @param uniformData - Uniform information generated by the shader
2831
+ * @param preFix
2832
+ * @returns Unique signature of the uniform group
2833
+ */
2834
+ _getSignature(group, uniformData, preFix) {
2835
+ const uniforms = group.uniforms;
2836
+ const strings = [`${preFix}-`];
2837
+ for (const i in uniforms) {
2838
+ strings.push(i);
2839
+ if (uniformData[i]) {
2840
+ strings.push(uniformData[i].type);
2841
+ }
2842
+ }
2843
+ return strings.join("-");
2844
+ }
2845
+ /** Destroys this System and removes all its textures. */
2846
+ destroy() {
2847
+ this._renderer = null;
2848
+ this._cache = null;
2849
+ }
2850
+ }
2851
+ /** @ignore */
2852
+ GlUniformGroupSystem.extension = {
2853
+ type: [
2854
+ Extensions.ExtensionType.WebGLSystem
2855
+ ],
2856
+ name: "uniformGroup"
2857
+ };
2858
+
2859
+
2860
+ //# sourceMappingURL=GlUniformGroupSystem.mjs.map
2861
+
2862
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/state/mapWebGLBlendModesToPixi.mjs
2863
+
2864
+
2865
+ "use strict";
2866
+ function mapWebGLBlendModesToPixi(gl) {
2867
+ const blendMap = {};
2868
+ blendMap.normal = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
2869
+ blendMap.add = [gl.ONE, gl.ONE];
2870
+ blendMap.multiply = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
2871
+ blendMap.screen = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
2872
+ blendMap.none = [0, 0];
2873
+ blendMap["normal-npm"] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
2874
+ blendMap["add-npm"] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];
2875
+ blendMap["screen-npm"] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
2876
+ blendMap.erase = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];
2877
+ const isWebGl2 = !(gl instanceof adapter.DOMAdapter.get().getWebGLRenderingContext());
2878
+ if (isWebGl2) {
2879
+ blendMap.min = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.MIN, gl.MIN];
2880
+ blendMap.max = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.MAX, gl.MAX];
2881
+ } else {
2882
+ const ext = gl.getExtension("EXT_blend_minmax");
2883
+ if (ext) {
2884
+ blendMap.min = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, ext.MIN_EXT, ext.MIN_EXT];
2885
+ blendMap.max = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, ext.MAX_EXT, ext.MAX_EXT];
2886
+ }
2887
+ }
2888
+ return blendMap;
2889
+ }
2890
+
2891
+
2892
+ //# sourceMappingURL=mapWebGLBlendModesToPixi.mjs.map
2893
+
2894
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/state/GlStateSystem.mjs
2895
+
2896
+
2897
+
2898
+
2899
+ "use strict";
2900
+ const BLEND = 0;
2901
+ const OFFSET = 1;
2902
+ const CULLING = 2;
2903
+ const DEPTH_TEST = 3;
2904
+ const WINDING = 4;
2905
+ const DEPTH_MASK = 5;
2906
+ const _GlStateSystem = class _GlStateSystem {
2907
+ constructor() {
2908
+ this.gl = null;
2909
+ this.stateId = 0;
2910
+ this.polygonOffset = 0;
2911
+ this.blendMode = "none";
2912
+ this._blendEq = false;
2913
+ this.map = [];
2914
+ this.map[BLEND] = this.setBlend;
2915
+ this.map[OFFSET] = this.setOffset;
2916
+ this.map[CULLING] = this.setCullFace;
2917
+ this.map[DEPTH_TEST] = this.setDepthTest;
2918
+ this.map[WINDING] = this.setFrontFace;
2919
+ this.map[DEPTH_MASK] = this.setDepthMask;
2920
+ this.checks = [];
2921
+ this.defaultState = State.State.for2d();
2922
+ }
2923
+ contextChange(gl) {
2924
+ this.gl = gl;
2925
+ this.blendModesMap = mapWebGLBlendModesToPixi(gl);
2926
+ this.reset();
2927
+ }
2928
+ /**
2929
+ * Sets the current state
2930
+ * @param {*} state - The state to set.
2931
+ */
2932
+ set(state) {
2933
+ state || (state = this.defaultState);
2934
+ if (this.stateId !== state.data) {
2935
+ let diff = this.stateId ^ state.data;
2936
+ let i = 0;
2937
+ while (diff) {
2938
+ if (diff & 1) {
2939
+ this.map[i].call(this, !!(state.data & 1 << i));
2940
+ }
2941
+ diff >>= 1;
2942
+ i++;
2943
+ }
2944
+ this.stateId = state.data;
2945
+ }
2946
+ for (let i = 0; i < this.checks.length; i++) {
2947
+ this.checks[i](this, state);
2948
+ }
2949
+ }
2950
+ /**
2951
+ * Sets the state, when previous state is unknown.
2952
+ * @param {*} state - The state to set
2953
+ */
2954
+ forceState(state) {
2955
+ state || (state = this.defaultState);
2956
+ for (let i = 0; i < this.map.length; i++) {
2957
+ this.map[i].call(this, !!(state.data & 1 << i));
2958
+ }
2959
+ for (let i = 0; i < this.checks.length; i++) {
2960
+ this.checks[i](this, state);
2961
+ }
2962
+ this.stateId = state.data;
2963
+ }
2964
+ /**
2965
+ * Sets whether to enable or disable blending.
2966
+ * @param value - Turn on or off WebGl blending.
2967
+ */
2968
+ setBlend(value) {
2969
+ this._updateCheck(_GlStateSystem._checkBlendMode, value);
2970
+ this.gl[value ? "enable" : "disable"](this.gl.BLEND);
2971
+ }
2972
+ /**
2973
+ * Sets whether to enable or disable polygon offset fill.
2974
+ * @param value - Turn on or off webgl polygon offset testing.
2975
+ */
2976
+ setOffset(value) {
2977
+ this._updateCheck(_GlStateSystem._checkPolygonOffset, value);
2978
+ this.gl[value ? "enable" : "disable"](this.gl.POLYGON_OFFSET_FILL);
2979
+ }
2980
+ /**
2981
+ * Sets whether to enable or disable depth test.
2982
+ * @param value - Turn on or off webgl depth testing.
2983
+ */
2984
+ setDepthTest(value) {
2985
+ this.gl[value ? "enable" : "disable"](this.gl.DEPTH_TEST);
2986
+ }
2987
+ /**
2988
+ * Sets whether to enable or disable depth mask.
2989
+ * @param value - Turn on or off webgl depth mask.
2990
+ */
2991
+ setDepthMask(value) {
2992
+ this.gl.depthMask(value);
2993
+ }
2994
+ /**
2995
+ * Sets whether to enable or disable cull face.
2996
+ * @param {boolean} value - Turn on or off webgl cull face.
2997
+ */
2998
+ setCullFace(value) {
2999
+ this.gl[value ? "enable" : "disable"](this.gl.CULL_FACE);
3000
+ }
3001
+ /**
3002
+ * Sets the gl front face.
3003
+ * @param {boolean} value - true is clockwise and false is counter-clockwise
3004
+ */
3005
+ setFrontFace(value) {
3006
+ this.gl.frontFace(this.gl[value ? "CW" : "CCW"]);
3007
+ }
3008
+ /**
3009
+ * Sets the blend mode.
3010
+ * @param {number} value - The blend mode to set to.
3011
+ */
3012
+ setBlendMode(value) {
3013
+ if (!this.blendModesMap[value]) {
3014
+ value = "normal";
3015
+ }
3016
+ if (value === this.blendMode) {
3017
+ return;
3018
+ }
3019
+ this.blendMode = value;
3020
+ const mode = this.blendModesMap[value];
3021
+ const gl = this.gl;
3022
+ if (mode.length === 2) {
3023
+ gl.blendFunc(mode[0], mode[1]);
3024
+ } else {
3025
+ gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);
3026
+ }
3027
+ if (mode.length === 6) {
3028
+ this._blendEq = true;
3029
+ gl.blendEquationSeparate(mode[4], mode[5]);
3030
+ } else if (this._blendEq) {
3031
+ this._blendEq = false;
3032
+ gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
3033
+ }
3034
+ }
3035
+ /**
3036
+ * Sets the polygon offset.
3037
+ * @param {number} value - the polygon offset
3038
+ * @param {number} scale - the polygon offset scale
3039
+ */
3040
+ setPolygonOffset(value, scale) {
3041
+ this.gl.polygonOffset(value, scale);
3042
+ }
3043
+ // used
3044
+ /** Resets all the logic and disables the VAOs. */
3045
+ reset() {
3046
+ this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);
3047
+ this.forceState(this.defaultState);
3048
+ this._blendEq = true;
3049
+ this.blendMode = "";
3050
+ this.setBlendMode("normal");
3051
+ }
3052
+ /**
3053
+ * Checks to see which updates should be checked based on which settings have been activated.
3054
+ *
3055
+ * For example, if blend is enabled then we should check the blend modes each time the state is changed
3056
+ * or if polygon fill is activated then we need to check if the polygon offset changes.
3057
+ * The idea is that we only check what we have too.
3058
+ * @param func - the checking function to add or remove
3059
+ * @param value - should the check function be added or removed.
3060
+ */
3061
+ _updateCheck(func, value) {
3062
+ const index = this.checks.indexOf(func);
3063
+ if (value && index === -1) {
3064
+ this.checks.push(func);
3065
+ } else if (!value && index !== -1) {
3066
+ this.checks.splice(index, 1);
3067
+ }
3068
+ }
3069
+ /**
3070
+ * A private little wrapper function that we call to check the blend mode.
3071
+ * @param system - the System to perform the state check on
3072
+ * @param state - the state that the blendMode will pulled from
3073
+ */
3074
+ static _checkBlendMode(system, state) {
3075
+ system.setBlendMode(state.blendMode);
3076
+ }
3077
+ /**
3078
+ * A private little wrapper function that we call to check the polygon offset.
3079
+ * @param system - the System to perform the state check on
3080
+ * @param state - the state that the blendMode will pulled from
3081
+ */
3082
+ static _checkPolygonOffset(system, state) {
3083
+ system.setPolygonOffset(1, state.polygonOffset);
3084
+ }
3085
+ /**
3086
+ * @ignore
3087
+ */
3088
+ destroy() {
3089
+ this.gl = null;
3090
+ this.checks.length = 0;
3091
+ }
3092
+ };
3093
+ /** @ignore */
3094
+ _GlStateSystem.extension = {
3095
+ type: [
3096
+ Extensions.ExtensionType.WebGLSystem
3097
+ ],
3098
+ name: "state"
3099
+ };
3100
+ let GlStateSystem = _GlStateSystem;
3101
+
3102
+
3103
+ //# sourceMappingURL=GlStateSystem.mjs.map
3104
+
3105
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/GlTexture.mjs
3106
+
3107
+
3108
+ "use strict";
3109
+ class GlTexture {
3110
+ constructor(texture) {
3111
+ this.target = GL_TARGETS.TEXTURE_2D;
3112
+ this.texture = texture;
3113
+ this.width = -1;
3114
+ this.height = -1;
3115
+ this.type = GL_TYPES.UNSIGNED_BYTE;
3116
+ this.internalFormat = GL_FORMATS.RGBA;
3117
+ this.format = GL_FORMATS.RGBA;
3118
+ this.samplerType = 0;
3119
+ }
3120
+ }
3121
+
3122
+
3123
+ //# sourceMappingURL=GlTexture.mjs.map
3124
+
3125
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadBufferImageResource.mjs
3126
+
3127
+ const glUploadBufferImageResource = {
3128
+ id: "buffer",
3129
+ upload(source, glTexture, gl) {
3130
+ if (glTexture.width === source.width || glTexture.height === source.height) {
3131
+ gl.texSubImage2D(
3132
+ gl.TEXTURE_2D,
3133
+ 0,
3134
+ 0,
3135
+ 0,
3136
+ source.width,
3137
+ source.height,
3138
+ glTexture.format,
3139
+ glTexture.type,
3140
+ source.resource
3141
+ );
3142
+ } else {
3143
+ gl.texImage2D(
3144
+ glTexture.target,
3145
+ 0,
3146
+ glTexture.internalFormat,
3147
+ source.width,
3148
+ source.height,
3149
+ 0,
3150
+ glTexture.format,
3151
+ glTexture.type,
3152
+ source.resource
3153
+ );
3154
+ }
3155
+ glTexture.width = source.width;
3156
+ glTexture.height = source.height;
3157
+ }
3158
+ };
3159
+
3160
+
3161
+ //# sourceMappingURL=glUploadBufferImageResource.mjs.map
3162
+
3163
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadCompressedTextureResource.mjs
3164
+
3165
+ const compressedFormatMap = {
3166
+ "bc1-rgba-unorm": true,
3167
+ "bc1-rgba-unorm-srgb": true,
3168
+ "bc2-rgba-unorm": true,
3169
+ "bc2-rgba-unorm-srgb": true,
3170
+ "bc3-rgba-unorm": true,
3171
+ "bc3-rgba-unorm-srgb": true,
3172
+ "bc4-r-unorm": true,
3173
+ "bc4-r-snorm": true,
3174
+ "bc5-rg-unorm": true,
3175
+ "bc5-rg-snorm": true,
3176
+ "bc6h-rgb-ufloat": true,
3177
+ "bc6h-rgb-float": true,
3178
+ "bc7-rgba-unorm": true,
3179
+ "bc7-rgba-unorm-srgb": true,
3180
+ // ETC2 compressed formats usable if "texture-compression-etc2" is both
3181
+ // supported by the device/user agent and enabled in requestDevice.
3182
+ "etc2-rgb8unorm": true,
3183
+ "etc2-rgb8unorm-srgb": true,
3184
+ "etc2-rgb8a1unorm": true,
3185
+ "etc2-rgb8a1unorm-srgb": true,
3186
+ "etc2-rgba8unorm": true,
3187
+ "etc2-rgba8unorm-srgb": true,
3188
+ "eac-r11unorm": true,
3189
+ "eac-r11snorm": true,
3190
+ "eac-rg11unorm": true,
3191
+ "eac-rg11snorm": true,
3192
+ // ASTC compressed formats usable if "texture-compression-astc" is both
3193
+ // supported by the device/user agent and enabled in requestDevice.
3194
+ "astc-4x4-unorm": true,
3195
+ "astc-4x4-unorm-srgb": true,
3196
+ "astc-5x4-unorm": true,
3197
+ "astc-5x4-unorm-srgb": true,
3198
+ "astc-5x5-unorm": true,
3199
+ "astc-5x5-unorm-srgb": true,
3200
+ "astc-6x5-unorm": true,
3201
+ "astc-6x5-unorm-srgb": true,
3202
+ "astc-6x6-unorm": true,
3203
+ "astc-6x6-unorm-srgb": true,
3204
+ "astc-8x5-unorm": true,
3205
+ "astc-8x5-unorm-srgb": true,
3206
+ "astc-8x6-unorm": true,
3207
+ "astc-8x6-unorm-srgb": true,
3208
+ "astc-8x8-unorm": true,
3209
+ "astc-8x8-unorm-srgb": true,
3210
+ "astc-10x5-unorm": true,
3211
+ "astc-10x5-unorm-srgb": true,
3212
+ "astc-10x6-unorm": true,
3213
+ "astc-10x6-unorm-srgb": true,
3214
+ "astc-10x8-unorm": true,
3215
+ "astc-10x8-unorm-srgb": true,
3216
+ "astc-10x10-unorm": true,
3217
+ "astc-10x10-unorm-srgb": true,
3218
+ "astc-12x10-unorm": true,
3219
+ "astc-12x10-unorm-srgb": true,
3220
+ "astc-12x12-unorm": true,
3221
+ "astc-12x12-unorm-srgb": true
3222
+ };
3223
+ const glUploadCompressedTextureResource = {
3224
+ id: "compressed",
3225
+ upload(source, glTexture, gl) {
3226
+ gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
3227
+ let mipWidth = source.pixelWidth;
3228
+ let mipHeight = source.pixelHeight;
3229
+ const compressed = !!compressedFormatMap[source.format];
3230
+ for (let i = 0; i < source.resource.length; i++) {
3231
+ const levelBuffer = source.resource[i];
3232
+ if (compressed) {
3233
+ gl.compressedTexImage2D(
3234
+ gl.TEXTURE_2D,
3235
+ i,
3236
+ glTexture.internalFormat,
3237
+ mipWidth,
3238
+ mipHeight,
3239
+ 0,
3240
+ levelBuffer
3241
+ );
3242
+ } else {
3243
+ gl.texImage2D(
3244
+ gl.TEXTURE_2D,
3245
+ i,
3246
+ glTexture.internalFormat,
3247
+ mipWidth,
3248
+ mipHeight,
3249
+ 0,
3250
+ glTexture.format,
3251
+ glTexture.type,
3252
+ levelBuffer
3253
+ );
3254
+ }
3255
+ mipWidth = Math.max(mipWidth >> 1, 1);
3256
+ mipHeight = Math.max(mipHeight >> 1, 1);
3257
+ }
3258
+ }
3259
+ };
3260
+
3261
+
3262
+ //# sourceMappingURL=glUploadCompressedTextureResource.mjs.map
3263
+
3264
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadImageResource.mjs
3265
+
3266
+ const glUploadImageResource = {
3267
+ id: "image",
3268
+ upload(source, glTexture, gl, webGLVersion) {
3269
+ const premultipliedAlpha = source.alphaMode === "premultiply-alpha-on-upload";
3270
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultipliedAlpha);
3271
+ const glWidth = glTexture.width;
3272
+ const glHeight = glTexture.height;
3273
+ const textureWidth = source.pixelWidth;
3274
+ const textureHeight = source.pixelHeight;
3275
+ const resourceWidth = source.resourceWidth;
3276
+ const resourceHeight = source.resourceHeight;
3277
+ if (resourceWidth < textureWidth || resourceHeight < textureHeight) {
3278
+ if (glWidth !== textureWidth || glHeight !== textureHeight) {
3279
+ gl.texImage2D(
3280
+ glTexture.target,
3281
+ 0,
3282
+ glTexture.internalFormat,
3283
+ textureWidth,
3284
+ textureHeight,
3285
+ 0,
3286
+ glTexture.format,
3287
+ glTexture.type,
3288
+ null
3289
+ );
3290
+ }
3291
+ if (webGLVersion === 2) {
3292
+ gl.texSubImage2D(
3293
+ gl.TEXTURE_2D,
3294
+ 0,
3295
+ 0,
3296
+ 0,
3297
+ resourceWidth,
3298
+ resourceHeight,
3299
+ glTexture.format,
3300
+ glTexture.type,
3301
+ source.resource
3302
+ );
3303
+ } else {
3304
+ gl.texSubImage2D(
3305
+ gl.TEXTURE_2D,
3306
+ 0,
3307
+ 0,
3308
+ 0,
3309
+ glTexture.format,
3310
+ glTexture.type,
3311
+ source.resource
3312
+ );
3313
+ }
3314
+ } else if (glWidth === textureWidth || glHeight === textureHeight) {
3315
+ gl.texSubImage2D(
3316
+ gl.TEXTURE_2D,
3317
+ 0,
3318
+ 0,
3319
+ 0,
3320
+ glTexture.format,
3321
+ glTexture.type,
3322
+ source.resource
3323
+ );
3324
+ } else if (webGLVersion === 2) {
3325
+ gl.texImage2D(
3326
+ glTexture.target,
3327
+ 0,
3328
+ glTexture.internalFormat,
3329
+ textureWidth,
3330
+ textureHeight,
3331
+ 0,
3332
+ glTexture.format,
3333
+ glTexture.type,
3334
+ source.resource
3335
+ );
3336
+ } else {
3337
+ gl.texImage2D(
3338
+ glTexture.target,
3339
+ 0,
3340
+ glTexture.internalFormat,
3341
+ glTexture.format,
3342
+ glTexture.type,
3343
+ source.resource
3344
+ );
3345
+ }
3346
+ glTexture.width = textureWidth;
3347
+ glTexture.height = textureHeight;
3348
+ }
3349
+ };
3350
+
3351
+
3352
+ //# sourceMappingURL=glUploadImageResource.mjs.map
3353
+
3354
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/uploaders/glUploadVideoResource.mjs
3355
+
3356
+
3357
+ "use strict";
3358
+ const glUploadVideoResource = {
3359
+ id: "video",
3360
+ upload(source, glTexture, gl, webGLVersion) {
3361
+ if (!source.isValid) {
3362
+ gl.texImage2D(
3363
+ glTexture.target,
3364
+ 0,
3365
+ glTexture.internalFormat,
3366
+ 1,
3367
+ 1,
3368
+ 0,
3369
+ glTexture.format,
3370
+ glTexture.type,
3371
+ null
3372
+ );
3373
+ return;
3374
+ }
3375
+ glUploadImageResource.upload(source, glTexture, gl, webGLVersion);
3376
+ }
3377
+ };
3378
+
3379
+
3380
+ //# sourceMappingURL=glUploadVideoResource.mjs.map
3381
+
3382
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/pixiToGlMaps.mjs
3383
+
3384
+ const scaleModeToGlFilter = {
3385
+ linear: 9729,
3386
+ nearest: 9728
3387
+ };
3388
+ const mipmapScaleModeToGlFilter = {
3389
+ linear: {
3390
+ linear: 9987,
3391
+ nearest: 9985
3392
+ },
3393
+ nearest: {
3394
+ linear: 9986,
3395
+ nearest: 9984
3396
+ }
3397
+ };
3398
+ const wrapModeToGlAddress = {
3399
+ "clamp-to-edge": 33071,
3400
+ repeat: 10497,
3401
+ "mirror-repeat": 33648
3402
+ };
3403
+ const compareModeToGlCompare = {
3404
+ never: 512,
3405
+ less: 513,
3406
+ equal: 514,
3407
+ "less-equal": 515,
3408
+ greater: 516,
3409
+ "not-equal": 517,
3410
+ "greater-equal": 518,
3411
+ always: 519
3412
+ };
3413
+
3414
+
3415
+ //# sourceMappingURL=pixiToGlMaps.mjs.map
3416
+
3417
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/applyStyleParams.mjs
3418
+
3419
+
3420
+ "use strict";
3421
+ function applyStyleParams(style, gl, mipmaps, anisotropicExt, glFunctionName, firstParam, forceClamp, firstCreation) {
3422
+ const castParam = firstParam;
3423
+ if (!firstCreation || style.addressModeU !== "repeat" || style.addressModeV !== "repeat" || style.addressModeW !== "repeat") {
3424
+ const wrapModeS = wrapModeToGlAddress[forceClamp ? "clamp-to-edge" : style.addressModeU];
3425
+ const wrapModeT = wrapModeToGlAddress[forceClamp ? "clamp-to-edge" : style.addressModeV];
3426
+ const wrapModeR = wrapModeToGlAddress[forceClamp ? "clamp-to-edge" : style.addressModeW];
3427
+ gl[glFunctionName](castParam, gl.TEXTURE_WRAP_S, wrapModeS);
3428
+ gl[glFunctionName](castParam, gl.TEXTURE_WRAP_T, wrapModeT);
3429
+ if (gl.TEXTURE_WRAP_R)
3430
+ gl[glFunctionName](castParam, gl.TEXTURE_WRAP_R, wrapModeR);
3431
+ }
3432
+ if (!firstCreation || style.magFilter !== "linear") {
3433
+ gl[glFunctionName](castParam, gl.TEXTURE_MAG_FILTER, scaleModeToGlFilter[style.magFilter]);
3434
+ }
3435
+ if (mipmaps) {
3436
+ if (!firstCreation || style.mipmapFilter !== "linear") {
3437
+ const glFilterMode = mipmapScaleModeToGlFilter[style.minFilter][style.mipmapFilter];
3438
+ gl[glFunctionName](castParam, gl.TEXTURE_MIN_FILTER, glFilterMode);
3439
+ }
3440
+ } else {
3441
+ gl[glFunctionName](castParam, gl.TEXTURE_MIN_FILTER, scaleModeToGlFilter[style.minFilter]);
3442
+ }
3443
+ if (anisotropicExt && style.maxAnisotropy > 1) {
3444
+ const level = Math.min(style.maxAnisotropy, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));
3445
+ gl[glFunctionName](castParam, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);
3446
+ }
3447
+ if (style.compare) {
3448
+ gl[glFunctionName](castParam, gl.TEXTURE_COMPARE_FUNC, compareModeToGlCompare[style.compare]);
3449
+ }
3450
+ }
3451
+
3452
+
3453
+ //# sourceMappingURL=applyStyleParams.mjs.map
3454
+
3455
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/mapFormatToGlFormat.mjs
3456
+
3457
+ function mapFormatToGlFormat(gl) {
3458
+ return {
3459
+ // 8-bit formats
3460
+ r8unorm: gl.RED,
3461
+ r8snorm: gl.RED,
3462
+ r8uint: gl.RED,
3463
+ r8sint: gl.RED,
3464
+ // 16-bit formats
3465
+ r16uint: gl.RED,
3466
+ r16sint: gl.RED,
3467
+ r16float: gl.RED,
3468
+ rg8unorm: gl.RG,
3469
+ rg8snorm: gl.RG,
3470
+ rg8uint: gl.RG,
3471
+ rg8sint: gl.RG,
3472
+ // 32-bit formats
3473
+ r32uint: gl.RED,
3474
+ r32sint: gl.RED,
3475
+ r32float: gl.RED,
3476
+ rg16uint: gl.RG,
3477
+ rg16sint: gl.RG,
3478
+ rg16float: gl.RG,
3479
+ rgba8unorm: gl.RGBA,
3480
+ "rgba8unorm-srgb": gl.RGBA,
3481
+ // Packed 32-bit formats
3482
+ rgba8snorm: gl.RGBA,
3483
+ rgba8uint: gl.RGBA,
3484
+ rgba8sint: gl.RGBA,
3485
+ bgra8unorm: gl.RGBA,
3486
+ "bgra8unorm-srgb": gl.RGBA,
3487
+ rgb9e5ufloat: gl.RGB,
3488
+ rgb10a2unorm: gl.RGBA,
3489
+ rg11b10ufloat: gl.RGB,
3490
+ // 64-bit formats
3491
+ rg32uint: gl.RG,
3492
+ rg32sint: gl.RG,
3493
+ rg32float: gl.RG,
3494
+ rgba16uint: gl.RGBA,
3495
+ rgba16sint: gl.RGBA,
3496
+ rgba16float: gl.RGBA,
3497
+ // 128-bit formats
3498
+ rgba32uint: gl.RGBA,
3499
+ rgba32sint: gl.RGBA,
3500
+ rgba32float: gl.RGBA,
3501
+ // Depth/stencil formats
3502
+ stencil8: gl.STENCIL_INDEX8,
3503
+ depth16unorm: gl.DEPTH_COMPONENT,
3504
+ depth24plus: gl.DEPTH_COMPONENT,
3505
+ "depth24plus-stencil8": gl.DEPTH_STENCIL,
3506
+ depth32float: gl.DEPTH_COMPONENT,
3507
+ "depth32float-stencil8": gl.DEPTH_STENCIL
3508
+ };
3509
+ }
3510
+
3511
+
3512
+ //# sourceMappingURL=mapFormatToGlFormat.mjs.map
3513
+
3514
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/mapFormatToGlInternalFormat.mjs
3515
+
3516
+
3517
+ "use strict";
3518
+ function mapFormatToGlInternalFormat(gl, extensions) {
3519
+ let srgb = {};
3520
+ let bgra8unorm = gl.RGBA;
3521
+ if (!(gl instanceof adapter.DOMAdapter.get().getWebGLRenderingContext())) {
3522
+ srgb = {
3523
+ "rgba8unorm-srgb": gl.SRGB8_ALPHA8,
3524
+ "bgra8unorm-srgb": gl.SRGB8_ALPHA8
3525
+ };
3526
+ bgra8unorm = gl.RGBA8;
3527
+ } else if (extensions.srgb) {
3528
+ srgb = {
3529
+ "rgba8unorm-srgb": extensions.srgb.SRGB8_ALPHA8_EXT,
3530
+ "bgra8unorm-srgb": extensions.srgb.SRGB8_ALPHA8_EXT
3531
+ };
3532
+ }
3533
+ return {
3534
+ // 8-bit formats
3535
+ r8unorm: gl.R8,
3536
+ r8snorm: gl.R8_SNORM,
3537
+ r8uint: gl.R8UI,
3538
+ r8sint: gl.R8I,
3539
+ // 16-bit formats
3540
+ r16uint: gl.R16UI,
3541
+ r16sint: gl.R16I,
3542
+ r16float: gl.R16F,
3543
+ rg8unorm: gl.RG8,
3544
+ rg8snorm: gl.RG8_SNORM,
3545
+ rg8uint: gl.RG8UI,
3546
+ rg8sint: gl.RG8I,
3547
+ // 32-bit formats
3548
+ r32uint: gl.R32UI,
3549
+ r32sint: gl.R32I,
3550
+ r32float: gl.R32F,
3551
+ rg16uint: gl.RG16UI,
3552
+ rg16sint: gl.RG16I,
3553
+ rg16float: gl.RG16F,
3554
+ rgba8unorm: gl.RGBA,
3555
+ ...srgb,
3556
+ // Packed 32-bit formats
3557
+ rgba8snorm: gl.RGBA8_SNORM,
3558
+ rgba8uint: gl.RGBA8UI,
3559
+ rgba8sint: gl.RGBA8I,
3560
+ bgra8unorm,
3561
+ rgb9e5ufloat: gl.RGB9_E5,
3562
+ rgb10a2unorm: gl.RGB10_A2,
3563
+ rg11b10ufloat: gl.R11F_G11F_B10F,
3564
+ // 64-bit formats
3565
+ rg32uint: gl.RG32UI,
3566
+ rg32sint: gl.RG32I,
3567
+ rg32float: gl.RG32F,
3568
+ rgba16uint: gl.RGBA16UI,
3569
+ rgba16sint: gl.RGBA16I,
3570
+ rgba16float: gl.RGBA16F,
3571
+ // 128-bit formats
3572
+ rgba32uint: gl.RGBA32UI,
3573
+ rgba32sint: gl.RGBA32I,
3574
+ rgba32float: gl.RGBA32F,
3575
+ // Depth/stencil formats
3576
+ stencil8: gl.STENCIL_INDEX8,
3577
+ depth16unorm: gl.DEPTH_COMPONENT16,
3578
+ depth24plus: gl.DEPTH_COMPONENT24,
3579
+ "depth24plus-stencil8": gl.DEPTH24_STENCIL8,
3580
+ depth32float: gl.DEPTH_COMPONENT32F,
3581
+ "depth32float-stencil8": gl.DEPTH32F_STENCIL8,
3582
+ // Compressed formats
3583
+ ...extensions.s3tc ? {
3584
+ "bc1-rgba-unorm": extensions.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,
3585
+ "bc2-rgba-unorm": extensions.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,
3586
+ "bc3-rgba-unorm": extensions.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT
3587
+ } : {},
3588
+ ...extensions.s3tc_sRGB ? {
3589
+ "bc1-rgba-unorm-srgb": extensions.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
3590
+ "bc2-rgba-unorm-srgb": extensions.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
3591
+ "bc3-rgba-unorm-srgb": extensions.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
3592
+ } : {},
3593
+ ...extensions.rgtc ? {
3594
+ "bc4-r-unorm": extensions.rgtc.COMPRESSED_RED_RGTC1_EXT,
3595
+ "bc4-r-snorm": extensions.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,
3596
+ "bc5-rg-unorm": extensions.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,
3597
+ "bc5-rg-snorm": extensions.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT
3598
+ } : {},
3599
+ ...extensions.bptc ? {
3600
+ "bc6h-rgb-float": extensions.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
3601
+ "bc6h-rgb-ufloat": extensions.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
3602
+ "bc7-rgba-unorm": extensions.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,
3603
+ "bc7-rgba-unorm-srgb": extensions.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT
3604
+ } : {},
3605
+ ...extensions.etc ? {
3606
+ "etc2-rgb8unorm": extensions.etc.COMPRESSED_RGB8_ETC2,
3607
+ "etc2-rgb8unorm-srgb": extensions.etc.COMPRESSED_SRGB8_ETC2,
3608
+ "etc2-rgb8a1unorm": extensions.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
3609
+ "etc2-rgb8a1unorm-srgb": extensions.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
3610
+ "etc2-rgba8unorm": extensions.etc.COMPRESSED_RGBA8_ETC2_EAC,
3611
+ "etc2-rgba8unorm-srgb": extensions.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
3612
+ "eac-r11unorm": extensions.etc.COMPRESSED_R11_EAC,
3613
+ // 'eac-r11snorm'
3614
+ "eac-rg11unorm": extensions.etc.COMPRESSED_SIGNED_RG11_EAC
3615
+ // 'eac-rg11snorm'
3616
+ } : {},
3617
+ ...extensions.astc ? {
3618
+ "astc-4x4-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,
3619
+ "astc-4x4-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
3620
+ "astc-5x4-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,
3621
+ "astc-5x4-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
3622
+ "astc-5x5-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,
3623
+ "astc-5x5-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
3624
+ "astc-6x5-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,
3625
+ "astc-6x5-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
3626
+ "astc-6x6-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,
3627
+ "astc-6x6-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
3628
+ "astc-8x5-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,
3629
+ "astc-8x5-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
3630
+ "astc-8x6-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,
3631
+ "astc-8x6-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
3632
+ "astc-8x8-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,
3633
+ "astc-8x8-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
3634
+ "astc-10x5-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,
3635
+ "astc-10x5-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
3636
+ "astc-10x6-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,
3637
+ "astc-10x6-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
3638
+ "astc-10x8-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,
3639
+ "astc-10x8-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
3640
+ "astc-10x10-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,
3641
+ "astc-10x10-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
3642
+ "astc-12x10-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,
3643
+ "astc-12x10-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
3644
+ "astc-12x12-unorm": extensions.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,
3645
+ "astc-12x12-unorm-srgb": extensions.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
3646
+ } : {}
3647
+ };
3648
+ }
3649
+
3650
+
3651
+ //# sourceMappingURL=mapFormatToGlInternalFormat.mjs.map
3652
+
3653
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/utils/mapFormatToGlType.mjs
3654
+
3655
+ function mapFormatToGlType(gl) {
3656
+ return {
3657
+ // 8-bit formats
3658
+ r8unorm: gl.UNSIGNED_BYTE,
3659
+ r8snorm: gl.BYTE,
3660
+ r8uint: gl.UNSIGNED_BYTE,
3661
+ r8sint: gl.BYTE,
3662
+ // 16-bit formats
3663
+ r16uint: gl.UNSIGNED_SHORT,
3664
+ r16sint: gl.SHORT,
3665
+ r16float: gl.HALF_FLOAT,
3666
+ rg8unorm: gl.UNSIGNED_BYTE,
3667
+ rg8snorm: gl.BYTE,
3668
+ rg8uint: gl.UNSIGNED_BYTE,
3669
+ rg8sint: gl.BYTE,
3670
+ // 32-bit formats
3671
+ r32uint: gl.UNSIGNED_INT,
3672
+ r32sint: gl.INT,
3673
+ r32float: gl.FLOAT,
3674
+ rg16uint: gl.UNSIGNED_SHORT,
3675
+ rg16sint: gl.SHORT,
3676
+ rg16float: gl.HALF_FLOAT,
3677
+ rgba8unorm: gl.UNSIGNED_BYTE,
3678
+ "rgba8unorm-srgb": gl.UNSIGNED_BYTE,
3679
+ // Packed 32-bit formats
3680
+ rgba8snorm: gl.BYTE,
3681
+ rgba8uint: gl.UNSIGNED_BYTE,
3682
+ rgba8sint: gl.BYTE,
3683
+ bgra8unorm: gl.UNSIGNED_BYTE,
3684
+ "bgra8unorm-srgb": gl.UNSIGNED_BYTE,
3685
+ rgb9e5ufloat: gl.UNSIGNED_INT_5_9_9_9_REV,
3686
+ rgb10a2unorm: gl.UNSIGNED_INT_2_10_10_10_REV,
3687
+ rg11b10ufloat: gl.UNSIGNED_INT_10F_11F_11F_REV,
3688
+ // 64-bit formats
3689
+ rg32uint: gl.UNSIGNED_INT,
3690
+ rg32sint: gl.INT,
3691
+ rg32float: gl.FLOAT,
3692
+ rgba16uint: gl.UNSIGNED_SHORT,
3693
+ rgba16sint: gl.SHORT,
3694
+ rgba16float: gl.HALF_FLOAT,
3695
+ // 128-bit formats
3696
+ rgba32uint: gl.UNSIGNED_INT,
3697
+ rgba32sint: gl.INT,
3698
+ rgba32float: gl.FLOAT,
3699
+ // Depth/stencil formats
3700
+ stencil8: gl.UNSIGNED_BYTE,
3701
+ depth16unorm: gl.UNSIGNED_SHORT,
3702
+ depth24plus: gl.UNSIGNED_INT,
3703
+ "depth24plus-stencil8": gl.UNSIGNED_INT_24_8,
3704
+ depth32float: gl.FLOAT,
3705
+ "depth32float-stencil8": gl.FLOAT_32_UNSIGNED_INT_24_8_REV
3706
+ };
3707
+ }
3708
+
3709
+
3710
+ //# sourceMappingURL=mapFormatToGlType.mjs.map
3711
+
3712
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/texture/GlTextureSystem.mjs
3713
+
3714
+
3715
+
3716
+
3717
+
3718
+
3719
+
3720
+
3721
+
3722
+
3723
+
3724
+
3725
+
3726
+
3727
+ "use strict";
3728
+ const BYTES_PER_PIXEL = 4;
3729
+ class GlTextureSystem {
3730
+ constructor(renderer) {
3731
+ this.managedTextures = [];
3732
+ this._glTextures = /* @__PURE__ */ Object.create(null);
3733
+ this._glSamplers = /* @__PURE__ */ Object.create(null);
3734
+ this._boundTextures = [];
3735
+ this._activeTextureLocation = -1;
3736
+ this._boundSamplers = /* @__PURE__ */ Object.create(null);
3737
+ this._uploads = {
3738
+ image: glUploadImageResource,
3739
+ buffer: glUploadBufferImageResource,
3740
+ video: glUploadVideoResource,
3741
+ compressed: glUploadCompressedTextureResource
3742
+ };
3743
+ // TODO - separate samplers will be a cool thing to add, but not right now!
3744
+ this._useSeparateSamplers = false;
3745
+ this._renderer = renderer;
3746
+ this._renderer.renderableGC.addManagedHash(this, "_glTextures");
3747
+ this._renderer.renderableGC.addManagedHash(this, "_glSamplers");
3748
+ }
3749
+ contextChange(gl) {
3750
+ this._gl = gl;
3751
+ if (!this._mapFormatToInternalFormat) {
3752
+ this._mapFormatToInternalFormat = mapFormatToGlInternalFormat(gl, this._renderer.context.extensions);
3753
+ this._mapFormatToType = mapFormatToGlType(gl);
3754
+ this._mapFormatToFormat = mapFormatToGlFormat(gl);
3755
+ }
3756
+ this._glTextures = /* @__PURE__ */ Object.create(null);
3757
+ this._glSamplers = /* @__PURE__ */ Object.create(null);
3758
+ this._boundSamplers = /* @__PURE__ */ Object.create(null);
3759
+ for (let i = 0; i < 16; i++) {
3760
+ this.bind(Texture.Texture.EMPTY, i);
3761
+ }
3762
+ }
3763
+ initSource(source) {
3764
+ this.bind(source);
3765
+ }
3766
+ bind(texture, location = 0) {
3767
+ const source = texture.source;
3768
+ if (texture) {
3769
+ this.bindSource(source, location);
3770
+ if (this._useSeparateSamplers) {
3771
+ this._bindSampler(source.style, location);
3772
+ }
3773
+ } else {
3774
+ this.bindSource(null, location);
3775
+ if (this._useSeparateSamplers) {
3776
+ this._bindSampler(null, location);
3777
+ }
3778
+ }
3779
+ }
3780
+ bindSource(source, location = 0) {
3781
+ const gl = this._gl;
3782
+ source._touched = this._renderer.textureGC.count;
3783
+ if (this._boundTextures[location] !== source) {
3784
+ this._boundTextures[location] = source;
3785
+ this._activateLocation(location);
3786
+ source || (source = Texture.Texture.EMPTY.source);
3787
+ const glTexture = this.getGlSource(source);
3788
+ gl.bindTexture(glTexture.target, glTexture.texture);
3789
+ }
3790
+ }
3791
+ _bindSampler(style, location = 0) {
3792
+ const gl = this._gl;
3793
+ if (!style) {
3794
+ this._boundSamplers[location] = null;
3795
+ gl.bindSampler(location, null);
3796
+ return;
3797
+ }
3798
+ const sampler = this._getGlSampler(style);
3799
+ if (this._boundSamplers[location] !== sampler) {
3800
+ this._boundSamplers[location] = sampler;
3801
+ gl.bindSampler(location, sampler);
3802
+ }
3803
+ }
3804
+ unbind(texture) {
3805
+ const source = texture.source;
3806
+ const boundTextures = this._boundTextures;
3807
+ const gl = this._gl;
3808
+ for (let i = 0; i < boundTextures.length; i++) {
3809
+ if (boundTextures[i] === source) {
3810
+ this._activateLocation(i);
3811
+ const glTexture = this.getGlSource(source);
3812
+ gl.bindTexture(glTexture.target, null);
3813
+ boundTextures[i] = null;
3814
+ }
3815
+ }
3816
+ }
3817
+ _activateLocation(location) {
3818
+ if (this._activeTextureLocation !== location) {
3819
+ this._activeTextureLocation = location;
3820
+ this._gl.activeTexture(this._gl.TEXTURE0 + location);
3821
+ }
3822
+ }
3823
+ _initSource(source) {
3824
+ const gl = this._gl;
3825
+ const glTexture = new GlTexture(gl.createTexture());
3826
+ glTexture.type = this._mapFormatToType[source.format];
3827
+ glTexture.internalFormat = this._mapFormatToInternalFormat[source.format];
3828
+ glTexture.format = this._mapFormatToFormat[source.format];
3829
+ if (source.autoGenerateMipmaps && (this._renderer.context.supports.nonPowOf2mipmaps || source.isPowerOfTwo)) {
3830
+ const biggestDimension = Math.max(source.width, source.height);
3831
+ source.mipLevelCount = Math.floor(Math.log2(biggestDimension)) + 1;
3832
+ }
3833
+ this._glTextures[source.uid] = glTexture;
3834
+ if (!this.managedTextures.includes(source)) {
3835
+ source.on("update", this.onSourceUpdate, this);
3836
+ source.on("resize", this.onSourceUpdate, this);
3837
+ source.on("styleChange", this.onStyleChange, this);
3838
+ source.on("destroy", this.onSourceDestroy, this);
3839
+ source.on("unload", this.onSourceUnload, this);
3840
+ source.on("updateMipmaps", this.onUpdateMipmaps, this);
3841
+ this.managedTextures.push(source);
3842
+ }
3843
+ this.onSourceUpdate(source);
3844
+ this.updateStyle(source, false);
3845
+ return glTexture;
3846
+ }
3847
+ onStyleChange(source) {
3848
+ this.updateStyle(source, false);
3849
+ }
3850
+ updateStyle(source, firstCreation) {
3851
+ const gl = this._gl;
3852
+ const glTexture = this.getGlSource(source);
3853
+ gl.bindTexture(gl.TEXTURE_2D, glTexture.texture);
3854
+ this._boundTextures[this._activeTextureLocation] = source;
3855
+ applyStyleParams(
3856
+ source.style,
3857
+ gl,
3858
+ source.mipLevelCount > 1,
3859
+ this._renderer.context.extensions.anisotropicFiltering,
3860
+ "texParameteri",
3861
+ gl.TEXTURE_2D,
3862
+ // will force a clamp to edge if the texture is not a power of two
3863
+ !this._renderer.context.supports.nonPowOf2wrapping && !source.isPowerOfTwo,
3864
+ firstCreation
3865
+ );
3866
+ }
3867
+ onSourceUnload(source) {
3868
+ const glTexture = this._glTextures[source.uid];
3869
+ if (!glTexture)
3870
+ return;
3871
+ this.unbind(source);
3872
+ this._glTextures[source.uid] = null;
3873
+ this._gl.deleteTexture(glTexture.texture);
3874
+ }
3875
+ onSourceUpdate(source) {
3876
+ const gl = this._gl;
3877
+ const glTexture = this.getGlSource(source);
3878
+ gl.bindTexture(gl.TEXTURE_2D, glTexture.texture);
3879
+ this._boundTextures[this._activeTextureLocation] = source;
3880
+ if (this._uploads[source.uploadMethodId]) {
3881
+ this._uploads[source.uploadMethodId].upload(source, glTexture, gl, this._renderer.context.webGLVersion);
3882
+ } else {
3883
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, source.pixelWidth, source.pixelHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
3884
+ }
3885
+ if (source.autoGenerateMipmaps && source.mipLevelCount > 1) {
3886
+ this.onUpdateMipmaps(source, false);
3887
+ }
3888
+ }
3889
+ onUpdateMipmaps(source, bind = true) {
3890
+ if (bind)
3891
+ this.bindSource(source, 0);
3892
+ const glTexture = this.getGlSource(source);
3893
+ this._gl.generateMipmap(glTexture.target);
3894
+ }
3895
+ onSourceDestroy(source) {
3896
+ source.off("destroy", this.onSourceDestroy, this);
3897
+ source.off("update", this.onSourceUpdate, this);
3898
+ source.off("resize", this.onSourceUpdate, this);
3899
+ source.off("unload", this.onSourceUnload, this);
3900
+ source.off("styleChange", this.onStyleChange, this);
3901
+ source.off("updateMipmaps", this.onUpdateMipmaps, this);
3902
+ this.managedTextures.splice(this.managedTextures.indexOf(source), 1);
3903
+ this.onSourceUnload(source);
3904
+ }
3905
+ _initSampler(style) {
3906
+ const gl = this._gl;
3907
+ const glSampler = this._gl.createSampler();
3908
+ this._glSamplers[style._resourceId] = glSampler;
3909
+ applyStyleParams(
3910
+ style,
3911
+ gl,
3912
+ this._boundTextures[this._activeTextureLocation].mipLevelCount > 1,
3913
+ this._renderer.context.extensions.anisotropicFiltering,
3914
+ "samplerParameteri",
3915
+ glSampler,
3916
+ false,
3917
+ true
3918
+ );
3919
+ return this._glSamplers[style._resourceId];
3920
+ }
3921
+ _getGlSampler(sampler) {
3922
+ return this._glSamplers[sampler._resourceId] || this._initSampler(sampler);
3923
+ }
3924
+ getGlSource(source) {
3925
+ return this._glTextures[source.uid] || this._initSource(source);
3926
+ }
3927
+ generateCanvas(texture) {
3928
+ const { pixels, width, height } = this.getPixels(texture);
3929
+ const canvas = adapter.DOMAdapter.get().createCanvas();
3930
+ canvas.width = width;
3931
+ canvas.height = height;
3932
+ const ctx = canvas.getContext("2d");
3933
+ if (ctx) {
3934
+ const imageData = ctx.createImageData(width, height);
3935
+ imageData.data.set(pixels);
3936
+ ctx.putImageData(imageData, 0, 0);
3937
+ }
3938
+ return canvas;
3939
+ }
3940
+ getPixels(texture) {
3941
+ const resolution = texture.source.resolution;
3942
+ const frame = texture.frame;
3943
+ const width = Math.max(Math.round(frame.width * resolution), 1);
3944
+ const height = Math.max(Math.round(frame.height * resolution), 1);
3945
+ const pixels = new Uint8Array(BYTES_PER_PIXEL * width * height);
3946
+ const renderer = this._renderer;
3947
+ const renderTarget = renderer.renderTarget.getRenderTarget(texture);
3948
+ const glRenterTarget = renderer.renderTarget.getGpuRenderTarget(renderTarget);
3949
+ const gl = renderer.gl;
3950
+ gl.bindFramebuffer(gl.FRAMEBUFFER, glRenterTarget.resolveTargetFramebuffer);
3951
+ gl.readPixels(
3952
+ Math.round(frame.x * resolution),
3953
+ Math.round(frame.y * resolution),
3954
+ width,
3955
+ height,
3956
+ gl.RGBA,
3957
+ gl.UNSIGNED_BYTE,
3958
+ pixels
3959
+ );
3960
+ if (false) {}
3961
+ return { pixels: new Uint8ClampedArray(pixels.buffer), width, height };
3962
+ }
3963
+ destroy() {
3964
+ this.managedTextures.slice().forEach((source) => this.onSourceDestroy(source));
3965
+ this.managedTextures = null;
3966
+ this._renderer = null;
3967
+ }
3968
+ }
3969
+ /** @ignore */
3970
+ GlTextureSystem.extension = {
3971
+ type: [
3972
+ Extensions.ExtensionType.WebGLSystem
3973
+ ],
3974
+ name: "texture"
3975
+ };
3976
+
3977
+
3978
+ //# sourceMappingURL=GlTextureSystem.mjs.map
3979
+
3980
+ ;// ./node_modules/pixi.js/lib/rendering/renderers/gl/WebGLRenderer.mjs
3981
+
3982
+
3983
+
3984
+
3985
+
3986
+
3987
+
3988
+
3989
+
3990
+
3991
+
3992
+
3993
+
3994
+
3995
+
3996
+
3997
+
3998
+
3999
+
4000
+
4001
+
4002
+ "use strict";
4003
+ const DefaultWebGLSystems = [
4004
+ ...SharedSystems.SharedSystems,
4005
+ GlUboSystem,
4006
+ GlBackBufferSystem,
4007
+ GlContextSystem,
4008
+ GlBufferSystem,
4009
+ GlTextureSystem,
4010
+ GlRenderTargetSystem,
4011
+ GlGeometrySystem,
4012
+ GlUniformGroupSystem,
4013
+ GlShaderSystem,
4014
+ GlEncoderSystem,
4015
+ GlStateSystem,
4016
+ GlStencilSystem,
4017
+ GlColorMaskSystem
4018
+ ];
4019
+ const DefaultWebGLPipes = [...SharedSystems.SharedRenderPipes];
4020
+ const DefaultWebGLAdapters = [GlBatchAdaptor, GlMeshAdaptor, GlGraphicsAdaptor];
4021
+ const systems = [];
4022
+ const renderPipes = [];
4023
+ const renderPipeAdaptors = [];
4024
+ Extensions.extensions.handleByNamedList(Extensions.ExtensionType.WebGLSystem, systems);
4025
+ Extensions.extensions.handleByNamedList(Extensions.ExtensionType.WebGLPipes, renderPipes);
4026
+ Extensions.extensions.handleByNamedList(Extensions.ExtensionType.WebGLPipesAdaptor, renderPipeAdaptors);
4027
+ Extensions.extensions.add(...DefaultWebGLSystems, ...DefaultWebGLPipes, ...DefaultWebGLAdapters);
4028
+ class WebGLRenderer extends AbstractRenderer.AbstractRenderer {
4029
+ constructor() {
4030
+ const systemConfig = {
4031
+ name: "webgl",
4032
+ type: types.RendererType.WEBGL,
4033
+ systems,
4034
+ renderPipes,
4035
+ renderPipeAdaptors
4036
+ };
4037
+ super(systemConfig);
4038
+ }
4039
+ }
4040
+
4041
+
4042
+ //# sourceMappingURL=WebGLRenderer.mjs.map
4043
+
4044
+
4045
+ /***/ })
4046
+
4047
+ };