@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/components/gsplat-component.d.ts +79 -0
- package/dist/index.d.ts +2 -2
- package/dist/pwc.cjs +63 -10
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +63 -10
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.mjs +63 -10
- package/dist/pwc.mjs.map +1 -1
- package/package.json +8 -8
- package/src/components/gsplat-component.ts +161 -0
- package/src/index.ts +2 -2
- package/dist/components/splat-component.d.ts +0 -48
- package/src/components/splat-component.ts +0 -102
package/dist/pwc.mjs
CHANGED
|
@@ -4363,29 +4363,33 @@ class SoundSlotElement extends AsyncElement {
|
|
|
4363
4363
|
customElements.define('pc-sound', SoundSlotElement);
|
|
4364
4364
|
|
|
4365
4365
|
/**
|
|
4366
|
-
* The
|
|
4367
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-
|
|
4368
|
-
* The
|
|
4366
|
+
* The GSplatComponentElement interface provides properties and methods for manipulating
|
|
4367
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-gsplat/ | `<pc-gsplat>`} elements.
|
|
4368
|
+
* The GSplatComponentElement interface also inherits the properties and methods of the
|
|
4369
4369
|
* {@link HTMLElement} interface.
|
|
4370
4370
|
*
|
|
4371
4371
|
* @category Components
|
|
4372
4372
|
*/
|
|
4373
|
-
class
|
|
4373
|
+
class GSplatComponentElement extends ComponentElement {
|
|
4374
4374
|
/** @ignore */
|
|
4375
4375
|
constructor() {
|
|
4376
4376
|
super('gsplat');
|
|
4377
4377
|
this._asset = '';
|
|
4378
4378
|
this._castShadows = false;
|
|
4379
|
+
this._lodBaseDistance = 5;
|
|
4380
|
+
this._lodMultiplier = 3;
|
|
4379
4381
|
}
|
|
4380
4382
|
getInitialComponentData() {
|
|
4381
4383
|
return {
|
|
4382
4384
|
asset: AssetElement.get(this._asset),
|
|
4383
|
-
castShadows: this._castShadows
|
|
4385
|
+
castShadows: this._castShadows,
|
|
4386
|
+
lodBaseDistance: this._lodBaseDistance,
|
|
4387
|
+
lodMultiplier: this._lodMultiplier
|
|
4384
4388
|
};
|
|
4385
4389
|
}
|
|
4386
4390
|
/**
|
|
4387
|
-
* Gets the underlying PlayCanvas
|
|
4388
|
-
* @returns The
|
|
4391
|
+
* Gets the underlying PlayCanvas gsplat component.
|
|
4392
|
+
* @returns The gsplat component.
|
|
4389
4393
|
*/
|
|
4390
4394
|
get component() {
|
|
4391
4395
|
return super.component;
|
|
@@ -4425,11 +4429,54 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4425
4429
|
get castShadows() {
|
|
4426
4430
|
return this._castShadows;
|
|
4427
4431
|
}
|
|
4432
|
+
/**
|
|
4433
|
+
* Sets the base distance for the first LOD transition (LOD 0 to LOD 1). Splats closer than
|
|
4434
|
+
* this distance use the highest quality LOD. Each subsequent LOD level transitions at a
|
|
4435
|
+
* progressively larger distance, controlled by {@link lodMultiplier}. Clamped to a minimum of
|
|
4436
|
+
* 0.1. Defaults to 5. Only affects assets that contain LOD levels (e.g. `.lod-meta.json`).
|
|
4437
|
+
* @param value - The LOD base distance.
|
|
4438
|
+
*/
|
|
4439
|
+
set lodBaseDistance(value) {
|
|
4440
|
+
this._lodBaseDistance = value;
|
|
4441
|
+
if (this.component) {
|
|
4442
|
+
this.component.lodBaseDistance = value;
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
/**
|
|
4446
|
+
* Gets the base distance for the first LOD transition.
|
|
4447
|
+
* @returns The LOD base distance.
|
|
4448
|
+
*/
|
|
4449
|
+
get lodBaseDistance() {
|
|
4450
|
+
return this._lodBaseDistance;
|
|
4451
|
+
}
|
|
4452
|
+
/**
|
|
4453
|
+
* Sets the multiplier between successive LOD distance thresholds. Each LOD level transitions
|
|
4454
|
+
* at this factor times the previous level's distance, creating a geometric progression. Lower
|
|
4455
|
+
* values keep higher quality at distance; higher values switch to coarser LODs sooner. Clamped
|
|
4456
|
+
* to a minimum of 1.2. Defaults to 3. Only affects assets that contain LOD levels (e.g.
|
|
4457
|
+
* `.lod-meta.json`).
|
|
4458
|
+
* @param value - The LOD multiplier.
|
|
4459
|
+
*/
|
|
4460
|
+
set lodMultiplier(value) {
|
|
4461
|
+
this._lodMultiplier = value;
|
|
4462
|
+
if (this.component) {
|
|
4463
|
+
this.component.lodMultiplier = value;
|
|
4464
|
+
}
|
|
4465
|
+
}
|
|
4466
|
+
/**
|
|
4467
|
+
* Gets the multiplier between successive LOD distance thresholds.
|
|
4468
|
+
* @returns The LOD multiplier.
|
|
4469
|
+
*/
|
|
4470
|
+
get lodMultiplier() {
|
|
4471
|
+
return this._lodMultiplier;
|
|
4472
|
+
}
|
|
4428
4473
|
static get observedAttributes() {
|
|
4429
4474
|
return [
|
|
4430
4475
|
...super.observedAttributes,
|
|
4431
4476
|
'asset',
|
|
4432
|
-
'cast-shadows'
|
|
4477
|
+
'cast-shadows',
|
|
4478
|
+
'lod-base-distance',
|
|
4479
|
+
'lod-multiplier'
|
|
4433
4480
|
];
|
|
4434
4481
|
}
|
|
4435
4482
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
@@ -4441,10 +4488,16 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4441
4488
|
case 'cast-shadows':
|
|
4442
4489
|
this.castShadows = this.hasAttribute('cast-shadows');
|
|
4443
4490
|
break;
|
|
4491
|
+
case 'lod-base-distance':
|
|
4492
|
+
this.lodBaseDistance = Number(newValue);
|
|
4493
|
+
break;
|
|
4494
|
+
case 'lod-multiplier':
|
|
4495
|
+
this.lodMultiplier = Number(newValue);
|
|
4496
|
+
break;
|
|
4444
4497
|
}
|
|
4445
4498
|
}
|
|
4446
4499
|
}
|
|
4447
|
-
customElements.define('pc-
|
|
4500
|
+
customElements.define('pc-gsplat', GSplatComponentElement);
|
|
4448
4501
|
|
|
4449
4502
|
/**
|
|
4450
4503
|
* The ModelElement interface provides properties and methods for manipulating
|
|
@@ -4982,5 +5035,5 @@ class SkyElement extends AsyncElement {
|
|
|
4982
5035
|
}
|
|
4983
5036
|
customElements.define('pc-sky', SkyElement);
|
|
4984
5037
|
|
|
4985
|
-
export { AppElement, AssetElement, AsyncElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, EntityElement, LightComponentElement, ListenerComponentElement, MaterialElement, ModelElement, ModuleElement, ParticleSystemComponentElement, RenderComponentElement, RigidBodyComponentElement, SceneElement, ScreenComponentElement, ScriptComponentElement, ScriptElement, SkyElement, SoundComponentElement, SoundSlotElement
|
|
5038
|
+
export { AppElement, AssetElement, AsyncElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, EntityElement, GSplatComponentElement, LightComponentElement, ListenerComponentElement, MaterialElement, ModelElement, ModuleElement, ParticleSystemComponentElement, RenderComponentElement, RigidBodyComponentElement, SceneElement, ScreenComponentElement, ScriptComponentElement, ScriptElement, SkyElement, SoundComponentElement, SoundSlotElement };
|
|
4986
5039
|
//# sourceMappingURL=pwc.mjs.map
|