@playcanvas/web-components 0.3.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +84 -84
  3. package/dist/components/gsplat-component.d.ts +79 -0
  4. package/dist/components/light-component.d.ts +48 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/pwc.cjs +324 -203
  7. package/dist/pwc.cjs.map +1 -1
  8. package/dist/pwc.js +324 -203
  9. package/dist/pwc.js.map +1 -1
  10. package/dist/pwc.min.js +1 -1
  11. package/dist/pwc.min.js.map +1 -1
  12. package/dist/pwc.mjs +325 -204
  13. package/dist/pwc.mjs.map +1 -1
  14. package/package.json +76 -66
  15. package/src/app.ts +612 -606
  16. package/src/asset.ts +159 -159
  17. package/src/async-element.ts +46 -46
  18. package/src/colors.ts +150 -150
  19. package/src/components/camera-component.ts +557 -557
  20. package/src/components/collision-component.ts +183 -183
  21. package/src/components/component.ts +97 -97
  22. package/src/components/element-component.ts +367 -367
  23. package/src/components/gsplat-component.ts +161 -0
  24. package/src/components/light-component.ts +570 -466
  25. package/src/components/listener-component.ts +30 -30
  26. package/src/components/particlesystem-component.ts +155 -155
  27. package/src/components/render-component.ts +147 -147
  28. package/src/components/rigidbody-component.ts +227 -227
  29. package/src/components/screen-component.ts +157 -157
  30. package/src/components/script-component.ts +270 -270
  31. package/src/components/script.ts +90 -90
  32. package/src/components/sound-component.ts +230 -230
  33. package/src/components/sound-slot.ts +288 -288
  34. package/src/entity.ts +360 -360
  35. package/src/index.ts +63 -63
  36. package/src/material.ts +141 -141
  37. package/src/model.ts +111 -111
  38. package/src/module.ts +43 -43
  39. package/src/scene.ts +217 -217
  40. package/src/sky.ts +293 -293
  41. package/src/utils.ts +71 -71
  42. package/dist/components/splat-component.d.ts +0 -61
  43. package/src/components/splat-component.ts +0 -133
