holostaff-widget 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CanvasRenderer-Cnd4gbWc.js → CanvasRenderer-J_XwG2_5.js} +50 -50
- package/dist/{CanvasRenderer-Cnd4gbWc.js.map → CanvasRenderer-J_XwG2_5.js.map} +1 -1
- package/dist/Filter-GqToX76B.js +670 -0
- package/dist/Filter-GqToX76B.js.map +1 -0
- package/dist/GpuStencilModesToPixi-Cc8Nerk4.js +222 -0
- package/dist/GpuStencilModesToPixi-Cc8Nerk4.js.map +1 -0
- package/dist/{RenderTargetSystem-oYKzpCzn.js → RenderTargetSystem-Bl4mRBf3.js} +327 -391
- package/dist/RenderTargetSystem-Bl4mRBf3.js.map +1 -0
- package/dist/WebGLRenderer-BtNMOOvs.js +2237 -0
- package/dist/WebGLRenderer-BtNMOOvs.js.map +1 -0
- package/dist/{WebGPURenderer-CwI3VE9f.js → WebGPURenderer-89fMKfXn.js} +281 -374
- package/dist/WebGPURenderer-89fMKfXn.js.map +1 -0
- package/dist/{browserAll-DrS3vkVd.js → browserAll-B7LFPR0f.js} +3 -3
- package/dist/{browserAll-DrS3vkVd.js.map → browserAll-B7LFPR0f.js.map} +1 -1
- package/dist/{getTextureBatchBindGroup-C0vQRfwn.js → getTextureBatchBindGroup-CMmHwizJ.js} +3 -3
- package/dist/{getTextureBatchBindGroup-C0vQRfwn.js.map → getTextureBatchBindGroup-CMmHwizJ.js.map} +1 -1
- package/dist/hs-widget.es.js +2 -2
- package/dist/hs-widget.umd.js +360 -346
- package/dist/hs-widget.umd.js.map +1 -1
- package/dist/{index-B7aJuEyO.js → index-BpOQ7Z5z.js} +11185 -9093
- package/dist/index-BpOQ7Z5z.js.map +1 -0
- package/dist/{webworkerAll-BNR1nfRY.js → webworkerAll-CAG5YOrW.js} +12 -12
- package/dist/{webworkerAll-BNR1nfRY.js.map → webworkerAll-CAG5YOrW.js.map} +1 -1
- package/package.json +1 -1
- package/dist/BufferResource-BsetVigd.js +0 -537
- package/dist/BufferResource-BsetVigd.js.map +0 -1
- package/dist/Geometry-C_hP7eDY.js +0 -1017
- package/dist/Geometry-C_hP7eDY.js.map +0 -1
- package/dist/RenderTargetSystem-oYKzpCzn.js.map +0 -1
- package/dist/WebGLRenderer-CnlX2m2i.js +0 -2939
- package/dist/WebGLRenderer-CnlX2m2i.js.map +0 -1
- package/dist/WebGPURenderer-CwI3VE9f.js.map +0 -1
- package/dist/index-B7aJuEyO.js.map +0 -1
|
@@ -1,69 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
class ve {
|
|
4
|
-
constructor(e) {
|
|
5
|
-
typeof e == "number" ? this.rawBinaryData = new ArrayBuffer(e) : e instanceof Uint8Array ? this.rawBinaryData = e.buffer : this.rawBinaryData = e, this.uint32View = new Uint32Array(this.rawBinaryData), this.float32View = new Float32Array(this.rawBinaryData), this.size = this.rawBinaryData.byteLength;
|
|
6
|
-
}
|
|
7
|
-
/** View on the raw binary data as a `Int8Array`. */
|
|
8
|
-
get int8View() {
|
|
9
|
-
return this._int8View || (this._int8View = new Int8Array(this.rawBinaryData)), this._int8View;
|
|
10
|
-
}
|
|
11
|
-
/** View on the raw binary data as a `Uint8Array`. */
|
|
12
|
-
get uint8View() {
|
|
13
|
-
return this._uint8View || (this._uint8View = new Uint8Array(this.rawBinaryData)), this._uint8View;
|
|
14
|
-
}
|
|
15
|
-
/** View on the raw binary data as a `Int16Array`. */
|
|
16
|
-
get int16View() {
|
|
17
|
-
return this._int16View || (this._int16View = new Int16Array(this.rawBinaryData)), this._int16View;
|
|
18
|
-
}
|
|
19
|
-
/** View on the raw binary data as a `Int32Array`. */
|
|
20
|
-
get int32View() {
|
|
21
|
-
return this._int32View || (this._int32View = new Int32Array(this.rawBinaryData)), this._int32View;
|
|
22
|
-
}
|
|
23
|
-
/** View on the raw binary data as a `Float64Array`. */
|
|
24
|
-
get float64View() {
|
|
25
|
-
return this._float64Array || (this._float64Array = new Float64Array(this.rawBinaryData)), this._float64Array;
|
|
26
|
-
}
|
|
27
|
-
/** View on the raw binary data as a `BigUint64Array`. */
|
|
28
|
-
get bigUint64View() {
|
|
29
|
-
return this._bigUint64Array || (this._bigUint64Array = new BigUint64Array(this.rawBinaryData)), this._bigUint64Array;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns the view of the given type.
|
|
33
|
-
* @param type - One of `int8`, `uint8`, `int16`,
|
|
34
|
-
* `uint16`, `int32`, `uint32`, and `float32`.
|
|
35
|
-
* @returns - typed array of given type
|
|
36
|
-
*/
|
|
37
|
-
view(e) {
|
|
38
|
-
return this[`${e}View`];
|
|
39
|
-
}
|
|
40
|
-
/** Destroys all buffer references. Do not use after calling this. */
|
|
41
|
-
destroy() {
|
|
42
|
-
this.rawBinaryData = null, this.uint32View = null, this.float32View = null, this.uint16View = null, this._int8View = null, this._uint8View = null, this._int16View = null, this._int32View = null, this._float64Array = null, this._bigUint64Array = null;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns the size of the given type in bytes.
|
|
46
|
-
* @param type - One of `int8`, `uint8`, `int16`,
|
|
47
|
-
* `uint16`, `int32`, `uint32`, and `float32`.
|
|
48
|
-
* @returns - size of the type in bytes
|
|
49
|
-
*/
|
|
50
|
-
static sizeOf(e) {
|
|
51
|
-
switch (e) {
|
|
52
|
-
case "int8":
|
|
53
|
-
case "uint8":
|
|
54
|
-
return 1;
|
|
55
|
-
case "int16":
|
|
56
|
-
case "uint16":
|
|
57
|
-
return 2;
|
|
58
|
-
case "int32":
|
|
59
|
-
case "uint32":
|
|
60
|
-
case "float32":
|
|
61
|
-
return 4;
|
|
62
|
-
default:
|
|
63
|
-
throw new Error(`${e} isn't a valid view type`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
import { u as ze, s as T, V as xe, G as He, m as Ct, f as ge, B as z, w as te, d as re, E as u, t as St, M as R, e as se, v as F, x as kt, y as ne, z as U, F as Fe, S as Mt, T as S, i as Q, H as _e, I as Le, J as Oe, K as We, L as Ve, C as L, N as Rt, O as Y, D as ae, k as I, R as O, Q as Bt, P as Pt, a as be, W as ve, j as X, X as wt, Y as Gt, Z as At } from "./index-BpOQ7Z5z.js";
|
|
2
|
+
import { g as Ut, G as $e, b as je, a as It, F as Et, S as Dt, R as ie, B as zt } from "./Filter-GqToX76B.js";
|
|
67
3
|
function ye(n, e, t, r) {
|
|
68
4
|
if (t ?? (t = 0), r ?? (r = Math.min(n.byteLength - t, e.byteLength)), !(t & 7) && !(r & 7)) {
|
|
69
5
|
const s = r / 8;
|
|
@@ -83,7 +19,7 @@ var k = /* @__PURE__ */ ((n) => (n[n.DISABLED = 0] = "DISABLED", n[n.RENDERING_M
|
|
|
83
19
|
function Te(n, e) {
|
|
84
20
|
return e.alphaMode === "no-premultiply-alpha" && Ht[n] || n;
|
|
85
21
|
}
|
|
86
|
-
const
|
|
22
|
+
const Ft = [
|
|
87
23
|
"precision mediump float;",
|
|
88
24
|
"void main(void){",
|
|
89
25
|
"float test = 0.1;",
|
|
@@ -92,20 +28,20 @@ const Vt = [
|
|
|
92
28
|
"}"
|
|
93
29
|
].join(`
|
|
94
30
|
`);
|
|
95
|
-
function
|
|
31
|
+
function Lt(n) {
|
|
96
32
|
let e = "";
|
|
97
33
|
for (let t = 0; t < n; ++t)
|
|
98
34
|
t > 0 && (e += `
|
|
99
35
|
else `), t < n - 1 && (e += `if(test == ${t}.0){}`);
|
|
100
36
|
return e;
|
|
101
37
|
}
|
|
102
|
-
function
|
|
38
|
+
function Ot(n, e) {
|
|
103
39
|
if (n === 0)
|
|
104
40
|
throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");
|
|
105
41
|
const t = e.createShader(e.FRAGMENT_SHADER);
|
|
106
42
|
try {
|
|
107
43
|
for (; ; ) {
|
|
108
|
-
const r =
|
|
44
|
+
const r = Ft.replace(/%forloop%/gi, Lt(n));
|
|
109
45
|
if (e.shaderSource(t, r), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS))
|
|
110
46
|
n = n / 2 | 0;
|
|
111
47
|
else
|
|
@@ -116,17 +52,17 @@ function Lt(n, e) {
|
|
|
116
52
|
}
|
|
117
53
|
return n;
|
|
118
54
|
}
|
|
119
|
-
let
|
|
55
|
+
let P = null;
|
|
120
56
|
function Wt() {
|
|
121
57
|
var e;
|
|
122
|
-
if (
|
|
58
|
+
if (P) return P;
|
|
123
59
|
const n = Ut();
|
|
124
|
-
return
|
|
125
|
-
|
|
60
|
+
return P = n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS), P = Ot(
|
|
61
|
+
P,
|
|
126
62
|
n
|
|
127
|
-
), (e = n.getExtension("WEBGL_lose_context")) == null || e.loseContext(),
|
|
63
|
+
), (e = n.getExtension("WEBGL_lose_context")) == null || e.loseContext(), P;
|
|
128
64
|
}
|
|
129
|
-
class
|
|
65
|
+
class Vt {
|
|
130
66
|
constructor() {
|
|
131
67
|
this.ids = /* @__PURE__ */ Object.create(null), this.textures = [], this.count = 0;
|
|
132
68
|
}
|
|
@@ -141,34 +77,34 @@ class Ot {
|
|
|
141
77
|
}
|
|
142
78
|
class $t {
|
|
143
79
|
constructor() {
|
|
144
|
-
this.renderPipeId = "batch", this.action = "startBatch", this.start = 0, this.size = 0, this.textures = new
|
|
80
|
+
this.renderPipeId = "batch", this.action = "startBatch", this.start = 0, this.size = 0, this.textures = new Vt(), this.blendMode = "normal", this.topology = "triangle-strip", this.canBundle = !0;
|
|
145
81
|
}
|
|
146
82
|
destroy() {
|
|
147
83
|
this.textures = null, this.gpuBindGroup = null, this.bindGroup = null, this.batcher = null, this.elements = null;
|
|
148
84
|
}
|
|
149
85
|
}
|
|
150
|
-
const
|
|
86
|
+
const E = [];
|
|
151
87
|
let W = 0;
|
|
152
88
|
He.register({
|
|
153
89
|
clear: () => {
|
|
154
|
-
if (
|
|
155
|
-
for (const n of
|
|
90
|
+
if (E.length > 0)
|
|
91
|
+
for (const n of E)
|
|
156
92
|
n && n.destroy();
|
|
157
|
-
|
|
93
|
+
E.length = 0, W = 0;
|
|
158
94
|
}
|
|
159
95
|
});
|
|
160
96
|
function Ce() {
|
|
161
|
-
return W > 0 ?
|
|
97
|
+
return W > 0 ? E[--W] : new $t();
|
|
162
98
|
}
|
|
163
99
|
function Se(n) {
|
|
164
|
-
n.elements = null,
|
|
100
|
+
n.elements = null, E[W++] = n;
|
|
165
101
|
}
|
|
166
|
-
let
|
|
102
|
+
let G = 0;
|
|
167
103
|
const Ne = class Ke {
|
|
168
104
|
constructor(e) {
|
|
169
105
|
this.uid = ze("batcher"), this.dirty = !0, this.batchIndex = 0, this.batches = [], this._elements = [], e = { ...Ke.defaultOptions, ...e }, e.maxTextures || (T("v8.8.0", "maxTextures is a required option for Batcher now, please pass it in the options"), e.maxTextures = Wt());
|
|
170
106
|
const { maxTextures: t, attributesInitialSize: r, indicesInitialSize: s } = e;
|
|
171
|
-
this.attributeBuffer = new
|
|
107
|
+
this.attributeBuffer = new xe(r * 4), this.indexBuffer = new Uint16Array(s), this.maxTextures = t;
|
|
172
108
|
}
|
|
173
109
|
begin() {
|
|
174
110
|
this.elementSize = 0, this.elementStart = 0, this.indexSize = 0, this.attributeSize = 0;
|
|
@@ -210,8 +146,8 @@ const Ne = class Ke {
|
|
|
210
146
|
if (!t[this.elementStart]) return;
|
|
211
147
|
let r = Ce(), s = r.textures;
|
|
212
148
|
s.clear();
|
|
213
|
-
const
|
|
214
|
-
let
|
|
149
|
+
const a = t[this.elementStart];
|
|
150
|
+
let i = Te(a.blendMode, a.texture._source), o = a.topology;
|
|
215
151
|
this.attributeSize * 4 > this.attributeBuffer.size && this._resizeAttributeBuffer(this.attributeSize * 4), this.indexSize > this.indexBuffer.length && this._resizeIndexBuffer(this.indexSize);
|
|
216
152
|
const l = this.attributeBuffer.float32View, d = this.attributeBuffer.uint32View, f = this.indexBuffer;
|
|
217
153
|
let c = this._batchIndexSize, x = this._batchIndexStart, g = "startBatch", m = [];
|
|
@@ -219,8 +155,8 @@ const Ne = class Ke {
|
|
|
219
155
|
for (let _ = this.elementStart; _ < this.elementSize; ++_) {
|
|
220
156
|
const h = t[_];
|
|
221
157
|
t[_] = null;
|
|
222
|
-
const p = h.texture._source, y = Te(h.blendMode, p), b =
|
|
223
|
-
if (p._batchTick ===
|
|
158
|
+
const p = h.texture._source, y = Te(h.blendMode, p), b = i !== y || o !== h.topology;
|
|
159
|
+
if (p._batchTick === G && !b) {
|
|
224
160
|
h._textureId = p._textureBindLocation, c += h.indexSize, h.packAsQuad ? (this.packQuadAttributes(
|
|
225
161
|
h,
|
|
226
162
|
l,
|
|
@@ -245,17 +181,17 @@ const Ne = class Ke {
|
|
|
245
181
|
)), h._batch = r, m.push(h);
|
|
246
182
|
continue;
|
|
247
183
|
}
|
|
248
|
-
p._batchTick =
|
|
184
|
+
p._batchTick = G, (s.count >= v || b) && (this._finishBatch(
|
|
249
185
|
r,
|
|
250
186
|
x,
|
|
251
187
|
c - x,
|
|
252
188
|
s,
|
|
253
|
-
|
|
189
|
+
i,
|
|
254
190
|
o,
|
|
255
191
|
e,
|
|
256
192
|
g,
|
|
257
193
|
m
|
|
258
|
-
), g = "renderBatch", x = c,
|
|
194
|
+
), g = "renderBatch", x = c, i = y, o = h.topology, r = Ce(), s = r.textures, s.clear(), m = [], ++G), h._textureId = p._textureBindLocation = s.count, s.ids[p.uid] = s.count, s.textures[s.count++] = p, h._batch = r, m.push(h), c += h.indexSize, h.packAsQuad ? (this.packQuadAttributes(
|
|
259
195
|
h,
|
|
260
196
|
l,
|
|
261
197
|
d,
|
|
@@ -283,15 +219,15 @@ const Ne = class Ke {
|
|
|
283
219
|
x,
|
|
284
220
|
c - x,
|
|
285
221
|
s,
|
|
286
|
-
|
|
222
|
+
i,
|
|
287
223
|
o,
|
|
288
224
|
e,
|
|
289
225
|
g,
|
|
290
226
|
m
|
|
291
|
-
), x = c, ++
|
|
227
|
+
), x = c, ++G), this.elementStart = this.elementSize, this._batchIndexStart = x, this._batchIndexSize = c;
|
|
292
228
|
}
|
|
293
|
-
_finishBatch(e, t, r, s,
|
|
294
|
-
e.gpuBindGroup = null, e.bindGroup = null, e.action = l, e.batcher = this, e.textures = s, e.blendMode =
|
|
229
|
+
_finishBatch(e, t, r, s, a, i, o, l, d) {
|
|
230
|
+
e.gpuBindGroup = null, e.bindGroup = null, e.action = l, e.batcher = this, e.textures = s, e.blendMode = a, e.topology = i, e.start = t, e.size = r, e.elements = d, ++G, this.batches[this.batchIndex++] = e, o.add(e);
|
|
295
231
|
}
|
|
296
232
|
finish(e) {
|
|
297
233
|
this.break(e);
|
|
@@ -311,7 +247,7 @@ const Ne = class Ke {
|
|
|
311
247
|
e <= this.indexBuffer.length || this._resizeIndexBuffer(e);
|
|
312
248
|
}
|
|
313
249
|
_resizeAttributeBuffer(e) {
|
|
314
|
-
const t = Math.max(e, this.attributeBuffer.size * 2), r = new
|
|
250
|
+
const t = Math.max(e, this.attributeBuffer.size * 2), r = new xe(t);
|
|
315
251
|
ye(this.attributeBuffer.rawBinaryData, r.rawBinaryData), this.attributeBuffer = r;
|
|
316
252
|
}
|
|
317
253
|
_resizeIndexBuffer(e) {
|
|
@@ -320,8 +256,8 @@ const Ne = class Ke {
|
|
|
320
256
|
r += r % 2;
|
|
321
257
|
const s = r > 65535 ? new Uint32Array(r) : new Uint16Array(r);
|
|
322
258
|
if (s.BYTES_PER_ELEMENT !== t.BYTES_PER_ELEMENT)
|
|
323
|
-
for (let
|
|
324
|
-
s[
|
|
259
|
+
for (let a = 0; a < t.length; a++)
|
|
260
|
+
s[a] = t[a];
|
|
325
261
|
else
|
|
326
262
|
ye(t.buffer, s.buffer);
|
|
327
263
|
this.indexBuffer = s;
|
|
@@ -330,9 +266,9 @@ const Ne = class Ke {
|
|
|
330
266
|
e[t] = r + 0, e[t + 1] = r + 1, e[t + 2] = r + 2, e[t + 3] = r + 0, e[t + 4] = r + 2, e[t + 5] = r + 3;
|
|
331
267
|
}
|
|
332
268
|
packIndex(e, t, r, s) {
|
|
333
|
-
const
|
|
334
|
-
for (let d = 0; d <
|
|
335
|
-
t[r++] = s +
|
|
269
|
+
const a = e.indices, i = e.indexSize, o = e.indexOffset, l = e.attributeOffset;
|
|
270
|
+
for (let d = 0; d < i; d++)
|
|
271
|
+
t[r++] = s + a[d + o] - l;
|
|
336
272
|
}
|
|
337
273
|
/**
|
|
338
274
|
* Destroys the batch and its resources.
|
|
@@ -358,14 +294,14 @@ Ne.defaultOptions = {
|
|
|
358
294
|
};
|
|
359
295
|
let jt = Ne;
|
|
360
296
|
const Nt = new Float32Array(1), Kt = new Uint32Array(1);
|
|
361
|
-
class qt extends
|
|
297
|
+
class qt extends Ct {
|
|
362
298
|
constructor() {
|
|
363
|
-
const t = new
|
|
299
|
+
const t = new ge({
|
|
364
300
|
data: Nt,
|
|
365
301
|
label: "attribute-batch-buffer",
|
|
366
302
|
usage: z.VERTEX | z.COPY_DST,
|
|
367
303
|
shrinkToFit: !1
|
|
368
|
-
}), r = new
|
|
304
|
+
}), r = new ge({
|
|
369
305
|
data: Kt,
|
|
370
306
|
label: "index-batch-buffer",
|
|
371
307
|
usage: z.INDEX | z.COPY_DST,
|
|
@@ -406,23 +342,23 @@ class qt extends Gt {
|
|
|
406
342
|
function ke(n, e, t) {
|
|
407
343
|
if (n)
|
|
408
344
|
for (const r in n) {
|
|
409
|
-
const s = r.toLocaleLowerCase(),
|
|
410
|
-
if (
|
|
411
|
-
let
|
|
412
|
-
r === "header" && (
|
|
345
|
+
const s = r.toLocaleLowerCase(), a = e[s];
|
|
346
|
+
if (a) {
|
|
347
|
+
let i = n[r];
|
|
348
|
+
r === "header" && (i = i.replace(/@in\s+[^;]+;\s*/g, "").replace(/@out\s+[^;]+;\s*/g, "")), t && a.push(`//----${t}----//`), a.push(i);
|
|
413
349
|
} else
|
|
414
350
|
te(`${r} placement hook does not exist in shader`);
|
|
415
351
|
}
|
|
416
352
|
}
|
|
417
353
|
const Qt = /\{\{(.*?)\}\}/g;
|
|
418
|
-
function
|
|
354
|
+
function Me(n) {
|
|
419
355
|
var r;
|
|
420
356
|
const e = {};
|
|
421
357
|
return (((r = n.match(Qt)) == null ? void 0 : r.map((s) => s.replace(/[{()}]/g, ""))) ?? []).forEach((s) => {
|
|
422
358
|
e[s] = [];
|
|
423
359
|
}), e;
|
|
424
360
|
}
|
|
425
|
-
function
|
|
361
|
+
function Re(n, e) {
|
|
426
362
|
let t;
|
|
427
363
|
const r = /@in\s+([^;]+);/g;
|
|
428
364
|
for (; (t = r.exec(n)) !== null; )
|
|
@@ -430,19 +366,19 @@ function Me(n, e) {
|
|
|
430
366
|
}
|
|
431
367
|
function Be(n, e, t = !1) {
|
|
432
368
|
const r = [];
|
|
433
|
-
|
|
434
|
-
o.header &&
|
|
369
|
+
Re(e, r), n.forEach((o) => {
|
|
370
|
+
o.header && Re(o.header, r);
|
|
435
371
|
});
|
|
436
372
|
const s = r;
|
|
437
373
|
t && s.sort();
|
|
438
|
-
const
|
|
374
|
+
const a = s.map((o, l) => ` @location(${l}) ${o},`).join(`
|
|
439
375
|
`);
|
|
440
|
-
let
|
|
441
|
-
return
|
|
442
|
-
${
|
|
443
|
-
`),
|
|
376
|
+
let i = e.replace(/@in\s+[^;]+;\s*/g, "");
|
|
377
|
+
return i = i.replace("{{in}}", `
|
|
378
|
+
${a}
|
|
379
|
+
`), i;
|
|
444
380
|
}
|
|
445
|
-
function
|
|
381
|
+
function Pe(n, e) {
|
|
446
382
|
let t;
|
|
447
383
|
const r = /@out\s+([^;]+);/g;
|
|
448
384
|
for (; (t = r.exec(n)) !== null; )
|
|
@@ -458,25 +394,25 @@ function Xt(n) {
|
|
|
458
394
|
}
|
|
459
395
|
function Jt(n, e) {
|
|
460
396
|
const t = [];
|
|
461
|
-
|
|
462
|
-
l.header &&
|
|
397
|
+
Pe(e, t), n.forEach((l) => {
|
|
398
|
+
l.header && Pe(l.header, t);
|
|
463
399
|
});
|
|
464
400
|
let r = 0;
|
|
465
401
|
const s = t.sort().map((l) => l.indexOf("builtin") > -1 ? l : `@location(${r++}) ${l}`).join(`,
|
|
466
|
-
`),
|
|
467
|
-
`),
|
|
402
|
+
`), a = t.sort().map((l) => ` var ${Xt(l)};`).join(`
|
|
403
|
+
`), i = `return VSOutput(
|
|
468
404
|
${t.sort().map((l) => ` ${Yt(l)}`).join(`,
|
|
469
405
|
`)});`;
|
|
470
406
|
let o = e.replace(/@out\s+[^;]+;\s*/g, "");
|
|
471
407
|
return o = o.replace("{{struct}}", `
|
|
472
408
|
${s}
|
|
473
409
|
`), o = o.replace("{{start}}", `
|
|
474
|
-
${i}
|
|
475
|
-
`), o = o.replace("{{return}}", `
|
|
476
410
|
${a}
|
|
411
|
+
`), o = o.replace("{{return}}", `
|
|
412
|
+
${i}
|
|
477
413
|
`), o;
|
|
478
414
|
}
|
|
479
|
-
function
|
|
415
|
+
function we(n, e) {
|
|
480
416
|
let t = n;
|
|
481
417
|
for (const r in e) {
|
|
482
418
|
const s = e[r];
|
|
@@ -488,44 +424,44 @@ ${s.join(`
|
|
|
488
424
|
}
|
|
489
425
|
return t;
|
|
490
426
|
}
|
|
491
|
-
const
|
|
427
|
+
const M = /* @__PURE__ */ Object.create(null), j = /* @__PURE__ */ new Map();
|
|
492
428
|
let Zt = 0;
|
|
493
429
|
function er({
|
|
494
430
|
template: n,
|
|
495
431
|
bits: e
|
|
496
432
|
}) {
|
|
497
433
|
const t = qe(n, e);
|
|
498
|
-
if (
|
|
434
|
+
if (M[t]) return M[t];
|
|
499
435
|
const { vertex: r, fragment: s } = rr(n, e);
|
|
500
|
-
return
|
|
436
|
+
return M[t] = Qe(r, s, e), M[t];
|
|
501
437
|
}
|
|
502
438
|
function tr({
|
|
503
439
|
template: n,
|
|
504
440
|
bits: e
|
|
505
441
|
}) {
|
|
506
442
|
const t = qe(n, e);
|
|
507
|
-
return
|
|
443
|
+
return M[t] || (M[t] = Qe(n.vertex, n.fragment, e)), M[t];
|
|
508
444
|
}
|
|
509
445
|
function rr(n, e) {
|
|
510
|
-
const t = e.map((
|
|
446
|
+
const t = e.map((i) => i.vertex).filter((i) => !!i), r = e.map((i) => i.fragment).filter((i) => !!i);
|
|
511
447
|
let s = Be(t, n.vertex, !0);
|
|
512
448
|
s = Jt(t, s);
|
|
513
|
-
const
|
|
449
|
+
const a = Be(r, n.fragment, !0);
|
|
514
450
|
return {
|
|
515
451
|
vertex: s,
|
|
516
|
-
fragment:
|
|
452
|
+
fragment: a
|
|
517
453
|
};
|
|
518
454
|
}
|
|
519
455
|
function qe(n, e) {
|
|
520
456
|
return e.map((t) => (j.has(t) || j.set(t, Zt++), j.get(t))).sort((t, r) => t - r).join("-") + n.vertex + n.fragment;
|
|
521
457
|
}
|
|
522
458
|
function Qe(n, e, t) {
|
|
523
|
-
const r =
|
|
524
|
-
return t.forEach((
|
|
525
|
-
ke(
|
|
459
|
+
const r = Me(n), s = Me(e);
|
|
460
|
+
return t.forEach((a) => {
|
|
461
|
+
ke(a.vertex, r, a.name), ke(a.fragment, s, a.name);
|
|
526
462
|
}), {
|
|
527
|
-
vertex:
|
|
528
|
-
fragment:
|
|
463
|
+
vertex: we(n, r),
|
|
464
|
+
fragment: we(e, s)
|
|
529
465
|
};
|
|
530
466
|
}
|
|
531
467
|
const sr = (
|
|
@@ -601,7 +537,7 @@ const sr = (
|
|
|
601
537
|
return finalColor;
|
|
602
538
|
};
|
|
603
539
|
`
|
|
604
|
-
),
|
|
540
|
+
), ar = (
|
|
605
541
|
/* glsl */
|
|
606
542
|
`
|
|
607
543
|
in vec2 aPosition;
|
|
@@ -640,7 +576,7 @@ const sr = (
|
|
|
640
576
|
{{end}}
|
|
641
577
|
}
|
|
642
578
|
`
|
|
643
|
-
),
|
|
579
|
+
), ir = (
|
|
644
580
|
/* glsl */
|
|
645
581
|
`
|
|
646
582
|
|
|
@@ -723,8 +659,8 @@ function cr({ bits: n, name: e }) {
|
|
|
723
659
|
name: e,
|
|
724
660
|
...tr({
|
|
725
661
|
template: {
|
|
726
|
-
vertex:
|
|
727
|
-
fragment:
|
|
662
|
+
vertex: ar,
|
|
663
|
+
fragment: ir
|
|
728
664
|
},
|
|
729
665
|
bits: [
|
|
730
666
|
lr,
|
|
@@ -891,18 +827,18 @@ const _r = {
|
|
|
891
827
|
`
|
|
892
828
|
)
|
|
893
829
|
}
|
|
894
|
-
},
|
|
830
|
+
}, Ge = {};
|
|
895
831
|
function vr(n) {
|
|
896
|
-
let e =
|
|
832
|
+
let e = Ge[n];
|
|
897
833
|
if (e) return e;
|
|
898
834
|
const t = new Int32Array(n);
|
|
899
835
|
for (let r = 0; r < n; r++)
|
|
900
836
|
t[r] = r;
|
|
901
|
-
return e =
|
|
837
|
+
return e = Ge[n] = new re({
|
|
902
838
|
uTextures: { value: t, type: "i32", size: n }
|
|
903
839
|
}, { isStatic: !0 }), e;
|
|
904
840
|
}
|
|
905
|
-
class
|
|
841
|
+
class Ae extends It {
|
|
906
842
|
constructor(e) {
|
|
907
843
|
const t = cr({
|
|
908
844
|
name: "batch",
|
|
@@ -928,10 +864,10 @@ class Ue extends It {
|
|
|
928
864
|
}), this.maxTextures = e;
|
|
929
865
|
}
|
|
930
866
|
}
|
|
931
|
-
let
|
|
867
|
+
let A = null;
|
|
932
868
|
const Ye = class Xe extends jt {
|
|
933
869
|
constructor(e) {
|
|
934
|
-
super(e), this.geometry = new qt(), this.name = Xe.extension.name, this.vertexSize = 6,
|
|
870
|
+
super(e), this.geometry = new qt(), this.name = Xe.extension.name, this.vertexSize = 6, A ?? (A = new Ae(e.maxTextures)), this.shader = A;
|
|
935
871
|
}
|
|
936
872
|
/**
|
|
937
873
|
* Packs the attributes of a DefaultBatchableMeshElement into the provided views.
|
|
@@ -941,11 +877,11 @@ const Ye = class Xe extends jt {
|
|
|
941
877
|
* @param index - The starting index in the views.
|
|
942
878
|
* @param textureId - The texture ID to use.
|
|
943
879
|
*/
|
|
944
|
-
packAttributes(e, t, r, s,
|
|
945
|
-
const
|
|
880
|
+
packAttributes(e, t, r, s, a) {
|
|
881
|
+
const i = a << 16 | e.roundPixels & 65535, o = e.transform, l = o.a, d = o.b, f = o.c, c = o.d, x = o.tx, g = o.ty, { positions: m, uvs: v } = e, _ = e.color, h = e.attributeOffset, C = h + e.attributeSize;
|
|
946
882
|
for (let p = h; p < C; p++) {
|
|
947
883
|
const y = p * 2, b = m[y], B = m[y + 1];
|
|
948
|
-
t[s++] = l * b + f * B + x, t[s++] = c * B + d * b + g, t[s++] = v[y], t[s++] = v[y + 1], r[s++] = _, r[s++] =
|
|
884
|
+
t[s++] = l * b + f * B + x, t[s++] = c * B + d * b + g, t[s++] = v[y], t[s++] = v[y + 1], r[s++] = _, r[s++] = i;
|
|
949
885
|
}
|
|
950
886
|
}
|
|
951
887
|
/**
|
|
@@ -956,8 +892,8 @@ const Ye = class Xe extends jt {
|
|
|
956
892
|
* @param index - The starting index in the views.
|
|
957
893
|
* @param textureId - The texture ID to use.
|
|
958
894
|
*/
|
|
959
|
-
packQuadAttributes(e, t, r, s,
|
|
960
|
-
const
|
|
895
|
+
packQuadAttributes(e, t, r, s, a) {
|
|
896
|
+
const i = e.texture, o = e.transform, l = o.a, d = o.b, f = o.c, c = o.d, x = o.tx, g = o.ty, m = e.bounds, v = m.maxX, _ = m.minX, h = m.maxY, C = m.minY, p = i.uvs, y = e.color, b = a << 16 | e.roundPixels & 65535;
|
|
961
897
|
t[s + 0] = l * _ + f * C + x, t[s + 1] = c * C + d * _ + g, t[s + 2] = p.x0, t[s + 3] = p.y0, r[s + 4] = y, r[s + 5] = b, t[s + 6] = l * v + f * C + x, t[s + 7] = c * C + d * v + g, t[s + 8] = p.x1, t[s + 9] = p.y1, r[s + 10] = y, r[s + 11] = b, t[s + 12] = l * v + f * h + x, t[s + 13] = c * h + d * v + g, t[s + 14] = p.x2, t[s + 15] = p.y2, r[s + 16] = y, r[s + 17] = b, t[s + 18] = l * _ + f * h + x, t[s + 19] = c * h + d * _ + g, t[s + 20] = p.x3, t[s + 21] = p.y3, r[s + 22] = y, r[s + 23] = b;
|
|
962
898
|
}
|
|
963
899
|
/**
|
|
@@ -966,7 +902,7 @@ const Ye = class Xe extends jt {
|
|
|
966
902
|
* @internal
|
|
967
903
|
*/
|
|
968
904
|
_updateMaxTextures(e) {
|
|
969
|
-
this.shader.maxTextures !== e && (
|
|
905
|
+
this.shader.maxTextures !== e && (A = new Ae(e), this.shader = A);
|
|
970
906
|
}
|
|
971
907
|
destroy() {
|
|
972
908
|
this.shader = null, super.destroy();
|
|
@@ -982,8 +918,8 @@ let Je = Ye;
|
|
|
982
918
|
class qr {
|
|
983
919
|
constructor(e) {
|
|
984
920
|
this.items = /* @__PURE__ */ Object.create(null);
|
|
985
|
-
const { renderer: t, type: r, onUnload: s, priority:
|
|
986
|
-
this._renderer = t, t.gc.addResourceHash(this, "items", r,
|
|
921
|
+
const { renderer: t, type: r, onUnload: s, priority: a, name: i } = e;
|
|
922
|
+
this._renderer = t, t.gc.addResourceHash(this, "items", r, a ?? 0), this._onUnload = s, this.name = i;
|
|
987
923
|
}
|
|
988
924
|
/**
|
|
989
925
|
* Add an item to the hash. No-op if already added.
|
|
@@ -1077,7 +1013,7 @@ void main(void)
|
|
|
1077
1013
|
vTextureCoord = filterTextureCoord(aPosition);
|
|
1078
1014
|
vMaskCoord = getFilterCoord(aPosition);
|
|
1079
1015
|
}
|
|
1080
|
-
`,
|
|
1016
|
+
`, Ue = `struct GlobalFilterUniforms {
|
|
1081
1017
|
uInputSize:vec4<f32>,
|
|
1082
1018
|
uInputPixel:vec4<f32>,
|
|
1083
1019
|
uInputClamp:vec4<f32>,
|
|
@@ -1176,20 +1112,20 @@ fn mainFragment(
|
|
|
1176
1112
|
return source * a;
|
|
1177
1113
|
}
|
|
1178
1114
|
`;
|
|
1179
|
-
class Cr extends
|
|
1115
|
+
class Cr extends Et {
|
|
1180
1116
|
constructor(e) {
|
|
1181
|
-
const { sprite: t, ...r } = e, s = new
|
|
1182
|
-
uFilterMatrix: { value: new
|
|
1117
|
+
const { sprite: t, ...r } = e, s = new St(t.texture), a = new re({
|
|
1118
|
+
uFilterMatrix: { value: new R(), type: "mat3x3<f32>" },
|
|
1183
1119
|
uMaskClamp: { value: s.uClampFrame, type: "vec4<f32>" },
|
|
1184
1120
|
uAlpha: { value: 1, type: "f32" },
|
|
1185
1121
|
uInverse: { value: e.inverse ? 1 : 0, type: "f32" }
|
|
1186
|
-
}),
|
|
1122
|
+
}), i = je.from({
|
|
1187
1123
|
vertex: {
|
|
1188
|
-
source:
|
|
1124
|
+
source: Ue,
|
|
1189
1125
|
entryPoint: "mainVertex"
|
|
1190
1126
|
},
|
|
1191
1127
|
fragment: {
|
|
1192
|
-
source:
|
|
1128
|
+
source: Ue,
|
|
1193
1129
|
entryPoint: "mainFragment"
|
|
1194
1130
|
}
|
|
1195
1131
|
}), o = $e.from({
|
|
@@ -1199,11 +1135,11 @@ class Cr extends Dt {
|
|
|
1199
1135
|
});
|
|
1200
1136
|
super({
|
|
1201
1137
|
...r,
|
|
1202
|
-
gpuProgram:
|
|
1138
|
+
gpuProgram: i,
|
|
1203
1139
|
glProgram: o,
|
|
1204
1140
|
clipToViewport: !1,
|
|
1205
1141
|
resources: {
|
|
1206
|
-
filterUniforms:
|
|
1142
|
+
filterUniforms: a,
|
|
1207
1143
|
uMaskTexture: t.texture.source
|
|
1208
1144
|
}
|
|
1209
1145
|
}), this.sprite = t, this._textureMatrix = s;
|
|
@@ -1245,7 +1181,7 @@ class Ze {
|
|
|
1245
1181
|
const oe = class et {
|
|
1246
1182
|
constructor(e, t) {
|
|
1247
1183
|
var r, s;
|
|
1248
|
-
this.state =
|
|
1184
|
+
this.state = Dt.for2d(), this._batchersByInstructionSet = /* @__PURE__ */ Object.create(null), this._activeBatches = /* @__PURE__ */ Object.create(null), this.renderer = e, this._adaptor = t, (s = (r = this._adaptor).init) == null || s.call(r, this);
|
|
1249
1185
|
}
|
|
1250
1186
|
static getBatcher(e) {
|
|
1251
1187
|
return new this._availableBatchers[e]();
|
|
@@ -1273,15 +1209,15 @@ const oe = class et {
|
|
|
1273
1209
|
this._activeBatch.break(e);
|
|
1274
1210
|
const t = this._activeBatches;
|
|
1275
1211
|
for (const r in t) {
|
|
1276
|
-
const s = t[r],
|
|
1277
|
-
|
|
1212
|
+
const s = t[r], a = s.geometry;
|
|
1213
|
+
a.indexBuffer.setDataWithSize(s.indexBuffer, s.indexSize, !0), a.buffers[0].setDataWithSize(s.attributeBuffer.float32View, s.attributeSize, !1);
|
|
1278
1214
|
}
|
|
1279
1215
|
}
|
|
1280
1216
|
upload(e) {
|
|
1281
1217
|
const t = this._batchersByInstructionSet[e.uid];
|
|
1282
1218
|
for (const r in t) {
|
|
1283
|
-
const s = t[r],
|
|
1284
|
-
s.dirty && (s.dirty = !1,
|
|
1219
|
+
const s = t[r], a = s.geometry;
|
|
1220
|
+
s.dirty && (s.dirty = !1, a.buffers[0].update(s.attributeSize * 4));
|
|
1285
1221
|
}
|
|
1286
1222
|
}
|
|
1287
1223
|
execute(e) {
|
|
@@ -1308,13 +1244,13 @@ oe.extension = {
|
|
|
1308
1244
|
};
|
|
1309
1245
|
oe._availableBatchers = /* @__PURE__ */ Object.create(null);
|
|
1310
1246
|
let tt = oe;
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
const kr = new
|
|
1314
|
-
class
|
|
1247
|
+
se.handleByMap(u.Batcher, tt._availableBatchers);
|
|
1248
|
+
se.add(Je);
|
|
1249
|
+
const kr = new ne();
|
|
1250
|
+
class Mr extends Fe {
|
|
1315
1251
|
constructor() {
|
|
1316
1252
|
super(), this.filters = [new Cr({
|
|
1317
|
-
sprite: new
|
|
1253
|
+
sprite: new Mt(S.EMPTY),
|
|
1318
1254
|
inverse: !1,
|
|
1319
1255
|
resolution: "inherit",
|
|
1320
1256
|
antialias: "inherit"
|
|
@@ -1347,12 +1283,12 @@ class rt {
|
|
|
1347
1283
|
canBundle: !1,
|
|
1348
1284
|
maskedContainer: t
|
|
1349
1285
|
}), e.inverse = t._maskOptions.inverse, e.renderMaskToTexture) {
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1286
|
+
const a = e.mask;
|
|
1287
|
+
a.includeInBuild = !0, a.collectRenderables(
|
|
1352
1288
|
r,
|
|
1353
1289
|
s,
|
|
1354
1290
|
null
|
|
1355
|
-
),
|
|
1291
|
+
), a.includeInBuild = !1;
|
|
1356
1292
|
}
|
|
1357
1293
|
s.renderPipes.batch.break(r), r.add({
|
|
1358
1294
|
renderPipeId: "alphaMask",
|
|
@@ -1375,23 +1311,23 @@ class rt {
|
|
|
1375
1311
|
execute(e) {
|
|
1376
1312
|
const t = this._renderer, r = e.mask.renderMaskToTexture;
|
|
1377
1313
|
if (e.action === "pushMaskBegin") {
|
|
1378
|
-
const s =
|
|
1314
|
+
const s = F.get(Mr);
|
|
1379
1315
|
if (s.inverse = e.inverse, r) {
|
|
1380
1316
|
e.mask.mask.measurable = !0;
|
|
1381
|
-
const
|
|
1382
|
-
e.mask.mask.measurable = !1,
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1317
|
+
const a = kt(e.mask.mask, !0, kr);
|
|
1318
|
+
e.mask.mask.measurable = !1, a.ceil();
|
|
1319
|
+
const i = t.renderTarget.renderTarget.colorTexture.source, o = U.getOptimalTexture(
|
|
1320
|
+
a.width,
|
|
1321
|
+
a.height,
|
|
1322
|
+
i._resolution,
|
|
1323
|
+
i.antialias
|
|
1388
1324
|
);
|
|
1389
1325
|
t.renderTarget.push(o, !0), t.globalUniforms.push({
|
|
1390
|
-
offset:
|
|
1326
|
+
offset: a,
|
|
1391
1327
|
worldColor: 4294967295
|
|
1392
1328
|
});
|
|
1393
1329
|
const l = s.sprite;
|
|
1394
|
-
l.texture = o, l.worldTransform.tx =
|
|
1330
|
+
l.texture = o, l.worldTransform.tx = a.minX, l.worldTransform.ty = a.minY, this._activeMaskStage.push({
|
|
1395
1331
|
filterEffect: s,
|
|
1396
1332
|
maskedContainer: e.maskedContainer,
|
|
1397
1333
|
filterTexture: o
|
|
@@ -1403,7 +1339,7 @@ class rt {
|
|
|
1403
1339
|
});
|
|
1404
1340
|
} else if (e.action === "pushMaskEnd") {
|
|
1405
1341
|
const s = this._activeMaskStage[this._activeMaskStage.length - 1];
|
|
1406
|
-
r && (t.type ===
|
|
1342
|
+
r && (t.type === ie.WEBGL && t.renderTarget.finishRenderPass(), t.renderTarget.pop(), t.globalUniforms.pop()), t.filter.push({
|
|
1407
1343
|
renderPipeId: "filter",
|
|
1408
1344
|
action: "pushFilter",
|
|
1409
1345
|
container: s.maskedContainer,
|
|
@@ -1413,7 +1349,7 @@ class rt {
|
|
|
1413
1349
|
} else if (e.action === "popMaskEnd") {
|
|
1414
1350
|
t.filter.pop();
|
|
1415
1351
|
const s = this._activeMaskStage.pop();
|
|
1416
|
-
r &&
|
|
1352
|
+
r && U.returnTexture(s.filterTexture), F.return(s.filterEffect);
|
|
1417
1353
|
}
|
|
1418
1354
|
}
|
|
1419
1355
|
destroy() {
|
|
@@ -1437,23 +1373,23 @@ class st {
|
|
|
1437
1373
|
}
|
|
1438
1374
|
push(e, t, r) {
|
|
1439
1375
|
this._renderer.renderPipes.batch.break(r);
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1376
|
+
const a = this._colorStack;
|
|
1377
|
+
a[this._colorStackIndex] = a[this._colorStackIndex - 1] & e.mask;
|
|
1378
|
+
const i = this._colorStack[this._colorStackIndex];
|
|
1379
|
+
i !== this._currentColor && (this._currentColor = i, r.add({
|
|
1444
1380
|
renderPipeId: "colorMask",
|
|
1445
|
-
colorMask:
|
|
1381
|
+
colorMask: i,
|
|
1446
1382
|
canBundle: !1
|
|
1447
1383
|
})), this._colorStackIndex++;
|
|
1448
1384
|
}
|
|
1449
1385
|
pop(e, t, r) {
|
|
1450
1386
|
this._renderer.renderPipes.batch.break(r);
|
|
1451
|
-
const
|
|
1387
|
+
const a = this._colorStack;
|
|
1452
1388
|
this._colorStackIndex--;
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1389
|
+
const i = a[this._colorStackIndex - 1];
|
|
1390
|
+
i !== this._currentColor && (this._currentColor = i, r.add({
|
|
1455
1391
|
renderPipeId: "colorMask",
|
|
1456
|
-
colorMask:
|
|
1392
|
+
colorMask: i,
|
|
1457
1393
|
canBundle: !1
|
|
1458
1394
|
}));
|
|
1459
1395
|
}
|
|
@@ -1477,25 +1413,25 @@ class nt {
|
|
|
1477
1413
|
}
|
|
1478
1414
|
push(e, t, r) {
|
|
1479
1415
|
var s;
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1416
|
+
const a = e, i = this._renderer;
|
|
1417
|
+
i.renderPipes.batch.break(r), i.renderPipes.blendMode.setBlendMode(a.mask, "none", r), r.add({
|
|
1482
1418
|
renderPipeId: "stencilMask",
|
|
1483
1419
|
action: "pushMaskBegin",
|
|
1484
1420
|
mask: e,
|
|
1485
1421
|
inverse: t._maskOptions.inverse,
|
|
1486
1422
|
canBundle: !1
|
|
1487
1423
|
});
|
|
1488
|
-
const o =
|
|
1489
|
-
o.includeInBuild = !0, this._maskHash.has(
|
|
1424
|
+
const o = a.mask;
|
|
1425
|
+
o.includeInBuild = !0, this._maskHash.has(a) || this._maskHash.set(a, {
|
|
1490
1426
|
instructionsStart: 0,
|
|
1491
1427
|
instructionsLength: 0
|
|
1492
1428
|
});
|
|
1493
|
-
const l = this._maskHash.get(
|
|
1429
|
+
const l = this._maskHash.get(a);
|
|
1494
1430
|
l.instructionsStart = r.instructionSize, o.collectRenderables(
|
|
1495
1431
|
r,
|
|
1496
|
-
|
|
1432
|
+
i,
|
|
1497
1433
|
null
|
|
1498
|
-
), o.includeInBuild = !1,
|
|
1434
|
+
), o.includeInBuild = !1, i.renderPipes.batch.break(r), r.add({
|
|
1499
1435
|
renderPipeId: "stencilMask",
|
|
1500
1436
|
action: "pushMaskEnd",
|
|
1501
1437
|
mask: e,
|
|
@@ -1504,20 +1440,20 @@ class nt {
|
|
|
1504
1440
|
});
|
|
1505
1441
|
const d = r.instructionSize - l.instructionsStart - 1;
|
|
1506
1442
|
l.instructionsLength = d;
|
|
1507
|
-
const f =
|
|
1443
|
+
const f = i.renderTarget.renderTarget.uid;
|
|
1508
1444
|
(s = this._maskStackHash)[f] ?? (s[f] = 0);
|
|
1509
1445
|
}
|
|
1510
1446
|
pop(e, t, r) {
|
|
1511
|
-
const s = e,
|
|
1512
|
-
|
|
1447
|
+
const s = e, a = this._renderer;
|
|
1448
|
+
a.renderPipes.batch.break(r), a.renderPipes.blendMode.setBlendMode(s.mask, "none", r), r.add({
|
|
1513
1449
|
renderPipeId: "stencilMask",
|
|
1514
1450
|
action: "popMaskBegin",
|
|
1515
1451
|
inverse: t._maskOptions.inverse,
|
|
1516
1452
|
canBundle: !1
|
|
1517
1453
|
});
|
|
1518
|
-
const
|
|
1519
|
-
for (let o = 0; o <
|
|
1520
|
-
r.instructions[r.instructionSize++] = r.instructions[
|
|
1454
|
+
const i = this._maskHash.get(e);
|
|
1455
|
+
for (let o = 0; o < i.instructionsLength; o++)
|
|
1456
|
+
r.instructions[r.instructionSize++] = r.instructions[i.instructionsStart++];
|
|
1521
1457
|
r.add({
|
|
1522
1458
|
renderPipeId: "stencilMask",
|
|
1523
1459
|
action: "popMaskEnd",
|
|
@@ -1526,9 +1462,9 @@ class nt {
|
|
|
1526
1462
|
}
|
|
1527
1463
|
execute(e) {
|
|
1528
1464
|
var t;
|
|
1529
|
-
const r = this._renderer, s = r,
|
|
1530
|
-
let
|
|
1531
|
-
e.action === "pushMaskBegin" ? (s.renderTarget.ensureDepthStencil(), s.stencil.setStencilMode(k.RENDERING_MASK_ADD,
|
|
1465
|
+
const r = this._renderer, s = r, a = r.renderTarget.renderTarget.uid;
|
|
1466
|
+
let i = (t = this._maskStackHash)[a] ?? (t[a] = 0);
|
|
1467
|
+
e.action === "pushMaskBegin" ? (s.renderTarget.ensureDepthStencil(), s.stencil.setStencilMode(k.RENDERING_MASK_ADD, i), i++, s.colorMask.setMask(0)) : e.action === "pushMaskEnd" ? (e.inverse ? s.stencil.setStencilMode(k.INVERSE_MASK_ACTIVE, i) : s.stencil.setStencilMode(k.MASK_ACTIVE, i), s.colorMask.setMask(15)) : e.action === "popMaskBegin" ? (s.colorMask.setMask(0), i !== 0 ? s.stencil.setStencilMode(k.RENDERING_MASK_REMOVE, i) : (s.renderTarget.clear(null, Q.STENCIL), s.stencil.setStencilMode(k.DISABLED, i)), i--) : e.action === "popMaskEnd" && (e.inverse ? s.stencil.setStencilMode(k.INVERSE_MASK_ACTIVE, i) : s.stencil.setStencilMode(k.MASK_ACTIVE, i), s.colorMask.setMask(15)), this._maskStackHash[a] = i;
|
|
1532
1468
|
}
|
|
1533
1469
|
destroy() {
|
|
1534
1470
|
this._renderer = null, this._maskStackHash = null, this._maskHash = null;
|
|
@@ -1541,7 +1477,7 @@ nt.extension = {
|
|
|
1541
1477
|
],
|
|
1542
1478
|
name: "stencilMask"
|
|
1543
1479
|
};
|
|
1544
|
-
class
|
|
1480
|
+
class at {
|
|
1545
1481
|
constructor(e) {
|
|
1546
1482
|
this._renderer = e;
|
|
1547
1483
|
}
|
|
@@ -1562,7 +1498,7 @@ class it {
|
|
|
1562
1498
|
this._renderer = null;
|
|
1563
1499
|
}
|
|
1564
1500
|
}
|
|
1565
|
-
|
|
1501
|
+
at.extension = {
|
|
1566
1502
|
type: [
|
|
1567
1503
|
u.WebGLPipes,
|
|
1568
1504
|
u.WebGPUPipes,
|
|
@@ -1573,11 +1509,11 @@ it.extension = {
|
|
|
1573
1509
|
function J(n, e) {
|
|
1574
1510
|
const t = n.instructionSet, r = t.instructions;
|
|
1575
1511
|
for (let s = 0; s < t.instructionSize; s++) {
|
|
1576
|
-
const
|
|
1577
|
-
e[
|
|
1512
|
+
const a = r[s];
|
|
1513
|
+
e[a.renderPipeId].execute(a);
|
|
1578
1514
|
}
|
|
1579
1515
|
}
|
|
1580
|
-
class
|
|
1516
|
+
class it {
|
|
1581
1517
|
constructor(e) {
|
|
1582
1518
|
this._renderer = e;
|
|
1583
1519
|
}
|
|
@@ -1591,16 +1527,16 @@ class at {
|
|
|
1591
1527
|
this._renderer = null;
|
|
1592
1528
|
}
|
|
1593
1529
|
_addRenderableDirect(e, t) {
|
|
1594
|
-
this._renderer.renderPipes.batch.break(t), e._batchableRenderGroup && (
|
|
1530
|
+
this._renderer.renderPipes.batch.break(t), e._batchableRenderGroup && (F.return(e._batchableRenderGroup), e._batchableRenderGroup = null), t.add(e);
|
|
1595
1531
|
}
|
|
1596
1532
|
_addRenderableCacheAsTexture(e, t) {
|
|
1597
|
-
const r = e._batchableRenderGroup ?? (e._batchableRenderGroup =
|
|
1533
|
+
const r = e._batchableRenderGroup ?? (e._batchableRenderGroup = F.get(Ze));
|
|
1598
1534
|
r.renderable = e.root, r.transform = e.root.relativeGroupTransform, r.texture = e.texture, r.bounds = e._textureBounds, t.add(e), this._renderer.renderPipes.blendMode.pushBlendMode(e, e.root.groupBlendMode, t), this._renderer.renderPipes.batch.addToBatch(r, t), this._renderer.renderPipes.blendMode.popBlendMode(t);
|
|
1599
1535
|
}
|
|
1600
1536
|
_executeCacheAsTexture(e) {
|
|
1601
1537
|
if (e.textureNeedsUpdate) {
|
|
1602
1538
|
e.textureNeedsUpdate = !1;
|
|
1603
|
-
const t = new
|
|
1539
|
+
const t = new R().translate(
|
|
1604
1540
|
-e._textureBounds.x,
|
|
1605
1541
|
-e._textureBounds.y
|
|
1606
1542
|
);
|
|
@@ -1619,7 +1555,7 @@ class at {
|
|
|
1619
1555
|
}), J(e, this._renderer.renderPipes), this._renderer.globalUniforms.pop();
|
|
1620
1556
|
}
|
|
1621
1557
|
}
|
|
1622
|
-
|
|
1558
|
+
it.extension = {
|
|
1623
1559
|
type: [
|
|
1624
1560
|
u.WebGLPipes,
|
|
1625
1561
|
u.WebGPUPipes,
|
|
@@ -1668,13 +1604,13 @@ ot.extension = {
|
|
|
1668
1604
|
],
|
|
1669
1605
|
name: "sprite"
|
|
1670
1606
|
};
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1607
|
+
const D = {};
|
|
1608
|
+
se.handle(u.BlendMode, (n) => {
|
|
1673
1609
|
if (!n.name)
|
|
1674
1610
|
throw new Error("BlendMode extension must have a name property");
|
|
1675
|
-
|
|
1611
|
+
D[n.name] = n.ref;
|
|
1676
1612
|
}, (n) => {
|
|
1677
|
-
delete
|
|
1613
|
+
delete D[n.name];
|
|
1678
1614
|
});
|
|
1679
1615
|
class lt {
|
|
1680
1616
|
constructor(e) {
|
|
@@ -1710,34 +1646,34 @@ class lt {
|
|
|
1710
1646
|
* @param instructionSet - The instruction set being built.
|
|
1711
1647
|
*/
|
|
1712
1648
|
setBlendMode(e, t, r) {
|
|
1713
|
-
var
|
|
1714
|
-
const s = e instanceof
|
|
1649
|
+
var a;
|
|
1650
|
+
const s = e instanceof _e;
|
|
1715
1651
|
if (this._activeBlendMode === t) {
|
|
1716
|
-
this._isAdvanced && e && !s && ((
|
|
1652
|
+
this._isAdvanced && e && !s && ((a = this._renderableList) == null || a.push(e));
|
|
1717
1653
|
return;
|
|
1718
1654
|
}
|
|
1719
|
-
this._isAdvanced && this._endAdvancedBlendMode(r), this._activeBlendMode = t, e && (this._isAdvanced = !!
|
|
1655
|
+
this._isAdvanced && this._endAdvancedBlendMode(r), this._activeBlendMode = t, e && (this._isAdvanced = !!D[t], this._isAdvanced && this._beginAdvancedBlendMode(e, r));
|
|
1720
1656
|
}
|
|
1721
1657
|
_beginAdvancedBlendMode(e, t) {
|
|
1722
1658
|
this._renderer.renderPipes.batch.break(t);
|
|
1723
1659
|
const r = this._activeBlendMode;
|
|
1724
|
-
if (!
|
|
1660
|
+
if (!D[r]) {
|
|
1725
1661
|
te(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);
|
|
1726
1662
|
return;
|
|
1727
1663
|
}
|
|
1728
|
-
const s = this._ensureFilterEffect(r),
|
|
1664
|
+
const s = this._ensureFilterEffect(r), a = e instanceof _e, i = {
|
|
1729
1665
|
renderPipeId: "filter",
|
|
1730
1666
|
action: "pushFilter",
|
|
1731
1667
|
filterEffect: s,
|
|
1732
|
-
renderables:
|
|
1733
|
-
container:
|
|
1668
|
+
renderables: a ? null : [e],
|
|
1669
|
+
container: a ? e.root : null,
|
|
1734
1670
|
canBundle: !1
|
|
1735
1671
|
};
|
|
1736
|
-
this._renderableList =
|
|
1672
|
+
this._renderableList = i.renderables, t.add(i);
|
|
1737
1673
|
}
|
|
1738
1674
|
_ensureFilterEffect(e) {
|
|
1739
1675
|
let t = this._filterHash[e];
|
|
1740
|
-
return t || (t = this._filterHash[e] = new
|
|
1676
|
+
return t || (t = this._filterHash[e] = new Fe(), t.filters = [new D[e]()]), t;
|
|
1741
1677
|
}
|
|
1742
1678
|
_endAdvancedBlendMode(e) {
|
|
1743
1679
|
this._isAdvanced = !1, this._renderableList = null, this._renderer.renderPipes.batch.break(e), e.add({
|
|
@@ -1783,17 +1719,17 @@ function Z(n, e) {
|
|
|
1783
1719
|
for (let t = e; t < n.length && n[t]; t++)
|
|
1784
1720
|
n[t] = null;
|
|
1785
1721
|
}
|
|
1786
|
-
const
|
|
1722
|
+
const Rr = new L(), Ie = Oe | We | Ve;
|
|
1787
1723
|
function ut(n, e = !1) {
|
|
1788
1724
|
Br(n);
|
|
1789
1725
|
const t = n.childrenToUpdate, r = n.updateTick++;
|
|
1790
1726
|
for (const s in t) {
|
|
1791
|
-
const
|
|
1727
|
+
const a = Number(s), i = t[s], o = i.list, l = i.index;
|
|
1792
1728
|
for (let d = 0; d < l; d++) {
|
|
1793
1729
|
const f = o[d];
|
|
1794
|
-
f.parentRenderGroup === n && f.relativeRenderGroupDepth ===
|
|
1730
|
+
f.parentRenderGroup === n && f.relativeRenderGroupDepth === a && ct(f, r, 0);
|
|
1795
1731
|
}
|
|
1796
|
-
Z(o, l),
|
|
1732
|
+
Z(o, l), i.index = 0;
|
|
1797
1733
|
}
|
|
1798
1734
|
if (e)
|
|
1799
1735
|
for (let s = 0; s < n.renderGroupChildren.length; s++)
|
|
@@ -1807,7 +1743,7 @@ function Br(n) {
|
|
|
1807
1743
|
n.worldTransform.appendFrom(
|
|
1808
1744
|
e.relativeGroupTransform,
|
|
1809
1745
|
r.worldTransform
|
|
1810
|
-
), n.worldColor =
|
|
1746
|
+
), n.worldColor = Le(
|
|
1811
1747
|
e.groupColor,
|
|
1812
1748
|
r.worldColor
|
|
1813
1749
|
), t = e.groupAlpha * r.worldAlpha;
|
|
@@ -1824,36 +1760,36 @@ function ct(n, e, t) {
|
|
|
1824
1760
|
if (s && !s.renderGroup ? (t |= n._updateFlags, n.relativeGroupTransform.appendFrom(
|
|
1825
1761
|
r,
|
|
1826
1762
|
s.relativeGroupTransform
|
|
1827
|
-
), t & Ie &&
|
|
1828
|
-
const
|
|
1829
|
-
for (let d = 0; d <
|
|
1830
|
-
ct(
|
|
1763
|
+
), t & Ie && Ee(n, s, t)) : (t = n._updateFlags, n.relativeGroupTransform.copyFrom(r), t & Ie && Ee(n, Rr, t)), !n.renderGroup) {
|
|
1764
|
+
const a = n.children, i = a.length;
|
|
1765
|
+
for (let d = 0; d < i; d++)
|
|
1766
|
+
ct(a[d], e, t);
|
|
1831
1767
|
const o = n.parentRenderGroup, l = n;
|
|
1832
1768
|
l.renderPipeId && !o.structureDidChange && o.updateRenderable(l);
|
|
1833
1769
|
}
|
|
1834
1770
|
}
|
|
1835
|
-
function
|
|
1771
|
+
function Ee(n, e, t) {
|
|
1836
1772
|
if (t & We) {
|
|
1837
|
-
n.groupColor =
|
|
1773
|
+
n.groupColor = Le(
|
|
1838
1774
|
n.localColor,
|
|
1839
1775
|
e.groupColor
|
|
1840
1776
|
);
|
|
1841
1777
|
let r = n.localAlpha * e.groupAlpha;
|
|
1842
1778
|
r = r < 0 ? 0 : r > 1 ? 1 : r, n.groupAlpha = r, n.groupColorAlpha = n.groupColor + ((r * 255 | 0) << 24);
|
|
1843
1779
|
}
|
|
1844
|
-
t &
|
|
1780
|
+
t & Ve && (n.groupBlendMode = n.localBlendMode === "inherit" ? e.groupBlendMode : n.localBlendMode), t & Oe && (n.globalDisplayStatus = n.localDisplayStatus & e.globalDisplayStatus), n._updateFlags = 0;
|
|
1845
1781
|
}
|
|
1846
|
-
function
|
|
1782
|
+
function Pr(n, e) {
|
|
1847
1783
|
const { list: t } = n.childrenRenderablesToUpdate;
|
|
1848
1784
|
let r = !1;
|
|
1849
1785
|
for (let s = 0; s < n.childrenRenderablesToUpdate.index; s++) {
|
|
1850
|
-
const
|
|
1851
|
-
if (r = e[
|
|
1786
|
+
const a = t[s];
|
|
1787
|
+
if (r = e[a.renderPipeId].validateRenderable(a), r)
|
|
1852
1788
|
break;
|
|
1853
1789
|
}
|
|
1854
1790
|
return n.structureDidChange = r, r;
|
|
1855
1791
|
}
|
|
1856
|
-
const
|
|
1792
|
+
const wr = new R();
|
|
1857
1793
|
class dt {
|
|
1858
1794
|
constructor(e) {
|
|
1859
1795
|
this._renderer = e;
|
|
@@ -1861,13 +1797,13 @@ class dt {
|
|
|
1861
1797
|
render({ container: e, transform: t }) {
|
|
1862
1798
|
const r = e.parent, s = e.renderGroup.renderGroupParent;
|
|
1863
1799
|
e.parent = null, e.renderGroup.renderGroupParent = null;
|
|
1864
|
-
const
|
|
1865
|
-
t && (
|
|
1866
|
-
const o =
|
|
1867
|
-
this._updateCachedRenderGroups(e.renderGroup, null), this._updateRenderGroups(e.renderGroup),
|
|
1800
|
+
const a = this._renderer, i = wr;
|
|
1801
|
+
t && (i.copyFrom(e.renderGroup.localTransform), e.renderGroup.localTransform.copyFrom(t));
|
|
1802
|
+
const o = a.renderPipes;
|
|
1803
|
+
this._updateCachedRenderGroups(e.renderGroup, null), this._updateRenderGroups(e.renderGroup), a.globalUniforms.start({
|
|
1868
1804
|
worldTransformMatrix: t ? e.renderGroup.localTransform : e.renderGroup.worldTransform,
|
|
1869
1805
|
worldColor: e.renderGroup.worldColorAlpha
|
|
1870
|
-
}), J(e.renderGroup, o), o.uniformBatch && o.uniformBatch.renderEnd(), t && e.renderGroup.localTransform.copyFrom(
|
|
1806
|
+
}), J(e.renderGroup, o), o.uniformBatch && o.uniformBatch.renderEnd(), t && e.renderGroup.localTransform.copyFrom(i), e.parent = r, e.renderGroup.renderGroupParent = s;
|
|
1871
1807
|
}
|
|
1872
1808
|
destroy() {
|
|
1873
1809
|
this._renderer = null;
|
|
@@ -1881,37 +1817,37 @@ class dt {
|
|
|
1881
1817
|
this._updateCachedRenderGroups(e.renderGroupChildren[r], t);
|
|
1882
1818
|
if (e.invalidateMatrices(), e.isCachedAsTexture) {
|
|
1883
1819
|
if (e.textureNeedsUpdate) {
|
|
1884
|
-
const r = e.root.getLocalBounds(), s = this._renderer,
|
|
1885
|
-
r.ceil(), e.texture &&
|
|
1886
|
-
const d =
|
|
1820
|
+
const r = e.root.getLocalBounds(), s = this._renderer, a = e.textureOptions.resolution || s.view.resolution, i = e.textureOptions.antialias ?? s.view.antialias, o = e.textureOptions.scaleMode ?? "linear", l = e.texture;
|
|
1821
|
+
r.ceil(), e.texture && U.returnTexture(e.texture, !0);
|
|
1822
|
+
const d = U.getOptimalTexture(
|
|
1887
1823
|
r.width,
|
|
1888
1824
|
r.height,
|
|
1889
|
-
|
|
1890
|
-
|
|
1825
|
+
a,
|
|
1826
|
+
i
|
|
1891
1827
|
);
|
|
1892
|
-
d._source.style = new
|
|
1828
|
+
d._source.style = new Rt({ scaleMode: o }), e.texture = d, e._textureBounds || (e._textureBounds = new ne()), e._textureBounds.copyFrom(r), l !== e.texture && e.renderGroupParent && (e.renderGroupParent.structureDidChange = !0);
|
|
1893
1829
|
}
|
|
1894
|
-
} else e.texture && (
|
|
1830
|
+
} else e.texture && (U.returnTexture(e.texture, !0), e.texture = null);
|
|
1895
1831
|
}
|
|
1896
1832
|
_updateRenderGroups(e) {
|
|
1897
1833
|
const t = this._renderer, r = t.renderPipes;
|
|
1898
|
-
if (e.runOnRender(t), e.instructionSet.renderPipes = r, e.structureDidChange ? Z(e.childrenRenderablesToUpdate.list, 0) :
|
|
1834
|
+
if (e.runOnRender(t), e.instructionSet.renderPipes = r, e.structureDidChange ? Z(e.childrenRenderablesToUpdate.list, 0) : Pr(e, r), ut(e), e.structureDidChange ? (e.structureDidChange = !1, this._buildInstructions(e, t)) : this._updateRenderables(e), e.childrenRenderablesToUpdate.index = 0, t.renderPipes.batch.upload(e.instructionSet), !(e.isCachedAsTexture && !e.textureNeedsUpdate))
|
|
1899
1835
|
for (let s = 0; s < e.renderGroupChildren.length; s++)
|
|
1900
1836
|
this._updateRenderGroups(e.renderGroupChildren[s]);
|
|
1901
1837
|
}
|
|
1902
1838
|
_updateRenderables(e) {
|
|
1903
1839
|
const { list: t, index: r } = e.childrenRenderablesToUpdate;
|
|
1904
1840
|
for (let s = 0; s < r; s++) {
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1841
|
+
const a = t[s];
|
|
1842
|
+
a.didViewUpdate && e.updateRenderable(a);
|
|
1907
1843
|
}
|
|
1908
1844
|
Z(t, r);
|
|
1909
1845
|
}
|
|
1910
1846
|
_buildInstructions(e, t) {
|
|
1911
1847
|
const r = e.root, s = e.instructionSet;
|
|
1912
1848
|
s.reset();
|
|
1913
|
-
const
|
|
1914
|
-
|
|
1849
|
+
const a = t.renderPipes ? t : t.batch.renderer, i = a.renderPipes;
|
|
1850
|
+
i.batch.buildStart(s), i.blendMode.buildStart(), i.colorMask.buildStart(), r.sortableChildren && r.sortChildren(), r.collectRenderablesWithEffects(s, a, null), i.batch.buildEnd(s), i.blendMode.buildEnd(s);
|
|
1915
1851
|
}
|
|
1916
1852
|
}
|
|
1917
1853
|
dt.extension = {
|
|
@@ -1986,7 +1922,7 @@ le.defaultOptions = {
|
|
|
1986
1922
|
*/
|
|
1987
1923
|
clearBeforeRender: !0
|
|
1988
1924
|
};
|
|
1989
|
-
let
|
|
1925
|
+
let Gr = le;
|
|
1990
1926
|
const q = {
|
|
1991
1927
|
png: "image/png",
|
|
1992
1928
|
jpg: "image/jpeg",
|
|
@@ -1997,7 +1933,7 @@ const q = {
|
|
|
1997
1933
|
this._renderer = e;
|
|
1998
1934
|
}
|
|
1999
1935
|
_normalizeOptions(e, t = {}) {
|
|
2000
|
-
return e instanceof
|
|
1936
|
+
return e instanceof L || e instanceof S ? {
|
|
2001
1937
|
target: e,
|
|
2002
1938
|
...t
|
|
2003
1939
|
} : {
|
|
@@ -2038,7 +1974,7 @@ const q = {
|
|
|
2038
1974
|
* @category rendering
|
|
2039
1975
|
*/
|
|
2040
1976
|
async image(e) {
|
|
2041
|
-
const t =
|
|
1977
|
+
const t = ae.get().createImage();
|
|
2042
1978
|
return t.src = await this.base64(e), t;
|
|
2043
1979
|
}
|
|
2044
1980
|
/**
|
|
@@ -2080,23 +2016,23 @@ const q = {
|
|
|
2080
2016
|
);
|
|
2081
2017
|
const { format: t, quality: r } = e, s = this.canvas(e);
|
|
2082
2018
|
if (s.toBlob !== void 0)
|
|
2083
|
-
return new Promise((
|
|
2019
|
+
return new Promise((a, i) => {
|
|
2084
2020
|
s.toBlob((o) => {
|
|
2085
2021
|
if (!o) {
|
|
2086
|
-
|
|
2022
|
+
i(new Error("ICanvas.toBlob failed!"));
|
|
2087
2023
|
return;
|
|
2088
2024
|
}
|
|
2089
2025
|
const l = new FileReader();
|
|
2090
|
-
l.onload = () =>
|
|
2026
|
+
l.onload = () => a(l.result), l.onerror = i, l.readAsDataURL(o);
|
|
2091
2027
|
}, q[t], r);
|
|
2092
2028
|
});
|
|
2093
2029
|
if (s.toDataURL !== void 0)
|
|
2094
2030
|
return s.toDataURL(q[t], r);
|
|
2095
2031
|
if (s.convertToBlob !== void 0) {
|
|
2096
|
-
const
|
|
2097
|
-
return new Promise((
|
|
2032
|
+
const a = await s.convertToBlob({ type: q[t], quality: r });
|
|
2033
|
+
return new Promise((i, o) => {
|
|
2098
2034
|
const l = new FileReader();
|
|
2099
|
-
l.onload = () =>
|
|
2035
|
+
l.onload = () => i(l.result), l.onerror = o, l.readAsDataURL(a);
|
|
2100
2036
|
});
|
|
2101
2037
|
}
|
|
2102
2038
|
throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented");
|
|
@@ -2146,8 +2082,8 @@ const q = {
|
|
|
2146
2082
|
const t = e.target, r = this._renderer;
|
|
2147
2083
|
if (t instanceof S)
|
|
2148
2084
|
return r.texture.generateCanvas(t);
|
|
2149
|
-
const s = r.textureGenerator.generateTexture(e),
|
|
2150
|
-
return s.destroy(!0),
|
|
2085
|
+
const s = r.textureGenerator.generateTexture(e), a = r.texture.generateCanvas(s);
|
|
2086
|
+
return s.destroy(!0), a;
|
|
2151
2087
|
}
|
|
2152
2088
|
/**
|
|
2153
2089
|
* Returns a one-dimensional array containing the pixel data of the entire texture in RGBA order,
|
|
@@ -2181,8 +2117,8 @@ const q = {
|
|
|
2181
2117
|
*/
|
|
2182
2118
|
pixels(e) {
|
|
2183
2119
|
e = this._normalizeOptions(e);
|
|
2184
|
-
const t = e.target, r = this._renderer, s = t instanceof S ? t : r.textureGenerator.generateTexture(e),
|
|
2185
|
-
return t instanceof
|
|
2120
|
+
const t = e.target, r = this._renderer, s = t instanceof S ? t : r.textureGenerator.generateTexture(e), a = r.texture.getPixels(s);
|
|
2121
|
+
return t instanceof L && s.destroy(!0), a;
|
|
2186
2122
|
}
|
|
2187
2123
|
/**
|
|
2188
2124
|
* Creates a texture from a display object or existing texture.
|
|
@@ -2300,13 +2236,13 @@ const q = {
|
|
|
2300
2236
|
e = this._normalizeOptions(e);
|
|
2301
2237
|
const r = this.canvas(e), s = r.toDataURL();
|
|
2302
2238
|
console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);
|
|
2303
|
-
const
|
|
2239
|
+
const a = [
|
|
2304
2240
|
"font-size: 1px;",
|
|
2305
2241
|
`padding: ${t}px 300px;`,
|
|
2306
2242
|
`background: url(${s}) no-repeat;`,
|
|
2307
2243
|
"background-size: contain;"
|
|
2308
2244
|
].join(" ");
|
|
2309
|
-
console.log("%c ",
|
|
2245
|
+
console.log("%c ", a);
|
|
2310
2246
|
}
|
|
2311
2247
|
destroy() {
|
|
2312
2248
|
this._renderer = null;
|
|
@@ -2324,7 +2260,7 @@ ue.defaultImageOptions = {
|
|
|
2324
2260
|
format: "png",
|
|
2325
2261
|
quality: 1
|
|
2326
2262
|
};
|
|
2327
|
-
let
|
|
2263
|
+
let Ar = ue;
|
|
2328
2264
|
class ce extends S {
|
|
2329
2265
|
/**
|
|
2330
2266
|
* Creates a RenderTexture. Pass `dynamic: true` in options to allow resizing after creation.
|
|
@@ -2352,7 +2288,7 @@ class ce extends S {
|
|
|
2352
2288
|
return this.source.resize(e, t, r), this;
|
|
2353
2289
|
}
|
|
2354
2290
|
}
|
|
2355
|
-
const
|
|
2291
|
+
const Ur = new O(), Ir = new ne(), Er = [0, 0, 0, 0];
|
|
2356
2292
|
class pt {
|
|
2357
2293
|
constructor(e) {
|
|
2358
2294
|
this._renderer = e;
|
|
@@ -2395,29 +2331,29 @@ class pt {
|
|
|
2395
2331
|
*/
|
|
2396
2332
|
generateTexture(e) {
|
|
2397
2333
|
var d;
|
|
2398
|
-
e instanceof
|
|
2334
|
+
e instanceof L && (e = {
|
|
2399
2335
|
target: e,
|
|
2400
2336
|
frame: void 0,
|
|
2401
2337
|
textureSourceOptions: {},
|
|
2402
2338
|
resolution: void 0
|
|
2403
2339
|
});
|
|
2404
2340
|
const t = e.resolution || this._renderer.resolution, r = e.antialias || this._renderer.view.antialias, s = e.target;
|
|
2405
|
-
let
|
|
2406
|
-
|
|
2407
|
-
const
|
|
2408
|
-
|
|
2341
|
+
let a = e.clearColor;
|
|
2342
|
+
a ? a = Array.isArray(a) && a.length === 4 ? a : Y.shared.setValue(a).toArray() : a = Er;
|
|
2343
|
+
const i = ((d = e.frame) == null ? void 0 : d.copyTo(Ur)) || Bt(s, Ir).rectangle;
|
|
2344
|
+
i.width = Math.max(i.width, 1 / t) | 0, i.height = Math.max(i.height, 1 / t) | 0;
|
|
2409
2345
|
const o = ce.create({
|
|
2410
2346
|
...e.textureSourceOptions,
|
|
2411
|
-
width:
|
|
2412
|
-
height:
|
|
2347
|
+
width: i.width,
|
|
2348
|
+
height: i.height,
|
|
2413
2349
|
resolution: t,
|
|
2414
2350
|
antialias: r
|
|
2415
|
-
}), l =
|
|
2351
|
+
}), l = R.shared.translate(-i.x, -i.y);
|
|
2416
2352
|
return this._renderer.render({
|
|
2417
2353
|
container: s,
|
|
2418
2354
|
transform: l,
|
|
2419
2355
|
target: o,
|
|
2420
|
-
clearColor:
|
|
2356
|
+
clearColor: a
|
|
2421
2357
|
}), o.source.updateMipmaps(), o;
|
|
2422
2358
|
}
|
|
2423
2359
|
destroy() {
|
|
@@ -2432,7 +2368,7 @@ pt.extension = {
|
|
|
2432
2368
|
],
|
|
2433
2369
|
name: "textureGenerator"
|
|
2434
2370
|
};
|
|
2435
|
-
function
|
|
2371
|
+
function Dr(n) {
|
|
2436
2372
|
let e = !1;
|
|
2437
2373
|
for (const r in n)
|
|
2438
2374
|
if (n[r] == null) {
|
|
@@ -2490,8 +2426,8 @@ const de = class mt {
|
|
|
2490
2426
|
), this._collectionsHandler = this._renderer.scheduler.repeat(
|
|
2491
2427
|
() => {
|
|
2492
2428
|
for (const t of this._managedCollections) {
|
|
2493
|
-
const { context: r, collection: s, type:
|
|
2494
|
-
|
|
2429
|
+
const { context: r, collection: s, type: a } = t;
|
|
2430
|
+
a === "hash" ? r[s] = Dr(r[s]) : r[s] = zr(r[s]);
|
|
2495
2431
|
}
|
|
2496
2432
|
},
|
|
2497
2433
|
this._frequency
|
|
@@ -2538,7 +2474,7 @@ const de = class mt {
|
|
|
2538
2474
|
* @param type - The type of resource to track
|
|
2539
2475
|
*/
|
|
2540
2476
|
addResource(e, t) {
|
|
2541
|
-
var s,
|
|
2477
|
+
var s, a;
|
|
2542
2478
|
if (e._gcLastUsed !== -1) {
|
|
2543
2479
|
e._gcLastUsed = this.now, (s = e._onTouch) == null || s.call(e, this.now);
|
|
2544
2480
|
return;
|
|
@@ -2547,7 +2483,7 @@ const de = class mt {
|
|
|
2547
2483
|
e._gcData = {
|
|
2548
2484
|
index: r,
|
|
2549
2485
|
type: t
|
|
2550
|
-
}, e._gcLastUsed = this.now, (
|
|
2486
|
+
}, e._gcLastUsed = this.now, (a = e._onTouch) == null || a.call(e, this.now), e.once("unload", this.removeResource, this), this._managedResources.push(e);
|
|
2551
2487
|
}
|
|
2552
2488
|
/**
|
|
2553
2489
|
* Removes a resource from garbage collection tracking.
|
|
@@ -2559,8 +2495,8 @@ const de = class mt {
|
|
|
2559
2495
|
if (!t) return;
|
|
2560
2496
|
const r = t.index, s = this._managedResources.length - 1;
|
|
2561
2497
|
if (r !== s) {
|
|
2562
|
-
const
|
|
2563
|
-
this._managedResources[r] =
|
|
2498
|
+
const a = this._managedResources[s];
|
|
2499
|
+
this._managedResources[r] = a, a._gcData.index = r;
|
|
2564
2500
|
}
|
|
2565
2501
|
this._managedResources.length--, e._gcData = null, e._gcLastUsed = -1;
|
|
2566
2502
|
}
|
|
@@ -2578,7 +2514,7 @@ const de = class mt {
|
|
|
2578
2514
|
hash: t,
|
|
2579
2515
|
type: r,
|
|
2580
2516
|
priority: s
|
|
2581
|
-
}), this._managedResourceHashes.sort((
|
|
2517
|
+
}), this._managedResourceHashes.sort((a, i) => a.priority - i.priority);
|
|
2582
2518
|
}
|
|
2583
2519
|
/**
|
|
2584
2520
|
* Performs garbage collection by cleaning up unused resources.
|
|
@@ -2590,15 +2526,15 @@ const de = class mt {
|
|
|
2590
2526
|
this.runOnHash(s, e);
|
|
2591
2527
|
let r = 0;
|
|
2592
2528
|
for (let s = 0; s < this._managedResources.length; s++) {
|
|
2593
|
-
const
|
|
2594
|
-
r = this.runOnResource(
|
|
2529
|
+
const a = this._managedResources[s];
|
|
2530
|
+
r = this.runOnResource(a, e, r);
|
|
2595
2531
|
}
|
|
2596
2532
|
this._managedResources.length = r;
|
|
2597
2533
|
}
|
|
2598
2534
|
updateRenderableGCTick(e, t) {
|
|
2599
|
-
var
|
|
2600
|
-
const r = e.renderGroup ?? e.parentRenderGroup, s = ((
|
|
2601
|
-
((r == null ? void 0 : r.gcTick) ?? 0) === s && (e._gcLastUsed = t, (
|
|
2535
|
+
var a, i;
|
|
2536
|
+
const r = e.renderGroup ?? e.parentRenderGroup, s = ((a = r == null ? void 0 : r.instructionSet) == null ? void 0 : a.gcTick) ?? -1;
|
|
2537
|
+
((r == null ? void 0 : r.gcTick) ?? 0) === s && (e._gcLastUsed = t, (i = e._onTouch) == null || i.call(e, t));
|
|
2602
2538
|
}
|
|
2603
2539
|
runOnResource(e, t, r) {
|
|
2604
2540
|
const s = e._gcData;
|
|
@@ -2620,20 +2556,20 @@ const de = class mt {
|
|
|
2620
2556
|
}
|
|
2621
2557
|
runOnHash(e, t) {
|
|
2622
2558
|
var d;
|
|
2623
|
-
const { context: r, hash: s, type:
|
|
2559
|
+
const { context: r, hash: s, type: a } = e, i = r[s];
|
|
2624
2560
|
let o = null, l = 0;
|
|
2625
|
-
for (const f in
|
|
2626
|
-
const c =
|
|
2561
|
+
for (const f in i) {
|
|
2562
|
+
const c = i[f];
|
|
2627
2563
|
if (c === null) {
|
|
2628
|
-
l++, l === 1e4 && !o && (o = this._createHashClone(
|
|
2564
|
+
l++, l === 1e4 && !o && (o = this._createHashClone(i, f));
|
|
2629
2565
|
continue;
|
|
2630
2566
|
}
|
|
2631
2567
|
if (c._gcLastUsed === -1) {
|
|
2632
2568
|
c._gcLastUsed = t, (d = c._onTouch) == null || d.call(c, t), o && (o[f] = c);
|
|
2633
2569
|
continue;
|
|
2634
2570
|
}
|
|
2635
|
-
if (
|
|
2636
|
-
if (o || (l + 1 !== 1e4 ? (
|
|
2571
|
+
if (a === "renderable" && this.updateRenderableGCTick(c, t), !(t - c._gcLastUsed < this.maxUnusedTime) && c.autoGarbageCollect) {
|
|
2572
|
+
if (o || (l + 1 !== 1e4 ? (i[f] = null, l++) : o = this._createHashClone(i, f)), a === "renderable") {
|
|
2637
2573
|
const g = c, m = g.renderGroup ?? g.parentRenderGroup;
|
|
2638
2574
|
m && (m.structureDidChange = !0);
|
|
2639
2575
|
}
|
|
@@ -2687,18 +2623,18 @@ class xt {
|
|
|
2687
2623
|
projectionMatrix: t,
|
|
2688
2624
|
worldTransformMatrix: r,
|
|
2689
2625
|
worldColor: s,
|
|
2690
|
-
offset:
|
|
2626
|
+
offset: a
|
|
2691
2627
|
}) {
|
|
2692
|
-
const
|
|
2693
|
-
worldTransformMatrix: new
|
|
2628
|
+
const i = this._renderer.renderTarget.renderTarget, o = this._stackIndex ? this._globalUniformDataStack[this._stackIndex - 1] : {
|
|
2629
|
+
worldTransformMatrix: new R(),
|
|
2694
2630
|
worldColor: 4294967295,
|
|
2695
|
-
offset: new
|
|
2631
|
+
offset: new Pt()
|
|
2696
2632
|
}, l = {
|
|
2697
2633
|
projectionMatrix: t || this._renderer.renderTarget.projectionMatrix,
|
|
2698
|
-
resolution: e ||
|
|
2634
|
+
resolution: e || i.size,
|
|
2699
2635
|
worldTransformMatrix: r || o.worldTransformMatrix,
|
|
2700
2636
|
worldColor: s || o.worldColor,
|
|
2701
|
-
offset:
|
|
2637
|
+
offset: a || o.offset,
|
|
2702
2638
|
bindGroup: null
|
|
2703
2639
|
}, d = this._uniformsPool.pop() || this._createUniforms();
|
|
2704
2640
|
this._activeUniforms.push(d);
|
|
@@ -2715,7 +2651,7 @@ class xt {
|
|
|
2715
2651
|
this.bind(e), this._globalUniformDataStack[this._stackIndex++] = this._currentGlobalUniformData;
|
|
2716
2652
|
}
|
|
2717
2653
|
pop() {
|
|
2718
|
-
this._currentGlobalUniformData = this._globalUniformDataStack[--this._stackIndex - 1], this._renderer.type ===
|
|
2654
|
+
this._currentGlobalUniformData = this._globalUniformDataStack[--this._stackIndex - 1], this._renderer.type === ie.WEBGL && this._currentGlobalUniformData.bindGroup.resources[0].update();
|
|
2719
2655
|
}
|
|
2720
2656
|
get bindGroup() {
|
|
2721
2657
|
return this._currentGlobalUniformData.bindGroup;
|
|
@@ -2727,9 +2663,9 @@ class xt {
|
|
|
2727
2663
|
return this._currentGlobalUniformData.bindGroup.resources[0];
|
|
2728
2664
|
}
|
|
2729
2665
|
_createUniforms() {
|
|
2730
|
-
return new
|
|
2731
|
-
uProjectionMatrix: { value: new
|
|
2732
|
-
uWorldTransformMatrix: { value: new
|
|
2666
|
+
return new re({
|
|
2667
|
+
uProjectionMatrix: { value: new R(), type: "mat3x3<f32>" },
|
|
2668
|
+
uWorldTransformMatrix: { value: new R(), type: "mat3x3<f32>" },
|
|
2733
2669
|
// TODO - someone smart - set this to be a unorm8x4 rather than a vec4<f32>
|
|
2734
2670
|
uWorldColorAlpha: { value: new Float32Array(4), type: "vec4<f32>" },
|
|
2735
2671
|
uResolution: { value: [0, 0], type: "vec2<f32>" }
|
|
@@ -2749,14 +2685,14 @@ xt.extension = {
|
|
|
2749
2685
|
],
|
|
2750
2686
|
name: "globalUniforms"
|
|
2751
2687
|
};
|
|
2752
|
-
let
|
|
2688
|
+
let Fr = 1;
|
|
2753
2689
|
class gt {
|
|
2754
2690
|
constructor() {
|
|
2755
2691
|
this._tasks = [], this._offset = 0;
|
|
2756
2692
|
}
|
|
2757
2693
|
/** Initializes the scheduler system and starts the ticker. */
|
|
2758
2694
|
init() {
|
|
2759
|
-
|
|
2695
|
+
be.system.add(this._update, this);
|
|
2760
2696
|
}
|
|
2761
2697
|
/**
|
|
2762
2698
|
* Schedules a repeating task.
|
|
@@ -2766,13 +2702,13 @@ class gt {
|
|
|
2766
2702
|
* @returns The unique identifier for the scheduled task.
|
|
2767
2703
|
*/
|
|
2768
2704
|
repeat(e, t, r = !0) {
|
|
2769
|
-
const s =
|
|
2770
|
-
let
|
|
2771
|
-
return r && (this._offset += 1e3,
|
|
2705
|
+
const s = Fr++;
|
|
2706
|
+
let a = 0;
|
|
2707
|
+
return r && (this._offset += 1e3, a = this._offset), this._tasks.push({
|
|
2772
2708
|
func: e,
|
|
2773
2709
|
duration: t,
|
|
2774
2710
|
start: performance.now(),
|
|
2775
|
-
offset:
|
|
2711
|
+
offset: a,
|
|
2776
2712
|
last: performance.now(),
|
|
2777
2713
|
repeat: !0,
|
|
2778
2714
|
id: s
|
|
@@ -2808,7 +2744,7 @@ class gt {
|
|
|
2808
2744
|
* @internal
|
|
2809
2745
|
*/
|
|
2810
2746
|
destroy() {
|
|
2811
|
-
|
|
2747
|
+
be.system.remove(this._update, this), this._tasks.length = 0;
|
|
2812
2748
|
}
|
|
2813
2749
|
}
|
|
2814
2750
|
gt.extension = {
|
|
@@ -2820,12 +2756,12 @@ gt.extension = {
|
|
|
2820
2756
|
name: "scheduler",
|
|
2821
2757
|
priority: 0
|
|
2822
2758
|
};
|
|
2823
|
-
let
|
|
2824
|
-
function
|
|
2825
|
-
if (!
|
|
2826
|
-
if (
|
|
2759
|
+
let De = !1;
|
|
2760
|
+
function Lr(n) {
|
|
2761
|
+
if (!De) {
|
|
2762
|
+
if (ae.get().getNavigator().userAgent.toLowerCase().indexOf("chrome") > -1) {
|
|
2827
2763
|
const e = [
|
|
2828
|
-
`%c %c %c %c %c PixiJS %c v${
|
|
2764
|
+
`%c %c %c %c %c PixiJS %c v${ve} (${n}) http://www.pixijs.com/
|
|
2829
2765
|
|
|
2830
2766
|
`,
|
|
2831
2767
|
"background: #E72264; padding:5px 0;",
|
|
@@ -2836,8 +2772,8 @@ function Fr(n) {
|
|
|
2836
2772
|
"color: #E72264; background: #FFFFFF; padding:5px 0;"
|
|
2837
2773
|
];
|
|
2838
2774
|
globalThis.console.log(...e);
|
|
2839
|
-
} else globalThis.console && globalThis.console.log(`PixiJS ${
|
|
2840
|
-
|
|
2775
|
+
} else globalThis.console && globalThis.console.log(`PixiJS ${ve} - ${n} - http://www.pixijs.com/`);
|
|
2776
|
+
De = !0;
|
|
2841
2777
|
}
|
|
2842
2778
|
}
|
|
2843
2779
|
class he {
|
|
@@ -2851,7 +2787,7 @@ class he {
|
|
|
2851
2787
|
init(e) {
|
|
2852
2788
|
if (e.hello) {
|
|
2853
2789
|
let t = this._renderer.name;
|
|
2854
|
-
this._renderer.type ===
|
|
2790
|
+
this._renderer.type === ie.WEBGL && (t += ` ${this._renderer.context.webGLVersion}`), Lr(t);
|
|
2855
2791
|
}
|
|
2856
2792
|
}
|
|
2857
2793
|
}
|
|
@@ -2951,7 +2887,7 @@ fe.defaultOptions = {
|
|
|
2951
2887
|
/** How often to run garbage collection in ms (default 30 seconds) */
|
|
2952
2888
|
renderableGCFrequency: 3e4
|
|
2953
2889
|
};
|
|
2954
|
-
let
|
|
2890
|
+
let Or = fe;
|
|
2955
2891
|
const pe = class H {
|
|
2956
2892
|
/**
|
|
2957
2893
|
* Frame count since started.
|
|
@@ -3121,8 +3057,8 @@ const bt = class vt {
|
|
|
3121
3057
|
}));
|
|
3122
3058
|
}
|
|
3123
3059
|
resize(e, t, r = this.resolution, s = !1) {
|
|
3124
|
-
this.dirtyId++, this.colorTextures.forEach((
|
|
3125
|
-
s &&
|
|
3060
|
+
this.dirtyId++, this.colorTextures.forEach((a, i) => {
|
|
3061
|
+
s && i === 0 || a.source.resize(e, t, r);
|
|
3126
3062
|
}), this.depthStencilTexture && this.depthStencilTexture.source.resize(e, t, r);
|
|
3127
3063
|
}
|
|
3128
3064
|
destroy() {
|
|
@@ -3151,21 +3087,21 @@ bt.defaultOptions = {
|
|
|
3151
3087
|
isRoot: !1
|
|
3152
3088
|
};
|
|
3153
3089
|
let ee = bt;
|
|
3154
|
-
const
|
|
3155
|
-
He.register(
|
|
3090
|
+
const w = /* @__PURE__ */ new Map();
|
|
3091
|
+
He.register(w);
|
|
3156
3092
|
function yt(n, e) {
|
|
3157
|
-
if (!
|
|
3093
|
+
if (!w.has(n)) {
|
|
3158
3094
|
const t = new S({
|
|
3159
3095
|
source: new X({
|
|
3160
3096
|
resource: n,
|
|
3161
3097
|
...e
|
|
3162
3098
|
})
|
|
3163
3099
|
}), r = () => {
|
|
3164
|
-
|
|
3100
|
+
w.get(n) === t && w.delete(n);
|
|
3165
3101
|
};
|
|
3166
|
-
t.once("destroy", r), t.source.once("destroy", r),
|
|
3102
|
+
t.once("destroy", r), t.source.once("destroy", r), w.set(n, t);
|
|
3167
3103
|
}
|
|
3168
|
-
return
|
|
3104
|
+
return w.get(n);
|
|
3169
3105
|
}
|
|
3170
3106
|
const me = class Tt {
|
|
3171
3107
|
/**
|
|
@@ -3198,7 +3134,7 @@ const me = class Tt {
|
|
|
3198
3134
|
e = {
|
|
3199
3135
|
...Tt.defaultOptions,
|
|
3200
3136
|
...e
|
|
3201
|
-
}, e.view && (T(
|
|
3137
|
+
}, e.view && (T(wt, "ViewSystem.view has been renamed to ViewSystem.canvas"), e.canvas = e.view), this.screen = new O(0, 0, e.width, e.height), this.canvas = e.canvas || ae.get().createCanvas(), this.antialias = !!e.antialias, this.texture = yt(this.canvas, e), this.renderTarget = new ee({
|
|
3202
3138
|
colorTextures: [this.texture],
|
|
3203
3139
|
depth: !!e.depth,
|
|
3204
3140
|
isRoot: !0
|
|
@@ -3256,33 +3192,33 @@ me.defaultOptions = {
|
|
|
3256
3192
|
*/
|
|
3257
3193
|
antialias: !1
|
|
3258
3194
|
};
|
|
3259
|
-
let
|
|
3195
|
+
let Vr = me;
|
|
3260
3196
|
const Qr = [
|
|
3261
|
-
|
|
3197
|
+
Gr,
|
|
3262
3198
|
xt,
|
|
3263
3199
|
he,
|
|
3264
|
-
|
|
3200
|
+
Vr,
|
|
3265
3201
|
dt,
|
|
3266
3202
|
Hr,
|
|
3267
3203
|
Wr,
|
|
3268
3204
|
pt,
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3205
|
+
Ar,
|
|
3206
|
+
Gt,
|
|
3207
|
+
Or,
|
|
3272
3208
|
gt
|
|
3273
3209
|
], Yr = [
|
|
3274
3210
|
lt,
|
|
3275
3211
|
tt,
|
|
3276
3212
|
ot,
|
|
3277
|
-
|
|
3213
|
+
it,
|
|
3278
3214
|
rt,
|
|
3279
3215
|
nt,
|
|
3280
3216
|
st,
|
|
3281
|
-
|
|
3217
|
+
at
|
|
3282
3218
|
];
|
|
3283
|
-
function $r(n, e, t, r, s,
|
|
3284
|
-
const
|
|
3285
|
-
return n.identity(), n.a = 1 / r * 2, n.d =
|
|
3219
|
+
function $r(n, e, t, r, s, a) {
|
|
3220
|
+
const i = a ? 1 : -1;
|
|
3221
|
+
return n.identity(), n.a = 1 / r * 2, n.d = i * (1 / s * 2), n.tx = -1 - e * n.a, n.ty = -i - t * n.d, n;
|
|
3286
3222
|
}
|
|
3287
3223
|
function jr(n) {
|
|
3288
3224
|
const e = n.colorTexture.source.resource;
|
|
@@ -3290,7 +3226,7 @@ function jr(n) {
|
|
|
3290
3226
|
}
|
|
3291
3227
|
class Xr {
|
|
3292
3228
|
constructor(e) {
|
|
3293
|
-
this.rootViewPort = new
|
|
3229
|
+
this.rootViewPort = new O(), this.viewport = new O(), this.mipLevel = 0, this.layer = 0, this.onRenderTargetChange = new At("onRenderTargetChange"), this.projectionMatrix = new R(), this.defaultClearColor = [0, 0, 0, 0], this._renderSurfaceToRenderTargetHash = /* @__PURE__ */ new Map(), this._gpuRenderTargetHash = /* @__PURE__ */ Object.create(null), this._renderTargetStack = [], this._renderer = e, e.gc.addCollection(this, "_gpuRenderTargetHash", "hash");
|
|
3294
3230
|
}
|
|
3295
3231
|
/** called when dev wants to finish a render pass */
|
|
3296
3232
|
finishRenderPass() {
|
|
@@ -3312,8 +3248,8 @@ class Xr {
|
|
|
3312
3248
|
clear: t,
|
|
3313
3249
|
clearColor: r,
|
|
3314
3250
|
frame: s,
|
|
3315
|
-
mipLevel:
|
|
3316
|
-
layer:
|
|
3251
|
+
mipLevel: a,
|
|
3252
|
+
layer: i
|
|
3317
3253
|
}) {
|
|
3318
3254
|
var o, l;
|
|
3319
3255
|
this._renderTargetStack.length = 0, this.push(
|
|
@@ -3321,8 +3257,8 @@ class Xr {
|
|
|
3321
3257
|
t,
|
|
3322
3258
|
r,
|
|
3323
3259
|
s,
|
|
3324
|
-
|
|
3325
|
-
|
|
3260
|
+
a ?? 0,
|
|
3261
|
+
i ?? 0
|
|
3326
3262
|
), this.rootViewPort.copyFrom(this.viewport), this.rootRenderTarget = this.renderTarget, this.renderingToScreen = jr(this.rootRenderTarget), (l = (o = this.adaptor).prerender) == null || l.call(o, this.rootRenderTarget);
|
|
3327
3263
|
}
|
|
3328
3264
|
postrender() {
|
|
@@ -3354,20 +3290,20 @@ class Xr {
|
|
|
3354
3290
|
* Ignored for surfaces that do not support layers.
|
|
3355
3291
|
* @returns the render target that was bound
|
|
3356
3292
|
*/
|
|
3357
|
-
bind(e, t = !0, r, s,
|
|
3293
|
+
bind(e, t = !0, r, s, a = 0, i = 0) {
|
|
3358
3294
|
const o = this.getRenderTarget(e), l = this.renderTarget !== o;
|
|
3359
3295
|
this.renderTarget = o, this.renderSurface = e;
|
|
3360
3296
|
const d = this.getGpuRenderTarget(o);
|
|
3361
3297
|
(o.pixelWidth !== d.width || o.pixelHeight !== d.height) && (this.adaptor.resizeGpuRenderTarget(o), d.width = o.pixelWidth, d.height = o.pixelHeight);
|
|
3362
3298
|
const f = o.colorTexture, c = this.viewport, x = f.arrayLayerCount || 1;
|
|
3363
|
-
if ((
|
|
3364
|
-
throw new Error(`[RenderTargetSystem] layer ${
|
|
3365
|
-
this.mipLevel =
|
|
3366
|
-
const g = Math.max(f.pixelWidth >>
|
|
3299
|
+
if ((i | 0) !== i && (i |= 0), i < 0 || i >= x)
|
|
3300
|
+
throw new Error(`[RenderTargetSystem] layer ${i} is out of bounds (arrayLayerCount=${x}).`);
|
|
3301
|
+
this.mipLevel = a | 0, this.layer = i | 0;
|
|
3302
|
+
const g = Math.max(f.pixelWidth >> a, 1), m = Math.max(f.pixelHeight >> a, 1);
|
|
3367
3303
|
if (!s && e instanceof S && (s = e.frame), s) {
|
|
3368
|
-
const v = f._resolution, _ = 1 << Math.max(
|
|
3369
|
-
let b = Math.floor(h / _), B = Math.floor(C / _),
|
|
3370
|
-
b = Math.min(Math.max(b, 0), g - 1), B = Math.min(Math.max(B, 0), m - 1),
|
|
3304
|
+
const v = f._resolution, _ = 1 << Math.max(a | 0, 0), h = s.x * v + 0.5 | 0, C = s.y * v + 0.5 | 0, p = s.width * v + 0.5 | 0, y = s.height * v + 0.5 | 0;
|
|
3305
|
+
let b = Math.floor(h / _), B = Math.floor(C / _), V = Math.ceil(p / _), $ = Math.ceil(y / _);
|
|
3306
|
+
b = Math.min(Math.max(b, 0), g - 1), B = Math.min(Math.max(B, 0), m - 1), V = Math.min(Math.max(V, 1), g - b), $ = Math.min(Math.max($, 1), m - B), c.x = b, c.y = B, c.width = V, c.height = $;
|
|
3371
3307
|
} else
|
|
3372
3308
|
c.x = 0, c.y = 0, c.width = g, c.height = m;
|
|
3373
3309
|
return $r(
|
|
@@ -3377,16 +3313,16 @@ class Xr {
|
|
|
3377
3313
|
c.width / f.resolution,
|
|
3378
3314
|
c.height / f.resolution,
|
|
3379
3315
|
!o.isRoot
|
|
3380
|
-
), this.adaptor.startRenderPass(o, t, r, c,
|
|
3316
|
+
), this.adaptor.startRenderPass(o, t, r, c, a, i), l && this.onRenderTargetChange.emit(o), o;
|
|
3381
3317
|
}
|
|
3382
|
-
clear(e, t = Q.ALL, r, s = this.mipLevel,
|
|
3318
|
+
clear(e, t = Q.ALL, r, s = this.mipLevel, a = this.layer) {
|
|
3383
3319
|
t && (e && (e = this.getRenderTarget(e)), this.adaptor.clear(
|
|
3384
3320
|
e || this.renderTarget,
|
|
3385
3321
|
t,
|
|
3386
3322
|
r,
|
|
3387
3323
|
this.viewport,
|
|
3388
3324
|
s,
|
|
3389
|
-
|
|
3325
|
+
a
|
|
3390
3326
|
));
|
|
3391
3327
|
}
|
|
3392
3328
|
contextChange() {
|
|
@@ -3402,13 +3338,13 @@ class Xr {
|
|
|
3402
3338
|
* @param layer - The layer of the render surface to render to. For array textures or cube maps, this specifies
|
|
3403
3339
|
* which layer or face to target. Defaults to 0 (the first layer).
|
|
3404
3340
|
*/
|
|
3405
|
-
push(e, t = Q.ALL, r, s,
|
|
3406
|
-
const o = this.bind(e, t, r, s,
|
|
3341
|
+
push(e, t = Q.ALL, r, s, a = 0, i = 0) {
|
|
3342
|
+
const o = this.bind(e, t, r, s, a, i);
|
|
3407
3343
|
return this._renderTargetStack.push({
|
|
3408
3344
|
renderTarget: o,
|
|
3409
3345
|
frame: s,
|
|
3410
|
-
mipLevel:
|
|
3411
|
-
layer:
|
|
3346
|
+
mipLevel: a,
|
|
3347
|
+
layer: i
|
|
3412
3348
|
}), o;
|
|
3413
3349
|
}
|
|
3414
3350
|
/** Pops the current render target from the renderer and restores the previous render target. */
|
|
@@ -3473,15 +3409,15 @@ class Xr {
|
|
|
3473
3409
|
* @param {number} originDest.x - the x origin of the paste
|
|
3474
3410
|
* @param {number} originDest.y - the y origin of the paste
|
|
3475
3411
|
*/
|
|
3476
|
-
copyToTexture(e, t, r, s,
|
|
3477
|
-
r.x < 0 && (s.width += r.x,
|
|
3478
|
-
const { pixelWidth:
|
|
3479
|
-
return s.width = Math.min(s.width,
|
|
3412
|
+
copyToTexture(e, t, r, s, a) {
|
|
3413
|
+
r.x < 0 && (s.width += r.x, a.x -= r.x, r.x = 0), r.y < 0 && (s.height += r.y, a.y -= r.y, r.y = 0);
|
|
3414
|
+
const { pixelWidth: i, pixelHeight: o } = e;
|
|
3415
|
+
return s.width = Math.min(s.width, i - r.x), s.height = Math.min(s.height, o - r.y), this.adaptor.copyToTexture(
|
|
3480
3416
|
e,
|
|
3481
3417
|
t,
|
|
3482
3418
|
r,
|
|
3483
3419
|
s,
|
|
3484
|
-
|
|
3420
|
+
a
|
|
3485
3421
|
);
|
|
3486
3422
|
}
|
|
3487
3423
|
/**
|
|
@@ -3517,7 +3453,7 @@ class Xr {
|
|
|
3517
3453
|
export {
|
|
3518
3454
|
rt as A,
|
|
3519
3455
|
lt as B,
|
|
3520
|
-
|
|
3456
|
+
at as C,
|
|
3521
3457
|
Je as D,
|
|
3522
3458
|
qr as G,
|
|
3523
3459
|
Xr as R,
|
|
@@ -3526,7 +3462,7 @@ export {
|
|
|
3526
3462
|
Qr as b,
|
|
3527
3463
|
ur as c,
|
|
3528
3464
|
Yr as d,
|
|
3529
|
-
|
|
3465
|
+
Ot as e,
|
|
3530
3466
|
ye as f,
|
|
3531
3467
|
mr as g,
|
|
3532
3468
|
cr as h,
|
|
@@ -3537,7 +3473,7 @@ export {
|
|
|
3537
3473
|
Sr as m,
|
|
3538
3474
|
tt as n,
|
|
3539
3475
|
ot as o,
|
|
3540
|
-
|
|
3476
|
+
it as p,
|
|
3541
3477
|
_r as r
|
|
3542
3478
|
};
|
|
3543
|
-
//# sourceMappingURL=RenderTargetSystem-
|
|
3479
|
+
//# sourceMappingURL=RenderTargetSystem-Bl4mRBf3.js.map
|