@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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { basisInitialize, WasmModule, Vec3, Color, Vec4, Quat, Vec2, createGraphicsDevice, AppOptions, Keyboard, Mouse, ElementInput, AnimComponentSystem, AnimationComponentSystem, AudioListenerComponentSystem, ButtonComponentSystem, CameraComponentSystem, CollisionComponentSystem, ElementComponentSystem, GSplatComponentSystem, JointComponentSystem, LayoutChildComponentSystem, LayoutGroupComponentSystem, LightComponentSystem, ModelComponentSystem, ParticleSystemComponentSystem, RenderComponentSystem, RigidBodyComponentSystem, ScreenComponentSystem, ScriptComponentSystem, ScrollbarComponentSystem, ScrollViewComponentSystem, SoundComponentSystem, SpriteComponentSystem, ZoneComponentSystem, AnimClipHandler, AnimationHandler, AnimStateGraphHandler, AudioHandler, BinaryHandler, CssHandler, ContainerHandler, CubemapHandler, FolderHandler, FontHandler, GSplatHandler, HierarchyHandler, HtmlHandler, JsonHandler, MaterialHandler, ModelHandler, RenderHandler, ScriptHandler, SceneHandler, ShaderHandler, SpriteHandler, TemplateHandler, TextHandler, TextureAtlasHandler, TextureHandler, SoundManager, Lightmapper, BatchManager, XrManager, AppBase, FILLMODE_NONE, RESOLUTION_AUTO, Picker, MeshInstance, Entity, Asset, SPRITE_RENDERMODE_SIMPLE, FILTER_LINEAR_MIPMAP_LINEAR, FILTER_LINEAR, ADDRESS_REPEAT, SPRITE_RENDERMODE_SLICED, SPRITE_RENDERMODE_TILED, ADDRESS_CLAMP_TO_EDGE, ADDRESS_MIRRORED_REPEAT, FILTER_NEAREST, FILTER_NEAREST_MIPMAP_NEAREST, FILTER_LINEAR_MIPMAP_NEAREST, FILTER_NEAREST_MIPMAP_LINEAR, AnimTrack, ANIM_CONTROL_STATES, BUTTON_TRANSITION_MODE_TINT, BUTTON_TRANSITION_MODE_SPRITE_CHANGE, TONEMAP_NONE, PROJECTION_PERSPECTIVE, GAMMA_SRGB, GAMMA_NONE, XRTYPE_VR, TONEMAP_LINEAR, TONEMAP_FILMIC, TONEMAP_HEJL, TONEMAP_ACES, TONEMAP_ACES2, TONEMAP_NEUTRAL, PROJECTION_ORTHOGRAPHIC, ORIENTATION_HORIZONTAL, FITTING_NONE, FITTING_STRETCH, FITTING_SHRINK, FITTING_BOTH, ORIENTATION_VERTICAL, SHADOW_PCF3_32F, SHADOW_PCF1_16F, SHADOW_PCF1_32F, SHADOW_PCF3_16F, SHADOW_PCF5_16F, SHADOW_PCF5_32F, SHADOW_VSM_16F, SHADOW_VSM_32F, SHADOW_PCSS_32F, StandardMaterial, BLEND_NONE, CULLFACE_BACK, FRESNEL_SCHLICK, SPECOCC_AO, BLEND_NORMAL, BLEND_ADDITIVE, BLEND_ADDITIVEALPHA, BLEND_PREMULTIPLIED, BLEND_MULTIPLICATIVE, BLEND_MULTIPLICATIVE2X, BLEND_SCREEN, BLEND_MIN, BLEND_MAX, BLEND_SUBTRACTIVE, CULLFACE_NONE, CULLFACE_FRONT, CULLFACE_FRONTANDBACK, FRESNEL_NONE, SPECOCC_NONE, SPECOCC_GLOSSDEPENDENT, SCALEMODE_NONE, SCALEMODE_BLEND, SCROLL_MODE_BOUNCE, SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED, SCROLLBAR_VISIBILITY_SHOW_ALWAYS, SCROLL_MODE_CLAMP, SCROLL_MODE_INFINITE, EnvLighting, LAYERID_SKYBOX } from 'playcanvas';
|
|
1
|
+
import { basisInitialize, WasmModule, Vec3, Color, Vec4, Quat, Vec2, createGraphicsDevice, AppOptions, Keyboard, Mouse, ElementInput, AnimComponentSystem, AnimationComponentSystem, AudioListenerComponentSystem, ButtonComponentSystem, CameraComponentSystem, CollisionComponentSystem, ElementComponentSystem, GSplatComponentSystem, JointComponentSystem, LayoutChildComponentSystem, LayoutGroupComponentSystem, LightComponentSystem, ModelComponentSystem, ParticleSystemComponentSystem, RenderComponentSystem, RigidBodyComponentSystem, ScreenComponentSystem, ScriptComponentSystem, ScrollbarComponentSystem, ScrollViewComponentSystem, SoundComponentSystem, SpriteComponentSystem, ZoneComponentSystem, AnimClipHandler, AnimationHandler, AnimStateGraphHandler, AudioHandler, BinaryHandler, CssHandler, ContainerHandler, CubemapHandler, FolderHandler, FontHandler, GSplatHandler, HierarchyHandler, HtmlHandler, JsonHandler, MaterialHandler, ModelHandler, RenderHandler, ScriptHandler, SceneHandler, ShaderHandler, SpriteHandler, TemplateHandler, TextHandler, TextureAtlasHandler, TextureHandler, SoundManager, Lightmapper, BatchManager, XrManager, AppBase, FILLMODE_NONE, RESOLUTION_AUTO, Picker, MeshInstance, Entity, Asset, SPRITE_RENDERMODE_SIMPLE, FILTER_LINEAR_MIPMAP_LINEAR, FILTER_LINEAR, ADDRESS_REPEAT, SPRITE_RENDERMODE_SLICED, SPRITE_RENDERMODE_TILED, ADDRESS_CLAMP_TO_EDGE, ADDRESS_MIRRORED_REPEAT, FILTER_NEAREST, FILTER_NEAREST_MIPMAP_NEAREST, FILTER_LINEAR_MIPMAP_NEAREST, FILTER_NEAREST_MIPMAP_LINEAR, AnimTrack, ANIM_CONTROL_STATES, BUTTON_TRANSITION_MODE_TINT, BUTTON_TRANSITION_MODE_SPRITE_CHANGE, TONEMAP_NONE, PROJECTION_PERSPECTIVE, GAMMA_SRGB, GAMMA_NONE, XRTYPE_AR, XRTYPE_VR, TONEMAP_LINEAR, TONEMAP_FILMIC, TONEMAP_HEJL, TONEMAP_ACES, TONEMAP_ACES2, TONEMAP_NEUTRAL, PROJECTION_ORTHOGRAPHIC, ORIENTATION_HORIZONTAL, FITTING_NONE, FITTING_STRETCH, FITTING_SHRINK, FITTING_BOTH, ORIENTATION_VERTICAL, SHADOW_PCF3_32F, SHADOW_PCF1_16F, SHADOW_PCF1_32F, SHADOW_PCF3_16F, SHADOW_PCF5_16F, SHADOW_PCF5_32F, SHADOW_VSM_16F, SHADOW_VSM_32F, SHADOW_PCSS_32F, StandardMaterial, BLEND_NONE, CULLFACE_BACK, FRESNEL_SCHLICK, SPECOCC_AO, BLEND_NORMAL, BLEND_ADDITIVE, BLEND_ADDITIVEALPHA, BLEND_PREMULTIPLIED, BLEND_MULTIPLICATIVE, BLEND_MULTIPLICATIVE2X, BLEND_SCREEN, BLEND_MIN, BLEND_MAX, BLEND_SUBTRACTIVE, CULLFACE_NONE, CULLFACE_FRONT, CULLFACE_FRONTANDBACK, FRESNEL_NONE, SPECOCC_NONE, SPECOCC_GLOSSDEPENDENT, SCALEMODE_NONE, SCALEMODE_BLEND, SCROLL_MODE_BOUNCE, SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED, SCROLLBAR_VISIBILITY_SHOW_ALWAYS, SCROLL_MODE_CLAMP, SCROLL_MODE_INFINITE, EnvLighting, LAYERID_SKYBOX } from 'playcanvas';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
@@ -121,6 +121,10 @@ async function whenReady(target) {
|
|
|
121
121
|
* A `<pc-wasm>` without a `name` warns and never becomes ready; a containing `<pc-app>` still
|
|
122
122
|
* boots.
|
|
123
123
|
*
|
|
124
|
+
* @elementSummary The `<pc-wasm>` element loads a WebAssembly module the engine needs before the
|
|
125
|
+
* application starts — `Ammo` for physics, `Basis` or `DracoDecoderModule` for compressed assets.
|
|
126
|
+
* Must be a direct child of `<pc-app>`.
|
|
127
|
+
*
|
|
124
128
|
* @attribute {string} name - The name of the WebAssembly module to configure, e.g. `Basis` or
|
|
125
129
|
* `Ammo`.
|
|
126
130
|
* @attribute {string} glue - The URL of the module's glue script.
|
|
@@ -762,6 +766,10 @@ const ensureBaseStyles = () => {
|
|
|
762
766
|
* tracked live via a ResizeObserver — so the element can be embedded at any size, resized by
|
|
763
767
|
* its container, or made fullscreen with ordinary CSS such as `width: 100vw; height: 100dvh`.
|
|
764
768
|
*
|
|
769
|
+
* @elementSummary The `<pc-app>` element creates a PlayCanvas application and the canvas it renders
|
|
770
|
+
* into, and is the root of every scene. It holds the `<pc-asset>`, `<pc-material>`, `<pc-wasm>` and
|
|
771
|
+
* `<pc-scene>` elements, and the page's CSS sizes it, as it would a `<video>`.
|
|
772
|
+
*
|
|
765
773
|
* @fires {ProgressEvent} progress - Fired while the application preloads its assets. `loaded` and
|
|
766
774
|
* `total` are asset counts, not bytes, and an asset that fails to load still counts as loaded.
|
|
767
775
|
* Fired at least once per boot, and the final event always has `loaded` equal to `total`. Does
|
|
@@ -1700,7 +1708,7 @@ class EntityBaseElement extends AsyncElement {
|
|
|
1700
1708
|
* Tracks whether an inline `onpointer*` attribute is present. The browser itself compiles and
|
|
1701
1709
|
* runs these attributes — they are standard `GlobalEventHandlers`, so setting one replaces
|
|
1702
1710
|
* the previous handler and removing it removes the handler, exactly like `onclick` on any
|
|
1703
|
-
* HTML element. But because they bypass {@link addEventListener}, the connect/disconnect
|
|
1711
|
+
* HTML element. But because they bypass {@link EventTarget.addEventListener}, the connect/disconnect
|
|
1704
1712
|
* bookkeeping that lets the application lazily attach its canvas pointer handlers must be
|
|
1705
1713
|
* kept in sync here.
|
|
1706
1714
|
*
|
|
@@ -1741,7 +1749,7 @@ class EntityBaseElement extends AsyncElement {
|
|
|
1741
1749
|
}
|
|
1742
1750
|
/**
|
|
1743
1751
|
* Whether the element has a listener for an event type, registered either with
|
|
1744
|
-
* {@link addEventListener} or with the matching inline `onpointer*` attribute. Read by the
|
|
1752
|
+
* {@link EventTarget.addEventListener} or with the matching inline `onpointer*` attribute. Read by the
|
|
1745
1753
|
* containing `<pc-app>` element to gate pointer event synthesis.
|
|
1746
1754
|
*
|
|
1747
1755
|
* @param type - The event type.
|
|
@@ -1810,7 +1818,7 @@ class EntityOwnerElement extends EntityBaseElement {
|
|
|
1810
1818
|
*/
|
|
1811
1819
|
_tags = [];
|
|
1812
1820
|
/**
|
|
1813
|
-
* Whether the hierarchy has been built for this entity — set once
|
|
1821
|
+
* Whether the hierarchy has been built for this entity — set once `_buildHierarchy` has
|
|
1814
1822
|
* parented it. Read by subclasses that gate work on the entity being in the scene graph.
|
|
1815
1823
|
*/
|
|
1816
1824
|
_built = false;
|
|
@@ -1899,7 +1907,7 @@ class EntityOwnerElement extends EntityBaseElement {
|
|
|
1899
1907
|
this._onBuilt();
|
|
1900
1908
|
}
|
|
1901
1909
|
/**
|
|
1902
|
-
* Called by
|
|
1910
|
+
* Called by `_buildHierarchy` once the backing entity has been parented — exactly once
|
|
1903
1911
|
* per build cycle. The default announces readiness, which is what a parented `<pc-entity>`
|
|
1904
1912
|
* means; `<pc-model>` overrides it to start loading content instead, because its readiness
|
|
1905
1913
|
* tracks the content settling rather than the host entering the scene graph.
|
|
@@ -2020,9 +2028,14 @@ class EntityOwnerElement extends EntityBaseElement {
|
|
|
2020
2028
|
*
|
|
2021
2029
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
2022
2030
|
* intersects this entity's geometry. They are only generated while the entity has a listener for
|
|
2023
|
-
* them, registered either with {@link addEventListener} or with the matching inline `onpointer*`
|
|
2031
|
+
* them, registered either with {@link EventTarget.addEventListener} or with the matching inline `onpointer*`
|
|
2024
2032
|
* attribute.
|
|
2025
2033
|
*
|
|
2034
|
+
* @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
|
|
2035
|
+
* scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
|
|
2036
|
+
* `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
|
|
2037
|
+
* `<pc-model>` or a `<pc-node>` to parent it there.
|
|
2038
|
+
*
|
|
2026
2039
|
* @attribute {boolean} enabled - The enabled state of the entity.
|
|
2027
2040
|
* @attribute {string} name - The name of the entity.
|
|
2028
2041
|
* @attribute {string} position - The position of the entity.
|
|
@@ -2403,6 +2416,10 @@ const processBufferView = (gltfBuffer, buffers, continuation) => {
|
|
|
2403
2416
|
* Apart from `lazy` and the texture options, these attributes are read once when the asset is
|
|
2404
2417
|
* created, so changing them later has no effect.
|
|
2405
2418
|
*
|
|
2419
|
+
* @elementSummary The `<pc-asset>` element declares an asset for the application to load — a model,
|
|
2420
|
+
* texture, font, sound, script or JSON file — under an `id` that other elements reference. Must be
|
|
2421
|
+
* a direct child of `<pc-app>`.
|
|
2422
|
+
*
|
|
2406
2423
|
* @attribute {string} id - The identifier used to reference the asset from other elements.
|
|
2407
2424
|
* @attribute {string} src - The URL of the asset to load.
|
|
2408
2425
|
* @attribute {string} type - The asset type. Inferred from the `src` file extension when omitted.
|
|
@@ -3029,6 +3046,11 @@ const formatHierarchy = (root, counts) => {
|
|
|
3029
3046
|
* intersects the model's geometry, exactly as for `<pc-entity>` — a hit on a content node that no
|
|
3030
3047
|
* `pc-node` fronts resolves to this element.
|
|
3031
3048
|
*
|
|
3049
|
+
* @elementSummary The `<pc-model>` element instantiates a 3D model from a container asset
|
|
3050
|
+
* (typically a GLB) beneath an entity of its own, so the element's transform and tags place the
|
|
3051
|
+
* instance in the scene. Its `<pc-node>` children override what the asset authored. Place it in the
|
|
3052
|
+
* `<pc-scene>`, or nest it under a `<pc-entity>`, another `<pc-model>` or a `<pc-node>`.
|
|
3053
|
+
*
|
|
3032
3054
|
* @attribute {boolean} enabled - The enabled state of the model.
|
|
3033
3055
|
* @attribute {string} name - The name of the model.
|
|
3034
3056
|
* @attribute {string} position - The position of the model.
|
|
@@ -3562,6 +3584,11 @@ class ComponentElement extends AsyncElement {
|
|
|
3562
3584
|
*
|
|
3563
3585
|
* Engine component: {@link AnimComponent} (`anim`).
|
|
3564
3586
|
*
|
|
3587
|
+
* @elementSummary The `<pc-anim>` element plays animation clips over its entity's hierarchy, taken
|
|
3588
|
+
* from `<pc-anim-clip>` children or from the enclosing `<pc-model>`'s own animations. The first
|
|
3589
|
+
* clip plays automatically, and the `clip` attribute switches between them. Must be a child of a
|
|
3590
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
3591
|
+
*
|
|
3565
3592
|
* @category Components
|
|
3566
3593
|
*/
|
|
3567
3594
|
class AnimComponentElement extends ComponentElement {
|
|
@@ -4180,6 +4207,10 @@ customElements.define('pc-anim', AnimComponentElement);
|
|
|
4180
4207
|
* named; in a multi-track source the track named `name` is chosen, falling back to the first
|
|
4181
4208
|
* with a warning. The element becomes ready once its resolved track is assigned.
|
|
4182
4209
|
*
|
|
4210
|
+
* @elementSummary The `<pc-anim-clip>` element declares one named animation clip on its parent
|
|
4211
|
+
* `<pc-anim>`, taken from the `asset` it names or, without one, from the enclosing `<pc-model>`'s
|
|
4212
|
+
* own animations. Must be a direct child of `<pc-anim>`.
|
|
4213
|
+
*
|
|
4183
4214
|
* @category Components
|
|
4184
4215
|
*/
|
|
4185
4216
|
class AnimClipElement extends AsyncElement {
|
|
@@ -4508,6 +4539,10 @@ customElements.define('pc-anim-clip', AnimClipElement);
|
|
|
4508
4539
|
*
|
|
4509
4540
|
* Engine component: {@link AudioListenerComponent} (`audiolistener`).
|
|
4510
4541
|
*
|
|
4542
|
+
* @elementSummary The `<pc-audio-listener>` element makes its entity the point from which
|
|
4543
|
+
* positional sounds are heard, typically the entity holding the `<pc-camera>`. Must be a child of a
|
|
4544
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
4545
|
+
*
|
|
4511
4546
|
* @category Components
|
|
4512
4547
|
*/
|
|
4513
4548
|
class AudioListenerComponentElement extends ComponentElement {
|
|
@@ -4537,6 +4572,11 @@ const transitionModes = new Map([
|
|
|
4537
4572
|
*
|
|
4538
4573
|
* Engine component: {@link ButtonComponent} (`button`).
|
|
4539
4574
|
*
|
|
4575
|
+
* @elementSummary The `<pc-button>` element makes its entity respond to pointer input, tinting or
|
|
4576
|
+
* swapping its image as the pointer hovers, presses and releases it. The entity also needs a
|
|
4577
|
+
* `<pc-element>` with `use-input` set. Must be a child of a `<pc-entity>`, `<pc-model>` or
|
|
4578
|
+
* `<pc-node>`.
|
|
4579
|
+
*
|
|
4540
4580
|
* @category Components
|
|
4541
4581
|
*/
|
|
4542
4582
|
class ButtonComponentElement extends ComponentElement {
|
|
@@ -4940,13 +4980,18 @@ const tonemaps = new Map([
|
|
|
4940
4980
|
*
|
|
4941
4981
|
* Engine component: {@link CameraComponent} (`camera`).
|
|
4942
4982
|
*
|
|
4983
|
+
* @elementSummary The `<pc-camera>` element renders the scene from its entity's transform, with
|
|
4984
|
+
* attributes for the projection, field of view, clip planes, clear color and tonemapping. Must be a
|
|
4985
|
+
* child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
4986
|
+
*
|
|
4943
4987
|
* @category Components
|
|
4944
4988
|
*/
|
|
4945
4989
|
class CameraComponentElement extends ComponentElement {
|
|
4946
4990
|
_clearColor = new Color(0.75, 0.75, 0.75, 1);
|
|
4947
4991
|
_clearColorBuffer = true;
|
|
4992
|
+
_clearDepth = 1;
|
|
4948
4993
|
_clearDepthBuffer = true;
|
|
4949
|
-
_clearStencilBuffer =
|
|
4994
|
+
_clearStencilBuffer = true;
|
|
4950
4995
|
_cullFaces = true;
|
|
4951
4996
|
_farClip = 1000;
|
|
4952
4997
|
_flipFaces = false;
|
|
@@ -4969,6 +5014,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
4969
5014
|
return {
|
|
4970
5015
|
clearColor: this._clearColor,
|
|
4971
5016
|
clearColorBuffer: this._clearColorBuffer,
|
|
5017
|
+
clearDepth: this._clearDepth,
|
|
4972
5018
|
clearDepthBuffer: this._clearDepthBuffer,
|
|
4973
5019
|
clearStencilBuffer: this._clearStencilBuffer,
|
|
4974
5020
|
cullFaces: this._cullFaces,
|
|
@@ -4987,9 +5033,31 @@ class CameraComponentElement extends ComponentElement {
|
|
|
4987
5033
|
toneMapping: tonemaps.get(this._tonemap) ?? TONEMAP_NONE
|
|
4988
5034
|
};
|
|
4989
5035
|
}
|
|
4990
|
-
|
|
5036
|
+
/**
|
|
5037
|
+
* Whether immersive AR is available. Independent of {@link vrAvailable}: a device can offer
|
|
5038
|
+
* either mode without the other.
|
|
5039
|
+
* @returns Whether immersive AR is available.
|
|
5040
|
+
*/
|
|
5041
|
+
get arAvailable() {
|
|
5042
|
+
return this._available(XRTYPE_AR);
|
|
5043
|
+
}
|
|
5044
|
+
/**
|
|
5045
|
+
* Whether immersive VR is available. Independent of {@link arAvailable}: a device can offer
|
|
5046
|
+
* either mode without the other.
|
|
5047
|
+
* @returns Whether immersive VR is available.
|
|
5048
|
+
*/
|
|
5049
|
+
get vrAvailable() {
|
|
5050
|
+
return this._available(XRTYPE_VR);
|
|
5051
|
+
}
|
|
5052
|
+
/**
|
|
5053
|
+
* Whether one XR session type is available on this device.
|
|
5054
|
+
*
|
|
5055
|
+
* @param type - The XR session type to test.
|
|
5056
|
+
* @returns Whether that type is available.
|
|
5057
|
+
*/
|
|
5058
|
+
_available(type) {
|
|
4991
5059
|
const xrManager = this.component?.system.app.xr;
|
|
4992
|
-
return xrManager
|
|
5060
|
+
return Boolean(xrManager?.supported && xrManager.isAvailable(type));
|
|
4993
5061
|
}
|
|
4994
5062
|
/**
|
|
4995
5063
|
* Starts the camera in XR mode.
|
|
@@ -4997,11 +5065,13 @@ class CameraComponentElement extends ComponentElement {
|
|
|
4997
5065
|
* @param space - The space to start the camera in.
|
|
4998
5066
|
*/
|
|
4999
5067
|
startXr(type, space) {
|
|
5000
|
-
|
|
5068
|
+
// Gated on the mode being started, not on XR in general: a device that offers only
|
|
5069
|
+
// one of the two would otherwise accept a session it cannot serve
|
|
5070
|
+
if (this.component && this._available(type)) {
|
|
5001
5071
|
this.component.startXr(type, space, {
|
|
5002
5072
|
callback: (err) => {
|
|
5003
5073
|
if (err)
|
|
5004
|
-
console.error(`WebXR
|
|
5074
|
+
console.error(`WebXR ${type} failed to start: ${err.message}`);
|
|
5005
5075
|
}
|
|
5006
5076
|
});
|
|
5007
5077
|
}
|
|
@@ -5055,6 +5125,23 @@ class CameraComponentElement extends ComponentElement {
|
|
|
5055
5125
|
get clearColorBuffer() {
|
|
5056
5126
|
return this._clearColorBuffer;
|
|
5057
5127
|
}
|
|
5128
|
+
/**
|
|
5129
|
+
* Sets the depth value the depth buffer is cleared to. Defaults to 1.
|
|
5130
|
+
* @param value - The clear depth value.
|
|
5131
|
+
*/
|
|
5132
|
+
set clearDepth(value) {
|
|
5133
|
+
this._clearDepth = value;
|
|
5134
|
+
if (this.component) {
|
|
5135
|
+
this.component.clearDepth = value;
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5138
|
+
/**
|
|
5139
|
+
* Gets the depth value the depth buffer is cleared to.
|
|
5140
|
+
* @returns The clear depth value.
|
|
5141
|
+
*/
|
|
5142
|
+
get clearDepth() {
|
|
5143
|
+
return this._clearDepth;
|
|
5144
|
+
}
|
|
5058
5145
|
/**
|
|
5059
5146
|
* Sets the clear depth buffer of the camera.
|
|
5060
5147
|
* @param value - The clear depth buffer.
|
|
@@ -5333,6 +5420,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
5333
5420
|
...super.observedAttributes,
|
|
5334
5421
|
'clear-color',
|
|
5335
5422
|
'clear-color-buffer',
|
|
5423
|
+
'clear-depth',
|
|
5336
5424
|
'clear-depth-buffer',
|
|
5337
5425
|
'clear-stencil-buffer',
|
|
5338
5426
|
'cull-faces',
|
|
@@ -5360,11 +5448,14 @@ class CameraComponentElement extends ComponentElement {
|
|
|
5360
5448
|
case 'clear-color-buffer':
|
|
5361
5449
|
this.clearColorBuffer = parseBool(newValue, true);
|
|
5362
5450
|
break;
|
|
5451
|
+
case 'clear-depth':
|
|
5452
|
+
this.clearDepth = parseNumber(newValue, 1, name);
|
|
5453
|
+
break;
|
|
5363
5454
|
case 'clear-depth-buffer':
|
|
5364
5455
|
this.clearDepthBuffer = parseBool(newValue, true);
|
|
5365
5456
|
break;
|
|
5366
5457
|
case 'clear-stencil-buffer':
|
|
5367
|
-
this.clearStencilBuffer = parseBool(newValue,
|
|
5458
|
+
this.clearStencilBuffer = parseBool(newValue, true);
|
|
5368
5459
|
break;
|
|
5369
5460
|
case 'cull-faces':
|
|
5370
5461
|
this.cullFaces = parseBool(newValue, true);
|
|
@@ -5427,6 +5518,10 @@ customElements.define('pc-camera', CameraComponentElement);
|
|
|
5427
5518
|
*
|
|
5428
5519
|
* Engine component: {@link CollisionComponent} (`collision`).
|
|
5429
5520
|
*
|
|
5521
|
+
* @elementSummary The `<pc-collision>` element gives its entity a collision shape — a box, sphere,
|
|
5522
|
+
* capsule, cone, cylinder or mesh — for the physics simulation to collide against. Pair it with a
|
|
5523
|
+
* `<pc-rigid-body>`. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
5524
|
+
*
|
|
5430
5525
|
* @category Components
|
|
5431
5526
|
*/
|
|
5432
5527
|
class CollisionComponentElement extends ComponentElement {
|
|
@@ -5617,6 +5712,10 @@ customElements.define('pc-collision', CollisionComponentElement);
|
|
|
5617
5712
|
*
|
|
5618
5713
|
* Engine component: {@link ElementComponent} (`element`).
|
|
5619
5714
|
*
|
|
5715
|
+
* @elementSummary The `<pc-element>` element gives its entity a 2D UI rectangle inside a
|
|
5716
|
+
* `<pc-screen>` hierarchy, drawing an image, a line of text or nothing (`type="image"`, `"text"` or
|
|
5717
|
+
* `"group"`). Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
5718
|
+
*
|
|
5620
5719
|
* @category Components
|
|
5621
5720
|
*/
|
|
5622
5721
|
class ElementComponentElement extends ComponentElement {
|
|
@@ -6301,6 +6400,11 @@ customElements.define('pc-element', ElementComponentElement);
|
|
|
6301
6400
|
* a rigid body component; leaving `entity-b` empty constrains `entity-a` to a fixed point in world
|
|
6302
6401
|
* space. The underlying engine component is in alpha, so its API may change.
|
|
6303
6402
|
*
|
|
6403
|
+
* @elementSummary The `<pc-joint>` element constrains two rigid bodies to each other — a hinged
|
|
6404
|
+
* door, a swinging chain, a sliding drawer. Its entity's transform is the joint frame, and
|
|
6405
|
+
* `entity-a` and `entity-b` name the bodies. Must be a child of a `<pc-entity>`, `<pc-model>` or
|
|
6406
|
+
* `<pc-node>`.
|
|
6407
|
+
*
|
|
6304
6408
|
* @fires {CustomEvent} break - Fired when the impulse on the joint exceeds `break-impulse` and the
|
|
6305
6409
|
* constraint breaks. A broken joint no longer constrains its bodies; calling `refreshFrames()` on
|
|
6306
6410
|
* the underlying component re-attaches it. Bubbles and is composed.
|
|
@@ -7171,6 +7275,10 @@ customElements.define('pc-joint', JointComponentElement);
|
|
|
7171
7275
|
*
|
|
7172
7276
|
* Engine component: {@link LayoutChildComponent} (`layoutchild`).
|
|
7173
7277
|
*
|
|
7278
|
+
* @elementSummary The `<pc-layout-child>` element controls how its entity is sized by the
|
|
7279
|
+
* `<pc-layout-group>` above it, through minimum and maximum sizes and fit proportions. Must be a
|
|
7280
|
+
* child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
7281
|
+
*
|
|
7174
7282
|
* @category Components
|
|
7175
7283
|
*/
|
|
7176
7284
|
class LayoutChildComponentElement extends ComponentElement {
|
|
@@ -7383,6 +7491,10 @@ const fittings = new Map([
|
|
|
7383
7491
|
*
|
|
7384
7492
|
* Engine component: {@link LayoutGroupComponent} (`layoutgroup`).
|
|
7385
7493
|
*
|
|
7494
|
+
* @elementSummary The `<pc-layout-group>` element arranges its entity's children in a row or
|
|
7495
|
+
* column, with spacing, padding, alignment and fitting. Must be a child of a `<pc-entity>`,
|
|
7496
|
+
* `<pc-model>` or `<pc-node>`.
|
|
7497
|
+
*
|
|
7386
7498
|
* @category Components
|
|
7387
7499
|
*/
|
|
7388
7500
|
class LayoutGroupComponentElement extends ComponentElement {
|
|
@@ -7643,23 +7755,30 @@ const shadowTypes = new Map([
|
|
|
7643
7755
|
*
|
|
7644
7756
|
* Engine component: {@link LightComponent} (`light`).
|
|
7645
7757
|
*
|
|
7758
|
+
* @elementSummary The `<pc-light>` element lights the scene from its entity — as a directional,
|
|
7759
|
+
* omni or spot light — with attributes for color, intensity, range and shadows. Must be a child of
|
|
7760
|
+
* a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
7761
|
+
*
|
|
7646
7762
|
* @category Components
|
|
7647
7763
|
*/
|
|
7648
7764
|
class LightComponentElement extends ComponentElement {
|
|
7765
|
+
_cascadeBlend = 0;
|
|
7766
|
+
_cascadeDistribution = 0.5;
|
|
7649
7767
|
_castShadows = false;
|
|
7650
7768
|
_color = new Color(1, 1, 1);
|
|
7651
7769
|
_innerConeAngle = 40;
|
|
7652
7770
|
_intensity = 1;
|
|
7653
|
-
_normalOffsetBias = 0
|
|
7771
|
+
_normalOffsetBias = 0;
|
|
7772
|
+
_numCascades = 1;
|
|
7654
7773
|
_outerConeAngle = 45;
|
|
7655
7774
|
_range = 10;
|
|
7656
|
-
_shadowBias = 0.
|
|
7657
|
-
_shadowDistance =
|
|
7775
|
+
_shadowBias = 0.05;
|
|
7776
|
+
_shadowDistance = 40;
|
|
7658
7777
|
_shadowIntensity = 1;
|
|
7659
7778
|
_shadowResolution = 1024;
|
|
7660
7779
|
_shadowType = 'pcf3-32f';
|
|
7661
7780
|
_type = 'directional';
|
|
7662
|
-
_vsmBias = 0.
|
|
7781
|
+
_vsmBias = 0.0025;
|
|
7663
7782
|
_vsmBlurSize = 11;
|
|
7664
7783
|
_penumbraSize = 1;
|
|
7665
7784
|
_penumbraFalloff = 1;
|
|
@@ -7671,11 +7790,14 @@ class LightComponentElement extends ComponentElement {
|
|
|
7671
7790
|
}
|
|
7672
7791
|
getInitialComponentData() {
|
|
7673
7792
|
return {
|
|
7793
|
+
cascadeBlend: this._cascadeBlend,
|
|
7794
|
+
cascadeDistribution: this._cascadeDistribution,
|
|
7674
7795
|
castShadows: this._castShadows,
|
|
7675
7796
|
color: this._color,
|
|
7676
7797
|
innerConeAngle: this._innerConeAngle,
|
|
7677
7798
|
intensity: this._intensity,
|
|
7678
7799
|
normalOffsetBias: this._normalOffsetBias,
|
|
7800
|
+
numCascades: this._numCascades,
|
|
7679
7801
|
outerConeAngle: this._outerConeAngle,
|
|
7680
7802
|
penumbraFalloff: this._penumbraFalloff,
|
|
7681
7803
|
penumbraSize: this._penumbraSize,
|
|
@@ -7686,7 +7808,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
7686
7808
|
shadowIntensity: this._shadowIntensity,
|
|
7687
7809
|
shadowResolution: this._shadowResolution,
|
|
7688
7810
|
shadowSamples: this._shadowSamples,
|
|
7689
|
-
shadowType: shadowTypes.get(this._shadowType),
|
|
7811
|
+
shadowType: shadowTypes.get(this._shadowType) ?? SHADOW_PCF3_32F,
|
|
7690
7812
|
type: this._type,
|
|
7691
7813
|
vsmBias: this._vsmBias,
|
|
7692
7814
|
vsmBlurSize: this._vsmBlurSize
|
|
@@ -7699,6 +7821,47 @@ class LightComponentElement extends ComponentElement {
|
|
|
7699
7821
|
get component() {
|
|
7700
7822
|
return super.component;
|
|
7701
7823
|
}
|
|
7824
|
+
/**
|
|
7825
|
+
* Sets the fraction of each shadow cascade that is blended into the next one, from 0 (no
|
|
7826
|
+
* blending) to 1, which applies only to `directional` lights with `num-cascades` greater than
|
|
7827
|
+
* 1. Defaults to 0.
|
|
7828
|
+
* @param value - The cascade blend factor.
|
|
7829
|
+
*/
|
|
7830
|
+
set cascadeBlend(value) {
|
|
7831
|
+
this._cascadeBlend = value;
|
|
7832
|
+
if (this.component) {
|
|
7833
|
+
this.component.cascadeBlend = value;
|
|
7834
|
+
}
|
|
7835
|
+
}
|
|
7836
|
+
/**
|
|
7837
|
+
* Gets the cascade blend factor of the light, from 0 (no blending) to 1, which applies only to
|
|
7838
|
+
* `directional` lights with `num-cascades` greater than 1.
|
|
7839
|
+
* @returns The cascade blend factor.
|
|
7840
|
+
*/
|
|
7841
|
+
get cascadeBlend() {
|
|
7842
|
+
return this._cascadeBlend;
|
|
7843
|
+
}
|
|
7844
|
+
/**
|
|
7845
|
+
* Sets the distribution of the camera frustum split between shadow cascades, from 0 (linear
|
|
7846
|
+
* split) to 1 (logarithmic split, concentrating shadow resolution near the camera), which
|
|
7847
|
+
* applies only to `directional` lights with `num-cascades` greater than 1. Defaults to 0.5.
|
|
7848
|
+
* @param value - The cascade distribution.
|
|
7849
|
+
*/
|
|
7850
|
+
set cascadeDistribution(value) {
|
|
7851
|
+
this._cascadeDistribution = value;
|
|
7852
|
+
if (this.component) {
|
|
7853
|
+
this.component.cascadeDistribution = value;
|
|
7854
|
+
}
|
|
7855
|
+
}
|
|
7856
|
+
/**
|
|
7857
|
+
* Gets the cascade distribution of the light, from 0 (linear split) to 1 (logarithmic split,
|
|
7858
|
+
* concentrating shadow resolution near the camera), which applies only to `directional` lights
|
|
7859
|
+
* with `num-cascades` greater than 1.
|
|
7860
|
+
* @returns The cascade distribution.
|
|
7861
|
+
*/
|
|
7862
|
+
get cascadeDistribution() {
|
|
7863
|
+
return this._cascadeDistribution;
|
|
7864
|
+
}
|
|
7702
7865
|
/**
|
|
7703
7866
|
* Sets the cast shadows flag of the light.
|
|
7704
7867
|
* @param value - The cast shadows flag.
|
|
@@ -7784,6 +7947,25 @@ class LightComponentElement extends ComponentElement {
|
|
|
7784
7947
|
get normalOffsetBias() {
|
|
7785
7948
|
return this._normalOffsetBias;
|
|
7786
7949
|
}
|
|
7950
|
+
/**
|
|
7951
|
+
* Sets the number of shadow cascades of the light, an integer from 1 (no cascades) to 4, which
|
|
7952
|
+
* applies only to `directional` lights. Defaults to 1.
|
|
7953
|
+
* @param value - The number of shadow cascades.
|
|
7954
|
+
*/
|
|
7955
|
+
set numCascades(value) {
|
|
7956
|
+
this._numCascades = value;
|
|
7957
|
+
if (this.component) {
|
|
7958
|
+
this.component.numCascades = value;
|
|
7959
|
+
}
|
|
7960
|
+
}
|
|
7961
|
+
/**
|
|
7962
|
+
* Gets the number of shadow cascades of the light, an integer from 1 (no cascades) to 4, which
|
|
7963
|
+
* applies only to `directional` lights.
|
|
7964
|
+
* @returns The number of shadow cascades.
|
|
7965
|
+
*/
|
|
7966
|
+
get numCascades() {
|
|
7967
|
+
return this._numCascades;
|
|
7968
|
+
}
|
|
7787
7969
|
/**
|
|
7788
7970
|
* Sets the outer cone angle of the light.
|
|
7789
7971
|
* @param value - The outer cone angle.
|
|
@@ -8036,11 +8218,14 @@ class LightComponentElement extends ComponentElement {
|
|
|
8036
8218
|
static get observedAttributes() {
|
|
8037
8219
|
return [
|
|
8038
8220
|
...super.observedAttributes,
|
|
8039
|
-
'
|
|
8221
|
+
'cascade-blend',
|
|
8222
|
+
'cascade-distribution',
|
|
8040
8223
|
'cast-shadows',
|
|
8041
|
-
'
|
|
8224
|
+
'color',
|
|
8042
8225
|
'inner-cone-angle',
|
|
8226
|
+
'intensity',
|
|
8043
8227
|
'normal-offset-bias',
|
|
8228
|
+
'num-cascades',
|
|
8044
8229
|
'outer-cone-angle',
|
|
8045
8230
|
'penumbra-falloff',
|
|
8046
8231
|
'penumbra-size',
|
|
@@ -8060,12 +8245,18 @@ class LightComponentElement extends ComponentElement {
|
|
|
8060
8245
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
8061
8246
|
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
8062
8247
|
switch (name) {
|
|
8063
|
-
case '
|
|
8064
|
-
this.
|
|
8248
|
+
case 'cascade-blend':
|
|
8249
|
+
this.cascadeBlend = parseNumber(newValue, 0, name);
|
|
8250
|
+
break;
|
|
8251
|
+
case 'cascade-distribution':
|
|
8252
|
+
this.cascadeDistribution = parseNumber(newValue, 0.5, name);
|
|
8065
8253
|
break;
|
|
8066
8254
|
case 'cast-shadows':
|
|
8067
8255
|
this.castShadows = parseBool(newValue, false);
|
|
8068
8256
|
break;
|
|
8257
|
+
case 'color':
|
|
8258
|
+
this.color = parseColor(newValue, Color.WHITE, name);
|
|
8259
|
+
break;
|
|
8069
8260
|
case 'inner-cone-angle':
|
|
8070
8261
|
this.innerConeAngle = parseNumber(newValue, 40, name);
|
|
8071
8262
|
break;
|
|
@@ -8073,7 +8264,10 @@ class LightComponentElement extends ComponentElement {
|
|
|
8073
8264
|
this.intensity = parseNumber(newValue, 1, name);
|
|
8074
8265
|
break;
|
|
8075
8266
|
case 'normal-offset-bias':
|
|
8076
|
-
this.normalOffsetBias = parseNumber(newValue, 0
|
|
8267
|
+
this.normalOffsetBias = parseNumber(newValue, 0, name);
|
|
8268
|
+
break;
|
|
8269
|
+
case 'num-cascades':
|
|
8270
|
+
this.numCascades = parseNumber(newValue, 1, name);
|
|
8077
8271
|
break;
|
|
8078
8272
|
case 'outer-cone-angle':
|
|
8079
8273
|
this.outerConeAngle = parseNumber(newValue, 45, name);
|
|
@@ -8088,20 +8282,20 @@ class LightComponentElement extends ComponentElement {
|
|
|
8088
8282
|
this.range = parseNumber(newValue, 10, name);
|
|
8089
8283
|
break;
|
|
8090
8284
|
case 'shadow-bias':
|
|
8091
|
-
this.shadowBias = parseNumber(newValue, 0.
|
|
8092
|
-
break;
|
|
8093
|
-
case 'shadow-distance':
|
|
8094
|
-
this.shadowDistance = parseNumber(newValue, 16, name);
|
|
8285
|
+
this.shadowBias = parseNumber(newValue, 0.05, name);
|
|
8095
8286
|
break;
|
|
8096
8287
|
case 'shadow-blocker-samples':
|
|
8097
8288
|
this.shadowBlockerSamples = parseNumber(newValue, 16, name);
|
|
8098
8289
|
break;
|
|
8099
|
-
case 'shadow-
|
|
8100
|
-
this.
|
|
8290
|
+
case 'shadow-distance':
|
|
8291
|
+
this.shadowDistance = parseNumber(newValue, 40, name);
|
|
8101
8292
|
break;
|
|
8102
8293
|
case 'shadow-intensity':
|
|
8103
8294
|
this.shadowIntensity = parseNumber(newValue, 1, name);
|
|
8104
8295
|
break;
|
|
8296
|
+
case 'shadow-resolution':
|
|
8297
|
+
this.shadowResolution = parseNumber(newValue, 1024, name);
|
|
8298
|
+
break;
|
|
8105
8299
|
case 'shadow-samples':
|
|
8106
8300
|
this.shadowSamples = parseNumber(newValue, 16, name);
|
|
8107
8301
|
break;
|
|
@@ -8112,7 +8306,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
8112
8306
|
this.type = parseEnum(newValue, ['directional', 'omni', 'spot'], 'directional', name);
|
|
8113
8307
|
break;
|
|
8114
8308
|
case 'vsm-bias':
|
|
8115
|
-
this.vsmBias = parseNumber(newValue, 0.
|
|
8309
|
+
this.vsmBias = parseNumber(newValue, 0.0025, name);
|
|
8116
8310
|
break;
|
|
8117
8311
|
case 'vsm-blur-size':
|
|
8118
8312
|
this.vsmBlurSize = parseNumber(newValue, 11, name);
|
|
@@ -8130,6 +8324,10 @@ customElements.define('pc-light', LightComponentElement);
|
|
|
8130
8324
|
*
|
|
8131
8325
|
* Engine component: {@link ParticleSystemComponent} (`particlesystem`).
|
|
8132
8326
|
*
|
|
8327
|
+
* @elementSummary The `<pc-particle-system>` element emits particles from its entity, with
|
|
8328
|
+
* attributes for the emitter's shape, rate, lifetime, textures and blending. Must be a child of a
|
|
8329
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
8330
|
+
*
|
|
8133
8331
|
* @category Components
|
|
8134
8332
|
*/
|
|
8135
8333
|
class ParticleSystemComponentElement extends ComponentElement {
|
|
@@ -8278,6 +8476,8 @@ const occludeSpeculars = new Map([
|
|
|
8278
8476
|
['ao', SPECOCC_AO],
|
|
8279
8477
|
['gloss-dependent', SPECOCC_GLOSSDEPENDENT]
|
|
8280
8478
|
]);
|
|
8479
|
+
// The DITHER_* constants are strings whose values are exactly these names, so a parsed value is
|
|
8480
|
+
// assigned to the material unchanged rather than mapped through a table.
|
|
8281
8481
|
const opacityDithers = ['none', 'bayer8', 'bluenoise', 'ignnoise'];
|
|
8282
8482
|
const colorChannels = ['r', 'g', 'b', 'a', 'rgb'];
|
|
8283
8483
|
const scalarChannels = ['r', 'g', 'b', 'a'];
|
|
@@ -8314,6 +8514,10 @@ const roughnessAliases = ['roughness', 'roughness-map'];
|
|
|
8314
8514
|
* The two aliases are documented here rather than on an accessor, because they resolve to the
|
|
8315
8515
|
* `gloss` properties and would otherwise inherit gloss's description - which reads inverted.
|
|
8316
8516
|
*
|
|
8517
|
+
* @elementSummary The `<pc-material>` element defines a physically based material, which
|
|
8518
|
+
* `<pc-render>` elements apply by naming its `id`. It is metal/rough by default, with `metalness`
|
|
8519
|
+
* starting at 0. Must be a direct child of `<pc-app>`.
|
|
8520
|
+
*
|
|
8317
8521
|
* @attribute {number} roughness - The roughness of the material, from 0 (shiny) to 1 (rough). An
|
|
8318
8522
|
* alias for `gloss` that also inverts it, so do not combine it with the `gloss` attributes.
|
|
8319
8523
|
* @attribute {string} roughness-map - The id of the `pc-asset` to use as the roughness map. An
|
|
@@ -10482,6 +10686,11 @@ customElements.define('pc-material', MaterialElement);
|
|
|
10482
10686
|
*
|
|
10483
10687
|
* Engine component: {@link RenderComponent} (`render`).
|
|
10484
10688
|
*
|
|
10689
|
+
* @elementSummary The `<pc-render>` element renders one of the engine's built-in primitives at its
|
|
10690
|
+
* entity — box, sphere, capsule, cone, cylinder or plane — shaded by the `<pc-material>` its
|
|
10691
|
+
* `material` attribute names. For glTF content, use `<pc-model>` instead. Must be a child of a
|
|
10692
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
10693
|
+
*
|
|
10485
10694
|
* @category Components
|
|
10486
10695
|
*/
|
|
10487
10696
|
class RenderComponentElement extends ComponentElement {
|
|
@@ -10612,6 +10821,11 @@ customElements.define('pc-render', RenderComponentElement);
|
|
|
10612
10821
|
*
|
|
10613
10822
|
* Engine component: {@link RigidBodyComponent} (`rigidbody`).
|
|
10614
10823
|
*
|
|
10824
|
+
* @elementSummary The `<pc-rigid-body>` element hands its entity to the physics simulation, with
|
|
10825
|
+
* attributes for its type, mass, friction and restitution. It needs a sibling `<pc-collision>` for
|
|
10826
|
+
* its shape, and `Ammo` loaded through `<pc-wasm>`. Must be a child of a `<pc-entity>`,
|
|
10827
|
+
* `<pc-model>` or `<pc-node>`.
|
|
10828
|
+
*
|
|
10615
10829
|
* @category Components
|
|
10616
10830
|
*/
|
|
10617
10831
|
class RigidBodyComponentElement extends ComponentElement {
|
|
@@ -10821,6 +11035,10 @@ const scaleModes = new Map([
|
|
|
10821
11035
|
*
|
|
10822
11036
|
* Engine component: {@link ScreenComponent} (`screen`).
|
|
10823
11037
|
*
|
|
11038
|
+
* @elementSummary The `<pc-screen>` element gives its entity a 2D space — in screen space or in the
|
|
11039
|
+
* world — that a hierarchy of `<pc-element>` descendants lays out inside. Must be a child of a
|
|
11040
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
11041
|
+
*
|
|
10824
11042
|
* @category Components
|
|
10825
11043
|
*/
|
|
10826
11044
|
class ScreenComponentElement extends ComponentElement {
|
|
@@ -10975,6 +11193,10 @@ const orientations = new Map([
|
|
|
10975
11193
|
*
|
|
10976
11194
|
* Engine component: {@link ScrollbarComponent} (`scrollbar`).
|
|
10977
11195
|
*
|
|
11196
|
+
* @elementSummary The `<pc-scrollbar>` element gives its entity a draggable handle reporting a
|
|
11197
|
+
* position from 0 to 1, which a `<pc-scroll-view>` references to scroll its content. Must be a
|
|
11198
|
+
* child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
11199
|
+
*
|
|
10978
11200
|
* @category Components
|
|
10979
11201
|
*/
|
|
10980
11202
|
class ScrollbarComponentElement extends ComponentElement {
|
|
@@ -11116,6 +11338,10 @@ const visibilities = new Map([
|
|
|
11116
11338
|
*
|
|
11117
11339
|
* Engine component: {@link ScrollViewComponent} (`scrollview`).
|
|
11118
11340
|
*
|
|
11341
|
+
* @elementSummary The `<pc-scroll-view>` element scrolls a larger content entity within a clipped
|
|
11342
|
+
* viewport at its entity, optionally driven by the `<pc-scrollbar>` elements it references. Must be
|
|
11343
|
+
* a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
11344
|
+
*
|
|
11119
11345
|
* @category Components
|
|
11120
11346
|
*/
|
|
11121
11347
|
class ScrollViewComponentElement extends ComponentElement {
|
|
@@ -11502,6 +11728,10 @@ customElements.define('pc-scroll-view', ScrollViewComponentElement);
|
|
|
11502
11728
|
* The element becomes ready once its script instance has been created by the parent
|
|
11503
11729
|
* `<pc-script>` element.
|
|
11504
11730
|
*
|
|
11731
|
+
* @elementSummary The `<pc-script-instance>` element attaches one script class, named by `name`, to
|
|
11732
|
+
* the entity of its parent `<pc-script>`. Its other attributes set script attributes of the same
|
|
11733
|
+
* name, and `attributes` takes a JSON object instead. Must be a direct child of `<pc-script>`.
|
|
11734
|
+
*
|
|
11505
11735
|
* @fires {CustomEvent} scriptattributeschange - Fired when the script's attributes change. The
|
|
11506
11736
|
* `detail` carries the new `attributes` object. Bubbles.
|
|
11507
11737
|
* @fires {CustomEvent} scriptenablechange - Fired when the script's enabled state changes. The
|
|
@@ -11846,6 +12076,9 @@ const findCaseMatch = (script, key) => {
|
|
|
11846
12076
|
*
|
|
11847
12077
|
* Engine component: {@link ScriptComponent} (`script`).
|
|
11848
12078
|
*
|
|
12079
|
+
* @elementSummary The `<pc-script>` element holds the `<pc-script-instance>` children that attach
|
|
12080
|
+
* scripts to its entity. Must be a child of a `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
12081
|
+
*
|
|
11849
12082
|
* @category Components
|
|
11850
12083
|
*/
|
|
11851
12084
|
class ScriptComponentElement extends ComponentElement {
|
|
@@ -12295,6 +12528,10 @@ customElements.define('pc-script', ScriptComponentElement);
|
|
|
12295
12528
|
*
|
|
12296
12529
|
* Engine component: {@link SoundComponent} (`sound`).
|
|
12297
12530
|
*
|
|
12531
|
+
* @elementSummary The `<pc-sound>` element holds the `<pc-sound-slot>` children that play sounds at
|
|
12532
|
+
* its entity, along with the positional audio settings they share. Must be a child of a
|
|
12533
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
12534
|
+
*
|
|
12298
12535
|
* @category Components
|
|
12299
12536
|
*/
|
|
12300
12537
|
class SoundComponentElement extends ComponentElement {
|
|
@@ -12491,6 +12728,9 @@ customElements.define('pc-sound', SoundComponentElement);
|
|
|
12491
12728
|
* The SoundSlotElement interface provides properties and methods for manipulating
|
|
12492
12729
|
* `<pc-sound-slot>` elements. The SoundSlotElement interface also inherits the properties and
|
|
12493
12730
|
* methods of the {@link AsyncElement} interface.
|
|
12731
|
+
*
|
|
12732
|
+
* @elementSummary The `<pc-sound-slot>` element declares one named sound on its parent `<pc-sound>`
|
|
12733
|
+
* — its asset, volume, pitch, looping and autoplay. Must be a direct child of `<pc-sound>`.
|
|
12494
12734
|
*/
|
|
12495
12735
|
class SoundSlotElement extends AsyncElement {
|
|
12496
12736
|
_asset = '';
|
|
@@ -12772,6 +13012,10 @@ customElements.define('pc-sound-slot', SoundSlotElement);
|
|
|
12772
13012
|
*
|
|
12773
13013
|
* Engine component: {@link GSplatComponent} (`gsplat`).
|
|
12774
13014
|
*
|
|
13015
|
+
* @elementSummary The `<pc-gsplat>` element renders the 3D Gaussian splats of a `gsplat` asset at
|
|
13016
|
+
* its entity, with attributes for shadow casting and level of detail. Must be a child of a
|
|
13017
|
+
* `<pc-entity>`, `<pc-model>` or `<pc-node>`.
|
|
13018
|
+
*
|
|
12775
13019
|
* @category Components
|
|
12776
13020
|
*/
|
|
12777
13021
|
class GSplatComponentElement extends ComponentElement {
|
|
@@ -13067,6 +13311,11 @@ const levenshtein = (a, b) => {
|
|
|
13067
13311
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
13068
13312
|
* intersects the bound node's geometry, exactly as for `<pc-entity>`.
|
|
13069
13313
|
*
|
|
13314
|
+
* @elementSummary The `<pc-node>` element binds to a node inside the hierarchy a `<pc-model>`
|
|
13315
|
+
* instantiated and declares overrides against it: a transform, an enabled state, tags, components
|
|
13316
|
+
* to add, or content to attach. Its `name` is a lookup, never a rename. Must be a descendant of
|
|
13317
|
+
* `<pc-model>`.
|
|
13318
|
+
*
|
|
13070
13319
|
* @attribute {string} name - The name of the node to bind, resolved within the nearest ancestor
|
|
13071
13320
|
* `pc-model` (or `pc-node`) once it has instantiated.
|
|
13072
13321
|
* @attribute {number} index - Which match to bind when `name` matches more than one node,
|
|
@@ -13807,6 +14056,9 @@ customElements.define('pc-node', NodeElement);
|
|
|
13807
14056
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
|
|
13808
14057
|
* The SceneElement interface also inherits the properties and methods of the
|
|
13809
14058
|
* {@link HTMLElement} interface.
|
|
14059
|
+
*
|
|
14060
|
+
* @elementSummary The `<pc-scene>` element holds the entity hierarchy the application renders,
|
|
14061
|
+
* along with the scene-wide fog and gravity settings. Must be a direct child of `<pc-app>`.
|
|
13810
14062
|
*/
|
|
13811
14063
|
class SceneElement extends AsyncElement {
|
|
13812
14064
|
/**
|
|
@@ -14030,6 +14282,10 @@ customElements.define('pc-scene', SceneElement);
|
|
|
14030
14282
|
* The SkyElement interface provides properties and methods for manipulating
|
|
14031
14283
|
* `<pc-sky>` elements. The SkyElement interface also inherits the properties and
|
|
14032
14284
|
* methods of the {@link HTMLElement} interface.
|
|
14285
|
+
*
|
|
14286
|
+
* @elementSummary The `<pc-sky>` element renders a skybox from a texture asset, projected as an
|
|
14287
|
+
* infinite background, a box or a dome, and optionally lights the scene from it. Must be a direct
|
|
14288
|
+
* child of `<pc-scene>`.
|
|
14033
14289
|
*/
|
|
14034
14290
|
class SkyElement extends AsyncElement {
|
|
14035
14291
|
_asset = '';
|