@playcanvas/web-components 0.5.0 → 0.6.0

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/pwc.js CHANGED
@@ -4367,29 +4367,33 @@
4367
4367
  customElements.define('pc-sound', SoundSlotElement);
4368
4368
 
4369
4369
  /**
4370
- * The SplatComponentElement interface provides properties and methods for manipulating
4371
- * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
4372
- * The SplatComponentElement interface also inherits the properties and methods of the
4370
+ * The GSplatComponentElement interface provides properties and methods for manipulating
4371
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-gsplat/ | `<pc-gsplat>`} elements.
4372
+ * The GSplatComponentElement interface also inherits the properties and methods of the
4373
4373
  * {@link HTMLElement} interface.
4374
4374
  *
4375
4375
  * @category Components
4376
4376
  */
4377
- class SplatComponentElement extends ComponentElement {
4377
+ class GSplatComponentElement extends ComponentElement {
4378
4378
  /** @ignore */
4379
4379
  constructor() {
4380
4380
  super('gsplat');
4381
4381
  this._asset = '';
4382
4382
  this._castShadows = false;
4383
+ this._lodBaseDistance = 5;
4384
+ this._lodMultiplier = 3;
4383
4385
  }
4384
4386
  getInitialComponentData() {
4385
4387
  return {
4386
4388
  asset: AssetElement.get(this._asset),
4387
- castShadows: this._castShadows
4389
+ castShadows: this._castShadows,
4390
+ lodBaseDistance: this._lodBaseDistance,
4391
+ lodMultiplier: this._lodMultiplier
4388
4392
  };
4389
4393
  }
4390
4394
  /**
4391
- * Gets the underlying PlayCanvas splat component.
4392
- * @returns The splat component.
4395
+ * Gets the underlying PlayCanvas gsplat component.
4396
+ * @returns The gsplat component.
4393
4397
  */
4394
4398
  get component() {
4395
4399
  return super.component;
@@ -4429,11 +4433,54 @@
4429
4433
  get castShadows() {
4430
4434
  return this._castShadows;
4431
4435
  }
4436
+ /**
4437
+ * Sets the base distance for the first LOD transition (LOD 0 to LOD 1). Splats closer than
4438
+ * this distance use the highest quality LOD. Each subsequent LOD level transitions at a
4439
+ * progressively larger distance, controlled by {@link lodMultiplier}. Clamped to a minimum of
4440
+ * 0.1. Defaults to 5. Only affects assets that contain LOD levels (e.g. `.lod-meta.json`).
4441
+ * @param value - The LOD base distance.
4442
+ */
4443
+ set lodBaseDistance(value) {
4444
+ this._lodBaseDistance = value;
4445
+ if (this.component) {
4446
+ this.component.lodBaseDistance = value;
4447
+ }
4448
+ }
4449
+ /**
4450
+ * Gets the base distance for the first LOD transition.
4451
+ * @returns The LOD base distance.
4452
+ */
4453
+ get lodBaseDistance() {
4454
+ return this._lodBaseDistance;
4455
+ }
4456
+ /**
4457
+ * Sets the multiplier between successive LOD distance thresholds. Each LOD level transitions
4458
+ * at this factor times the previous level's distance, creating a geometric progression. Lower
4459
+ * values keep higher quality at distance; higher values switch to coarser LODs sooner. Clamped
4460
+ * to a minimum of 1.2. Defaults to 3. Only affects assets that contain LOD levels (e.g.
4461
+ * `.lod-meta.json`).
4462
+ * @param value - The LOD multiplier.
4463
+ */
4464
+ set lodMultiplier(value) {
4465
+ this._lodMultiplier = value;
4466
+ if (this.component) {
4467
+ this.component.lodMultiplier = value;
4468
+ }
4469
+ }
4470
+ /**
4471
+ * Gets the multiplier between successive LOD distance thresholds.
4472
+ * @returns The LOD multiplier.
4473
+ */
4474
+ get lodMultiplier() {
4475
+ return this._lodMultiplier;
4476
+ }
4432
4477
  static get observedAttributes() {
4433
4478
  return [
4434
4479
  ...super.observedAttributes,
4435
4480
  'asset',
4436
- 'cast-shadows'
4481
+ 'cast-shadows',
4482
+ 'lod-base-distance',
4483
+ 'lod-multiplier'
4437
4484
  ];
4438
4485
  }
4439
4486
  attributeChangedCallback(name, _oldValue, newValue) {
@@ -4445,10 +4492,16 @@
4445
4492
  case 'cast-shadows':
4446
4493
  this.castShadows = this.hasAttribute('cast-shadows');
4447
4494
  break;
4495
+ case 'lod-base-distance':
4496
+ this.lodBaseDistance = Number(newValue);
4497
+ break;
4498
+ case 'lod-multiplier':
4499
+ this.lodMultiplier = Number(newValue);
4500
+ break;
4448
4501
  }
4449
4502
  }
4450
4503
  }
4451
- customElements.define('pc-splat', SplatComponentElement);
4504
+ customElements.define('pc-gsplat', GSplatComponentElement);
4452
4505
 
4453
4506
  /**
4454
4507
  * The ModelElement interface provides properties and methods for manipulating
@@ -4994,6 +5047,7 @@
4994
5047
  exports.ComponentElement = ComponentElement;
4995
5048
  exports.ElementComponentElement = ElementComponentElement;
4996
5049
  exports.EntityElement = EntityElement;
5050
+ exports.GSplatComponentElement = GSplatComponentElement;
4997
5051
  exports.LightComponentElement = LightComponentElement;
4998
5052
  exports.ListenerComponentElement = ListenerComponentElement;
4999
5053
  exports.MaterialElement = MaterialElement;
@@ -5009,7 +5063,6 @@
5009
5063
  exports.SkyElement = SkyElement;
5010
5064
  exports.SoundComponentElement = SoundComponentElement;
5011
5065
  exports.SoundSlotElement = SoundSlotElement;
5012
- exports.SplatComponentElement = SplatComponentElement;
5013
5066
 
5014
5067
  }));
5015
5068
  //# sourceMappingURL=pwc.js.map