excalibur 0.32.0-alpha.1563 → 0.32.0-alpha.1565

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.
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1563+eadef91 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1565+76be137 - 2025-11-24
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
@@ -14354,7 +14354,7 @@ void main() {
14354
14354
  v_screenuv = a_screenuv;
14355
14355
  }
14356
14356
  `;
14357
- class Material {
14357
+ const _Material = class _Material2 {
14358
14358
  constructor(options) {
14359
14359
  this._logger = Logger.getInstance();
14360
14360
  this._color = Color.Transparent;
@@ -14376,6 +14376,25 @@ class Material {
14376
14376
  } else {
14377
14377
  this._logger.warn(`Material ${name} was created in 2D Canvas mode, currently only WebGL is supported`);
14378
14378
  }
14379
+ {
14380
+ if (this.images.u_graphic) {
14381
+ this._logger.warn(
14382
+ `Material named "${this.name}" is overriding built in image u_graphic, is this on purpose? If so ignore this warning.`
14383
+ );
14384
+ }
14385
+ if (this.images.u_screen_texture) {
14386
+ this._logger.warn(
14387
+ `Material named "${this.name}" is overriding built in image u_screen_texture, is this on purpose? If so ignore this warning.`
14388
+ );
14389
+ }
14390
+ for (const uniform of Object.keys(this._uniforms)) {
14391
+ if (_Material2.BuiltInUniforms.includes(uniform)) {
14392
+ this._logger.warn(
14393
+ `Material named "${this.name}" is overriding built in uniform ${uniform}, is this on purpose? If so ignore this warning.`
14394
+ );
14395
+ }
14396
+ }
14397
+ }
14379
14398
  }
14380
14399
  _initialize(graphicsContextWebGL) {
14381
14400
  if (this._initialized) {
@@ -14412,6 +14431,9 @@ class Material {
14412
14431
  get isUsingScreenTexture() {
14413
14432
  return this._fragmentSource.includes("u_screen_texture");
14414
14433
  }
14434
+ get isOverridingGraphic() {
14435
+ return !!this._images.u_graphic;
14436
+ }
14415
14437
  update(callback) {
14416
14438
  if (this._shader) {
14417
14439
  this._shader.use();
@@ -14423,6 +14445,18 @@ class Material {
14423
14445
  }
14424
14446
  addImageSource(samplerName, image) {
14425
14447
  this._shader.addImageSource(samplerName, image);
14448
+ {
14449
+ if (this.images.u_graphic) {
14450
+ this._logger.warn(
14451
+ `Material named "${this.name}" is overriding built in image u_graphic, is this on purpose? If so ignore this warning.`
14452
+ );
14453
+ }
14454
+ if (this.images.u_screen_texture) {
14455
+ this._logger.warn(
14456
+ `Material named "${this.name}" is overriding built in image u_screen_texture, is this on purpose? If so ignore this warning.`
14457
+ );
14458
+ }
14459
+ }
14426
14460
  }
14427
14461
  removeImageSource(samplerName) {
14428
14462
  this._shader.removeImageSource(samplerName);
@@ -14435,7 +14469,19 @@ class Material {
14435
14469
  throw Error(`Material ${this.name} not yet initialized, use the ExcaliburGraphicsContext.createMaterial() to work around this.`);
14436
14470
  }
14437
14471
  }
14438
- }
14472
+ };
14473
+ _Material.BuiltInUniforms = [
14474
+ "u_time_ms",
14475
+ "u_opacity",
14476
+ "u_resolution",
14477
+ "u_graphic_resolution",
14478
+ "u_size",
14479
+ "u_matrix",
14480
+ "u_transform",
14481
+ "u_graphic",
14482
+ "u_screen_texture"
14483
+ ];
14484
+ let Material = _Material;
14439
14485
  const _Debug = class _Debug2 {
14440
14486
  static registerGraphicsContext(ctx) {
14441
14487
  _Debug2._ctx = ctx;
@@ -15551,7 +15597,7 @@ class MaterialRenderer {
15551
15597
  this._gl = null;
15552
15598
  }
15553
15599
  draw(image, sx, sy, swidth, sheight, dx, dy, dwidth, dheight) {
15554
- var _a, _b, _c, _d;
15600
+ var _a, _b, _c, _d, _e;
15555
15601
  const gl = this._gl;
15556
15602
  const material = this._context.material;
15557
15603
  if (!material) {
@@ -15616,7 +15662,7 @@ class MaterialRenderer {
15616
15662
  vertexBuffer[vertexIndex++] = uvy1;
15617
15663
  vertexBuffer[vertexIndex++] = screenUVX1;
15618
15664
  vertexBuffer[vertexIndex++] = screenUVY1;
15619
- const texture = this._addImageAsTexture(image);
15665
+ let texture = this._addImageAsTexture(image);
15620
15666
  material.use();
15621
15667
  this._layout.shader = shader;
15622
15668
  this._layout.use(true);
@@ -15627,6 +15673,11 @@ class MaterialRenderer {
15627
15673
  shader.trySetUniformFloatVector("u_size", vec(sw, sh));
15628
15674
  shader.trySetUniformMatrix("u_matrix", this._context.ortho);
15629
15675
  shader.trySetUniformMatrix("u_transform", transform.to4x4());
15676
+ if (material.isOverridingGraphic) {
15677
+ if ((_e = material.images.u_graphic) == null ? void 0 : _e.image) {
15678
+ texture = this._addImageAsTexture(material.images.u_graphic.image);
15679
+ }
15680
+ }
15630
15681
  gl.activeTexture(gl.TEXTURE0 + 0);
15631
15682
  gl.bindTexture(gl.TEXTURE_2D, texture);
15632
15683
  shader.trySetUniformInt("u_graphic", 0);
@@ -19412,7 +19463,9 @@ const _Actor = class _Actor2 extends Entity {
19412
19463
  anchor,
19413
19464
  offset,
19414
19465
  collisionType,
19415
- collisionGroup
19466
+ collisionGroup,
19467
+ graphic,
19468
+ material
19416
19469
  } = {
19417
19470
  ...config
19418
19471
  };
@@ -19483,6 +19536,12 @@ const _Actor = class _Actor2 extends Entity {
19483
19536
  }
19484
19537
  }
19485
19538
  this.graphics.isVisible = visible != null ? visible : true;
19539
+ if (graphic) {
19540
+ this.graphics.use(graphic);
19541
+ }
19542
+ if (material) {
19543
+ this.graphics.material = material;
19544
+ }
19486
19545
  }
19487
19546
  /**
19488
19547
  * Gets the position vector of the actor in pixels
@@ -33039,7 +33098,7 @@ class Semaphore {
33039
33098
  this._count += count;
33040
33099
  }
33041
33100
  }
33042
- const EX_VERSION = "0.32.0-alpha.1563+eadef91";
33101
+ const EX_VERSION = "0.32.0-alpha.1565+76be137";
33043
33102
  polyfill();
33044
33103
  export {
33045
33104
  ActionCompleteEvent,
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1563+eadef91 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1565+76be137 - 2025-11-24
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
@@ -14354,7 +14354,7 @@ void main() {
14354
14354
  v_screenuv = a_screenuv;
14355
14355
  }
14356
14356
  `;
