@playcanvas/web-components 0.17.0 → 0.19.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 +28 -3
- package/dist/app.d.ts +28 -3
- package/dist/asset.d.cts +13 -3
- package/dist/asset.d.ts +13 -3
- package/dist/components/anim-clip.d.cts +3 -1
- package/dist/components/anim-clip.d.ts +3 -1
- 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 +338 -7
- package/dist/entity-base.d.cts +5 -4
- package/dist/entity-base.d.ts +5 -4
- package/dist/entity-owner.d.cts +2 -2
- package/dist/entity-owner.d.ts +2 -2
- package/dist/entity.d.cts +13 -2
- package/dist/entity.d.ts +13 -2
- 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 +11 -0
- package/dist/model.d.ts +11 -0
- package/dist/node.d.cts +12 -1
- package/dist/node.d.ts +12 -1
- package/dist/pwc.cjs +601 -206
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +601 -206
- 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 +602 -207
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.cts +19 -0
- package/dist/scene.d.ts +19 -0
- package/dist/sky.d.cts +4 -0
- package/dist/sky.d.ts +4 -0
- package/dist/vscode.html-custom-data.json +257 -62
- package/dist/wasm.d.cts +4 -0
- package/dist/wasm.d.ts +4 -0
- package/dist/web-types.json +169 -69
- package/package.json +3 -3
- package/src/app.ts +150 -71
- package/src/asset.ts +13 -4
- package/src/components/anim-clip.ts +3 -1
- 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 +28 -16
- package/src/entity-owner.ts +2 -2
- package/src/entity.ts +16 -4
- package/src/index.ts +12 -1
- package/src/material.ts +19 -8
- package/src/model.ts +14 -2
- package/src/node.ts +15 -3
- package/src/scene.ts +35 -1
- package/src/sky.ts +4 -0
- package/src/wasm.ts +4 -0
package/dist/entity-base.d.cts
CHANGED
|
@@ -17,11 +17,12 @@ declare class EntityBaseElement extends AsyncElement {
|
|
|
17
17
|
*/
|
|
18
18
|
protected _appElement: AppElement | null;
|
|
19
19
|
/**
|
|
20
|
-
* The
|
|
20
|
+
* The event listeners registered on the element, by type.
|
|
21
21
|
*/
|
|
22
22
|
private _listeners;
|
|
23
23
|
/**
|
|
24
|
-
* The event types for which an inline
|
|
24
|
+
* The event types for which an inline handler attribute (`onpointerdown`, `onclick`, ...)
|
|
25
|
+
* is currently present.
|
|
25
26
|
*/
|
|
26
27
|
private _inlineHandlerTypes;
|
|
27
28
|
/**
|
|
@@ -45,10 +46,10 @@ declare class EntityBaseElement extends AsyncElement {
|
|
|
45
46
|
*/
|
|
46
47
|
protected _unregisterEntity(entity: Entity): void;
|
|
47
48
|
/**
|
|
48
|
-
* Tracks whether an inline
|
|
49
|
+
* Tracks whether an inline handler attribute is present. The browser itself compiles and
|
|
49
50
|
* runs these attributes — they are standard `GlobalEventHandlers`, so setting one replaces
|
|
50
51
|
* the previous handler and removing it removes the handler, exactly like `onclick` on any
|
|
51
|
-
* HTML element. But because they bypass {@link addEventListener}, the connect/disconnect
|
|
52
|
+
* HTML element. But because they bypass {@link EventTarget.addEventListener}, the connect/disconnect
|
|
52
53
|
* bookkeeping that lets the application lazily attach its canvas pointer handlers must be
|
|
53
54
|
* kept in sync here.
|
|
54
55
|
*
|
package/dist/entity-base.d.ts
CHANGED
|
@@ -17,11 +17,12 @@ declare class EntityBaseElement extends AsyncElement {
|
|
|
17
17
|
*/
|
|
18
18
|
protected _appElement: AppElement | null;
|
|
19
19
|
/**
|
|
20
|
-
* The
|
|
20
|
+
* The event listeners registered on the element, by type.
|
|
21
21
|
*/
|
|
22
22
|
private _listeners;
|
|
23
23
|
/**
|
|
24
|
-
* The event types for which an inline
|
|
24
|
+
* The event types for which an inline handler attribute (`onpointerdown`, `onclick`, ...)
|
|
25
|
+
* is currently present.
|
|
25
26
|
*/
|
|
26
27
|
private _inlineHandlerTypes;
|
|
27
28
|
/**
|
|
@@ -45,10 +46,10 @@ declare class EntityBaseElement extends AsyncElement {
|
|
|
45
46
|
*/
|
|
46
47
|
protected _unregisterEntity(entity: Entity): void;
|
|
47
48
|
/**
|
|
48
|
-
* Tracks whether an inline
|
|
49
|
+
* Tracks whether an inline handler attribute is present. The browser itself compiles and
|
|
49
50
|
* runs these attributes — they are standard `GlobalEventHandlers`, so setting one replaces
|
|
50
51
|
* the previous handler and removing it removes the handler, exactly like `onclick` on any
|
|
51
|
-
* HTML element. But because they bypass {@link addEventListener}, the connect/disconnect
|
|
52
|
+
* HTML element. But because they bypass {@link EventTarget.addEventListener}, the connect/disconnect
|
|
52
53
|
* bookkeeping that lets the application lazily attach its canvas pointer handlers must be
|
|
53
54
|
* kept in sync here.
|
|
54
55
|
*
|
package/dist/entity-owner.d.cts
CHANGED
|
@@ -33,7 +33,7 @@ declare class EntityOwnerElement extends EntityBaseElement {
|
|
|
33
33
|
*/
|
|
34
34
|
private _tags;
|
|
35
35
|
/**
|
|
36
|
-
* Whether the hierarchy has been built for this entity — set once
|
|
36
|
+
* Whether the hierarchy has been built for this entity — set once `_buildHierarchy` has
|
|
37
37
|
* parented it. Read by subclasses that gate work on the entity being in the scene graph.
|
|
38
38
|
*/
|
|
39
39
|
protected _built: boolean;
|
|
@@ -48,7 +48,7 @@ declare class EntityOwnerElement extends EntityBaseElement {
|
|
|
48
48
|
*/
|
|
49
49
|
protected _onEntityDestroy(entity: Entity): void;
|
|
50
50
|
/**
|
|
51
|
-
* Called by
|
|
51
|
+
* Called by `_buildHierarchy` once the backing entity has been parented — exactly once
|
|
52
52
|
* per build cycle. The default announces readiness, which is what a parented `<pc-entity>`
|
|
53
53
|
* means; `<pc-model>` overrides it to start loading content instead, because its readiness
|
|
54
54
|
* tracks the content settling rather than the host entering the scene graph.
|
package/dist/entity-owner.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare class EntityOwnerElement extends EntityBaseElement {
|
|
|
33
33
|
*/
|
|
34
34
|
private _tags;
|
|
35
35
|
/**
|
|
36
|
-
* Whether the hierarchy has been built for this entity — set once
|
|
36
|
+
* Whether the hierarchy has been built for this entity — set once `_buildHierarchy` has
|
|
37
37
|
* parented it. Read by subclasses that gate work on the entity being in the scene graph.
|
|
38
38
|
*/
|
|
39
39
|
protected _built: boolean;
|
|
@@ -48,7 +48,7 @@ declare class EntityOwnerElement extends EntityBaseElement {
|
|
|
48
48
|
*/
|
|
49
49
|
protected _onEntityDestroy(entity: Entity): void;
|
|
50
50
|
/**
|
|
51
|
-
* Called by
|
|
51
|
+
* Called by `_buildHierarchy` once the backing entity has been parented — exactly once
|
|
52
52
|
* per build cycle. The default announces readiness, which is what a parented `<pc-entity>`
|
|
53
53
|
* means; `<pc-model>` overrides it to start loading content instead, because its readiness
|
|
54
54
|
* tracks the content settling rather than the host entering the scene graph.
|
package/dist/entity.d.cts
CHANGED
|
@@ -7,8 +7,13 @@ import { EntityOwnerElement } from './entity-owner.cjs';
|
|
|
7
7
|
*
|
|
8
8
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
9
9
|
* intersects this entity's geometry. They are only generated while the entity has a listener for
|
|
10
|
-
* them, registered either with {@link addEventListener} or with the matching inline
|
|
11
|
-
* attribute.
|
|
10
|
+
* them, registered either with {@link EventTarget.addEventListener} or with the matching inline
|
|
11
|
+
* attribute (`onpointerdown`, `onclick`, ...).
|
|
12
|
+
*
|
|
13
|
+
* @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
|
|
14
|
+
* scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
|
|
15
|
+
* `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
|
|
16
|
+
* `<pc-model>` or a `<pc-node>` to parent it there.
|
|
12
17
|
*
|
|
13
18
|
* @attribute {boolean} enabled - The enabled state of the entity.
|
|
14
19
|
* @attribute {string} name - The name of the entity.
|
|
@@ -23,11 +28,17 @@ import { EntityOwnerElement } from './entity-owner.cjs';
|
|
|
23
28
|
* entity.
|
|
24
29
|
* @attribute {string} onpointerup - Script to run when a pointer button is released over the
|
|
25
30
|
* entity.
|
|
31
|
+
* @attribute {string} onclick - Script to run when the entity is clicked: a primary pointer
|
|
32
|
+
* button pressed and then released over it.
|
|
26
33
|
* @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the entity.
|
|
27
34
|
* @fires {PointerEvent} pointerleave - Fired when the pointer moves off the entity.
|
|
28
35
|
* @fires {PointerEvent} pointermove - Fired when the pointer moves over the entity.
|
|
29
36
|
* @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the entity.
|
|
30
37
|
* @fires {PointerEvent} pointerup - Fired when a pointer button is released over the entity.
|
|
38
|
+
* @fires {PointerEvent} click - Fired when a primary pointer button is pressed and then released
|
|
39
|
+
* over the entity. A press and release that picked different entities fires on their nearest
|
|
40
|
+
* common ancestor instead, as in the DOM. `detail` carries the click count, so a double click
|
|
41
|
+
* arrives as a click whose `detail` is 2.
|
|
31
42
|
*/
|
|
32
43
|
declare class EntityElement extends EntityOwnerElement {
|
|
33
44
|
connectedCallback(): void;
|
package/dist/entity.d.ts
CHANGED
|
@@ -7,8 +7,13 @@ import { EntityOwnerElement } from './entity-owner.js';
|
|
|
7
7
|
*
|
|
8
8
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
9
9
|
* intersects this entity's geometry. They are only generated while the entity has a listener for
|
|
10
|
-
* them, registered either with {@link addEventListener} or with the matching inline
|
|
11
|
-
* attribute.
|
|
10
|
+
* them, registered either with {@link EventTarget.addEventListener} or with the matching inline
|
|
11
|
+
* attribute (`onpointerdown`, `onclick`, ...).
|
|
12
|
+
*
|
|
13
|
+
* @elementSummary The `<pc-entity>` element creates an entity: a named, transformable node of the
|
|
14
|
+
* scene hierarchy, and the host for component elements such as `<pc-camera>`, `<pc-light>` and
|
|
15
|
+
* `<pc-render>`. Place it in the `<pc-scene>`, or nest it under another `<pc-entity>`, a
|
|
16
|
+
* `<pc-model>` or a `<pc-node>` to parent it there.
|
|
12
17
|
*
|
|
13
18
|
* @attribute {boolean} enabled - The enabled state of the entity.
|
|
14
19
|
* @attribute {string} name - The name of the entity.
|
|
@@ -23,11 +28,17 @@ import { EntityOwnerElement } from './entity-owner.js';
|
|
|
23
28
|
* entity.
|
|
24
29
|
* @attribute {string} onpointerup - Script to run when a pointer button is released over the
|
|
25
30
|
* entity.
|
|
31
|
+
* @attribute {string} onclick - Script to run when the entity is clicked: a primary pointer
|
|
32
|
+
* button pressed and then released over it.
|
|
26
33
|
* @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the entity.
|
|
27
34
|
* @fires {PointerEvent} pointerleave - Fired when the pointer moves off the entity.
|
|
28
35
|
* @fires {PointerEvent} pointermove - Fired when the pointer moves over the entity.
|
|
29
36
|
* @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the entity.
|
|
30
37
|
* @fires {PointerEvent} pointerup - Fired when a pointer button is released over the entity.
|
|
38
|
+
* @fires {PointerEvent} click - Fired when a primary pointer button is pressed and then released
|
|
39
|
+
* over the entity. A press and release that picked different entities fires on their nearest
|
|
40
|
+
* common ancestor instead, as in the DOM. `detail` carries the click count, so a double click
|
|
41
|
+
* arrives as a click whose `detail` is 2.
|
|
31
42
|
*/
|
|
32
43
|
declare class EntityElement extends EntityOwnerElement {
|
|
33
44
|
connectedCallback(): void;
|
package/dist/index.d.cts
CHANGED
|
@@ -84,6 +84,9 @@ declare global {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
export { AsyncElement, WasmElement, AppElement, EntityElement, AssetElement, AnimComponentElement, AnimClipElement, ButtonComponentElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, JointComponentElement, LayoutChildComponentElement, LayoutGroupComponentElement, ParticleSystemComponentElement, LightComponentElement, AudioListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScreenComponentElement, ScrollbarComponentElement, ScrollViewComponentElement, ScriptComponentElement, ScriptInstanceElement, SoundComponentElement, SoundSlotElement, GSplatComponentElement, EntityBaseElement, EntityOwnerElement, MaterialElement, ModelElement, NodeElement, SceneElement, SkyElement, whenReady };
|
|
87
|
+
export type { AddressMode, MagFilterMode, MinFilterMode } from './asset.cjs';
|
|
87
88
|
export type { AsyncElementTagName } from './async-element.cjs';
|
|
89
|
+
export type { JointType, MotionMode } from './components/joint-component.cjs';
|
|
90
|
+
export type { BlendType, ColorChannel, CullMode, FresnelModel, OccludeSpecular, OpacityDither, ScalarChannel } from './material.cjs';
|
|
88
91
|
export type { HierarchyMaterial, HierarchyNode } from './model.cjs';
|
|
89
|
-
export type { MaterialOverrides } from './node.cjs';
|
|
92
|
+
export type { MaterialOverrides, NodeBindingState } from './node.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,9 @@ declare global {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
export { AsyncElement, WasmElement, AppElement, EntityElement, AssetElement, AnimComponentElement, AnimClipElement, ButtonComponentElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, JointComponentElement, LayoutChildComponentElement, LayoutGroupComponentElement, ParticleSystemComponentElement, LightComponentElement, AudioListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScreenComponentElement, ScrollbarComponentElement, ScrollViewComponentElement, ScriptComponentElement, ScriptInstanceElement, SoundComponentElement, SoundSlotElement, GSplatComponentElement, EntityBaseElement, EntityOwnerElement, MaterialElement, ModelElement, NodeElement, SceneElement, SkyElement, whenReady };
|
|
87
|
+
export type { AddressMode, MagFilterMode, MinFilterMode } from './asset.js';
|
|
87
88
|
export type { AsyncElementTagName } from './async-element.js';
|
|
89
|
+
export type { JointType, MotionMode } from './components/joint-component.js';
|
|
90
|
+
export type { BlendType, ColorChannel, CullMode, FresnelModel, OccludeSpecular, OpacityDither, ScalarChannel } from './material.js';
|
|
88
91
|
export type { HierarchyMaterial, HierarchyNode } from './model.js';
|
|
89
|
-
export type { MaterialOverrides } from './node.js';
|
|
92
|
+
export type { MaterialOverrides, NodeBindingState } from './node.js';
|
package/dist/material.d.cts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { Color, StandardMaterial, Vec2 } from 'playcanvas';
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
-
|
|
2
|
+
/** The blend modes for a material. */
|
|
3
|
+
export type BlendType = 'none' | 'normal' | 'additive' | 'additive-alpha' | 'premultiplied' | 'multiplicative' | 'multiplicative-2x' | 'screen' | 'min' | 'max' | 'subtractive';
|
|
4
|
+
/** The face culling modes for a material. */
|
|
5
|
+
export type CullMode = 'none' | 'back' | 'front' | 'front-and-back';
|
|
6
|
+
/** The Fresnel models for a material. */
|
|
7
|
+
export type FresnelModel = 'none' | 'schlick';
|
|
8
|
+
/** The specular occlusion modes for a material. */
|
|
9
|
+
export type OccludeSpecular = 'none' | 'ao' | 'gloss-dependent';
|
|
10
|
+
/** The opacity dithering modes for a material. */
|
|
11
|
+
export type OpacityDither = 'none' | 'bayer8' | 'bluenoise' | 'ignnoise';
|
|
12
|
+
/** The texture channels a color map can sample. */
|
|
13
|
+
export type ColorChannel = 'r' | 'g' | 'b' | 'a' | 'rgb';
|
|
14
|
+
/** The texture channels a scalar map can sample. */
|
|
15
|
+
export type ScalarChannel = 'r' | 'g' | 'b' | 'a';
|
|
9
16
|
/**
|
|
10
17
|
* The MaterialElement interface provides properties and methods for manipulating
|
|
11
18
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/ | `<pc-material>`} elements.
|
|
@@ -30,6 +37,10 @@ type ScalarChannel = 'r' | 'g' | 'b' | 'a';
|
|
|
30
37
|
* The two aliases are documented here rather than on an accessor, because they resolve to the
|
|
31
38
|
* `gloss` properties and would otherwise inherit gloss's description - which reads inverted.
|
|
32
39
|
*
|
|
40
|
+
* @elementSummary The `<pc-material>` element defines a physically based material, which
|
|
41
|
+
* `<pc-render>` elements apply by naming its `id`. It is metal/rough by default, with `metalness`
|
|
42
|
+
* starting at 0. Must be a direct child of `<pc-app>`.
|
|
43
|
+
*
|
|
33
44
|
* @attribute {number} roughness - The roughness of the material, from 0 (shiny) to 1 (rough). An
|
|
34
45
|
* alias for `gloss` that also inverts it, so do not combine it with the `gloss` attributes.
|
|
35
46
|
* @attribute {string} roughness-map - The id of the `pc-asset` to use as the roughness map. An
|
package/dist/material.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { Color, StandardMaterial, Vec2 } from 'playcanvas';
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
-
|
|
2
|
+
/** The blend modes for a material. */
|
|
3
|
+
export type BlendType = 'none' | 'normal' | 'additive' | 'additive-alpha' | 'premultiplied' | 'multiplicative' | 'multiplicative-2x' | 'screen' | 'min' | 'max' | 'subtractive';
|
|
4
|
+
/** The face culling modes for a material. */
|
|
5
|
+
export type CullMode = 'none' | 'back' | 'front' | 'front-and-back';
|
|
6
|
+
/** The Fresnel models for a material. */
|
|
7
|
+
export type FresnelModel = 'none' | 'schlick';
|
|
8
|
+
/** The specular occlusion modes for a material. */
|
|
9
|
+
export type OccludeSpecular = 'none' | 'ao' | 'gloss-dependent';
|
|
10
|
+
/** The opacity dithering modes for a material. */
|
|
11
|
+
export type OpacityDither = 'none' | 'bayer8' | 'bluenoise' | 'ignnoise';
|
|
12
|
+
/** The texture channels a color map can sample. */
|
|
13
|
+
export type ColorChannel = 'r' | 'g' | 'b' | 'a' | 'rgb';
|
|
14
|
+
/** The texture channels a scalar map can sample. */
|
|
15
|
+
export type ScalarChannel = 'r' | 'g' | 'b' | 'a';
|
|
9
16
|
/**
|
|
10
17
|
* The MaterialElement interface provides properties and methods for manipulating
|
|
11
18
|
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/ | `<pc-material>`} elements.
|
|
@@ -30,6 +37,10 @@ type ScalarChannel = 'r' | 'g' | 'b' | 'a';
|
|
|
30
37
|
* The two aliases are documented here rather than on an accessor, because they resolve to the
|
|
31
38
|
* `gloss` properties and would otherwise inherit gloss's description - which reads inverted.
|
|
32
39
|
*
|
|
40
|
+
* @elementSummary The `<pc-material>` element defines a physically based material, which
|
|
41
|
+
* `<pc-render>` elements apply by naming its `id`. It is metal/rough by default, with `metalness`
|
|
42
|
+
* starting at 0. Must be a direct child of `<pc-app>`.
|
|
43
|
+
*
|
|
33
44
|
* @attribute {number} roughness - The roughness of the material, from 0 (shiny) to 1 (rough). An
|
|
34
45
|
* alias for `gloss` that also inverts it, so do not combine it with the `gloss` attributes.
|
|
35
46
|
* @attribute {string} roughness-map - The id of the `pc-asset` to use as the roughness map. An
|
package/dist/model.d.cts
CHANGED
|
@@ -79,6 +79,11 @@ type HierarchyNode = {
|
|
|
79
79
|
* intersects the model's geometry, exactly as for `<pc-entity>` — a hit on a content node that no
|
|
80
80
|
* `pc-node` fronts resolves to this element.
|
|
81
81
|
*
|
|
82
|
+
* @elementSummary The `<pc-model>` element instantiates a 3D model from a container asset
|
|
83
|
+
* (typically a GLB) beneath an entity of its own, so the element's transform and tags place the
|
|
84
|
+
* instance in the scene. Its `<pc-node>` children override what the asset authored. Place it in the
|
|
85
|
+
* `<pc-scene>`, or nest it under a `<pc-entity>`, another `<pc-model>` or a `<pc-node>`.
|
|
86
|
+
*
|
|
82
87
|
* @attribute {boolean} enabled - The enabled state of the model.
|
|
83
88
|
* @attribute {string} name - The name of the model.
|
|
84
89
|
* @attribute {string} position - The position of the model.
|
|
@@ -92,11 +97,17 @@ type HierarchyNode = {
|
|
|
92
97
|
* model.
|
|
93
98
|
* @attribute {string} onpointerup - Script to run when a pointer button is released over the
|
|
94
99
|
* model.
|
|
100
|
+
* @attribute {string} onclick - Script to run when the model is clicked: a primary pointer
|
|
101
|
+
* button pressed and then released over it.
|
|
95
102
|
* @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the model.
|
|
96
103
|
* @fires {PointerEvent} pointerleave - Fired when the pointer moves off the model.
|
|
97
104
|
* @fires {PointerEvent} pointermove - Fired when the pointer moves over the model.
|
|
98
105
|
* @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the model.
|
|
99
106
|
* @fires {PointerEvent} pointerup - Fired when a pointer button is released over the model.
|
|
107
|
+
* @fires {PointerEvent} click - Fired when a primary pointer button is pressed and then released
|
|
108
|
+
* over the model. A press and release that picked different entities fires on their nearest
|
|
109
|
+
* common ancestor instead, as in the DOM. `detail` carries the click count, so a double click
|
|
110
|
+
* arrives as a click whose `detail` is 2.
|
|
100
111
|
* @fires {Event} load - Fired each time a container asset finishes instantiating, including
|
|
101
112
|
* re-instantiation after `asset` changes. Does not bubble — listen on this element, or use a
|
|
102
113
|
* capture-phase listener on an ancestor.
|
package/dist/model.d.ts
CHANGED
|
@@ -79,6 +79,11 @@ type HierarchyNode = {
|
|
|
79
79
|
* intersects the model's geometry, exactly as for `<pc-entity>` — a hit on a content node that no
|
|
80
80
|
* `pc-node` fronts resolves to this element.
|
|
81
81
|
*
|
|
82
|
+
* @elementSummary The `<pc-model>` element instantiates a 3D model from a container asset
|
|
83
|
+
* (typically a GLB) beneath an entity of its own, so the element's transform and tags place the
|
|
84
|
+
* instance in the scene. Its `<pc-node>` children override what the asset authored. Place it in the
|
|
85
|
+
* `<pc-scene>`, or nest it under a `<pc-entity>`, another `<pc-model>` or a `<pc-node>`.
|
|
86
|
+
*
|
|
82
87
|
* @attribute {boolean} enabled - The enabled state of the model.
|
|
83
88
|
* @attribute {string} name - The name of the model.
|
|
84
89
|
* @attribute {string} position - The position of the model.
|
|
@@ -92,11 +97,17 @@ type HierarchyNode = {
|
|
|
92
97
|
* model.
|
|
93
98
|
* @attribute {string} onpointerup - Script to run when a pointer button is released over the
|
|
94
99
|
* model.
|
|
100
|
+
* @attribute {string} onclick - Script to run when the model is clicked: a primary pointer
|
|
101
|
+
* button pressed and then released over it.
|
|
95
102
|
* @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the model.
|
|
96
103
|
* @fires {PointerEvent} pointerleave - Fired when the pointer moves off the model.
|
|
97
104
|
* @fires {PointerEvent} pointermove - Fired when the pointer moves over the model.
|
|
98
105
|
* @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the model.
|
|
99
106
|
* @fires {PointerEvent} pointerup - Fired when a pointer button is released over the model.
|
|
107
|
+
* @fires {PointerEvent} click - Fired when a primary pointer button is pressed and then released
|
|
108
|
+
* over the model. A press and release that picked different entities fires on their nearest
|
|
109
|
+
* common ancestor instead, as in the DOM. `detail` carries the click count, so a double click
|
|
110
|
+
* arrives as a click whose `detail` is 2.
|
|
100
111
|
* @fires {Event} load - Fired each time a container asset finishes instantiating, including
|
|
101
112
|
* re-instantiation after `asset` changes. Does not bubble — listen on this element, or use a
|
|
102
113
|
* capture-phase listener on an ancestor.
|
package/dist/node.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ import { EntityBaseElement } from './entity-base.cjs';
|
|
|
6
6
|
* `missing`/`ambiguous`/`duplicate` when resolution failed — each accompanied by a warning
|
|
7
7
|
* naming the cause.
|
|
8
8
|
*/
|
|
9
|
-
type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
|
|
9
|
+
export type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
|
|
10
10
|
/**
|
|
11
11
|
* A sparse mapping from selector to `pc-material` id, as carried by the `material-overrides`
|
|
12
12
|
* attribute and `materialOverrides` property. A `name:X` key selects every mesh instance of the
|
|
@@ -38,6 +38,11 @@ type MaterialOverrides = Readonly<Record<string, string>>;
|
|
|
38
38
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
39
39
|
* intersects the bound node's geometry, exactly as for `<pc-entity>`.
|
|
40
40
|
*
|
|
41
|
+
* @elementSummary The `<pc-node>` element binds to a node inside the hierarchy a `<pc-model>`
|
|
42
|
+
* instantiated and declares overrides against it: a transform, an enabled state, tags, components
|
|
43
|
+
* to add, or content to attach. Its `name` is a lookup, never a rename. Must be a descendant of
|
|
44
|
+
* `<pc-model>`.
|
|
45
|
+
*
|
|
41
46
|
* @attribute {string} name - The name of the node to bind, resolved within the nearest ancestor
|
|
42
47
|
* `pc-model` (or `pc-node`) once it has instantiated.
|
|
43
48
|
* @attribute {number} index - Which match to bind when `name` matches more than one node,
|
|
@@ -62,11 +67,17 @@ type MaterialOverrides = Readonly<Record<string, string>>;
|
|
|
62
67
|
* node.
|
|
63
68
|
* @attribute {string} onpointerup - Script to run when a pointer button is released over the
|
|
64
69
|
* node.
|
|
70
|
+
* @attribute {string} onclick - Script to run when the node is clicked: a primary pointer
|
|
71
|
+
* button pressed and then released over it.
|
|
65
72
|
* @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the node.
|
|
66
73
|
* @fires {PointerEvent} pointerleave - Fired when the pointer moves off the node.
|
|
67
74
|
* @fires {PointerEvent} pointermove - Fired when the pointer moves over the node.
|
|
68
75
|
* @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the node.
|
|
69
76
|
* @fires {PointerEvent} pointerup - Fired when a pointer button is released over the node.
|
|
77
|
+
* @fires {PointerEvent} click - Fired when a primary pointer button is pressed and then released
|
|
78
|
+
* over the node. A press and release that picked different entities fires on their nearest
|
|
79
|
+
* common ancestor instead, as in the DOM. `detail` carries the click count, so a double click
|
|
80
|
+
* arrives as a click whose `detail` is 2.
|
|
70
81
|
*/
|
|
71
82
|
declare class NodeElement extends EntityBaseElement {
|
|
72
83
|
private _name;
|
package/dist/node.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { EntityBaseElement } from './entity-base.js';
|
|
|
6
6
|
* `missing`/`ambiguous`/`duplicate` when resolution failed — each accompanied by a warning
|
|
7
7
|
* naming the cause.
|
|
8
8
|
*/
|
|
9
|
-
type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
|
|
9
|
+
export type NodeBindingState = 'pending' | 'bound' | 'missing' | 'ambiguous' | 'duplicate';
|
|
10
10
|
/**
|
|
11
11
|
* A sparse mapping from selector to `pc-material` id, as carried by the `material-overrides`
|
|
12
12
|
* attribute and `materialOverrides` property. A `name:X` key selects every mesh instance of the
|
|
@@ -38,6 +38,11 @@ type MaterialOverrides = Readonly<Record<string, string>>;
|
|
|
38
38
|
* The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
|
|
39
39
|
* intersects the bound node's geometry, exactly as for `<pc-entity>`.
|
|
40
40
|
*
|
|
41
|
+
* @elementSummary The `<pc-node>` element binds to a node inside the hierarchy a `<pc-model>`
|
|
42
|
+
* instantiated and declares overrides against it: a transform, an enabled state, tags, components
|
|
43
|
+
* to add, or content to attach. Its `name` is a lookup, never a rename. Must be a descendant of
|
|
44
|
+
* `<pc-model>`.
|
|
45
|
+
*
|
|
41
46
|
* @attribute {string} name - The name of the node to bind, resolved within the nearest ancestor
|
|
42
47
|
* `pc-model` (or `pc-node`) once it has instantiated.
|
|
43
48
|
* @attribute {number} index - Which match to bind when `name` matches more than one node,
|
|
@@ -62,11 +67,17 @@ type MaterialOverrides = Readonly<Record<string, string>>;
|
|
|
62
67
|
* node.
|
|
63
68
|
* @attribute {string} onpointerup - Script to run when a pointer button is released over the
|
|
64
69
|
* node.
|
|
70
|
+
* @attribute {string} onclick - Script to run when the node is clicked: a primary pointer
|
|
71
|
+
* button pressed and then released over it.
|
|
65
72
|
* @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the node.
|
|
66
73
|
* @fires {PointerEvent} pointerleave - Fired when the pointer moves off the node.
|
|
67
74
|
* @fires {PointerEvent} pointermove - Fired when the pointer moves over the node.
|
|
68
75
|
* @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the node.
|
|
69
76
|
* @fires {PointerEvent} pointerup - Fired when a pointer button is released over the node.
|
|
77
|
+
* @fires {PointerEvent} click - Fired when a primary pointer button is pressed and then released
|
|
78
|
+
* over the node. A press and release that picked different entities fires on their nearest
|
|
79
|
+
* common ancestor instead, as in the DOM. `detail` carries the click count, so a double click
|
|
80
|
+
* arrives as a click whose `detail` is 2.
|
|
70
81
|
*/
|
|
71
82
|
declare class NodeElement extends EntityBaseElement {
|
|
72
83
|
private _name;
|