@playcanvas/web-components 0.3.0 → 0.5.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/LICENSE +21 -21
- package/README.md +84 -84
- package/dist/components/light-component.d.ts +48 -0
- package/dist/components/splat-component.d.ts +0 -13
- package/dist/pwc.cjs +275 -207
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +275 -207
- 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.mjs +276 -208
- package/dist/pwc.mjs.map +1 -1
- package/package.json +76 -66
- package/src/app.ts +612 -606
- package/src/asset.ts +159 -159
- package/src/async-element.ts +46 -46
- package/src/colors.ts +150 -150
- package/src/components/camera-component.ts +557 -557
- package/src/components/collision-component.ts +183 -183
- package/src/components/component.ts +97 -97
- package/src/components/element-component.ts +367 -367
- package/src/components/light-component.ts +570 -466
- package/src/components/listener-component.ts +30 -30
- package/src/components/particlesystem-component.ts +155 -155
- package/src/components/render-component.ts +147 -147
- package/src/components/rigidbody-component.ts +227 -227
- package/src/components/screen-component.ts +157 -157
- package/src/components/script-component.ts +270 -270
- package/src/components/script.ts +90 -90
- package/src/components/sound-component.ts +230 -230
- package/src/components/sound-slot.ts +288 -288
- package/src/components/splat-component.ts +102 -133
- package/src/entity.ts +360 -360
- package/src/index.ts +63 -63
- package/src/material.ts +141 -141
- package/src/model.ts +111 -111
- package/src/module.ts +43 -43
- package/src/scene.ts +217 -217
- package/src/sky.ts +293 -293
- package/src/utils.ts +71 -71
|
@@ -1,133 +1,102 @@
|
|
|
1
|
-
import { GSplatComponent } from 'playcanvas';
|
|
2
|
-
|
|
3
|
-
import { ComponentElement } from './component';
|
|
4
|
-
import { AssetElement } from '../asset';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The SplatComponentElement interface provides properties and methods for manipulating
|
|
8
|
-
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
|
|
9
|
-
* The SplatComponentElement interface also inherits the properties and methods of the
|
|
10
|
-
* {@link HTMLElement} interface.
|
|
11
|
-
*
|
|
12
|
-
* @category Components
|
|
13
|
-
*/
|
|
14
|
-
class SplatComponentElement extends ComponentElement {
|
|
15
|
-
private _asset = '';
|
|
16
|
-
|
|
17
|
-
private _castShadows = false;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
static get observedAttributes() {
|
|
106
|
-
return [
|
|
107
|
-
...super.observedAttributes,
|
|
108
|
-
'asset',
|
|
109
|
-
'cast-shadows',
|
|
110
|
-
'unified'
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
115
|
-
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
116
|
-
|
|
117
|
-
switch (name) {
|
|
118
|
-
case 'asset':
|
|
119
|
-
this.asset = newValue;
|
|
120
|
-
break;
|
|
121
|
-
case 'cast-shadows':
|
|
122
|
-
this.castShadows = this.hasAttribute('cast-shadows');
|
|
123
|
-
break;
|
|
124
|
-
case 'unified':
|
|
125
|
-
this.unified = this.hasAttribute('unified');
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
customElements.define('pc-splat', SplatComponentElement);
|
|
132
|
-
|
|
133
|
-
export { SplatComponentElement };
|
|
1
|
+
import { GSplatComponent } from 'playcanvas';
|
|
2
|
+
|
|
3
|
+
import { ComponentElement } from './component';
|
|
4
|
+
import { AssetElement } from '../asset';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The SplatComponentElement interface provides properties and methods for manipulating
|
|
8
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
|
|
9
|
+
* The SplatComponentElement interface also inherits the properties and methods of the
|
|
10
|
+
* {@link HTMLElement} interface.
|
|
11
|
+
*
|
|
12
|
+
* @category Components
|
|
13
|
+
*/
|
|
14
|
+
class SplatComponentElement extends ComponentElement {
|
|
15
|
+
private _asset = '';
|
|
16
|
+
|
|
17
|
+
private _castShadows = false;
|
|
18
|
+
|
|
19
|
+
/** @ignore */
|
|
20
|
+
constructor() {
|
|
21
|
+
super('gsplat');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getInitialComponentData() {
|
|
25
|
+
return {
|
|
26
|
+
asset: AssetElement.get(this._asset),
|
|
27
|
+
castShadows: this._castShadows
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Gets the underlying PlayCanvas splat component.
|
|
33
|
+
* @returns The splat component.
|
|
34
|
+
*/
|
|
35
|
+
get component(): GSplatComponent | null {
|
|
36
|
+
return super.component as GSplatComponent | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Sets id of the `pc-asset` to use for the splat.
|
|
41
|
+
* @param value - The asset ID.
|
|
42
|
+
*/
|
|
43
|
+
set asset(value: string) {
|
|
44
|
+
this._asset = value;
|
|
45
|
+
const asset = AssetElement.get(value);
|
|
46
|
+
if (this.component && asset) {
|
|
47
|
+
this.component.asset = asset;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Gets the id of the `pc-asset` to use for the splat.
|
|
53
|
+
* @returns The asset ID.
|
|
54
|
+
*/
|
|
55
|
+
get asset() {
|
|
56
|
+
return this._asset;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sets whether the splat casts shadows.
|
|
61
|
+
* @param value - Whether the splat casts shadows.
|
|
62
|
+
*/
|
|
63
|
+
set castShadows(value: boolean) {
|
|
64
|
+
this._castShadows = value;
|
|
65
|
+
if (this.component) {
|
|
66
|
+
this.component.castShadows = value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Gets whether the splat casts shadows.
|
|
72
|
+
* @returns Whether the splat casts shadows.
|
|
73
|
+
*/
|
|
74
|
+
get castShadows() {
|
|
75
|
+
return this._castShadows;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static get observedAttributes() {
|
|
79
|
+
return [
|
|
80
|
+
...super.observedAttributes,
|
|
81
|
+
'asset',
|
|
82
|
+
'cast-shadows'
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string) {
|
|
87
|
+
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
88
|
+
|
|
89
|
+
switch (name) {
|
|
90
|
+
case 'asset':
|
|
91
|
+
this.asset = newValue;
|
|
92
|
+
break;
|
|
93
|
+
case 'cast-shadows':
|
|
94
|
+
this.castShadows = this.hasAttribute('cast-shadows');
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
customElements.define('pc-splat', SplatComponentElement);
|
|
101
|
+
|
|
102
|
+
export { SplatComponentElement };
|