excalibur 0.32.0-alpha.1569 → 0.32.0-alpha.1571
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/CHANGELOG.md +26 -1
- package/build/dist/Collision/BoundingBox.d.ts +9 -3
- package/build/dist/Debug/DebugConfig.d.ts +14 -1
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.d.ts +13 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.d.ts +2 -1
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +20 -3
- package/build/dist/Graphics/Context/debug-circle-renderer/debug-circle-renderer.d.ts +23 -0
- package/build/dist/Graphics/Context/{line-renderer/line-renderer.d.ts → debug-line-renderer/debug-line-renderer.d.ts} +5 -7
- package/build/dist/Graphics/Context/{point-renderer/point-renderer.d.ts → debug-point-renderer/debug-point-renderer.d.ts} +2 -2
- package/build/dist/Graphics/Context/debug-text.d.ts +5 -1
- package/build/dist/Graphics/Debug.d.ts +5 -5
- package/build/dist/excalibur.development.js +501 -163
- package/build/dist/excalibur.js +501 -163
- package/build/dist/excalibur.min.development.js +158 -47
- package/build/dist/excalibur.min.js +158 -47
- package/build/esm/excalibur.development.js +501 -163
- package/build/esm/excalibur.js +501 -163
- package/build/esm/excalibur.min.development.js +2868 -2609
- package/build/esm/excalibur.min.js +2868 -2609
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! excalibur - 0.32.0-alpha.
|
|
1
|
+
/*! excalibur - 0.32.0-alpha.1571+1b94394 - 2025-11-26
|
|
2
2
|
https://github.com/excaliburjs/Excalibur
|
|
3
3
|
Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
|
|
4
4
|
Licensed BSD-2-Clause
|
|
@@ -6404,13 +6404,22 @@ const _BoundingBox = class _BoundingBox2 {
|
|
|
6404
6404
|
const intersect = this.intersect(bb);
|
|
6405
6405
|
return _BoundingBox2.getSideFromIntersection(intersect);
|
|
6406
6406
|
}
|
|
6407
|
+
/**
|
|
6408
|
+
* Draw a debug bounding box
|
|
6409
|
+
* @param ex
|
|
6410
|
+
* @param color
|
|
6411
|
+
* @deprecated
|
|
6412
|
+
*/
|
|
6413
|
+
draw(ex, options = { color: Color.Yellow }) {
|
|
6414
|
+
ex.debug.drawRect(this.left, this.top, this.width, this.height, options);
|
|
6415
|
+
}
|
|
6407
6416
|
/**
|
|
6408
6417
|
* Draw a debug bounding box
|
|
6409
6418
|
* @param ex
|
|
6410
6419
|
* @param color
|
|
6411
6420
|
*/
|
|
6412
|
-
|
|
6413
|
-
ex.debug.drawRect(this.left, this.top, this.width, this.height,
|
|
6421
|
+
debug(ex, options = { color: Color.Yellow }) {
|
|
6422
|
+
ex.debug.drawRect(this.left, this.top, this.width, this.height, options);
|
|
6414
6423
|
}
|
|
6415
6424
|
};
|
|
6416
6425
|
_BoundingBox._SCRATCH_INTERSECT = [0, 0, 0, 0];
|
|
@@ -6858,9 +6867,9 @@ class DynamicTree {
|
|
|
6858
6867
|
const helper = (currentNode) => {
|
|
6859
6868
|
if (currentNode) {
|
|
6860
6869
|
if (currentNode.isLeaf()) {
|
|
6861
|
-
currentNode.bounds.
|
|
6870
|
+
currentNode.bounds.debug(ex, { color: Color.Green });
|
|
6862
6871
|
} else {
|
|
6863
|
-
currentNode.bounds.
|
|
6872
|
+
currentNode.bounds.debug(ex, { color: Color.White });
|
|
6864
6873
|
}
|
|
6865
6874
|
if (currentNode.left) {
|
|
6866
6875
|
helper(currentNode.left);
|
|
@@ -7794,7 +7803,7 @@ class CircleCollider extends Collider {
|
|
|
7794
7803
|
ex.translate(pos.x, pos.y);
|
|
7795
7804
|
ex.rotate(rotation);
|
|
7796
7805
|
ex.scale(scale.x, scale.y);
|
|
7797
|
-
ex.drawCircle((_d = this.offset) != null ? _d : Vector.Zero, this._naturalRadius, Color.Transparent, color, lineWidth);
|
|
7806
|
+
ex.debug.drawCircle((_d = this.offset) != null ? _d : Vector.Zero, this._naturalRadius, Color.Transparent, color, lineWidth);
|
|
7798
7807
|
ex.restore();
|
|
7799
7808
|
}
|
|
7800
7809
|
}
|
|
@@ -8560,9 +8569,9 @@ class EdgeCollider extends Collider {
|
|
|
8560
8569
|
debug(ex, color) {
|
|
8561
8570
|
const begin = this._getTransformedBegin();
|
|
8562
8571
|
const end = this._getTransformedEnd();
|
|
8563
|
-
ex.drawLine(begin, end, color, 2);
|
|
8564
|
-
ex.drawCircle(begin, 2, color);
|
|
8565
|
-
ex.drawCircle(end, 2, color);
|
|
8572
|
+
ex.debug.drawLine(begin, end, { color, lineWidth: 2 });
|
|
8573
|
+
ex.debug.drawCircle(begin, 2, color);
|
|
8574
|
+
ex.debug.drawCircle(end, 2, color);
|
|
8566
8575
|
}
|
|
8567
8576
|
}
|
|
8568
8577
|
class PolygonCollider extends Collider {
|
|
@@ -11296,11 +11305,118 @@ class SpriteSheet {
|
|
|
11296
11305
|
});
|
|
11297
11306
|
}
|
|
11298
11307
|
}
|
|
11299
|
-
const
|
|
11308
|
+
const debugFont2 = "data:image/png;base64,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";
|
|
11309
|
+
const _Debug = class _Debug2 {
|
|
11310
|
+
static registerDebugConfig(config) {
|
|
11311
|
+
_Debug2.config = config;
|
|
11312
|
+
}
|
|
11313
|
+
static draw(debugDrawCall) {
|
|
11314
|
+
this._drawCalls.push(debugDrawCall);
|
|
11315
|
+
}
|
|
11316
|
+
static drawPoint(point2, options) {
|
|
11317
|
+
_Debug2.draw((ctx) => {
|
|
11318
|
+
ctx.debug.drawPoint(point2, options);
|
|
11319
|
+
});
|
|
11320
|
+
}
|
|
11321
|
+
static drawLine(start, end, options) {
|
|
11322
|
+
_Debug2.draw((ctx) => {
|
|
11323
|
+
ctx.debug.drawLine(start, end, options);
|
|
11324
|
+
});
|
|
11325
|
+
}
|
|
11326
|
+
static drawLines(points, options) {
|
|
11327
|
+
if (points.length > 1) {
|
|
11328
|
+
_Debug2.draw((ctx) => {
|
|
11329
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
11330
|
+
ctx.debug.drawLine(points[i], points[i + 1], options);
|
|
11331
|
+
}
|
|
11332
|
+
});
|
|
11333
|
+
}
|
|
11334
|
+
}
|
|
11335
|
+
static drawText(text, pos) {
|
|
11336
|
+
_Debug2.draw((ctx) => {
|
|
11337
|
+
ctx.debug.drawText(text, pos);
|
|
11338
|
+
});
|
|
11339
|
+
}
|
|
11340
|
+
static drawPolygon(points, options) {
|
|
11341
|
+
if (points.length > 1) {
|
|
11342
|
+
_Debug2.draw((ctx) => {
|
|
11343
|
+
const firstPoint = points[0];
|
|
11344
|
+
const polygon = [...points, firstPoint];
|
|
11345
|
+
for (let i = 0; i < polygon.length - 1; i++) {
|
|
11346
|
+
ctx.debug.drawLine(polygon[i], polygon[i + 1], options);
|
|
11347
|
+
}
|
|
11348
|
+
});
|
|
11349
|
+
}
|
|
11350
|
+
}
|
|
11351
|
+
static drawCircle(center, radius, options) {
|
|
11352
|
+
const { color, strokeColor, width } = {
|
|
11353
|
+
color: Color.Black,
|
|
11354
|
+
strokeColor: void 0,
|
|
11355
|
+
width: void 0,
|
|
11356
|
+
...options
|
|
11357
|
+
};
|
|
11358
|
+
_Debug2.draw((ctx) => {
|
|
11359
|
+
ctx.debug.drawCircle(center, radius, color, strokeColor, width);
|
|
11360
|
+
});
|
|
11361
|
+
}
|
|
11362
|
+
static drawBounds(boundingBox, options) {
|
|
11363
|
+
_Debug2.draw((ctx) => {
|
|
11364
|
+
ctx.debug.drawRect(boundingBox.left, boundingBox.top, boundingBox.width, boundingBox.height, options);
|
|
11365
|
+
});
|
|
11366
|
+
}
|
|
11367
|
+
static drawRay(ray, options) {
|
|
11368
|
+
const { distance, color } = {
|
|
11369
|
+
color: Color.Blue,
|
|
11370
|
+
distance: 10,
|
|
11371
|
+
...options
|
|
11372
|
+
};
|
|
11373
|
+
_Debug2.draw((ctx) => {
|
|
11374
|
+
ctx.z = _Debug2.config.settings.z.ray;
|
|
11375
|
+
const start = ray.pos;
|
|
11376
|
+
const end = ray.pos.add(ray.dir.scale(distance));
|
|
11377
|
+
ctx.debug.drawLine(start, end, { color });
|
|
11378
|
+
});
|
|
11379
|
+
}
|
|
11380
|
+
static flush(ctx) {
|
|
11381
|
+
ctx.save();
|
|
11382
|
+
ctx.z = _Debug2.z;
|
|
11383
|
+
for (const drawCall of _Debug2._drawCalls) {
|
|
11384
|
+
drawCall(ctx);
|
|
11385
|
+
}
|
|
11386
|
+
ctx.restore();
|
|
11387
|
+
_Debug2.clear();
|
|
11388
|
+
}
|
|
11389
|
+
static clear() {
|
|
11390
|
+
_Debug2._drawCalls.length = 0;
|
|
11391
|
+
}
|
|
11392
|
+
};
|
|
11393
|
+
_Debug._drawCalls = [];
|
|
11394
|
+
_Debug.z = Infinity;
|
|
11395
|
+
_Debug.config = {
|
|
11396
|
+
// add some defaults
|
|
11397
|
+
settings: {
|
|
11398
|
+
text: {
|
|
11399
|
+
foreground: Color.Black,
|
|
11400
|
+
background: Color.Transparent,
|
|
11401
|
+
border: Color.Transparent
|
|
11402
|
+
},
|
|
11403
|
+
z: {
|
|
11404
|
+
text: Number.POSITIVE_INFINITY,
|
|
11405
|
+
point: Number.MAX_SAFE_INTEGER - 1,
|
|
11406
|
+
ray: Number.MAX_SAFE_INTEGER - 1,
|
|
11407
|
+
dashed: Number.MAX_SAFE_INTEGER - 2,
|
|
11408
|
+
solid: Number.MAX_SAFE_INTEGER - 3
|
|
11409
|
+
}
|
|
11410
|
+
}
|
|
11411
|
+
};
|
|
11412
|
+
let Debug = _Debug;
|
|
11300
11413
|
class DebugText {
|
|
11301
11414
|
constructor() {
|
|
11302
|
-
this.fontSheet =
|
|
11415
|
+
this.fontSheet = debugFont2;
|
|
11303
11416
|
this.size = 16;
|
|
11417
|
+
this.foregroundColor = Debug.config.settings.text.foreground;
|
|
11418
|
+
this.backgroundColor = Debug.config.settings.text.background;
|
|
11419
|
+
this.borderColor = Debug.config.settings.text.border;
|
|
11304
11420
|
this.load();
|
|
11305
11421
|
}
|
|
11306
11422
|
load() {
|
|
@@ -11309,17 +11425,23 @@ class DebugText {
|
|
|
11309
11425
|
this._spriteSheet = SpriteSheet.fromImageSource({
|
|
11310
11426
|
image: this._imageSource,
|
|
11311
11427
|
grid: {
|
|
11312
|
-
rows:
|
|
11428
|
+
rows: 8,
|
|
11313
11429
|
columns: 16,
|
|
11314
|
-
spriteWidth:
|
|
11315
|
-
|
|
11430
|
+
spriteWidth: 6 * 2 - 2,
|
|
11431
|
+
// hack to avoid sample bleed
|
|
11432
|
+
spriteHeight: 12 * 2
|
|
11433
|
+
},
|
|
11434
|
+
spacing: {
|
|
11435
|
+
// hack to avoid sample bleed
|
|
11436
|
+
originOffset: { x: 2, y: 0 },
|
|
11437
|
+
margin: { x: 2, y: 0 }
|
|
11316
11438
|
}
|
|
11317
11439
|
});
|
|
11318
11440
|
this._spriteFont = new SpriteFont({
|
|
11319
|
-
alphabet:
|
|
11320
|
-
caseInsensitive:
|
|
11441
|
+
alphabet: " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?",
|
|
11442
|
+
caseInsensitive: false,
|
|
11321
11443
|
spriteSheet: this._spriteSheet,
|
|
11322
|
-
spacing:
|
|
11444
|
+
spacing: 2
|
|
11323
11445
|
});
|
|
11324
11446
|
});
|
|
11325
11447
|
}
|
|
@@ -11329,9 +11451,23 @@ class DebugText {
|
|
|
11329
11451
|
* @param text
|
|
11330
11452
|
* @param pos
|
|
11331
11453
|
*/
|
|
11332
|
-
write(ctx, text, pos) {
|
|
11454
|
+
write(ctx, text, pos, foreground, background) {
|
|
11333
11455
|
if (this._imageSource.isLoaded()) {
|
|
11456
|
+
const pos1 = ctx.getTransform().getPosition();
|
|
11457
|
+
ctx.save();
|
|
11458
|
+
ctx.resetTransform();
|
|
11459
|
+
ctx.z = Debug.config.settings.z.text;
|
|
11460
|
+
ctx.translate(pos1.x, pos1.y);
|
|
11461
|
+
const bounds = this._spriteFont.measureText(text);
|
|
11462
|
+
const color = foreground != null ? foreground : this.foregroundColor;
|
|
11463
|
+
const bg = background != null ? background : this.backgroundColor;
|
|
11464
|
+
ctx.save();
|
|
11465
|
+
ctx.z = Debug.config.settings.z.solid;
|
|
11466
|
+
ctx.drawRectangle(pos, bounds.width, bounds.height, bg, this.borderColor, 1);
|
|
11467
|
+
ctx.restore();
|
|
11468
|
+
ctx.tint = color;
|
|
11334
11469
|
this._spriteFont.render(ctx, text, null, pos.x, pos.y);
|
|
11470
|
+
ctx.restore();
|
|
11335
11471
|
}
|
|
11336
11472
|
}
|
|
11337
11473
|
}
|
|
@@ -11495,8 +11631,8 @@ class RenderTarget {
|
|
|
11495
11631
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
11496
11632
|
}
|
|
11497
11633
|
}
|
|
11498
|
-
const lineVertexSource = "#version 300 es\nin vec2 a_position;\nin vec4 a_color;\n\nout lowp vec4 v_color;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n // Set the vertex position using the ortho transform matrix\n gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);\n\n // Passthrough the color\n v_color = a_color;\n}";
|
|
11499
|
-
const lineFragmentSource = "#version 300 es\nprecision mediump float;\n\n// Color\nin lowp vec4 v_color;\n\nout vec4 fragColor;\n\nvoid main() {\n fragColor = v_color;\n}";
|
|
11634
|
+
const lineVertexSource = "#version 300 es\nin vec2 a_position;\nin vec4 a_color;\nin float a_lengthSoFar;\n\nout lowp vec4 v_color;\nout float v_lengthSoFar;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n // Set the vertex position using the ortho transform matrix\n gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);\n\n // Passthrough the color\n v_color = a_color;\n\n // Passthrough the line length so far\n v_lengthSoFar = a_lengthSoFar;\n}\n";
|
|
11635
|
+
const lineFragmentSource = "#version 300 es\nprecision mediump float;\n\n// Color\nin lowp vec4 v_color;\nin float v_lengthSoFar;\n\nout vec4 fragColor;\n\nuniform bool u_dashed;\n\nvoid main() {\n fragColor = v_color;\n if (u_dashed) {\n fragColor.a = smoothstep(0.5, 0.55, fract(v_lengthSoFar / 10.0)); // 10 pixel dashes\n fragColor.rgb *= fragColor.a;\n }\n}\n";
|
|
11500
11636
|
class Line extends Graphic {
|
|
11501
11637
|
constructor(options) {
|
|
11502
11638
|
super();
|
|
@@ -11791,6 +11927,7 @@ class GraphicsSystem extends System {
|
|
|
11791
11927
|
graphic.flipVertical = oldFlipVertical;
|
|
11792
11928
|
}
|
|
11793
11929
|
if (((_b = this._engine) == null ? void 0 : _b.isDebug) && this._engine.debug.graphics.showBounds) {
|
|
11930
|
+
this._graphicsContext.save();
|
|
11794
11931
|
const offset2 = vec(offsetX, offsetY);
|
|
11795
11932
|
if (graphic instanceof GraphicsGroup) {
|
|
11796
11933
|
for (const member of graphic.members) {
|
|
@@ -11803,14 +11940,15 @@ class GraphicsSystem extends System {
|
|
|
11803
11940
|
pos = member.offset;
|
|
11804
11941
|
}
|
|
11805
11942
|
if (graphic.useAnchor) {
|
|
11806
|
-
g == null ? void 0 : g.localBounds.translate(offset2.add(pos)).
|
|
11943
|
+
g == null ? void 0 : g.localBounds.translate(offset2.add(pos)).debug(this._graphicsContext, { color: this._engine.debug.graphics.boundsColor, dashed: true });
|
|
11807
11944
|
} else {
|
|
11808
|
-
g == null ? void 0 : g.localBounds.translate(pos).
|
|
11945
|
+
g == null ? void 0 : g.localBounds.translate(pos).debug(this._graphicsContext, { color: this._engine.debug.graphics.boundsColor, dashed: true });
|
|
11809
11946
|
}
|
|
11810
11947
|
}
|
|
11811
11948
|
} else {
|
|
11812
|
-
graphic == null ? void 0 : graphic.localBounds.translate(offset2).
|
|
11949
|
+
graphic == null ? void 0 : graphic.localBounds.translate(offset2).debug(this._graphicsContext, { color: this._engine.debug.graphics.boundsColor, dashed: true });
|
|
11813
11950
|
}
|
|
11951
|
+
this._graphicsContext.restore();
|
|
11814
11952
|
}
|
|
11815
11953
|
}
|
|
11816
11954
|
}
|
|
@@ -12636,6 +12774,30 @@ class ExcaliburGraphicsContext2DCanvasDebug {
|
|
|
12636
12774
|
this._ex.__ctx.closePath();
|
|
12637
12775
|
this._ex.__ctx.restore();
|
|
12638
12776
|
}
|
|
12777
|
+
drawCircle(pos, radius, color, stroke, thickness) {
|
|
12778
|
+
this._ex.__ctx.save();
|
|
12779
|
+
this._ex.__ctx.beginPath();
|
|
12780
|
+
if (stroke) {
|
|
12781
|
+
this._ex.__ctx.strokeStyle = stroke.toString();
|
|
12782
|
+
}
|
|
12783
|
+
if (thickness) {
|
|
12784
|
+
this._ex.__ctx.lineWidth = thickness;
|
|
12785
|
+
}
|
|
12786
|
+
this._ex.__ctx.fillStyle = color.toString();
|
|
12787
|
+
this._ex.__ctx.arc(
|
|
12788
|
+
this._ex.snapToPixel ? ~~(pos.x + pixelSnapEpsilon$1) : pos.x,
|
|
12789
|
+
this._ex.snapToPixel ? ~~(pos.y + pixelSnapEpsilon$1) : pos.y,
|
|
12790
|
+
radius,
|
|
12791
|
+
0,
|
|
12792
|
+
Math.PI * 2
|
|
12793
|
+
);
|
|
12794
|
+
this._ex.__ctx.fill();
|
|
12795
|
+
if (stroke) {
|
|
12796
|
+
this._ex.__ctx.stroke();
|
|
12797
|
+
}
|
|
12798
|
+
this._ex.__ctx.closePath();
|
|
12799
|
+
this._ex.__ctx.restore();
|
|
12800
|
+
}
|
|
12639
12801
|
drawText(text, pos) {
|
|
12640
12802
|
this._debugText.write(this._ex, text, pos);
|
|
12641
12803
|
}
|
|
@@ -12788,7 +12950,15 @@ class ExcaliburGraphicsContext2DCanvas {
|
|
|
12788
12950
|
this.__ctx.scale(x, y);
|
|
12789
12951
|
}
|
|
12790
12952
|
getTransform() {
|
|
12791
|
-
|
|
12953
|
+
const domMatrix = this.__ctx.getTransform();
|
|
12954
|
+
const affine = new AffineMatrix();
|
|
12955
|
+
affine.data[0] = domMatrix.a;
|
|
12956
|
+
affine.data[1] = domMatrix.b;
|
|
12957
|
+
affine.data[2] = domMatrix.c;
|
|
12958
|
+
affine.data[3] = domMatrix.d;
|
|
12959
|
+
affine.data[4] = domMatrix.e;
|
|
12960
|
+
affine.data[5] = domMatrix.f;
|
|
12961
|
+
return affine;
|
|
12792
12962
|
}
|
|
12793
12963
|
multiply(_m) {
|
|
12794
12964
|
this.__ctx.setTransform(this.__ctx.getTransform().multiply(_m.toDOMMatrix()));
|
|
@@ -14482,101 +14652,17 @@ _Material.BuiltInUniforms = [
|
|
|
14482
14652
|
"u_screen_texture"
|
|
14483
14653
|
];
|
|
14484
14654
|
let Material = _Material;
|
|
14485
|
-
|
|
14486
|
-
static registerGraphicsContext(ctx) {
|
|
14487
|
-
_Debug2._ctx = ctx;
|
|
14488
|
-
}
|
|
14489
|
-
static draw(debugDrawCall) {
|
|
14490
|
-
this._drawCalls.push(debugDrawCall);
|
|
14491
|
-
}
|
|
14492
|
-
static drawPoint(point2, options) {
|
|
14493
|
-
_Debug2.draw((ctx) => {
|
|
14494
|
-
ctx.debug.drawPoint(point2, options);
|
|
14495
|
-
});
|
|
14496
|
-
}
|
|
14497
|
-
static drawLine(start, end, options) {
|
|
14498
|
-
_Debug2.draw((ctx) => {
|
|
14499
|
-
ctx.debug.drawLine(start, end, options);
|
|
14500
|
-
});
|
|
14501
|
-
}
|
|
14502
|
-
static drawLines(points, options) {
|
|
14503
|
-
if (points.length > 1) {
|
|
14504
|
-
_Debug2.draw((ctx) => {
|
|
14505
|
-
for (let i = 0; i < points.length - 1; i++) {
|
|
14506
|
-
ctx.debug.drawLine(points[i], points[i + 1], options);
|
|
14507
|
-
}
|
|
14508
|
-
});
|
|
14509
|
-
}
|
|
14510
|
-
}
|
|
14511
|
-
static drawText(text, pos) {
|
|
14512
|
-
_Debug2.draw((ctx) => {
|
|
14513
|
-
ctx.debug.drawText(text, pos);
|
|
14514
|
-
});
|
|
14515
|
-
}
|
|
14516
|
-
static drawPolygon(points, options) {
|
|
14517
|
-
if (points.length > 1) {
|
|
14518
|
-
_Debug2.draw((ctx) => {
|
|
14519
|
-
const firstPoint = points[0];
|
|
14520
|
-
const polygon = [...points, firstPoint];
|
|
14521
|
-
for (let i = 0; i < polygon.length - 1; i++) {
|
|
14522
|
-
ctx.debug.drawLine(polygon[i], polygon[i + 1], options);
|
|
14523
|
-
}
|
|
14524
|
-
});
|
|
14525
|
-
}
|
|
14526
|
-
}
|
|
14527
|
-
static drawCircle(center, radius, options) {
|
|
14528
|
-
const { color, strokeColor, width } = {
|
|
14529
|
-
color: Color.Black,
|
|
14530
|
-
strokeColor: void 0,
|
|
14531
|
-
width: void 0,
|
|
14532
|
-
...options
|
|
14533
|
-
};
|
|
14534
|
-
_Debug2.draw((ctx) => {
|
|
14535
|
-
ctx.drawCircle(center, radius, color, strokeColor, width);
|
|
14536
|
-
});
|
|
14537
|
-
}
|
|
14538
|
-
static drawBounds(boundingBox, options) {
|
|
14539
|
-
_Debug2.draw((ctx) => {
|
|
14540
|
-
ctx.debug.drawRect(boundingBox.left, boundingBox.top, boundingBox.width, boundingBox.height, options);
|
|
14541
|
-
});
|
|
14542
|
-
}
|
|
14543
|
-
static drawRay(ray, options) {
|
|
14544
|
-
const { distance, color } = {
|
|
14545
|
-
color: Color.Blue,
|
|
14546
|
-
distance: 10,
|
|
14547
|
-
...options
|
|
14548
|
-
};
|
|
14549
|
-
_Debug2.draw((ctx) => {
|
|
14550
|
-
const start = ray.pos;
|
|
14551
|
-
const end = ray.pos.add(ray.dir.scale(distance));
|
|
14552
|
-
ctx.debug.drawLine(start, end, { color });
|
|
14553
|
-
});
|
|
14554
|
-
}
|
|
14555
|
-
static flush(ctx) {
|
|
14556
|
-
ctx.save();
|
|
14557
|
-
ctx.z = _Debug2.z;
|
|
14558
|
-
for (const drawCall of _Debug2._drawCalls) {
|
|
14559
|
-
drawCall(ctx);
|
|
14560
|
-
}
|
|
14561
|
-
ctx.restore();
|
|
14562
|
-
_Debug2.clear();
|
|
14563
|
-
}
|
|
14564
|
-
static clear() {
|
|
14565
|
-
_Debug2._drawCalls.length = 0;
|
|
14566
|
-
}
|
|
14567
|
-
};
|
|
14568
|
-
_Debug._drawCalls = [];
|
|
14569
|
-
_Debug.z = Infinity;
|
|
14570
|
-
let Debug = _Debug;
|
|
14571
|
-
class LineRenderer {
|
|
14655
|
+
class DebugLineRenderer {
|
|
14572
14656
|
constructor() {
|
|
14573
|
-
this.type = "ex.line";
|
|
14657
|
+
this.type = "ex.debug-line";
|
|
14574
14658
|
this.priority = 0;
|
|
14575
14659
|
this._maxLines = 10922;
|
|
14576
14660
|
this._vertexIndex = 0;
|
|
14577
14661
|
this._lineCount = 0;
|
|
14578
14662
|
this._startScratch = vec(0, 0);
|
|
14579
14663
|
this._endScratch = vec(0, 0);
|
|
14664
|
+
this._lengthSoFar = 0;
|
|
14665
|
+
this._currentlyDashed = false;
|
|
14580
14666
|
}
|
|
14581
14667
|
initialize(gl, context) {
|
|
14582
14668
|
this._gl = gl;
|
|
@@ -14591,7 +14677,8 @@ class LineRenderer {
|
|
|
14591
14677
|
this._shader.setUniformMatrix("u_matrix", this._context.ortho);
|
|
14592
14678
|
this._vertexBuffer = new VertexBuffer({
|
|
14593
14679
|
gl,
|
|
14594
|
-
size:
|
|
14680
|
+
size: 7 * 6 * this._maxLines,
|
|
14681
|
+
// 7 floats per vert, 6 verts per line
|
|
14595
14682
|
type: "dynamic"
|
|
14596
14683
|
});
|
|
14597
14684
|
this._layout = new VertexLayout({
|
|
@@ -14600,7 +14687,8 @@ class LineRenderer {
|
|
|
14600
14687
|
shader: this._shader,
|
|
14601
14688
|
attributes: [
|
|
14602
14689
|
["a_position", 2],
|
|
14603
|
-
["a_color", 4]
|
|
14690
|
+
["a_color", 4],
|
|
14691
|
+
["a_lengthSoFar", 1]
|
|
14604
14692
|
]
|
|
14605
14693
|
});
|
|
14606
14694
|
}
|
|
@@ -14610,27 +14698,62 @@ class LineRenderer {
|
|
|
14610
14698
|
this._context = null;
|
|
14611
14699
|
this._gl = null;
|
|
14612
14700
|
}
|
|
14613
|
-
draw(start, end, color) {
|
|
14614
|
-
if (this._isFull()) {
|
|
14701
|
+
draw(start, end, color, width = 2, dashed = false) {
|
|
14702
|
+
if (this._isFull() || this._currentlyDashed !== dashed) {
|
|
14703
|
+
this._currentlyDashed = dashed;
|
|
14615
14704
|
this.flush();
|
|
14616
14705
|
}
|
|
14617
14706
|
this._lineCount++;
|
|
14618
14707
|
const transform = this._context.getTransform();
|
|
14619
14708
|
const finalStart = transform.multiply(start, this._startScratch);
|
|
14620
14709
|
const finalEnd = transform.multiply(end, this._endScratch);
|
|
14710
|
+
const dir = finalEnd.sub(finalStart);
|
|
14711
|
+
const dist = finalStart.distance(finalEnd);
|
|
14712
|
+
const normal = dir.normal();
|
|
14713
|
+
const halfWidth = width / 2;
|
|
14621
14714
|
const vertexBuffer = this._vertexBuffer.bufferData;
|
|
14622
|
-
vertexBuffer[this._vertexIndex++] = finalStart.x;
|
|
14623
|
-
vertexBuffer[this._vertexIndex++] = finalStart.y;
|
|
14715
|
+
vertexBuffer[this._vertexIndex++] = finalStart.x - normal.x * halfWidth;
|
|
14716
|
+
vertexBuffer[this._vertexIndex++] = finalStart.y - normal.y * halfWidth;
|
|
14717
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14718
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14719
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14720
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14721
|
+
vertexBuffer[this._vertexIndex++] = this._lengthSoFar;
|
|
14722
|
+
vertexBuffer[this._vertexIndex++] = finalStart.x + normal.x * halfWidth;
|
|
14723
|
+
vertexBuffer[this._vertexIndex++] = finalStart.y + normal.y * halfWidth;
|
|
14724
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14725
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14726
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14727
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14728
|
+
vertexBuffer[this._vertexIndex++] = this._lengthSoFar;
|
|
14729
|
+
vertexBuffer[this._vertexIndex++] = finalEnd.x - normal.x * halfWidth;
|
|
14730
|
+
vertexBuffer[this._vertexIndex++] = finalEnd.y - normal.y * halfWidth;
|
|
14624
14731
|
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14625
14732
|
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14626
14733
|
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14627
14734
|
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14628
|
-
vertexBuffer[this._vertexIndex++] =
|
|
14629
|
-
vertexBuffer[this._vertexIndex++] = finalEnd.
|
|
14735
|
+
vertexBuffer[this._vertexIndex++] = this._lengthSoFar + dist;
|
|
14736
|
+
vertexBuffer[this._vertexIndex++] = finalEnd.x - normal.x * halfWidth;
|
|
14737
|
+
vertexBuffer[this._vertexIndex++] = finalEnd.y - normal.y * halfWidth;
|
|
14630
14738
|
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14631
14739
|
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14632
14740
|
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14633
14741
|
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14742
|
+
vertexBuffer[this._vertexIndex++] = this._lengthSoFar + dist;
|
|
14743
|
+
vertexBuffer[this._vertexIndex++] = finalStart.x + normal.x * halfWidth;
|
|
14744
|
+
vertexBuffer[this._vertexIndex++] = finalStart.y + normal.y * halfWidth;
|
|
14745
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14746
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14747
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14748
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14749
|
+
vertexBuffer[this._vertexIndex++] = this._lengthSoFar;
|
|
14750
|
+
vertexBuffer[this._vertexIndex++] = finalEnd.x + normal.x * halfWidth;
|
|
14751
|
+
vertexBuffer[this._vertexIndex++] = finalEnd.y + normal.y * halfWidth;
|
|
14752
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14753
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14754
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14755
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14756
|
+
vertexBuffer[this._vertexIndex++] = this._lengthSoFar + dist;
|
|
14634
14757
|
}
|
|
14635
14758
|
_isFull() {
|
|
14636
14759
|
if (this._lineCount >= this._maxLines) {
|
|
@@ -14649,18 +14772,20 @@ class LineRenderer {
|
|
|
14649
14772
|
this._shader.use();
|
|
14650
14773
|
this._layout.use(true);
|
|
14651
14774
|
this._shader.setUniformMatrix("u_matrix", this._context.ortho);
|
|
14652
|
-
|
|
14775
|
+
this._shader.setUniformBoolean("u_dashed", this._currentlyDashed);
|
|
14776
|
+
gl.drawArrays(gl.TRIANGLES, 0, this._lineCount * 6);
|
|
14653
14777
|
GraphicsDiagnostics.DrawnImagesCount += this._lineCount;
|
|
14654
14778
|
GraphicsDiagnostics.DrawCallCount++;
|
|
14655
14779
|
this._vertexIndex = 0;
|
|
14656
14780
|
this._lineCount = 0;
|
|
14781
|
+
this._lengthSoFar = 0;
|
|
14657
14782
|
}
|
|
14658
14783
|
}
|
|
14659
14784
|
const pointVertexSource = "#version 300 es\nin vec2 a_position;\nin vec4 a_color;\nin float a_size;\nout lowp vec4 v_color;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);\n gl_PointSize = a_size * 2.0;\n v_color = a_color;\n}";
|
|
14660
14785
|
const pointFragmentSource = '#version 300 es\n\nprecision mediump float;\nin lowp vec4 v_color;\n\nout vec4 fragColor;\n\nvoid main() {\n float r = 0.0, delta = 0.0, alpha = 1.0;\n vec2 cxy = 2.0 * gl_PointCoord - 1.0;\n r = dot(cxy, cxy);\n\n delta = fwidth(r);\n alpha = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);\n // "premultiply" the color by alpha\n vec4 color = v_color;\n color.a = color.a * alpha;\n color.rgb = color.rgb * color.a;\n fragColor = color;\n}';
|
|
14661
|
-
class
|
|
14786
|
+
class DebugPointRenderer {
|
|
14662
14787
|
constructor() {
|
|
14663
|
-
this.type = "ex.point";
|
|
14788
|
+
this.type = "ex.debug-point";
|
|
14664
14789
|
this.priority = 0;
|
|
14665
14790
|
this._maxPoints = 10922;
|
|
14666
14791
|
this._pointCount = 0;
|
|
@@ -14719,7 +14844,7 @@ class PointRenderer {
|
|
|
14719
14844
|
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14720
14845
|
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14721
14846
|
vertexBuffer[this._vertexIndex++] = color.a * opacity;
|
|
14722
|
-
vertexBuffer[this._vertexIndex++] = size
|
|
14847
|
+
vertexBuffer[this._vertexIndex++] = size;
|
|
14723
14848
|
}
|
|
14724
14849
|
_isFull() {
|
|
14725
14850
|
if (this._pointCount >= this._maxPoints) {
|
|
@@ -14745,6 +14870,169 @@ class PointRenderer {
|
|
|
14745
14870
|
this._vertexIndex = 0;
|
|
14746
14871
|
}
|
|
14747
14872
|
}
|
|
14873
|
+
const frag$4 = "#version 300 es\nprecision highp float;\n\n// UV coord\nin vec2 v_uv;\n\n// Color coord to blend with image\nin lowp vec4 v_color;\n\n// Stroke color if used\nin lowp vec4 v_strokeColor;\n\n// Stroke thickness if used\nin lowp float v_strokeThickness;\n\nin float v_radius;\n\n// Opacity\nin float v_opacity;\n\nout vec4 fragColor;\n\nvoid main() {\n // make (0, 0) the center the uv \n vec2 uv = v_uv * 2.0 - 1.0;\n\n vec4 color = v_color;\n vec4 strokeColor = v_strokeColor;\n\n float dist = 1.0 - length(uv);\n float radius = dist * v_radius; // 0 is the edge\n\n // Fade based on fwidth\n float fade = fwidth(dot(uv, uv)) / 2.0;\n\n float fill = smoothstep(-fade, fade, radius);\n\n float stroke = \n smoothstep(0.0, fade, radius) -\n smoothstep(v_strokeThickness, v_strokeThickness + fade, radius);\n\n strokeColor.a = stroke;\n strokeColor.rgb *= strokeColor.a;\n\n // vec4 finalColor = strokeColor;\n\n color.a *= fill * (1.0 - stroke);\n color.rgb *= color.a;\n\n vec4 finalColor = mix(vec4(0.0), (color + strokeColor), fill);\n finalColor.rgb = finalColor.rgb * v_opacity;\n finalColor.a = finalColor.a * v_opacity;\n\n fragColor = finalColor;\n}\n";
|
|
14874
|
+
const vert$4 = "#version 300 es\nin vec2 a_position;\n\n// UV coordinate\nin vec2 a_uv;\nout vec2 v_uv;\n\n// Opacity \nin float a_opacity;\nout float v_opacity;\n\nin vec4 a_color;\nout vec4 v_color;\n\nin vec4 a_strokeColor;\nout vec4 v_strokeColor;\n\nin float a_strokeThickness;\nout float v_strokeThickness;\n\nin float a_radius;\nout float v_radius;\n\nuniform mat4 u_matrix;\n\n\nvoid main() {\n // Set the vertex position using the ortho transform matrix\n gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);\n\n // Pass through UV coords\n v_uv = a_uv;\n // Pass through the Opacity to the fragment shader\n v_opacity = a_opacity;\n // Pass through the color to the fragment shader\n v_color = a_color;\n // Pass through the stroke color to the fragment shader\n v_strokeColor = a_strokeColor;\n // Pass through the stroke thickenss to the fragment shader\n v_strokeThickness = a_strokeThickness;\n v_radius = a_radius;\n}\n";
|
|
14875
|
+
class DebugCircleRenderer {
|
|
14876
|
+
constructor() {
|
|
14877
|
+
this.type = "ex.debug-circle";
|
|
14878
|
+
this.priority = 0;
|
|
14879
|
+
this._maxCircles = 10922;
|
|
14880
|
+
this._circleCount = 0;
|
|
14881
|
+
this._vertexIndex = 0;
|
|
14882
|
+
}
|
|
14883
|
+
initialize(gl, context) {
|
|
14884
|
+
this._gl = gl;
|
|
14885
|
+
this._context = context;
|
|
14886
|
+
this._shader = new Shader({
|
|
14887
|
+
graphicsContext: context,
|
|
14888
|
+
fragmentSource: frag$4,
|
|
14889
|
+
vertexSource: vert$4
|
|
14890
|
+
});
|
|
14891
|
+
this._shader.compile();
|
|
14892
|
+
this._shader.use();
|
|
14893
|
+
this._shader.setUniformMatrix("u_matrix", context.ortho);
|
|
14894
|
+
this._buffer = new VertexBuffer({
|
|
14895
|
+
gl,
|
|
14896
|
+
size: 15 * 4 * this._maxCircles,
|
|
14897
|
+
type: "dynamic"
|
|
14898
|
+
});
|
|
14899
|
+
this._layout = new VertexLayout({
|
|
14900
|
+
gl,
|
|
14901
|
+
shader: this._shader,
|
|
14902
|
+
vertexBuffer: this._buffer,
|
|
14903
|
+
attributes: [
|
|
14904
|
+
["a_position", 2],
|
|
14905
|
+
["a_uv", 2],
|
|
14906
|
+
["a_opacity", 1],
|
|
14907
|
+
["a_color", 4],
|
|
14908
|
+
["a_strokeColor", 4],
|
|
14909
|
+
["a_strokeThickness", 1],
|
|
14910
|
+
["a_radius", 1]
|
|
14911
|
+
]
|
|
14912
|
+
});
|
|
14913
|
+
this._quads = new QuadIndexBuffer(gl, this._maxCircles, true);
|
|
14914
|
+
}
|
|
14915
|
+
dispose() {
|
|
14916
|
+
this._buffer.dispose();
|
|
14917
|
+
this._quads.dispose();
|
|
14918
|
+
this._shader.dispose();
|
|
14919
|
+
this._context = null;
|
|
14920
|
+
this._gl = null;
|
|
14921
|
+
}
|
|
14922
|
+
_isFull() {
|
|
14923
|
+
if (this._circleCount >= this._maxCircles) {
|
|
14924
|
+
return true;
|
|
14925
|
+
}
|
|
14926
|
+
return false;
|
|
14927
|
+
}
|
|
14928
|
+
draw(pos, radius, color, stroke = Color.Transparent, strokeThickness = 0) {
|
|
14929
|
+
if (this._isFull()) {
|
|
14930
|
+
this.flush();
|
|
14931
|
+
}
|
|
14932
|
+
this._circleCount++;
|
|
14933
|
+
const transform = this._context.getTransform();
|
|
14934
|
+
const scale = transform.getScaleX();
|
|
14935
|
+
const opacity = this._context.opacity;
|
|
14936
|
+
const snapToPixel = this._context.snapToPixel;
|
|
14937
|
+
const topLeft = transform.multiply(pos.add(vec(-radius, -radius)));
|
|
14938
|
+
const topRight = transform.multiply(pos.add(vec(radius, -radius)));
|
|
14939
|
+
const bottomRight = transform.multiply(pos.add(vec(radius, radius)));
|
|
14940
|
+
const bottomLeft = transform.multiply(pos.add(vec(-radius, radius)));
|
|
14941
|
+
if (snapToPixel) {
|
|
14942
|
+
topLeft.x = ~~(topLeft.x + pixelSnapEpsilon);
|
|
14943
|
+
topLeft.y = ~~(topLeft.y + pixelSnapEpsilon);
|
|
14944
|
+
topRight.x = ~~(topRight.x + pixelSnapEpsilon);
|
|
14945
|
+
topRight.y = ~~(topRight.y + pixelSnapEpsilon);
|
|
14946
|
+
bottomLeft.x = ~~(bottomLeft.x + pixelSnapEpsilon);
|
|
14947
|
+
bottomLeft.y = ~~(bottomLeft.y + pixelSnapEpsilon);
|
|
14948
|
+
bottomRight.x = ~~(bottomRight.x + pixelSnapEpsilon);
|
|
14949
|
+
bottomRight.y = ~~(bottomRight.y + pixelSnapEpsilon);
|
|
14950
|
+
}
|
|
14951
|
+
const uvx0 = 0;
|
|
14952
|
+
const uvy0 = 0;
|
|
14953
|
+
const uvx1 = 1;
|
|
14954
|
+
const uvy1 = 1;
|
|
14955
|
+
const vertexBuffer = this._layout.vertexBuffer.bufferData;
|
|
14956
|
+
vertexBuffer[this._vertexIndex++] = topLeft.x;
|
|
14957
|
+
vertexBuffer[this._vertexIndex++] = topLeft.y;
|
|
14958
|
+
vertexBuffer[this._vertexIndex++] = uvx0;
|
|
14959
|
+
vertexBuffer[this._vertexIndex++] = uvy0;
|
|
14960
|
+
vertexBuffer[this._vertexIndex++] = opacity;
|
|
14961
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14962
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14963
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14964
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14965
|
+
vertexBuffer[this._vertexIndex++] = stroke.r / 255;
|
|
14966
|
+
vertexBuffer[this._vertexIndex++] = stroke.g / 255;
|
|
14967
|
+
vertexBuffer[this._vertexIndex++] = stroke.b / 255;
|
|
14968
|
+
vertexBuffer[this._vertexIndex++] = stroke.a;
|
|
14969
|
+
vertexBuffer[this._vertexIndex++] = strokeThickness;
|
|
14970
|
+
vertexBuffer[this._vertexIndex++] = radius * scale;
|
|
14971
|
+
vertexBuffer[this._vertexIndex++] = bottomLeft.x;
|
|
14972
|
+
vertexBuffer[this._vertexIndex++] = bottomLeft.y;
|
|
14973
|
+
vertexBuffer[this._vertexIndex++] = uvx0;
|
|
14974
|
+
vertexBuffer[this._vertexIndex++] = uvy1;
|
|
14975
|
+
vertexBuffer[this._vertexIndex++] = opacity;
|
|
14976
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14977
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14978
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14979
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14980
|
+
vertexBuffer[this._vertexIndex++] = stroke.r / 255;
|
|
14981
|
+
vertexBuffer[this._vertexIndex++] = stroke.g / 255;
|
|
14982
|
+
vertexBuffer[this._vertexIndex++] = stroke.b / 255;
|
|
14983
|
+
vertexBuffer[this._vertexIndex++] = stroke.a;
|
|
14984
|
+
vertexBuffer[this._vertexIndex++] = strokeThickness;
|
|
14985
|
+
vertexBuffer[this._vertexIndex++] = radius * scale;
|
|
14986
|
+
vertexBuffer[this._vertexIndex++] = topRight.x;
|
|
14987
|
+
vertexBuffer[this._vertexIndex++] = topRight.y;
|
|
14988
|
+
vertexBuffer[this._vertexIndex++] = uvx1;
|
|
14989
|
+
vertexBuffer[this._vertexIndex++] = uvy0;
|
|
14990
|
+
vertexBuffer[this._vertexIndex++] = opacity;
|
|
14991
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
14992
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
14993
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
14994
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
14995
|
+
vertexBuffer[this._vertexIndex++] = stroke.r / 255;
|
|
14996
|
+
vertexBuffer[this._vertexIndex++] = stroke.g / 255;
|
|
14997
|
+
vertexBuffer[this._vertexIndex++] = stroke.b / 255;
|
|
14998
|
+
vertexBuffer[this._vertexIndex++] = stroke.a;
|
|
14999
|
+
vertexBuffer[this._vertexIndex++] = strokeThickness;
|
|
15000
|
+
vertexBuffer[this._vertexIndex++] = radius * scale;
|
|
15001
|
+
vertexBuffer[this._vertexIndex++] = bottomRight.x;
|
|
15002
|
+
vertexBuffer[this._vertexIndex++] = bottomRight.y;
|
|
15003
|
+
vertexBuffer[this._vertexIndex++] = uvx1;
|
|
15004
|
+
vertexBuffer[this._vertexIndex++] = uvy1;
|
|
15005
|
+
vertexBuffer[this._vertexIndex++] = opacity;
|
|
15006
|
+
vertexBuffer[this._vertexIndex++] = color.r / 255;
|
|
15007
|
+
vertexBuffer[this._vertexIndex++] = color.g / 255;
|
|
15008
|
+
vertexBuffer[this._vertexIndex++] = color.b / 255;
|
|
15009
|
+
vertexBuffer[this._vertexIndex++] = color.a;
|
|
15010
|
+
vertexBuffer[this._vertexIndex++] = stroke.r / 255;
|
|
15011
|
+
vertexBuffer[this._vertexIndex++] = stroke.g / 255;
|
|
15012
|
+
vertexBuffer[this._vertexIndex++] = stroke.b / 255;
|
|
15013
|
+
vertexBuffer[this._vertexIndex++] = stroke.a;
|
|
15014
|
+
vertexBuffer[this._vertexIndex++] = strokeThickness;
|
|
15015
|
+
vertexBuffer[this._vertexIndex++] = radius * scale;
|
|
15016
|
+
}
|
|
15017
|
+
hasPendingDraws() {
|
|
15018
|
+
return this._circleCount !== 0;
|
|
15019
|
+
}
|
|
15020
|
+
flush() {
|
|
15021
|
+
if (this._circleCount === 0) {
|
|
15022
|
+
return;
|
|
15023
|
+
}
|
|
15024
|
+
const gl = this._gl;
|
|
15025
|
+
this._shader.use();
|
|
15026
|
+
this._layout.use(true);
|
|
15027
|
+
this._shader.setUniformMatrix("u_matrix", this._context.ortho);
|
|
15028
|
+
this._quads.bind();
|
|
15029
|
+
gl.drawElements(gl.TRIANGLES, this._circleCount * 6, this._quads.bufferGlType, 0);
|
|
15030
|
+
GraphicsDiagnostics.DrawnImagesCount += this._circleCount;
|
|
15031
|
+
GraphicsDiagnostics.DrawCallCount++;
|
|
15032
|
+
this._circleCount = 0;
|
|
15033
|
+
this._vertexIndex = 0;
|
|
15034
|
+
}
|
|
15035
|
+
}
|
|
14748
15036
|
const screenVertex = "#version 300 es\nin vec2 a_position;\n\nin vec2 a_texcoord;\nout vec2 v_texcoord;\n\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n\n // Pass the texcoord to the fragment shader.\n v_texcoord = a_texcoord;\n}";
|
|
14749
15037
|
const screenFragment = "#version 300 es\nprecision mediump float;\n\n// Passed in from the vertex shader.\nin vec2 v_texcoord;\n\n// The texture.\nuniform sampler2D u_texture;\n\nout vec4 fragColor;\n\nvoid main() {\n fragColor = texture(u_texture, v_texcoord);\n}";
|
|
14750
15038
|
class ScreenPassPainter {
|
|
@@ -16056,7 +16344,9 @@ class ExcaliburGraphicsContextWebGLDebug {
|
|
|
16056
16344
|
this._debugText = new DebugText();
|
|
16057
16345
|
}
|
|
16058
16346
|
/**
|
|
16059
|
-
* Draw a debugging rectangle to the context
|
|
16347
|
+
* Draw a debugging rectangle to the graphics context
|
|
16348
|
+
*
|
|
16349
|
+
* Debugging draws are independent of scale/zoom
|
|
16060
16350
|
* @param x
|
|
16061
16351
|
* @param y
|
|
16062
16352
|
* @param width
|
|
@@ -16069,25 +16359,61 @@ class ExcaliburGraphicsContextWebGLDebug {
|
|
|
16069
16359
|
this.drawLine(vec(x, y + height), vec(x, y), { ...rectOptions });
|
|
16070
16360
|
}
|
|
16071
16361
|
/**
|
|
16072
|
-
* Draw a debugging line to the context
|
|
16362
|
+
* Draw a debugging line to the graphics context
|
|
16363
|
+
*
|
|
16364
|
+
* Debugging draws are independent of scale/zoom
|
|
16073
16365
|
* @param start
|
|
16074
16366
|
* @param end
|
|
16075
16367
|
* @param lineOptions
|
|
16076
16368
|
*/
|
|
16077
16369
|
drawLine(start, end, lineOptions) {
|
|
16078
16370
|
var _a;
|
|
16079
|
-
this._webglCtx.
|
|
16371
|
+
this._webglCtx.save();
|
|
16372
|
+
this._webglCtx.z = (lineOptions == null ? void 0 : lineOptions.dashed) ? Debug.config.settings.z.dashed : Debug.config.settings.z.solid;
|
|
16373
|
+
this._webglCtx.draw(
|
|
16374
|
+
"ex.debug-line",
|
|
16375
|
+
start,
|
|
16376
|
+
end,
|
|
16377
|
+
(_a = lineOptions == null ? void 0 : lineOptions.color) != null ? _a : Color.Black,
|
|
16378
|
+
lineOptions == null ? void 0 : lineOptions.lineWidth,
|
|
16379
|
+
lineOptions == null ? void 0 : lineOptions.dashed
|
|
16380
|
+
);
|
|
16381
|
+
this._webglCtx.restore();
|
|
16080
16382
|
}
|
|
16081
16383
|
/**
|
|
16082
|
-
* Draw a debugging point to the context
|
|
16384
|
+
* Draw a debugging point to the graphics context
|
|
16385
|
+
*
|
|
16386
|
+
* Debugging draws are independent of scale/zoom
|
|
16083
16387
|
* @param point
|
|
16084
16388
|
* @param pointOptions
|
|
16085
16389
|
*/
|
|
16086
16390
|
drawPoint(point2, pointOptions = { color: Color.Black, size: 5 }) {
|
|
16087
|
-
this._webglCtx.
|
|
16391
|
+
this._webglCtx.save();
|
|
16392
|
+
this._webglCtx.z = Debug.config.settings.z.point;
|
|
16393
|
+
this._webglCtx.draw("ex.debug-point", point2, pointOptions.color, pointOptions.size);
|
|
16394
|
+
this._webglCtx.restore();
|
|
16395
|
+
}
|
|
16396
|
+
/**
|
|
16397
|
+
* Draw a debugging circle to the graphics context
|
|
16398
|
+
*
|
|
16399
|
+
* Debugging draws are independent of scale/zoom
|
|
16400
|
+
*/
|
|
16401
|
+
drawCircle(pos, radius, color, stroke, thickness) {
|
|
16402
|
+
this._webglCtx.save();
|
|
16403
|
+
this._webglCtx.z = Debug.config.settings.z.solid;
|
|
16404
|
+
this._webglCtx.draw("ex.debug-circle", pos, radius, color, stroke, thickness);
|
|
16405
|
+
this._webglCtx.restore();
|
|
16088
16406
|
}
|
|
16407
|
+
/**
|
|
16408
|
+
* Draw some debugging text to the graphics context
|
|
16409
|
+
*
|
|
16410
|
+
* Debugging draws are independent of scale/zoom
|
|
16411
|
+
*/
|
|
16089
16412
|
drawText(text, pos) {
|
|
16413
|
+
this._webglCtx.save();
|
|
16414
|
+
this._webglCtx.z = Debug.config.settings.z.text;
|
|
16090
16415
|
this._debugText.write(this._webglCtx, text, pos);
|
|
16416
|
+
this._webglCtx.restore();
|
|
16091
16417
|
}
|
|
16092
16418
|
}
|
|
16093
16419
|
class ExcaliburGraphicsContextWebGL {
|
|
@@ -16116,7 +16442,6 @@ class ExcaliburGraphicsContextWebGL {
|
|
|
16116
16442
|
this._disposed = false;
|
|
16117
16443
|
this._imageToWidth = /* @__PURE__ */ new Map();
|
|
16118
16444
|
this._imageToHeight = /* @__PURE__ */ new Map();
|
|
16119
|
-
this.debug = new ExcaliburGraphicsContextWebGLDebug(this);
|
|
16120
16445
|
this._totalPostProcessorTime = 0;
|
|
16121
16446
|
const {
|
|
16122
16447
|
canvasElement,
|
|
@@ -16242,8 +16567,9 @@ class ExcaliburGraphicsContextWebGL {
|
|
|
16242
16567
|
this.register(new MaterialRenderer());
|
|
16243
16568
|
this.register(new RectangleRenderer());
|
|
16244
16569
|
this.register(new CircleRenderer());
|
|
16245
|
-
this.
|
|
16246
|
-
this.
|
|
16570
|
+
this.lazyRegister("ex.debug-circle", () => new DebugCircleRenderer());
|
|
16571
|
+
this.lazyRegister("ex.debug-point", () => new DebugPointRenderer());
|
|
16572
|
+
this.lazyRegister("ex.debug-line", () => new DebugLineRenderer());
|
|
16247
16573
|
this.lazyRegister("ex.particle", () => new ParticleRenderer());
|
|
16248
16574
|
this.register(
|
|
16249
16575
|
new ImageRendererV2({
|
|
@@ -16291,6 +16617,7 @@ class ExcaliburGraphicsContextWebGL {
|
|
|
16291
16617
|
antialias: this.multiSampleAntialiasing,
|
|
16292
16618
|
samples: this.samples
|
|
16293
16619
|
});
|
|
16620
|
+
this.debug = new ExcaliburGraphicsContextWebGLDebug(this);
|
|
16294
16621
|
}
|
|
16295
16622
|
register(renderer) {
|
|
16296
16623
|
this._renderers.set(renderer.type, renderer);
|
|
@@ -21358,12 +21685,12 @@ class QuadTree {
|
|
|
21358
21685
|
return 1 + Math.max(this.topLeft.getTreeDepth(), this.topRight.getTreeDepth(), this.bottomLeft.getTreeDepth(), this.bottomRight.getTreeDepth());
|
|
21359
21686
|
}
|
|
21360
21687
|
debug(ctx) {
|
|
21361
|
-
this.bounds.
|
|
21688
|
+
this.bounds.debug(ctx, { color: Color.Yellow });
|
|
21362
21689
|
if (this._isDivided) {
|
|
21363
|
-
this.topLeft.bounds.
|
|
21364
|
-
this.topRight.bounds.
|
|
21365
|
-
this.bottomLeft.bounds.
|
|
21366
|
-
this.bottomRight.bounds.
|
|
21690
|
+
this.topLeft.bounds.debug(ctx, { color: Color.Yellow });
|
|
21691
|
+
this.topRight.bounds.debug(ctx, { color: Color.Yellow });
|
|
21692
|
+
this.bottomLeft.bounds.debug(ctx, { color: Color.Yellow });
|
|
21693
|
+
this.bottomRight.bounds.debug(ctx, { color: Color.Yellow });
|
|
21367
21694
|
}
|
|
21368
21695
|
}
|
|
21369
21696
|
}
|
|
@@ -25256,7 +25583,7 @@ class TileMap extends Entity {
|
|
|
25256
25583
|
gfx.z = 999;
|
|
25257
25584
|
if (showColliderBounds) {
|
|
25258
25585
|
for (let i = 0; i < this.tiles.length; i++) {
|
|
25259
|
-
this.tiles[i].bounds.
|
|
25586
|
+
this.tiles[i].bounds.debug(gfx);
|
|
25260
25587
|
}
|
|
25261
25588
|
}
|
|
25262
25589
|
gfx.restore();
|
|
@@ -25793,17 +26120,17 @@ class IsometricMap extends Entity {
|
|
|
25793
26120
|
for (let y = 0; y < this.rows + 1; y++) {
|
|
25794
26121
|
const left = this.tileToWorld(vec(0, y));
|
|
25795
26122
|
const right = this.tileToWorld(vec(this.columns, y));
|
|
25796
|
-
gfx.drawLine(left, right, gridColor, gridWidth);
|
|
26123
|
+
gfx.debug.drawLine(left, right, { color: gridColor, lineWidth: gridWidth });
|
|
25797
26124
|
}
|
|
25798
26125
|
for (let x = 0; x < this.columns + 1; x++) {
|
|
25799
26126
|
const top = this.tileToWorld(vec(x, 0));
|
|
25800
26127
|
const bottom = this.tileToWorld(vec(x, this.rows));
|
|
25801
|
-
gfx.drawLine(top, bottom, gridColor, gridWidth);
|
|
26128
|
+
gfx.debug.drawLine(top, bottom, { color: gridColor, lineWidth: gridWidth });
|
|
25802
26129
|
}
|
|
25803
26130
|
}
|
|
25804
26131
|
if (showAll || showPosition) {
|
|
25805
26132
|
for (const tile of this.tiles) {
|
|
25806
|
-
gfx.drawCircle(this.tileToWorld(vec(tile.x, tile.y)), positionSize, positionColor);
|
|
26133
|
+
gfx.debug.drawCircle(this.tileToWorld(vec(tile.x, tile.y)), positionSize, positionColor);
|
|
25807
26134
|
}
|
|
25808
26135
|
}
|
|
25809
26136
|
if (showAll || showColliderGeometry) {
|
|
@@ -26548,8 +26875,6 @@ class DebugSystem extends System {
|
|
|
26548
26875
|
let colliderComp;
|
|
26549
26876
|
const colliderSettings = this._engine.debug.collider;
|
|
26550
26877
|
const physicsSettings = this._engine.debug.physics;
|
|
26551
|
-
let graphics;
|
|
26552
|
-
const graphicsSettings = this._engine.debug.graphics;
|
|
26553
26878
|
let debugDraw;
|
|
26554
26879
|
let body;
|
|
26555
26880
|
const bodySettings = this._engine.debug.body;
|
|
@@ -26584,7 +26909,6 @@ class DebugSystem extends System {
|
|
|
26584
26909
|
if (tx.coordPlane === CoordPlane.Screen) {
|
|
26585
26910
|
this._graphicsContext.translate(this._engine.screen.contentArea.left, this._engine.screen.contentArea.top);
|
|
26586
26911
|
}
|
|
26587
|
-
this._graphicsContext.z = txSettings.debugZIndex;
|
|
26588
26912
|
this._applyTransform(entity);
|
|
26589
26913
|
if (tx) {
|
|
26590
26914
|
if (txSettings.showAll || txSettings.showPosition) {
|
|
@@ -26620,13 +26944,6 @@ class DebugSystem extends System {
|
|
|
26620
26944
|
this._graphicsContext.drawLine(Vector.Zero, tx.scale.add(Vector.Zero), txSettings.scaleColor, 2);
|
|
26621
26945
|
}
|
|
26622
26946
|
}
|
|
26623
|
-
graphics = entity.get(GraphicsComponent);
|
|
26624
|
-
if (graphics) {
|
|
26625
|
-
if (graphicsSettings.showAll || graphicsSettings.showBounds) {
|
|
26626
|
-
const bounds = graphics.localBounds;
|
|
26627
|
-
bounds.draw(this._graphicsContext, graphicsSettings.boundsColor);
|
|
26628
|
-
}
|
|
26629
|
-
}
|
|
26630
26947
|
debugDraw = entity.get(DebugGraphicsComponent);
|
|
26631
26948
|
if (debugDraw) {
|
|
26632
26949
|
if (!debugDraw.useTransform) {
|
|
@@ -26666,7 +26983,6 @@ class DebugSystem extends System {
|
|
|
26666
26983
|
if (tx.coordPlane === CoordPlane.Screen) {
|
|
26667
26984
|
this._graphicsContext.translate(this._engine.screen.contentArea.left, this._engine.screen.contentArea.top);
|
|
26668
26985
|
}
|
|
26669
|
-
this._graphicsContext.z = txSettings.debugZIndex;
|
|
26670
26986
|
motion = entity.get(MotionComponent);
|
|
26671
26987
|
if (motion) {
|
|
26672
26988
|
if (motionSettings.showAll || motionSettings.showVelocity) {
|
|
@@ -26693,16 +27009,25 @@ class DebugSystem extends System {
|
|
|
26693
27009
|
for (const collider2 of colliders) {
|
|
26694
27010
|
const bounds = collider2.bounds;
|
|
26695
27011
|
const pos = vec(bounds.left, bounds.top);
|
|
26696
|
-
this._graphicsContext.debug.drawRect(pos.x, pos.y, bounds.width, bounds.height, {
|
|
27012
|
+
this._graphicsContext.debug.drawRect(pos.x, pos.y, bounds.width, bounds.height, {
|
|
27013
|
+
color: colliderSettings.boundsColor,
|
|
27014
|
+
dashed: true
|
|
27015
|
+
});
|
|
26697
27016
|
if (colliderSettings.showAll || colliderSettings.showOwner) {
|
|
26698
27017
|
this._graphicsContext.debug.drawText(`owner id(${collider2.owner.id})`, pos);
|
|
26699
27018
|
}
|
|
26700
27019
|
}
|
|
26701
|
-
colliderComp.bounds.
|
|
27020
|
+
colliderComp.bounds.debug(this._graphicsContext, {
|
|
27021
|
+
color: colliderSettings.boundsColor,
|
|
27022
|
+
dashed: true
|
|
27023
|
+
});
|
|
26702
27024
|
} else if (collider) {
|
|
26703
27025
|
const bounds = colliderComp.bounds;
|
|
26704
27026
|
const pos = vec(bounds.left, bounds.top);
|
|
26705
|
-
this._graphicsContext.debug.drawRect(pos.x, pos.y, bounds.width, bounds.height, {
|
|
27027
|
+
this._graphicsContext.debug.drawRect(pos.x, pos.y, bounds.width, bounds.height, {
|
|
27028
|
+
color: colliderSettings.boundsColor,
|
|
27029
|
+
dashed: true
|
|
27030
|
+
});
|
|
26706
27031
|
if (colliderSettings.showAll || colliderSettings.showOwner) {
|
|
26707
27032
|
this._graphicsContext.debug.drawText(`owner id(${colliderComp.owner.id})`, pos);
|
|
26708
27033
|
}
|
|
@@ -26741,14 +27066,13 @@ class DebugSystem extends System {
|
|
|
26741
27066
|
this._graphicsContext.save();
|
|
26742
27067
|
this._camera.draw(this._graphicsContext);
|
|
26743
27068
|
if (cameraSettings.showAll || cameraSettings.showFocus) {
|
|
26744
|
-
this._graphicsContext.drawCircle(this._camera.pos, 4, cameraSettings.focusColor);
|
|
27069
|
+
this._graphicsContext.debug.drawCircle(this._camera.pos, 4, cameraSettings.focusColor);
|
|
26745
27070
|
}
|
|
26746
27071
|
if (cameraSettings.showAll || cameraSettings.showZoom) {
|
|
26747
27072
|
this._graphicsContext.debug.drawText(`zoom(${this._camera.zoom})`, this._camera.pos);
|
|
26748
27073
|
}
|
|
26749
27074
|
this._graphicsContext.restore();
|
|
26750
27075
|
}
|
|
26751
|
-
this._graphicsContext.flush();
|
|
26752
27076
|
}
|
|
26753
27077
|
postupdate(engine, elapsed) {
|
|
26754
27078
|
if (this._engine.isDebug) {
|
|
@@ -28767,6 +29091,20 @@ class DebugConfig {
|
|
|
28767
29091
|
*/
|
|
28768
29092
|
prevFrame: new FrameStats()
|
|
28769
29093
|
};
|
|
29094
|
+
this.settings = {
|
|
29095
|
+
text: {
|
|
29096
|
+
foreground: Color.Black,
|
|
29097
|
+
background: Color.Transparent,
|
|
29098
|
+
border: Color.Transparent
|
|
29099
|
+
},
|
|
29100
|
+
z: {
|
|
29101
|
+
text: Number.POSITIVE_INFINITY,
|
|
29102
|
+
point: Number.MAX_SAFE_INTEGER - 1,
|
|
29103
|
+
ray: Number.MAX_SAFE_INTEGER - 1,
|
|
29104
|
+
dashed: Number.MAX_SAFE_INTEGER - 2,
|
|
29105
|
+
solid: Number.MAX_SAFE_INTEGER - 3
|
|
29106
|
+
}
|
|
29107
|
+
};
|
|
28770
29108
|
this.filter = {
|
|
28771
29109
|
/**
|
|
28772
29110
|
* Toggle filter on or off (default off) must be on for DebugDraw to use filters
|
|
@@ -28788,7 +29126,6 @@ class DebugConfig {
|
|
|
28788
29126
|
};
|
|
28789
29127
|
this.transform = {
|
|
28790
29128
|
showAll: false,
|
|
28791
|
-
debugZIndex: 1e7,
|
|
28792
29129
|
showPosition: false,
|
|
28793
29130
|
showPositionLabel: false,
|
|
28794
29131
|
positionColor: Color.Yellow,
|
|
@@ -28810,8 +29147,8 @@ class DebugConfig {
|
|
|
28810
29147
|
showOwner: false,
|
|
28811
29148
|
showGeometry: true,
|
|
28812
29149
|
geometryColor: Color.Green,
|
|
28813
|
-
geometryLineWidth:
|
|
28814
|
-
geometryPointSize:
|
|
29150
|
+
geometryLineWidth: 2,
|
|
29151
|
+
geometryPointSize: 2
|
|
28815
29152
|
};
|
|
28816
29153
|
this.physics = {
|
|
28817
29154
|
showAll: false,
|
|
@@ -28819,7 +29156,7 @@ class DebugConfig {
|
|
|
28819
29156
|
showCollisionNormals: false,
|
|
28820
29157
|
collisionNormalColor: Color.Cyan,
|
|
28821
29158
|
showCollisionContacts: true,
|
|
28822
|
-
contactSize:
|
|
29159
|
+
contactSize: 10,
|
|
28823
29160
|
collisionContactColor: Color.Red
|
|
28824
29161
|
};
|
|
28825
29162
|
this.motion = {
|
|
@@ -28865,6 +29202,7 @@ class DebugConfig {
|
|
|
28865
29202
|
};
|
|
28866
29203
|
this._engine = engine;
|
|
28867
29204
|
this.colorBlindMode = new ColorBlindFlags(this._engine);
|
|
29205
|
+
Debug.registerDebugConfig(this);
|
|
28868
29206
|
}
|
|
28869
29207
|
/**
|
|
28870
29208
|
* Switch the current excalibur clock with the {@apilink TestClock} and return
|
|
@@ -30189,6 +30527,7 @@ const _Engine = class _Engine2 {
|
|
|
30189
30527
|
this._suppressPlayButton = true;
|
|
30190
30528
|
}
|
|
30191
30529
|
this._logger = Logger.getInstance();
|
|
30530
|
+
this.debug = new DebugConfig(this);
|
|
30192
30531
|
if (this._logger.defaultLevel === LogLevel.Debug) {
|
|
30193
30532
|
detector.logBrowserFeatures();
|
|
30194
30533
|
}
|
|
@@ -30352,7 +30691,6 @@ Read more about this issue at https://excaliburjs.com/docs/performance`
|
|
|
30352
30691
|
};
|
|
30353
30692
|
mergeDeep(this.physics, options.physics);
|
|
30354
30693
|
}
|
|
30355
|
-
this.debug = new DebugConfig(this);
|
|
30356
30694
|
this.director = new Director(this, options.scenes);
|
|
30357
30695
|
this.director.events.pipe(this.events);
|
|
30358
30696
|
this._initialize(options);
|
|
@@ -33098,7 +33436,7 @@ class Semaphore {
|
|
|
33098
33436
|
this._count += count;
|
|
33099
33437
|
}
|
|
33100
33438
|
}
|
|
33101
|
-
const EX_VERSION = "0.32.0-alpha.
|
|
33439
|
+
const EX_VERSION = "0.32.0-alpha.1571+1b94394";
|
|
33102
33440
|
polyfill();
|
|
33103
33441
|
export {
|
|
33104
33442
|
ActionCompleteEvent,
|