@playcanvas/web-components 0.17.0 → 0.18.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/README.md +5 -3
- package/dist/app.d.cts +4 -0
- package/dist/app.d.ts +4 -0
- package/dist/asset.d.cts +13 -3
- package/dist/asset.d.ts +13 -3
- package/dist/components/anim-clip.d.cts +4 -0
- package/dist/components/anim-clip.d.ts +4 -0
- package/dist/components/anim-component.d.cts +5 -0
- package/dist/components/anim-component.d.ts +5 -0
- package/dist/components/audio-listener-component.d.cts +4 -0
- package/dist/components/audio-listener-component.d.ts +4 -0
- package/dist/components/button-component.d.cts +5 -0
- package/dist/components/button-component.d.ts +5 -0
- package/dist/components/camera-component.d.cts +35 -1
- package/dist/components/camera-component.d.ts +35 -1
- package/dist/components/collision-component.d.cts +4 -0
- package/dist/components/collision-component.d.ts +4 -0
- package/dist/components/element-component.d.cts +4 -0
- package/dist/components/element-component.d.ts +4 -0
- package/dist/components/gsplat-component.d.cts +4 -0
- package/dist/components/gsplat-component.d.ts +4 -0
- package/dist/components/joint-component.d.cts +12 -2
- package/dist/components/joint-component.d.ts +12 -2
- package/dist/components/layout-child-component.d.cts +4 -0
- package/dist/components/layout-child-component.d.ts +4 -0
- package/dist/components/layout-group-component.d.cts +4 -0
- package/dist/components/layout-group-component.d.ts +4 -0
- package/dist/components/light-component.d.cts +50 -1
- package/dist/components/light-component.d.ts +50 -1
- package/dist/components/particle-system-component.d.cts +4 -0
- package/dist/components/particle-system-component.d.ts +4 -0
- package/dist/components/render-component.d.cts +5 -0
- package/dist/components/render-component.d.ts +5 -0
- package/dist/components/rigid-body-component.d.cts +5 -0
- package/dist/components/rigid-body-component.d.ts +5 -0
- package/dist/components/screen-component.d.cts +4 -0
- package/dist/components/screen-component.d.ts +4 -0
- package/dist/components/script-component.d.cts +3 -0
- package/dist/components/script-component.d.ts +3 -0
- package/dist/components/script-instance.d.cts +4 -0
- package/dist/components/script-instance.d.ts +4 -0
- package/dist/components/scroll-view-component.d.cts +4 -0
- package/dist/components/scroll-view-component.d.ts +4 -0
- package/dist/components/scrollbar-component.d.cts +4 -0
- package/dist/components/scrollbar-component.d.ts +4 -0
- package/dist/components/sound-component.d.cts +4 -0
- package/dist/components/sound-component.d.ts +4 -0
- package/dist/components/sound-slot.d.cts +3 -0
- package/dist/components/sound-slot.d.ts +3 -0
- package/dist/custom-elements.json +268 -7
- package/dist/entity-base.d.cts +1 -1
- package/dist/entity-base.d.ts +1 -1
- package/dist/entity-owner.d.cts +2 -2
- package/dist/entity-owner.d.ts +2 -2
- package/dist/entity.d.cts +6 -1
- package/dist/entity.d.ts +6 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/material.d.cts +18 -7
- package/dist/material.d.ts +18 -7
- package/dist/model.d.cts +5 -0
- package/dist/model.d.ts +5 -0
- package/dist/node.d.cts +6 -1
- package/dist/node.d.ts +6 -1
- package/dist/pwc.cjs +284 -28
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +284 -28
- 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.min.mjs +1 -1
- package/dist/pwc.min.mjs.map +1 -1
- package/dist/pwc.mjs +285 -29
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.cts +3 -0
- package/dist/scene.d.ts +3 -0
- package/dist/sky.d.cts +4 -0
- package/dist/sky.d.ts +4 -0
- package/dist/vscode.html-custom-data.json +237 -62
- package/dist/wasm.d.cts +4 -0
- package/dist/wasm.d.ts +4 -0
- package/dist/web-types.json +115 -69
- package/package.json +1 -1
- package/src/app.ts +4 -0
- package/src/asset.ts +13 -4
- package/src/components/anim-clip.ts +4 -0
- package/src/components/anim-component.ts +5 -0
- package/src/components/audio-listener-component.ts +4 -0
- package/src/components/button-component.ts +5 -0
- package/src/components/camera-component.ts +63 -6
- package/src/components/collision-component.ts +4 -0
- package/src/components/element-component.ts +4 -0
- package/src/components/gsplat-component.ts +4 -0
- package/src/components/joint-component.ts +12 -2
- package/src/components/layout-child-component.ts +4 -0
- package/src/components/layout-group-component.ts +4 -0
- package/src/components/light-component.ts +108 -17
- package/src/components/particle-system-component.ts +4 -0
- package/src/components/render-component.ts +5 -0
- package/src/components/rigid-body-component.ts +5 -0
- package/src/components/screen-component.ts +4 -0
- package/src/components/script-component.ts +3 -0
- package/src/components/script-instance.ts +4 -0
- package/src/components/scroll-view-component.ts +4 -0
- package/src/components/scrollbar-component.ts +4 -0
- package/src/components/sound-component.ts +4 -0
- package/src/components/sound-slot.ts +3 -0
- package/src/entity-base.ts +2 -2
- package/src/entity-owner.ts +2 -2
- package/src/entity.ts +6 -1
- package/src/index.ts +12 -1
- package/src/material.ts +19 -8
- package/src/model.ts +5 -0
- package/src/node.ts +6 -1
- package/src/scene.ts +3 -0
- package/src/sky.ts +4 -0
- package/src/wasm.ts +4 -0
package/dist/pwc.cjs
CHANGED
|
@@ -123,6 +123,10 @@ async function whenReady(target) {
|
|
|
123
123
|
* A `<pc-wasm>` without a `name` warns and never becomes ready; a containing `<pc-app>` still
|
|
124
124
|
* boots.
|
|
125
125
|
*
|
|
126
|
+
* @elementSummary The `<pc-wasm>` element loads a WebAssembly module the engine needs before the
|
|
127
|
+
* application starts — `Ammo` for physics, `Basis` or `DracoDecoderModule` for compressed assets.
|
|
128
|
+
* Must be a direct child of `<pc-app>`.
|
|
129
|
+
*
|
|
126
130
|
* @attribute {string} name - The name of the WebAssembly module to configure, e.g. `Basis` or
|
|
127
131
|
* `Ammo`.
|
|
128
132
|
* @attribute {string} glue - The URL of the module's glue script.
|
|
@@ -764,6 +768,10 @@ const ensureBaseStyles = () => {
|
|
|
764
768
|
* tracked live via a ResizeObserver — so the element can be embedded at any size, resized by
|
|
765
769
|
* its container, or made fullscreen with ordinary CSS such as `width: 100vw; height: 100dvh`.
|
|
766
770
|
*
|
|
771
|
+
* @elementSummary The `<pc-app>` element creates a PlayCanvas application and the canvas it renders
|
|
772
|
+
* into, and is the root of every scene. It holds the `<pc-asset>`, `<pc-material>`, `<pc-wasm>` and
|
|
773
|
+
* `<pc-scene>` elements, and the page's CSS sizes it, as it would a `<video>`.
|
|
774
|
+
*
|
|
767
775
|
* @fires {ProgressEvent} progress - Fired while the application preloads its assets. `loaded` and
|
|
768
776
|
* `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded.
|
|
769
777
|
* Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does
|
|
@@ -1702,7 +1710,7 @@ class EntityBaseElement extends AsyncElement {
|
|
|
1702
1710
|
* Tracks whether an inline `onpointer*` attribute is present. The browser itself compiles and
|
|
1703
1711
|
* runs these attributes — they are standard `GlobalEventHandlers`, so setting one replaces
|
|
1704
1712
|
* the previous handler and removing it removes the handler, exactly like `onclick` on any
|
|
1705
|
-
* HTML element. But because they bypass {@link addEventListener}, the connect/disconnect
|
|
1713
|
+
* HTML element. But because they bypass {@link EventTarget.addEventListener}, the connect/disconnect
|
|
1706
1714
|
* bookkeeping that lets the application lazily attach its canvas pointer handlers must be
|
|
1707
1715
|
* kept in sync here.
|
|
1708
1716
|
*
|
|
@@ -1743,7 +1751,7 @@ class EntityBaseElement extends AsyncElement {
|
|
|
1743
1751
|
}
|
|
1744
1752
|
/**
|
|
1745
1753
|
* Whether the element has a listener for an event type, registered either with
|
|
1746
|
-
* {@link addEventListener} or with the matching inline `onpointer*` attribute. Read by the
|
|
1754
|
+
* {@link EventTarget.addEventListener} or with the matching inline `onpointer*` attribute. Read by the
|
|
1747
1755
|
* containing `<pc-app>` element to gate pointer event synthesis.
|
|
1748
1756
|
*
|
|
1749
1757
|
* @param type - The event type.
|
|
@@ -1812,7 +1820,7 @@ class EntityOwnerElement extends EntityBaseElement {
|
|
|
1812
1820
|
*/
|
|
1813
1821
|
_tags = [];
|
|
1814
1822
|
/**
|
|
1815
|
-
* Whether the hierarchy has been built for this entity — set once
|
|
1823
|
+
* Whether the hierarchy has been built for this entity — set once `_buildHierarchy` has
|
|
1816
1824
|
* parented it. Read by subclasses that gate work on the entity being in the scene graph.
|
|
1817
1825
|
*/
|
|
1818
1826
|
_built = false;
|
|
@@ -1901,7 +1909,7 @@ class EntityOwnerElement extends EntityBaseElement {
|
|
|
1901
1909
|
this._onBuilt();
|
|
1902
1910
|
}
|
|
1903
1911
|
/**
|
|
1904
|
-
* Called by
|
|
1912
|
+
* Called by `_buildHierarchy` once the backing entity has been parented — exactly once
|
|
1905
1913
|
* per build cycle. The default announces readiness, which is what a parented `<pc-entity>`
|
|
1906
1914
|
* means; `<pc-model>` overrides it to start loading content instead, because its readiness
|
|
1907
1915
|
* tracks the content settling rather than the host entering the scene graph.
|
|
@@ -2022,9 +2030,14 @@ class EntityOwnerElement extends EntityBaseElement {
|
|
|
2022
2030
|
*
|
|
2023
2031
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
2024
2032
|
* intersects this entity's geometry. They are only generated while the entity has a listener for
|
|
2025
|
-
* them, registered either with {@link addEventListener} or with the matching inline `onpointer*`
|
|
2033
|
+
* them, registered either with {@link EventTarget.addEventListener} or with the matching inline `onpointer*`
|
|
2026
2034
|
* attribute.
|
|
2027
2035
|
*
|
|
2036
|
+
* @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
|
|
2037
|
+
* scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
|
|
2038
|
+
* `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
|
|
2039
|
+
* `<pc-model>` or a `<pc-node>` to parent it there.
|
|
2040
|
+
*
|
|
2028
2041
|
* @attribute {boolean} enabled - The enabled state of the entity.
|
|
2029
2042
|
* @attribute {string} name - The name of the entity.
|
|
2030
2043
|
* @attribute {string} position - The position of the entity.
|
|
@@ -2405,6 +2418,10 @@ const processBufferView = (gltfBuffer, buffers, continuation) => {
|
|
|
2405
2418
|
* Apart from `lazy` and the texture options, these attributes are read once when the asset is
|
|
2406
2419
|
* created, so changing them later has no effect.
|
|
2407
2420
|
*
|
|
2421
|
+
* @elementSummary The `<pc-asset>` element declares an asset for the application to load — a model,
|
|
2422
|
+
* texture, font, sound, script or JSON file — under an `id` that other elements reference. Must be
|
|
2423
|
+
* a direct child of `<pc-app>`.
|
|
2424
|
+
*
|
|
2408
2425
|
* @attribute {string} id - The identifier used to reference the asset from other elements.
|
|
2409
2426
|
* @attribute {string} src - The URL of the asset to load.
|
|
2410
2427
|
* @attribute {string} type - The asset type. Inferred from the `src` file extension when omitted.
|
|
@@ -3031,6 +3048,11 @@ const formatHierarchy = (root, counts) => {
|
|
|
3031
3048
|
* intersects the model's geometry, exactly as for `<pc-entity>` — a hit on a content node that no
|
|
3032
3049
|
* `pc-node` fronts resolves to this element.
|
|
3033
3050
|
*
|
|
3051
|
+
* @elementSummary The `<pc-model>` element instantiates a 3D model from a container asset
|
|
3052
|
+
* (typically a GLB) beneath an entity of its own, so the element's transform and tags place the
|
|
3053
|
+
* instance in the scene. Its `<pc-node>` children override what the asset authored. Place it in the
|
|
3054
|
+
* `<pc-scene>`, or nest it under a `<pc-entity>`, another `<pc-model>` or a `<pc-node>`.
|
|
3055
|
+
*
|
|
3034
3056
|
* @attribute {boolean} enabled - The enabled state of the model.
|
|
3035
3057
|
* @attribute {string} name - The name of the model.
|
|
3036
3058
|
* @attribute {string} position - The position of the model.
|
|
@@ -3564,6 +3586,11 @@ class ComponentElement extends AsyncElement {
|
|
|
3564
3586
|
*
|
|
3565
3587
|
* Engine component: {@link AnimComponent} (`anim`).
|
|
3566
3588
|
*
|
|
3589
|
+
* @elementSummary The `<pc-anim>` element plays animation clips over its entity's hierarchy, taken
|
|
3590
|
+
* from `<pc-anim-clip>` children or from the enclosing `<pc-model>`'s own animations. The first
|
|
3591
|
+
* clip plays automatically, and the `clip` attribute switches between them. Must be a child of a
|
|
3592
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
3593
|
+
*
|
|
3567
3594
|
* @category Components
|
|
3568
3595
|
*/
|
|
3569
3596
|
class AnimComponentElement extends ComponentElement {
|
|
@@ -4182,6 +4209,10 @@ customElements.define('pc-anim', AnimComponentElement);
|
|
|
4182
4209
|
* named; in a multi-track source the track named `name` is chosen, falling back to the first
|
|
4183
4210
|
* with a warning. The element becomes ready once its resolved track is assigned.
|
|
4184
4211
|
*
|
|
4212
|
+
* @elementSummary The `<pc-anim-clip>` element declares one named animation clip on its parent
|
|
4213
|
+
* `<pc-anim>`, taken from the `asset` it names or, without one, from the enclosing `<pc-model>`'s
|
|
4214
|
+
* own animations. Must be a direct child of `<pc-anim>`.
|
|
4215
|
+
*
|
|
4185
4216
|
* @category Components
|
|
4186
4217
|
*/
|
|
4187
4218
|
class AnimClipElement extends AsyncElement {
|
|
@@ -4510,6 +4541,10 @@ customElements.define('pc-anim-clip', AnimClipElement);
|
|
|
4510
4541
|
*
|
|
4511
4542
|
* Engine component: {@link AudioListenerComponent} (`audiolistener`).
|
|
4512
4543
|
*
|
|
4544
|
+
* @elementSummary The `<pc-audio-listener>` element makes its entity the point from which
|
|
4545
|
+
* positional sounds are heard, typically the entity holding the `<pc-camera>`. Must be a child of a
|
|
4546
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
4547
|
+
*
|
|
4513
4548
|
* @category Components
|
|
4514
4549
|
*/
|
|
4515
4550
|
class AudioListenerComponentElement extends ComponentElement {
|
|
@@ -4539,6 +4574,11 @@ const transitionModes = new Map([
|
|
|
4539
4574
|
*
|
|
4540
4575
|
* Engine component: {@link ButtonComponent} (`button`).
|
|
4541
4576
|
*
|
|
4577
|
+
* @elementSummary The `<pc-button>` element makes its entity respond to pointer input, tinting or
|
|
4578
|
+
* swapping its image as the pointer hovers, presses and releases it. The entity also needs a
|
|
4579
|
+
* `<pc-element>` with `use-input` set. Must be a child of a `<pc-entity>`, `<pc-model>` or
|
|
4580
|
+
* `<pc-node>`.
|
|
4581
|
+
*
|
|
4542
4582
|
* @category Components
|
|
4543
4583
|
*/
|
|
4544
4584
|
class ButtonComponentElement extends ComponentElement {
|
|
@@ -4942,13 +4982,18 @@ const tonemaps = new Map([
|
|
|
4942
4982
|
*
|
|
4943
4983
|
* Engine component: {@link CameraComponent} (`camera`).
|
|
4944
4984
|
*
|
|
4985
|
+
* @elementSummary The `<pc-camera>` element renders the scene from its entity's transform, with
|
|
4986
|
+
* attributes for the projection, field of view, clip planes, clear color and tonemapping. Must be a
|
|
4987
|
+
* child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
4988
|
+
*
|
|
4945
4989
|
* @category Components
|
|
4946
4990
|
*/
|
|
4947
4991
|
class CameraComponentElement extends ComponentElement {
|
|
4948
4992
|
_clearColor = new playcanvas.Color(0.75, 0.75, 0.75, 1);
|
|
4949
4993
|
_clearColorBuffer = true;
|
|
4994
|
+
_clearDepth = 1;
|
|
4950
4995
|
_clearDepthBuffer = true;
|
|
4951
|
-
_clearStencilBuffer =
|
|
4996
|
+
_clearStencilBuffer = true;
|
|
4952
4997
|
_cullFaces = true;
|
|
4953
4998
|
_farClip = 1000;
|
|
4954
4999
|
_flipFaces = false;
|
|
@@ -4971,6 +5016,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
4971
5016
|
return {
|
|
4972
5017
|
clearColor: this._clearColor,
|
|
4973
5018
|
clearColorBuffer: this._clearColorBuffer,
|
|
5019
|
+
clearDepth: this._clearDepth,
|
|
4974
5020
|
clearDepthBuffer: this._clearDepthBuffer,
|
|
4975
5021
|
clearStencilBuffer: this._clearStencilBuffer,
|
|
4976
5022
|
cullFaces: this._cullFaces,
|
|
@@ -4989,9 +5035,31 @@ class CameraComponentElement extends ComponentElement {
|
|
|
4989
5035
|
toneMapping: tonemaps.get(this._tonemap) ?? playcanvas.TONEMAP_NONE
|
|
4990
5036
|
};
|
|
4991
5037
|
}
|
|
4992
|
-
|
|
5038
|
+
/**
|
|
5039
|
+
* Whether immersive AR is available. Independent of {@link vrAvailable}: a device can offer
|
|
5040
|
+
* either mode without the other.
|
|
5041
|
+
* @returns Whether immersive AR is available.
|
|
5042
|
+
*/
|
|
5043
|
+
get arAvailable() {
|
|
5044
|
+
return this._available(playcanvas.XRTYPE_AR);
|
|
5045
|
+
}
|
|
5046
|
+
/**
|
|
5047
|
+
* Whether immersive VR is available. Independent of {@link arAvailable}: a device can offer
|
|
5048
|
+
* either mode without the other.
|
|
5049
|
+
* @returns Whether immersive VR is available.
|
|
5050
|
+
*/
|
|
5051
|
+
get vrAvailable() {
|
|
5052
|
+
return this._available(playcanvas.XRTYPE_VR);
|
|
5053
|
+
}
|
|
5054
|
+
/**
|
|
5055
|
+
* Whether one XR session type is available on this device.
|
|
5056
|
+
*
|
|
5057
|
+
* @param type - The XR session type to test.
|
|
5058
|
+
* @returns Whether that type is available.
|
|
5059
|
+
*/
|
|
5060
|
+
_available(type) {
|
|
4993
5061
|
const xrManager = this.component?.system.app.xr;
|
|
4994
|
-
return xrManager
|
|
5062
|
+
return Boolean(xrManager?.supported && xrManager.isAvailable(type));
|
|
4995
5063
|
}
|
|
4996
5064
|
/**
|
|
4997
5065
|
* Starts the camera in XR mode.
|
|
@@ -4999,11 +5067,13 @@ class CameraComponentElement extends ComponentElement {
|
|
|
4999
5067
|
* @param space - The space to start the camera in.
|
|
5000
5068
|
*/
|
|
5001
5069
|
startXr(type, space) {
|
|
5002
|
-
|
|
5070
|
+
// Gated on the mode being started, not on XR in general: a device that offers only
|
|
5071
|
+
// one of the two would otherwise accept a session it cannot serve
|
|
5072
|
+
if (this.component && this._available(type)) {
|
|
5003
5073
|
this.component.startXr(type, space, {
|
|
5004
5074
|
callback: (err) => {
|
|
5005
5075
|
if (err)
|
|
5006
|
-
console.error(`WebXR
|
|
5076
|
+
console.error(`WebXR ${type} failed to start: ${err.message}`);
|
|
5007
5077
|
}
|
|
5008
5078
|
});
|
|
5009
5079
|
}
|
|
@@ -5057,6 +5127,23 @@ class CameraComponentElement extends ComponentElement {
|
|
|
5057
5127
|
get clearColorBuffer() {
|
|
5058
5128
|
return this._clearColorBuffer;
|
|
5059
5129
|
}
|
|
5130
|
+
/**
|
|
5131
|
+
* Sets the depth value the depth buffer is cleared to. Defaults to 1.
|
|
5132
|
+
* @param value - The clear depth value.
|
|
5133
|
+
*/
|
|
5134
|
+
set clearDepth(value) {
|
|
5135
|
+
this._clearDepth = value;
|
|
5136
|
+
if (this.component) {
|
|
5137
|
+
this.component.clearDepth = value;
|
|
5138
|
+
}
|
|
5139
|
+
}
|
|
5140
|
+
/**
|
|
5141
|
+
* Gets the depth value the depth buffer is cleared to.
|
|
5142
|
+
* @returns The clear depth value.
|
|
5143
|
+
*/
|
|
5144
|
+
get clearDepth() {
|
|
5145
|
+
return this._clearDepth;
|
|
5146
|
+
}
|
|
5060
5147
|
/**
|
|
5061
5148
|
* Sets the clear depth buffer of the camera.
|
|
5062
5149
|
* @param value - The clear depth buffer.
|
|
@@ -5335,6 +5422,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
5335
5422
|
...super.observedAttributes,
|
|
5336
5423
|
'clear-color',
|
|
5337
5424
|
'clear-color-buffer',
|
|
5425
|
+
'clear-depth',
|
|
5338
5426
|
'clear-depth-buffer',
|
|
5339
5427
|
'clear-stencil-buffer',
|
|
5340
5428
|
'cull-faces',
|
|
@@ -5362,11 +5450,14 @@ class CameraComponentElement extends ComponentElement {
|
|
|
5362
5450
|
case 'clear-color-buffer':
|
|
5363
5451
|
this.clearColorBuffer = parseBool(newValue, true);
|
|
5364
5452
|
break;
|
|
5453
|
+
case 'clear-depth':
|
|
5454
|
+
this.clearDepth = parseNumber(newValue, 1, name);
|
|
5455
|
+
break;
|
|
5365
5456
|
case 'clear-depth-buffer':
|
|
5366
5457
|
this.clearDepthBuffer = parseBool(newValue, true);
|
|
5367
5458
|
break;
|
|
5368
5459
|
case 'clear-stencil-buffer':
|
|
5369
|
-
this.clearStencilBuffer = parseBool(newValue,
|
|
5460
|
+
this.clearStencilBuffer = parseBool(newValue, true);
|
|
5370
5461
|
break;
|
|
5371
5462
|
case 'cull-faces':
|
|
5372
5463
|
this.cullFaces = parseBool(newValue, true);
|
|
@@ -5429,6 +5520,10 @@ customElements.define('pc-camera', CameraComponentElement);
|
|
|
5429
5520
|
*
|
|
5430
5521
|
* Engine component: {@link CollisionComponent} (`collision`).
|
|
5431
5522
|
*
|
|
5523
|
+
* @elementSummary The `<pc-collision>` element gives its entity a collision shape — a box, sphere,
|
|
5524
|
+
* capsule, cone, cylinder or mesh — for the physics simulation to collide against. Pair it with a
|
|
5525
|
+
* `<pc-rigid-body>`. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
5526
|
+
*
|
|
5432
5527
|
* @category Components
|
|
5433
5528
|
*/
|
|
5434
5529
|
class CollisionComponentElement extends ComponentElement {
|
|
@@ -5619,6 +5714,10 @@ customElements.define('pc-collision', CollisionComponentElement);
|
|
|
5619
5714
|
*
|
|
5620
5715
|
* Engine component: {@link ElementComponent} (`element`).
|
|
5621
5716
|
*
|
|
5717
|
+
* @elementSummary The `<pc-element>` element gives its entity a 2D UI rectangle inside a
|
|
5718
|
+
* `<pc-screen>` hierarchy, drawing an image, a line of text or nothing (`type="image"`, `"text"` or
|
|
5719
|
+
* `"group"`). Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
5720
|
+
*
|
|
5622
5721
|
* @category Components
|
|
5623
5722
|
*/
|
|
5624
5723
|
class ElementComponentElement extends ComponentElement {
|
|
@@ -6303,6 +6402,11 @@ customElements.define('pc-element', ElementComponentElement);
|
|
|
6303
6402
|
* a rigid body component; leaving `entity-b` empty constrains `entity-a` to a fixed point in world
|
|
6304
6403
|
* space. The underlying engine component is in alpha, so its API may change.
|
|
6305
6404
|
*
|
|
6405
|
+
* @elementSummary The `<pc-joint>` element constrains two rigid bodies to each other — a hinged
|
|
6406
|
+
* door, a swinging chain, a sliding drawer. Its entity's transform is the joint frame, and
|
|
6407
|
+
* `entity-a` and `entity-b` name the bodies. Must be a child of a `<pc-entity>`, `<pc-model>` or
|
|
6408
|
+
* `<pc-node>`.
|
|
6409
|
+
*
|
|
6306
6410
|
* @fires {CustomEvent} break - Fired when the impulse on the joint exceeds `break-impulse` and the
|
|
6307
6411
|
* constraint breaks. A broken joint no longer constrains its bodies; calling `refreshFrames()` on
|
|
6308
6412
|
* the underlying component re-attaches it. Bubbles and is composed.
|
|
@@ -7173,6 +7277,10 @@ customElements.define('pc-joint', JointComponentElement);
|
|
|
7173
7277
|
*
|
|
7174
7278
|
* Engine component: {@link LayoutChildComponent} (`layoutchild`).
|
|
7175
7279
|
*
|
|
7280
|
+
* @elementSummary The `<pc-layout-child>` element controls how its entity is sized by the
|
|
7281
|
+
* `<pc-layout-group>` above it, through minimum and maximum sizes and fit proportions. Must be a
|
|
7282
|
+
* child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
7283
|
+
*
|
|
7176
7284
|
* @category Components
|
|
7177
7285
|
*/
|
|
7178
7286
|
class LayoutChildComponentElement extends ComponentElement {
|
|
@@ -7385,6 +7493,10 @@ const fittings = new Map([
|
|
|
7385
7493
|
*
|
|
7386
7494
|
* Engine component: {@link LayoutGroupComponent} (`layoutgroup`).
|
|
7387
7495
|
*
|
|
7496
|
+
* @elementSummary The `<pc-layout-group>` element arranges its entity's children in a row or
|
|
7497
|
+
* column, with spacing, padding, alignment and fitting. Must be a child of a `<pc-entity>`,
|
|
7498
|
+
* `<pc-model>` or `<pc-node>`.
|
|
7499
|
+
*
|
|
7388
7500
|
* @category Components
|
|
7389
7501
|
*/
|
|
7390
7502
|
class LayoutGroupComponentElement extends ComponentElement {
|
|
@@ -7645,23 +7757,30 @@ const shadowTypes = new Map([
|
|
|
7645
7757
|
*
|
|
7646
7758
|
* Engine component: {@link LightComponent} (`light`).
|
|
7647
7759
|
*
|
|
7760
|
+
* @elementSummary The `<pc-light>` element lights the scene from its entity — as a directional,
|
|
7761
|
+
* omni or spot light — with attributes for color, intensity, range and shadows. Must be a child of
|
|
7762
|
+
* a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
7763
|
+
*
|
|
7648
7764
|
* @category Components
|
|
7649
7765
|
*/
|
|
7650
7766
|
class LightComponentElement extends ComponentElement {
|
|
7767
|
+
_cascadeBlend = 0;
|
|
7768
|
+
_cascadeDistribution = 0.5;
|
|
7651
7769
|
_castShadows = false;
|
|
7652
7770
|
_color = new playcanvas.Color(1, 1, 1);
|
|
7653
7771
|
_innerConeAngle = 40;
|
|
7654
7772
|
_intensity = 1;
|
|
7655
|
-
_normalOffsetBias = 0
|
|
7773
|
+
_normalOffsetBias = 0;
|
|
7774
|
+
_numCascades = 1;
|
|
7656
7775
|
_outerConeAngle = 45;
|
|
7657
7776
|
_range = 10;
|
|
7658
|
-
_shadowBias = 0.
|
|
7659
|
-
_shadowDistance =
|
|
7777
|
+
_shadowBias = 0.05;
|
|
7778
|
+
_shadowDistance = 40;
|
|
7660
7779
|
_shadowIntensity = 1;
|
|
7661
7780
|
_shadowResolution = 1024;
|
|
7662
7781
|
_shadowType = 'pcf3-32f';
|
|
7663
7782
|
_type = 'directional';
|
|
7664
|
-
_vsmBias = 0.
|
|
7783
|
+
_vsmBias = 0.0025;
|
|
7665
7784
|
_vsmBlurSize = 11;
|
|
7666
7785
|
_penumbraSize = 1;
|
|
7667
7786
|
_penumbraFalloff = 1;
|
|
@@ -7673,11 +7792,14 @@ class LightComponentElement extends ComponentElement {
|
|
|
7673
7792
|
}
|
|
7674
7793
|
getInitialComponentData() {
|
|
7675
7794
|
return {
|
|
7795
|
+
cascadeBlend: this._cascadeBlend,
|
|
7796
|
+
cascadeDistribution: this._cascadeDistribution,
|
|
7676
7797
|
castShadows: this._castShadows,
|
|
7677
7798
|
color: this._color,
|
|
7678
7799
|
innerConeAngle: this._innerConeAngle,
|
|
7679
7800
|
intensity: this._intensity,
|
|
7680
7801
|
normalOffsetBias: this._normalOffsetBias,
|
|
7802
|
+
numCascades: this._numCascades,
|
|
7681
7803
|
outerConeAngle: this._outerConeAngle,
|
|
7682
7804
|
penumbraFalloff: this._penumbraFalloff,
|
|
7683
7805
|
penumbraSize: this._penumbraSize,
|
|
@@ -7688,7 +7810,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
7688
7810
|
shadowIntensity: this._shadowIntensity,
|
|
7689
7811
|
shadowResolution: this._shadowResolution,
|
|
7690
7812
|
shadowSamples: this._shadowSamples,
|
|
7691
|
-
shadowType: shadowTypes.get(this._shadowType),
|
|
7813
|
+
shadowType: shadowTypes.get(this._shadowType) ?? playcanvas.SHADOW_PCF3_32F,
|
|
7692
7814
|
type: this._type,
|
|
7693
7815
|
vsmBias: this._vsmBias,
|
|
7694
7816
|
vsmBlurSize: this._vsmBlurSize
|
|
@@ -7701,6 +7823,47 @@ class LightComponentElement extends ComponentElement {
|
|
|
7701
7823
|
get component() {
|
|
7702
7824
|
return super.component;
|
|
7703
7825
|
}
|
|
7826
|
+
/**
|
|
7827
|
+
* Sets the fraction of each shadow cascade that is blended into the next one, from 0 (no
|
|
7828
|
+
* blending) to 1, which applies only to `directional` lights with `num-cascades` greater than
|
|
7829
|
+
* 1. Defaults to 0.
|
|
7830
|
+
* @param value - The cascade blend factor.
|
|
7831
|
+
*/
|
|
7832
|
+
set cascadeBlend(value) {
|
|
7833
|
+
this._cascadeBlend = value;
|
|
7834
|
+
if (this.component) {
|
|
7835
|
+
this.component.cascadeBlend = value;
|
|
7836
|
+
}
|
|
7837
|
+
}
|
|
7838
|
+
/**
|
|
7839
|
+
* Gets the cascade blend factor of the light, from 0 (no blending) to 1, which applies only to
|
|
7840
|
+
* `directional` lights with `num-cascades` greater than 1.
|
|
7841
|
+
* @returns The cascade blend factor.
|
|
7842
|
+
*/
|
|
7843
|
+
get cascadeBlend() {
|
|
7844
|
+
return this._cascadeBlend;
|
|
7845
|
+
}
|
|
7846
|
+
/**
|
|
7847
|
+
* Sets the distribution of the camera frustum split between shadow cascades, from 0 (linear
|
|
7848
|
+
* split) to 1 (logarithmic split, concentrating shadow resolution near the camera), which
|
|
7849
|
+
* applies only to `directional` lights with `num-cascades` greater than 1. Defaults to 0.5.
|
|
7850
|
+
* @param value - The cascade distribution.
|
|
7851
|
+
*/
|
|
7852
|
+
set cascadeDistribution(value) {
|
|
7853
|
+
this._cascadeDistribution = value;
|
|
7854
|
+
if (this.component) {
|
|
7855
|
+
this.component.cascadeDistribution = value;
|
|
7856
|
+
}
|
|
7857
|
+
}
|
|
7858
|
+
/**
|
|
7859
|
+
* Gets the cascade distribution of the light, from 0 (linear split) to 1 (logarithmic split,
|
|
7860
|
+
* concentrating shadow resolution near the camera), which applies only to `directional` lights
|
|
7861
|
+
* with `num-cascades` greater than 1.
|
|
7862
|
+
* @returns The cascade distribution.
|
|
7863
|
+
*/
|
|
7864
|
+
get cascadeDistribution() {
|
|
7865
|
+
return this._cascadeDistribution;
|
|
7866
|
+
}
|
|
7704
7867
|
/**
|
|
7705
7868
|
* Sets the cast shadows flag of the light.
|
|
7706
7869
|
* @param value - The cast shadows flag.
|
|
@@ -7786,6 +7949,25 @@ class LightComponentElement extends ComponentElement {
|
|
|
7786
7949
|
get normalOffsetBias() {
|
|
7787
7950
|
return this._normalOffsetBias;
|
|
7788
7951
|
}
|
|
7952
|
+
/**
|
|
7953
|
+
* Sets the number of shadow cascades of the light, an integer from 1 (no cascades) to 4, which
|
|
7954
|
+
* applies only to `directional` lights. Defaults to 1.
|
|
7955
|
+
* @param value - The number of shadow cascades.
|
|
7956
|
+
*/
|
|
7957
|
+
set numCascades(value) {
|
|
7958
|
+
this._numCascades = value;
|
|
7959
|
+
if (this.component) {
|
|
7960
|
+
this.component.numCascades = value;
|
|
7961
|
+
}
|
|
7962
|
+
}
|
|
7963
|
+
/**
|
|
7964
|
+
* Gets the number of shadow cascades of the light, an integer from 1 (no cascades) to 4, which
|
|
7965
|
+
* applies only to `directional` lights.
|
|
7966
|
+
* @returns The number of shadow cascades.
|
|
7967
|
+
*/
|
|
7968
|
+
get numCascades() {
|
|
7969
|
+
return this._numCascades;
|
|
7970
|
+
}
|
|
7789
7971
|
/**
|
|
7790
7972
|
* Sets the outer cone angle of the light.
|
|
7791
7973
|
* @param value - The outer cone angle.
|
|
@@ -8038,11 +8220,14 @@ class LightComponentElement extends ComponentElement {
|
|
|
8038
8220
|
static get observedAttributes() {
|
|
8039
8221
|
return [
|
|
8040
8222
|
...super.observedAttributes,
|
|
8041
|
-
'
|
|
8223
|
+
'cascade-blend',
|
|
8224
|
+
'cascade-distribution',
|
|
8042
8225
|
'cast-shadows',
|
|
8043
|
-
'
|
|
8226
|
+
'color',
|
|
8044
8227
|
'inner-cone-angle',
|
|
8228
|
+
'intensity',
|
|
8045
8229
|
'normal-offset-bias',
|
|
8230
|
+
'num-cascades',
|
|
8046
8231
|
'outer-cone-angle',
|
|
8047
8232
|
'penumbra-falloff',
|
|
8048
8233
|
'penumbra-size',
|
|
@@ -8062,12 +8247,18 @@ class LightComponentElement extends ComponentElement {
|
|
|
8062
8247
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
8063
8248
|
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
8064
8249
|
switch (name) {
|
|
8065
|
-
case '
|
|
8066
|
-
this.
|
|
8250
|
+
case 'cascade-blend':
|
|
8251
|
+
this.cascadeBlend = parseNumber(newValue, 0, name);
|
|
8252
|
+
break;
|
|
8253
|
+
case 'cascade-distribution':
|
|
8254
|
+
this.cascadeDistribution = parseNumber(newValue, 0.5, name);
|
|
8067
8255
|
break;
|
|
8068
8256
|
case 'cast-shadows':
|
|
8069
8257
|
this.castShadows = parseBool(newValue, false);
|
|
8070
8258
|
break;
|
|
8259
|
+
case 'color':
|
|
8260
|
+
this.color = parseColor(newValue, playcanvas.Color.WHITE, name);
|
|
8261
|
+
break;
|
|
8071
8262
|
case 'inner-cone-angle':
|
|
8072
8263
|
this.innerConeAngle = parseNumber(newValue, 40, name);
|
|
8073
8264
|
break;
|
|
@@ -8075,7 +8266,10 @@ class LightComponentElement extends ComponentElement {
|
|
|
8075
8266
|
this.intensity = parseNumber(newValue, 1, name);
|
|
8076
8267
|
break;
|
|
8077
8268
|
case 'normal-offset-bias':
|
|
8078
|
-
this.normalOffsetBias = parseNumber(newValue, 0
|
|
8269
|
+
this.normalOffsetBias = parseNumber(newValue, 0, name);
|
|
8270
|
+
break;
|
|
8271
|
+
case 'num-cascades':
|
|
8272
|
+
this.numCascades = parseNumber(newValue, 1, name);
|
|
8079
8273
|
break;
|
|
8080
8274
|
case 'outer-cone-angle':
|
|
8081
8275
|
this.outerConeAngle = parseNumber(newValue, 45, name);
|
|
@@ -8090,20 +8284,20 @@ class LightComponentElement extends ComponentElement {
|
|
|
8090
8284
|
this.range = parseNumber(newValue, 10, name);
|
|
8091
8285
|
break;
|
|
8092
8286
|
case 'shadow-bias':
|
|
8093
|
-
this.shadowBias = parseNumber(newValue, 0.
|
|
8094
|
-
break;
|
|
8095
|
-
case 'shadow-distance':
|
|
8096
|
-
this.shadowDistance = parseNumber(newValue, 16, name);
|
|
8287
|
+
this.shadowBias = parseNumber(newValue, 0.05, name);
|
|
8097
8288
|
break;
|
|
8098
8289
|
case 'shadow-blocker-samples':
|
|
8099
8290
|
this.shadowBlockerSamples = parseNumber(newValue, 16, name);
|
|
8100
8291
|
break;
|
|
8101
|
-
case 'shadow-
|
|
8102
|
-
this.
|
|
8292
|
+
case 'shadow-distance':
|
|
8293
|
+
this.shadowDistance = parseNumber(newValue, 40, name);
|
|
8103
8294
|
break;
|
|
8104
8295
|
case 'shadow-intensity':
|
|
8105
8296
|
this.shadowIntensity = parseNumber(newValue, 1, name);
|
|
8106
8297
|
break;
|
|
8298
|
+
case 'shadow-resolution':
|
|
8299
|
+
this.shadowResolution = parseNumber(newValue, 1024, name);
|
|
8300
|
+
break;
|
|
8107
8301
|
case 'shadow-samples':
|
|
8108
8302
|
this.shadowSamples = parseNumber(newValue, 16, name);
|
|
8109
8303
|
break;
|
|
@@ -8114,7 +8308,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
8114
8308
|
this.type = parseEnum(newValue, ['directional', 'omni', 'spot'], 'directional', name);
|
|
8115
8309
|
break;
|
|
8116
8310
|
case 'vsm-bias':
|
|
8117
|
-
this.vsmBias = parseNumber(newValue, 0.
|
|
8311
|
+
this.vsmBias = parseNumber(newValue, 0.0025, name);
|
|
8118
8312
|
break;
|
|
8119
8313
|
case 'vsm-blur-size':
|
|
8120
8314
|
this.vsmBlurSize = parseNumber(newValue, 11, name);
|
|
@@ -8132,6 +8326,10 @@ customElements.define('pc-light', LightComponentElement);
|
|
|
8132
8326
|
*
|
|
8133
8327
|
* Engine component: {@link ParticleSystemComponent} (`particlesystem`).
|
|
8134
8328
|
*
|
|
8329
|
+
* @elementSummary The `<pc-particle-system>` element emits particles from its entity, with
|
|
8330
|
+
* attributes for the emitter's shape, rate, lifetime, textures and blending. Must be a child of a
|
|
8331
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
8332
|
+
*
|
|
8135
8333
|
* @category Components
|
|
8136
8334
|
*/
|
|
8137
8335
|
class ParticleSystemComponentElement extends ComponentElement {
|
|
@@ -8280,6 +8478,8 @@ const occludeSpeculars = new Map([
|
|
|
8280
8478
|
['ao', playcanvas.SPECOCC_AO],
|
|
8281
8479
|
['gloss-dependent', playcanvas.SPECOCC_GLOSSDEPENDENT]
|
|
8282
8480
|
]);
|
|
8481
|
+
// The DITHER_* constants are strings whose values are exactly these names, so a parsed value is
|
|
8482
|
+
// assigned to the material unchanged rather than mapped through a table.
|
|
8283
8483
|
const opacityDithers = ['none', 'bayer8', 'bluenoise', 'ignnoise'];
|
|
8284
8484
|
const colorChannels = ['r', 'g', 'b', 'a', 'rgb'];
|
|
8285
8485
|
const scalarChannels = ['r', 'g', 'b', 'a'];
|
|
@@ -8316,6 +8516,10 @@ const roughnessAliases = ['roughness', 'roughness-map'];
|
|
|
8316
8516
|
* The two aliases are documented here rather than on an accessor, because they resolve to the
|
|
8317
8517
|
* `gloss` properties and would otherwise inherit gloss's description - which reads inverted.
|
|
8318
8518
|
*
|
|
8519
|
+
* @elementSummary The `<pc-material>` element defines a physically based material, which
|
|
8520
|
+
* `<pc-render>` elements apply by naming its `id`. It is metal/rough by default, with `metalness`
|
|
8521
|
+
* starting at 0. Must be a direct child of `<pc-app>`.
|
|
8522
|
+
*
|
|
8319
8523
|
* @attribute {number} roughness - The roughness of the material, from 0 (shiny) to 1 (rough). An
|
|
8320
8524
|
* alias for `gloss` that also inverts it, so do not combine it with the `gloss` attributes.
|
|
8321
8525
|
* @attribute {string} roughness-map - The id of the `pc-asset` to use as the roughness map. An
|
|
@@ -10484,6 +10688,11 @@ customElements.define('pc-material', MaterialElement);
|
|
|
10484
10688
|
*
|
|
10485
10689
|
* Engine component: {@link RenderComponent} (`render`).
|
|
10486
10690
|
*
|
|
10691
|
+
* @elementSummary The `<pc-render>` element renders one of the engine's built-in primitives at its
|
|
10692
|
+
* entity — box, sphere, capsule, cone, cylinder or plane — shaded by the `<pc-material>` its
|
|
10693
|
+
* `material` attribute names. For glTF content, use `<pc-model>` instead. Must be a child of a
|
|
10694
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
10695
|
+
*
|
|
10487
10696
|
* @category Components
|
|
10488
10697
|
*/
|
|
10489
10698
|
class RenderComponentElement extends ComponentElement {
|
|
@@ -10614,6 +10823,11 @@ customElements.define('pc-render', RenderComponentElement);
|
|
|
10614
10823
|
*
|
|
10615
10824
|
* Engine component: {@link RigidBodyComponent} (`rigidbody`).
|
|
10616
10825
|
*
|
|
10826
|
+
* @elementSummary The `<pc-rigid-body>` element hands its entity to the physics simulation, with
|
|
10827
|
+
* attributes for its type, mass, friction and restitution. It needs a sibling `<pc-collision>` for
|
|
10828
|
+
* its shape, and `Ammo` loaded through `<pc-wasm>`. Must be a child of a `<pc-entity>`,
|
|
10829
|
+
* `<pc-model>` or `<pc-node>`.
|
|
10830
|
+
*
|
|
10617
10831
|
* @category Components
|
|
10618
10832
|
*/
|
|
10619
10833
|
class RigidBodyComponentElement extends ComponentElement {
|
|
@@ -10823,6 +11037,10 @@ const scaleModes = new Map([
|
|
|
10823
11037
|
*
|
|
10824
11038
|
* Engine component: {@link ScreenComponent} (`screen`).
|
|
10825
11039
|
*
|
|
11040
|
+
* @elementSummary The `<pc-screen>` element gives its entity a 2D space — in screen space or in the
|
|
11041
|
+
* world — that a hierarchy of `<pc-element>` descendants lays out inside. Must be a child of a
|
|
11042
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
11043
|
+
*
|
|
10826
11044
|
* @category Components
|
|
10827
11045
|
*/
|
|
10828
11046
|
class ScreenComponentElement extends ComponentElement {
|
|
@@ -10977,6 +11195,10 @@ const orientations = new Map([
|
|
|
10977
11195
|
*
|
|
10978
11196
|
* Engine component: {@link ScrollbarComponent} (`scrollbar`).
|
|
10979
11197
|
*
|
|
11198
|
+
* @elementSummary The `<pc-scrollbar>` element gives its entity a draggable handle reporting a
|
|
11199
|
+
* position from 0 to 1, which a `<pc-scroll-view>` references to scroll its content. Must be a
|
|
11200
|
+
* child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
11201
|
+
*
|
|
10980
11202
|
* @category Components
|
|
10981
11203
|
*/
|
|
10982
11204
|
class ScrollbarComponentElement extends ComponentElement {
|
|
@@ -11118,6 +11340,10 @@ const visibilities = new Map([
|
|
|
11118
11340
|
*
|
|
11119
11341
|
* Engine component: {@link ScrollViewComponent} (`scrollview`).
|
|
11120
11342
|
*
|
|
11343
|
+
* @elementSummary The `<pc-scroll-view>` element scrolls a larger content entity within a clipped
|
|
11344
|
+
* viewport at its entity, optionally driven by the `<pc-scrollbar>` elements it references. Must be
|
|
11345
|
+
* a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
11346
|
+
*
|
|
11121
11347
|
* @category Components
|
|
11122
11348
|
*/
|
|
11123
11349
|
class ScrollViewComponentElement extends ComponentElement {
|
|
@@ -11504,6 +11730,10 @@ customElements.define('pc-scroll-view', ScrollViewComponentElement);
|
|
|
11504
11730
|
* The element becomes ready once its script instance has been created by the parent
|
|
11505
11731
|
* `<pc-script>` element.
|
|
11506
11732
|
*
|
|
11733
|
+
* @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
|
|
11734
|
+
* the entity of its parent `<pc-script>`. Its other attributes set script attributes of the same
|
|
11735
|
+
* name, and `attributes` takes a JSON object instead. Must be a direct child of `<pc-script>`.
|
|
11736
|
+
*
|
|
11507
11737
|
* @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
|
|
11508
11738
|
* `detail` carries the new `attributes` object. Bubbles.
|
|
11509
11739
|
* @fires {CustomEvent} scriptenablechange - Fired when the script's enabled state changes. The
|
|
@@ -11848,6 +12078,9 @@ const findCaseMatch = (script, key) => {
|
|
|
11848
12078
|
*
|
|
11849
12079
|
* Engine component: {@link ScriptComponent} (`script`).
|
|
11850
12080
|
*
|
|
12081
|
+
* @elementSummary The `<pc-script>` element holds the `<pc-script-instance>` children that attach
|
|
12082
|
+
* scripts to its entity. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
12083
|
+
*
|
|
11851
12084
|
* @category Components
|
|
11852
12085
|
*/
|
|
11853
12086
|
class ScriptComponentElement extends ComponentElement {
|
|
@@ -12297,6 +12530,10 @@ customElements.define('pc-script', ScriptComponentElement);
|
|
|
12297
12530
|
*
|
|
12298
12531
|
* Engine component: {@link SoundComponent} (`sound`).
|
|
12299
12532
|
*
|
|
12533
|
+
* @elementSummary The `<pc-sound>` element holds the `<pc-sound-slot>` children that play sounds at
|
|
12534
|
+
* its entity, along with the positional audio settings they share. Must be a child of a
|
|
12535
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
12536
|
+
*
|
|
12300
12537
|
* @category Components
|
|
12301
12538
|
*/
|
|
12302
12539
|
class SoundComponentElement extends ComponentElement {
|
|
@@ -12493,6 +12730,9 @@ customElements.define('pc-sound', SoundComponentElement);
|
|
|
12493
12730
|
* The SoundSlotElement interface provides properties and methods for manipulating
|
|
12494
12731
|
* `<pc-sound-slot>` elements. The SoundSlotElement interface also inherits the properties and
|
|
12495
12732
|
* methods of the {@link AsyncElement} interface.
|
|
12733
|
+
*
|
|
12734
|
+
* @elementSummary The `<pc-sound-slot>` element declares one named sound on its parent `<pc-sound>`
|
|
12735
|
+
* — its asset, volume, pitch, looping and autoplay. Must be a direct child of `<pc-sound>`.
|
|
12496
12736
|
*/
|
|
12497
12737
|
class SoundSlotElement extends AsyncElement {
|
|
12498
12738
|
_asset = '';
|
|
@@ -12774,6 +13014,10 @@ customElements.define('pc-sound-slot', SoundSlotElement);
|
|
|
12774
13014
|
*
|
|
12775
13015
|
* Engine component: {@link GSplatComponent} (`gsplat`).
|
|
12776
13016
|
*
|
|
13017
|
+
* @elementSummary The `<pc-gsplat>` element renders the 3D Gaussian splats of a `gsplat` asset at
|
|
13018
|
+
* its entity, with attributes for shadow casting and level of detail. Must be a child of a
|
|
13019
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
13020
|
+
*
|
|
12777
13021
|
* @category Components
|
|
12778
13022
|
*/
|
|
12779
13023
|
class GSplatComponentElement extends ComponentElement {
|
|
@@ -13069,6 +13313,11 @@ const levenshtein = (a, b) => {
|
|
|
13069
13313
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
13070
13314
|
* intersects the bound node's geometry, exactly as for `<pc-entity>`.
|
|
13071
13315
|
*
|
|
13316
|
+
* @elementSummary The `<pc-node>` element binds to a node inside the hierarchy a `<pc-model>`
|
|
13317
|
+
* instantiated and declares overrides against it: a transform, an enabled state, tags, components
|
|
13318
|
+
* to add, or content to attach. Its `name` is a lookup, never a rename. Must be a descendant of
|
|
13319
|
+
* `<pc-model>`.
|
|
13320
|
+
*
|
|
13072
13321
|
* @attribute {string} name - The name of the node to bind, resolved within the nearest ancestor
|
|
13073
13322
|
* `pc-model` (or `pc-node`) once it has instantiated.
|
|
13074
13323
|
* @attribute {number} index - Which match to bind when `name` matches more than one node,
|
|
@@ -13809,6 +14058,9 @@ customElements.define('pc-node', NodeElement);
|
|
|
13809
14058
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
|
|
13810
14059
|
* The SceneElement interface also inherits the properties and methods of the
|
|
13811
14060
|
* {@link HTMLElement} interface.
|
|
14061
|
+
*
|
|
14062
|
+
* @elementSummary The `<pc-scene>` element holds the entity hierarchy the application renders,
|
|
14063
|
+
* along with the scene-wide fog and gravity settings. Must be a direct child of `<pc-app>`.
|
|
13812
14064
|
*/
|
|
13813
14065
|
class SceneElement extends AsyncElement {
|
|
13814
14066
|
/**
|
|
@@ -14032,6 +14284,10 @@ customElements.define('pc-scene', SceneElement);
|
|
|
14032
14284
|
* The SkyElement interface provides properties and methods for manipulating
|
|
14033
14285
|
* `<pc-sky>` elements. The SkyElement interface also inherits the properties and
|
|
14034
14286
|
* methods of the {@link HTMLElement} interface.
|
|
14287
|
+
*
|
|
14288
|
+
* @elementSummary The `<pc-sky>` element renders a skybox from a texture asset, projected as an
|
|
14289
|
+
* infinite background, a box or a dome, and optionally lights the scene from it. Must be a direct
|
|
14290
|
+
* child of `<pc-scene>`.
|
|
14035
14291
|
*/
|
|
14036
14292
|
class SkyElement extends AsyncElement {
|
|
14037
14293
|
_asset = '';
|