@playcanvas/web-components 0.1.2 → 0.1.4

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 CHANGED
@@ -43,6 +43,7 @@ Table of contents:
43
43
  - [pc-script](#pc-script)
44
44
  - [pc-scripts](#pc-scripts)
45
45
  - [pc-sky](#pc-sky)
46
+ - [pc-screen](#pc-screen)
46
47
  - [pc-sound](#pc-sound)
47
48
  - [pc-sounds](#pc-sounds)
48
49
  - [pc-splat](#pc-splat)
@@ -72,12 +73,21 @@ The `pc-camera` tag is used to define a camera component. It must be a direct ch
72
73
 
73
74
  | Attribute | Description |
74
75
  | --- | --- |
75
- | `clear-color` | The background color of the camera. Can be a comma-separated list of R, G, B, and A values or a hex color code. If not specified, `1,1,1,1` is used. |
76
- | `far-clip` | The far clipping plane of the camera. If not specified, `1000` is used. |
77
- | `fov` | The field of view of the camera. If not specified, `45` is used. |
78
- | `near-clip` | The near clipping plane of the camera. If not specified, `0.1` is used. |
79
- | `orthographic` | Valueless attribute. If present, the camera uses an orthographic projection. |
80
- | `ortho-height` | The height of the orthographic projection. If not specified, `10` is used. |
76
+ | `clear-color` | The background color of the camera. Can be a comma-separated list of R, G, B, and A values or a hex color code. If unspecified, `0.75,0.75,0.75,1` is used. |
77
+ | `clear-color-buffer` | Boolean attribute. Controls whether the camera clears the color buffer. If unspecified, the color buffer is cleared. |
78
+ | `clear-depth-buffer` | Boolean attribute. Controls whether the camera clears the depth buffer. If unspecified, the depth buffer is cleared. |
79
+ | `clear-stencil-buffer` | Boolean attribute. Controls whether the camera clears the stencil buffer. If unspecified, the stencil buffer is cleared. |
80
+ | `cull-faces` | Boolean attribute. Controls whether the camera culls faces. If unspecified, faces are culled. |
81
+ | `far-clip` | The far clipping plane of the camera. If unspecified, `1000` is used. |
82
+ | `flip-faces` | Boolean attribute. Controls whether the camera flips faces. If unspecified, faces are not flipped. |
83
+ | `fov` | The field of view of the camera. If unspecified, `45` is used. |
84
+ | `frustum-culling` | Boolean attribute. Controls whether the camera uses frustum culling. If unspecified, frustum culling is used. |
85
+ | `near-clip` | The near clipping plane of the camera. If unspecified, `0.1` is used. |
86
+ | `orthographic` | Valueless attribute. If present, the camera uses an orthographic projection. If unspecified, the camera uses a perspective projection. |
87
+ | `ortho-height` | The height of the orthographic projection. If unspecified, `10` is used. |
88
+ | `priority` | The priority of the camera. If unspecified, `0` is used. |
89
+ | `rect` | The viewport rectangle of the camera. Specified as a comma-separated list of X, Y, Width, and Height values. If unspecified, `0,0,1,1` is used. |
90
+ | `scissor-rect` | The scissor rectangle of the camera. Specified as a comma-separated list of X, Y, Width, and Height values. If not specified, `0,0,1,1` is used. |
81
91
 
82
92
  ### pc-collision
83
93
 
@@ -194,6 +204,20 @@ The `pc-scene` tag is used to define the scene. It must be a direct child of `pc
194
204
  | `fog-end` | The end distance of the fog. |
195
205
  | `fog-density` | The density of the fog. |
196
206
 
207
+ ### pc-screen
208
+
209
+ The `pc-screen` tag is used to define a screen component. It must be a direct child of a `pc-entity`.
210
+
211
+ | Attribute | Description |
212
+ | --- | --- |
213
+ | `blend` | Valueless attribute. If present, the screen component blends. |
214
+ | `priority` | The priority of the screen component. Must be an integer between `0` and `255`. If not specified, `0` is used. |
215
+ | `reference-resolution` | The reference resolution of the screen component. Specified as a comma-separated list of Width and Height values. If not specified, `640,320` is used. |
216
+ | `resolution` | The resolution of the screen component. Specified as a comma-separated list of Width and Height values. If not specified, `640,320` is used. |
217
+ | `scale-blend` | The scale blend of the screen component. Must be a number between `0` and `1`. If not specified, `0.5` is used. |
218
+ | `screen-space` | Valueless attribute. If present, the screen component is in screen space. |
219
+
220
+
197
221
  ### pc-script
198
222
 
199
223
  The `pc-script` tag is used to define a script. It must be a direct child of a `pc-scripts` component.
package/dist/asset.d.ts CHANGED
@@ -22,6 +22,7 @@ declare class AssetElement extends HTMLElement {
22
22
  * @returns The preload flag.
23
23
  */
24
24
  get preload(): boolean;
25
+ static get(id: string): Asset | null | undefined;
25
26
  static get observedAttributes(): string[];
26
27
  attributeChangedCallback(name: string, _oldValue: string, _newValue: string): void;
27
28
  }
@@ -1,4 +1,4 @@
1
- import { CameraComponent, Color } from 'playcanvas';
1
+ import { CameraComponent, Color, Vec4 } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
4
  * Represents a camera component in the PlayCanvas engine.
@@ -7,22 +7,40 @@ import { ComponentElement } from './component';
7
7
  */
8
8
  declare class CameraComponentElement extends ComponentElement {
9
9
  private _clearColor;
10
+ private _clearColorBuffer;
11
+ private _clearDepthBuffer;
12
+ private _clearStencilBuffer;
13
+ private _cullFaces;
10
14
  private _farClip;
15
+ private _flipFaces;
11
16
  private _fov;
17
+ private _frustumCulling;
12
18
  private _nearClip;
13
19
  private _orthographic;
14
20
  private _orthoHeight;
21
+ private _priority;
22
+ private _rect;
23
+ private _scissorRect;
15
24
  /**
16
25
  * Creates a new CameraComponentElement.
17
26
  */
18
27
  constructor();
19
28
  getInitialComponentData(): {
20
29
  clearColor: Color;
30
+ clearColorBuffer: boolean;
31
+ clearDepthBuffer: boolean;
32
+ clearStencilBuffer: boolean;
33
+ cullFaces: boolean;
21
34
  farClip: number;
35
+ flipFaces: boolean;
22
36
  fov: number;
37
+ frustumCulling: boolean;
23
38
  nearClip: number;
24
- projection: number;
39
+ orthographic: boolean;
25
40
  orthoHeight: number;
41
+ priority: number;
42
+ rect: Vec4;
43
+ scissorRect: Vec4;
26
44
  };
27
45
  /**
28
46
  * Gets the camera component.
@@ -39,6 +57,46 @@ declare class CameraComponentElement extends ComponentElement {
39
57
  * @returns The clear color.
40
58
  */
41
59
  get clearColor(): Color;
60
+ /**
61
+ * Sets the clear color buffer of the camera.
62
+ * @param value - The clear color buffer.
63
+ */
64
+ set clearColorBuffer(value: boolean);
65
+ /**
66
+ * Gets the clear color buffer of the camera.
67
+ * @returns The clear color buffer.
68
+ */
69
+ get clearColorBuffer(): boolean;
70
+ /**
71
+ * Sets the clear depth buffer of the camera.
72
+ * @param value - The clear depth buffer.
73
+ */
74
+ set clearDepthBuffer(value: boolean);
75
+ /**
76
+ * Gets the clear depth buffer of the camera.
77
+ * @returns The clear depth buffer.
78
+ */
79
+ get clearDepthBuffer(): boolean;
80
+ /**
81
+ * Sets the clear stencil buffer of the camera.
82
+ * @param value - The clear stencil buffer.
83
+ */
84
+ set clearStencilBuffer(value: boolean);
85
+ /**
86
+ * Gets the clear stencil buffer of the camera.
87
+ * @returns The clear stencil buffer.
88
+ */
89
+ get clearStencilBuffer(): boolean;
90
+ /**
91
+ * Sets the cull faces of the camera.
92
+ * @param value - The cull faces.
93
+ */
94
+ set cullFaces(value: boolean);
95
+ /**
96
+ * Gets the cull faces of the camera.
97
+ * @returns The cull faces.
98
+ */
99
+ get cullFaces(): boolean;
42
100
  /**
43
101
  * Sets the far clip distance of the camera.
44
102
  * @param value - The far clip distance.
@@ -49,6 +107,16 @@ declare class CameraComponentElement extends ComponentElement {
49
107
  * @returns The far clip distance.
50
108
  */
51
109
  get farClip(): number;
110
+ /**
111
+ * Sets the flip faces of the camera.
112
+ * @param value - The flip faces.
113
+ */
114
+ set flipFaces(value: boolean);
115
+ /**
116
+ * Gets the flip faces of the camera.
117
+ * @returns The flip faces.
118
+ */
119
+ get flipFaces(): boolean;
52
120
  /**
53
121
  * Sets the field of view of the camera.
54
122
  * @param value - The field of view.
@@ -59,6 +127,16 @@ declare class CameraComponentElement extends ComponentElement {
59
127
  * @returns The field of view.
60
128
  */
61
129
  get fov(): number;
130
+ /**
131
+ * Sets the frustum culling of the camera.
132
+ * @param value - The frustum culling.
133
+ */
134
+ set frustumCulling(value: boolean);
135
+ /**
136
+ * Gets the frustum culling of the camera.
137
+ * @returns The frustum culling.
138
+ */
139
+ get frustumCulling(): boolean;
62
140
  /**
63
141
  * Sets the near clip distance of the camera.
64
142
  * @param value - The near clip distance.
@@ -89,6 +167,36 @@ declare class CameraComponentElement extends ComponentElement {
89
167
  * @returns The orthographic height.
90
168
  */
91
169
  get orthoHeight(): number;
170
+ /**
171
+ * Sets the priority of the camera.
172
+ * @param value - The priority.
173
+ */
174
+ set priority(value: number);
175
+ /**
176
+ * Gets the priority of the camera.
177
+ * @returns The priority.
178
+ */
179
+ get priority(): number;
180
+ /**
181
+ * Sets the rect of the camera.
182
+ * @param value - The rect.
183
+ */
184
+ set rect(value: Vec4);
185
+ /**
186
+ * Gets the rect of the camera.
187
+ * @returns The rect.
188
+ */
189
+ get rect(): Vec4;
190
+ /**
191
+ * Sets the scissor rect of the camera.
192
+ * @param value - The scissor rect.
193
+ */
194
+ set scissorRect(value: Vec4);
195
+ /**
196
+ * Gets the scissor rect of the camera.
197
+ * @returns The scissor rect.
198
+ */
199
+ get scissorRect(): Vec4;
92
200
  static get observedAttributes(): string[];
93
201
  attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
94
202
  }
@@ -1,4 +1,4 @@
1
- import { CollisionComponent, Vec3 } from 'playcanvas';
1
+ import { CollisionComponent, Quat, Vec3 } from 'playcanvas';
2
2
  import { ComponentElement } from './component';
3
3
  /**
4
4
  * Represents a collision component in the PlayCanvas engine.
@@ -6,10 +6,12 @@ import { ComponentElement } from './component';
6
6
  * @category Components
7
7
  */
8
8
  declare class CollisionComponentElement extends ComponentElement {
9
+ private _angularOffset;
9
10
  private _axis;
10
11
  private _convexHull;
11
12
  private _halfExtents;
12
13
  private _height;
14
+ private _linearOffset;
13
15
  private _radius;
14
16
  private _type;
15
17
  /**
@@ -18,9 +20,11 @@ declare class CollisionComponentElement extends ComponentElement {
18
20
  constructor();
19
21
  getInitialComponentData(): {
20
22
  axis: number;
23
+ angularOffset: Quat;
21
24
  convexHull: boolean;
22
25
  halfExtents: Vec3;
23
26
  height: number;
27
+ linearOffset: Vec3;
24
28
  radius: number;
25
29
  type: string;
26
30
  };
@@ -29,6 +33,8 @@ declare class CollisionComponentElement extends ComponentElement {
29
33
  * @returns The collision component.
30
34
  */
31
35
  get component(): CollisionComponent | null;
36
+ set angularOffset(value: Quat);
37
+ get angularOffset(): Quat;
32
38
  set axis(value: number);
33
39
  get axis(): number;
34
40
  set convexHull(value: boolean);
@@ -37,6 +43,8 @@ declare class CollisionComponentElement extends ComponentElement {
37
43
  get halfExtents(): Vec3;
38
44
  set height(value: number);
39
45
  get height(): number;
46
+ set linearOffset(value: Vec3);
47
+ get linearOffset(): Vec3;
40
48
  set radius(value: number);
41
49
  get radius(): number;
42
50
  set type(value: string);
@@ -19,7 +19,6 @@ declare class ElementComponentElement extends ComponentElement {
19
19
  private _wrapLines;
20
20
  constructor();
21
21
  connectedCallback(): Promise<void>;
22
- getAsset(): import("playcanvas").Asset | null;
23
22
  getInitialComponentData(): {
24
23
  anchor: Vec4;
25
24
  autoWidth: boolean;
@@ -8,9 +8,8 @@ import { ComponentElement } from './component';
8
8
  declare class GSplatComponentElement extends ComponentElement {
9
9
  private _asset;
10
10
  constructor();
11
- getAsset(): import("playcanvas").Asset | null;
12
11
  getInitialComponentData(): {
13
- asset: import("playcanvas").Asset | null;
12
+ asset: import("playcanvas").Asset | null | undefined;
14
13
  };
15
14
  /**
16
15
  * Gets the gsplat component.
@@ -6,10 +6,12 @@ import { ComponentElement } from './component';
6
6
  * @category Components
7
7
  */
8
8
  declare class RenderComponentElement extends ComponentElement {
9
- private _type;
10
9
  private _castShadows;
10
+ private _material;
11
11
  private _receiveShadows;
12
+ private _type;
12
13
  constructor();
14
+ connectedCallback(): Promise<void>;
13
15
  getInitialComponentData(): {
14
16
  type: "box" | "asset" | "capsule" | "cone" | "cylinder" | "plane" | "sphere";
15
17
  castShadows: boolean;
@@ -40,6 +42,16 @@ declare class RenderComponentElement extends ComponentElement {
40
42
  * @returns The cast shadows flag.
41
43
  */
42
44
  get castShadows(): boolean;
45
+ /**
46
+ * Sets the material of the render component.
47
+ * @param value - The id of the material asset to use.
48
+ */
49
+ set material(value: string);
50
+ /**
51
+ * Gets the id of the material asset used by the render component.
52
+ * @returns The id of the material asset.
53
+ */
54
+ get material(): string;
43
55
  /**
44
56
  * Sets the receive shadows flag of the render component.
45
57
  * @param value - The receive shadows flag.
@@ -0,0 +1,44 @@
1
+ import { ScreenComponent, Vec2 } from 'playcanvas';
2
+ import { ComponentElement } from './component';
3
+ /**
4
+ * Represents a screen component in the PlayCanvas engine.
5
+ *
6
+ * @category Components
7
+ */
8
+ declare class ScreenComponentElement extends ComponentElement {
9
+ private _screenSpace;
10
+ private _resolution;
11
+ private _referenceResolution;
12
+ private _priority;
13
+ private _blend;
14
+ private _scaleBlend;
15
+ constructor();
16
+ getInitialComponentData(): {
17
+ priority: number;
18
+ referenceResolution: Vec2;
19
+ resolution: Vec2;
20
+ scaleBlend: number;
21
+ scaleMode: string;
22
+ screenSpace: boolean;
23
+ };
24
+ /**
25
+ * Gets the screen component.
26
+ * @returns The screen component.
27
+ */
28
+ get component(): ScreenComponent | null;
29
+ set priority(value: number);
30
+ get priority(): number;
31
+ set referenceResolution(value: Vec2);
32
+ get referenceResolution(): Vec2;
33
+ set resolution(value: Vec2);
34
+ get resolution(): Vec2;
35
+ set scaleBlend(value: number);
36
+ get scaleBlend(): number;
37
+ set blend(value: boolean);
38
+ get blend(): boolean;
39
+ set screenSpace(value: boolean);
40
+ get screenSpace(): boolean;
41
+ static get observedAttributes(): string[];
42
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
43
+ }
44
+ export { ScreenComponentElement };
@@ -17,7 +17,6 @@ declare class SoundSlotElement extends HTMLElement {
17
17
  * The sound slot.
18
18
  */
19
19
  soundSlot: SoundSlot | null;
20
- getAsset(): import("playcanvas").Asset | null;
21
20
  connectedCallback(): Promise<void>;
22
21
  disconnectedCallback(): void;
23
22
  protected get soundElement(): SoundComponentElement | null;
package/dist/entity.d.ts CHANGED
@@ -27,6 +27,8 @@ declare class EntityElement extends HTMLElement {
27
27
  * The tags of the entity.
28
28
  */
29
29
  private _tags;
30
+ private _resolveEntity;
31
+ private _entityReady;
30
32
  /**
31
33
  * The PlayCanvas entity instance.
32
34
  */
package/dist/index.d.ts CHANGED
@@ -11,11 +11,13 @@ import { GSplatComponentElement } from './components/gsplat-component';
11
11
  import { LightComponentElement } from './components/light-component';
12
12
  import { RenderComponentElement } from './components/render-component';
13
13
  import { RigidBodyComponentElement } from './components/rigidbody-component';
14
+ import { ScreenComponentElement } from './components/screen-component';
14
15
  import { ScriptComponentElement } from './components/script-component';
15
16
  import { ScriptElement } from './components/script';
16
17
  import { SoundComponentElement } from './components/sound-component';
17
18
  import { SoundSlotElement } from './components/sound-slot';
19
+ import { MaterialElement } from './material';
18
20
  import { ModelElement } from './model';
19
21
  import { SceneElement } from './scene';
20
22
  import { SkyElement } from './sky';
21
- export { ModuleElement, AppElement, EntityElement, AssetElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, GSplatComponentElement, LightComponentElement, ListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScriptComponentElement, ScriptElement, SoundComponentElement, SoundSlotElement, ModelElement, SceneElement, SkyElement };
23
+ export { ModuleElement, AppElement, EntityElement, AssetElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, GSplatComponentElement, LightComponentElement, ListenerComponentElement, RenderComponentElement, RigidBodyComponentElement, ScreenComponentElement, ScriptComponentElement, ScriptElement, SoundComponentElement, SoundSlotElement, MaterialElement, ModelElement, SceneElement, SkyElement };
@@ -0,0 +1,29 @@
1
+ import { Color, StandardMaterial } from 'playcanvas';
2
+ /**
3
+ * Represents a material in the PlayCanvas engine.
4
+ */
5
+ declare class MaterialElement extends HTMLElement {
6
+ private _diffuse;
7
+ private _diffuseMap;
8
+ private _metalnessMap;
9
+ private _normalMap;
10
+ private _roughnessMap;
11
+ material: StandardMaterial | null;
12
+ createMaterial(): void;
13
+ disconnectedCallback(): void;
14
+ setMap(map: string, property: 'diffuseMap' | 'metalnessMap' | 'normalMap' | 'glossMap'): void;
15
+ set diffuse(value: Color);
16
+ get diffuse(): Color;
17
+ set diffuseMap(value: string);
18
+ get diffuseMap(): string;
19
+ set metalnessMap(value: string);
20
+ get metalnessMap(): string;
21
+ set normalMap(value: string);
22
+ get normalMap(): string;
23
+ set roughnessMap(value: string);
24
+ get roughnessMap(): string;
25
+ static get(id: string): StandardMaterial | null | undefined;
26
+ static get observedAttributes(): string[];
27
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
28
+ }
29
+ export { MaterialElement };
package/dist/model.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  declare class ModelElement extends HTMLElement {
5
5
  private _asset;
6
6
  connectedCallback(): Promise<void>;
7
- getAsset(): import("playcanvas").Asset | null;
8
7
  _loadModel(): void;
9
8
  /**
10
9
  * Sets the asset ID of the model.