modern-canvas 0.23.0 → 0.23.2
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/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Observable as e, RawWeakMap as t, Reactivable as n, clearUndef as r, defineProperty as i, getDefaultLayoutStyle as a, getDefaultStyle as o, getDefaultTextStyle as s, idGenerator as c, isColorFillObject as l, isGradient as u, isNone as d, normalizeBackground as f, normalizeChart as p, normalizeConnection as m, normalizeFill as h, normalizeForeground as g, normalizeOutline as ee, normalizeShadow as te, normalizeShape as ne, normalizeTable as re, normalizeText as ie, normalizeTextContent as ae, parseColor as oe, property as _ } from "modern-idoc";
|
|
2
|
-
import { BoundingBox as
|
|
3
|
-
import { extend as
|
|
4
|
-
import
|
|
5
|
-
import { fonts as
|
|
6
|
-
import { Character as
|
|
1
|
+
import { Observable as e, RawWeakMap as t, Reactivable as n, clearUndef as r, defineProperty as i, getDefaultLayoutStyle as a, getDefaultStyle as o, getDefaultTextStyle as s, idGenerator as c, isColorFillObject as l, isGradient as u, isNone as d, normalizeBackground as f, normalizeChart as p, normalizeConnection as m, normalizeFill as h, normalizeForeground as g, normalizeOutline as ee, normalizeShadow as te, normalizeShape as ne, normalizeTable as re, normalizeText as ie, normalizeTextContent as ae, parseColor as oe, property as _, stringifyFilter as se } from "modern-idoc";
|
|
2
|
+
import { BoundingBox as ce, Path2D as le, Path2DSet as ue, Transform2D as v, Vector2 as y, svgToDom as de, svgToPath2DSet as fe } from "modern-path2d";
|
|
3
|
+
import { extend as pe } from "colord";
|
|
4
|
+
import me from "colord/plugins/names";
|
|
5
|
+
import { fonts as he } from "modern-font";
|
|
6
|
+
import { Character as ge, Text as _e } from "modern-text";
|
|
7
7
|
//#region src/core/decorators/customNode.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
8
|
+
var ve = /* @__PURE__ */ new Map();
|
|
9
|
+
function b(e, t) {
|
|
10
10
|
return function(n) {
|
|
11
11
|
Object.defineProperty(n.prototype, "is", {
|
|
12
12
|
value: e,
|
|
@@ -14,19 +14,19 @@ function x(e, t) {
|
|
|
14
14
|
configurable: !0
|
|
15
15
|
}), t && Object.keys(t).forEach((e) => {
|
|
16
16
|
i(n, e, { fallback: t[e] });
|
|
17
|
-
}),
|
|
17
|
+
}), ve.set(e, n);
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/core/global/createNode.ts
|
|
22
|
-
function
|
|
23
|
-
let n =
|
|
22
|
+
function ye(e = "node", t = {}) {
|
|
23
|
+
let n = ve.get(e);
|
|
24
24
|
if (!n) throw Error(`Failed to createNode, tag: ${e}`);
|
|
25
25
|
return new n().setProperties(t);
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/core/global/Ticker.ts
|
|
29
|
-
var
|
|
29
|
+
var x = class {
|
|
30
30
|
static _queue = [];
|
|
31
31
|
static _currentTime = 0;
|
|
32
32
|
static _elapsed = 0;
|
|
@@ -83,12 +83,12 @@ var S = class {
|
|
|
83
83
|
this._queue = t;
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
x.start();
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/core/global/nextTick.ts
|
|
89
|
-
async function
|
|
89
|
+
async function be(e) {
|
|
90
90
|
return new Promise((t) => {
|
|
91
|
-
|
|
91
|
+
x.on(() => {
|
|
92
92
|
e?.(), t();
|
|
93
93
|
}, {
|
|
94
94
|
sort: 1,
|
|
@@ -98,14 +98,14 @@ async function ve(e) {
|
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/core/shared/utils.ts
|
|
101
|
-
var
|
|
102
|
-
function
|
|
101
|
+
var xe = Math.PI, Se = xe * 2;
|
|
102
|
+
function Ce(e) {
|
|
103
103
|
return !(e & e - 1) && !!e;
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/core/shared/css.ts
|
|
107
|
-
var
|
|
108
|
-
function
|
|
107
|
+
var we = /([\w-]+)\((.+?)\)/g, Te = /[^,]+/g, Ee = /([-e.\d]+)(.*)/;
|
|
108
|
+
function De(e) {
|
|
109
109
|
return Array.isArray(e) ? e.map((e) => ({
|
|
110
110
|
name: e.name,
|
|
111
111
|
args: e.args.map((e) => ({
|
|
@@ -117,31 +117,31 @@ function Te(e) {
|
|
|
117
117
|
normalizedIntValue: e.normalizedDefaultIntValue
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
let r =
|
|
122
|
-
return r.length ? r :
|
|
120
|
+
function Oe(e, t, n = {}) {
|
|
121
|
+
let r = ke(t, n);
|
|
122
|
+
return r.length ? r : je(e, t, n);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function ke(e, t = {}) {
|
|
125
125
|
let n = [], r;
|
|
126
|
-
for (; (r =
|
|
126
|
+
for (; (r = we.exec(e)) !== null;) {
|
|
127
127
|
let [, e, i] = r;
|
|
128
128
|
e && n.push({
|
|
129
129
|
name: e,
|
|
130
|
-
args:
|
|
130
|
+
args: Ae(e, i, t)
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
return n;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Ae(e, t, n = {}) {
|
|
136
136
|
let r = [], i, a = 0;
|
|
137
|
-
for (; (i =
|
|
137
|
+
for (; (i = Te.exec(t)) !== null;) r.push(je(e, i[0], {
|
|
138
138
|
...n,
|
|
139
139
|
index: a++
|
|
140
140
|
}));
|
|
141
141
|
return r;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
let { width: r = 1, height: i = 1, index: a = 0 } = n, o = t.match(
|
|
143
|
+
function je(e, t, n = {}) {
|
|
144
|
+
let { width: r = 1, height: i = 1, index: a = 0 } = n, o = t.match(Ee), s = {
|
|
145
145
|
unit: o?.[2] ?? null,
|
|
146
146
|
value: t,
|
|
147
147
|
intValue: Number(o?.[1]),
|
|
@@ -161,7 +161,7 @@ function ke(e, t, n = {}) {
|
|
|
161
161
|
s.normalizedIntValue = s.intValue / 100;
|
|
162
162
|
break;
|
|
163
163
|
case "rad":
|
|
164
|
-
s.normalizedIntValue = s.intValue /
|
|
164
|
+
s.normalizedIntValue = s.intValue / Se;
|
|
165
165
|
break;
|
|
166
166
|
case "deg":
|
|
167
167
|
s.normalizedIntValue = s.intValue / 360;
|
|
@@ -184,48 +184,48 @@ function ke(e, t, n = {}) {
|
|
|
184
184
|
}
|
|
185
185
|
//#endregion
|
|
186
186
|
//#region src/core/shared/dom.ts
|
|
187
|
-
var
|
|
188
|
-
function
|
|
187
|
+
var Me = "WebGL2RenderingContext" in globalThis, Ne = "ImageBitmap" in globalThis, Pe = "ResizeObserver" in globalThis, Fe = "PointerEvent" in globalThis, Ie = "WheelEvent" in globalThis, Le = "MouseEvent" in globalThis, Re = "ontouchstart" in globalThis, ze = "onclick" in globalThis, Be = "createImageBitmap" in globalThis, Ve = "AudioContext" in globalThis, He = "webkitAudioContext" in globalThis, Ue = "OfflineAudioContext" in globalThis, We = "webkitOfflineAudioContext" in globalThis, Ge = Ve || He, Ke = typeof window < "u", qe = typeof navigator < "u" && navigator?.userAgent?.indexOf("Mac") >= 0, Je = globalThis.devicePixelRatio || 1, Ye = (e) => typeof e == "object" && !!e && e.nodeType === 1, Xe = (e) => Ye(e) && e.tagName === "VIDEO", Ze = (e) => Ye(e) && e.tagName === "IMG";
|
|
188
|
+
function Qe(e) {
|
|
189
189
|
return typeof e == "object" && !!e && e.nodeType === 1 && e.tagName === "CANVAS";
|
|
190
190
|
}
|
|
191
|
-
function Ze(e) {
|
|
192
|
-
return Ae && e instanceof globalThis.WebGL2RenderingContext;
|
|
193
|
-
}
|
|
194
|
-
var Qe;
|
|
195
191
|
function $e(e) {
|
|
196
|
-
|
|
192
|
+
return Me && e instanceof globalThis.WebGL2RenderingContext;
|
|
197
193
|
}
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
var et;
|
|
195
|
+
function tt(e) {
|
|
196
|
+
et = e;
|
|
200
197
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
tt = e;
|
|
198
|
+
function nt() {
|
|
199
|
+
return et;
|
|
204
200
|
}
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
var rt;
|
|
202
|
+
function it(e) {
|
|
203
|
+
rt = e;
|
|
207
204
|
}
|
|
208
|
-
function
|
|
205
|
+
function at() {
|
|
206
|
+
return rt;
|
|
207
|
+
}
|
|
208
|
+
function S(e, t) {
|
|
209
209
|
let n;
|
|
210
|
-
return
|
|
210
|
+
return et ? n = et(e, t) : Ke && (n = globalThis.document.createElement("canvas")), n && (e !== void 0 && (n.width = e), t !== void 0 && (n.height = t)), n;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function ot(e, t = globalThis.location) {
|
|
213
213
|
if (e.startsWith("data:") || !t || typeof document > "u") return "";
|
|
214
214
|
let n = new URL(e, document.baseURI);
|
|
215
215
|
return n.hostname !== t.hostname || n.port !== t.port || n.protocol !== t.protocol ? "anonymous" : "";
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
n === null && !t.startsWith("data:") ? e.crossOrigin =
|
|
217
|
+
function st(e, t, n) {
|
|
218
|
+
n === null && !t.startsWith("data:") ? e.crossOrigin = ot(t) : n !== !1 && (e.crossOrigin = typeof n == "string" ? n : "anonymous");
|
|
219
219
|
}
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region src/core/shared/id.ts
|
|
222
|
-
var
|
|
223
|
-
function
|
|
224
|
-
return ++
|
|
222
|
+
var ct = 0;
|
|
223
|
+
function lt() {
|
|
224
|
+
return ++ct;
|
|
225
225
|
}
|
|
226
226
|
//#endregion
|
|
227
227
|
//#region src/core/input/InputEvent.ts
|
|
228
|
-
var
|
|
228
|
+
var ut = class e {
|
|
229
229
|
cursor;
|
|
230
230
|
bubbles = !1;
|
|
231
231
|
cancelBubble = !1;
|
|
@@ -260,14 +260,14 @@ var lt = class e {
|
|
|
260
260
|
initUIEvent(...e) {
|
|
261
261
|
throw Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, dt = class extends ut {
|
|
264
264
|
getModifierState(...e) {
|
|
265
265
|
throw Error("getModifierState() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
266
266
|
}
|
|
267
267
|
initKeyboardEvent(...e) {
|
|
268
268
|
throw Error("initKeyboardEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
269
269
|
}
|
|
270
|
-
},
|
|
270
|
+
}, ft = class extends ut {
|
|
271
271
|
client = {
|
|
272
272
|
x: 0,
|
|
273
273
|
y: 0
|
|
@@ -350,7 +350,7 @@ var lt = class e {
|
|
|
350
350
|
get globalY() {
|
|
351
351
|
return this.global.y;
|
|
352
352
|
}
|
|
353
|
-
},
|
|
353
|
+
}, pt = class extends ft {
|
|
354
354
|
width = 0;
|
|
355
355
|
height = 0;
|
|
356
356
|
isPrimary = !1;
|
|
@@ -360,20 +360,20 @@ var lt = class e {
|
|
|
360
360
|
getPredictedEvents() {
|
|
361
361
|
throw Error("getPredictedEvents is not supported!");
|
|
362
362
|
}
|
|
363
|
-
},
|
|
363
|
+
}, mt = class extends ft {
|
|
364
364
|
static DOM_DELTA_PIXEL = 0;
|
|
365
365
|
DOM_DELTA_PIXEL = 0;
|
|
366
366
|
static DOM_DELTA_LINE = 1;
|
|
367
367
|
DOM_DELTA_LINE = 1;
|
|
368
368
|
static DOM_DELTA_PAGE = 2;
|
|
369
369
|
DOM_DELTA_PAGE = 2;
|
|
370
|
-
},
|
|
370
|
+
}, ht = {
|
|
371
371
|
touchstart: "pointerdown",
|
|
372
372
|
touchend: "pointerup",
|
|
373
373
|
touchendoutside: "pointerupoutside",
|
|
374
374
|
touchmove: "pointermove",
|
|
375
375
|
touchcancel: "pointercancel"
|
|
376
|
-
},
|
|
376
|
+
}, gt = class extends e {
|
|
377
377
|
event;
|
|
378
378
|
target;
|
|
379
379
|
cursor = "default";
|
|
@@ -391,21 +391,21 @@ var lt = class e {
|
|
|
391
391
|
removeEventListeners() {
|
|
392
392
|
if (!this.setuped || !this.target) return;
|
|
393
393
|
let e = this.target.style;
|
|
394
|
-
globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "", e.msTouchAction = "") :
|
|
394
|
+
globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "", e.msTouchAction = "") : Fe && (e.touchAction = ""), Fe ? (this.target.removeEventListener("pointerdown", this._onPointerDown), this.target.removeEventListener("pointerleave", this._onPointerOver), this.target.removeEventListener("pointerover", this._onPointerOver), this.target.removeEventListener("pointermove", this._onPointerMove), this.target.removeEventListener("pointerup", this._onPointerUp)) : (this.target.removeEventListener("mousedown", this._onPointerDown), this.target.removeEventListener("mouseout", this._onPointerOver), this.target.removeEventListener("mouseover", this._onPointerOver), this.target.removeEventListener("mousemove", this._onPointerMove), this.target.removeEventListener("mouseup", this._onPointerUp)), Re && (this.target.removeEventListener("touchstart", this._onPointerDown), this.target.removeEventListener("touchmove", this._onPointerMove), this.target.removeEventListener("touchend", this._onPointerUp)), this.target.removeEventListener("wheel", this._onWheel), typeof document < "u" && (document.removeEventListener("keydown", this._onKeyDown), document.removeEventListener("keypress", this._onKeyPress), document.removeEventListener("keyup", this._onKeyUp)), this.target = void 0, this.setuped = !1;
|
|
395
395
|
}
|
|
396
396
|
addEventListeners() {
|
|
397
397
|
if (this.setuped || !this.target) return;
|
|
398
398
|
let e = this.target.style;
|
|
399
|
-
e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "none", e.msTouchAction = "none") :
|
|
399
|
+
e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "none", e.msTouchAction = "none") : Fe && (e.touchAction = "none")), Fe ? (this.target.addEventListener("pointerdown", this._onPointerDown), this.target.addEventListener("pointerleave", this._onPointerOver), this.target.addEventListener("pointerover", this._onPointerOver), this.target.addEventListener("pointermove", this._onPointerMove), this.target.addEventListener("pointerup", this._onPointerUp)) : (this.target.addEventListener("mousedown", this._onPointerDown), this.target.addEventListener("mouseout", this._onPointerOver), this.target.addEventListener("mouseover", this._onPointerOver), this.target.addEventListener("mousemove", this._onPointerMove), this.target.addEventListener("mouseup", this._onPointerUp)), Re && (this.target.addEventListener("touchstart", this._onPointerDown), this.target.addEventListener("touchmove", this._onPointerMove), this.target.addEventListener("touchend", this._onPointerUp)), this.target.addEventListener("wheel", this._onWheel), typeof document < "u" && (document.addEventListener("keydown", this._onKeyDown), document.addEventListener("keypress", this._onKeyPress), document.addEventListener("keyup", this._onKeyUp)), this.setuped = !0;
|
|
400
400
|
}
|
|
401
401
|
normalize(e) {
|
|
402
402
|
let t = [];
|
|
403
|
-
if (
|
|
403
|
+
if (Re && e instanceof globalThis.TouchEvent) for (let n = 0, r = e.changedTouches.length; n < r; n++) {
|
|
404
404
|
let r = e.changedTouches[n];
|
|
405
405
|
r.button === void 0 && (r.button = 0), r.buttons === void 0 && (r.buttons = 1), r.isPrimary === void 0 && (r.isPrimary = e.touches.length === 1 && e.type === "touchstart"), r.width === void 0 && (r.width = r.radiusX || 1), r.height === void 0 && (r.height = r.radiusY || 1), r.tiltX === void 0 && (r.tiltX = 0), r.tiltY === void 0 && (r.tiltY = 0), r.pointerType === void 0 && (r.pointerType = "touch"), r.pointerId === void 0 && (r.pointerId = r.identifier || 0), r.pressure === void 0 && (r.pressure = r.force || .5), r.twist === void 0 && (r.twist = 0), r.tangentialPressure === void 0 && (r.tangentialPressure = 0), r.layerX === void 0 && (r.layerX = r.offsetX = r.clientX), r.layerY === void 0 && (r.layerY = r.offsetY = r.clientY), r.type = e.type, t.push(r);
|
|
406
406
|
}
|
|
407
|
-
else if (
|
|
408
|
-
else if (
|
|
407
|
+
else if (Ie && e instanceof globalThis.WheelEvent) t.push(e);
|
|
408
|
+
else if (Fe && e instanceof globalThis.PointerEvent) t.push(e);
|
|
409
409
|
else {
|
|
410
410
|
let n = e;
|
|
411
411
|
n.isPrimary === void 0 && (n.isPrimary = !0), n.width === void 0 && (n.width = 1), n.height === void 0 && (n.height = 1), n.tiltX === void 0 && (n.tiltX = 0), n.tiltY === void 0 && (n.tiltY = 0), n.pointerType === void 0 && (n.pointerType = "mouse"), n.pointerId === void 0 && (n.pointerId = 1), n.pressure === void 0 && (n.pressure = .5), n.twist === void 0 && (n.twist = 0), n.tangentialPressure === void 0 && (n.tangentialPressure = 0), t.push(n);
|
|
@@ -413,8 +413,8 @@ var lt = class e {
|
|
|
413
413
|
return t;
|
|
414
414
|
}
|
|
415
415
|
_clonePointerEvent(e) {
|
|
416
|
-
let t = new
|
|
417
|
-
return t.nativeEvent = e, t.pointerId = e.pointerId, t.width = e.width, t.height = e.height, t.isPrimary = e.isPrimary, t.pointerType = e.pointerType, t.pressure = e.pressure, t.tangentialPressure = e.tangentialPressure, t.tiltX = e.tiltX, t.tiltY = e.tiltY, t.twist = e.twist, t.isTrusted = e.isTrusted, this._copyMouseEvent(t, e), this.mapPositionToPoint(t.screen, e.clientX, e.clientY), t.global.x = t.screen.x, t.global.y = t.screen.y, t.offset.x = t.screen.x, t.offset.y = t.screen.y, t.type === "pointerleave" ? t.type = "pointerout" : t.type.startsWith("mouse") ? t.type = t.type.replace("mouse", "pointer") : t.type.startsWith("touch") && (t.type =
|
|
416
|
+
let t = new pt();
|
|
417
|
+
return t.nativeEvent = e, t.pointerId = e.pointerId, t.width = e.width, t.height = e.height, t.isPrimary = e.isPrimary, t.pointerType = e.pointerType, t.pressure = e.pressure, t.tangentialPressure = e.tangentialPressure, t.tiltX = e.tiltX, t.tiltY = e.tiltY, t.twist = e.twist, t.isTrusted = e.isTrusted, this._copyMouseEvent(t, e), this.mapPositionToPoint(t.screen, e.clientX, e.clientY), t.global.x = t.screen.x, t.global.y = t.screen.y, t.offset.x = t.screen.x, t.offset.y = t.screen.y, t.type === "pointerleave" ? t.type = "pointerout" : t.type.startsWith("mouse") ? t.type = t.type.replace("mouse", "pointer") : t.type.startsWith("touch") && (t.type = ht[t.type] || t.type), t;
|
|
418
418
|
}
|
|
419
419
|
_copyInputEvent(e, t) {
|
|
420
420
|
e.nativeEvent = t, e.bubbles = t.bubbles, e.cancelBubble = t.cancelBubble, e.cancelable = t.cancelable, e.composed = t.composed, e.currentTarget = t.currentTarget, e.defaultPrevented = t.defaultPrevented, e.eventPhase = t.eventPhase, e.isTrusted = t.isTrusted, e.returnValue = t.returnValue, e.srcElement = t.srcElement, e.timeStamp = t.timeStamp, e.type = t.type;
|
|
@@ -423,11 +423,11 @@ var lt = class e {
|
|
|
423
423
|
this._copyInputEvent(e, t), e.altKey = t.altKey, e.button = t.button, e.buttons = t.buttons, e.client.x = t.clientX, e.client.y = t.clientY, e.ctrlKey = t.ctrlKey, e.metaKey = t.metaKey, e.movement.x = t.movementX, e.movement.y = t.movementY, e.page.x = t.pageX, e.page.y = t.pageY, e.relatedTarget = null, e.shiftKey = t.shiftKey;
|
|
424
424
|
}
|
|
425
425
|
_cloneWheelEvent(e) {
|
|
426
|
-
let t = new
|
|
426
|
+
let t = new mt();
|
|
427
427
|
return this._copyMouseEvent(t, e), t.wheelDeltaY = e.wheelDeltaY, t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ, t.deltaMode = e.deltaMode, this.mapPositionToPoint(t.screen, e.clientX, e.clientY), t.global.x = t.screen.x, t.global.y = t.screen.y, t.offset.x = t.screen.x, t.offset.y = t.screen.y, t;
|
|
428
428
|
}
|
|
429
429
|
_cloneKeyboardEvent(e) {
|
|
430
|
-
let t = new
|
|
430
|
+
let t = new dt();
|
|
431
431
|
return this._copyInputEvent(t, e), t.altKey = e.altKey, t.charCode = e.charCode, t.code = e.code, t.ctrlKey = e.ctrlKey, t.isComposing = e.isComposing, t.key = e.key, t.keyCode = e.keyCode, t.location = e.location, t.metaKey = e.metaKey, t.repeat = e.repeat, t.shiftKey = e.shiftKey, t;
|
|
432
432
|
}
|
|
433
433
|
setCursor(e = "default") {
|
|
@@ -475,25 +475,25 @@ var lt = class e {
|
|
|
475
475
|
this.event?.cursor && this.setCursor(this.event.cursor);
|
|
476
476
|
};
|
|
477
477
|
_onPointerDown = (e) => {
|
|
478
|
-
if (
|
|
478
|
+
if (Re && e.pointerType === "touch") return;
|
|
479
479
|
let t = this.normalize(e);
|
|
480
480
|
for (let e = 0, n = t.length; e < n; e++) this.emit("pointerdown", this.event = this._clonePointerEvent(t[e]));
|
|
481
481
|
this.event?.cursor && this.setCursor(this.event.cursor);
|
|
482
482
|
};
|
|
483
483
|
_onPointerOver = (e) => {
|
|
484
|
-
if (!this.enableClickEvent ||
|
|
484
|
+
if (!this.enableClickEvent || Re && e.pointerType === "touch") return;
|
|
485
485
|
let t = this.normalize(e);
|
|
486
486
|
for (let e = 0, n = t.length; e < n; e++) this.emit("pointerover", this.event = this._clonePointerEvent(t[e]));
|
|
487
487
|
this.event?.cursor && this.setCursor(this.event.cursor);
|
|
488
488
|
};
|
|
489
489
|
_onPointerMove = (e) => {
|
|
490
|
-
if (!this.enableMoveEvent ||
|
|
490
|
+
if (!this.enableMoveEvent || Re && e.pointerType === "touch") return;
|
|
491
491
|
let t = this.normalize(e);
|
|
492
492
|
for (let e = 0, n = t.length; e < n; e++) this.emit("pointermove", this.event = this._clonePointerEvent(t[e]));
|
|
493
493
|
this.event?.cursor && this.setCursor(this.event.cursor);
|
|
494
494
|
};
|
|
495
495
|
_onPointerUp = (e) => {
|
|
496
|
-
if (!this.enableClickEvent ||
|
|
496
|
+
if (!this.enableClickEvent || Re && e.pointerType === "touch") return;
|
|
497
497
|
let t = e.target;
|
|
498
498
|
e.composedPath && e.composedPath().length > 0 && (t = e.composedPath()[0]);
|
|
499
499
|
let n = t === this.target ? "" : "outside", r = this.normalize(e);
|
|
@@ -513,7 +513,7 @@ var lt = class e {
|
|
|
513
513
|
this.removeEventListeners(), super.destroy();
|
|
514
514
|
}
|
|
515
515
|
}, C = class extends n {
|
|
516
|
-
instanceId =
|
|
516
|
+
instanceId = lt();
|
|
517
517
|
destroyed = !1;
|
|
518
518
|
get json() {
|
|
519
519
|
return this.toJSON();
|
|
@@ -522,7 +522,7 @@ var lt = class e {
|
|
|
522
522
|
this.setProperties(e);
|
|
523
523
|
}
|
|
524
524
|
_nextTick() {
|
|
525
|
-
return
|
|
525
|
+
return be();
|
|
526
526
|
}
|
|
527
527
|
equal(e) {
|
|
528
528
|
return !!(e && this.instanceId === e.instanceId);
|
|
@@ -531,7 +531,7 @@ var lt = class e {
|
|
|
531
531
|
destroy() {
|
|
532
532
|
this.destroyed || (this.destroyed = !0, this._destroy(), this.emit("destroy"), this.removeAllListeners());
|
|
533
533
|
}
|
|
534
|
-
},
|
|
534
|
+
}, _t = class extends C {}, w = class extends _t {}, vt = class e {
|
|
535
535
|
get x() {
|
|
536
536
|
return this.min.x;
|
|
537
537
|
}
|
|
@@ -664,7 +664,7 @@ var lt = class e {
|
|
|
664
664
|
};
|
|
665
665
|
//#endregion
|
|
666
666
|
//#region src/core/math/Color.ts
|
|
667
|
-
|
|
667
|
+
pe([me]);
|
|
668
668
|
var T = class {
|
|
669
669
|
get value() {
|
|
670
670
|
return this._value;
|
|
@@ -748,8 +748,8 @@ var T = class {
|
|
|
748
748
|
this.a
|
|
749
749
|
];
|
|
750
750
|
}
|
|
751
|
-
},
|
|
752
|
-
function
|
|
751
|
+
}, yt = xe / 180, bt = 180 / xe;
|
|
752
|
+
function xt(e, t, n) {
|
|
753
753
|
return Math.max(t, Math.min(e, n));
|
|
754
754
|
}
|
|
755
755
|
function E(e, t, n) {
|
|
@@ -757,7 +757,7 @@ function E(e, t, n) {
|
|
|
757
757
|
}
|
|
758
758
|
//#endregion
|
|
759
759
|
//#region src/core/math/ColorMatrix.ts
|
|
760
|
-
var
|
|
760
|
+
var St = class {
|
|
761
761
|
_array = new Float32Array(20);
|
|
762
762
|
constructor() {
|
|
763
763
|
this.identity();
|
|
@@ -912,7 +912,7 @@ var xt = class {
|
|
|
912
912
|
]);
|
|
913
913
|
}
|
|
914
914
|
sepia(e = 1) {
|
|
915
|
-
let t =
|
|
915
|
+
let t = xt(e, 0, 1);
|
|
916
916
|
return this.multiply([
|
|
917
917
|
E(1, .393, t),
|
|
918
918
|
E(0, .7689999, t),
|
|
@@ -961,7 +961,7 @@ var xt = class {
|
|
|
961
961
|
]);
|
|
962
962
|
}
|
|
963
963
|
grayscale(e = 1) {
|
|
964
|
-
let t =
|
|
964
|
+
let t = xt(e, 0, 1), n = E(1, .3, t), r = E(0, .3, t), i = E(1, .59, t), a = E(0, .59, t), o = E(1, .11, t), s = E(0, .11, t);
|
|
965
965
|
return this.multiply([
|
|
966
966
|
n,
|
|
967
967
|
a,
|
|
@@ -1013,10 +1013,10 @@ var xt = class {
|
|
|
1013
1013
|
toArray() {
|
|
1014
1014
|
return this._array;
|
|
1015
1015
|
}
|
|
1016
|
-
},
|
|
1016
|
+
}, Ct = class e extends vt {
|
|
1017
1017
|
rotation;
|
|
1018
1018
|
get rotationDegrees() {
|
|
1019
|
-
return this.rotation /
|
|
1019
|
+
return this.rotation / yt;
|
|
1020
1020
|
}
|
|
1021
1021
|
constructor(...e) {
|
|
1022
1022
|
let t, n;
|
|
@@ -1026,7 +1026,7 @@ var xt = class {
|
|
|
1026
1026
|
if (!this.rotation && (!("rotation" in e) || !e.rotation)) return super.overlap(e, t);
|
|
1027
1027
|
{
|
|
1028
1028
|
let t = (e, t) => Math.abs(e.x * t.x + e.y * t.y), n = (e) => {
|
|
1029
|
-
let { width: n, height: r, rotation: i = 0 } = e, a = i /
|
|
1029
|
+
let { width: n, height: r, rotation: i = 0 } = e, a = i / yt;
|
|
1030
1030
|
a = -a % 180;
|
|
1031
1031
|
let o = a / 180 * Math.PI, s = {
|
|
1032
1032
|
x: Math.cos(o),
|
|
@@ -1068,7 +1068,7 @@ var xt = class {
|
|
|
1068
1068
|
clone() {
|
|
1069
1069
|
return new e(this.toJSON());
|
|
1070
1070
|
}
|
|
1071
|
-
},
|
|
1071
|
+
}, wt = class {
|
|
1072
1072
|
_array;
|
|
1073
1073
|
x = 0;
|
|
1074
1074
|
y = 0;
|
|
@@ -1105,7 +1105,7 @@ function O(e, t, n, r) {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
//#endregion
|
|
1107
1107
|
//#region src/core/os/MainLoop.ts
|
|
1108
|
-
var
|
|
1108
|
+
var Tt = class extends C {
|
|
1109
1109
|
_starting = !1;
|
|
1110
1110
|
_nextDeltaTime = 0;
|
|
1111
1111
|
_startedProcess;
|
|
@@ -1119,13 +1119,13 @@ var wt = class extends C {
|
|
|
1119
1119
|
super(), this._onTicker = this._onTicker.bind(this), this.setProperties(e);
|
|
1120
1120
|
}
|
|
1121
1121
|
start(e) {
|
|
1122
|
-
this._starting || (this._starting = !0, this._startedProcess && this.off("process", this._startedProcess), this._startedProcess = e, this.on("process", e),
|
|
1122
|
+
this._starting || (this._starting = !0, this._startedProcess && this.off("process", this._startedProcess), this._startedProcess = e, this.on("process", e), x.on(this._onTicker, { sort: 0 }));
|
|
1123
1123
|
}
|
|
1124
1124
|
stop() {
|
|
1125
|
-
this._starting && (this._starting = !1,
|
|
1125
|
+
this._starting && (this._starting = !1, x.off(this._onTicker, { sort: 0 }));
|
|
1126
1126
|
}
|
|
1127
1127
|
_onTicker() {
|
|
1128
|
-
let e =
|
|
1128
|
+
let e = x.elapsed * this.speed;
|
|
1129
1129
|
if ((this._nextDeltaTime -= e) <= 0) {
|
|
1130
1130
|
let t = (this._nextDeltaTime = this.spf) || e;
|
|
1131
1131
|
this.emit("process", t);
|
|
@@ -1135,14 +1135,14 @@ var wt = class extends C {
|
|
|
1135
1135
|
super._destroy(), this.stop();
|
|
1136
1136
|
}
|
|
1137
1137
|
};
|
|
1138
|
-
O([_({ fallback: 60 }), D("design:type", Number)],
|
|
1138
|
+
O([_({ fallback: 60 }), D("design:type", Number)], Tt.prototype, "fps", void 0), O([_({ fallback: 1 }), D("design:type", Number)], Tt.prototype, "speed", void 0);
|
|
1139
1139
|
//#endregion
|
|
1140
1140
|
//#region src/core/renderers/gl/buffer/const.ts
|
|
1141
|
-
var
|
|
1141
|
+
var Et = /* @__PURE__ */ function(e) {
|
|
1142
1142
|
return e[e.elementArrayBuffer = 34963] = "elementArrayBuffer", e[e.arrayBuffer = 34962] = "arrayBuffer", e[e.uniformBuffer = 35345] = "uniformBuffer", e;
|
|
1143
|
-
}({}),
|
|
1143
|
+
}({}), Dt = class {
|
|
1144
1144
|
native;
|
|
1145
|
-
target =
|
|
1145
|
+
target = Et.arrayBuffer;
|
|
1146
1146
|
byteLength = 0;
|
|
1147
1147
|
dirty = !0;
|
|
1148
1148
|
constructor(e) {
|
|
@@ -1150,7 +1150,7 @@ var Tt = /* @__PURE__ */ function(e) {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
}, k = /* @__PURE__ */ function(e) {
|
|
1152
1152
|
return e[e.mapRead = 1] = "mapRead", e[e.mapWrite = 2] = "mapWrite", e[e.copySrc = 4] = "copySrc", e[e.copyDst = 8] = "copyDst", e[e.index = 16] = "index", e[e.vertex = 32] = "vertex", e[e.uniform = 64] = "uniform", e[e.storage = 128] = "storage", e[e.indirect = 256] = "indirect", e[e.queryResolve = 512] = "queryResolve", e[e.static = 1024] = "static", e;
|
|
1153
|
-
}({}),
|
|
1153
|
+
}({}), Ot = class extends n {
|
|
1154
1154
|
screen = {
|
|
1155
1155
|
x: 0,
|
|
1156
1156
|
y: 0,
|
|
@@ -1169,12 +1169,12 @@ var Tt = /* @__PURE__ */ function(e) {
|
|
|
1169
1169
|
this.view && (this.view.width = Math.floor(e * this.pixelRatio), this.view.height = Math.floor(t * this.pixelRatio)), this.screen.width = e, this.screen.height = t, n && this.view && (this.view.style.width = `${e}px`, this.view.style.height = `${t}px`);
|
|
1170
1170
|
}
|
|
1171
1171
|
};
|
|
1172
|
-
O([_({ fallback:
|
|
1172
|
+
O([_({ fallback: Je }), D("design:type", Number)], Ot.prototype, "pixelRatio", void 0), O([_({ internal: !0 }), D("design:type", typeof HTMLCanvasElement > "u" ? Object : HTMLCanvasElement)], Ot.prototype, "view", void 0);
|
|
1173
1173
|
//#endregion
|
|
1174
1174
|
//#region src/core/renderers/shared/shader/UniformGroup.ts
|
|
1175
|
-
var
|
|
1175
|
+
var kt = 0, At = class {
|
|
1176
1176
|
isUniformGroup = !0;
|
|
1177
|
-
uid = ++
|
|
1177
|
+
uid = ++kt;
|
|
1178
1178
|
uniforms;
|
|
1179
1179
|
ubo;
|
|
1180
1180
|
isStatic;
|
|
@@ -1185,10 +1185,10 @@ var Ot = 0, kt = class {
|
|
|
1185
1185
|
update() {
|
|
1186
1186
|
this._dirtyId++;
|
|
1187
1187
|
}
|
|
1188
|
-
},
|
|
1189
|
-
function
|
|
1190
|
-
let n =
|
|
1191
|
-
return n === void 0 && (
|
|
1188
|
+
}, jt = Object.create(null), Mt = Object.create(null);
|
|
1189
|
+
function Nt(e, t) {
|
|
1190
|
+
let n = Mt[e];
|
|
1191
|
+
return n === void 0 && (jt[t] === void 0 && (jt[t] = 1), Mt[e] = n = jt[t]++), n;
|
|
1192
1192
|
}
|
|
1193
1193
|
//#endregion
|
|
1194
1194
|
//#region src/core/renderers/gl/system/GlSystem.ts
|
|
@@ -1206,7 +1206,7 @@ var A = class extends e {
|
|
|
1206
1206
|
_setup() {}
|
|
1207
1207
|
flush() {}
|
|
1208
1208
|
reset() {}
|
|
1209
|
-
},
|
|
1209
|
+
}, Pt = class extends A {
|
|
1210
1210
|
install(e) {
|
|
1211
1211
|
super.install(e), e.buffer = this;
|
|
1212
1212
|
}
|
|
@@ -1216,8 +1216,8 @@ var A = class extends e {
|
|
|
1216
1216
|
return this.glBuffers.get(e.instanceId) || this._createGlBuffer(e);
|
|
1217
1217
|
}
|
|
1218
1218
|
_createGlBuffer(e) {
|
|
1219
|
-
let t = this._gl, n = new
|
|
1220
|
-
return e.usage & k.index ? r =
|
|
1219
|
+
let t = this._gl, n = new Dt(t.createBuffer()), r = Et.arrayBuffer;
|
|
1220
|
+
return e.usage & k.index ? r = Et.elementArrayBuffer : e.usage & k.uniform && (r = Et.uniformBuffer), n.target = r, this.glBuffers.set(e.instanceId, n), this.buffers.get(e.instanceId) || ("on" in e && (e.on("updateProperty", (e) => {
|
|
1221
1221
|
switch (e) {
|
|
1222
1222
|
case "usage":
|
|
1223
1223
|
case "data":
|
|
@@ -1255,13 +1255,13 @@ var A = class extends e {
|
|
|
1255
1255
|
}
|
|
1256
1256
|
this.buffers.clear(), this.glBuffers.clear();
|
|
1257
1257
|
}
|
|
1258
|
-
},
|
|
1259
|
-
function
|
|
1260
|
-
return
|
|
1258
|
+
}, Ft;
|
|
1259
|
+
function It() {
|
|
1260
|
+
return Ft ||= "mediump", Ft;
|
|
1261
1261
|
}
|
|
1262
1262
|
//#endregion
|
|
1263
1263
|
//#region src/core/renderers/gl/shader/preprocessors/addProgramDefines.ts
|
|
1264
|
-
function
|
|
1264
|
+
function Lt(e, t, n) {
|
|
1265
1265
|
return t ? e : n ? (e = e.replace("out vec4 finalColor;", ""), `#ifdef GL_ES
|
|
1266
1266
|
#define in varying
|
|
1267
1267
|
#define finalColor gl_FragColor
|
|
@@ -1275,7 +1275,7 @@ ${e}`;
|
|
|
1275
1275
|
}
|
|
1276
1276
|
//#endregion
|
|
1277
1277
|
//#region src/core/renderers/gl/shader/preprocessors/ensurePrecision.ts
|
|
1278
|
-
function
|
|
1278
|
+
function Rt(e, t, n) {
|
|
1279
1279
|
let r = n ? t.maxSupportedFragmentPrecision : t.maxSupportedVertexPrecision;
|
|
1280
1280
|
if (e.substring(0, 9) !== "precision") {
|
|
1281
1281
|
let i = n ? t.requestedFragmentPrecision : t.requestedVertexPrecision;
|
|
@@ -1285,31 +1285,31 @@ function Lt(e, t, n) {
|
|
|
1285
1285
|
}
|
|
1286
1286
|
//#endregion
|
|
1287
1287
|
//#region src/core/renderers/gl/shader/preprocessors/insertVersion.ts
|
|
1288
|
-
function
|
|
1288
|
+
function zt(e, t) {
|
|
1289
1289
|
return t ? `#version 300 es\n${e}` : e;
|
|
1290
1290
|
}
|
|
1291
1291
|
//#endregion
|
|
1292
1292
|
//#region src/core/renderers/gl/shader/preprocessors/setProgramName.ts
|
|
1293
|
-
var
|
|
1294
|
-
function
|
|
1293
|
+
var Bt = {}, Vt = {};
|
|
1294
|
+
function Ht(e, { name: t = "program" }, n = !0) {
|
|
1295
1295
|
t = t.replace(/\s+/g, "-"), t += n ? "-fragment" : "-vertex";
|
|
1296
|
-
let r = n ?
|
|
1296
|
+
let r = n ? Bt : Vt;
|
|
1297
1297
|
return r[t] ? (r[t]++, t += `-${r[t]}`) : r[t] = 1, e.includes("#define SHADER_NAME") ? e : `${`#define SHADER_NAME ${t}`}\n${e}`;
|
|
1298
1298
|
}
|
|
1299
1299
|
//#endregion
|
|
1300
1300
|
//#region src/core/renderers/gl/shader/preprocessors/stripVersion.ts
|
|
1301
|
-
function
|
|
1301
|
+
function Ut(e, t) {
|
|
1302
1302
|
return t ? e.replace("#version 300 es", "") : e;
|
|
1303
1303
|
}
|
|
1304
1304
|
//#endregion
|
|
1305
1305
|
//#region src/core/renderers/gl/shader/GlProgram.ts
|
|
1306
|
-
var
|
|
1307
|
-
stripVersion:
|
|
1308
|
-
ensurePrecision:
|
|
1309
|
-
addProgramDefines:
|
|
1310
|
-
setProgramName:
|
|
1311
|
-
insertVersion:
|
|
1312
|
-
},
|
|
1306
|
+
var Wt = Object.create(null), Gt = {
|
|
1307
|
+
stripVersion: Ut,
|
|
1308
|
+
ensurePrecision: Rt,
|
|
1309
|
+
addProgramDefines: Lt,
|
|
1310
|
+
setProgramName: Ht,
|
|
1311
|
+
insertVersion: zt
|
|
1312
|
+
}, Kt = class e {
|
|
1313
1313
|
static defaultOptions = {
|
|
1314
1314
|
preferredVertexPrecision: "highp",
|
|
1315
1315
|
preferredFragmentPrecision: "mediump"
|
|
@@ -1332,25 +1332,25 @@ var Ut = Object.create(null), Wt = {
|
|
|
1332
1332
|
requestedFragmentPrecision: t.preferredFragmentPrecision,
|
|
1333
1333
|
requestedVertexPrecision: t.preferredVertexPrecision,
|
|
1334
1334
|
maxSupportedVertexPrecision: "highp",
|
|
1335
|
-
maxSupportedFragmentPrecision:
|
|
1335
|
+
maxSupportedFragmentPrecision: It()
|
|
1336
1336
|
},
|
|
1337
1337
|
setProgramName: { name: t.name },
|
|
1338
1338
|
addProgramDefines: i,
|
|
1339
1339
|
insertVersion: i
|
|
1340
1340
|
};
|
|
1341
|
-
Object.keys(
|
|
1341
|
+
Object.keys(Gt).forEach((e) => {
|
|
1342
1342
|
let t = a[e];
|
|
1343
|
-
n =
|
|
1344
|
-
}), this.fragment = n, this.vertex = r, this.transformFeedbackVaryings = t.transformFeedbackVaryings, this.id =
|
|
1343
|
+
n = Gt[e](n, t, !0), r = Gt[e](r, t, !1);
|
|
1344
|
+
}), this.fragment = n, this.vertex = r, this.transformFeedbackVaryings = t.transformFeedbackVaryings, this.id = Nt(`${r}:${n}`, "GlProgram");
|
|
1345
1345
|
}
|
|
1346
1346
|
destroy() {
|
|
1347
|
-
this.fragment = "", this.vertex = "", this.attributes = Object.create(null), this.uniforms = Object.create(null), this.transformFeedbackVaryings = void 0, this._cacheKey && delete
|
|
1347
|
+
this.fragment = "", this.vertex = "", this.attributes = Object.create(null), this.uniforms = Object.create(null), this.transformFeedbackVaryings = void 0, this._cacheKey && delete Wt[this._cacheKey];
|
|
1348
1348
|
}
|
|
1349
1349
|
static from(t) {
|
|
1350
1350
|
let n = `${t.vertex}:${t.fragment}`;
|
|
1351
|
-
return
|
|
1351
|
+
return Wt[n] || (Wt[n] = new e(t), Wt[n]._cacheKey = n), Wt[n];
|
|
1352
1352
|
}
|
|
1353
|
-
},
|
|
1353
|
+
}, qt = {
|
|
1354
1354
|
uint8x2: {
|
|
1355
1355
|
size: 2,
|
|
1356
1356
|
stride: 2,
|
|
@@ -1502,18 +1502,18 @@ var Ut = Object.create(null), Wt = {
|
|
|
1502
1502
|
normalized: !1
|
|
1503
1503
|
}
|
|
1504
1504
|
};
|
|
1505
|
-
function
|
|
1506
|
-
return
|
|
1505
|
+
function Jt(e) {
|
|
1506
|
+
return qt[e] ?? qt.float32;
|
|
1507
1507
|
}
|
|
1508
1508
|
//#endregion
|
|
1509
1509
|
//#region src/core/renderers/gl/shader/GlProgramData.ts
|
|
1510
|
-
var
|
|
1510
|
+
var Yt = class {
|
|
1511
1511
|
native;
|
|
1512
1512
|
uniformDirtyGroups = Object.create(null);
|
|
1513
1513
|
constructor(e) {
|
|
1514
1514
|
this.native = e;
|
|
1515
1515
|
}
|
|
1516
|
-
},
|
|
1516
|
+
}, Xt, Zt = {
|
|
1517
1517
|
FLOAT: "float",
|
|
1518
1518
|
FLOAT_VEC2: "vec2",
|
|
1519
1519
|
FLOAT_VEC3: "vec3",
|
|
@@ -1542,7 +1542,7 @@ var Jt = class {
|
|
|
1542
1542
|
SAMPLER_2D_ARRAY: "sampler2DArray",
|
|
1543
1543
|
INT_SAMPLER_2D_ARRAY: "sampler2DArray",
|
|
1544
1544
|
UNSIGNED_INT_SAMPLER_2D_ARRAY: "sampler2DArray"
|
|
1545
|
-
},
|
|
1545
|
+
}, Qt = {
|
|
1546
1546
|
float: "float32",
|
|
1547
1547
|
vec2: "float32x2",
|
|
1548
1548
|
vec3: "float32x3",
|
|
@@ -1560,29 +1560,29 @@ var Jt = class {
|
|
|
1560
1560
|
bvec3: "uint32x3",
|
|
1561
1561
|
bvec4: "uint32x4"
|
|
1562
1562
|
};
|
|
1563
|
-
function
|
|
1564
|
-
if (!
|
|
1565
|
-
let t = Object.keys(
|
|
1566
|
-
|
|
1563
|
+
function $t(e, t) {
|
|
1564
|
+
if (!Xt) {
|
|
1565
|
+
let t = Object.keys(Zt);
|
|
1566
|
+
Xt = {};
|
|
1567
1567
|
for (let n = 0; n < t.length; ++n) {
|
|
1568
1568
|
let r = t[n];
|
|
1569
|
-
|
|
1569
|
+
Xt[e[r]] = Zt[r];
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
return
|
|
1572
|
+
return Xt[t];
|
|
1573
1573
|
}
|
|
1574
|
-
function
|
|
1575
|
-
return
|
|
1574
|
+
function en(e, t) {
|
|
1575
|
+
return Qt[$t(e, t)] || "float32";
|
|
1576
1576
|
}
|
|
1577
1577
|
//#endregion
|
|
1578
1578
|
//#region src/core/renderers/gl/shader/GlShaderSystem.ts
|
|
1579
|
-
var
|
|
1579
|
+
var tn = class extends A {
|
|
1580
1580
|
install(e) {
|
|
1581
1581
|
super.install(e), e.shader = this;
|
|
1582
1582
|
}
|
|
1583
1583
|
glProgramDatas = /* @__PURE__ */ new Map();
|
|
1584
1584
|
currentProgram = null;
|
|
1585
|
-
globalUniforms = new
|
|
1585
|
+
globalUniforms = new At({
|
|
1586
1586
|
projectionMatrix: new Float32Array([
|
|
1587
1587
|
1,
|
|
1588
1588
|
0,
|
|
@@ -1623,7 +1623,7 @@ var en = class extends A {
|
|
|
1623
1623
|
return this.glProgramDatas.get(e.id) || this._createGlProgramData(e);
|
|
1624
1624
|
}
|
|
1625
1625
|
_createGlProgramData(e) {
|
|
1626
|
-
let t = this._gl, n = new
|
|
1626
|
+
let t = this._gl, n = new Yt(t.createProgram());
|
|
1627
1627
|
this.glProgramDatas.set(e.id, n), this.useProgram(e);
|
|
1628
1628
|
let r = this._createGlShader(e.vertex, t.VERTEX_SHADER), i = this._createGlShader(e.fragment, t.FRAGMENT_SHADER);
|
|
1629
1629
|
if (t.attachShader(n.native, r), t.attachShader(n.native, i), t.linkProgram(n.native), !t.getProgramParameter(n.native, t.LINK_STATUS)) throw Error(`Failed to link program: ${t.getProgramInfoLog(n.native)}`);
|
|
@@ -1631,11 +1631,11 @@ var en = class extends A {
|
|
|
1631
1631
|
for (let e = t.getProgramParameter(n.native, t.ACTIVE_ATTRIBUTES), r = 0; r < e; r++) {
|
|
1632
1632
|
let e = t.getActiveAttrib(n.native, r);
|
|
1633
1633
|
if (!e || e.name.startsWith("gl_")) continue;
|
|
1634
|
-
let i =
|
|
1634
|
+
let i = en(t, e.type);
|
|
1635
1635
|
a[e.name] = {
|
|
1636
1636
|
location: 0,
|
|
1637
1637
|
format: i,
|
|
1638
|
-
stride:
|
|
1638
|
+
stride: Jt(i).stride,
|
|
1639
1639
|
offset: 0,
|
|
1640
1640
|
instance: !1,
|
|
1641
1641
|
start: 0
|
|
@@ -1652,7 +1652,7 @@ var en = class extends A {
|
|
|
1652
1652
|
for (let e = t.getProgramParameter(n.native, t.ACTIVE_UNIFORMS), r = 0; r < e; r++) {
|
|
1653
1653
|
let e = t.getActiveUniform(n.native, r);
|
|
1654
1654
|
if (!e) continue;
|
|
1655
|
-
let i = e.name.replace(/\[.*?\]$/, ""), a =
|
|
1655
|
+
let i = e.name.replace(/\[.*?\]$/, ""), a = $t(t, e.type), o = e.size;
|
|
1656
1656
|
c[i] = {
|
|
1657
1657
|
name: i,
|
|
1658
1658
|
index: r,
|
|
@@ -1687,7 +1687,7 @@ var en = class extends A {
|
|
|
1687
1687
|
let { type: s, isArray: c, name: l } = o;
|
|
1688
1688
|
o.location === void 0 && (o.location = r.getUniformLocation(t.native, l));
|
|
1689
1689
|
let u = o.location;
|
|
1690
|
-
if (
|
|
1690
|
+
if (nn(o.value, a)) switch (o.value = rn(o.value, a), s) {
|
|
1691
1691
|
case "float":
|
|
1692
1692
|
c ? r.uniform1fv(u, a) : r.uniform1f(u, a);
|
|
1693
1693
|
break;
|
|
@@ -1774,7 +1774,7 @@ var en = class extends A {
|
|
|
1774
1774
|
super.destroy(), this.bind(null);
|
|
1775
1775
|
}
|
|
1776
1776
|
};
|
|
1777
|
-
function
|
|
1777
|
+
function nn(e, t) {
|
|
1778
1778
|
if (typeof t == "object" && t) {
|
|
1779
1779
|
let n = t.length;
|
|
1780
1780
|
if (typeof e != "object" || !e || e.length !== n) return !0;
|
|
@@ -1783,7 +1783,7 @@ function tn(e, t) {
|
|
|
1783
1783
|
}
|
|
1784
1784
|
return e !== t;
|
|
1785
1785
|
}
|
|
1786
|
-
function
|
|
1786
|
+
function rn(e, t) {
|
|
1787
1787
|
if (typeof t == "object" && t) {
|
|
1788
1788
|
let n = t.length;
|
|
1789
1789
|
if (typeof e == "object" && e && e.length === n) {
|
|
@@ -1796,10 +1796,10 @@ function nn(e, t) {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
//#endregion
|
|
1798
1798
|
//#region src/core/renderers/gl/state/GlBlendMode.ts
|
|
1799
|
-
var
|
|
1799
|
+
var an = /* @__PURE__ */ function(e) {
|
|
1800
1800
|
return e.normal = "normal", e.add = "add", e.multiply = "multiply", e.screen = "screen", e.none = "none", e.normalNpm = "normalNpm", e.addNpm = "add_npm", e.screenNpm = "screenNpm", e.srcIn = "srcIn", e.srcOut = "srcOut", e.srcAtop = "srcAtop", e.dstOver = "dstOver", e.dstIn = "dstIn", e.dstOut = "dstOut", e.dstAtop = "dstAtop", e.xor = "xor", e.subtract = "subtract", e;
|
|
1801
1801
|
}({});
|
|
1802
|
-
function
|
|
1802
|
+
function on(e) {
|
|
1803
1803
|
return {
|
|
1804
1804
|
normal: [e.ONE, e.ONE_MINUS_SRC_ALPHA],
|
|
1805
1805
|
add: [e.ONE, e.ONE],
|
|
@@ -1854,7 +1854,7 @@ function an(e) {
|
|
|
1854
1854
|
}
|
|
1855
1855
|
//#endregion
|
|
1856
1856
|
//#region src/core/renderers/gl/state/GlStateSystem.ts
|
|
1857
|
-
var
|
|
1857
|
+
var sn = class e {
|
|
1858
1858
|
static _properties = [
|
|
1859
1859
|
"blend",
|
|
1860
1860
|
"offsets",
|
|
@@ -1881,14 +1881,14 @@ var on = class e {
|
|
|
1881
1881
|
let t = new e();
|
|
1882
1882
|
return t.depthTest = !1, t.blend = !0, t;
|
|
1883
1883
|
}
|
|
1884
|
-
_blendMode =
|
|
1884
|
+
_blendMode = an.normal;
|
|
1885
1885
|
_polygonOffset = 0;
|
|
1886
1886
|
bitmap = 0;
|
|
1887
1887
|
get blendMode() {
|
|
1888
1888
|
return this._blendMode;
|
|
1889
1889
|
}
|
|
1890
1890
|
set blendMode(e) {
|
|
1891
|
-
this.blend = e !==
|
|
1891
|
+
this.blend = e !== an.none, this._blendMode = e;
|
|
1892
1892
|
}
|
|
1893
1893
|
get polygonOffset() {
|
|
1894
1894
|
return this._polygonOffset;
|
|
@@ -1900,19 +1900,19 @@ var on = class e {
|
|
|
1900
1900
|
if (e) for (let t in e) this[t] = e[t];
|
|
1901
1901
|
}
|
|
1902
1902
|
};
|
|
1903
|
-
|
|
1904
|
-
var
|
|
1903
|
+
sn._init();
|
|
1904
|
+
var cn = class extends A {
|
|
1905
1905
|
install(e) {
|
|
1906
1906
|
super.install(e), e.state = this;
|
|
1907
1907
|
}
|
|
1908
1908
|
_blendEq = !1;
|
|
1909
|
-
_setters =
|
|
1909
|
+
_setters = sn._properties.map((e) => this[`set${e.replace(/^\S/, (e) => e.toUpperCase())}`]);
|
|
1910
1910
|
boundStateBitmap = 0;
|
|
1911
1911
|
boundBlendMode;
|
|
1912
1912
|
blendModes;
|
|
1913
|
-
defaultState = new
|
|
1913
|
+
defaultState = new sn({ blend: !0 });
|
|
1914
1914
|
_updateContext(e) {
|
|
1915
|
-
super._updateContext(e), this.blendModes =
|
|
1915
|
+
super._updateContext(e), this.blendModes = on(e);
|
|
1916
1916
|
}
|
|
1917
1917
|
toggle(e, t) {
|
|
1918
1918
|
this._renderer.gl[t ? "enable" : "disable"](e);
|
|
@@ -1955,14 +1955,14 @@ var sn = class extends A {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
reset() {
|
|
1957
1957
|
super.reset();
|
|
1958
|
-
let e = (1 <<
|
|
1958
|
+
let e = (1 << sn._properties.length) - 1;
|
|
1959
1959
|
this.boundStateBitmap = ~this.defaultState.bitmap & e, this.boundBlendMode = void 0, this._blendEq = !0, this.bind(this.defaultState);
|
|
1960
1960
|
}
|
|
1961
|
-
},
|
|
1961
|
+
}, ln = class extends A {
|
|
1962
1962
|
install(e) {
|
|
1963
1963
|
super.install(e), e.batch2D = this;
|
|
1964
1964
|
}
|
|
1965
|
-
_state =
|
|
1965
|
+
_state = sn.for2D();
|
|
1966
1966
|
_batchSize = 4096 * 4;
|
|
1967
1967
|
_batchables = [];
|
|
1968
1968
|
_vertexCount = 0;
|
|
@@ -1983,8 +1983,8 @@ var sn = class extends A {
|
|
|
1983
1983
|
}
|
|
1984
1984
|
_createShader(e) {
|
|
1985
1985
|
let t = this._renderer, n = {
|
|
1986
|
-
instanceId:
|
|
1987
|
-
glProgram: new
|
|
1986
|
+
instanceId: lt(),
|
|
1987
|
+
glProgram: new Kt({
|
|
1988
1988
|
vertex: "precision highp float;\nin vec2 aPosition;\nin vec2 aUv;\nin vec4 aTextureParams;\nin vec4 aModulate;\n\nuniform vec2 size;\nuniform mat3 projectionMatrix;\nuniform mat3 viewMatrix;\n\nout float vTextureId;\nout float vClipOutsideUv;\nout vec2 vUv;\nout vec4 vModulate;\n\nvec2 roundPixels(vec2 position, vec2 targetSize) {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n}\n\nvoid main(void) {\n mat3 modelMatrix = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n mat3 modelViewProjectionMatrix = projectionMatrix * viewMatrix * modelMatrix;\n gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);\n vTextureId = aTextureParams.x;\n vClipOutsideUv = aTextureParams.y;\n if (aTextureParams.z == 1.) {\n gl_Position.xy = roundPixels(gl_Position.xy, size);\n }\n vUv = aUv;\n vModulate = aModulate;\n}",
|
|
1989
1989
|
fragment: `precision highp float;
|
|
1990
1990
|
in float vTextureId;
|
|
@@ -2013,15 +2013,15 @@ void main(void) {
|
|
|
2013
2013
|
}`
|
|
2014
2014
|
})
|
|
2015
2015
|
}, r = {
|
|
2016
|
-
instanceId:
|
|
2016
|
+
instanceId: lt(),
|
|
2017
2017
|
usage: k.vertex,
|
|
2018
2018
|
data: new Float32Array()
|
|
2019
2019
|
}, i = {
|
|
2020
|
-
instanceId:
|
|
2020
|
+
instanceId: lt(),
|
|
2021
2021
|
usage: k.index,
|
|
2022
2022
|
data: new Uint32Array()
|
|
2023
2023
|
}, a = {
|
|
2024
|
-
instanceId:
|
|
2024
|
+
instanceId: lt(),
|
|
2025
2025
|
topology: "triangle-list",
|
|
2026
2026
|
attributes: Object.fromEntries(Object.entries(this._attributes).map(([e, t]) => [e, {
|
|
2027
2027
|
...t,
|
|
@@ -2061,15 +2061,15 @@ void main(void) {
|
|
|
2061
2061
|
let { indices: r, vertices: p, uvs: h = new Float32Array(), size: g = {
|
|
2062
2062
|
width: 0,
|
|
2063
2063
|
height: 0
|
|
2064
|
-
}, texture: ee, blendMode: te =
|
|
2064
|
+
}, texture: ee, blendMode: te = an.normal, clipOutsideUv: ne, roundPixels: re, modulate: ie = [
|
|
2065
2065
|
255,
|
|
2066
2066
|
255,
|
|
2067
2067
|
255,
|
|
2068
2068
|
255
|
|
2069
2069
|
] } = n[e];
|
|
2070
2070
|
m < e && t.blendMode !== te && (t.size = l - t.start, u.push(t), m = e, t = { id: ++d }, t.textures = i, t.textureLocationMap = f, t.start = l);
|
|
2071
|
-
let { width: ae, height: oe } = g, _ = c / this._vertexSize, se = (ee ? f.get(ee) : 255) ?? 255, ce = +!!re, le = +!!ne, v, y
|
|
2072
|
-
for (let e = p.length, t = 0; t < e; t += 2)
|
|
2071
|
+
let { width: ae, height: oe } = g, _ = c / this._vertexSize, se = (ee ? f.get(ee) : 255) ?? 255, ce = +!!re, le = +!!ne, ue, v, y;
|
|
2072
|
+
for (let e = p.length, t = 0; t < e; t += 2) ue = h[t], v = h[t + 1], ae > 0 && oe > 0 && (ue = Math.ceil(ue * ae) / ae, v = Math.ceil(v * oe) / oe), a[c++] = p[t], a[c++] = p[t + 1], a[c++] = ue, a[c++] = v, y = c * 4, o[y] = se, o[y + 1] = le, o[y + 2] = ce, o[y + 3] = 0, c++, y = c * 4, o[y] = ie[0], o[y + 1] = ie[1], o[y + 2] = ie[2], o[y + 3] = ie[3], c++;
|
|
2073
2073
|
for (let e = r.length, t = 0; t < e; t++) s[l++] = _ + r[t];
|
|
2074
2074
|
t.blendMode = te;
|
|
2075
2075
|
}
|
|
@@ -2091,22 +2091,22 @@ void main(void) {
|
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
2093
|
_getBufferData(e) {
|
|
2094
|
-
let t =
|
|
2094
|
+
let t = un(Math.ceil(e / 8)), n = dn(t), r = t * 8;
|
|
2095
2095
|
this._attributeBuffer.length <= n && (this._attributeBuffer.length = n + 1);
|
|
2096
2096
|
let i = this._attributeBuffer[n];
|
|
2097
2097
|
return i || (this._attributeBuffer[n] = i = /* @__PURE__ */ new ArrayBuffer(r * this._vertexSize * 4)), i;
|
|
2098
2098
|
}
|
|
2099
2099
|
_getIndexBufferData(e) {
|
|
2100
|
-
let t =
|
|
2100
|
+
let t = un(Math.ceil(e / 12)), n = dn(t), r = t * 12;
|
|
2101
2101
|
this._indexBuffers.length <= n && (this._indexBuffers.length = n + 1);
|
|
2102
2102
|
let i = this._indexBuffers[n];
|
|
2103
2103
|
return i || (this._indexBuffers[n] = i = new Uint32Array(r)), i;
|
|
2104
2104
|
}
|
|
2105
2105
|
};
|
|
2106
|
-
function
|
|
2106
|
+
function un(e) {
|
|
2107
2107
|
return e += +(e === 0), --e, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>> 8, e |= e >>> 16, e + 1;
|
|
2108
2108
|
}
|
|
2109
|
-
function
|
|
2109
|
+
function dn(e) {
|
|
2110
2110
|
let t = (e > 65535) << 4;
|
|
2111
2111
|
e >>>= t;
|
|
2112
2112
|
let n = (e > 255) << 3;
|
|
@@ -2116,9 +2116,9 @@ function un(e) {
|
|
|
2116
2116
|
//#region src/core/renderers/gl/const.ts
|
|
2117
2117
|
var j = /* @__PURE__ */ function(e) {
|
|
2118
2118
|
return e[e.disabled = 0] = "disabled", e[e.renderingMaskAdd = 1] = "renderingMaskAdd", e[e.maskActive = 2] = "maskActive", e[e.inverseMaskActive = 3] = "inverseMaskActive", e[e.renderingMaskRemove = 4] = "renderingMaskRemove", e[e.none = 5] = "none", e;
|
|
2119
|
-
}({}),
|
|
2119
|
+
}({}), fn = /* @__PURE__ */ function(e) {
|
|
2120
2120
|
return e[e.none = 0] = "none", e[e.color = 16384] = "color", e[e.stencil = 1024] = "stencil", e[e.depth = 256] = "depth", e[e.colorDepth = 16640] = "colorDepth", e[e.colorStencil = 17408] = "colorStencil", e[e.depthStencil = 1280] = "depthStencil", e[e.all = 17664] = "all", e;
|
|
2121
|
-
}({}),
|
|
2121
|
+
}({}), pn = class extends A {
|
|
2122
2122
|
install(e) {
|
|
2123
2123
|
super.install(e), e.mask = this;
|
|
2124
2124
|
}
|
|
@@ -2143,10 +2143,10 @@ var j = /* @__PURE__ */ function(e) {
|
|
|
2143
2143
|
let t = this.stack.pop();
|
|
2144
2144
|
if (!t || t.source !== e) return;
|
|
2145
2145
|
let { mask: n } = t, r = this._renderer.renderTarget.current?.instanceId ?? -1, i = this._maskStackHash[r] ?? 0;
|
|
2146
|
-
"x" in n ? this._renderer.scissor.pop() : "render" in n && (this._renderer.flush(), i === 0 ? (this._renderer.clear(
|
|
2146
|
+
"x" in n ? this._renderer.scissor.pop() : "render" in n && (this._renderer.flush(), i === 0 ? (this._renderer.clear(fn.stencil), this._renderer.stencil.bind(j.disabled, i)) : this._renderer.stencil.bind(j.renderingMaskRemove, i), i--, n.render(this._renderer), this._renderer.flush(), this._renderer.stencil.bind(j.maskActive, i), this._renderer.colorMask.bind(15)), this._maskStackHash[r] = i;
|
|
2147
2147
|
}
|
|
2148
|
-
},
|
|
2149
|
-
|
|
2148
|
+
}, mn = [];
|
|
2149
|
+
mn[j.none] = {}, mn[j.disabled] = {}, mn[j.renderingMaskAdd] = {
|
|
2150
2150
|
stencilFront: {
|
|
2151
2151
|
compare: "equal",
|
|
2152
2152
|
passOp: "increment-clamp"
|
|
@@ -2155,7 +2155,7 @@ pn[j.none] = {}, pn[j.disabled] = {}, pn[j.renderingMaskAdd] = {
|
|
|
2155
2155
|
compare: "equal",
|
|
2156
2156
|
passOp: "increment-clamp"
|
|
2157
2157
|
}
|
|
2158
|
-
},
|
|
2158
|
+
}, mn[j.renderingMaskRemove] = {
|
|
2159
2159
|
stencilFront: {
|
|
2160
2160
|
compare: "equal",
|
|
2161
2161
|
passOp: "decrement-clamp"
|
|
@@ -2164,7 +2164,7 @@ pn[j.none] = {}, pn[j.disabled] = {}, pn[j.renderingMaskAdd] = {
|
|
|
2164
2164
|
compare: "equal",
|
|
2165
2165
|
passOp: "decrement-clamp"
|
|
2166
2166
|
}
|
|
2167
|
-
},
|
|
2167
|
+
}, mn[j.maskActive] = {
|
|
2168
2168
|
stencilFront: {
|
|
2169
2169
|
compare: "equal",
|
|
2170
2170
|
passOp: "keep"
|
|
@@ -2173,7 +2173,7 @@ pn[j.none] = {}, pn[j.disabled] = {}, pn[j.renderingMaskAdd] = {
|
|
|
2173
2173
|
compare: "equal",
|
|
2174
2174
|
passOp: "keep"
|
|
2175
2175
|
}
|
|
2176
|
-
},
|
|
2176
|
+
}, mn[j.inverseMaskActive] = {
|
|
2177
2177
|
stencilFront: {
|
|
2178
2178
|
compare: "not-equal",
|
|
2179
2179
|
passOp: "keep"
|
|
@@ -2183,7 +2183,7 @@ pn[j.none] = {}, pn[j.disabled] = {}, pn[j.renderingMaskAdd] = {
|
|
|
2183
2183
|
passOp: "keep"
|
|
2184
2184
|
}
|
|
2185
2185
|
};
|
|
2186
|
-
var
|
|
2186
|
+
var hn = class extends A {
|
|
2187
2187
|
install(e) {
|
|
2188
2188
|
super.install(e), e.stencil = this;
|
|
2189
2189
|
}
|
|
@@ -2235,7 +2235,7 @@ var mn = class extends A {
|
|
|
2235
2235
|
}
|
|
2236
2236
|
};
|
|
2237
2237
|
bind(e, t) {
|
|
2238
|
-
let n = this.current[this._renderer.renderTarget.current?.instanceId ?? -1], r = this._gl, i =
|
|
2238
|
+
let n = this.current[this._renderer.renderTarget.current?.instanceId ?? -1], r = this._gl, i = mn[e], a = this._cache;
|
|
2239
2239
|
if (n.stencilMode = e, n.refCount = t, e === j.disabled) {
|
|
2240
2240
|
this._cache.enabled && (this._cache.enabled = !1, r.disable(r.STENCIL_TEST));
|
|
2241
2241
|
return;
|
|
@@ -2245,8 +2245,8 @@ var mn = class extends A {
|
|
|
2245
2245
|
destroy() {
|
|
2246
2246
|
super.destroy(), this._renderer.renderTarget.off("updateRenderTarget", this._updateRenderTarget);
|
|
2247
2247
|
}
|
|
2248
|
-
},
|
|
2249
|
-
current = new
|
|
2248
|
+
}, gn = class extends A {
|
|
2249
|
+
current = new vt(0, 0, 0, 0);
|
|
2250
2250
|
install(e) {
|
|
2251
2251
|
super.install(e), e.viewport = this;
|
|
2252
2252
|
}
|
|
@@ -2254,7 +2254,7 @@ var mn = class extends A {
|
|
|
2254
2254
|
let t = this.current, n = Math.floor(e.x), r = Math.floor(e.y), i = Math.floor(e.width), a = Math.floor(e.height);
|
|
2255
2255
|
t.x === n && t.y === r && t.width === i && t.height === a || (this._gl.viewport(n, r, i, a), t.x = n, t.y = r, t.width = i, t.height = a);
|
|
2256
2256
|
}
|
|
2257
|
-
},
|
|
2257
|
+
}, _n = class {
|
|
2258
2258
|
framebuffer;
|
|
2259
2259
|
width = -1;
|
|
2260
2260
|
height = -1;
|
|
@@ -2265,7 +2265,7 @@ var mn = class extends A {
|
|
|
2265
2265
|
constructor(e) {
|
|
2266
2266
|
this.framebuffer = e;
|
|
2267
2267
|
}
|
|
2268
|
-
},
|
|
2268
|
+
}, vn = class extends A {
|
|
2269
2269
|
install(e) {
|
|
2270
2270
|
super.install(e), e.renderTarget = this;
|
|
2271
2271
|
}
|
|
@@ -2275,7 +2275,7 @@ var mn = class extends A {
|
|
|
2275
2275
|
_msaaSamples = [];
|
|
2276
2276
|
_hasMRT = !0;
|
|
2277
2277
|
_writeDepthTexture = !0;
|
|
2278
|
-
projection = new
|
|
2278
|
+
projection = new wt();
|
|
2279
2279
|
_updateContext(e) {
|
|
2280
2280
|
if (super._updateContext(e), this._hasMRT = !0, this._writeDepthTexture = !0, this._renderer.version === 1) {
|
|
2281
2281
|
let t = this._renderer.extensions.drawBuffers, n = this._renderer.extensions.depthTexture;
|
|
@@ -2311,7 +2311,7 @@ var mn = class extends A {
|
|
|
2311
2311
|
return this.glRenderTargets.get(e.instanceId) || this._createGlRenderTarget(e);
|
|
2312
2312
|
}
|
|
2313
2313
|
_createGlRenderTarget(e) {
|
|
2314
|
-
let t = this._gl, n = new
|
|
2314
|
+
let t = this._gl, n = new _n(t.createFramebuffer());
|
|
2315
2315
|
return this.glRenderTargets.set(e.instanceId, n), this.renderTargets.get(e.instanceId) || (this.renderTargets.set(e.instanceId, e), this._update(e, n), "on" in e && (e.on("updateProperty", (t) => {
|
|
2316
2316
|
switch (t) {
|
|
2317
2317
|
case "width":
|
|
@@ -2388,28 +2388,28 @@ var mn = class extends A {
|
|
|
2388
2388
|
reset() {
|
|
2389
2389
|
super.reset(), this._renderer.contextLost || this.glRenderTargets.forEach((e) => this.destroyGpuRenderTarget(e)), this.renderTargets.clear(), this.glRenderTargets.clear(), this.current = null, this._msaaSamples.length = 0;
|
|
2390
2390
|
}
|
|
2391
|
-
},
|
|
2391
|
+
}, yn = /* @__PURE__ */ function(e) {
|
|
2392
2392
|
return e[e.RGBA = 6408] = "RGBA", e[e.RGB = 6407] = "RGB", e[e.RG = 33319] = "RG", e[e.RED = 6403] = "RED", e[e.RGBA_INTEGER = 36249] = "RGBA_INTEGER", e[e.RGB_INTEGER = 36248] = "RGB_INTEGER", e[e.RG_INTEGER = 33320] = "RG_INTEGER", e[e.RED_INTEGER = 36244] = "RED_INTEGER", e[e.ALPHA = 6406] = "ALPHA", e[e.LUMINANCE = 6409] = "LUMINANCE", e[e.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA", e[e.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT", e[e.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", e;
|
|
2393
|
-
}({}),
|
|
2393
|
+
}({}), bn = /* @__PURE__ */ function(e) {
|
|
2394
2394
|
return e[e.TEXTURE_2D = 3553] = "TEXTURE_2D", e[e.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP", e[e.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY", e[e.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X", e[e.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X", e[e.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y", e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y", e[e.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z", e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z", e;
|
|
2395
2395
|
}({}), M = /* @__PURE__ */ function(e) {
|
|
2396
2396
|
return e[e.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE", e[e.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT", e[e.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5", e[e.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4", e[e.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1", e[e.UNSIGNED_INT = 5125] = "UNSIGNED_INT", e[e.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV", e[e.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV", e[e.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8", e[e.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV", e[e.BYTE = 5120] = "BYTE", e[e.SHORT = 5122] = "SHORT", e[e.INT = 5124] = "INT", e[e.FLOAT = 5126] = "FLOAT", e[e.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV", e[e.HALF_FLOAT = 36193] = "HALF_FLOAT", e;
|
|
2397
|
-
}({}),
|
|
2397
|
+
}({}), xn = class {
|
|
2398
2398
|
native;
|
|
2399
|
-
target =
|
|
2399
|
+
target = bn.TEXTURE_2D;
|
|
2400
2400
|
width = -1;
|
|
2401
2401
|
height = -1;
|
|
2402
2402
|
mipmap = !1;
|
|
2403
2403
|
type = M.UNSIGNED_BYTE;
|
|
2404
|
-
internalFormat =
|
|
2405
|
-
format =
|
|
2404
|
+
internalFormat = yn.RGBA;
|
|
2405
|
+
format = yn.RGBA;
|
|
2406
2406
|
constructor(e) {
|
|
2407
2407
|
this.native = e;
|
|
2408
2408
|
}
|
|
2409
2409
|
};
|
|
2410
2410
|
//#endregion
|
|
2411
2411
|
//#region src/core/renderers/gl/texture/mapFormatToGlFormat.ts
|
|
2412
|
-
function
|
|
2412
|
+
function Sn(e) {
|
|
2413
2413
|
return {
|
|
2414
2414
|
r8unorm: e.RED,
|
|
2415
2415
|
r8snorm: e.RED,
|
|
@@ -2457,7 +2457,7 @@ function xn(e) {
|
|
|
2457
2457
|
}
|
|
2458
2458
|
//#endregion
|
|
2459
2459
|
//#region src/core/renderers/gl/texture/mapFormatToGlInternalFormat.ts
|
|
2460
|
-
function
|
|
2460
|
+
function Cn(e, t) {
|
|
2461
2461
|
let n = {}, r = e.RGBA;
|
|
2462
2462
|
return e instanceof WebGLRenderingContext ? t.srgb && (n = {
|
|
2463
2463
|
"rgba8unorm-srgb": t.srgb.SRGB8_ALPHA8_EXT,
|
|
@@ -2573,7 +2573,7 @@ function Sn(e, t) {
|
|
|
2573
2573
|
}
|
|
2574
2574
|
//#endregion
|
|
2575
2575
|
//#region src/core/renderers/gl/texture/mapFormatToGlType.ts
|
|
2576
|
-
function
|
|
2576
|
+
function wn(e) {
|
|
2577
2577
|
return {
|
|
2578
2578
|
r8unorm: e.UNSIGNED_BYTE,
|
|
2579
2579
|
r8snorm: e.BYTE,
|
|
@@ -2621,7 +2621,7 @@ function Cn(e) {
|
|
|
2621
2621
|
}
|
|
2622
2622
|
//#endregion
|
|
2623
2623
|
//#region src/core/renderers/gl/texture/updateTextureStyle.ts
|
|
2624
|
-
var
|
|
2624
|
+
var Tn = {
|
|
2625
2625
|
linear: {
|
|
2626
2626
|
linear: 9987,
|
|
2627
2627
|
nearest: 9985
|
|
@@ -2630,10 +2630,10 @@ var wn = {
|
|
|
2630
2630
|
linear: 9986,
|
|
2631
2631
|
nearest: 9984
|
|
2632
2632
|
}
|
|
2633
|
-
},
|
|
2633
|
+
}, En = {
|
|
2634
2634
|
linear: 9729,
|
|
2635
2635
|
nearest: 9728
|
|
2636
|
-
},
|
|
2636
|
+
}, Dn = {
|
|
2637
2637
|
never: 512,
|
|
2638
2638
|
less: 513,
|
|
2639
2639
|
equal: 514,
|
|
@@ -2642,32 +2642,32 @@ var wn = {
|
|
|
2642
2642
|
"not-equal": 517,
|
|
2643
2643
|
"greater-equal": 518,
|
|
2644
2644
|
always: 519
|
|
2645
|
-
},
|
|
2645
|
+
}, On = {
|
|
2646
2646
|
"clamp-to-edge": 33071,
|
|
2647
2647
|
repeat: 10497,
|
|
2648
2648
|
"mirror-repeat": 33648
|
|
2649
2649
|
};
|
|
2650
|
-
function
|
|
2650
|
+
function kn(e, t, n, r, i, a, o, s) {
|
|
2651
2651
|
let { addressModeU: c = "repeat", addressModeV: l = "repeat", addressModeW: u = "repeat", magFilter: d = "linear", minFilter: f = "linear", mipmapFilter: p = "linear", maxAnisotropy: m = 0, compare: h } = e, g = a;
|
|
2652
2652
|
if (!s || c !== "repeat" || l !== "repeat" || u !== "repeat") {
|
|
2653
|
-
let e =
|
|
2653
|
+
let e = On[o ? "clamp-to-edge" : c], n = On[o ? "clamp-to-edge" : l], r = On[o ? "clamp-to-edge" : u];
|
|
2654
2654
|
t[i](g, t.TEXTURE_WRAP_S, e), t[i](g, t.TEXTURE_WRAP_T, n), t.TEXTURE_WRAP_R && t[i](g, t.TEXTURE_WRAP_R, r);
|
|
2655
2655
|
}
|
|
2656
|
-
if ((!s || d !== "linear") && t[i](g, t.TEXTURE_MAG_FILTER,
|
|
2656
|
+
if ((!s || d !== "linear") && t[i](g, t.TEXTURE_MAG_FILTER, En[d]), n) {
|
|
2657
2657
|
if (!s || p !== "linear") {
|
|
2658
|
-
let e =
|
|
2658
|
+
let e = Tn[f][p];
|
|
2659
2659
|
t[i](g, t.TEXTURE_MIN_FILTER, e);
|
|
2660
2660
|
}
|
|
2661
|
-
} else t[i](g, t.TEXTURE_MIN_FILTER,
|
|
2661
|
+
} else t[i](g, t.TEXTURE_MIN_FILTER, En[f]);
|
|
2662
2662
|
if (r && m > 1) {
|
|
2663
2663
|
let e = Math.min(m, t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));
|
|
2664
2664
|
t[i](g, r.TEXTURE_MAX_ANISOTROPY_EXT, e);
|
|
2665
2665
|
}
|
|
2666
|
-
h && t[i](g, t.TEXTURE_COMPARE_FUNC,
|
|
2666
|
+
h && t[i](g, t.TEXTURE_COMPARE_FUNC, Dn[h]);
|
|
2667
2667
|
}
|
|
2668
2668
|
//#endregion
|
|
2669
2669
|
//#region src/core/renderers/gl/texture/uploaders/index.ts
|
|
2670
|
-
var
|
|
2670
|
+
var An = {
|
|
2671
2671
|
buffer: {
|
|
2672
2672
|
id: "buffer",
|
|
2673
2673
|
upload: (e, t, n) => {
|
|
@@ -2681,8 +2681,8 @@ var kn = {
|
|
|
2681
2681
|
c < o || l < s ? ((i !== o || a !== s) && n.texImage2D(t.target, 0, t.internalFormat, o, s, 0, t.format, t.type, null), r === 2 ? n.texSubImage2D(n.TEXTURE_2D, 0, 0, 0, c, l, t.format, t.type, e.source) : n.texSubImage2D(n.TEXTURE_2D, 0, 0, 0, t.format, t.type, e.source)) : i === o && a === s ? n.texSubImage2D(n.TEXTURE_2D, 0, 0, 0, t.format, t.type, e.source) : r === 2 ? n.texImage2D(t.target, 0, t.internalFormat, o, s, 0, t.format, t.type, e.source) : n.texImage2D(t.target, 0, t.internalFormat, t.format, t.type, e.source), t.width = o, t.height = s;
|
|
2682
2682
|
}
|
|
2683
2683
|
}
|
|
2684
|
-
},
|
|
2685
|
-
uploaders = { ...
|
|
2684
|
+
}, jn = class extends A {
|
|
2685
|
+
uploaders = { ...An };
|
|
2686
2686
|
textures = /* @__PURE__ */ new Map();
|
|
2687
2687
|
glTextures = /* @__PURE__ */ new Map();
|
|
2688
2688
|
_mapFormatToInternalFormat = Object.create(null);
|
|
@@ -2697,14 +2697,14 @@ var kn = {
|
|
|
2697
2697
|
super.install(e), e.texture = this;
|
|
2698
2698
|
}
|
|
2699
2699
|
_updateContext(e) {
|
|
2700
|
-
super._updateContext(e), Object.keys(this._mapFormatToInternalFormat).length || (this._mapFormatToInternalFormat =
|
|
2700
|
+
super._updateContext(e), Object.keys(this._mapFormatToInternalFormat).length || (this._mapFormatToInternalFormat = Cn(e, this._renderer.extensions), this._mapFormatToType = wn(e), this._mapFormatToFormat = Sn(e)), this.maxTextureSize = e.getParameter(e.MAX_TEXTURE_SIZE), this.maxTextureImageUnits = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);
|
|
2701
2701
|
for (let e = 0; e < this.maxTextureImageUnits; e++) this.unbind(e);
|
|
2702
2702
|
}
|
|
2703
2703
|
getGlTexture(e) {
|
|
2704
2704
|
return this.glTextures.get(e.instanceId) || this._createGlTexture(e);
|
|
2705
2705
|
}
|
|
2706
2706
|
_createGlTexture(e) {
|
|
2707
|
-
let t = this._gl, n = new
|
|
2707
|
+
let t = this._gl, n = new xn(t.createTexture());
|
|
2708
2708
|
if (t.bindTexture(n.target, n.native), n.type = this._mapFormatToType[e.format], n.internalFormat = this._mapFormatToInternalFormat[e.format], n.format = this._mapFormatToFormat[e.format], this.glTextures.set(e.instanceId, n), e.mipmap && (this._renderer.supports.nonPowOf2mipmaps || e.isPowerOfTwo)) {
|
|
2709
2709
|
let t = Math.max(e.width, e.height);
|
|
2710
2710
|
e.mipLevelCount = Math.floor(Math.log2(t)) + 1;
|
|
@@ -2764,7 +2764,7 @@ var kn = {
|
|
|
2764
2764
|
}
|
|
2765
2765
|
updateStyle(e, t = !1) {
|
|
2766
2766
|
let n = this._gl;
|
|
2767
|
-
|
|
2767
|
+
kn(e, n, e.mipLevelCount > 1, this._renderer.extensions.anisotropicFiltering, "texParameteri", n.TEXTURE_2D, !this._renderer.supports.nonPowOf2wrapping && !e.isPowerOfTwo, t);
|
|
2768
2768
|
}
|
|
2769
2769
|
updateGpuTexture(e) {
|
|
2770
2770
|
this.bind(e);
|
|
@@ -2779,7 +2779,7 @@ var kn = {
|
|
|
2779
2779
|
let e = this._gl;
|
|
2780
2780
|
this._renderer.contextLost || this.glTextures.forEach((t) => e.deleteTexture(t.native)), this.textures.clear(), this.glTextures.clear(), this._location = 0, this.current.length = 0, this._premultiplyAlpha = !1, this._renderer.contextLost || e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this._premultiplyAlpha);
|
|
2781
2781
|
}
|
|
2782
|
-
},
|
|
2782
|
+
}, Mn = {
|
|
2783
2783
|
uint8x2: M.UNSIGNED_BYTE,
|
|
2784
2784
|
uint8x4: M.UNSIGNED_BYTE,
|
|
2785
2785
|
sint8x2: M.BYTE,
|
|
@@ -2811,18 +2811,18 @@ var kn = {
|
|
|
2811
2811
|
sint32x3: M.INT,
|
|
2812
2812
|
sint32x4: M.INT
|
|
2813
2813
|
};
|
|
2814
|
-
function
|
|
2815
|
-
return
|
|
2814
|
+
function Nn(e) {
|
|
2815
|
+
return Mn[e] ?? Mn.float32;
|
|
2816
2816
|
}
|
|
2817
2817
|
//#endregion
|
|
2818
2818
|
//#region src/core/renderers/gl/geometry/GlGeometrySystem.ts
|
|
2819
|
-
var
|
|
2819
|
+
var Pn = {
|
|
2820
2820
|
"point-list": 0,
|
|
2821
2821
|
"line-list": 1,
|
|
2822
2822
|
"line-strip": 3,
|
|
2823
2823
|
"triangle-list": 4,
|
|
2824
2824
|
"triangle-strip": 5
|
|
2825
|
-
},
|
|
2825
|
+
}, Fn = class extends A {
|
|
2826
2826
|
_geometryVaoHash = {};
|
|
2827
2827
|
hasInstance = !1;
|
|
2828
2828
|
current = null;
|
|
@@ -2861,11 +2861,11 @@ var Nn = {
|
|
|
2861
2861
|
}
|
|
2862
2862
|
for (let e in r) {
|
|
2863
2863
|
let t = r[e];
|
|
2864
|
-
i[t.buffer.instanceId] +=
|
|
2864
|
+
i[t.buffer.instanceId] += Jt(t.format).stride;
|
|
2865
2865
|
}
|
|
2866
2866
|
for (let e in r) {
|
|
2867
2867
|
let t = r[e];
|
|
2868
|
-
t.stride ??= i[t.buffer.instanceId], t.start ??= a[t.buffer.instanceId], a[t.buffer.instanceId] +=
|
|
2868
|
+
t.stride ??= i[t.buffer.instanceId], t.start ??= a[t.buffer.instanceId], a[t.buffer.instanceId] += Jt(t.format).stride;
|
|
2869
2869
|
}
|
|
2870
2870
|
}
|
|
2871
2871
|
_createVao(e, t) {
|
|
@@ -2900,7 +2900,7 @@ var Nn = {
|
|
|
2900
2900
|
a !== c && (r.bind(s), a = c);
|
|
2901
2901
|
let e = l.location;
|
|
2902
2902
|
n.enableVertexAttribArray(e);
|
|
2903
|
-
let t =
|
|
2903
|
+
let t = Jt(o.format), i = Nn(o.format);
|
|
2904
2904
|
if (l.format?.substring(1, 4) === "int" ? n.vertexAttribIPointer(e, t.size, i, o.stride ?? 0, o.start ?? 0) : n.vertexAttribPointer(e, t.size, i, t.normalized, o.stride ?? 0, o.start ?? 0), o.instance) if (this.hasInstance) {
|
|
2905
2905
|
let t = o.divisor ?? 1;
|
|
2906
2906
|
n.vertexAttribDivisor(e, t);
|
|
@@ -2933,7 +2933,7 @@ var Nn = {
|
|
|
2933
2933
|
let { topology: t, size: n, start: r = 0, instanceCount: i } = e, { gl: a } = this._renderer, o = this.current;
|
|
2934
2934
|
if (!o) return this;
|
|
2935
2935
|
t = t || o.topology || "triangle-list";
|
|
2936
|
-
let s =
|
|
2936
|
+
let s = Pn[t];
|
|
2937
2937
|
if (i = i || o.instanceCount || 1, o.indexBuffer) {
|
|
2938
2938
|
n ||= o.indexBuffer.data.length;
|
|
2939
2939
|
let e = o.indexBuffer.data.BYTES_PER_ELEMENT, t = e === 2 ? a.UNSIGNED_SHORT : a.UNSIGNED_INT;
|
|
@@ -2954,7 +2954,7 @@ var Nn = {
|
|
|
2954
2954
|
}
|
|
2955
2955
|
this._geometryVaoHash = {}, this.current = null, this.currentVao = null;
|
|
2956
2956
|
}
|
|
2957
|
-
},
|
|
2957
|
+
}, In = class extends A {
|
|
2958
2958
|
install(e) {
|
|
2959
2959
|
super.install(e), e.colorMask = this;
|
|
2960
2960
|
}
|
|
@@ -2965,19 +2965,19 @@ var Nn = {
|
|
|
2965
2965
|
};
|
|
2966
2966
|
//#endregion
|
|
2967
2967
|
//#region src/core/renderers/gl/GlScissorSystem.ts
|
|
2968
|
-
function
|
|
2968
|
+
function Ln(e, t, n) {
|
|
2969
2969
|
let [r, i, a, o, s, c, l, u, d] = e, f = r * t + o * n + l, p = i * t + s * n + u, m = a * t + c * n + d;
|
|
2970
2970
|
return {
|
|
2971
2971
|
x: f / m,
|
|
2972
2972
|
y: p / m
|
|
2973
2973
|
};
|
|
2974
2974
|
}
|
|
2975
|
-
function
|
|
2975
|
+
function Rn(e, t) {
|
|
2976
2976
|
let { x: n, y: r, width: i, height: a } = t, o = [
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2977
|
+
Ln(e, n, r),
|
|
2978
|
+
Ln(e, n + i, r),
|
|
2979
|
+
Ln(e, n + i, r + a),
|
|
2980
|
+
Ln(e, n, r + a)
|
|
2981
2981
|
], s = o.map((e) => e.x), c = o.map((e) => e.y), l = Math.min(...s), u = Math.max(...s), d = Math.min(...c), f = Math.max(...c);
|
|
2982
2982
|
return {
|
|
2983
2983
|
x: l,
|
|
@@ -2986,7 +2986,7 @@ function Ln(e, t) {
|
|
|
2986
2986
|
height: f - d
|
|
2987
2987
|
};
|
|
2988
2988
|
}
|
|
2989
|
-
var
|
|
2989
|
+
var zn = class extends A {
|
|
2990
2990
|
install(e) {
|
|
2991
2991
|
super.install(e), e.scissor = this;
|
|
2992
2992
|
}
|
|
@@ -3013,28 +3013,28 @@ var Rn = class extends A {
|
|
|
3013
3013
|
bind(e) {
|
|
3014
3014
|
let t = this._gl;
|
|
3015
3015
|
if (e) {
|
|
3016
|
-
let { pixelRatio: n, viewport: r } = this._renderer, { viewMatrix: i } = this._renderer.shader.uniforms, { x: a, y: o, width: s, height: c } =
|
|
3016
|
+
let { pixelRatio: n, viewport: r } = this._renderer, { viewMatrix: i } = this._renderer.shader.uniforms, { x: a, y: o, width: s, height: c } = Rn(i, e), l = r.current.height / n - (o + c);
|
|
3017
3017
|
t.scissor(a * n, l * n, s * n, c * n);
|
|
3018
3018
|
} else t.disable(t.SCISSOR_TEST);
|
|
3019
3019
|
}
|
|
3020
3020
|
destroy() {
|
|
3021
3021
|
super.destroy(), this._renderer.renderTarget.off("updateRenderTarget", this._updateRenderTarget);
|
|
3022
3022
|
}
|
|
3023
|
-
},
|
|
3023
|
+
}, Bn = class extends Ot {
|
|
3024
3024
|
contextLost = !1;
|
|
3025
3025
|
_systems = [
|
|
3026
|
-
new
|
|
3027
|
-
new
|
|
3028
|
-
new
|
|
3029
|
-
new Pn(),
|
|
3030
|
-
new _n(),
|
|
3031
|
-
new sn(),
|
|
3032
|
-
new fn(),
|
|
3026
|
+
new jn(),
|
|
3027
|
+
new Pt(),
|
|
3028
|
+
new tn(),
|
|
3033
3029
|
new Fn(),
|
|
3034
|
-
new
|
|
3035
|
-
new Rn(),
|
|
3030
|
+
new vn(),
|
|
3036
3031
|
new cn(),
|
|
3037
|
-
new
|
|
3032
|
+
new pn(),
|
|
3033
|
+
new In(),
|
|
3034
|
+
new hn(),
|
|
3035
|
+
new zn(),
|
|
3036
|
+
new ln(),
|
|
3037
|
+
new gn()
|
|
3038
3038
|
];
|
|
3039
3039
|
bindPoints = /* @__PURE__ */ new Map();
|
|
3040
3040
|
supports = {
|
|
@@ -3046,13 +3046,13 @@ var Rn = class extends A {
|
|
|
3046
3046
|
msaa: !0,
|
|
3047
3047
|
nonPowOf2mipmaps: !0
|
|
3048
3048
|
};
|
|
3049
|
-
constructor(e =
|
|
3049
|
+
constructor(e = S(), t) {
|
|
3050
3050
|
if (super(), !e) throw Error("Failed to createHTMLCanvas");
|
|
3051
|
-
|
|
3051
|
+
Qe(e) ? this._setupContext(e, t) : (this.gl = e, this.version = $e(this.gl) ? 2 : 1), this._setupBindPoints()._setupExtensions()._setupPolyfill()._setupSupports(), this._systems.forEach((e) => e.install(this)), this._systems.forEach((e) => e.emit("updateContext", this.gl)), this._systems.forEach((e) => e.emit("setup"));
|
|
3052
3052
|
}
|
|
3053
3053
|
_setupContext(e, t) {
|
|
3054
3054
|
this.view = e;
|
|
3055
|
-
let n =
|
|
3055
|
+
let n = at()?.(e, t), r = n && $e(n) ? 2 : 1;
|
|
3056
3056
|
if (n || (n = e.getContext("webgl2", t) || e.getContext("experimental-webgl2", t), r = 2), n || (n = e.getContext("webgl", t) || e.getContext("experimental-webgl", t), r = 1), !n) throw Error("Unable to getContext");
|
|
3057
3057
|
return this.gl = n, this.version = r, this._contextLost = this._contextLost.bind(this), this._contextRestored = this._contextRestored.bind(this), typeof e.addEventListener == "function" && (e.addEventListener("webglcontextlost", this._contextLost, !1), e.addEventListener("webglcontextrestored", this._contextRestored, !1)), this;
|
|
3058
3058
|
}
|
|
@@ -3128,8 +3128,8 @@ var Rn = class extends A {
|
|
|
3128
3128
|
height: this.screen.height * this.pixelRatio
|
|
3129
3129
|
});
|
|
3130
3130
|
}
|
|
3131
|
-
clear(e =
|
|
3132
|
-
typeof e == "boolean" && (e = e ?
|
|
3131
|
+
clear(e = fn.all) {
|
|
3132
|
+
typeof e == "boolean" && (e = e ? fn.all : fn.none), e && this.gl.clear(e);
|
|
3133
3133
|
}
|
|
3134
3134
|
reset() {
|
|
3135
3135
|
this._systems.forEach((e) => e.reset());
|
|
@@ -3146,7 +3146,7 @@ var Rn = class extends A {
|
|
|
3146
3146
|
for (let e = 0; e < i; e += a) c.set(s.subarray(e, e + a), o - e);
|
|
3147
3147
|
return c;
|
|
3148
3148
|
}
|
|
3149
|
-
},
|
|
3149
|
+
}, Vn = class {}, Hn = class extends Vn {
|
|
3150
3150
|
install(e) {
|
|
3151
3151
|
let t = async (e) => {
|
|
3152
3152
|
let { parseFont: t } = await import("modern-font");
|
|
@@ -3160,15 +3160,15 @@ var Rn = class extends A {
|
|
|
3160
3160
|
e.register(n, t);
|
|
3161
3161
|
}), e.font = this, this;
|
|
3162
3162
|
}
|
|
3163
|
-
},
|
|
3163
|
+
}, Un = class extends w {
|
|
3164
3164
|
constructor(e) {
|
|
3165
3165
|
super(), this.setProperties(e);
|
|
3166
3166
|
}
|
|
3167
3167
|
};
|
|
3168
|
-
O([_({ fallback: k.index }), D("design:type", k === void 0 ? Object : k)],
|
|
3168
|
+
O([_({ fallback: k.index }), D("design:type", k === void 0 ? Object : k)], Un.prototype, "usage", void 0), O([_({ default: () => new Uint32Array() }), D("design:type", Object)], Un.prototype, "data", void 0);
|
|
3169
3169
|
//#endregion
|
|
3170
3170
|
//#region src/scene/resources/geometries/Geometry.ts
|
|
3171
|
-
var
|
|
3171
|
+
var Wn = class extends w {
|
|
3172
3172
|
constructor(e = {}) {
|
|
3173
3173
|
super(), this.setProperties(e);
|
|
3174
3174
|
}
|
|
@@ -3176,7 +3176,7 @@ var Un = class extends w {
|
|
|
3176
3176
|
e.flush(), t.activate(e, n), e.geometry.bind(this, t.glProgram), e.geometry.draw(), e.geometry.unbind();
|
|
3177
3177
|
}
|
|
3178
3178
|
};
|
|
3179
|
-
O([_({ fallback: "triangle-list" }), D("design:type", Object)],
|
|
3179
|
+
O([_({ fallback: "triangle-list" }), D("design:type", Object)], Wn.prototype, "topology", void 0), O([_({ default: () => ({}) }), D("design:type", typeof Record > "u" ? Object : Record)], Wn.prototype, "attributes", void 0), O([_({ default: () => new Un() }), D("design:type", Un === void 0 ? Object : Un)], Wn.prototype, "indexBuffer", void 0), O([_({ fallback: 1 }), D("design:type", Number)], Wn.prototype, "instanceCount", void 0);
|
|
3180
3180
|
//#endregion
|
|
3181
3181
|
//#region src/scene/resources/geometries/VertexBuffer.ts
|
|
3182
3182
|
var N = class extends w {
|
|
@@ -3195,7 +3195,7 @@ var P = class extends w {
|
|
|
3195
3195
|
O([_({ default: () => new N() }), D("design:type", N === void 0 ? Object : N)], P.prototype, "buffer", void 0), O([_({ fallback: "float32" }), D("design:type", Object)], P.prototype, "format", void 0), O([_(), D("design:type", Boolean)], P.prototype, "instance", void 0), O([_(), D("design:type", Number)], P.prototype, "stride", void 0), O([_(), D("design:type", Number)], P.prototype, "offset", void 0), O([_(), D("design:type", Number)], P.prototype, "start", void 0), O([_(), D("design:type", Number)], P.prototype, "divisor", void 0);
|
|
3196
3196
|
//#endregion
|
|
3197
3197
|
//#region src/scene/resources/geometries/QuadGeometry.ts
|
|
3198
|
-
var
|
|
3198
|
+
var Gn = class extends Wn {
|
|
3199
3199
|
constructor() {
|
|
3200
3200
|
super({
|
|
3201
3201
|
topology: "triangle-strip",
|
|
@@ -3212,7 +3212,7 @@ var Wn = class extends Un {
|
|
|
3212
3212
|
1
|
|
3213
3213
|
]) })
|
|
3214
3214
|
}) },
|
|
3215
|
-
indexBuffer: new
|
|
3215
|
+
indexBuffer: new Un({ data: new Uint32Array([
|
|
3216
3216
|
0,
|
|
3217
3217
|
1,
|
|
3218
3218
|
3,
|
|
@@ -3223,7 +3223,7 @@ var Wn = class extends Un {
|
|
|
3223
3223
|
};
|
|
3224
3224
|
//#endregion
|
|
3225
3225
|
//#region src/scene/resources/materials/Material.ts
|
|
3226
|
-
function
|
|
3226
|
+
function Kn() {
|
|
3227
3227
|
return {
|
|
3228
3228
|
projectionMatrix: new Float32Array([
|
|
3229
3229
|
1,
|
|
@@ -3261,7 +3261,7 @@ var F = class extends w {
|
|
|
3261
3261
|
constructor(e = {}) {
|
|
3262
3262
|
super();
|
|
3263
3263
|
let { uniforms: t, gl: n } = e;
|
|
3264
|
-
t && (this.uniforms = t), this.glProgram = new
|
|
3264
|
+
t && (this.uniforms = t), this.glProgram = new Kt({
|
|
3265
3265
|
vertex: "in vec2 position;\nuniform mat3 projectionMatrix;\nuniform mat3 modelViewMatrix;\nvoid main(void) {\n gl_Position = vec4((projectionMatrix * modelViewMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}",
|
|
3266
3266
|
fragment: "uniform vec4 tint;\nvoid main(void) {\n gl_FragColor = tint;\n}",
|
|
3267
3267
|
...n
|
|
@@ -3274,13 +3274,13 @@ var F = class extends w {
|
|
|
3274
3274
|
}, e.shader.updateUniforms(this);
|
|
3275
3275
|
}
|
|
3276
3276
|
};
|
|
3277
|
-
O([_({ default:
|
|
3277
|
+
O([_({ default: Kn }), D("design:type", typeof Record > "u" ? Object : Record)], F.prototype, "uniforms", void 0);
|
|
3278
3278
|
//#endregion
|
|
3279
3279
|
//#region src/scene/resources/materials/EffectMaterial.ts
|
|
3280
|
-
var
|
|
3281
|
-
function
|
|
3280
|
+
var qn = /^uniform \w+ (.+?);\s*\/\/\s*=\s*([^;]+?)[\s;]*$/gm, Jn = /vec(\d)\((.*)\)/;
|
|
3281
|
+
function Yn(e) {
|
|
3282
3282
|
e = e.trim();
|
|
3283
|
-
let t = e.match(
|
|
3283
|
+
let t = e.match(Jn);
|
|
3284
3284
|
if (t) {
|
|
3285
3285
|
let e = Array.from({ length: Number(t[1]) }, () => 0);
|
|
3286
3286
|
return t[2].split(",").forEach((t, n) => {
|
|
@@ -3289,7 +3289,7 @@ function Jn(e) {
|
|
|
3289
3289
|
}
|
|
3290
3290
|
return Number(e);
|
|
3291
3291
|
}
|
|
3292
|
-
var
|
|
3292
|
+
var Xn = class e extends F {
|
|
3293
3293
|
static RE = {
|
|
3294
3294
|
getColor: /\sgetColor\s*\(/,
|
|
3295
3295
|
getFromColor: /\sgetFromColor\s*\(/,
|
|
@@ -3325,12 +3325,12 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3325
3325
|
progress: 0
|
|
3326
3326
|
}
|
|
3327
3327
|
}), this.has = n;
|
|
3328
|
-
let r = t.matchAll(
|
|
3328
|
+
let r = t.matchAll(qn);
|
|
3329
3329
|
for (let e of r) e[1] && e[2] && e[1].split(",").forEach((t) => {
|
|
3330
|
-
this.uniforms[t.trim()] =
|
|
3330
|
+
this.uniforms[t.trim()] = Yn(e[2]);
|
|
3331
3331
|
});
|
|
3332
3332
|
}
|
|
3333
|
-
},
|
|
3333
|
+
}, Zn = class extends F {
|
|
3334
3334
|
static _instance;
|
|
3335
3335
|
static get instance() {
|
|
3336
3336
|
return this._instance ??= new this();
|
|
@@ -3374,12 +3374,12 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3374
3374
|
}
|
|
3375
3375
|
});
|
|
3376
3376
|
}
|
|
3377
|
-
}, I = class extends
|
|
3377
|
+
}, I = class extends Wn {
|
|
3378
3378
|
static _instance;
|
|
3379
3379
|
static get instance() {
|
|
3380
3380
|
return this._instance ??= new this();
|
|
3381
3381
|
}
|
|
3382
|
-
static draw(e, t =
|
|
3382
|
+
static draw(e, t = Zn.instance, n) {
|
|
3383
3383
|
this.instance.draw(e, t, n);
|
|
3384
3384
|
}
|
|
3385
3385
|
constructor() {
|
|
@@ -3412,7 +3412,7 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3412
3412
|
]) })
|
|
3413
3413
|
})
|
|
3414
3414
|
},
|
|
3415
|
-
indexBuffer: new
|
|
3415
|
+
indexBuffer: new Un({ data: new Uint32Array([
|
|
3416
3416
|
0,
|
|
3417
3417
|
1,
|
|
3418
3418
|
2,
|
|
@@ -3422,7 +3422,7 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3422
3422
|
]) })
|
|
3423
3423
|
});
|
|
3424
3424
|
}
|
|
3425
|
-
},
|
|
3425
|
+
}, Qn = class extends Wn {
|
|
3426
3426
|
positionBuffer;
|
|
3427
3427
|
uvBuffer;
|
|
3428
3428
|
constructor(e) {
|
|
@@ -3439,7 +3439,7 @@ ${t}${n.transform ? "\nvoid main(void) { gl_FragColor = transform(vUv); }" : n.t
|
|
|
3439
3439
|
buffer: n
|
|
3440
3440
|
})
|
|
3441
3441
|
},
|
|
3442
|
-
indexBuffer: new
|
|
3442
|
+
indexBuffer: new Un({ data: new Uint32Array() })
|
|
3443
3443
|
}), this.positionBuffer = t, this.uvBuffer = n;
|
|
3444
3444
|
}
|
|
3445
3445
|
}, L = class extends w {
|
|
@@ -3550,7 +3550,7 @@ var R = class extends w {
|
|
|
3550
3550
|
switch (super._updateProperty(e, t, n), e) {
|
|
3551
3551
|
case "width":
|
|
3552
3552
|
case "height":
|
|
3553
|
-
this.isPowerOfTwo =
|
|
3553
|
+
this.isPowerOfTwo = Ce(this.pixelWidth) && Ce(this.pixelHeight);
|
|
3554
3554
|
break;
|
|
3555
3555
|
case "source":
|
|
3556
3556
|
this.updateSize();
|
|
@@ -3567,13 +3567,13 @@ var R = class extends w {
|
|
|
3567
3567
|
e.texture.unbind(this);
|
|
3568
3568
|
}
|
|
3569
3569
|
_destroy() {
|
|
3570
|
-
super._destroy(),
|
|
3570
|
+
super._destroy(), Ne && this.source instanceof ImageBitmap && this.source.close();
|
|
3571
3571
|
}
|
|
3572
3572
|
};
|
|
3573
3573
|
O([_({ fallback: "unknown" }), D("design:type", String)], R.prototype, "uploadMethodId", void 0), O([_({ internal: !0 }), D("design:type", Object)], R.prototype, "source", void 0), O([_({ fallback: 0 }), D("design:type", Number)], R.prototype, "width", void 0), O([_({ fallback: 0 }), D("design:type", Number)], R.prototype, "height", void 0), O([_({ fallback: 1 }), D("design:type", Number)], R.prototype, "pixelRatio", void 0), O([_({ fallback: "bgra8unorm" }), D("design:type", Object)], R.prototype, "format", void 0), O([_({ fallback: "premultiply-alpha-on-upload" }), D("design:type", Object)], R.prototype, "alphaMode", void 0), O([_({ fallback: 1 }), D("design:type", Number)], R.prototype, "mipLevelCount", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], R.prototype, "mipmap", void 0), O([_({ fallback: "clamp-to-edge" }), D("design:type", Object)], R.prototype, "addressModeU", void 0), O([_({ fallback: "clamp-to-edge" }), D("design:type", Object)], R.prototype, "addressModeV", void 0), O([_({ fallback: "clamp-to-edge" }), D("design:type", Object)], R.prototype, "addressModeW", void 0), O([_({ fallback: "linear" }), D("design:type", Object)], R.prototype, "magFilter", void 0), O([_({ fallback: "linear" }), D("design:type", Object)], R.prototype, "minFilter", void 0), O([_({ fallback: "linear" }), D("design:type", Object)], R.prototype, "mipmapFilter", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], R.prototype, "isPowerOfTwo", void 0);
|
|
3574
3574
|
//#endregion
|
|
3575
3575
|
//#region src/scene/resources/textures/AnimatedTexture.ts
|
|
3576
|
-
var
|
|
3576
|
+
var $n = class extends w {
|
|
3577
3577
|
frames;
|
|
3578
3578
|
frameIndex = 0;
|
|
3579
3579
|
get currentFrame() {
|
|
@@ -3598,12 +3598,12 @@ var Qn = class extends w {
|
|
|
3598
3598
|
e.texture.destroy();
|
|
3599
3599
|
});
|
|
3600
3600
|
}
|
|
3601
|
-
},
|
|
3601
|
+
}, er = class extends R {
|
|
3602
3602
|
constructor(e = {}) {
|
|
3603
3603
|
super({
|
|
3604
3604
|
pixelRatio: 2,
|
|
3605
3605
|
...e,
|
|
3606
|
-
source: e.source ??
|
|
3606
|
+
source: e.source ?? S(),
|
|
3607
3607
|
uploadMethodId: "image"
|
|
3608
3608
|
});
|
|
3609
3609
|
}
|
|
@@ -3618,7 +3618,7 @@ var Qn = class extends w {
|
|
|
3618
3618
|
}
|
|
3619
3619
|
super._updateProperty(e, t, n);
|
|
3620
3620
|
}
|
|
3621
|
-
},
|
|
3621
|
+
}, tr = class e extends R {
|
|
3622
3622
|
static _cached = /* @__PURE__ */ new Map();
|
|
3623
3623
|
static get(t) {
|
|
3624
3624
|
let n = new T(t), r = n.toHex(), i = this._cached.get(r);
|
|
@@ -3639,13 +3639,13 @@ var Qn = class extends w {
|
|
|
3639
3639
|
mipmap: !0
|
|
3640
3640
|
});
|
|
3641
3641
|
}
|
|
3642
|
-
},
|
|
3642
|
+
}, nr = class e extends R {
|
|
3643
3643
|
static test(e) {
|
|
3644
3644
|
return u(e);
|
|
3645
3645
|
}
|
|
3646
3646
|
static linearGradient(e, t, n) {
|
|
3647
3647
|
t ||= 1, n ||= 1;
|
|
3648
|
-
let r =
|
|
3648
|
+
let r = S(t, n);
|
|
3649
3649
|
if (!r) throw Error("GradientTexture requires a canvas; call setCanvasFactory() in non-browser environments.");
|
|
3650
3650
|
let i = r.getContext("2d");
|
|
3651
3651
|
if (!i) throw Error("Failed to parse linear gradient, get canvas context is null.");
|
|
@@ -3663,7 +3663,7 @@ var Qn = class extends w {
|
|
|
3663
3663
|
constructor(t, n, r) {
|
|
3664
3664
|
super(e.linearGradient(t, n, r));
|
|
3665
3665
|
}
|
|
3666
|
-
},
|
|
3666
|
+
}, rr = class extends R {
|
|
3667
3667
|
constructor(e = {}) {
|
|
3668
3668
|
super({
|
|
3669
3669
|
...e,
|
|
@@ -3673,7 +3673,7 @@ var Qn = class extends w {
|
|
|
3673
3673
|
};
|
|
3674
3674
|
//#endregion
|
|
3675
3675
|
//#region src/scene/resources/textures/VideoTexture.ts
|
|
3676
|
-
function
|
|
3676
|
+
function ir(e) {
|
|
3677
3677
|
return {
|
|
3678
3678
|
autoLoad: !!(e?.autoLoad ?? !0),
|
|
3679
3679
|
autoPlay: !!(e?.autoPlay ?? !1),
|
|
@@ -3684,7 +3684,7 @@ function rr(e) {
|
|
|
3684
3684
|
playsinline: !!(e?.playsinline ?? !0)
|
|
3685
3685
|
};
|
|
3686
3686
|
}
|
|
3687
|
-
var
|
|
3687
|
+
var ar = class e extends R {
|
|
3688
3688
|
static mimeTypes = new Map(Object.entries({
|
|
3689
3689
|
ogv: "video/ogg",
|
|
3690
3690
|
mov: "video/quicktime",
|
|
@@ -3718,13 +3718,13 @@ var ir = class e extends R {
|
|
|
3718
3718
|
_reject;
|
|
3719
3719
|
_seekResolves = [];
|
|
3720
3720
|
constructor(t, n) {
|
|
3721
|
-
let r =
|
|
3722
|
-
if (!
|
|
3721
|
+
let r = ir(n);
|
|
3722
|
+
if (!Xe(t)) {
|
|
3723
3723
|
typeof t == "string" && (t = [t]);
|
|
3724
3724
|
let n = t[0].src || t[0];
|
|
3725
3725
|
if (typeof document > "u") throw TypeError("VideoTexture requires a DOM <video> element and is not supported in non-browser environments.");
|
|
3726
3726
|
let i = document.createElement("video");
|
|
3727
|
-
r.autoLoad && i.setAttribute("preload", "auto"), r.playsinline && (i.setAttribute("webkit-playsinline", ""), i.setAttribute("playsinline", "")), r.muted && (i.setAttribute("muted", ""), i.muted = !0), r.loop && i.setAttribute("loop", ""), r.autoPlay && i.setAttribute("autoplay", ""),
|
|
3727
|
+
r.autoLoad && i.setAttribute("preload", "auto"), r.playsinline && (i.setAttribute("webkit-playsinline", ""), i.setAttribute("playsinline", "")), r.muted && (i.setAttribute("muted", ""), i.muted = !0), r.loop && i.setAttribute("loop", ""), r.autoPlay && i.setAttribute("autoplay", ""), st(i, n, r.crossorigin);
|
|
3728
3728
|
for (let n = 0; n < t.length; ++n) {
|
|
3729
3729
|
let { src: r, mime: a } = t[n];
|
|
3730
3730
|
if (r ||= t[n], r.startsWith("data:")) a = r.slice(5, r.indexOf(";"));
|
|
@@ -3787,13 +3787,13 @@ var ir = class e extends R {
|
|
|
3787
3787
|
});
|
|
3788
3788
|
}
|
|
3789
3789
|
_setupAutoUpdate() {
|
|
3790
|
-
this.autoUpdate && this.isPlaying ? !this.fps && this.source.requestVideoFrameCallback ? (this._connected && (
|
|
3790
|
+
this.autoUpdate && this.isPlaying ? !this.fps && this.source.requestVideoFrameCallback ? (this._connected && (x.off(this.requestUpload), this._connected = !1, this._nextTime = 0), this._requestId === void 0 && (this._requestId = this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))) : (this._requestId !== void 0 && (this.source.cancelVideoFrameCallback(this._requestId), this._requestId = void 0), this._connected || (x.on(this.requestUpload), this._connected = !0, this._nextTime = 0)) : (this._requestId !== void 0 && (this.source.cancelVideoFrameCallback(this._requestId), this._requestId = void 0), this._connected && (x.off(this.requestUpload), this._connected = !1, this._nextTime = 0));
|
|
3791
3791
|
}
|
|
3792
3792
|
_videoFrameRequestCallback = () => {
|
|
3793
3793
|
this.requestUpload(), this._requestId = this.source.requestVideoFrameCallback(this._videoFrameRequestCallback);
|
|
3794
3794
|
};
|
|
3795
3795
|
requestUpload = () => {
|
|
3796
|
-
let e = Math.floor(
|
|
3796
|
+
let e = Math.floor(x.elapsed * this.source.playbackRate);
|
|
3797
3797
|
this._nextTime -= e, (!this._spf || this._nextTime <= 0) && (this.requestUpdate("source"), this._nextTime = this._spf || 0);
|
|
3798
3798
|
};
|
|
3799
3799
|
async load() {
|
|
@@ -3814,13 +3814,13 @@ var ir = class e extends R {
|
|
|
3814
3814
|
O([_({
|
|
3815
3815
|
internal: !0,
|
|
3816
3816
|
fallback: !0
|
|
3817
|
-
}), D("design:type", Boolean)],
|
|
3817
|
+
}), D("design:type", Boolean)], ar.prototype, "autoUpdate", void 0), O([_({
|
|
3818
3818
|
internal: !0,
|
|
3819
3819
|
fallback: 0
|
|
3820
|
-
}), D("design:type", Number)],
|
|
3820
|
+
}), D("design:type", Number)], ar.prototype, "fps", void 0);
|
|
3821
3821
|
//#endregion
|
|
3822
3822
|
//#region src/scene/resources/textures/ViewportTexture.ts
|
|
3823
|
-
var
|
|
3823
|
+
var or = class extends R {}, sr = class extends le {
|
|
3824
3824
|
fillStyle;
|
|
3825
3825
|
fillRule;
|
|
3826
3826
|
strokeStyle;
|
|
@@ -3834,7 +3834,7 @@ var ar = class extends R {}, or = class extends ce {
|
|
|
3834
3834
|
_draws = [];
|
|
3835
3835
|
_triCache = [];
|
|
3836
3836
|
_parseDrawStyle(e) {
|
|
3837
|
-
return e ? e instanceof R ? { texture: e } : { texture:
|
|
3837
|
+
return e ? e instanceof R ? { texture: e } : { texture: tr.get(e) } : {};
|
|
3838
3838
|
}
|
|
3839
3839
|
stroke(e) {
|
|
3840
3840
|
if (!this.curves.length) return;
|
|
@@ -3851,7 +3851,7 @@ var ar = class extends R {}, or = class extends ce {
|
|
|
3851
3851
|
...e,
|
|
3852
3852
|
...this._parseDrawStyle(n),
|
|
3853
3853
|
type: "stroke",
|
|
3854
|
-
path: new
|
|
3854
|
+
path: new le(this),
|
|
3855
3855
|
transformUv: this.transformUv,
|
|
3856
3856
|
transformVertex: this.transformVertex,
|
|
3857
3857
|
lineStyle: {
|
|
@@ -3880,7 +3880,7 @@ var ar = class extends R {}, or = class extends ce {
|
|
|
3880
3880
|
l(this.style.fill) && (t = this.style.fill.color);
|
|
3881
3881
|
break;
|
|
3882
3882
|
}
|
|
3883
|
-
let n = new
|
|
3883
|
+
let n = new le(this), r = this.fillRule ?? this.style.fillRule;
|
|
3884
3884
|
r && (n.style.fillRule = r), this._draws.push({
|
|
3885
3885
|
transformUv: this.transformUv,
|
|
3886
3886
|
transformVertex: this.transformVertex,
|
|
@@ -3931,7 +3931,7 @@ var ar = class extends R {}, or = class extends ce {
|
|
|
3931
3931
|
destroy() {
|
|
3932
3932
|
this.reset(), this._triCache.length = 0;
|
|
3933
3933
|
}
|
|
3934
|
-
},
|
|
3934
|
+
}, cr = class {
|
|
3935
3935
|
front = [];
|
|
3936
3936
|
default = [];
|
|
3937
3937
|
back = [];
|
|
@@ -3974,7 +3974,7 @@ var ar = class extends R {}, or = class extends ce {
|
|
|
3974
3974
|
toJSON() {
|
|
3975
3975
|
return [...this.default];
|
|
3976
3976
|
}
|
|
3977
|
-
},
|
|
3977
|
+
}, lr = class extends C {
|
|
3978
3978
|
parent;
|
|
3979
3979
|
getPropertyDeclarations() {
|
|
3980
3980
|
super.getPropertyDeclarations();
|
|
@@ -3993,22 +3993,22 @@ var ar = class extends R {}, or = class extends ce {
|
|
|
3993
3993
|
deleteProperty: (e, t) => Reflect.has(e, t) || String(t).startsWith("_") ? Reflect.deleteProperty(e, t) : (e.setProperty(String(t), void 0), !0)
|
|
3994
3994
|
});
|
|
3995
3995
|
}
|
|
3996
|
-
},
|
|
3997
|
-
function
|
|
3998
|
-
let t =
|
|
3999
|
-
return t++,
|
|
3996
|
+
}, ur, dr = {};
|
|
3997
|
+
function fr(e) {
|
|
3998
|
+
let t = dr[e] ?? 0;
|
|
3999
|
+
return t++, dr[e] = t, t;
|
|
4000
4000
|
}
|
|
4001
|
-
var z =
|
|
4001
|
+
var z = ur = class extends C {
|
|
4002
4002
|
static parse(e, t = "Node") {
|
|
4003
4003
|
if (Array.isArray(e)) return e.map((e) => this.parse(e));
|
|
4004
|
-
let { is: n, meta: r = {}, children: i, ...a } = e, o = new ((
|
|
4004
|
+
let { is: n, meta: r = {}, children: i, ...a } = e, o = new ((ve.get(n ?? r.inCanvasIs ?? t)) ?? ur)({
|
|
4005
4005
|
...a,
|
|
4006
4006
|
meta: r
|
|
4007
4007
|
});
|
|
4008
4008
|
return i?.forEach((e) => o.appendChild(this.parse(e))), o;
|
|
4009
4009
|
}
|
|
4010
4010
|
_mask;
|
|
4011
|
-
_meta = new
|
|
4011
|
+
_meta = new lr(this);
|
|
4012
4012
|
get meta() {
|
|
4013
4013
|
return this._meta;
|
|
4014
4014
|
}
|
|
@@ -4031,7 +4031,7 @@ var z = lr = class extends C {
|
|
|
4031
4031
|
}).append(t), this.on("treeEnter", this._onTreeEnter).on("treeExit", this._onTreeExit).on("parented", this._onParented).on("unparented", this._onUnparented).on("ready", this._onReady).on("process", this._onProcess), this.updateProcessable(), this.updateRenderable();
|
|
4032
4032
|
}
|
|
4033
4033
|
_defaultName() {
|
|
4034
|
-
return `@${this.is}@${
|
|
4034
|
+
return `@${this.is}@${fr(this.is)}`;
|
|
4035
4035
|
}
|
|
4036
4036
|
setProperties(e) {
|
|
4037
4037
|
if (e) {
|
|
@@ -4098,7 +4098,7 @@ var z = lr = class extends C {
|
|
|
4098
4098
|
}
|
|
4099
4099
|
return this;
|
|
4100
4100
|
}
|
|
4101
|
-
_children = new
|
|
4101
|
+
_children = new cr();
|
|
4102
4102
|
get children() {
|
|
4103
4103
|
return this._children.default;
|
|
4104
4104
|
}
|
|
@@ -4258,7 +4258,7 @@ var z = lr = class extends C {
|
|
|
4258
4258
|
append(...e) {
|
|
4259
4259
|
let t;
|
|
4260
4260
|
t = Array.isArray(e[0]) ? e[0] : e, t.forEach((e) => {
|
|
4261
|
-
e instanceof
|
|
4261
|
+
e instanceof ur ? this.appendChild(e) : this.appendChild(ur.parse(e));
|
|
4262
4262
|
});
|
|
4263
4263
|
}
|
|
4264
4264
|
before(...e) {
|
|
@@ -4364,7 +4364,7 @@ var z = lr = class extends C {
|
|
|
4364
4364
|
O([_({ default: () => c() }), D("design:type", String)], z.prototype, "id", void 0), O([_({ default: () => c() }), D("design:type", String)], z.prototype, "name", void 0), O([_({ fallback: "inherit" }), D("design:type", Object)], z.prototype, "processMode", void 0), O([_({ fallback: "default" }), D("design:type", Object)], z.prototype, "processSortMode", void 0), O([_({ fallback: "inherit" }), D("design:type", Object)], z.prototype, "renderMode", void 0), O([_({ fallback: "inherit" }), D("design:type", Object)], z.prototype, "inputMode", void 0), O([_({ fallback: "default" }), D("design:type", Object)], z.prototype, "internalMode", void 0), O([_({
|
|
4365
4365
|
internal: !0,
|
|
4366
4366
|
default: !0
|
|
4367
|
-
}), D("design:type", Boolean)], z.prototype, "needsRender", void 0), z =
|
|
4367
|
+
}), D("design:type", Boolean)], z.prototype, "needsRender", void 0), z = ur = O([b("Node"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], z);
|
|
4368
4368
|
//#endregion
|
|
4369
4369
|
//#region src/scene/main/TimelineNode.ts
|
|
4370
4370
|
var B = class extends z {
|
|
@@ -4398,7 +4398,7 @@ var B = class extends z {
|
|
|
4398
4398
|
return this._globalStartTime + this._globalDuration;
|
|
4399
4399
|
}
|
|
4400
4400
|
get currentTimeProgress() {
|
|
4401
|
-
return this._duration ?
|
|
4401
|
+
return this._duration ? xt(this._currentTime / this._duration, 0, 1) : 0;
|
|
4402
4402
|
}
|
|
4403
4403
|
isInsideTimeRange() {
|
|
4404
4404
|
let e = this._currentTime;
|
|
@@ -4438,18 +4438,18 @@ var B = class extends z {
|
|
|
4438
4438
|
super._process(e), this._updateCurrentTime();
|
|
4439
4439
|
}
|
|
4440
4440
|
};
|
|
4441
|
-
O([_({ fallback: !1 }), D("design:type", Boolean)], B.prototype, "loop", void 0), O([_({ fallback: 0 }), D("design:type", Number)], B.prototype, "delay", void 0), O([_({ fallback: 0 }), D("design:type", Number)], B.prototype, "duration", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], B.prototype, "paused", void 0), B = O([
|
|
4441
|
+
O([_({ fallback: !1 }), D("design:type", Boolean)], B.prototype, "loop", void 0), O([_({ fallback: 0 }), D("design:type", Number)], B.prototype, "delay", void 0), O([_({ fallback: 0 }), D("design:type", Number)], B.prototype, "duration", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], B.prototype, "paused", void 0), B = O([b("TimelineNode"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], B);
|
|
4442
4442
|
//#endregion
|
|
4443
4443
|
//#region src/scene/main/CanvasItem.ts
|
|
4444
|
-
var
|
|
4445
|
-
function
|
|
4446
|
-
|
|
4444
|
+
var pr = [], mr = 0;
|
|
4445
|
+
function hr() {
|
|
4446
|
+
mr = 0;
|
|
4447
4447
|
}
|
|
4448
|
-
function
|
|
4449
|
-
let i =
|
|
4450
|
-
return i || (i = {},
|
|
4448
|
+
function gr(e, t, n, r) {
|
|
4449
|
+
let i = pr[mr];
|
|
4450
|
+
return i || (i = {}, pr[mr] = i), mr++, Object.assign(i, e), i.roundPixels = t, i.size = n, i.texture = r, i;
|
|
4451
4451
|
}
|
|
4452
|
-
var
|
|
4452
|
+
var _r = class extends B {
|
|
4453
4453
|
_blendMode;
|
|
4454
4454
|
_parentGlobalVisible;
|
|
4455
4455
|
_globalVisible;
|
|
@@ -4467,7 +4467,7 @@ var gr = class extends B {
|
|
|
4467
4467
|
255,
|
|
4468
4468
|
255
|
|
4469
4469
|
];
|
|
4470
|
-
context = new
|
|
4470
|
+
context = new sr();
|
|
4471
4471
|
_resetContext = !0;
|
|
4472
4472
|
needsDraw = !0;
|
|
4473
4473
|
needsLayout = !1;
|
|
@@ -4529,7 +4529,7 @@ var gr = class extends B {
|
|
|
4529
4529
|
}
|
|
4530
4530
|
_updateGlobalOpacity() {
|
|
4531
4531
|
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
4532
|
-
let e =
|
|
4532
|
+
let e = xt(this.opacity, 0, 1) * (this._parentGlobalOpacity ?? 1);
|
|
4533
4533
|
this._globalOpacity !== e && (this._globalOpacity = e, this._updateModulate(), this.requestPaint(), this.updateRenderable());
|
|
4534
4534
|
}
|
|
4535
4535
|
_draw() {
|
|
@@ -4597,7 +4597,7 @@ var gr = class extends B {
|
|
|
4597
4597
|
return;
|
|
4598
4598
|
}
|
|
4599
4599
|
let t = this._tree?.pixelate, n = this._tree?.roundPixels, r = this._batchables;
|
|
4600
|
-
for (let i, a, o = r.length, s = 0; s < o; s++) i = r[s], a = i.texture, a instanceof
|
|
4600
|
+
for (let i, a, o = r.length, s = 0; s < o; s++) i = r[s], a = i.texture, a instanceof or && (a = this._handleViewportTexture(i)), e.batch2D.render(gr(i, n, t ? i.size : void 0, a));
|
|
4601
4601
|
super._render(e);
|
|
4602
4602
|
}
|
|
4603
4603
|
_cullsRender() {
|
|
@@ -4607,13 +4607,13 @@ var gr = class extends B {
|
|
|
4607
4607
|
super._destroy(), this.context.destroy(), this._drawBatchables = [], this._layoutBatchables = [], this._batchables = [];
|
|
4608
4608
|
}
|
|
4609
4609
|
};
|
|
4610
|
-
O([_(), D("design:type", Object)],
|
|
4610
|
+
O([_(), D("design:type", Object)], _r.prototype, "blendMode", void 0), O([_({
|
|
4611
4611
|
internal: !0,
|
|
4612
4612
|
fallback: !0
|
|
4613
|
-
}), D("design:type", Boolean)],
|
|
4613
|
+
}), D("design:type", Boolean)], _r.prototype, "visible", void 0), O([_({
|
|
4614
4614
|
internal: !0,
|
|
4615
4615
|
fallback: 1
|
|
4616
|
-
}), D("design:type", Number)],
|
|
4616
|
+
}), D("design:type", Number)], _r.prototype, "opacity", void 0), _r = O([b("CanvasItem"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], _r);
|
|
4617
4617
|
//#endregion
|
|
4618
4618
|
//#region src/scene/main/Viewport.ts
|
|
4619
4619
|
var V = class extends z {
|
|
@@ -4666,7 +4666,7 @@ var V = class extends z {
|
|
|
4666
4666
|
return !1;
|
|
4667
4667
|
}
|
|
4668
4668
|
activateWithCopy(e, t) {
|
|
4669
|
-
this.resize(t.width, t.height), this.activate(e) && (e.clear(), t.texture.activate(e, 0), I.draw(e,
|
|
4669
|
+
this.resize(t.width, t.height), this.activate(e) && (e.clear(), t.texture.activate(e, 0), I.draw(e, Zn.instance, { sampler: 0 }));
|
|
4670
4670
|
}
|
|
4671
4671
|
renderStart(e, t) {
|
|
4672
4672
|
this.activate(e, t) && e.clear();
|
|
@@ -4679,7 +4679,7 @@ var V = class extends z {
|
|
|
4679
4679
|
this.renderStart(e), super.render(e, t), this.renderEnd(e, n);
|
|
4680
4680
|
}
|
|
4681
4681
|
getRect() {
|
|
4682
|
-
return new
|
|
4682
|
+
return new vt(this.x, this.y, this.width, this.height);
|
|
4683
4683
|
}
|
|
4684
4684
|
toCanvasGlobal(e, t) {
|
|
4685
4685
|
return this.canvasTransform.applyAffineInverse(e, t);
|
|
@@ -4691,7 +4691,7 @@ var V = class extends z {
|
|
|
4691
4691
|
super._destroy(), this.canvasTransform.destroy(), this.renderTargets.forEach((e) => e.destroy());
|
|
4692
4692
|
}
|
|
4693
4693
|
};
|
|
4694
|
-
O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "x", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "y", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "width", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "height", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "mipLevel", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], V.prototype, "msaa", void 0), V = O([
|
|
4694
|
+
O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "x", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "y", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "width", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "height", void 0), O([_({ fallback: 0 }), D("design:type", Number)], V.prototype, "mipLevel", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], V.prototype, "msaa", void 0), V = O([b("Viewport")], V);
|
|
4695
4695
|
//#endregion
|
|
4696
4696
|
//#region src/scene/main/Effect.ts
|
|
4697
4697
|
var H = class extends B {
|
|
@@ -4717,7 +4717,7 @@ var H = class extends B {
|
|
|
4717
4717
|
_updateProperty(e, t, n) {
|
|
4718
4718
|
switch (super._updateProperty(e, t, n), e) {
|
|
4719
4719
|
case "glsl": {
|
|
4720
|
-
let e = new
|
|
4720
|
+
let e = new Xn(t);
|
|
4721
4721
|
!this.effectMode && e.has.transition && (this.effectMode = "transition"), this.material = e;
|
|
4722
4722
|
break;
|
|
4723
4723
|
}
|
|
@@ -4752,7 +4752,7 @@ var H = class extends B {
|
|
|
4752
4752
|
}
|
|
4753
4753
|
}
|
|
4754
4754
|
getRect() {
|
|
4755
|
-
return new
|
|
4755
|
+
return new vt(this._rect);
|
|
4756
4756
|
}
|
|
4757
4757
|
_processParent() {
|
|
4758
4758
|
let e = this._tree?.renderStack;
|
|
@@ -4922,10 +4922,10 @@ var H = class extends B {
|
|
|
4922
4922
|
super._destroy(), this.viewport1.destroy(), this.viewport2.destroy();
|
|
4923
4923
|
}
|
|
4924
4924
|
};
|
|
4925
|
-
O([_({ internal: !0 }), D("design:type", Object)], H.prototype, "material", void 0), O([_(), D("design:type", Object)], H.prototype, "effectMode", void 0), O([_(), D("design:type", String)], H.prototype, "glsl", void 0), O([_(), D("design:type", String)], H.prototype, "glslSrc", void 0), H = O([
|
|
4925
|
+
O([_({ internal: !0 }), D("design:type", Object)], H.prototype, "material", void 0), O([_(), D("design:type", Object)], H.prototype, "effectMode", void 0), O([_(), D("design:type", String)], H.prototype, "glsl", void 0), O([_(), D("design:type", String)], H.prototype, "glslSrc", void 0), H = O([b("Effect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], H);
|
|
4926
4926
|
//#endregion
|
|
4927
4927
|
//#region src/scene/main/RenderStack.ts
|
|
4928
|
-
var
|
|
4928
|
+
var vr = class {
|
|
4929
4929
|
currentCall;
|
|
4930
4930
|
calls = [];
|
|
4931
4931
|
createCall(e) {
|
|
@@ -4947,11 +4947,11 @@ var _r = class {
|
|
|
4947
4947
|
});
|
|
4948
4948
|
}), this.calls = [];
|
|
4949
4949
|
}
|
|
4950
|
-
},
|
|
4950
|
+
}, yr, br = yr = class extends z {
|
|
4951
4951
|
currentTime = 0;
|
|
4952
4952
|
static from(e, t = !1) {
|
|
4953
4953
|
let [n, r] = e ? Array.isArray(e) ? e : [0, e] : [];
|
|
4954
|
-
return new
|
|
4954
|
+
return new yr({
|
|
4955
4955
|
startTime: n,
|
|
4956
4956
|
endTime: r,
|
|
4957
4957
|
loop: t
|
|
@@ -4969,16 +4969,16 @@ var _r = class {
|
|
|
4969
4969
|
}
|
|
4970
4970
|
addTime(e) {
|
|
4971
4971
|
let t = this.endTime, n = Math.min(this.startTime, this.endTime), r = this.currentTime;
|
|
4972
|
-
return r += e, this.loop && r > t && (r = n + r % t), r =
|
|
4972
|
+
return r += e, this.loop && r > t && (r = n + r % t), r = xt(r, n, t), this.currentTime = r, this.emit("updateCurrentTime", r, e), this;
|
|
4973
4973
|
}
|
|
4974
4974
|
_process(e) {
|
|
4975
4975
|
super._process(e), this.paused || this.addTime(e);
|
|
4976
4976
|
}
|
|
4977
4977
|
};
|
|
4978
|
-
O([_({ fallback: 0 }), D("design:type", Number)],
|
|
4978
|
+
O([_({ fallback: 0 }), D("design:type", Number)], br.prototype, "startTime", void 0), O([_({ fallback: 2 ** 53 - 1 }), D("design:type", Number)], br.prototype, "endTime", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], br.prototype, "loop", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], br.prototype, "paused", void 0), br = yr = O([b("Timeline"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial])], br);
|
|
4979
4979
|
//#endregion
|
|
4980
4980
|
//#region src/scene/main/Window.ts
|
|
4981
|
-
var
|
|
4981
|
+
var xr = class extends V {
|
|
4982
4982
|
constructor() {
|
|
4983
4983
|
super(), this.renderTargets.forEach((e) => e.isRoot = !0);
|
|
4984
4984
|
}
|
|
@@ -4989,17 +4989,17 @@ var br = class extends V {
|
|
|
4989
4989
|
super.flush(e), this.finish(e);
|
|
4990
4990
|
}
|
|
4991
4991
|
};
|
|
4992
|
-
|
|
4992
|
+
xr = O([b("Window", {
|
|
4993
4993
|
processMode: "always",
|
|
4994
4994
|
renderMode: "always"
|
|
4995
|
-
}), D("design:paramtypes", [])],
|
|
4995
|
+
}), D("design:paramtypes", [])], xr);
|
|
4996
4996
|
//#endregion
|
|
4997
4997
|
//#region src/scene/main/SceneTree.ts
|
|
4998
|
-
var
|
|
4999
|
-
input = new
|
|
5000
|
-
renderStack = new
|
|
5001
|
-
root = new
|
|
5002
|
-
timeline = new
|
|
4998
|
+
var Sr = class extends Tt {
|
|
4999
|
+
input = new gt();
|
|
5000
|
+
renderStack = new vr();
|
|
5001
|
+
root = new xr().setTree(this);
|
|
5002
|
+
timeline = new br().setTree(this);
|
|
5003
5003
|
nodeMap = /* @__PURE__ */ new Map();
|
|
5004
5004
|
_backgroundColor = new T();
|
|
5005
5005
|
_previousViewport;
|
|
@@ -5040,7 +5040,7 @@ var xr = class extends wt {
|
|
|
5040
5040
|
this.timeline.emit("process", e), this.emit("processing"), this.root.emit("process", e), this.emit("processed");
|
|
5041
5041
|
}
|
|
5042
5042
|
_render(e) {
|
|
5043
|
-
this.emit("rendering"),
|
|
5043
|
+
this.emit("rendering"), hr(), this.renderStack.render(e), this._renderScreen(e), this.emit("rendered");
|
|
5044
5044
|
}
|
|
5045
5045
|
_renderScreen(e) {
|
|
5046
5046
|
this.root.finish(e), e.state.reset(), e.renderTarget.unbind(), this.backgroundColor && e.gl.clearColor(...this._backgroundColor.toArray()), e.clear(), this.backgroundColor && e.gl.clearColor(0, 0, 0, 0);
|
|
@@ -5051,30 +5051,30 @@ var xr = class extends wt {
|
|
|
5051
5051
|
super._destroy(), this.root.destroy(), this.input.destroy(), this.nodeMap.clear();
|
|
5052
5052
|
}
|
|
5053
5053
|
};
|
|
5054
|
-
O([_({ alias: "root.msaa" }), D("design:type", Boolean)],
|
|
5054
|
+
O([_({ alias: "root.msaa" }), D("design:type", Boolean)], Sr.prototype, "msaa", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], Sr.prototype, "pixelate", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], Sr.prototype, "roundPixels", void 0), O([_(), D("design:type", Object)], Sr.prototype, "backgroundColor", void 0), O([_({
|
|
5055
5055
|
internal: !0,
|
|
5056
5056
|
fallback: !1
|
|
5057
|
-
}), D("design:type", Boolean)],
|
|
5057
|
+
}), D("design:type", Boolean)], Sr.prototype, "debug", void 0), O([_({
|
|
5058
5058
|
internal: !0,
|
|
5059
5059
|
fallback: !1
|
|
5060
|
-
}), D("design:type", Boolean)],
|
|
5060
|
+
}), D("design:type", Boolean)], Sr.prototype, "processPaused", void 0), O([_({
|
|
5061
5061
|
internal: !0,
|
|
5062
|
-
default: () =>
|
|
5063
|
-
}), D("design:type", Object)],
|
|
5062
|
+
default: () => he
|
|
5063
|
+
}), D("design:type", Object)], Sr.prototype, "fonts", void 0);
|
|
5064
5064
|
//#endregion
|
|
5065
5065
|
//#region src/scene/main/Transition.ts
|
|
5066
|
-
var
|
|
5066
|
+
var Cr = class extends H {
|
|
5067
5067
|
constructor(e, t = []) {
|
|
5068
5068
|
super(), this.setProperties(e).append(t);
|
|
5069
5069
|
}
|
|
5070
5070
|
};
|
|
5071
|
-
|
|
5071
|
+
Cr = O([b("Transition", {
|
|
5072
5072
|
effectMode: "transition",
|
|
5073
5073
|
duration: 2e3
|
|
5074
|
-
}), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])],
|
|
5074
|
+
}), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Cr);
|
|
5075
5075
|
//#endregion
|
|
5076
5076
|
//#region src/scene/2d/Node2D.ts
|
|
5077
|
-
var
|
|
5077
|
+
var wr = class extends _r {
|
|
5078
5078
|
rotation = 0;
|
|
5079
5079
|
position = new y(0, 0, () => this.updateGlobalTransform());
|
|
5080
5080
|
scale = new y(1, 1, () => this.updateGlobalTransform());
|
|
@@ -5126,10 +5126,10 @@ var Cr = class extends gr {
|
|
|
5126
5126
|
super._destroy(), this.position.destroy(), this.scale.destroy(), this.skew.destroy(), this.pivot.destroy(), this.extraTransform.destroy(), this.transform.destroy(), this.globalPosition.destroy(), this.globalScale.destroy(), this.globalSkew.destroy(), this.globalTransform.destroy();
|
|
5127
5127
|
}
|
|
5128
5128
|
};
|
|
5129
|
-
|
|
5129
|
+
wr = O([b("Node2D"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], wr);
|
|
5130
5130
|
//#endregion
|
|
5131
5131
|
//#region src/scene/2d/Camera2D.ts
|
|
5132
|
-
var
|
|
5132
|
+
var Tr = class extends wr {
|
|
5133
5133
|
canvasTransform = new v();
|
|
5134
5134
|
_screenOffset = {
|
|
5135
5135
|
x: 0,
|
|
@@ -5170,7 +5170,7 @@ var wr = class extends Cr {
|
|
|
5170
5170
|
return this.setZoom(this._zoom.x + e, this._zoom.y + t);
|
|
5171
5171
|
}
|
|
5172
5172
|
setZoom(e, t = e) {
|
|
5173
|
-
return this._zoom.set(
|
|
5173
|
+
return this._zoom.set(xt(e, this._minZoom.x, this._maxZoom.x), xt(t, this._minZoom.y, this._maxZoom.y)), this;
|
|
5174
5174
|
}
|
|
5175
5175
|
setZoomAtOrigin(e, t, n) {
|
|
5176
5176
|
let r;
|
|
@@ -5243,7 +5243,7 @@ var wr = class extends Cr {
|
|
|
5243
5243
|
});
|
|
5244
5244
|
}
|
|
5245
5245
|
_getZoomByWheel(e, t) {
|
|
5246
|
-
let n = e.ctrlKey &&
|
|
5246
|
+
let n = e.ctrlKey && qe ? 10 : 1, r = -e.deltaY * (e.deltaMode === 1 ? .05 : e.deltaMode ? 1 : .002) * n, i = Math.log(t) + r;
|
|
5247
5247
|
return Math.round(Math.exp(i) * 1e4) / 1e4;
|
|
5248
5248
|
}
|
|
5249
5249
|
_updateTransform() {
|
|
@@ -5276,16 +5276,16 @@ var wr = class extends Cr {
|
|
|
5276
5276
|
O([_({
|
|
5277
5277
|
internal: !0,
|
|
5278
5278
|
fallback: !1
|
|
5279
|
-
}), D("design:type", Boolean)],
|
|
5279
|
+
}), D("design:type", Boolean)], Tr.prototype, "spaceKey", void 0), O([_({
|
|
5280
5280
|
internal: !0,
|
|
5281
5281
|
fallback: !1
|
|
5282
|
-
}), D("design:type", Boolean)],
|
|
5282
|
+
}), D("design:type", Boolean)], Tr.prototype, "grabbing", void 0), Tr = O([b("Camera2D", {
|
|
5283
5283
|
processMode: "disabled",
|
|
5284
5284
|
renderMode: "disabled"
|
|
5285
|
-
}), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])],
|
|
5285
|
+
}), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Tr);
|
|
5286
5286
|
//#endregion
|
|
5287
5287
|
//#region src/scene/2d/element/connectionRouter.ts
|
|
5288
|
-
function
|
|
5288
|
+
function Er(e, t) {
|
|
5289
5289
|
return Math.abs(e) >= Math.abs(t) ? {
|
|
5290
5290
|
x: Math.sign(e) || 1,
|
|
5291
5291
|
y: 0
|
|
@@ -5294,11 +5294,11 @@ function Tr(e, t) {
|
|
|
5294
5294
|
y: Math.sign(t) || 1
|
|
5295
5295
|
};
|
|
5296
5296
|
}
|
|
5297
|
-
function
|
|
5298
|
-
let i = t.point, a = n.point, o = new
|
|
5297
|
+
function Dr(e, t, n, r = {}) {
|
|
5298
|
+
let i = t.point, a = n.point, o = new le();
|
|
5299
5299
|
switch (e) {
|
|
5300
5300
|
case "curved": {
|
|
5301
|
-
let e = t.dir ??
|
|
5301
|
+
let e = t.dir ?? Er(a.x - i.x, a.y - i.y), s = n.dir ?? Er(i.x - a.x, i.y - a.y), c = a.x - i.x, l = a.y - i.y, u = Math.hypot(c, l) || 1, d = c / u, f = l / u, p = Math.max((r.stub ?? 16) * 2, u * .4), m = (e, t, n, r) => Math.max(.1, (1 + e * n + t * r) / 2), h = p * m(e.x, e.y, d, f), g = p * m(s.x, s.y, -d, -f), ee = i.x + e.x * h, te = i.y + e.y * h, ne = a.x + s.x * g, re = a.y + s.y * g;
|
|
5302
5302
|
for (let e = 0; e <= 32; e++) {
|
|
5303
5303
|
let t = e / 32, n = 1 - t, r = n * n * n, s = 3 * n * n * t, c = 3 * n * t * t, l = t * t * t, u = r * i.x + s * ee + c * ne + l * a.x, d = r * i.y + s * te + c * re + l * a.y;
|
|
5304
5304
|
e === 0 ? o.moveTo(u, d) : o.lineTo(u, d);
|
|
@@ -5306,7 +5306,7 @@ function Er(e, t, n, r = {}) {
|
|
|
5306
5306
|
break;
|
|
5307
5307
|
}
|
|
5308
5308
|
case "orthogonal": {
|
|
5309
|
-
let e =
|
|
5309
|
+
let e = kr(t, n, r);
|
|
5310
5310
|
for (let t = 0; t < e.length; t++) t === 0 ? o.moveTo(e[t].x, e[t].y) : o.lineTo(e[t].x, e[t].y);
|
|
5311
5311
|
break;
|
|
5312
5312
|
}
|
|
@@ -5316,11 +5316,11 @@ function Er(e, t, n, r = {}) {
|
|
|
5316
5316
|
}
|
|
5317
5317
|
return o;
|
|
5318
5318
|
}
|
|
5319
|
-
function
|
|
5320
|
-
return
|
|
5319
|
+
function Or(e) {
|
|
5320
|
+
return Er(e.x, e.y);
|
|
5321
5321
|
}
|
|
5322
|
-
function
|
|
5323
|
-
let r = e.point, i = t.point, a = n.stub ?? 16, o =
|
|
5322
|
+
function kr(e, t, n) {
|
|
5323
|
+
let r = e.point, i = t.point, a = n.stub ?? 16, o = Or(e.dir ?? Er(i.x - r.x, i.y - r.y)), s = Or(t.dir ?? Er(r.x - i.x, r.y - i.y)), c = {
|
|
5324
5324
|
x: r.x + o.x * a,
|
|
5325
5325
|
y: r.y + o.y * a
|
|
5326
5326
|
}, l = {
|
|
@@ -5332,12 +5332,12 @@ function Or(e, t, n) {
|
|
|
5332
5332
|
x: r.x,
|
|
5333
5333
|
y: r.y
|
|
5334
5334
|
}, c];
|
|
5335
|
-
return d.push(...
|
|
5335
|
+
return d.push(...jr(c, o, l, s, a, u)), d.push(l, {
|
|
5336
5336
|
x: i.x,
|
|
5337
5337
|
y: i.y
|
|
5338
|
-
}),
|
|
5338
|
+
}), Mr(d);
|
|
5339
5339
|
}
|
|
5340
|
-
function
|
|
5340
|
+
function Ar(e, t, n, r, i) {
|
|
5341
5341
|
let a = Infinity, o = -Infinity, s = t === "y" ? "x" : "y";
|
|
5342
5342
|
for (let e of r) {
|
|
5343
5343
|
let r = e.min[s], i = r + e.size[s];
|
|
@@ -5348,7 +5348,7 @@ function kr(e, t, n, r, i) {
|
|
|
5348
5348
|
}
|
|
5349
5349
|
return e > a && e < o ? a - i : e;
|
|
5350
5350
|
}
|
|
5351
|
-
function
|
|
5351
|
+
function jr(e, t, n, r, i, a = []) {
|
|
5352
5352
|
let o = t.y === 0;
|
|
5353
5353
|
if (o === (r.y === 0)) {
|
|
5354
5354
|
if (o) {
|
|
@@ -5363,7 +5363,7 @@ function Ar(e, t, n, r, i, a = []) {
|
|
|
5363
5363
|
}];
|
|
5364
5364
|
}
|
|
5365
5365
|
let o = Math.abs(e.y - n.y) < .001 ? e.y + i : (e.y + n.y) / 2;
|
|
5366
|
-
return o =
|
|
5366
|
+
return o = Ar(o, "y", [Math.min(e.x, n.x), Math.max(e.x, n.x)], a, i), [{
|
|
5367
5367
|
x: e.x,
|
|
5368
5368
|
y: o
|
|
5369
5369
|
}, {
|
|
@@ -5382,7 +5382,7 @@ function Ar(e, t, n, r, i, a = []) {
|
|
|
5382
5382
|
}];
|
|
5383
5383
|
}
|
|
5384
5384
|
let s = Math.abs(e.x - n.x) < .001 ? e.x + i : (e.x + n.x) / 2;
|
|
5385
|
-
return s =
|
|
5385
|
+
return s = Ar(s, "x", [Math.min(e.y, n.y), Math.max(e.y, n.y)], a, i), [{
|
|
5386
5386
|
x: s,
|
|
5387
5387
|
y: e.y
|
|
5388
5388
|
}, {
|
|
@@ -5409,7 +5409,7 @@ function Ar(e, t, n, r, i, a = []) {
|
|
|
5409
5409
|
y: l.y
|
|
5410
5410
|
}];
|
|
5411
5411
|
}
|
|
5412
|
-
function
|
|
5412
|
+
function Mr(e) {
|
|
5413
5413
|
let t = [];
|
|
5414
5414
|
for (let n = 0; n < e.length; n++) {
|
|
5415
5415
|
let r = e[n], i = t[t.length - 1];
|
|
@@ -5419,7 +5419,7 @@ function jr(e) {
|
|
|
5419
5419
|
}
|
|
5420
5420
|
//#endregion
|
|
5421
5421
|
//#region src/css/parseCssFilter.ts
|
|
5422
|
-
var
|
|
5422
|
+
var Nr = {
|
|
5423
5423
|
brightness: 1,
|
|
5424
5424
|
contrast: 1,
|
|
5425
5425
|
grayscale: 0,
|
|
@@ -5429,18 +5429,18 @@ var Mr = {
|
|
|
5429
5429
|
saturate: 1,
|
|
5430
5430
|
sepia: 0
|
|
5431
5431
|
};
|
|
5432
|
-
function
|
|
5433
|
-
let t = new
|
|
5432
|
+
function Pr(e) {
|
|
5433
|
+
let t = new St();
|
|
5434
5434
|
if (e === "none") return t;
|
|
5435
|
-
let n =
|
|
5436
|
-
Object.keys(
|
|
5437
|
-
n[e] = n[e] ??
|
|
5435
|
+
let n = ke(e).reduce((e, { name: t, args: n }) => (e[t] = n[0].normalizedIntValue, e), {});
|
|
5436
|
+
Object.keys(Nr).forEach((e) => {
|
|
5437
|
+
n[e] = n[e] ?? Nr[e];
|
|
5438
5438
|
});
|
|
5439
5439
|
for (let e in n) {
|
|
5440
5440
|
let r = n[e];
|
|
5441
5441
|
switch (e) {
|
|
5442
5442
|
case "hue-rotate":
|
|
5443
|
-
t.hueRotate(r *
|
|
5443
|
+
t.hueRotate(r * Se);
|
|
5444
5444
|
break;
|
|
5445
5445
|
case "saturate":
|
|
5446
5446
|
t.saturate(r);
|
|
@@ -5469,7 +5469,7 @@ function Nr(e) {
|
|
|
5469
5469
|
}
|
|
5470
5470
|
//#endregion
|
|
5471
5471
|
//#region src/css/parseCssTransformOrigin.ts
|
|
5472
|
-
function
|
|
5472
|
+
function Fr(e) {
|
|
5473
5473
|
let [t, n = t] = e.split(" ");
|
|
5474
5474
|
return [t, n].map((e) => {
|
|
5475
5475
|
switch (e = e.trim(), e) {
|
|
@@ -5484,9 +5484,9 @@ function Pr(e) {
|
|
|
5484
5484
|
}
|
|
5485
5485
|
//#endregion
|
|
5486
5486
|
//#region src/scene/effects/ColorAdjustEffect.ts
|
|
5487
|
-
var
|
|
5487
|
+
var Ir, U = class extends H {
|
|
5488
5488
|
static {
|
|
5489
|
-
|
|
5489
|
+
Ir = this;
|
|
5490
5490
|
}
|
|
5491
5491
|
static material = new F({ gl: {
|
|
5492
5492
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -5497,7 +5497,7 @@ var Fr, U = class extends H {
|
|
|
5497
5497
|
}
|
|
5498
5498
|
apply(e, t) {
|
|
5499
5499
|
t.redraw(e, () => {
|
|
5500
|
-
I.draw(e,
|
|
5500
|
+
I.draw(e, Ir.material, {
|
|
5501
5501
|
sampler: 0,
|
|
5502
5502
|
saturation: this.saturation,
|
|
5503
5503
|
contrast: this.contrast,
|
|
@@ -5511,18 +5511,18 @@ var Fr, U = class extends H {
|
|
|
5511
5511
|
});
|
|
5512
5512
|
}
|
|
5513
5513
|
};
|
|
5514
|
-
O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "saturation", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "contrast", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "brightness", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "red", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "green", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "blue", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "alpha", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "gamma", void 0), U =
|
|
5514
|
+
O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "saturation", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "contrast", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "brightness", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "red", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "green", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "blue", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "alpha", void 0), O([_({ fallback: 1 }), D("design:type", Number)], U.prototype, "gamma", void 0), U = Ir = O([b("ColorAdjustEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], U);
|
|
5515
5515
|
//#endregion
|
|
5516
5516
|
//#region src/scene/effects/ColorFilterEffect.ts
|
|
5517
|
-
var
|
|
5517
|
+
var Lr, Rr = class extends H {
|
|
5518
5518
|
static {
|
|
5519
|
-
|
|
5519
|
+
Lr = this;
|
|
5520
5520
|
}
|
|
5521
5521
|
static material = new F({ gl: {
|
|
5522
5522
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5523
5523
|
fragment: "in vec2 vUv;\nuniform sampler2D sampler;\nuniform float m[20];\n\nvoid main(void) {\n vec4 c = texture2D(sampler, vUv);\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n gl_FragColor = vec4(\n m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4] / 255.0,\n m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9] / 255.0,\n m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14] / 255.0,\n m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19] / 255.0\n );\n}"
|
|
5524
5524
|
} });
|
|
5525
|
-
_colorMatrix = new
|
|
5525
|
+
_colorMatrix = new St();
|
|
5526
5526
|
constructor(e, t = []) {
|
|
5527
5527
|
super(), this.setProperties(e).append(t);
|
|
5528
5528
|
}
|
|
@@ -5535,13 +5535,13 @@ var Ir, Lr = class extends H {
|
|
|
5535
5535
|
}
|
|
5536
5536
|
apply(e, t) {
|
|
5537
5537
|
if (!this.filter) return;
|
|
5538
|
-
let n =
|
|
5538
|
+
let n = ke(this.filter), r = this._colorMatrix.identity();
|
|
5539
5539
|
n.forEach(({ name: e, args: t }) => {
|
|
5540
5540
|
let n = t.map((e) => e.normalizedIntValue);
|
|
5541
5541
|
switch (e) {
|
|
5542
5542
|
case "hue-rotate":
|
|
5543
5543
|
case "hueRotate":
|
|
5544
|
-
r.hueRotate(n[0] *
|
|
5544
|
+
r.hueRotate(n[0] * Se);
|
|
5545
5545
|
break;
|
|
5546
5546
|
case "saturate":
|
|
5547
5547
|
r.saturate(n[0]);
|
|
@@ -5566,25 +5566,25 @@ var Ir, Lr = class extends H {
|
|
|
5566
5566
|
break;
|
|
5567
5567
|
}
|
|
5568
5568
|
}), t.redraw(e, () => {
|
|
5569
|
-
I.draw(e,
|
|
5569
|
+
I.draw(e, Lr.material, {
|
|
5570
5570
|
sampler: 0,
|
|
5571
5571
|
m: r.toArray()
|
|
5572
5572
|
});
|
|
5573
5573
|
});
|
|
5574
5574
|
}
|
|
5575
5575
|
};
|
|
5576
|
-
O([_(), D("design:type", String)],
|
|
5576
|
+
O([_(), D("design:type", String)], Rr.prototype, "filter", void 0), Rr = Lr = O([b("ColorFilterEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Rr);
|
|
5577
5577
|
//#endregion
|
|
5578
5578
|
//#region src/scene/effects/ColorOverlayEffect.ts
|
|
5579
|
-
var
|
|
5579
|
+
var zr, Br = 50, Vr = class extends H {
|
|
5580
5580
|
static {
|
|
5581
|
-
|
|
5581
|
+
zr = this;
|
|
5582
5582
|
}
|
|
5583
5583
|
static material = new F({ gl: {
|
|
5584
5584
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5585
5585
|
fragment: `precision mediump float;
|
|
5586
5586
|
uniform sampler2D sampler;
|
|
5587
|
-
uniform vec4 colors[${
|
|
5587
|
+
uniform vec4 colors[${Br}];
|
|
5588
5588
|
varying vec2 vUv;
|
|
5589
5589
|
|
|
5590
5590
|
float calcWidth() {
|
|
@@ -5593,7 +5593,7 @@ float calcWidth() {
|
|
|
5593
5593
|
|
|
5594
5594
|
int calcCount() {
|
|
5595
5595
|
int count = 0;
|
|
5596
|
-
for (int i = 0; i < ${
|
|
5596
|
+
for (int i = 0; i < ${Br}; i++) {
|
|
5597
5597
|
if (colors[i] != vec4(0,0,0,0)){
|
|
5598
5598
|
count++;
|
|
5599
5599
|
}
|
|
@@ -5605,7 +5605,7 @@ vec4 calcColor(float x) {
|
|
|
5605
5605
|
float perUnit = calcWidth() / float(calcCount());
|
|
5606
5606
|
int index = int(x / perUnit);
|
|
5607
5607
|
|
|
5608
|
-
for(int i=0; i<${
|
|
5608
|
+
for(int i=0; i<${Br}; i++){
|
|
5609
5609
|
if(i==index){
|
|
5610
5610
|
return colors[i];
|
|
5611
5611
|
}
|
|
@@ -5631,25 +5631,25 @@ void main(void) {
|
|
|
5631
5631
|
let t = this._color.toArray();
|
|
5632
5632
|
return t[3] = this.alpha, t;
|
|
5633
5633
|
});
|
|
5634
|
-
for (; t.length <
|
|
5634
|
+
for (; t.length < Br;) t.push([
|
|
5635
5635
|
0,
|
|
5636
5636
|
0,
|
|
5637
5637
|
0,
|
|
5638
5638
|
0
|
|
5639
5639
|
]);
|
|
5640
|
-
I.draw(e,
|
|
5640
|
+
I.draw(e, zr.material, {
|
|
5641
5641
|
sampler: 0,
|
|
5642
|
-
colors: t.slice(0,
|
|
5642
|
+
colors: t.slice(0, Br).flatMap((e) => e)
|
|
5643
5643
|
});
|
|
5644
5644
|
});
|
|
5645
5645
|
}
|
|
5646
5646
|
};
|
|
5647
|
-
O([_({ default: () => [] }), D("design:type", Array)],
|
|
5647
|
+
O([_({ default: () => [] }), D("design:type", Array)], Vr.prototype, "colors", void 0), O([_({ fallback: .5 }), D("design:type", Number)], Vr.prototype, "alpha", void 0), Vr = zr = O([b("ColorOverlayEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Vr);
|
|
5648
5648
|
//#endregion
|
|
5649
5649
|
//#region src/scene/effects/ColorRemoveEffect.ts
|
|
5650
|
-
var
|
|
5650
|
+
var Hr, Ur = class extends H {
|
|
5651
5651
|
static {
|
|
5652
|
-
|
|
5652
|
+
Hr = this;
|
|
5653
5653
|
}
|
|
5654
5654
|
static material = new F({ gl: {
|
|
5655
5655
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -5669,7 +5669,7 @@ var Vr, Hr = class extends H {
|
|
|
5669
5669
|
r.slice(0, 50).forEach((e, t) => {
|
|
5670
5670
|
n[t * 3] = e[0], n[t * 3 + 1] = e[1], n[t * 3 + 2] = e[2];
|
|
5671
5671
|
}), t.redraw(e, () => {
|
|
5672
|
-
I.draw(e,
|
|
5672
|
+
I.draw(e, Hr.material, {
|
|
5673
5673
|
sampler: 0,
|
|
5674
5674
|
epsilon: this.epsilon,
|
|
5675
5675
|
originalColors: n
|
|
@@ -5677,19 +5677,19 @@ var Vr, Hr = class extends H {
|
|
|
5677
5677
|
});
|
|
5678
5678
|
}
|
|
5679
5679
|
};
|
|
5680
|
-
O([_({ default: () => [] }), D("design:type", Array)],
|
|
5680
|
+
O([_({ default: () => [] }), D("design:type", Array)], Ur.prototype, "colors", void 0), O([_({ fallback: .5 }), D("design:type", Number)], Ur.prototype, "epsilon", void 0), Ur = Hr = O([b("ColorRemoveEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Ur);
|
|
5681
5681
|
//#endregion
|
|
5682
5682
|
//#region src/scene/effects/ColorReplaceEffect.ts
|
|
5683
|
-
var
|
|
5683
|
+
var Wr, Gr = 50, Kr = class extends H {
|
|
5684
5684
|
static {
|
|
5685
|
-
|
|
5685
|
+
Wr = this;
|
|
5686
5686
|
}
|
|
5687
5687
|
static material = new F({ gl: {
|
|
5688
5688
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5689
5689
|
fragment: `varying vec2 vUv;
|
|
5690
5690
|
uniform sampler2D sampler;
|
|
5691
5691
|
uniform float epsilon;
|
|
5692
|
-
const int MAX_COLORS = ${
|
|
5692
|
+
const int MAX_COLORS = ${Gr};
|
|
5693
5693
|
uniform vec3 originalColors[MAX_COLORS];
|
|
5694
5694
|
uniform vec3 targetColors[MAX_COLORS];
|
|
5695
5695
|
|
|
@@ -5726,8 +5726,8 @@ void main(void) {
|
|
|
5726
5726
|
this._color.value = e[0];
|
|
5727
5727
|
let t = this._color.toArray().slice(0, 3);
|
|
5728
5728
|
return this._color.value = e[1], [t, this._color.toArray().slice(0, 3)];
|
|
5729
|
-
}), r = this.epsilon, i = new Float32Array(
|
|
5730
|
-
for (; n.length <
|
|
5729
|
+
}), r = this.epsilon, i = new Float32Array(Gr * 3), a = new Float32Array(Gr * 3);
|
|
5730
|
+
for (; n.length < Gr;) n.push([[
|
|
5731
5731
|
-1,
|
|
5732
5732
|
0,
|
|
5733
5733
|
0
|
|
@@ -5737,10 +5737,10 @@ void main(void) {
|
|
|
5737
5737
|
0,
|
|
5738
5738
|
1
|
|
5739
5739
|
]]);
|
|
5740
|
-
n.slice(0,
|
|
5740
|
+
n.slice(0, Gr).forEach(([e, t], n) => {
|
|
5741
5741
|
i[n * 3] = e[0], i[n * 3 + 1] = e[1], i[n * 3 + 2] = e[2], a[n * 3] = t[0], a[n * 3 + 1] = t[1], a[n * 3 + 2] = t[2];
|
|
5742
5742
|
}), t.redraw(e, () => {
|
|
5743
|
-
I.draw(e,
|
|
5743
|
+
I.draw(e, Wr.material, {
|
|
5744
5744
|
sampler: 0,
|
|
5745
5745
|
epsilon: r,
|
|
5746
5746
|
originalColors: i,
|
|
@@ -5749,17 +5749,17 @@ void main(void) {
|
|
|
5749
5749
|
});
|
|
5750
5750
|
}
|
|
5751
5751
|
};
|
|
5752
|
-
O([_({ default: () => [] }), D("design:type", Array)],
|
|
5752
|
+
O([_({ default: () => [] }), D("design:type", Array)], Kr.prototype, "colors", void 0), O([_({ fallback: .05 }), D("design:type", Number)], Kr.prototype, "epsilon", void 0), Kr = Wr = O([b("ColorReplaceEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Kr);
|
|
5753
5753
|
//#endregion
|
|
5754
5754
|
//#region src/scene/effects/DrawboardEffect.frag?raw
|
|
5755
|
-
var
|
|
5755
|
+
var qr = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nuniform vec2 inputSize;\nuniform vec2 zoom;\nuniform vec2 translate;\nuniform float gridScale;\nuniform vec2 gridSize;\nuniform int checkerboard;\nuniform int checkerboardStyle;\nuniform float dotBackgroundBaseColor;\nuniform float dotBackgroundZoomedOutColor;\nuniform float dotColorDiff;\nuniform int pixelGrid;\nuniform int watermark;\nuniform sampler2D watermarkTexture;\nuniform vec2 watermarkSize;\nuniform vec2 watermarkOffset;\nuniform vec2 watermarkSpacing;\nuniform float watermarkRotation;\nuniform float watermarkAlpha;\n\nconst float VIEWPORT_SPACE_MIN_DOT_RADIUS = 0.5;\nconst float CANVAS_SPACE_DOT_RADIUS = 1.;\nconst float CANVAS_SPACE_DOT_GRID_SIZE_PX = 16.;\n\nconst int CHECKERBOARD_STYLE_NONE = 0;\nconst int CHECKERBOARD_STYLE_GRID = 1;\nconst int CHECKERBOARD_STYLE_GRID_DARK = 2;\nconst int CHECKERBOARD_STYLE_DOTS = 3;\nconst int CHECKERBOARD_STYLE_DOTS_DARK = 4;\n\nfloat _round(float val) {\n return floor(val + .5);\n}\n\nvec2 _round(vec2 pt) {\n return floor(pt + .5);\n}\n\nfloat scaledGridSize(float zoomScale) {\n if (zoomScale < 0.03125) {\n return 32.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.0625) {\n return 16.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.125) {\n return 8.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.25) {\n return 4.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else if (zoomScale < 0.5) {\n return 2.0 * CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n else {\n return CANVAS_SPACE_DOT_GRID_SIZE_PX;\n }\n}\n\nvec4 renderCheckerboard(vec2 coord, vec4 color) {\n float value;\n if (checkerboardStyle == CHECKERBOARD_STYLE_GRID) {\n vec2 fractValue = fract(coord * vec2(gridScale) * zoom) - 0.5;\n value = fractValue.x * fractValue.y < 0.0 ? 1.0 : 0.95;\n }\n else if (checkerboardStyle == CHECKERBOARD_STYLE_GRID_DARK) {\n vec2 fractValue = fract(coord * vec2(gridScale) * zoom) - 0.5;\n value = fractValue.x * fractValue.y < 0.0 ? 0.12 : 0.17;\n }\n else if (checkerboardStyle == CHECKERBOARD_STYLE_DOTS || checkerboardStyle == CHECKERBOARD_STYLE_DOTS_DARK) {\n // light vs dark dots share this path; the base/dot colours are supplied as\n // uniforms (set per style on the CPU side), so only the values differ.\n float zoomScale = zoom.x;\n float gridPixelSize = scaledGridSize(zoomScale);\n float zoomInterpolationFactor = smoothstep(0.5, 1.0, zoomScale);\n float dotColor = dotBackgroundZoomedOutColor + dotColorDiff * zoomInterpolationFactor;\n vec2 nearestGridPoint = _round(coord / gridPixelSize) * gridPixelSize;\n float canvasSpaceDist = length(coord - nearestGridPoint);\n float viewportSpaceDist = canvasSpaceDist * zoomScale;\n float viewportSpaceDotRadius = max(VIEWPORT_SPACE_MIN_DOT_RADIUS, CANVAS_SPACE_DOT_RADIUS * zoomScale);\n float dist = 1.0 - smoothstep(0., 1., (viewportSpaceDist - viewportSpaceDotRadius + .5));\n value = mix(dotBackgroundBaseColor, dotColor, dist);\n }\n return vec4(value * (1.0 - color.a) + color.rgb, 1);\n}\n\nvec4 renderPixelGrid(vec2 coord, vec4 color) {\n vec3 rgb = color.rgb;\n vec2 corner = fract(coord);\n float gridWeight = max(float(corner.x < gridSize.x), float(corner.y < gridSize.y));\n vec3 gridColor;\n vec3 weights = vec3(0.299, 0.587, 0.114);\n float c2 = dot(rgb * rgb, weights);\n float luminance = sqrt(c2);\n if (luminance > 0.5) {\n float target = (luminance - 0.05) / luminance;\n gridColor = rgb * target;\n }\n else {\n float target = luminance * 0.8 + 0.15;\n float c1 = dot(rgb, weights);\n float a = 1.0 - 2.0 * c1 + c2;\n float b = c2 - c1;\n gridColor = mix(rgb, vec3(1), (b + sqrt(b * b - a * (c2 - target * target))) / a);\n }\n return vec4(mix(rgb, gridColor, gridWeight), color.a);\n}\n\nvec4 renderWatermark(vec2 coord, vec4 color) {\n float hw = watermarkSize.x * 0.5;\n float hh = watermarkSize.y * 0.5;\n float c = cos(-watermarkRotation);\n float s = sin(-watermarkRotation);\n vec2 blockSize = watermarkSize + watermarkSpacing;\n vec2 tiles = max(floor(inputSize / blockSize), vec2(1.0));\n vec2 gridCoverage = tiles * blockSize;\n vec2 startPos = watermarkOffset;\n vec2 localPix = coord - startPos;\n vec2 blockIndex = floor(localPix / blockSize);\n vec2 wmCenter = startPos + blockIndex * blockSize + watermarkSize * 0.5 + watermarkSpacing / 2.0;\n vec2 local = coord - wmCenter;\n vec2 inv = vec2(\n local.x * c + local.y * s,\n -local.x * s + local.y * c\n );\n if (inv.x >= -hw && inv.x <= hw && inv.y >= -hh && inv.y <= hh) {\n vec2 wmUV = (inv + vec2(hw, hh)) / watermarkSize;\n vec4 wmColor = texture(watermarkTexture, wmUV);\n float alpha = wmColor.a * watermarkAlpha;\n return mix(color, wmColor, alpha);\n } else {\n return color;\n }\n}\n\nvoid main(void) {\n vec4 color = texture(uTexture, vUv);\n vec2 coord = vec2(vUv.x, 1.0 - vUv.y);\n coord = (coord * inputSize - translate) / zoom;\n if (checkerboard > 0) {\n color = renderCheckerboard(coord, color);\n }\n if (watermark > 0) {\n color = renderWatermark(coord, color);\n }\n if (pixelGrid > 0) {\n color = renderPixelGrid(coord, color);\n }\n gl_FragColor = color;\n}\n", Jr, W = class extends H {
|
|
5756
5756
|
static {
|
|
5757
|
-
|
|
5757
|
+
Jr = this;
|
|
5758
5758
|
}
|
|
5759
5759
|
_watermark;
|
|
5760
5760
|
static material = new F({ gl: {
|
|
5761
5761
|
vertex: "attribute vec2 position;\nin vec2 uv;\nuniform mat3 projectionMatrix;\nuniform mat3 viewMatrix;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position.xy, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5762
|
-
fragment:
|
|
5762
|
+
fragment: qr
|
|
5763
5763
|
} });
|
|
5764
5764
|
constructor(e, t = []) {
|
|
5765
5765
|
super(), this.setProperties(e).append(t);
|
|
@@ -5808,7 +5808,7 @@ var Kr = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nu
|
|
|
5808
5808
|
zoomedOut: this.dotColor ?? a.zoomedOut,
|
|
5809
5809
|
diff: this.dotZoomDiff ?? a.diff
|
|
5810
5810
|
};
|
|
5811
|
-
I.draw(e,
|
|
5811
|
+
I.draw(e, Jr.material, {
|
|
5812
5812
|
uTexture: 0,
|
|
5813
5813
|
inputSize: [t.width, t.height],
|
|
5814
5814
|
zoom: [n[0], n[4]],
|
|
@@ -5832,20 +5832,20 @@ var Kr = "precision highp float;\n\nin vec2 vUv;\nuniform sampler2D uTexture;\nu
|
|
|
5832
5832
|
});
|
|
5833
5833
|
}
|
|
5834
5834
|
};
|
|
5835
|
-
O([_({ fallback: !1 }), D("design:type", Boolean)], W.prototype, "checkerboard", void 0), O([_({ fallback: "grid" }), D("design:type", Object)], W.prototype, "checkerboardStyle", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], W.prototype, "pixelGrid", void 0), O([_(), D("design:type", Number)], W.prototype, "dotBaseColor", void 0), O([_(), D("design:type", Number)], W.prototype, "dotColor", void 0), O([_(), D("design:type", Number)], W.prototype, "dotZoomDiff", void 0), O([_(), D("design:type", String)], W.prototype, "watermark", void 0), O([_({ fallback: 100 }), D("design:type", Number)], W.prototype, "watermarkWidth", void 0), O([_({ fallback: .05 }), D("design:type", Number)], W.prototype, "watermarkAlpha", void 0), O([_({ fallback: .5236 }), D("design:type", Number)], W.prototype, "watermarkRotation", void 0), W =
|
|
5835
|
+
O([_({ fallback: !1 }), D("design:type", Boolean)], W.prototype, "checkerboard", void 0), O([_({ fallback: "grid" }), D("design:type", Object)], W.prototype, "checkerboardStyle", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], W.prototype, "pixelGrid", void 0), O([_(), D("design:type", Number)], W.prototype, "dotBaseColor", void 0), O([_(), D("design:type", Number)], W.prototype, "dotColor", void 0), O([_(), D("design:type", Number)], W.prototype, "dotZoomDiff", void 0), O([_(), D("design:type", String)], W.prototype, "watermark", void 0), O([_({ fallback: 100 }), D("design:type", Number)], W.prototype, "watermarkWidth", void 0), O([_({ fallback: .05 }), D("design:type", Number)], W.prototype, "watermarkAlpha", void 0), O([_({ fallback: .5236 }), D("design:type", Number)], W.prototype, "watermarkRotation", void 0), W = Jr = O([b("DrawboardEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], W);
|
|
5836
5836
|
//#endregion
|
|
5837
5837
|
//#region src/scene/effects/GaussianBlurEffect.ts
|
|
5838
|
-
var
|
|
5838
|
+
var Yr, Xr = "varying vec2 vUv[9];\nuniform sampler2D sampler;\n\nvoid main(void) {\n gl_FragColor = vec4(0.0);\n float flag = 0.0;\n for (int i = 0; i < 9; i++) {\n vec2 uv = vUv[i];\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n flag = 1.0;\n break;\n }\n }\n if (flag == 1.0) {\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;\n } else {\n gl_FragColor += texture2D(sampler, vUv[0]) * 0.028532;\n gl_FragColor += texture2D(sampler, vUv[1]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[2]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[3]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;\n gl_FragColor += texture2D(sampler, vUv[5]) * 0.179044;\n gl_FragColor += texture2D(sampler, vUv[6]) * 0.124009;\n gl_FragColor += texture2D(sampler, vUv[7]) * 0.067234;\n gl_FragColor += texture2D(sampler, vUv[8]) * 0.028532;\n }\n}", Zr = class extends H {
|
|
5839
5839
|
static {
|
|
5840
|
-
|
|
5840
|
+
Yr = this;
|
|
5841
5841
|
}
|
|
5842
5842
|
static materialX = new F({ gl: {
|
|
5843
5843
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nuniform float uStrength;\nvarying vec2 vUv[9];\n\nvoid main(void) {\n gl_Position = vec4(position, 0, 1);\n vUv[0] = uv + vec2(-4.0 * uStrength, 0.0);\n vUv[1] = uv + vec2(-3.0 * uStrength, 0.0);\n vUv[2] = uv + vec2(-2.0 * uStrength, 0.0);\n vUv[3] = uv + vec2(-1.0 * uStrength, 0.0);\n vUv[4] = uv + vec2(0.0 * uStrength, 0.0);\n vUv[5] = uv + vec2(1.0 * uStrength, 0.0);\n vUv[6] = uv + vec2(2.0 * uStrength, 0.0);\n vUv[7] = uv + vec2(3.0 * uStrength, 0.0);\n vUv[8] = uv + vec2(4.0 * uStrength, 0.0);\n}",
|
|
5844
|
-
fragment:
|
|
5844
|
+
fragment: Xr
|
|
5845
5845
|
} });
|
|
5846
5846
|
static materialY = new F({ gl: {
|
|
5847
5847
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nuniform float uStrength;\nvarying vec2 vUv[9];\n\nvoid main(void) {\n gl_Position = vec4(position, 0, 1);\n vUv[0] = uv + vec2(0.0, -4.0 * uStrength);\n vUv[1] = uv + vec2(0.0, -3.0 * uStrength);\n vUv[2] = uv + vec2(0.0, -2.0 * uStrength);\n vUv[3] = uv + vec2(0.0, -1.0 * uStrength);\n vUv[4] = uv + vec2(0.0, 0.0 * uStrength);\n vUv[5] = uv + vec2(0.0, 1.0 * uStrength);\n vUv[6] = uv + vec2(0.0, 2.0 * uStrength);\n vUv[7] = uv + vec2(0.0, 3.0 * uStrength);\n vUv[8] = uv + vec2(0.0, 4.0 * uStrength);\n}",
|
|
5848
|
-
fragment:
|
|
5848
|
+
fragment: Xr
|
|
5849
5849
|
} });
|
|
5850
5850
|
constructor(e, t = []) {
|
|
5851
5851
|
super(), this.setProperties(e).append(t);
|
|
@@ -5853,31 +5853,31 @@ var Jr, Yr = "varying vec2 vUv[9];\nuniform sampler2D sampler;\n\nvoid main(void
|
|
|
5853
5853
|
apply(e, t) {
|
|
5854
5854
|
let n = 1 / t.width, r = 1 / t.height, i = Math.max(this.quality, 1);
|
|
5855
5855
|
for (let r = 0; r < i; r++) t.redraw(e, () => {
|
|
5856
|
-
I.draw(e,
|
|
5856
|
+
I.draw(e, Yr.materialX, {
|
|
5857
5857
|
sampler: 0,
|
|
5858
5858
|
uStrength: n * (this.strength / i)
|
|
5859
5859
|
});
|
|
5860
5860
|
});
|
|
5861
5861
|
for (let n = 0; n < i; n++) t.redraw(e, () => {
|
|
5862
|
-
I.draw(e,
|
|
5862
|
+
I.draw(e, Yr.materialY, {
|
|
5863
5863
|
sampler: 0,
|
|
5864
5864
|
uStrength: r * (this.strength / i)
|
|
5865
5865
|
});
|
|
5866
5866
|
});
|
|
5867
5867
|
}
|
|
5868
5868
|
};
|
|
5869
|
-
O([_({ fallback: 4 }), D("design:type", Number)],
|
|
5869
|
+
O([_({ fallback: 4 }), D("design:type", Number)], Zr.prototype, "strength", void 0), O([_({ fallback: 3 }), D("design:type", Number)], Zr.prototype, "quality", void 0), Zr = Yr = O([b("GaussianBlurEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], Zr);
|
|
5870
5870
|
//#endregion
|
|
5871
5871
|
//#region src/scene/effects/DropShadowEffect.ts
|
|
5872
|
-
var
|
|
5872
|
+
var Qr, $r = class extends H {
|
|
5873
5873
|
static {
|
|
5874
|
-
|
|
5874
|
+
Qr = this;
|
|
5875
5875
|
}
|
|
5876
5876
|
static material = new F({ gl: {
|
|
5877
5877
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
5878
5878
|
fragment: "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform float uAlpha;\nuniform vec3 uColor;\nuniform vec2 uOffset;\nuniform vec4 uInputSize;\n\nvoid main(void) {\n vec4 sample = texture2D(sampler, vUv + uOffset * uInputSize.zw);\n sample.rgb = uColor.rgb * sample.a;\n sample *= uAlpha;\n gl_FragColor = sample;\n}"
|
|
5879
5879
|
} });
|
|
5880
|
-
blurEffect = new
|
|
5880
|
+
blurEffect = new Zr();
|
|
5881
5881
|
viewport3 = new V();
|
|
5882
5882
|
_color = new T();
|
|
5883
5883
|
constructor(e, t = []) {
|
|
@@ -5885,7 +5885,7 @@ var Zr, Qr = class extends H {
|
|
|
5885
5885
|
}
|
|
5886
5886
|
apply(e, t) {
|
|
5887
5887
|
this.viewport3.activateWithCopy(e, t), this.viewport3.redraw(e, () => {
|
|
5888
|
-
this._color.value = this.color, I.draw(e,
|
|
5888
|
+
this._color.value = this.color, I.draw(e, Qr.material, {
|
|
5889
5889
|
sampler: 0,
|
|
5890
5890
|
uAlpha: this._color.a,
|
|
5891
5891
|
uColor: this._color.toArray().slice(0, 3),
|
|
@@ -5898,16 +5898,16 @@ var Zr, Qr = class extends H {
|
|
|
5898
5898
|
]
|
|
5899
5899
|
});
|
|
5900
5900
|
}), this.blurEffect.strength = this.blur, this.blurEffect.apply(e, this.viewport3), t.redraw(e, () => {
|
|
5901
|
-
this.viewport3.texture.activate(e, 1), I.draw(e,
|
|
5901
|
+
this.viewport3.texture.activate(e, 1), I.draw(e, Zn.instance, { sampler: 1 }), this.shadowOnly || I.draw(e, Zn.instance, { sampler: 0 }), e.texture.unbind(1);
|
|
5902
5902
|
});
|
|
5903
5903
|
}
|
|
5904
5904
|
};
|
|
5905
|
-
O([_({ fallback: "#000000FF" }), D("design:type", Object)],
|
|
5905
|
+
O([_({ fallback: "#000000FF" }), D("design:type", Object)], $r.prototype, "color", void 0), O([_({ fallback: 4 }), D("design:type", Number)], $r.prototype, "blur", void 0), O([_({ fallback: 4 }), D("design:type", Number)], $r.prototype, "offsetX", void 0), O([_({ fallback: 4 }), D("design:type", Number)], $r.prototype, "offsetY", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], $r.prototype, "shadowOnly", void 0), $r = Qr = O([b("DropShadowEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], $r);
|
|
5906
5906
|
//#endregion
|
|
5907
5907
|
//#region src/scene/effects/EmbossEffect.ts
|
|
5908
|
-
var
|
|
5908
|
+
var ei, ti = class extends H {
|
|
5909
5909
|
static {
|
|
5910
|
-
|
|
5910
|
+
ei = this;
|
|
5911
5911
|
}
|
|
5912
5912
|
static material = new F({ gl: {
|
|
5913
5913
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -5918,7 +5918,7 @@ var $r, ei = class extends H {
|
|
|
5918
5918
|
}
|
|
5919
5919
|
apply(e, t) {
|
|
5920
5920
|
t.redraw(e, () => {
|
|
5921
|
-
I.draw(e,
|
|
5921
|
+
I.draw(e, ei.material, {
|
|
5922
5922
|
sampler: 0,
|
|
5923
5923
|
strength: this.strength,
|
|
5924
5924
|
inputSize: [
|
|
@@ -5931,12 +5931,12 @@ var $r, ei = class extends H {
|
|
|
5931
5931
|
});
|
|
5932
5932
|
}
|
|
5933
5933
|
};
|
|
5934
|
-
O([_({ fallback: 5 }), D("design:type", Number)],
|
|
5934
|
+
O([_({ fallback: 5 }), D("design:type", Number)], ti.prototype, "strength", void 0), ti = ei = O([b("EmbossEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], ti);
|
|
5935
5935
|
//#endregion
|
|
5936
5936
|
//#region src/scene/effects/GlitchEffect.ts
|
|
5937
|
-
var
|
|
5937
|
+
var ni, G = class extends H {
|
|
5938
5938
|
static {
|
|
5939
|
-
|
|
5939
|
+
ni = this;
|
|
5940
5940
|
}
|
|
5941
5941
|
static material = new F({ gl: {
|
|
5942
5942
|
vertex: "in vec2 position;\nin vec2 uv;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -5949,7 +5949,7 @@ var ti, G = class extends H {
|
|
|
5949
5949
|
_needsRedraw = !1;
|
|
5950
5950
|
constructor(e, t = []) {
|
|
5951
5951
|
super(), this.setProperties(e).append(t);
|
|
5952
|
-
let n =
|
|
5952
|
+
let n = S(4, this.sampleSize);
|
|
5953
5953
|
if (!n) throw Error("GlitchEffect requires a canvas; call setCanvasFactory() in non-browser environments.");
|
|
5954
5954
|
this._canvas = n, this._texture = new R(this._canvas), this._sizes = new Float32Array(this.slices), this._offsets = new Float32Array(this.slices);
|
|
5955
5955
|
}
|
|
@@ -5968,7 +5968,7 @@ var ti, G = class extends H {
|
|
|
5968
5968
|
this._needsRedraw || (this._needsRedraw = !0, this.redraw());
|
|
5969
5969
|
let n = t.width, r = t.height, i = this.direction * (Math.PI / 180), a = Math.sin(i), o = Math.cos(i);
|
|
5970
5970
|
t.redraw(e, () => {
|
|
5971
|
-
this._texture.activate(e, 1), I.draw(e,
|
|
5971
|
+
this._texture.activate(e, 1), I.draw(e, ni.material, {
|
|
5972
5972
|
sampler: 0,
|
|
5973
5973
|
filterClamp: [
|
|
5974
5974
|
0,
|
|
@@ -5997,12 +5997,12 @@ var ti, G = class extends H {
|
|
|
5997
5997
|
});
|
|
5998
5998
|
}
|
|
5999
5999
|
};
|
|
6000
|
-
O([_({ fallback: 10 }), D("design:type", Number)], G.prototype, "slices", void 0), O([_({ fallback: 512 }), D("design:type", Number)], G.prototype, "sampleSize", void 0), O([_({ fallback: 100 }), D("design:type", Number)], G.prototype, "offset", void 0), O([_({ fallback: 0 }), D("design:type", Number)], G.prototype, "direction", void 0), O([_({ fallback: 2 }), D("design:type", Number)], G.prototype, "fillMode", void 0), O([_({ fallback: 0 }), D("design:type", Number)], G.prototype, "seed", void 0), O([_({ default: () => [2, 2] }), D("design:type", Array)], G.prototype, "red", void 0), O([_({ default: () => [-10, 4] }), D("design:type", Array)], G.prototype, "green", void 0), O([_({ default: () => [10, -4] }), D("design:type", Array)], G.prototype, "blue", void 0), G =
|
|
6000
|
+
O([_({ fallback: 10 }), D("design:type", Number)], G.prototype, "slices", void 0), O([_({ fallback: 512 }), D("design:type", Number)], G.prototype, "sampleSize", void 0), O([_({ fallback: 100 }), D("design:type", Number)], G.prototype, "offset", void 0), O([_({ fallback: 0 }), D("design:type", Number)], G.prototype, "direction", void 0), O([_({ fallback: 2 }), D("design:type", Number)], G.prototype, "fillMode", void 0), O([_({ fallback: 0 }), D("design:type", Number)], G.prototype, "seed", void 0), O([_({ default: () => [2, 2] }), D("design:type", Array)], G.prototype, "red", void 0), O([_({ default: () => [-10, 4] }), D("design:type", Array)], G.prototype, "green", void 0), O([_({ default: () => [10, -4] }), D("design:type", Array)], G.prototype, "blue", void 0), G = ni = O([b("GlitchEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], G);
|
|
6001
6001
|
//#endregion
|
|
6002
6002
|
//#region src/scene/effects/GodrayEffect.ts
|
|
6003
|
-
var
|
|
6003
|
+
var ri, ii = "vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 permute(vec4 x) {\n return mod289(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nvec3 fade(vec3 t) {\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n// Classic Perlin noise, periodic variant\nfloat pnoise(vec3 P, vec3 rep) {\n vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n}\nfloat turb(vec3 P, vec3 rep, float lacunarity, float gain) {\n float sum = 0.0;\n float sc = 1.0;\n float totalgain = 1.0;\n for (float i = 0.0; i < 6.0; i++) {\n sum += totalgain * pnoise(P * sc, rep);\n sc *= lacunarity;\n totalgain *= gain;\n }\n return abs(sum);\n}", K = class extends H {
|
|
6004
6004
|
static {
|
|
6005
|
-
|
|
6005
|
+
ri = this;
|
|
6006
6006
|
}
|
|
6007
6007
|
static material = new F({ gl: {
|
|
6008
6008
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -6017,7 +6017,7 @@ uniform float uTime;
|
|
|
6017
6017
|
uniform vec3 uRay;
|
|
6018
6018
|
uniform vec4 uInputSize;
|
|
6019
6019
|
|
|
6020
|
-
${
|
|
6020
|
+
${ii}
|
|
6021
6021
|
|
|
6022
6022
|
void main(void) {
|
|
6023
6023
|
bool uParallel = uParallel > 0.5;
|
|
@@ -6056,7 +6056,7 @@ void main(void) {
|
|
|
6056
6056
|
apply(e, t) {
|
|
6057
6057
|
let n = this.angle * (Math.PI / 180), r = this.parallel ? [Math.cos(n), Math.sin(n)] : this.center;
|
|
6058
6058
|
t.redraw(e, () => {
|
|
6059
|
-
I.draw(e,
|
|
6059
|
+
I.draw(e, ri.material, {
|
|
6060
6060
|
sampler: 0,
|
|
6061
6061
|
uDimensions: [t.width, t.height],
|
|
6062
6062
|
uParallel: +!!this.parallel,
|
|
@@ -6078,15 +6078,15 @@ void main(void) {
|
|
|
6078
6078
|
});
|
|
6079
6079
|
}
|
|
6080
6080
|
};
|
|
6081
|
-
O([_({ fallback: 0 }), D("design:type", Number)], K.prototype, "time", void 0), O([_({ fallback: 30 }), D("design:type", Number)], K.prototype, "angle", void 0), O([_({ fallback: .5 }), D("design:type", Number)], K.prototype, "gain", void 0), O([_({ fallback: 2.5 }), D("design:type", Number)], K.prototype, "lacunarity", void 0), O([_({ fallback: !0 }), D("design:type", Boolean)], K.prototype, "parallel", void 0), O([_({ default: () => [0, 0] }), D("design:type", Array)], K.prototype, "center", void 0), O([_({ fallback: 1 }), D("design:type", Number)], K.prototype, "alpha", void 0), K =
|
|
6081
|
+
O([_({ fallback: 0 }), D("design:type", Number)], K.prototype, "time", void 0), O([_({ fallback: 30 }), D("design:type", Number)], K.prototype, "angle", void 0), O([_({ fallback: .5 }), D("design:type", Number)], K.prototype, "gain", void 0), O([_({ fallback: 2.5 }), D("design:type", Number)], K.prototype, "lacunarity", void 0), O([_({ fallback: !0 }), D("design:type", Boolean)], K.prototype, "parallel", void 0), O([_({ default: () => [0, 0] }), D("design:type", Array)], K.prototype, "center", void 0), O([_({ fallback: 1 }), D("design:type", Number)], K.prototype, "alpha", void 0), K = ri = O([b("GodrayEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], K);
|
|
6082
6082
|
//#endregion
|
|
6083
6083
|
//#region src/scene/effects/KawaseBlurEffect.ts
|
|
6084
|
-
var
|
|
6084
|
+
var ai = "varying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 uOffset;\n\nvoid main(void) {\n vec4 color = vec4(0.0);\n color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y + uOffset.y));\n color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y + uOffset.y));\n color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y - uOffset.y));\n color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y - uOffset.y));\n color *= 0.25;\n gl_FragColor = color;\n}", oi = "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 uOffset;\nuniform vec4 uInputClamp;\nvoid main(void) {\n vec4 color = vec4(0.0);\n color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n color *= 0.25;\n gl_FragColor = color;\n}", si = class extends H {
|
|
6085
6085
|
_kernels = [0];
|
|
6086
6086
|
constructor(e, t = []) {
|
|
6087
6087
|
super(), this.material = new F({ gl: {
|
|
6088
6088
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6089
|
-
fragment: e?.clamp ?
|
|
6089
|
+
fragment: e?.clamp ? oi : ai
|
|
6090
6090
|
} }), this.setProperties(e).append(t), this._generateKernels();
|
|
6091
6091
|
}
|
|
6092
6092
|
_updateProperty(e, t, n) {
|
|
@@ -6124,12 +6124,12 @@ var ii = "varying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 uOffset;\n
|
|
|
6124
6124
|
});
|
|
6125
6125
|
}
|
|
6126
6126
|
};
|
|
6127
|
-
O([_({ fallback: 4 }), D("design:type", Number)],
|
|
6127
|
+
O([_({ fallback: 4 }), D("design:type", Number)], si.prototype, "strength", void 0), O([_({ fallback: 3 }), D("design:type", Number)], si.prototype, "quality", void 0), O([_({ default: () => [1, 1] }), D("design:type", Array)], si.prototype, "pixelSize", void 0), si = O([b("KawaseBlurEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], si);
|
|
6128
6128
|
//#endregion
|
|
6129
6129
|
//#region src/scene/effects/MaskEffect.ts
|
|
6130
|
-
var
|
|
6130
|
+
var ci, li = class extends H {
|
|
6131
6131
|
static {
|
|
6132
|
-
|
|
6132
|
+
ci = this;
|
|
6133
6133
|
}
|
|
6134
6134
|
static material = new F({ gl: {
|
|
6135
6135
|
vertex: "attribute vec2 position;\nin vec2 uv;\nout vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -6151,7 +6151,7 @@ var si, ci = class extends H {
|
|
|
6151
6151
|
}
|
|
6152
6152
|
apply(e, t, n) {
|
|
6153
6153
|
this.texture && t.redraw(e, () => {
|
|
6154
|
-
this.texture.activate(e, 1), I.draw(e,
|
|
6154
|
+
this.texture.activate(e, 1), I.draw(e, ci.material, {
|
|
6155
6155
|
sampler: 0,
|
|
6156
6156
|
mask: 1,
|
|
6157
6157
|
rotation: n.target?.globalRotation ?? 0
|
|
@@ -6159,23 +6159,23 @@ var si, ci = class extends H {
|
|
|
6159
6159
|
});
|
|
6160
6160
|
}
|
|
6161
6161
|
};
|
|
6162
|
-
O([_({ fallback: "" }), D("design:type", String)],
|
|
6162
|
+
O([_({ fallback: "" }), D("design:type", String)], li.prototype, "image", void 0), li = ci = O([b("MaskEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], li);
|
|
6163
6163
|
//#endregion
|
|
6164
6164
|
//#region src/scene/effects/OutlineEffect.ts
|
|
6165
|
-
var
|
|
6165
|
+
var ui, di = "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampler;\nuniform vec2 uThickness;\nuniform vec3 uColor;\nuniform float uAlpha;\nuniform float uKnockout;\nuniform vec4 uInputClamp;\n\nconst float DOUBLE_PI = 2. * 3.14159265358979323846264;\nconst float ANGLE_STEP = {ANGLE_STEP};\n\nfloat outlineMaxAlphaAtPos(vec2 pos) {\n if (uThickness.x == 0. || uThickness.y == 0.) {\n return 0.;\n }\n vec4 displacedColor;\n vec2 displacedPos;\n float maxAlpha = 0.;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ANGLE_STEP) {\n displacedPos.x = vUv.x + uThickness.x * cos(angle);\n displacedPos.y = vUv.y + uThickness.y * sin(angle);\n displacedColor = texture2D(sampler, clamp(displacedPos, uInputClamp.xy, uInputClamp.zw));\n maxAlpha = max(maxAlpha, displacedColor.a);\n }\n return maxAlpha;\n}\n\nvoid main(void) {\n vec4 sourceColor = texture2D(sampler, vUv);\n vec4 contentColor = sourceColor * float(uKnockout < 0.5);\n float outlineAlpha = uAlpha * outlineMaxAlphaAtPos(vUv.xy) * (1.-sourceColor.a);\n vec4 outlineColor = vec4(vec3(uColor) * outlineAlpha, outlineAlpha);\n gl_FragColor = contentColor + outlineColor;\n}", q = class extends H {
|
|
6166
6166
|
static {
|
|
6167
|
-
|
|
6167
|
+
ui = this;
|
|
6168
6168
|
}
|
|
6169
6169
|
static MIN_SAMPLES = 1;
|
|
6170
6170
|
static MAX_SAMPLES = 100;
|
|
6171
6171
|
static getAngleStep(e) {
|
|
6172
|
-
return Number.parseFloat((Math.PI * 2 / Math.max(e *
|
|
6172
|
+
return Number.parseFloat((Math.PI * 2 / Math.max(e * ui.MAX_SAMPLES, ui.MIN_SAMPLES)).toFixed(7));
|
|
6173
6173
|
}
|
|
6174
6174
|
_color = new T();
|
|
6175
6175
|
constructor(e, t = []) {
|
|
6176
6176
|
super(), this.setProperties(e).append(t), this.material = new F({ gl: {
|
|
6177
6177
|
vertex: "precision mediump float;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
6178
|
-
fragment:
|
|
6178
|
+
fragment: di.replace(/\{ANGLE_STEP\}/, ui.getAngleStep(this.quality).toFixed(7))
|
|
6179
6179
|
} });
|
|
6180
6180
|
}
|
|
6181
6181
|
apply(e, t) {
|
|
@@ -6185,7 +6185,7 @@ var li, ui = "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampl
|
|
|
6185
6185
|
uThickness: [this.width / t.width, this.width / t.height],
|
|
6186
6186
|
uColor: this._color.toArray().slice(0, 3),
|
|
6187
6187
|
uAlpha: this.opacity === 1 ? this._color.a : this.opacity,
|
|
6188
|
-
uAngleStep:
|
|
6188
|
+
uAngleStep: ui.getAngleStep(this.quality),
|
|
6189
6189
|
uKnockout: +!!this.knockout,
|
|
6190
6190
|
uInputClamp: [
|
|
6191
6191
|
0,
|
|
@@ -6197,12 +6197,12 @@ var li, ui = "precision highp float;\nvarying vec2 vUv;\nuniform sampler2D sampl
|
|
|
6197
6197
|
});
|
|
6198
6198
|
}
|
|
6199
6199
|
};
|
|
6200
|
-
O([_({ fallback: "#000000ff" }), D("design:type", Object)], q.prototype, "color", void 0), O([_({ fallback: 1 }), D("design:type", Number)], q.prototype, "width", void 0), O([_({ fallback: "solid" }), D("design:type", String)], q.prototype, "style", void 0), O([_(), D("design:type", Object)], q.prototype, "image", void 0), O([_({ fallback: 1 }), D("design:type", Number)], q.prototype, "opacity", void 0), O([_({ fallback: .1 }), D("design:type", Number)], q.prototype, "quality", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], q.prototype, "knockout", void 0), q =
|
|
6200
|
+
O([_({ fallback: "#000000ff" }), D("design:type", Object)], q.prototype, "color", void 0), O([_({ fallback: 1 }), D("design:type", Number)], q.prototype, "width", void 0), O([_({ fallback: "solid" }), D("design:type", String)], q.prototype, "style", void 0), O([_(), D("design:type", Object)], q.prototype, "image", void 0), O([_({ fallback: 1 }), D("design:type", Number)], q.prototype, "opacity", void 0), O([_({ fallback: .1 }), D("design:type", Number)], q.prototype, "quality", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], q.prototype, "knockout", void 0), q = ui = O([b("OutlineEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], q);
|
|
6201
6201
|
//#endregion
|
|
6202
6202
|
//#region src/scene/effects/PixelateEffect.ts
|
|
6203
|
-
var
|
|
6203
|
+
var fi, pi = class extends H {
|
|
6204
6204
|
static {
|
|
6205
|
-
|
|
6205
|
+
fi = this;
|
|
6206
6206
|
}
|
|
6207
6207
|
static material = new F({ gl: {
|
|
6208
6208
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -6218,16 +6218,16 @@ var di, fi = class extends H {
|
|
|
6218
6218
|
offset: [(r[0] + i[0]) / t.width, 1 - (r[1] + i[1]) / t.height],
|
|
6219
6219
|
step: [this.strength * r[0] / t.width, this.strength * r[1] / t.height]
|
|
6220
6220
|
};
|
|
6221
|
-
I.draw(e,
|
|
6221
|
+
I.draw(e, fi.material, a);
|
|
6222
6222
|
});
|
|
6223
6223
|
}
|
|
6224
6224
|
};
|
|
6225
|
-
O([_({ fallback: 10 }), D("design:type", Number)],
|
|
6225
|
+
O([_({ fallback: 10 }), D("design:type", Number)], pi.prototype, "strength", void 0), pi = fi = O([b("PixelateEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], pi);
|
|
6226
6226
|
//#endregion
|
|
6227
6227
|
//#region src/scene/effects/ZoomBlurEffect.ts
|
|
6228
|
-
var
|
|
6228
|
+
var mi, hi = class extends H {
|
|
6229
6229
|
static {
|
|
6230
|
-
|
|
6230
|
+
mi = this;
|
|
6231
6231
|
}
|
|
6232
6232
|
static material = new F({ gl: {
|
|
6233
6233
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
@@ -6238,7 +6238,7 @@ var pi, mi = class extends H {
|
|
|
6238
6238
|
}
|
|
6239
6239
|
apply(e, t) {
|
|
6240
6240
|
t.redraw(e, () => {
|
|
6241
|
-
I.draw(e,
|
|
6241
|
+
I.draw(e, mi.material, {
|
|
6242
6242
|
sampler: 0,
|
|
6243
6243
|
uCenter: [t.width / 2, t.height / 2],
|
|
6244
6244
|
uInnerRadius: this.innerRadius,
|
|
@@ -6254,10 +6254,10 @@ var pi, mi = class extends H {
|
|
|
6254
6254
|
});
|
|
6255
6255
|
}
|
|
6256
6256
|
};
|
|
6257
|
-
O([_(), D("design:type", Array)],
|
|
6257
|
+
O([_(), D("design:type", Array)], hi.prototype, "center", void 0), O([_({ fallback: 20 }), D("design:type", Number)], hi.prototype, "innerRadius", void 0), O([_({ fallback: -1 }), D("design:type", Number)], hi.prototype, "radius", void 0), O([_({ fallback: .1 }), D("design:type", Number)], hi.prototype, "strength", void 0), hi = mi = O([b("ZoomBlurEffect"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], hi);
|
|
6258
6258
|
//#endregion
|
|
6259
6259
|
//#region src/scene/2d/element/utils.ts
|
|
6260
|
-
function
|
|
6260
|
+
function gi(e, t) {
|
|
6261
6261
|
let { x: n, y: r, width: i, height: a } = t, o = !1, s = new v().translate(-n, -r).scale(1 / i, 1 / a);
|
|
6262
6262
|
if (e.cropRect) {
|
|
6263
6263
|
let { left: t = 0, top: n = 0, right: r = 0, bottom: i = 0 } = e.cropRect;
|
|
@@ -6312,7 +6312,7 @@ var J = class extends C {
|
|
|
6312
6312
|
}
|
|
6313
6313
|
}
|
|
6314
6314
|
async loadTexture() {
|
|
6315
|
-
if (this.linearGradient || this.radialGradient) this.texture = new
|
|
6315
|
+
if (this.linearGradient || this.radialGradient) this.texture = new nr(this.linearGradient ?? this.radialGradient, Math.floor(this._parent.size.width), Math.floor(this._parent.size.height));
|
|
6316
6316
|
else if (d(this.image)) this.animatedTexture = void 0, this.texture = void 0;
|
|
6317
6317
|
else if (this._parent.tree?.log(`load image ${this.image}`), this.image !== "viewport") {
|
|
6318
6318
|
let e = this.image.split("?")[0].endsWith(".gif"), t = this.image, n = await $.loadBy(t, async () => {
|
|
@@ -6333,12 +6333,12 @@ var J = class extends C {
|
|
|
6333
6333
|
width: e,
|
|
6334
6334
|
height: t
|
|
6335
6335
|
} };
|
|
6336
|
-
if (this.image === "viewport") n.fillStyle = new
|
|
6336
|
+
if (this.image === "viewport") n.fillStyle = new or();
|
|
6337
6337
|
else {
|
|
6338
6338
|
let i = this.animatedTexture?.currentFrame.texture ?? this.texture;
|
|
6339
6339
|
r = {
|
|
6340
6340
|
...r,
|
|
6341
|
-
...
|
|
6341
|
+
...gi(this, this.tile && i ? {
|
|
6342
6342
|
x: 0,
|
|
6343
6343
|
y: 0,
|
|
6344
6344
|
width: i.sourceWidth,
|
|
@@ -6377,7 +6377,7 @@ var J = class extends C {
|
|
|
6377
6377
|
O([_({ fallback: !0 }), D("design:type", Boolean)], J.prototype, "enabled", void 0), O([_(), D("design:type", Object)], J.prototype, "color", void 0), O([_(), D("design:type", Object)], J.prototype, "image", void 0), O([_(), D("design:type", Object)], J.prototype, "linearGradient", void 0), O([_(), D("design:type", Object)], J.prototype, "radialGradient", void 0), O([_(), D("design:type", Object)], J.prototype, "cropRect", void 0), O([_(), D("design:type", Object)], J.prototype, "stretchRect", void 0), O([_(), D("design:type", Object)], J.prototype, "dpi", void 0), O([_(), D("design:type", Object)], J.prototype, "rotateWithShape", void 0), O([_(), D("design:type", Object)], J.prototype, "tile", void 0), O([_(), D("design:type", Object)], J.prototype, "opacity", void 0);
|
|
6378
6378
|
//#endregion
|
|
6379
6379
|
//#region src/scene/2d/element/Element2DBackground.ts
|
|
6380
|
-
var
|
|
6380
|
+
var _i = class extends J {
|
|
6381
6381
|
setProperties(e) {
|
|
6382
6382
|
return super._setProperties(d(e) ? void 0 : f(e));
|
|
6383
6383
|
}
|
|
@@ -6389,14 +6389,14 @@ var gi = class extends J {
|
|
|
6389
6389
|
}
|
|
6390
6390
|
}
|
|
6391
6391
|
};
|
|
6392
|
-
O([_(), D("design:type", Object)],
|
|
6392
|
+
O([_(), D("design:type", Object)], _i.prototype, "fillWithShape", void 0);
|
|
6393
6393
|
//#endregion
|
|
6394
6394
|
//#region src/scene/2d/element/Element2DChart.ts
|
|
6395
|
-
var
|
|
6396
|
-
function
|
|
6397
|
-
return
|
|
6395
|
+
var vi;
|
|
6396
|
+
function yi() {
|
|
6397
|
+
return vi ||= import("echarts").then((e) => e?.init ? e : e?.default).catch(() => void 0), vi;
|
|
6398
6398
|
}
|
|
6399
|
-
function
|
|
6399
|
+
function bi(e) {
|
|
6400
6400
|
if (!e) return { show: !1 };
|
|
6401
6401
|
switch (e) {
|
|
6402
6402
|
case "bottom": return {
|
|
@@ -6462,7 +6462,7 @@ var Y = class extends C {
|
|
|
6462
6462
|
this._teardown(), this._parent.requestDraw();
|
|
6463
6463
|
return;
|
|
6464
6464
|
}
|
|
6465
|
-
let n = await
|
|
6465
|
+
let n = await yi();
|
|
6466
6466
|
if (!n) {
|
|
6467
6467
|
console.warn("[modern-canvas] chart rendering requires the optional \"echarts\" dependency (e.g. `pnpm add echarts`)");
|
|
6468
6468
|
return;
|
|
@@ -6487,7 +6487,7 @@ var Y = class extends C {
|
|
|
6487
6487
|
}), this._instance.setOption(this._toOption(), !0), !this._texture) {
|
|
6488
6488
|
let e = this._container.querySelector("canvas");
|
|
6489
6489
|
if (!e) return;
|
|
6490
|
-
this._texture = new
|
|
6490
|
+
this._texture = new er({
|
|
6491
6491
|
source: e,
|
|
6492
6492
|
pixelRatio: 1
|
|
6493
6493
|
});
|
|
@@ -6511,7 +6511,7 @@ var Y = class extends C {
|
|
|
6511
6511
|
text: this.title,
|
|
6512
6512
|
left: "center"
|
|
6513
6513
|
} : void 0,
|
|
6514
|
-
legend:
|
|
6514
|
+
legend: bi(this.legend),
|
|
6515
6515
|
tooltip: {}
|
|
6516
6516
|
};
|
|
6517
6517
|
if (n) {
|
|
@@ -6558,7 +6558,7 @@ var Y = class extends C {
|
|
|
6558
6558
|
O([_({ fallback: !0 }), D("design:type", Boolean)], Y.prototype, "enabled", void 0), O([_({ fallback: "column" }), D("design:type", Object)], Y.prototype, "type", void 0), O([_(), D("design:type", Object)], Y.prototype, "grouping", void 0), O([_({ fallback: () => [] }), D("design:type", Object)], Y.prototype, "categories", void 0), O([_({ fallback: () => [] }), D("design:type", Object)], Y.prototype, "series", void 0), O([_(), D("design:type", Object)], Y.prototype, "title", void 0), O([_(), D("design:type", Object)], Y.prototype, "legend", void 0), O([_(), D("design:type", Object)], Y.prototype, "categoryAxis", void 0), O([_(), D("design:type", Object)], Y.prototype, "valueAxis", void 0);
|
|
6559
6559
|
//#endregion
|
|
6560
6560
|
//#region src/scene/2d/element/Element2DConnection.ts
|
|
6561
|
-
var
|
|
6561
|
+
var xi = class extends C {
|
|
6562
6562
|
_parent;
|
|
6563
6563
|
_routeSig;
|
|
6564
6564
|
_routePath;
|
|
@@ -6601,12 +6601,12 @@ var bi = class extends C {
|
|
|
6601
6601
|
let n = t.shape.connectionPoints?.find((t) => t.idx === e.idx);
|
|
6602
6602
|
if (n) {
|
|
6603
6603
|
let e = t.globalTransform.apply(new y(n.x * t.size.x, n.y * t.size.y)), i;
|
|
6604
|
-
return i = n.ang === void 0 ?
|
|
6604
|
+
return i = n.ang === void 0 ? Er(n.x - .5, n.y - .5) : {
|
|
6605
6605
|
x: Math.cos(n.ang),
|
|
6606
6606
|
y: Math.sin(n.ang)
|
|
6607
6607
|
}, {
|
|
6608
6608
|
point: e,
|
|
6609
|
-
dir:
|
|
6609
|
+
dir: Si(i, t.globalRotation),
|
|
6610
6610
|
bbox: r
|
|
6611
6611
|
};
|
|
6612
6612
|
}
|
|
@@ -6629,11 +6629,11 @@ var bi = class extends C {
|
|
|
6629
6629
|
return;
|
|
6630
6630
|
}
|
|
6631
6631
|
let n = (e) => e ? `${e.point.x},${e.point.y},${e.dir?.x ?? ""},${e.dir?.y ?? ""}` : "-", r = `${this.mode}|${n(e)}|${n(t)}`;
|
|
6632
|
-
return (r !== this._routeSig || !this._routePath) && (this._routeSig = r, this._routePath =
|
|
6632
|
+
return (r !== this._routeSig || !this._routePath) && (this._routeSig = r, this._routePath = Dr(this.mode, e ?? t, t ?? e)), this._routePath;
|
|
6633
6633
|
}
|
|
6634
6634
|
};
|
|
6635
|
-
O([_(), D("design:type", Object)],
|
|
6636
|
-
function
|
|
6635
|
+
O([_(), D("design:type", Object)], xi.prototype, "start", void 0), O([_(), D("design:type", Object)], xi.prototype, "end", void 0), O([_({ fallback: "straight" }), D("design:type", Object)], xi.prototype, "mode", void 0), O([_({ fallback: .5 }), D("design:type", Number)], xi.prototype, "labelPosition", void 0);
|
|
6636
|
+
function Si(e, t) {
|
|
6637
6637
|
if (!t) return e;
|
|
6638
6638
|
let n = Math.cos(t), r = Math.sin(t);
|
|
6639
6639
|
return {
|
|
@@ -6642,8 +6642,59 @@ function xi(e, t) {
|
|
|
6642
6642
|
};
|
|
6643
6643
|
}
|
|
6644
6644
|
//#endregion
|
|
6645
|
+
//#region src/scene/2d/element/bakeImageEffects.ts
|
|
6646
|
+
function Ci(e) {
|
|
6647
|
+
return e.getContext("2d");
|
|
6648
|
+
}
|
|
6649
|
+
function wi(e, t, n, r) {
|
|
6650
|
+
let i = (t?.angle ?? 0) * Math.PI / 180, a = n / 2, o = r / 2, s = (Math.abs(Math.cos(i)) * n + Math.abs(Math.sin(i)) * r) / 2, c = Math.cos(i) * s, l = Math.sin(i) * s, u = e.createLinearGradient(a - c, o - l, a + c, o + l);
|
|
6651
|
+
for (let e of t?.stops ?? []) u.addColorStop(Math.min(1, Math.max(0, e.offset)), e.color);
|
|
6652
|
+
return u;
|
|
6653
|
+
}
|
|
6654
|
+
function Ti(e, t, n, r, i) {
|
|
6655
|
+
let a = S(t, n), o = Ci(a);
|
|
6656
|
+
return o.drawImage(e, 0, 0, t, n), o.globalCompositeOperation = "source-in", r.linearGradient ? (o.fillStyle = wi(o, r.linearGradient, t, n), o.fillRect(0, 0, t, n)) : r.image && i[r.image] ? o.drawImage(i[r.image], 0, 0, t, n) : r.color && (o.fillStyle = r.color, o.fillRect(0, 0, t, n)), a;
|
|
6657
|
+
}
|
|
6658
|
+
function Ei(e, t, n, r, i) {
|
|
6659
|
+
let a = S(t, n), o = Ci(a), s = Math.max(8, Math.ceil(r) * 2);
|
|
6660
|
+
for (let i = 0; i < s; i++) {
|
|
6661
|
+
let a = i / s * Math.PI * 2;
|
|
6662
|
+
o.drawImage(e, Math.cos(a) * r, Math.sin(a) * r, t, n);
|
|
6663
|
+
}
|
|
6664
|
+
o.globalCompositeOperation = "source-in", o.fillStyle = i, o.fillRect(0, 0, t, n);
|
|
6665
|
+
let c = S(t, n), l = Ci(c);
|
|
6666
|
+
return l.drawImage(a, 0, 0), l.drawImage(e, 0, 0, t, n), c;
|
|
6667
|
+
}
|
|
6668
|
+
function Di(e) {
|
|
6669
|
+
let t = 0, n = 0;
|
|
6670
|
+
if (!e) return {
|
|
6671
|
+
x: t,
|
|
6672
|
+
y: n
|
|
6673
|
+
};
|
|
6674
|
+
let r = e.match(/translate\(\s*(-?[\d.]+)[\s,]+(-?[\d.]+)/);
|
|
6675
|
+
r && (t = Number.parseFloat(r[1]), n = Number.parseFloat(r[2]));
|
|
6676
|
+
let i = e.match(/translateX\(\s*(-?[\d.]+)/);
|
|
6677
|
+
i && (t = Number.parseFloat(i[1]));
|
|
6678
|
+
let a = e.match(/translateY\(\s*(-?[\d.]+)/);
|
|
6679
|
+
return a && (n = Number.parseFloat(a[1])), {
|
|
6680
|
+
x: t,
|
|
6681
|
+
y: n
|
|
6682
|
+
};
|
|
6683
|
+
}
|
|
6684
|
+
function Oi(e, t, n, r, i = {}) {
|
|
6685
|
+
let a = Math.max(1, Math.round(n)), o = Math.max(1, Math.round(r)), s = S(a, o), c = Ci(s);
|
|
6686
|
+
for (let n of t) {
|
|
6687
|
+
let t = e;
|
|
6688
|
+
n.fill && (n.fill.color || n.fill.linearGradient || n.fill.image) && (t = Ti(t, a, o, n.fill, i)), n.outline?.width && n.outline.color && (t = Ei(t, a, o, n.outline.width, n.outline.color));
|
|
6689
|
+
let { x: r, y: s } = Di(n.transform);
|
|
6690
|
+
c.save(), n.shadow && (c.shadowColor = n.shadow.color, c.shadowBlur = n.shadow.blur ?? 0, c.shadowOffsetX = n.shadow.offsetX ?? 0, c.shadowOffsetY = n.shadow.offsetY ?? 0), r || s ? c.drawImage(t, r, s, a, o) : (c.globalCompositeOperation = "destination-over", c.drawImage(t, 0, 0, a, o)), c.restore();
|
|
6691
|
+
}
|
|
6692
|
+
return s;
|
|
6693
|
+
}
|
|
6694
|
+
//#endregion
|
|
6645
6695
|
//#region src/scene/2d/element/Element2DForeground.ts
|
|
6646
|
-
var
|
|
6696
|
+
var ki = class extends J {
|
|
6697
|
+
_sourceCanvas;
|
|
6647
6698
|
setProperties(e) {
|
|
6648
6699
|
return super._setProperties(d(e) ? void 0 : g(e));
|
|
6649
6700
|
}
|
|
@@ -6652,17 +6703,39 @@ var Si = class extends J {
|
|
|
6652
6703
|
case "fillWithShape":
|
|
6653
6704
|
this._parent.requestDraw();
|
|
6654
6705
|
break;
|
|
6706
|
+
case "effects":
|
|
6707
|
+
this._updateTexture();
|
|
6708
|
+
break;
|
|
6655
6709
|
}
|
|
6656
6710
|
}
|
|
6711
|
+
async loadTexture() {
|
|
6712
|
+
await super.loadTexture(), this._applyEffects();
|
|
6713
|
+
}
|
|
6714
|
+
_applyEffects() {
|
|
6715
|
+
if (!this.effects?.length || this.animatedTexture || !this.texture) return;
|
|
6716
|
+
let e = this.texture.source;
|
|
6717
|
+
if (e && e.width > 0 && e.height > 0) {
|
|
6718
|
+
let t = Math.max(1, Math.round(e.width)), n = Math.max(1, Math.round(e.height)), r = S(t, n), i = r?.getContext("2d");
|
|
6719
|
+
r && i && (i.drawImage(e, 0, 0, t, n), this._sourceCanvas = r);
|
|
6720
|
+
}
|
|
6721
|
+
let t = this._sourceCanvas;
|
|
6722
|
+
if (!t) return;
|
|
6723
|
+
let n = t.width, r = t.height, i = Oi(t, this.effects, n, r);
|
|
6724
|
+
this.texture = new er({
|
|
6725
|
+
source: i,
|
|
6726
|
+
width: n,
|
|
6727
|
+
height: r
|
|
6728
|
+
});
|
|
6729
|
+
}
|
|
6657
6730
|
};
|
|
6658
|
-
O([_(), D("design:type", Object)],
|
|
6731
|
+
O([_(), D("design:type", Object)], ki.prototype, "fillWithShape", void 0), O([_(), D("design:type", Array)], ki.prototype, "effects", void 0);
|
|
6659
6732
|
//#endregion
|
|
6660
6733
|
//#region src/scene/2d/element/Element2DOutline.ts
|
|
6661
|
-
var
|
|
6734
|
+
var Ai = {
|
|
6662
6735
|
sm: 4,
|
|
6663
6736
|
md: 6,
|
|
6664
6737
|
lg: 8
|
|
6665
|
-
},
|
|
6738
|
+
}, ji = class extends J {
|
|
6666
6739
|
setProperties(e) {
|
|
6667
6740
|
return super._setProperties(d(e) ? void 0 : ee(e));
|
|
6668
6741
|
}
|
|
@@ -6684,7 +6757,7 @@ var Ci = {
|
|
|
6684
6757
|
}
|
|
6685
6758
|
draw() {
|
|
6686
6759
|
let { width: e, height: t } = this._parent.size, n = this._parent.context;
|
|
6687
|
-
this.image === "viewport" ? n.strokeStyle = new
|
|
6760
|
+
this.image === "viewport" ? n.strokeStyle = new or() : n.strokeStyle = this.texture ?? this.color ?? "#000000FF", n.lineWidth = this.width || 1, n.lineCap = this.lineCap, n.lineJoin = this.lineJoin, n.stroke({ ...gi(this, {
|
|
6688
6761
|
x: 0,
|
|
6689
6762
|
y: 0,
|
|
6690
6763
|
width: e,
|
|
@@ -6707,14 +6780,14 @@ var Ci = {
|
|
|
6707
6780
|
_fillEnd(e, t, n, r, i) {
|
|
6708
6781
|
let a = e.x - t.x, o = e.y - t.y, s = Math.hypot(a, o);
|
|
6709
6782
|
if (s < .001) return;
|
|
6710
|
-
let c =
|
|
6783
|
+
let c = Ai[String(n.width ?? n.height ?? "md")] ?? 6, l = r * c, u = r * c * .5, d = a / s, f = o / s, p = e.x - d * l, m = e.y - f * l, h = -f * u, g = d * u, ee = this._parent.context;
|
|
6711
6784
|
ee.fillStyle = i, ee.moveTo(e.x, e.y).lineTo(p + h, m + g).lineTo(p - h, m - g).closePath().fill();
|
|
6712
6785
|
}
|
|
6713
6786
|
};
|
|
6714
|
-
O([_(), D("design:type", Object)],
|
|
6787
|
+
O([_(), D("design:type", Object)], ji.prototype, "color", void 0), O([_(), D("design:type", Object)], ji.prototype, "width", void 0), O([_({ fallback: "solid" }), D("design:type", Object)], ji.prototype, "style", void 0), O([_({ fallback: "butt" }), D("design:type", Object)], ji.prototype, "lineCap", void 0), O([_({ fallback: "miter" }), D("design:type", Object)], ji.prototype, "lineJoin", void 0), O([_(), D("design:type", Object)], ji.prototype, "headEnd", void 0), O([_(), D("design:type", Object)], ji.prototype, "tailEnd", void 0);
|
|
6715
6788
|
//#endregion
|
|
6716
6789
|
//#region src/scene/2d/element/Element2DShadow.ts
|
|
6717
|
-
var
|
|
6790
|
+
var Mi = class extends C {
|
|
6718
6791
|
_parent;
|
|
6719
6792
|
constructor(e) {
|
|
6720
6793
|
super(), this._parent = e;
|
|
@@ -6735,15 +6808,15 @@ var Ti = class extends C {
|
|
|
6735
6808
|
}
|
|
6736
6809
|
updateEffect() {
|
|
6737
6810
|
let e = "__$shadow", t = this._parent.getNode(e);
|
|
6738
|
-
this.enabled && (this.blur || this.offsetX || this.offsetY) ? (t || (t = new
|
|
6811
|
+
this.enabled && (this.blur || this.offsetX || this.offsetY) ? (t || (t = new $r({ name: e }), this._parent.appendChild(t, "back")), t.setProperties(this.getProperties())) : t && this._parent.removeChild(t);
|
|
6739
6812
|
}
|
|
6740
6813
|
};
|
|
6741
|
-
O([_({ fallback: !0 }), D("design:type", Boolean)],
|
|
6814
|
+
O([_({ fallback: !0 }), D("design:type", Boolean)], Mi.prototype, "enabled", void 0), O([_({ fallback: "#000000FF" }), D("design:type", Object)], Mi.prototype, "color", void 0), O([_({ fallback: 0 }), D("design:type", Object)], Mi.prototype, "blur", void 0), O([_({ fallback: 0 }), D("design:type", Object)], Mi.prototype, "offsetY", void 0), O([_({ fallback: 0 }), D("design:type", Object)], Mi.prototype, "offsetX", void 0);
|
|
6742
6815
|
//#endregion
|
|
6743
6816
|
//#region src/scene/2d/element/Element2DShape.ts
|
|
6744
|
-
var
|
|
6817
|
+
var Ni = class extends C {
|
|
6745
6818
|
_parent;
|
|
6746
|
-
_path2DSet = new
|
|
6819
|
+
_path2DSet = new ue();
|
|
6747
6820
|
_localPath;
|
|
6748
6821
|
_hitPath2DSet;
|
|
6749
6822
|
_hitWidth = 0;
|
|
@@ -6792,7 +6865,7 @@ var Ei = class extends C {
|
|
|
6792
6865
|
if (!(!e || !t)) {
|
|
6793
6866
|
if (!this._hitPath2DSet || this._hitWidth !== e || this._hitHeight !== t) {
|
|
6794
6867
|
let n = new v().scale(e, t);
|
|
6795
|
-
this._hitPath2DSet = new
|
|
6868
|
+
this._hitPath2DSet = new ue(this._path2DSet.paths.map((e) => e.clone().applyTransform(n))), this._hitWidth = e, this._hitHeight = t;
|
|
6796
6869
|
}
|
|
6797
6870
|
return this._hitPath2DSet;
|
|
6798
6871
|
}
|
|
@@ -6800,10 +6873,10 @@ var Ei = class extends C {
|
|
|
6800
6873
|
_updatePath2DSet() {
|
|
6801
6874
|
let e;
|
|
6802
6875
|
if (this.svg) {
|
|
6803
|
-
let t =
|
|
6804
|
-
this._path2DSet =
|
|
6876
|
+
let t = de(this.svg);
|
|
6877
|
+
this._path2DSet = fe(t), e = this._path2DSet.viewBox;
|
|
6805
6878
|
} else this._path2DSet.paths.length = 0, this.paths?.forEach((e, t) => {
|
|
6806
|
-
let { data: n, ...r } = e, i = new
|
|
6879
|
+
let { data: n, ...r } = e, i = new le();
|
|
6807
6880
|
i.style = r, i.addData(n), this._path2DSet.paths[t] = i;
|
|
6808
6881
|
});
|
|
6809
6882
|
if (!e) {
|
|
@@ -6839,24 +6912,24 @@ var Ei = class extends C {
|
|
|
6839
6912
|
t && n && (r ? e.roundRect(0, 0, t, n, r) : e.rect(0, 0, t, n));
|
|
6840
6913
|
}
|
|
6841
6914
|
};
|
|
6842
|
-
O([_({ fallback: !0 }), D("design:type", Boolean)],
|
|
6915
|
+
O([_({ fallback: !0 }), D("design:type", Boolean)], Ni.prototype, "enabled", void 0), O([_(), D("design:type", Object)], Ni.prototype, "preset", void 0), O([_(), D("design:type", Object)], Ni.prototype, "svg", void 0), O([_(), D("design:type", Object)], Ni.prototype, "viewBox", void 0), O([_(), D("design:type", Object)], Ni.prototype, "paths", void 0), O([_(), D("design:type", Object)], Ni.prototype, "connectionPoints", void 0);
|
|
6843
6916
|
//#endregion
|
|
6844
6917
|
//#region src/scene/2d/element/Element2DStyle.ts
|
|
6845
|
-
var
|
|
6918
|
+
var Pi = class extends w {
|
|
6846
6919
|
constructor(e) {
|
|
6847
6920
|
super(), this.setProperties(e);
|
|
6848
6921
|
}
|
|
6849
|
-
},
|
|
6922
|
+
}, Fi = {
|
|
6850
6923
|
...o(),
|
|
6851
6924
|
left: 0,
|
|
6852
6925
|
top: 0,
|
|
6853
6926
|
width: 0,
|
|
6854
6927
|
height: 0
|
|
6855
6928
|
};
|
|
6856
|
-
for (let e in
|
|
6929
|
+
for (let e in Fi) i(Pi, e, { fallback: Fi[e] });
|
|
6857
6930
|
//#endregion
|
|
6858
6931
|
//#region src/scene/2d/element/Element2DTable.ts
|
|
6859
|
-
var
|
|
6932
|
+
var Ii = 100, Li = 40, Ri = class extends C {
|
|
6860
6933
|
_parent;
|
|
6861
6934
|
_cellNodes = /* @__PURE__ */ new Map();
|
|
6862
6935
|
_cellSnapshots = /* @__PURE__ */ new Map();
|
|
@@ -6887,10 +6960,10 @@ var ki = 100, Ai = 40, ji = class extends C {
|
|
|
6887
6960
|
return !!(this.enabled && this.cells.length);
|
|
6888
6961
|
}
|
|
6889
6962
|
get gridWidth() {
|
|
6890
|
-
return this.columns.reduce((e, t) => e + (t.width ||
|
|
6963
|
+
return this.columns.reduce((e, t) => e + (t.width || Ii), 0);
|
|
6891
6964
|
}
|
|
6892
6965
|
get gridHeight() {
|
|
6893
|
-
return this.rows.reduce((e, t) => e + (t.height ||
|
|
6966
|
+
return this.rows.reduce((e, t) => e + (t.height || Li), 0);
|
|
6894
6967
|
}
|
|
6895
6968
|
update() {
|
|
6896
6969
|
if (this._dirty = !1, !this.isValid()) {
|
|
@@ -6900,9 +6973,9 @@ var ki = 100, Ai = 40, ji = class extends C {
|
|
|
6900
6973
|
let { columns: e, rows: t, cells: n } = this, r = e.length, i = t.length;
|
|
6901
6974
|
for (let e of n) r = Math.max(r, e.col + (e.colSpan || 1)), i = Math.max(i, e.row + (e.rowSpan || 1));
|
|
6902
6975
|
let a = [0];
|
|
6903
|
-
for (let t = 0; t < r; t++) a.push(a[t] + (e[t]?.width ||
|
|
6976
|
+
for (let t = 0; t < r; t++) a.push(a[t] + (e[t]?.width || Ii));
|
|
6904
6977
|
let o = [0];
|
|
6905
|
-
for (let e = 0; e < i; e++) o.push(o[e] + (t[e]?.height ||
|
|
6978
|
+
for (let e = 0; e < i; e++) o.push(o[e] + (t[e]?.height || Li));
|
|
6906
6979
|
this._parent.size.set(a[e.length] ?? 0, o[t.length] ?? 0);
|
|
6907
6980
|
let s = /* @__PURE__ */ new Set();
|
|
6908
6981
|
for (let e of n) {
|
|
@@ -6939,7 +7012,7 @@ var ki = 100, Ai = 40, ji = class extends C {
|
|
|
6939
7012
|
this._clearCells();
|
|
6940
7013
|
}
|
|
6941
7014
|
};
|
|
6942
|
-
O([_({ fallback: !0 }), D("design:type", Boolean)],
|
|
7015
|
+
O([_({ fallback: !0 }), D("design:type", Boolean)], Ri.prototype, "enabled", void 0), O([_({ fallback: () => [] }), D("design:type", Object)], Ri.prototype, "columns", void 0), O([_({ fallback: () => [] }), D("design:type", Object)], Ri.prototype, "rows", void 0), O([_({ fallback: () => [] }), D("design:type", Object)], Ri.prototype, "cells", void 0);
|
|
6943
7016
|
//#endregion
|
|
6944
7017
|
//#region src/scene/2d/element/Element2DText.ts
|
|
6945
7018
|
var X = class extends C {
|
|
@@ -6953,10 +7026,10 @@ var X = class extends C {
|
|
|
6953
7026
|
}
|
|
6954
7027
|
_textContent = "";
|
|
6955
7028
|
_autoDrawMode;
|
|
6956
|
-
_texture = new
|
|
7029
|
+
_texture = new er({ mipmap: !0 });
|
|
6957
7030
|
_textureMap = /* @__PURE__ */ new Map();
|
|
6958
7031
|
constructor(e) {
|
|
6959
|
-
super(), this._parent = e, this.base = new
|
|
7032
|
+
super(), this._parent = e, this.base = new _e(), this.base.setPropertyAccessor(this);
|
|
6960
7033
|
}
|
|
6961
7034
|
setProperties(e) {
|
|
6962
7035
|
return super.setProperties(d(e) ? void 0 : ie(e));
|
|
@@ -7006,15 +7079,15 @@ var X = class extends C {
|
|
|
7006
7079
|
let r = [];
|
|
7007
7080
|
if (t.fragments.forEach((e, t) => {
|
|
7008
7081
|
if (e.characters.length) {
|
|
7009
|
-
let i =
|
|
7082
|
+
let i = ce.from(...e.characters.map((e) => e.compatibleGlyphBox));
|
|
7010
7083
|
this._updateTexture(`${n}.${t}.fill`, e.fill, i), this._updateTexture(`${n}.${t}.outline`, e.outline, i), r.push(i);
|
|
7011
7084
|
}
|
|
7012
7085
|
}), r.length) {
|
|
7013
|
-
let i =
|
|
7086
|
+
let i = ce.from(...r);
|
|
7014
7087
|
this._updateTexture(`${n}.fill`, t.fill, i), this._updateTexture(`${n}.outline`, t.outline, i), e.push(i);
|
|
7015
7088
|
}
|
|
7016
7089
|
}), e.length) {
|
|
7017
|
-
let t =
|
|
7090
|
+
let t = ce.from(...e);
|
|
7018
7091
|
this._updateTexture("fill", this.fill, t), this._updateTexture("outline", this.outline, t);
|
|
7019
7092
|
}
|
|
7020
7093
|
}
|
|
@@ -7025,7 +7098,7 @@ var X = class extends C {
|
|
|
7025
7098
|
}), this._parent.requestDraw());
|
|
7026
7099
|
}
|
|
7027
7100
|
async _loadTexture(e, t) {
|
|
7028
|
-
return e.linearGradient || e.radialGradient ? new
|
|
7101
|
+
return e.linearGradient || e.radialGradient ? new nr(e.linearGradient ?? e.radialGradient, t.width, t.height) : d(e.image) ? void 0 : (this._parent.tree?.log(`load image ${e.image}`), await $.texture.load(e.image));
|
|
7029
7102
|
}
|
|
7030
7103
|
setContent(e) {
|
|
7031
7104
|
this.content = ae(e);
|
|
@@ -7049,12 +7122,12 @@ var X = class extends C {
|
|
|
7049
7122
|
this.base.pathSets.forEach((n) => {
|
|
7050
7123
|
n.paths.forEach((n) => {
|
|
7051
7124
|
let r = n.getMeta();
|
|
7052
|
-
if (r instanceof
|
|
7125
|
+
if (r instanceof ge) {
|
|
7053
7126
|
let i = r.parent.index, a = r.parent.parent.index;
|
|
7054
7127
|
if (n.style.fill && !d(n.style.fill)) if (typeof n.style.fill == "object") {
|
|
7055
7128
|
let r = n.style.fill, o = this._textureMap.get(`${a}.${i}.fill`) ?? this._textureMap.get(`${a}.fill`) ?? this._textureMap.get("fill");
|
|
7056
7129
|
r.enabled !== !1 && (o || r.color) && (e.addPath(n), e.style = { ...n.style }, e.fillStyle = o?.texture ?? r.color, e.fill({
|
|
7057
|
-
...
|
|
7130
|
+
...gi(r, o?.box ?? {
|
|
7058
7131
|
x: 0,
|
|
7059
7132
|
y: 0,
|
|
7060
7133
|
width: this._parent.size.width,
|
|
@@ -7066,7 +7139,7 @@ var X = class extends C {
|
|
|
7066
7139
|
if (n.style.stroke && !d(n.style.stroke)) if (typeof n.style.stroke == "object") {
|
|
7067
7140
|
let r = n.style.stroke, o = this._textureMap.get(`${a}.${i}.outline`) ?? this._textureMap.get(`${a}.outline`) ?? this._textureMap.get("outline");
|
|
7068
7141
|
r.enabled !== !1 && (o || r.color) && (r.width === void 0 || r.width) && (e.addPath(n), e.style = { ...n.style }, e.lineWidth = r.width || 1, e.strokeStyle = o?.texture ?? r.color, e.lineCap = r.lineCap, e.lineJoin = r.lineJoin, e.stroke({
|
|
7069
|
-
...
|
|
7142
|
+
...gi(r, o?.box ?? {
|
|
7070
7143
|
x: 0,
|
|
7071
7144
|
y: 0,
|
|
7072
7145
|
width: this._parent.size.width,
|
|
@@ -7109,7 +7182,7 @@ var Z = {
|
|
|
7109
7182
|
horizontal: 6,
|
|
7110
7183
|
vertical: 7,
|
|
7111
7184
|
all: 8
|
|
7112
|
-
},
|
|
7185
|
+
}, zi = {
|
|
7113
7186
|
column: 0,
|
|
7114
7187
|
row: 1,
|
|
7115
7188
|
all: 2
|
|
@@ -7123,42 +7196,42 @@ var Z = {
|
|
|
7123
7196
|
"space-between": 6,
|
|
7124
7197
|
"space-around": 7,
|
|
7125
7198
|
"space-evenly": 8
|
|
7126
|
-
},
|
|
7199
|
+
}, Bi = {
|
|
7127
7200
|
flex: 0,
|
|
7128
7201
|
none: 1,
|
|
7129
7202
|
contents: 2
|
|
7130
|
-
},
|
|
7203
|
+
}, Vi = {
|
|
7131
7204
|
inherit: 0,
|
|
7132
7205
|
ltr: 1,
|
|
7133
7206
|
rtl: 2
|
|
7134
|
-
},
|
|
7207
|
+
}, Hi = {
|
|
7135
7208
|
column: 0,
|
|
7136
7209
|
"column-reverse": 1,
|
|
7137
7210
|
row: 2,
|
|
7138
7211
|
"row-reverse": 3
|
|
7139
|
-
},
|
|
7212
|
+
}, Ui = {
|
|
7140
7213
|
"no-wrap": 0,
|
|
7141
7214
|
wrap: 1,
|
|
7142
7215
|
"Wrap-reverse": 2
|
|
7143
|
-
},
|
|
7216
|
+
}, Wi = {
|
|
7144
7217
|
"flex-start": 0,
|
|
7145
7218
|
center: 1,
|
|
7146
7219
|
"flex-end": 2,
|
|
7147
7220
|
"space-between": 3,
|
|
7148
7221
|
"space-around": 4,
|
|
7149
7222
|
"space-evenly": 5
|
|
7150
|
-
},
|
|
7223
|
+
}, Gi = {
|
|
7151
7224
|
visible: 0,
|
|
7152
7225
|
hidden: 1,
|
|
7153
7226
|
scroll: 2
|
|
7154
|
-
},
|
|
7227
|
+
}, Ki = {
|
|
7155
7228
|
static: 0,
|
|
7156
7229
|
relative: 1,
|
|
7157
7230
|
absolute: 2
|
|
7158
|
-
},
|
|
7231
|
+
}, qi = {
|
|
7159
7232
|
"border-box": 0,
|
|
7160
7233
|
"content-box": 1
|
|
7161
|
-
},
|
|
7234
|
+
}, Ji = class e {
|
|
7162
7235
|
_parent;
|
|
7163
7236
|
static _yoga;
|
|
7164
7237
|
static async load() {
|
|
@@ -7170,14 +7243,14 @@ var Z = {
|
|
|
7170
7243
|
this._parent = e, this._addChild = this._addChild.bind(this), this._removeChild = this._removeChild.bind(this), this._parent.on("addChild", this._addChild), this._parent.on("removeChild", this._removeChild);
|
|
7171
7244
|
}
|
|
7172
7245
|
_addChild(e, t) {
|
|
7173
|
-
if (e instanceof
|
|
7246
|
+
if (e instanceof $i && e.flexbox.node && this.node) {
|
|
7174
7247
|
this.node.insertChild(e.flexbox.node, t);
|
|
7175
7248
|
let n = e.style.getProperties();
|
|
7176
7249
|
for (let t in n) e.flexbox.updateStyleProperty(t, n[t]);
|
|
7177
7250
|
}
|
|
7178
7251
|
}
|
|
7179
7252
|
_removeChild(e, t) {
|
|
7180
|
-
e instanceof
|
|
7253
|
+
e instanceof $i && e.flexbox.node && this.node && this.node.removeChild(e.flexbox.node);
|
|
7181
7254
|
}
|
|
7182
7255
|
updateStyleProperty(e, t) {
|
|
7183
7256
|
let n = this.node;
|
|
@@ -7211,10 +7284,10 @@ var Z = {
|
|
|
7211
7284
|
n.setBorder(Z.all, this._parent.style.borderWidth);
|
|
7212
7285
|
break;
|
|
7213
7286
|
case "direction":
|
|
7214
|
-
n.setDirection(t ?
|
|
7287
|
+
n.setDirection(t ? Vi[t] ?? Vi.inherit : Vi.inherit);
|
|
7215
7288
|
break;
|
|
7216
7289
|
case "display":
|
|
7217
|
-
n.setDisplay(t ?
|
|
7290
|
+
n.setDisplay(t ? Bi[t] ?? Bi.flex : Bi.flex);
|
|
7218
7291
|
break;
|
|
7219
7292
|
case "flex":
|
|
7220
7293
|
n.setFlex(t);
|
|
@@ -7223,7 +7296,7 @@ var Z = {
|
|
|
7223
7296
|
n.setFlexBasis(t);
|
|
7224
7297
|
break;
|
|
7225
7298
|
case "flexDirection":
|
|
7226
|
-
n.setFlexDirection(t ?
|
|
7299
|
+
n.setFlexDirection(t ? Hi[t] ?? Hi.row : Hi.row);
|
|
7227
7300
|
break;
|
|
7228
7301
|
case "flexGrow":
|
|
7229
7302
|
n.setFlexGrow(t);
|
|
@@ -7232,16 +7305,16 @@ var Z = {
|
|
|
7232
7305
|
n.setFlexShrink(t);
|
|
7233
7306
|
break;
|
|
7234
7307
|
case "flexWrap":
|
|
7235
|
-
n.setFlexWrap(t ?
|
|
7308
|
+
n.setFlexWrap(t ? Ui[t] ?? Ui.wrap : Ui.wrap);
|
|
7236
7309
|
break;
|
|
7237
7310
|
case "height":
|
|
7238
7311
|
n.setHeight(t);
|
|
7239
7312
|
break;
|
|
7240
7313
|
case "justifyContent":
|
|
7241
|
-
n.setJustifyContent(t ?
|
|
7314
|
+
n.setJustifyContent(t ? Wi[t] ?? Wi["flex-start"] : Wi["flex-start"]);
|
|
7242
7315
|
break;
|
|
7243
7316
|
case "gap":
|
|
7244
|
-
t !== void 0 && n.setGap(
|
|
7317
|
+
t !== void 0 && n.setGap(zi.all, t);
|
|
7245
7318
|
break;
|
|
7246
7319
|
case "marginTop":
|
|
7247
7320
|
n.setMargin(Z.top, t);
|
|
@@ -7271,7 +7344,7 @@ var Z = {
|
|
|
7271
7344
|
n.setMinWidth(t);
|
|
7272
7345
|
break;
|
|
7273
7346
|
case "overflow":
|
|
7274
|
-
n.setOverflow(t ?
|
|
7347
|
+
n.setOverflow(t ? Gi[t] ?? Gi.visible : Gi.visible);
|
|
7275
7348
|
break;
|
|
7276
7349
|
case "paddingTop":
|
|
7277
7350
|
n.setPadding(Z.top, t);
|
|
@@ -7301,10 +7374,10 @@ var Z = {
|
|
|
7301
7374
|
n.setPosition(Z.right, t);
|
|
7302
7375
|
break;
|
|
7303
7376
|
case "position":
|
|
7304
|
-
n.setPositionType(t ?
|
|
7377
|
+
n.setPositionType(t ? Ki[t] ?? Ki.relative : Ki.relative);
|
|
7305
7378
|
break;
|
|
7306
7379
|
case "boxSizing":
|
|
7307
|
-
n.setBoxSizing(t ?
|
|
7380
|
+
n.setBoxSizing(t ? qi[t] ?? qi["content-box"] : qi["content-box"]);
|
|
7308
7381
|
break;
|
|
7309
7382
|
case "width":
|
|
7310
7383
|
n.setWidth(t);
|
|
@@ -7315,7 +7388,7 @@ var Z = {
|
|
|
7315
7388
|
}
|
|
7316
7389
|
update() {
|
|
7317
7390
|
let e = this._parent, t = this.node;
|
|
7318
|
-
if (e.getParent()?.flexbox?.update(), e.globalDisplay === "flex" && t && (t.isDirty() && t.calculateLayout(void 0, void 0,
|
|
7391
|
+
if (e.getParent()?.flexbox?.update(), e.globalDisplay === "flex" && t && (t.isDirty() && t.calculateLayout(void 0, void 0, Vi.ltr), t.hasNewLayout())) {
|
|
7319
7392
|
let { left: n, top: r, width: i, height: a } = t.getComputedLayout();
|
|
7320
7393
|
(!Number.isNaN(n) && n !== e.position.x || !Number.isNaN(r) && r !== e.position.y) && e.position.set(n, r), (!Number.isNaN(i) && i !== e.size.x || !Number.isNaN(a) && a !== e.size.y) && e.size.set(i, a), t.markLayoutSeen();
|
|
7321
7394
|
}
|
|
@@ -7323,15 +7396,15 @@ var Z = {
|
|
|
7323
7396
|
destroy() {
|
|
7324
7397
|
this.node?.free(), this.node = void 0;
|
|
7325
7398
|
}
|
|
7326
|
-
},
|
|
7399
|
+
}, Yi = new Set(Object.keys(a())), Xi = new Set(Object.keys(s())), Zi = new y(), Qi = [
|
|
7327
7400
|
[0, 0],
|
|
7328
7401
|
[1, 0],
|
|
7329
7402
|
[1, 1],
|
|
7330
7403
|
[0, 1]
|
|
7331
|
-
],
|
|
7332
|
-
flexbox = new
|
|
7333
|
-
aabb = new
|
|
7334
|
-
globalAabb = new
|
|
7404
|
+
], $i = class extends wr {
|
|
7405
|
+
flexbox = new Ji(this);
|
|
7406
|
+
aabb = new vt();
|
|
7407
|
+
globalAabb = new vt();
|
|
7335
7408
|
_parentGlobalDisplay;
|
|
7336
7409
|
_globalDisplay;
|
|
7337
7410
|
get globalDisplay() {
|
|
@@ -7342,7 +7415,7 @@ var Z = {
|
|
|
7342
7415
|
});
|
|
7343
7416
|
_allowPointerEvents = !0;
|
|
7344
7417
|
_overflowHidden = !1;
|
|
7345
|
-
_style = new
|
|
7418
|
+
_style = new Pi().on("updateProperty", (...e) => {
|
|
7346
7419
|
this.onUpdateStyleProperty(e[0], e[1], e[2]);
|
|
7347
7420
|
});
|
|
7348
7421
|
get style() {
|
|
@@ -7356,14 +7429,14 @@ var Z = {
|
|
|
7356
7429
|
this._endBatch();
|
|
7357
7430
|
}
|
|
7358
7431
|
}
|
|
7359
|
-
_background = new
|
|
7432
|
+
_background = new _i(this);
|
|
7360
7433
|
get background() {
|
|
7361
7434
|
return this._background;
|
|
7362
7435
|
}
|
|
7363
7436
|
set background(e) {
|
|
7364
7437
|
this._background.resetProperties().setProperties(e);
|
|
7365
7438
|
}
|
|
7366
|
-
_shape = new
|
|
7439
|
+
_shape = new Ni(this);
|
|
7367
7440
|
get shape() {
|
|
7368
7441
|
return this._shape;
|
|
7369
7442
|
}
|
|
@@ -7377,14 +7450,14 @@ var Z = {
|
|
|
7377
7450
|
set fill(e) {
|
|
7378
7451
|
this._fill.resetProperties().setProperties(e);
|
|
7379
7452
|
}
|
|
7380
|
-
_outline = new
|
|
7453
|
+
_outline = new ji(this);
|
|
7381
7454
|
get outline() {
|
|
7382
7455
|
return this._outline;
|
|
7383
7456
|
}
|
|
7384
7457
|
set outline(e) {
|
|
7385
7458
|
this._outline.resetProperties().setProperties(e);
|
|
7386
7459
|
}
|
|
7387
|
-
_foreground = new
|
|
7460
|
+
_foreground = new ki(this);
|
|
7388
7461
|
get foreground() {
|
|
7389
7462
|
return this._foreground;
|
|
7390
7463
|
}
|
|
@@ -7398,21 +7471,21 @@ var Z = {
|
|
|
7398
7471
|
set text(e) {
|
|
7399
7472
|
this._text.resetProperties().setProperties(e);
|
|
7400
7473
|
}
|
|
7401
|
-
_shadow = new
|
|
7474
|
+
_shadow = new Mi(this);
|
|
7402
7475
|
get shadow() {
|
|
7403
7476
|
return this._shadow;
|
|
7404
7477
|
}
|
|
7405
7478
|
set shadow(e) {
|
|
7406
7479
|
this._shadow.resetProperties().setProperties(e);
|
|
7407
7480
|
}
|
|
7408
|
-
_connection = new
|
|
7481
|
+
_connection = new xi(this);
|
|
7409
7482
|
get connection() {
|
|
7410
7483
|
return this._connection;
|
|
7411
7484
|
}
|
|
7412
7485
|
set connection(e) {
|
|
7413
7486
|
this._connection.resetProperties().setProperties(e);
|
|
7414
7487
|
}
|
|
7415
|
-
_table = new
|
|
7488
|
+
_table = new Ri(this);
|
|
7416
7489
|
get table() {
|
|
7417
7490
|
return this._table;
|
|
7418
7491
|
}
|
|
@@ -7441,8 +7514,8 @@ var Z = {
|
|
|
7441
7514
|
if (e) {
|
|
7442
7515
|
this._beginBatch();
|
|
7443
7516
|
try {
|
|
7444
|
-
let { style: t, text: n, shape: r, background: i, fill: a, outline: o, foreground: s, shadow: c, connection: l, table: u, chart: d,
|
|
7445
|
-
t && this.style.setProperties(t), i && this.background.setProperties(i), r && this.shape.setProperties(r), a && this.fill.setProperties(a), o && this.outline.setProperties(o), n && this.text.setProperties(n), s && this.foreground.setProperties(s), c && this.shadow.setProperties(c), l && this.connection.setProperties(l), u && this.table.setProperties(u), d && this.chart.setProperties(d), super.setProperties(
|
|
7517
|
+
let { style: t, text: n, shape: r, background: i, fill: a, outline: o, foreground: s, shadow: c, connection: l, table: u, chart: d, filter: f, ...p } = e;
|
|
7518
|
+
t && this.style.setProperties(t), i && this.background.setProperties(i), r && this.shape.setProperties(r), a && this.fill.setProperties(a), o && this.outline.setProperties(o), n && this.text.setProperties(n), s && this.foreground.setProperties(s), c && this.shadow.setProperties(c), l && this.connection.setProperties(l), u && this.table.setProperties(u), d && this.chart.setProperties(d), this._updateElementFilter(f), super.setProperties(p);
|
|
7446
7519
|
} finally {
|
|
7447
7520
|
this._endBatch();
|
|
7448
7521
|
}
|
|
@@ -7504,7 +7577,7 @@ var Z = {
|
|
|
7504
7577
|
this._updateGlobalDisplay();
|
|
7505
7578
|
break;
|
|
7506
7579
|
case "rotate":
|
|
7507
|
-
this.rotation = (t || 0) *
|
|
7580
|
+
this.rotation = (t || 0) * yt, this.updateGlobalTransform();
|
|
7508
7581
|
break;
|
|
7509
7582
|
case "scaleX":
|
|
7510
7583
|
this.scale.x = t, this.text.isValid() && (t ^ n) < 0 && this.requestDraw();
|
|
@@ -7525,7 +7598,7 @@ var Z = {
|
|
|
7525
7598
|
}), this.extraTransform.translate(this.pivot.x, this.pivot.y), this.updateGlobalTransform();
|
|
7526
7599
|
break;
|
|
7527
7600
|
case "transformOrigin": {
|
|
7528
|
-
let e =
|
|
7601
|
+
let e = Fr(t ?? "");
|
|
7529
7602
|
this.pivot.set(e[0] * this.size.width, e[1] * this.size.height);
|
|
7530
7603
|
break;
|
|
7531
7604
|
}
|
|
@@ -7569,7 +7642,7 @@ var Z = {
|
|
|
7569
7642
|
this.requestDraw();
|
|
7570
7643
|
break;
|
|
7571
7644
|
}
|
|
7572
|
-
if ((
|
|
7645
|
+
if ((Xi.has(e) || Yi.has(e)) && this.text.isValid() && (this._batchDepth > 0 ? this._pendingTextUpdate = !0 : this.text.update()), this.globalDisplay === "flex") this.flexbox.updateStyleProperty(e, t);
|
|
7573
7646
|
else switch (e) {
|
|
7574
7647
|
case "left":
|
|
7575
7648
|
this.position.x = Number(t);
|
|
@@ -7609,21 +7682,31 @@ var Z = {
|
|
|
7609
7682
|
}
|
|
7610
7683
|
_intersectsViewport(e) {
|
|
7611
7684
|
let t = e.canvasTransform, n = e.width, r = e.height, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
7612
|
-
for (let [e, c] of
|
|
7685
|
+
for (let [e, c] of Qi) t.applyAffineInverse({
|
|
7613
7686
|
x: e * n,
|
|
7614
7687
|
y: c * r
|
|
7615
|
-
},
|
|
7688
|
+
}, Zi), i = Math.min(i, Zi.x), a = Math.max(a, Zi.x), o = Math.min(o, Zi.y), s = Math.max(s, Zi.y);
|
|
7616
7689
|
let c = a - i, l = s - o, { min: u, size: d } = this.globalAabb;
|
|
7617
7690
|
return !(u.x > a + c || u.x + d.x < i - c || u.y > s + l || u.y + d.y < o - l);
|
|
7618
7691
|
}
|
|
7692
|
+
_styleFilter;
|
|
7693
|
+
_elementFilter;
|
|
7619
7694
|
_updateStyleFilter(e) {
|
|
7620
|
-
d(e) ?
|
|
7695
|
+
this._styleFilter = d(e) ? void 0 : e, this._applyColorFilter();
|
|
7696
|
+
}
|
|
7697
|
+
_updateElementFilter(e) {
|
|
7698
|
+
let t = e ? se(e) : "";
|
|
7699
|
+
this._elementFilter = t || void 0, this._applyColorFilter();
|
|
7700
|
+
}
|
|
7701
|
+
_applyColorFilter() {
|
|
7702
|
+
let e = [this._styleFilter, this._elementFilter].filter(Boolean).join(" ").trim();
|
|
7703
|
+
e ? (this._colorFilterEffect || (this._colorFilterEffect = new Rr({
|
|
7621
7704
|
name: "styleFilter",
|
|
7622
7705
|
internalMode: "front"
|
|
7623
|
-
}), this.append(this._colorFilterEffect)), this._colorFilterEffect.filter = e);
|
|
7706
|
+
}), this.append(this._colorFilterEffect)), this._colorFilterEffect.filter = e) : (this._colorFilterEffect?.remove(), this._colorFilterEffect = void 0, this.requestRender());
|
|
7624
7707
|
}
|
|
7625
7708
|
_updateStyleMaskImage(e) {
|
|
7626
|
-
d(e) ? (this._maskEffect?.remove(), this._maskEffect = void 0, this.requestRender()) : (this._maskEffect || (this._maskEffect = new
|
|
7709
|
+
d(e) ? (this._maskEffect?.remove(), this._maskEffect = void 0, this.requestRender()) : (this._maskEffect || (this._maskEffect = new li({
|
|
7627
7710
|
name: "styleMaskImage",
|
|
7628
7711
|
internalMode: "back"
|
|
7629
7712
|
}), this.append(this._maskEffect)), this._maskEffect.image = e);
|
|
@@ -7654,11 +7737,11 @@ var Z = {
|
|
|
7654
7737
|
}
|
|
7655
7738
|
getObb() {
|
|
7656
7739
|
let e = this.pivot, t = this.transform.apply(e).sub(e);
|
|
7657
|
-
return new
|
|
7740
|
+
return new Ct(this._getPointArray().map((e) => (e.x += t.x, e.y += t.y, e)), this.rotation);
|
|
7658
7741
|
}
|
|
7659
7742
|
getGlobalObb() {
|
|
7660
7743
|
let e = this.pivot, t = this.globalTransform.apply(e).sub(e);
|
|
7661
|
-
return new
|
|
7744
|
+
return new Ct(this._getPointArray().map((e) => (e.x += t.x, e.y += t.y, e)), this.globalRotation);
|
|
7662
7745
|
}
|
|
7663
7746
|
_draw() {
|
|
7664
7747
|
super._draw(), this._background.isValid() && (this._shape.draw(!this._background.fillWithShape), this._background.draw()), this._fill.isValid() && (this._shape.draw(), this._fill.draw()), this._outline.isValid() && (this._shape.draw(), this._outline.draw()), this._foreground.isValid() && (this._shape.draw(!this._foreground.fillWithShape), this._foreground.draw()), this._text.isValid() && this._text.draw(), this._chart.isValid() && this._chart.draw(), this._drawContent();
|
|
@@ -7712,10 +7795,10 @@ var Z = {
|
|
|
7712
7795
|
super._destroy(), this.flexbox.destroy(), this.aabb.destroy(), this.globalAabb.destroy(), this.size.destroy(), this.style.destroy(), this.background.destroy(), this.shape.destroy(), this.fill.destroy(), this.outline.destroy(), this.text.destroy(), this.foreground.destroy(), this.shadow.destroy(), this.connection.destroy(), this._colorFilterEffect = void 0, this._maskEffect = void 0;
|
|
7713
7796
|
}
|
|
7714
7797
|
};
|
|
7715
|
-
|
|
7798
|
+
$i = O([b("Element2D"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], $i);
|
|
7716
7799
|
//#endregion
|
|
7717
7800
|
//#region src/scene/2d/TextureRect2D.ts
|
|
7718
|
-
var
|
|
7801
|
+
var ea = class extends $i {
|
|
7719
7802
|
texture;
|
|
7720
7803
|
constructor(e, t = []) {
|
|
7721
7804
|
super(), this.setProperties(e).append(t);
|
|
@@ -7729,8 +7812,8 @@ var qi = class extends Ki {
|
|
|
7729
7812
|
} });
|
|
7730
7813
|
}
|
|
7731
7814
|
}
|
|
7732
|
-
},
|
|
7733
|
-
texture = new
|
|
7815
|
+
}, ta = class extends ea {
|
|
7816
|
+
texture = new er();
|
|
7734
7817
|
animation;
|
|
7735
7818
|
_lastTime = NaN;
|
|
7736
7819
|
constructor(e, t = []) {
|
|
@@ -7760,10 +7843,10 @@ var qi = class extends Ki {
|
|
|
7760
7843
|
this.currentTime !== this._lastTime && (this._lastTime = this.currentTime, this.animation?.goToAndStop(this.currentTime, !1), this.texture.requestUpdate("source"), this.requestDraw()), super._process(e);
|
|
7761
7844
|
}
|
|
7762
7845
|
};
|
|
7763
|
-
O([_({ fallback: "" }), D("design:type", String)],
|
|
7846
|
+
O([_({ fallback: "" }), D("design:type", String)], ta.prototype, "src", void 0), ta = O([b("Lottie2D"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], ta);
|
|
7764
7847
|
//#endregion
|
|
7765
7848
|
//#region src/scene/2d/TransformRect2D.ts
|
|
7766
|
-
var
|
|
7849
|
+
var na = class extends $i {
|
|
7767
7850
|
constructor(e, t = []) {
|
|
7768
7851
|
super(), this.setProperties(e).append(t);
|
|
7769
7852
|
}
|
|
@@ -7786,10 +7869,10 @@ var Yi = class extends Ki {
|
|
|
7786
7869
|
this.context.rect(0, 0, e, t), this.context.strokeStyle = "#00FF00", this.context.stroke(), this._drawCircle(0, 0), this._drawCircle(e, t), this._drawCircle(0, t), this._drawEllipse(0, t / 2), this._drawCircle(e, 0), this._drawEllipse(e, t / 2);
|
|
7787
7870
|
}
|
|
7788
7871
|
};
|
|
7789
|
-
O([_({ fallback: 6 }), D("design:type", Number)],
|
|
7872
|
+
O([_({ fallback: 6 }), D("design:type", Number)], na.prototype, "handleSize", void 0);
|
|
7790
7873
|
//#endregion
|
|
7791
7874
|
//#region src/scene/2d/Video2D.ts
|
|
7792
|
-
var
|
|
7875
|
+
var ra = class extends ea {
|
|
7793
7876
|
get videoDuration() {
|
|
7794
7877
|
return (this.texture?.duration ?? 0) * 1e3;
|
|
7795
7878
|
}
|
|
@@ -7829,11 +7912,11 @@ var Xi = class extends qi {
|
|
|
7829
7912
|
super._process(e), this._updateVideoCurrentTime();
|
|
7830
7913
|
}
|
|
7831
7914
|
};
|
|
7832
|
-
O([_({ fallback: "" }), D("design:type", String)],
|
|
7915
|
+
O([_({ fallback: "" }), D("design:type", String)], ra.prototype, "src", void 0), ra = O([b("Video2D"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], ra);
|
|
7833
7916
|
//#endregion
|
|
7834
7917
|
//#region src/scene/animation/Animation.ts
|
|
7835
|
-
var
|
|
7836
|
-
function
|
|
7918
|
+
var ia = (e) => e, aa = la(.25, .1, .25, 1), oa = la(.42, 0, 1, 1), sa = la(0, 0, .58, 1), ca = la(.42, 0, .58, 1);
|
|
7919
|
+
function la(e, t, n, r) {
|
|
7837
7920
|
let i = 1e-6, a = 3 * e - 3 * n + 1, o = 3 * n - 6 * e, s = 3 * e, c = 3 * t - 3 * r + 1, l = 3 * r - 6 * t, u = 3 * t, d = (e) => (3 * a * e + 2 * o) * e + s, f = (e) => ((a * e + o) * e + s) * e, p = (e) => ((c * e + l) * e + u) * e;
|
|
7838
7921
|
function m(e) {
|
|
7839
7922
|
let t = e, n, r;
|
|
@@ -7853,13 +7936,13 @@ function na(e, t, n, r) {
|
|
|
7853
7936
|
}
|
|
7854
7937
|
return (e) => p(m(e));
|
|
7855
7938
|
}
|
|
7856
|
-
var
|
|
7857
|
-
linear:
|
|
7858
|
-
ease:
|
|
7859
|
-
easeIn:
|
|
7860
|
-
easeOut:
|
|
7861
|
-
easeInOut:
|
|
7862
|
-
},
|
|
7939
|
+
var ua = {
|
|
7940
|
+
linear: ia,
|
|
7941
|
+
ease: aa,
|
|
7942
|
+
easeIn: oa,
|
|
7943
|
+
easeOut: sa,
|
|
7944
|
+
easeInOut: ca
|
|
7945
|
+
}, da = class extends B {
|
|
7863
7946
|
_keyframes = [];
|
|
7864
7947
|
_isFirstUpdatePosition = !1;
|
|
7865
7948
|
_cachedProps = new t();
|
|
@@ -7894,7 +7977,7 @@ var ra = {
|
|
|
7894
7977
|
e = [this.getParent()].filter(Boolean);
|
|
7895
7978
|
break;
|
|
7896
7979
|
}
|
|
7897
|
-
return e.filter((e) => e instanceof
|
|
7980
|
+
return e.filter((e) => e instanceof $i);
|
|
7898
7981
|
}
|
|
7899
7982
|
_updateKeyframes() {
|
|
7900
7983
|
let e = [], t = this.keyframes;
|
|
@@ -7926,7 +8009,7 @@ var ra = {
|
|
|
7926
8009
|
}
|
|
7927
8010
|
let e = this._getTargets(), t = 1 / e.length, n = this.currentTimeProgress;
|
|
7928
8011
|
e.forEach((e, r) => {
|
|
7929
|
-
let i = t === 1 ? n :
|
|
8012
|
+
let i = t === 1 ? n : xt(Math.max(0, n - t * r) / t, 0, 1), a = this._cachedProps.get(e);
|
|
7930
8013
|
if (!a) return;
|
|
7931
8014
|
let o = this._parseKeyframes(i, a);
|
|
7932
8015
|
o?.length && this._commitStyle(i, e, a, o[0], o[1]);
|
|
@@ -7942,10 +8025,10 @@ var ra = {
|
|
|
7942
8025
|
});
|
|
7943
8026
|
}
|
|
7944
8027
|
_parseEasing(e) {
|
|
7945
|
-
if (!e) return
|
|
7946
|
-
if (e in
|
|
8028
|
+
if (!e) return ua.linear;
|
|
8029
|
+
if (e in ua) return ua[e];
|
|
7947
8030
|
let t = e.replace(/cubic-bezier\((.+)\)/, "$1").split(",").map((e) => Number(e));
|
|
7948
|
-
return
|
|
8031
|
+
return la(t[0], t[1], t[2], t[3]);
|
|
7949
8032
|
}
|
|
7950
8033
|
_parseKeyframes(e, t) {
|
|
7951
8034
|
let n, r = this._keyframes;
|
|
@@ -7981,10 +8064,10 @@ var ra = {
|
|
|
7981
8064
|
}
|
|
7982
8065
|
_getDiffValue(e, t, n, r, i) {
|
|
7983
8066
|
let a, o;
|
|
7984
|
-
if (t === "none" && (t = void 0), n === "none" && (n = void 0), t === void 0 || n === void 0) if (t !== void 0) a =
|
|
7985
|
-
else if (n !== void 0) o =
|
|
8067
|
+
if (t === "none" && (t = void 0), n === "none" && (n = void 0), t === void 0 || n === void 0) if (t !== void 0) a = Oe(e, String(t), i), o = De(a);
|
|
8068
|
+
else if (n !== void 0) o = Oe(e, String(n), i), a = De(o);
|
|
7986
8069
|
else return;
|
|
7987
|
-
else a =
|
|
8070
|
+
else a = Oe(e, String(t), i), o = Oe(e, String(n), i);
|
|
7988
8071
|
if (Array.isArray(a) && Array.isArray(o)) {
|
|
7989
8072
|
let e = /* @__PURE__ */ new Set(), t = {}, n = {};
|
|
7990
8073
|
a.forEach(({ name: n, args: r }) => {
|
|
@@ -8023,14 +8106,14 @@ var ra = {
|
|
|
8023
8106
|
});
|
|
8024
8107
|
}
|
|
8025
8108
|
};
|
|
8026
|
-
O([_({ fallback: "parent" }), D("design:type", Object)],
|
|
8109
|
+
O([_({ fallback: "parent" }), D("design:type", Object)], da.prototype, "effectMode", void 0), O([_({ default: () => [] }), D("design:type", Array)], da.prototype, "keyframes", void 0), O([_(), D("design:type", Object)], da.prototype, "easing", void 0), da = O([b("Animation", {
|
|
8027
8110
|
renderMode: "disabled",
|
|
8028
8111
|
processSortMode: "parent-before",
|
|
8029
8112
|
duration: 2e3
|
|
8030
|
-
}), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])],
|
|
8113
|
+
}), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial, Array])], da);
|
|
8031
8114
|
//#endregion
|
|
8032
8115
|
//#region src/scene/audio/html/HTMLAudioContext.ts
|
|
8033
|
-
var
|
|
8116
|
+
var fa = class t extends e {
|
|
8034
8117
|
static _instance;
|
|
8035
8118
|
static get instance() {
|
|
8036
8119
|
return this._instance ||= new t(), this._instance;
|
|
@@ -8060,7 +8143,7 @@ var aa = class t extends e {
|
|
|
8060
8143
|
togglePause() {
|
|
8061
8144
|
return this.paused = !this.paused, this.refreshPaused(), this.paused;
|
|
8062
8145
|
}
|
|
8063
|
-
},
|
|
8146
|
+
}, pa = class t extends e {
|
|
8064
8147
|
static PADDING = .1;
|
|
8065
8148
|
_source = null;
|
|
8066
8149
|
_audio = null;
|
|
@@ -8173,21 +8256,21 @@ var aa = class t extends e {
|
|
|
8173
8256
|
if (!this._source) return;
|
|
8174
8257
|
let { start: n = 0, end: r = 0 } = e;
|
|
8175
8258
|
r && console.assert(r > n, "End time is before start time"), e.playbackRate !== void 0 && (this._playbackRate = e.playbackRate), e.volume !== void 0 && (this._volume = e.volume), e.loop !== void 0 && (this._loop = e.loop), e.muted !== void 0 && (this._muted = e.muted), this.refresh(), this.loop && r !== null && (console.warn("Looping not support when specifying an \"end\" time"), this.loop = !1), this._start = n, this._end = r || this._duration, this._start = Math.max(0, this._start - t.PADDING), this._end = Math.min(this._end + t.PADDING, this._duration), this._source.onloadedmetadata = () => {
|
|
8176
|
-
this._source && (this._source.currentTime = n, this._source.onloadedmetadata = null, this.emit("progress", n, this._duration),
|
|
8259
|
+
this._source && (this._source.currentTime = n, this._source.onloadedmetadata = null, this.emit("progress", n, this._duration), x.on(this._onUpdate));
|
|
8177
8260
|
}, this._source.onended = this._onComplete.bind(this), this._source.play(), this.emit("start");
|
|
8178
8261
|
}
|
|
8179
8262
|
_onUpdate = () => {
|
|
8180
8263
|
this._source && (this.emit("progress", this.progress, this._duration), this._source.currentTime >= this._end && !this._source.loop && this._onComplete());
|
|
8181
8264
|
};
|
|
8182
8265
|
_onComplete() {
|
|
8183
|
-
|
|
8266
|
+
x.off(this._onUpdate), this._stop(), this.emit("progress", 1, this._duration), this.emit("end", this);
|
|
8184
8267
|
}
|
|
8185
8268
|
destroy() {
|
|
8186
|
-
|
|
8269
|
+
x.off(this._onUpdate), super.destroy();
|
|
8187
8270
|
let e = this._source;
|
|
8188
8271
|
e && (e.onended = null, e.onplay = null, e.onpause = null, this._stop()), this._source = null, this._playbackRate = 1, this._volume = 1, this._loop = !1, this._end = 0, this._start = 0, this._duration = 0, this._playing = !1, this._pausedReal = !1, this._paused = !1, this._muted = !1, this._audio &&= (this._audio.context.off("refresh", this.refresh), this._audio.context.off("refreshPaused", this.refreshPaused), null);
|
|
8189
8272
|
}
|
|
8190
|
-
},
|
|
8273
|
+
}, ma = class {
|
|
8191
8274
|
parent;
|
|
8192
8275
|
source = new globalThis.Audio();
|
|
8193
8276
|
_src = "";
|
|
@@ -8204,7 +8287,7 @@ var aa = class t extends e {
|
|
|
8204
8287
|
return !!this.source && this.source.readyState === 4;
|
|
8205
8288
|
}
|
|
8206
8289
|
get context() {
|
|
8207
|
-
return
|
|
8290
|
+
return fa.instance;
|
|
8208
8291
|
}
|
|
8209
8292
|
constructor(e) {
|
|
8210
8293
|
this.parent = e;
|
|
@@ -8215,9 +8298,9 @@ var aa = class t extends e {
|
|
|
8215
8298
|
});
|
|
8216
8299
|
}
|
|
8217
8300
|
createSound() {
|
|
8218
|
-
return new
|
|
8301
|
+
return new pa();
|
|
8219
8302
|
}
|
|
8220
|
-
},
|
|
8303
|
+
}, ha = class extends e {
|
|
8221
8304
|
_input;
|
|
8222
8305
|
_output;
|
|
8223
8306
|
_processers = [];
|
|
@@ -8239,7 +8322,7 @@ var aa = class t extends e {
|
|
|
8239
8322
|
get destination() {
|
|
8240
8323
|
return this._input;
|
|
8241
8324
|
}
|
|
8242
|
-
},
|
|
8325
|
+
}, ga = class {
|
|
8243
8326
|
destination;
|
|
8244
8327
|
source;
|
|
8245
8328
|
constructor(e, t = null) {
|
|
@@ -8254,21 +8337,21 @@ var aa = class t extends e {
|
|
|
8254
8337
|
};
|
|
8255
8338
|
//#endregion
|
|
8256
8339
|
//#region src/scene/audio/web/WebAudioContext.ts
|
|
8257
|
-
function
|
|
8258
|
-
if (
|
|
8259
|
-
if (
|
|
8340
|
+
function _a() {
|
|
8341
|
+
if (Ve) return new AudioContext();
|
|
8342
|
+
if (He) {
|
|
8260
8343
|
let e = globalThis.webkitAudioContext;
|
|
8261
8344
|
return new e();
|
|
8262
8345
|
} else throw Error("Failed to createAudioContext");
|
|
8263
8346
|
}
|
|
8264
|
-
function
|
|
8265
|
-
if (
|
|
8266
|
-
if (
|
|
8347
|
+
function va(e, t, n) {
|
|
8348
|
+
if (Ue) return new OfflineAudioContext(e, t, n);
|
|
8349
|
+
if (We) {
|
|
8267
8350
|
let r = globalThis.webkitOfflineAudioContext;
|
|
8268
8351
|
return new r(e, t, n);
|
|
8269
8352
|
} else throw Error("Failed to createOfflineAudioContext");
|
|
8270
8353
|
}
|
|
8271
|
-
var
|
|
8354
|
+
var ya = class e extends ha {
|
|
8272
8355
|
static _instance;
|
|
8273
8356
|
static get instance() {
|
|
8274
8357
|
return this._instance ||= new e(), this._instance;
|
|
@@ -8309,8 +8392,8 @@ var fa = class e extends ca {
|
|
|
8309
8392
|
_compressor;
|
|
8310
8393
|
_analyser;
|
|
8311
8394
|
constructor() {
|
|
8312
|
-
let e =
|
|
8313
|
-
r.connect(n), n.connect(e.destination), super(r, n), this._context = e, this._offlineContext = t, this._compressor = n, this._analyser = r, this._locked = e.state === "suspended" && (
|
|
8395
|
+
let e = _a(), t = va(1, 2, Ue ? Math.max(8e3, Math.min(96e3, e.sampleRate)) : 44100), n = e.createDynamicsCompressor(), r = e.createAnalyser();
|
|
8396
|
+
r.connect(n), n.connect(e.destination), super(r, n), this._context = e, this._offlineContext = t, this._compressor = n, this._analyser = r, this._locked = e.state === "suspended" && (Re || ze), Ke && (this._locked && (this._unlock(), document.addEventListener("mousedown", this._unlock, !0), document.addEventListener("touchstart", this._unlock, !0), document.addEventListener("touchend", this._unlock, !0)), globalThis.addEventListener("focus", this._onFocus), globalThis.addEventListener("blur", this._onBlur));
|
|
8314
8397
|
}
|
|
8315
8398
|
_onFocus() {
|
|
8316
8399
|
if (!this.autoPause) return;
|
|
@@ -8350,7 +8433,7 @@ var fa = class e extends ca {
|
|
|
8350
8433
|
setParamValue(e, t) {
|
|
8351
8434
|
e.setValueAtTime ? e.setValueAtTime(t, this._context.currentTime) : e.value = t;
|
|
8352
8435
|
}
|
|
8353
|
-
},
|
|
8436
|
+
}, ba = class extends e {
|
|
8354
8437
|
_audio = null;
|
|
8355
8438
|
_sourceNode = null;
|
|
8356
8439
|
_gain = null;
|
|
@@ -8478,12 +8561,12 @@ var fa = class e extends ca {
|
|
|
8478
8561
|
};
|
|
8479
8562
|
_updateListener = () => this._update();
|
|
8480
8563
|
_enableTicker(e) {
|
|
8481
|
-
|
|
8564
|
+
x.off(this._updateListener), e && x.on(this._updateListener);
|
|
8482
8565
|
}
|
|
8483
8566
|
destroy() {
|
|
8484
8567
|
super.destroy(), this._stop(), this._gain?.disconnect(), this._gain = null, this._audio?.context.off("refresh", this.refresh), this._audio?.context.off("refreshPaused", this.refreshPaused), this._audio = null, this._processors.forEach((e) => e.disconnect()), this._processors.length = 0, this._end = 0, this._playbackRate = 1, this._volume = 1, this._loop = !1, this._elapsed = 0, this._duration = 0, this._paused = !1, this._muted = !1, this._pausedReal = !1;
|
|
8485
8568
|
}
|
|
8486
|
-
},
|
|
8569
|
+
}, xa = class extends ha {
|
|
8487
8570
|
parent;
|
|
8488
8571
|
_sourceBuffer;
|
|
8489
8572
|
_sourceNode;
|
|
@@ -8491,7 +8574,7 @@ var fa = class e extends ca {
|
|
|
8491
8574
|
gain;
|
|
8492
8575
|
analyser;
|
|
8493
8576
|
get context() {
|
|
8494
|
-
return
|
|
8577
|
+
return ya.instance;
|
|
8495
8578
|
}
|
|
8496
8579
|
get isPlayable() {
|
|
8497
8580
|
return !!this._sourceNode.buffer;
|
|
@@ -8506,8 +8589,8 @@ var fa = class e extends ca {
|
|
|
8506
8589
|
this._sourceNode.buffer = e;
|
|
8507
8590
|
}
|
|
8508
8591
|
constructor(e) {
|
|
8509
|
-
let t =
|
|
8510
|
-
n.connect(i), i.connect(r), r.connect(
|
|
8592
|
+
let t = ya.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
|
|
8593
|
+
n.connect(i), i.connect(r), r.connect(ya.instance.destination), super(i, r), this.parent = e, this._sourceNode = n, this.gain = r, this.analyser = i;
|
|
8511
8594
|
}
|
|
8512
8595
|
async load() {
|
|
8513
8596
|
return this._sourceLoad ||= new Promise((e) => {
|
|
@@ -8520,7 +8603,7 @@ var fa = class e extends ca {
|
|
|
8520
8603
|
});
|
|
8521
8604
|
}
|
|
8522
8605
|
_decode(e) {
|
|
8523
|
-
return Promise.resolve(e instanceof AudioBuffer ? e :
|
|
8606
|
+
return Promise.resolve(e instanceof AudioBuffer ? e : ya.decode(e)).then((e) => (this.parent.isLoaded = !0, this.buffer = e, e));
|
|
8524
8607
|
}
|
|
8525
8608
|
cloneSource() {
|
|
8526
8609
|
let e = this.context, t = this._sourceNode, n = e.audioContext.createBufferSource(), r = e.audioContext.createGain();
|
|
@@ -8530,15 +8613,15 @@ var fa = class e extends ca {
|
|
|
8530
8613
|
};
|
|
8531
8614
|
}
|
|
8532
8615
|
createSound() {
|
|
8533
|
-
return new
|
|
8616
|
+
return new ba();
|
|
8534
8617
|
}
|
|
8535
|
-
},
|
|
8618
|
+
}, Sa, Ca = class extends B {
|
|
8536
8619
|
static {
|
|
8537
|
-
|
|
8620
|
+
Sa = this;
|
|
8538
8621
|
}
|
|
8539
8622
|
static _soundPool = [];
|
|
8540
8623
|
_sounds = [];
|
|
8541
|
-
_platformAudio =
|
|
8624
|
+
_platformAudio = Ge ? new xa(this) : new ma(this);
|
|
8542
8625
|
get platformAudio() {
|
|
8543
8626
|
return this._platformAudio;
|
|
8544
8627
|
}
|
|
@@ -8631,7 +8714,7 @@ var fa = class e extends ca {
|
|
|
8631
8714
|
this._sounds.length = 0;
|
|
8632
8715
|
}
|
|
8633
8716
|
_createSound() {
|
|
8634
|
-
return
|
|
8717
|
+
return Sa._soundPool.length > 0 ? Sa._soundPool.pop().init(this._platformAudio) : this._platformAudio.createSound().init(this._platformAudio);
|
|
8635
8718
|
}
|
|
8636
8719
|
refresh() {
|
|
8637
8720
|
for (let e = this._sounds.length, t = 0; t < e; t++) this._sounds[t].refresh();
|
|
@@ -8647,7 +8730,7 @@ var fa = class e extends ca {
|
|
|
8647
8730
|
this._recycleSound(e);
|
|
8648
8731
|
};
|
|
8649
8732
|
_recycleSound(e) {
|
|
8650
|
-
e.destroy(),
|
|
8733
|
+
e.destroy(), Sa._soundPool.includes(e) || Sa._soundPool.push(e);
|
|
8651
8734
|
}
|
|
8652
8735
|
_prevTime = 0;
|
|
8653
8736
|
_timer = 0;
|
|
@@ -8663,13 +8746,13 @@ var fa = class e extends ca {
|
|
|
8663
8746
|
}, 100);
|
|
8664
8747
|
}
|
|
8665
8748
|
};
|
|
8666
|
-
|
|
8749
|
+
Ca = Sa = O([b("Audio"), D("design:paramtypes", [Object])], Ca);
|
|
8667
8750
|
//#endregion
|
|
8668
8751
|
//#region src/scene/audio/AudioSpectrum.ts
|
|
8669
|
-
var
|
|
8752
|
+
var wa = class extends wr {}, Ta = class extends $i {
|
|
8670
8753
|
_audioBuffer;
|
|
8671
8754
|
_src = (() => {
|
|
8672
|
-
let e =
|
|
8755
|
+
let e = S();
|
|
8673
8756
|
return e ? new R({ source: e }) : void 0;
|
|
8674
8757
|
})();
|
|
8675
8758
|
_needsUpdateTexture = !1;
|
|
@@ -8690,7 +8773,7 @@ var _a = class extends Cr {}, va = class extends Ki {
|
|
|
8690
8773
|
}
|
|
8691
8774
|
}
|
|
8692
8775
|
async _loadSrc(e) {
|
|
8693
|
-
await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) =>
|
|
8776
|
+
await globalThis.fetch(e).then((e) => e.arrayBuffer()).then((e) => ya.decode(e)).then((e) => {
|
|
8694
8777
|
this._audioBuffer = e, this.syncTexture(!0);
|
|
8695
8778
|
});
|
|
8696
8779
|
}
|
|
@@ -8725,12 +8808,12 @@ var _a = class extends Cr {}, va = class extends Ki {
|
|
|
8725
8808
|
this.syncTexture(), super._process(e);
|
|
8726
8809
|
}
|
|
8727
8810
|
};
|
|
8728
|
-
O([_(), D("design:type", Object)],
|
|
8811
|
+
O([_(), D("design:type", Object)], Ta.prototype, "src", void 0), O([_({ fallback: 0 }), D("design:type", Number)], Ta.prototype, "gap", void 0), O([_({ fallback: "#000000" }), D("design:type", String)], Ta.prototype, "color", void 0), Ta = O([b("AudioWaveform"), D("design:paramtypes", [typeof Partial > "u" ? Object : Partial])], Ta);
|
|
8729
8812
|
//#endregion
|
|
8730
8813
|
//#region src/scene/transitions/KawaseTransition.ts
|
|
8731
|
-
var
|
|
8814
|
+
var Ea, Da = class extends Cr {
|
|
8732
8815
|
static {
|
|
8733
|
-
|
|
8816
|
+
Ea = this;
|
|
8734
8817
|
}
|
|
8735
8818
|
blur = 10;
|
|
8736
8819
|
quality = 10;
|
|
@@ -8749,7 +8832,7 @@ var ya, ba = class extends Sr {
|
|
|
8749
8832
|
let d = 1 / s, f = 1 / c, p = [], m, h = o - 1;
|
|
8750
8833
|
for (let e = 0; e < h; e++) m = u[e] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p });
|
|
8751
8834
|
m = u[h] + .5, p[0] = m * d, p[1] = m * f, l.push({ offset: p }), l.forEach((t) => {
|
|
8752
|
-
I.draw(e,
|
|
8835
|
+
I.draw(e, Ea.material, {
|
|
8753
8836
|
sampler: r,
|
|
8754
8837
|
progress: i,
|
|
8755
8838
|
...t
|
|
@@ -8757,31 +8840,31 @@ var ya, ba = class extends Sr {
|
|
|
8757
8840
|
});
|
|
8758
8841
|
}
|
|
8759
8842
|
};
|
|
8760
|
-
|
|
8843
|
+
Da = Ea = O([b("KawaseTransition")], Da);
|
|
8761
8844
|
//#endregion
|
|
8762
8845
|
//#region src/scene/transitions/LeftEraseTransition.ts
|
|
8763
|
-
var
|
|
8846
|
+
var Oa, ka = class extends Cr {
|
|
8764
8847
|
static {
|
|
8765
|
-
|
|
8848
|
+
Oa = this;
|
|
8766
8849
|
}
|
|
8767
8850
|
static material = new F({ gl: {
|
|
8768
8851
|
vertex: "attribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n vUv = uv;\n}",
|
|
8769
8852
|
fragment: "precision highp float;\nvarying vec2 vUv;\nuniform float progress;\nuniform sampler2D previous;\nuniform sampler2D next;\n\nfloat easeInOutQuint(float t) {\n return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;\n}\n\nvoid main() {\n vec4 src1Color = texture2D(previous, vUv);\n vec4 src2Color = texture2D(next, vUv);\n float mProgress = 1.0 - progress;\n float mixPercent = 0.0;\n if (vUv.x <= mProgress) {\n mixPercent = 1.0;\n }\n gl_FragColor = mix(src2Color, src1Color, mixPercent);\n}"
|
|
8770
8853
|
} });
|
|
8771
8854
|
apply(e) {
|
|
8772
|
-
I.draw(e,
|
|
8855
|
+
I.draw(e, Oa.material, {
|
|
8773
8856
|
previous: 0,
|
|
8774
8857
|
next: 1,
|
|
8775
8858
|
progress: this.currentTimeProgress
|
|
8776
8859
|
});
|
|
8777
8860
|
}
|
|
8778
8861
|
};
|
|
8779
|
-
|
|
8862
|
+
ka = Oa = O([b("LeftEraseTransition")], ka);
|
|
8780
8863
|
//#endregion
|
|
8781
8864
|
//#region src/scene/transitions/TiltShiftTransition.ts
|
|
8782
|
-
var
|
|
8865
|
+
var Aa, ja = class extends Cr {
|
|
8783
8866
|
static {
|
|
8784
|
-
|
|
8867
|
+
Aa = this;
|
|
8785
8868
|
}
|
|
8786
8869
|
blur = 100;
|
|
8787
8870
|
gradientBlur = 600;
|
|
@@ -8793,7 +8876,7 @@ var Ca, wa = class extends Sr {
|
|
|
8793
8876
|
let n = this.currentTimeProgress, r, i;
|
|
8794
8877
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
8795
8878
|
let a = t.width, o = t.height, s = [0, o / 2], c = [600, o / 2], l = [a, o], u = c[0] - s[0], d = c[1] - s[1], f = Math.sqrt(u * u + d * d);
|
|
8796
|
-
I.draw(e,
|
|
8879
|
+
I.draw(e, Aa.material, {
|
|
8797
8880
|
sampler: r,
|
|
8798
8881
|
progress: i,
|
|
8799
8882
|
blur: this.blur,
|
|
@@ -8802,7 +8885,7 @@ var Ca, wa = class extends Sr {
|
|
|
8802
8885
|
end: c,
|
|
8803
8886
|
delta: [u / f, d / f],
|
|
8804
8887
|
texSize: l
|
|
8805
|
-
}), I.draw(e,
|
|
8888
|
+
}), I.draw(e, Aa.material, {
|
|
8806
8889
|
sampler: r,
|
|
8807
8890
|
progress: i,
|
|
8808
8891
|
blur: this.blur,
|
|
@@ -8814,12 +8897,12 @@ var Ca, wa = class extends Sr {
|
|
|
8814
8897
|
});
|
|
8815
8898
|
}
|
|
8816
8899
|
};
|
|
8817
|
-
|
|
8900
|
+
ja = Aa = O([b("TiltShiftTransition")], ja);
|
|
8818
8901
|
//#endregion
|
|
8819
8902
|
//#region src/scene/transitions/TwistTransition.ts
|
|
8820
|
-
var
|
|
8903
|
+
var Ma, Na = class extends Cr {
|
|
8821
8904
|
static {
|
|
8822
|
-
|
|
8905
|
+
Ma = this;
|
|
8823
8906
|
}
|
|
8824
8907
|
radius;
|
|
8825
8908
|
angle = 4;
|
|
@@ -8833,7 +8916,7 @@ var Ta, Ea = class extends Sr {
|
|
|
8833
8916
|
let n = this.currentTimeProgress, r, i;
|
|
8834
8917
|
n < .5 ? (r = 0, i = (.5 - n) / .5) : (r = 1, i = (n - .5) / .5);
|
|
8835
8918
|
let a = t.width, o = t.height;
|
|
8836
|
-
I.draw(e,
|
|
8919
|
+
I.draw(e, Ma.material, {
|
|
8837
8920
|
sampler: r,
|
|
8838
8921
|
progress: i,
|
|
8839
8922
|
filterArea: [
|
|
@@ -8849,16 +8932,16 @@ var Ta, Ea = class extends Sr {
|
|
|
8849
8932
|
});
|
|
8850
8933
|
}
|
|
8851
8934
|
};
|
|
8852
|
-
|
|
8935
|
+
Na = Ma = O([b("TwistTransition")], Na);
|
|
8853
8936
|
//#endregion
|
|
8854
8937
|
//#region src/asset/loaders/GifLoader.ts
|
|
8855
|
-
var
|
|
8938
|
+
var Pa = class extends Vn {
|
|
8856
8939
|
install(e) {
|
|
8857
8940
|
let t = async (t) => {
|
|
8858
8941
|
let { decodeFrames: n } = await import("modern-gif");
|
|
8859
|
-
return await t.arrayBuffer().then((t) => n(t, e.gifWorkerUrl ? { workerUrl: e.gifWorkerUrl } : void 0)).then((e) => new
|
|
8942
|
+
return await t.arrayBuffer().then((t) => n(t, e.gifWorkerUrl ? { workerUrl: e.gifWorkerUrl } : void 0)).then((e) => new $n(e.map((e) => ({
|
|
8860
8943
|
duration: e.delay,
|
|
8861
|
-
texture: new
|
|
8944
|
+
texture: new rr({
|
|
8862
8945
|
source: e.data,
|
|
8863
8946
|
width: e.width,
|
|
8864
8947
|
height: e.height
|
|
@@ -8869,14 +8952,14 @@ var Da = class extends Bn {
|
|
|
8869
8952
|
e.register(n, t);
|
|
8870
8953
|
}), e.gif = this, this;
|
|
8871
8954
|
}
|
|
8872
|
-
},
|
|
8955
|
+
}, Fa = class extends Vn {
|
|
8873
8956
|
install(e) {
|
|
8874
8957
|
let t = async (e) => JSON.parse(await e.text());
|
|
8875
8958
|
return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), ["application/json"].forEach((n) => {
|
|
8876
8959
|
e.register(n, t);
|
|
8877
8960
|
}), e.json = this, this;
|
|
8878
8961
|
}
|
|
8879
|
-
},
|
|
8962
|
+
}, Ia = class extends Vn {
|
|
8880
8963
|
install(e) {
|
|
8881
8964
|
return this.load = async (t, n) => (await import("lottie-web").then((e) => e.default)).loadAnimation({
|
|
8882
8965
|
container: null,
|
|
@@ -8887,12 +8970,12 @@ var Da = class extends Bn {
|
|
|
8887
8970
|
animationData: await e.loadBy(t, () => e.fetch(t).then((e) => e.json()))
|
|
8888
8971
|
}), e.lottie = this, this;
|
|
8889
8972
|
}
|
|
8890
|
-
},
|
|
8973
|
+
}, La = class extends Vn {
|
|
8891
8974
|
install(e) {
|
|
8892
8975
|
let t = async (e) => e.text();
|
|
8893
8976
|
return this.load = (n) => typeof n == "string" ? e.loadBy(n).then(t) : t(n), e.text = this, this;
|
|
8894
8977
|
}
|
|
8895
|
-
},
|
|
8978
|
+
}, Ra = class extends Vn {
|
|
8896
8979
|
install(e) {
|
|
8897
8980
|
let t = (t) => e.fetchImageBitmap(t, { premultiplyAlpha: "premultiply" }).then((e) => new R({
|
|
8898
8981
|
source: e,
|
|
@@ -8916,11 +8999,11 @@ var Da = class extends Bn {
|
|
|
8916
8999
|
e.register(n, t);
|
|
8917
9000
|
}), e.texture = this, this;
|
|
8918
9001
|
}
|
|
8919
|
-
},
|
|
9002
|
+
}, za = class extends Vn {
|
|
8920
9003
|
install(e) {
|
|
8921
|
-
return this.load = (t) => e.awaitBy(() => new
|
|
9004
|
+
return this.load = (t) => e.awaitBy(() => new ar(t).load()), e.video = this, this;
|
|
8922
9005
|
}
|
|
8923
|
-
},
|
|
9006
|
+
}, Ba = Object.entries({
|
|
8924
9007
|
"font/woff": ["woff"],
|
|
8925
9008
|
"font/ttf": ["ttf"],
|
|
8926
9009
|
"font/otf": ["otf"],
|
|
@@ -8936,31 +9019,31 @@ var Da = class extends Bn {
|
|
|
8936
9019
|
"image/webp": ["webp"],
|
|
8937
9020
|
"application/json": ["json"]
|
|
8938
9021
|
});
|
|
8939
|
-
function
|
|
8940
|
-
for (let [t, n] of
|
|
9022
|
+
function Va(e) {
|
|
9023
|
+
for (let [t, n] of Ba) if (n.includes(e)) return t;
|
|
8941
9024
|
}
|
|
8942
|
-
function
|
|
9025
|
+
function Ha(e) {
|
|
8943
9026
|
let t;
|
|
8944
9027
|
if (e.startsWith("data:")) t = e.match(/^data:(.+?);/)?.[1];
|
|
8945
9028
|
else if (e.startsWith("http")) {
|
|
8946
9029
|
let n = e.split(/[#?]/)[0].split(".").pop()?.trim();
|
|
8947
|
-
n && (t =
|
|
9030
|
+
n && (t = Va(n));
|
|
8948
9031
|
}
|
|
8949
9032
|
return t;
|
|
8950
9033
|
}
|
|
8951
9034
|
//#endregion
|
|
8952
9035
|
//#region src/asset/Assets.ts
|
|
8953
|
-
var
|
|
9036
|
+
var Ua = "WeakRef" in globalThis, Wa = class extends e {
|
|
8954
9037
|
defaultHandler = (e) => e;
|
|
8955
9038
|
_handlers = /* @__PURE__ */ new Map();
|
|
8956
9039
|
_handleing = /* @__PURE__ */ new Map();
|
|
8957
9040
|
_handled = /* @__PURE__ */ new Map();
|
|
8958
|
-
_gc =
|
|
9041
|
+
_gc = Ua ? new FinalizationRegistry((e) => {
|
|
8959
9042
|
let t = this.get(e);
|
|
8960
9043
|
t && "destroy" in t && t.destroy(), this._handled.delete(e);
|
|
8961
9044
|
}) : void 0;
|
|
8962
9045
|
constructor() {
|
|
8963
|
-
super(),
|
|
9046
|
+
super(), Ua || x.on(this.gc.bind(this), { sort: 2 });
|
|
8964
9047
|
}
|
|
8965
9048
|
use(e) {
|
|
8966
9049
|
return e.install(this), this;
|
|
@@ -9000,7 +9083,7 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9000
9083
|
}).then((e) => {
|
|
9001
9084
|
if (e.complete && e.naturalWidth && e.naturalHeight) return createImageBitmap(e, t);
|
|
9002
9085
|
{
|
|
9003
|
-
let e =
|
|
9086
|
+
let e = S(1, 1);
|
|
9004
9087
|
if (!e) throw Error("createImageBitmap fallback requires a canvas; call setCanvasFactory() in non-browser environments.");
|
|
9005
9088
|
return createImageBitmap(e);
|
|
9006
9089
|
}
|
|
@@ -9009,11 +9092,11 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9009
9092
|
}
|
|
9010
9093
|
get(e) {
|
|
9011
9094
|
let t = this._handled.get(e);
|
|
9012
|
-
return
|
|
9095
|
+
return Ua && t instanceof WeakRef && (t = t.deref(), t || this._handleing.delete(e)), t;
|
|
9013
9096
|
}
|
|
9014
9097
|
set(e, t) {
|
|
9015
9098
|
let n = t;
|
|
9016
|
-
|
|
9099
|
+
Ua && typeof t == "object" && (this._gc.register(t, e), n = new WeakRef(t)), this._handled.set(e, n);
|
|
9017
9100
|
}
|
|
9018
9101
|
async awaitBy(e) {
|
|
9019
9102
|
let t = e(), n = c();
|
|
@@ -9028,7 +9111,7 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9028
9111
|
return this._handleing.set(e, r), r;
|
|
9029
9112
|
}
|
|
9030
9113
|
async load(e, t) {
|
|
9031
|
-
let n = await this.loadBy(e), r =
|
|
9114
|
+
let n = await this.loadBy(e), r = Ha(e);
|
|
9032
9115
|
return r === void 0 && (r = n.type?.split(";")[0] ?? void 0), ((r ? this._handlers.get(r) : void 0) ?? this.defaultHandler)(n, t);
|
|
9033
9116
|
}
|
|
9034
9117
|
async waitUntilLoad() {
|
|
@@ -9042,14 +9125,14 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9042
9125
|
n && "destroy" in n && n.destroy();
|
|
9043
9126
|
}), this._handled.clear();
|
|
9044
9127
|
}
|
|
9045
|
-
}, $ = new
|
|
9128
|
+
}, $ = new Wa().use(new Hn()).use(new Pa()).use(new Fa()).use(new Ia()).use(new La()).use(new Ra()).use(new za()), Ga = {
|
|
9046
9129
|
alpha: !0,
|
|
9047
9130
|
stencil: !0,
|
|
9048
9131
|
antialias: !1,
|
|
9049
9132
|
premultipliedAlpha: !0,
|
|
9050
9133
|
preserveDrawingBuffer: !1,
|
|
9051
9134
|
powerPreference: "default"
|
|
9052
|
-
},
|
|
9135
|
+
}, Ka = class extends Sr {
|
|
9053
9136
|
renderer;
|
|
9054
9137
|
get view() {
|
|
9055
9138
|
return this.renderer.view;
|
|
@@ -9072,7 +9155,7 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9072
9155
|
set pixelRatio(e) {
|
|
9073
9156
|
this.renderer.pixelRatio = e, this.resize(this.width, this.height);
|
|
9074
9157
|
}
|
|
9075
|
-
_resizeObserver =
|
|
9158
|
+
_resizeObserver = Pe ? new ResizeObserver((e) => {
|
|
9076
9159
|
let t = e[0];
|
|
9077
9160
|
if (t.target === this.view) {
|
|
9078
9161
|
let { inlineSize: e, blockSize: n } = Array.isArray(t.contentBoxSize) ? t.contentBoxSize[0] : t.contentBoxSize;
|
|
@@ -9080,14 +9163,14 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9080
9163
|
}
|
|
9081
9164
|
}) : void 0;
|
|
9082
9165
|
constructor(e = {}) {
|
|
9083
|
-
let { view: t, width: n, height: r, pixelRatio: i =
|
|
9084
|
-
super(), this.renderer = new
|
|
9085
|
-
alpha:
|
|
9086
|
-
stencil:
|
|
9087
|
-
antialias:
|
|
9088
|
-
premultipliedAlpha:
|
|
9089
|
-
preserveDrawingBuffer:
|
|
9090
|
-
powerPreference:
|
|
9166
|
+
let { view: t, width: n, height: r, pixelRatio: i = Je, autoResize: a, data: o } = e;
|
|
9167
|
+
super(), this.renderer = new Bn(t, {
|
|
9168
|
+
alpha: Ga.alpha ?? e.alpha,
|
|
9169
|
+
stencil: Ga.stencil ?? e.stencil,
|
|
9170
|
+
antialias: Ga.antialias ?? e.antialias,
|
|
9171
|
+
premultipliedAlpha: Ga.premultipliedAlpha ?? e.premultipliedAlpha,
|
|
9172
|
+
preserveDrawingBuffer: Ga.preserveDrawingBuffer ?? e.preserveDrawingBuffer,
|
|
9173
|
+
powerPreference: Ga.powerPreference ?? e.powerPreference
|
|
9091
9174
|
}), this._setupInput(), this.pixelRatio = i, a ? !t && this.renderer.view && (this.renderer.view.style.width = "100%", this.renderer.view.style.height = "100%") : this.resize(n || this.gl.drawingBufferWidth || this.view?.clientWidth || 200, r || this.gl.drawingBufferHeight || this.view?.clientHeight || 200, !t), this.setProperties(e), o && this.root.append(o);
|
|
9092
9175
|
}
|
|
9093
9176
|
_updateProperty(e, t, n) {
|
|
@@ -9120,7 +9203,7 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9120
9203
|
return this.renderer.resize(e, t, n), this.root.width = e, this.root.height = t, this.render(), this;
|
|
9121
9204
|
}
|
|
9122
9205
|
nextTick() {
|
|
9123
|
-
return
|
|
9206
|
+
return be();
|
|
9124
9207
|
}
|
|
9125
9208
|
async waitUntilLoad() {
|
|
9126
9209
|
await $.waitUntilLoad(), await this.nextTick();
|
|
@@ -9159,9 +9242,9 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9159
9242
|
return new ImageData(this.toPixels(), this.root.width, this.root.height);
|
|
9160
9243
|
}
|
|
9161
9244
|
toCanvas2D(e = this.toImageData()) {
|
|
9162
|
-
let t =
|
|
9245
|
+
let t = S(e.width, e.height), n = t?.getContext("2d");
|
|
9163
9246
|
t && n && (n.fillStyle = "rgba(0, 0, 0, 0)", n.clearRect(0, 0, t.width, t.height), n.putImageData(e, 0, 0));
|
|
9164
|
-
let r =
|
|
9247
|
+
let r = S(e.width, e.height);
|
|
9165
9248
|
if (!r) throw Error("toCanvas2D requires a canvas; call setCanvasFactory() in non-browser environments.");
|
|
9166
9249
|
let i = r.getContext("2d");
|
|
9167
9250
|
return i && t && (i.fillStyle = "rgba(0, 0, 0, 0)", i.clearRect(0, 0, r.width, r.height), i.drawImage(t, 0, 0, t.width, t.height, 0, 0, r.width, r.height)), r;
|
|
@@ -9170,22 +9253,22 @@ var Ia = "WeakRef" in globalThis, La = class extends e {
|
|
|
9170
9253
|
super._destroy(), this._resizeObserver?.disconnect(), this.renderer.destroy();
|
|
9171
9254
|
}
|
|
9172
9255
|
};
|
|
9173
|
-
O([_({ fallback: !1 }), D("design:type", Boolean)],
|
|
9256
|
+
O([_({ fallback: !1 }), D("design:type", Boolean)], Ka.prototype, "autoResize", void 0), O([_({ fallback: !1 }), D("design:type", Boolean)], Ka.prototype, "autoStart", void 0);
|
|
9174
9257
|
//#endregion
|
|
9175
9258
|
//#region src/render.ts
|
|
9176
|
-
var
|
|
9177
|
-
function
|
|
9178
|
-
return
|
|
9259
|
+
var qa, Ja = [], Ya = !1;
|
|
9260
|
+
function Xa() {
|
|
9261
|
+
return qa ??= new Ka({
|
|
9179
9262
|
pixelRatio: 1,
|
|
9180
9263
|
width: 1,
|
|
9181
9264
|
height: 1,
|
|
9182
9265
|
preserveDrawingBuffer: !0
|
|
9183
9266
|
});
|
|
9184
9267
|
}
|
|
9185
|
-
async function
|
|
9186
|
-
if (!
|
|
9187
|
-
for (
|
|
9188
|
-
let t =
|
|
9268
|
+
async function Za(e = 100) {
|
|
9269
|
+
if (!Ya) {
|
|
9270
|
+
for (Ya = !0; Ja.length;) {
|
|
9271
|
+
let t = Ja.shift();
|
|
9189
9272
|
if (t) try {
|
|
9190
9273
|
await t();
|
|
9191
9274
|
} catch (e) {
|
|
@@ -9193,11 +9276,11 @@ async function Wa(e = 100) {
|
|
|
9193
9276
|
}
|
|
9194
9277
|
else await new Promise((t) => setTimeout(t, e));
|
|
9195
9278
|
}
|
|
9196
|
-
|
|
9279
|
+
Ya = !1;
|
|
9197
9280
|
}
|
|
9198
9281
|
}
|
|
9199
|
-
async function
|
|
9200
|
-
let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f =
|
|
9282
|
+
async function Qa(e) {
|
|
9283
|
+
let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f = Xa();
|
|
9201
9284
|
if (f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resize(u, d, !0), f.root.removeChildren(!0), f.root.append(a), await s?.(f), await f.waitAndRender(), o.length) {
|
|
9202
9285
|
let e = o.length, t = o[e - 1];
|
|
9203
9286
|
for (let n = 0; n < e; n++) {
|
|
@@ -9215,15 +9298,15 @@ async function Ga(e) {
|
|
|
9215
9298
|
toCanvas2D: () => f.toCanvas2D(new ImageData(p, u, d))
|
|
9216
9299
|
};
|
|
9217
9300
|
}
|
|
9218
|
-
async function
|
|
9301
|
+
async function $a(e) {
|
|
9219
9302
|
return new Promise((t) => {
|
|
9220
|
-
|
|
9303
|
+
Ja.push(async () => t(await Qa(e).then((e) => e.toCanvas2D()))), Za();
|
|
9221
9304
|
});
|
|
9222
9305
|
}
|
|
9223
|
-
async function
|
|
9306
|
+
async function eo(e) {
|
|
9224
9307
|
return new Promise((t) => {
|
|
9225
|
-
|
|
9308
|
+
Ja.push(async () => t(await Qa(e).then((e) => e.pixels))), Za();
|
|
9226
9309
|
});
|
|
9227
9310
|
}
|
|
9228
9311
|
//#endregion
|
|
9229
|
-
export {
|
|
9312
|
+
export { vt as Aabb2D, $n as AnimatedTexture, da as Animation, Wa as Assets, Ca as Audio, ha as AudioPipeline, ga as AudioProcessor, wa as AudioSpectrum, Ta as AudioWaveform, k as BufferUsage, Tr as Camera2D, sr as CanvasContext, _r as CanvasItem, er as CanvasTexture, T as Color, U as ColorAdjustEffect, Rr as ColorFilterEffect, St as ColorMatrix, Vr as ColorOverlayEffect, Ur as ColorRemoveEffect, Kr as ColorReplaceEffect, tr as ColorTexture, C as CoreObject, yt as DEG_TO_RAD, Je as DEVICE_PIXEL_RATIO, W as DrawboardEffect, $r as DropShadowEffect, H as Effect, Xn as EffectMaterial, $i as Element2D, _i as Element2DBackground, Y as Element2DChart, xi as Element2DConnection, J as Element2DFill, ki as Element2DForeground, ji as Element2DOutline, Mi as Element2DShadow, Ni as Element2DShape, Pi as Element2DStyle, Ri as Element2DTable, X as Element2DText, ti as EmbossEffect, Ka as Engine, Ji as Flexbox, Hn as FontLoader, Zr as GaussianBlurEffect, Wn as Geometry, Pa as GifLoader, ln as GlBatch2DSystem, an as GlBlendMode, Dt as GlBuffer, Pt as GlBufferSystem, Et as GlBufferTarget, pn as GlMaskSystem, Kt as GlProgram, _n as GlRenderTarget, vn as GlRenderTargetSystem, tn as GlShaderSystem, sn as GlState, cn as GlStateSystem, hn as GlStencilSystem, A as GlSystem, gn as GlViewportSystem, G as GlitchEffect, K as GodrayEffect, nr as GradientTexture, ma as HTMLAudio, fa as HTMLAudioContext, pa as HTMLSound, Ke as IN_BROWSER, qe as IN_MAC_OS, Un as IndexBuffer, gt as Input, ut as InputEvent, Fa as JsonLoader, si as KawaseBlurEffect, Da as KawaseTransition, dt as KeyboardInputEvent, ka as LeftEraseTransition, Vn as Loader, ta as Lottie2D, Ia as LottieLoader, Tt as MainLoop, li as MaskEffect, F as Material, lr as Meta, ft as MouseInputEvent, z as Node, wr as Node2D, Ct as Obb2D, q as OutlineEffect, xe as PI, Se as PI_2, pi as PixelateEffect, rr as PixelsTexture, pt as PointerInputEvent, wt as Projection2D, Gn as QuadGeometry, I as QuadUvGeometry, bt as RAD_TO_DEG, _t as RefCounted, L as RenderTarget, Ot as Renderer, w as Resource, Ve as SUPPORTS_AUDIO_CONTEXT, ze as SUPPORTS_CLICK_EVENTS, Be as SUPPORTS_CREATE_IMAGE_BITMAP, Ne as SUPPORTS_IMAGE_BITMAP, Le as SUPPORTS_MOUSE_EVENTS, Ue as SUPPORTS_OFFLINE_AUDIO_CONTEXT, Fe as SUPPORTS_POINTER_EVENTS, Pe as SUPPORTS_RESIZE_OBSERVER, Re as SUPPORTS_TOUCH_EVENTS, Me as SUPPORTS_WEBGL2, He as SUPPORTS_WEBKIT_AUDIO_CONTEXT, We as SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, Ge as SUPPORTS_WEB_AUDIO, Ie as SUPPORTS_WHEEL_EVENTS, Sr as SceneTree, La as TextLoader, R as Texture2D, Ra as TextureLoader, ea as TextureRect2D, x as Ticker, ja as TiltShiftTransition, br as Timeline, B as TimelineNode, na as TransformRect2D, Cr as Transition, Na as TwistTransition, At as UniformGroup, Qn as UvGeometry, Zn as UvMaterial, P as VertexAttribute, N as VertexBuffer, ra as Video2D, za as VideoLoader, ar as VideoTexture, V as Viewport, or as ViewportTexture, xa as WebAudio, ya as WebAudioContext, Bn as WebGLRenderer, ba as WebSound, mt as WheelInputEvent, xr as Window, hi as ZoomBlurEffect, Q as alignMap, $ as assets, Er as axisDir, qi as boxSizingMap, xt as clamp, oi as clampFrag, S as createHTMLCanvas, Nt as createIdFromString, ye as createNode, st as crossOrigin, la as cubicBezier, b as customNode, ve as customNodes, Ga as defaultOptions, ot as determineCrossOrigin, Vi as directionMap, Bi as displayMap, aa as ease, oa as easeIn, ca as easeInOut, sa as easeOut, Z as edgeMap, Hi as flexDirectionMap, Ui as flexWrapMap, ai as frag, nt as getCanvasFactory, De as getDefaultCssPropertyValue, at as getGlContextProvider, Xa as getRenderEngine, zi as gutterMap, lt as instanceId, Qe as isCanvasElement, Ye as isElementNode, Ze as isImageElement, Ce as isPow2, Xe as isVideoElement, $e as isWebgl2, Wi as justifyMap, E as lerp, ia as linear, dn as log2, on as mapGlBlendModes, un as nextPow2, be as nextTick, Gi as overflowMap, Pr as parseCssFilter, ke as parseCssFunctions, Oe as parseCssProperty, Fr as parseCssTransformOrigin, Ki as positionTypeMap, $a as render, eo as renderPixels, hr as resetBatchPool, Dr as routeConnection, tt as setCanvasFactory, it as setGlContextProvider, mn as stencilModeMap, ua as timingFunctions };
|