@@ -1,157 +1,157 @@
1
- import { SCALEMODE_BLEND, SCALEMODE_NONE, ScreenComponent, Vec2 } from 'playcanvas';
2
-
3
- import { ComponentElement } from './component';
4
- import { parseVec2 } from '../utils';
5
-
6
- /**
7
- * The ScreenComponentElement interface provides properties and methods for manipulating
8
- * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
9
- * The ScreenComponentElement interface also inherits the properties and methods of the
10
- * {@link HTMLElement} interface.
11
- *
12
- * @category Components
13
- */
14
- class ScreenComponentElement extends ComponentElement {
15
- private _screenSpace = false;
16
-
17
- private _resolution: Vec2 = new Vec2(640, 320);
18
-
19
- private _referenceResolution: Vec2 = new Vec2(640, 320);
20
-
21
- private _priority = 0;
22
-
23
- private _blend = false;
24
-
25
- private _scaleBlend = 0.5;
26
-
27
- /** @ignore */
28
- constructor() {
29
- super('screen');
30
- }
31
-
32
- getInitialComponentData() {
33
- return {
34
- priority: this._priority,
35
- referenceResolution: this._referenceResolution,
36
- resolution: this._resolution,
37
- scaleBlend: this._scaleBlend,
38
- scaleMode: this._blend ? SCALEMODE_BLEND : SCALEMODE_NONE,
39
- screenSpace: this._screenSpace
40
- };
41
- }
42
-
43
- /**
44
- * Gets the underlying PlayCanvas screen component.
45
- * @returns The screen component.
46
- */
47
- get component(): ScreenComponent | null {
48
- return super.component as ScreenComponent | null;
49
- }
50
-
51
- set priority(value: number) {
52
- this._priority = value;
53
- if (this.component) {
54
- this.component.priority = this._priority;
55
- }
56
- }
57
-
58
- get priority() {
59
- return this._priority;
60
- }
61
-
62
- set referenceResolution(value: Vec2) {
63
- this._referenceResolution = value;
64
- if (this.component) {
65
- this.component.referenceResolution = this._referenceResolution;
66
- }
67
- }
68
-
69
- get referenceResolution() {
70
- return this._referenceResolution;
71
- }
72
-
73
- set resolution(value: Vec2) {
74
- this._resolution = value;
75
- if (this.component) {
76
- this.component.resolution = this._resolution;
77
- }
78
- }
79
-
80
- get resolution() {
81
- return this._resolution;
82
- }
83
-
84
- set scaleBlend(value: number) {
85
- this._scaleBlend = value;
86
- if (this.component) {
87
- this.component.scaleBlend = this._scaleBlend;
88
- }
89
- }
90
-
91
- get scaleBlend() {
92
- return this._scaleBlend;
93
- }
94
-
95
- set blend(value: boolean) {
96
- this._blend = value;
97
- if (this.component) {
98
- this.component.scaleMode = this._blend ? SCALEMODE_BLEND : SCALEMODE_NONE;
99
- }
100
- }
101
-
102
- get blend() {
103
- return this._blend;
104
- }
105
-
106
- set screenSpace(value: boolean) {
107
- this._screenSpace = value;
108
- if (this.component) {
109
- this.component.screenSpace = this._screenSpace;
110
- }
111
- }
112
-
113
- get screenSpace() {
114
- return this._screenSpace;
115
- }
116
-
117
- static get observedAttributes() {
118
- return [
119
- ...super.observedAttributes,
120
- 'blend',
121
- 'screen-space',
122
- 'resolution',
123
- 'reference-resolution',
124
- 'priority',
125
- 'scale-blend'
126
- ];
127
- }
128
-
129
- attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
130
- super.attributeChangedCallback(name, _oldValue, newValue);
131
-
132
- switch (name) {
133
- case 'priority':
134
- this.priority = parseInt(newValue, 10);
135
- break;
136
- case 'reference-resolution':
137
- this.referenceResolution = parseVec2(newValue);
138
- break;
139
- case 'resolution':
140
- this.resolution = parseVec2(newValue);
141
- break;
142
- case 'scale-blend':
143
- this.scaleBlend = parseFloat(newValue);
144
- break;
145
- case 'blend':
146
- this.blend = this.hasAttribute('blend');
147
- break;
148
- case 'screen-space':
149
- this.screenSpace = this.hasAttribute('screen-space');
150
- break;
151
- }
152
- }
153
- }
154
-
155
- customElements.define('pc-screen', ScreenComponentElement);
156
-
157
- export { ScreenComponentElement };
1
+ import { SCALEMODE_BLEND, SCALEMODE_NONE, ScreenComponent, Vec2 } from 'playcanvas';
2
+
3
+ import { ComponentElement } from './component';
4
+ import { parseVec2 } from '../utils';
5
+
6
+ /**
7
+ * The ScreenComponentElement interface provides properties and methods for manipulating
8
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
9
+ * The ScreenComponentElement interface also inherits the properties and methods of the
10
+ * {@link HTMLElement} interface.
11
+ *
12
+ * @category Components
13
+ */
14
+ class ScreenComponentElement extends ComponentElement {
15
+ private _screenSpace = false;
16
+
17
+ private _resolution: Vec2 = new Vec2(640, 320);
18
+
19
+ private _referenceResolution: Vec2 = new Vec2(640, 320);
20
+
21
+ private _priority = 0;
22
+
23
+ private _blend = false;
24
+
25
+ private _scaleBlend = 0.5;
26
+
27
+ /** @ignore */
28
+ constructor() {
29
+ super('screen');
30
+ }
31
+
32
+ getInitialComponentData() {
33
+ return {
34
+ priority: this._priority,
35
+ referenceResolution: this._referenceResolution,
36
+ resolution: this._resolution,
37
+ scaleBlend: this._scaleBlend,
38
+ scaleMode: this._blend ? SCALEMODE_BLEND : SCALEMODE_NONE,
39
+ screenSpace: this._screenSpace
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Gets the underlying PlayCanvas screen component.
45
+ * @returns The screen component.
46
+ */
47
+ get component(): ScreenComponent | null {
48
+ return super.component as ScreenComponent | null;
49
+ }
50
+
51
+ set priority(value: number) {
52
+ this._priority = value;
53
+ if (this.component) {
54
+ this.component.priority = this._priority;
55
+ }
56
+ }
57
+
58
+ get priority() {
59
+ return this._priority;
60
+ }
61
+
62
+ set referenceResolution(value: Vec2) {
63
+ this._referenceResolution = value;
64
+ if (this.component) {
65
+ this.component.referenceResolution = this._referenceResolution;
66
+ }
67
+ }
68
+
69
+ get referenceResolution() {
70
+ return this._referenceResolution;
71
+ }
72
+
73
+ set resolution(value: Vec2) {
74
+ this._resolution = value;
75
+ if (this.component) {
76
+ this.component.resolution = this._resolution;
77
+ }
78
+ }
79
+
80
+ get resolution() {
81
+ return this._resolution;
82
+ }
83
+
84
+ set scaleBlend(value: number) {
85
+ this._scaleBlend = value;
86
+ if (this.component) {
87
+ this.component.scaleBlend = this._scaleBlend;
88
+ }
89
+ }
90
+
91
+ get scaleBlend() {
92
+ return this._scaleBlend;
93
+ }
94
+
95
+ set blend(value: boolean) {
96
+ this._blend = value;
97
+ if (this.component) {
98
+ this.component.scaleMode = this._blend ? SCALEMODE_BLEND : SCALEMODE_NONE;
99
+ }
100
+ }
101
+
102
+ get blend() {
103
+ return this._blend;
104
+ }
105
+
106
+ set screenSpace(value: boolean) {
107
+ this._screenSpace = value;
108
+ if (this.component) {
109
+ this.component.screenSpace = this._screenSpace;
110
+ }
111
+ }
112
+
113
+ get screenSpace() {
114
+ return this._screenSpace;
115
+ }
116
+
117
+ static get observedAttributes() {
118
+ return [
119
+ ...super.observedAttributes,
120
+ 'blend',
121
+ 'screen-space',
122
+ 'resolution',
123
+ 'reference-resolution',
124
+ 'priority',
125
+ 'scale-blend'
126
+ ];
127
+ }
128
+
129
+ attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
130
+ super.attributeChangedCallback(name, _oldValue, newValue);
131
+
132
+ switch (name) {
133
+ case 'priority':
134
+ this.priority = parseInt(newValue, 10);
135
+ break;
136
+ case 'reference-resolution':
137
+ this.referenceResolution = parseVec2(newValue);
138
+ break;
139
+ case 'resolution':
140
+ this.resolution = parseVec2(newValue);
141
+ break;
142
+ case 'scale-blend':
143
+ this.scaleBlend = parseFloat(newValue);
144
+ break;
145
+ case 'blend':
146
+ this.blend = this.hasAttribute('blend');
147
+ break;
148
+ case 'screen-space':
149
+ this.screenSpace = this.hasAttribute('screen-space');
150
+ break;
151
+ }
152
+ }
153
+ }
154
+
155
+ customElements.define('pc-screen', ScreenComponentElement);
156
+
157
+ export { ScreenComponentElement };