14357
- class Material {
14357
+ const _Material = class _Material2 {
14358
14358
  constructor(options) {
14359
14359
  this._logger = Logger.getInstance();
14360
14360
  this._color = Color.Transparent;
@@ -14376,6 +14376,25 @@ class Material {
14376
14376
  } else {
14377
14377
  this._logger.warn(`Material ${name} was created in 2D Canvas mode, currently only WebGL is supported`);
14378
14378
  }
14379
+ {
14380
+ if (this.images.u_graphic) {
14381
+ this._logger.warn(
14382
+ `Material named "${this.name}" is overriding built in image u_graphic, is this on purpose? If so ignore this warning.`
14383
+ );
14384
+ }
14385
+ if (this.images.u_screen_texture) {
14386
+ this._logger.warn(
14387
+ `Material named "${this.name}" is overriding built in image u_screen_texture, is this on purpose? If so ignore this warning.`
14388
+ );
14389
+ }
14390
+ for (const uniform of Object.keys(this._uniforms)) {
14391
+ if (_Material2.BuiltInUniforms.includes(uniform)) {
14392
+ this._logger.warn(
14393
+ `Material named "${this.name}" is overriding built in uniform ${uniform}, is this on purpose? If so ignore this warning.`
14394
+ );
14395
+ }
14396
+ }
14397
+ }
14379
14398
  }
14380
14399
  _initialize(graphicsContextWebGL) {
14381
14400
  if (this._initialized) {
@@ -14412,6 +14431,9 @@ class Material {
14412
14431
  get isUsingScreenTexture() {
14413
14432
  return this._fragmentSource.includes("u_screen_texture");
14414
14433
  }
14434
+ get isOverridingGraphic() {
14435
+ return !!this._images.u_graphic;
14436
+ }
14415
14437
  update(callback) {
14416
14438
  if (this._shader) {
14417
14439
  this._shader.use();
@@ -14423,6 +14445,18 @@ class Material {
14423
14445
  }
14424
14446
  addImageSource(samplerName, image) {
14425
14447
  this._shader.addImageSource(samplerName, image);
14448
+ {
14449
+ if (this.images.u_graphic) {
14450
+ this._logger.warn(
14451
+ `Material named "${this.name}" is overriding built in image u_graphic, is this on purpose? If so ignore this warning.`
14452
+ );
14453
+ }
14454
+ if (this.images.u_screen_texture) {
14455
+ this._logger.warn(
14456
+ `Material named "${this.name}" is overriding built in image u_screen_texture, is this on purpose? If so ignore this warning.`
14457
+ );
14458
+ }
14459
+ }
14426
14460
  }
14427
14461
  removeImageSource(samplerName) {
14428
14462
  this._shader.removeImageSource(samplerName);
@@ -14435,7 +14469,19 @@ class Material {
14435
14469
  throw Error(`Material ${this.name} not yet initialized, use the ExcaliburGraphicsContext.createMaterial() to work around this.`);
14436
14470
  }
14437
14471
  }
14438
- }
14472
+ };
14473
+ _Material.BuiltInUniforms = [
14474
+ "u_time_ms",
14475
+ "u_opacity",
14476
+ "u_resolution",
14477
+ "u_graphic_resolution",
14478
+ "u_size",
14479
+ "u_matrix",
14480
+ "u_transform",
14481
+ "u_graphic",
14482
+ "u_screen_texture"
14483
+ ];
14484
+ let Material = _Material;
14439
14485
  const _Debug = class _Debug2 {
14440
14486
  static registerGraphicsContext(ctx) {
14441
14487
  _Debug2._ctx = ctx;
@@ -15551,7 +15597,7 @@ class MaterialRenderer {
15551
15597
  this._gl = null;
15552
15598
  }
15553
15599
  draw(image, sx, sy, swidth, sheight, dx, dy, dwidth, dheight) {
15554
- var _a, _b, _c, _d;
15600
+ var _a, _b, _c, _d, _e;
15555
15601
  const gl = this._gl;
15556
15602
  const material = this._context.material;
15557
15603
  if (!material) {
@@ -15616,7 +15662,7 @@ class MaterialRenderer {
15616
15662
  vertexBuffer[vertexIndex++] = uvy1;
15617
15663
  vertexBuffer[vertexIndex++] = screenUVX1;
15618
15664
  vertexBuffer[vertexIndex++] = screenUVY1;
15619
- const texture = this._addImageAsTexture(image);
15665
+ let texture = this._addImageAsTexture(image);
15620
15666
  material.use();
15621
15667
  this._layout.shader = shader;
15622
15668
  this._layout.use(true);
@@ -15627,6 +15673,11 @@ class MaterialRenderer {
15627
15673
  shader.trySetUniformFloatVector("u_size", vec(sw, sh));
15628
15674
  shader.trySetUniformMatrix("u_matrix", this._context.ortho);
15629
15675
  shader.trySetUniformMatrix("u_transform", transform.to4x4());
15676
+ if (material.isOverridingGraphic) {
15677
+ if ((_e = material.images.u_graphic) == null ? void 0 : _e.image) {
15678
+ texture = this._addImageAsTexture(material.images.u_graphic.image);
15679
+ }
15680
+ }
15630
15681
  gl.activeTexture(gl.TEXTURE0 + 0);
15631
15682
  gl.bindTexture(gl.TEXTURE_2D, texture);
15632
15683
  shader.trySetUniformInt("u_graphic", 0);
@@ -19412,7 +19463,9 @@ const _Actor = class _Actor2 extends Entity {
19412
19463
  anchor,
19413
19464
  offset,
19414
19465
  collisionType,
19415
- collisionGroup
19466
+ collisionGroup,
19467
+ graphic,
19468
+ material
19416
19469
  } = {
19417
19470
  ...config
19418
19471
  };
@@ -19483,6 +19536,12 @@ const _Actor = class _Actor2 extends Entity {
19483
19536
  }
19484
19537
  }
19485
19538
  this.graphics.isVisible = visible != null ? visible : true;
19539
+ if (graphic) {
19540
+ this.graphics.use(graphic);
19541
+ }
19542
+ if (material) {
19543
+ this.graphics.material = material;
19544
+ }
19486
19545
  }
19487
19546
  /**
19488
19547
  * Gets the position vector of the actor in pixels
@@ -33039,7 +33098,7 @@ class Semaphore {
33039
33098
  this._count += count;
33040
33099
  }
33041
33100
  }
33042
- const EX_VERSION = "0.32.0-alpha.1563+eadef91";
33101
+ const EX_VERSION = "0.32.0-alpha.1565+76be137";
33043
33102
  polyfill();
33044
33103
  export {
33045
33104
  ActionCompleteEvent,