@playcanvas/web-components 0.1.10 → 0.1.12
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 +1 -1
- package/README.md +33 -273
- package/dist/app.d.ts +4 -1
- package/dist/asset.d.ts +3 -2
- package/dist/components/camera-component.d.ts +17 -3
- package/dist/components/collision-component.d.ts +4 -3
- package/dist/components/element-component.d.ts +84 -3
- package/dist/components/light-component.d.ts +4 -3
- package/dist/components/listener-component.d.ts +4 -3
- package/dist/components/render-component.d.ts +4 -3
- package/dist/components/rigidbody-component.d.ts +5 -4
- package/dist/components/screen-component.d.ts +4 -3
- package/dist/components/script-component.d.ts +4 -3
- package/dist/components/sound-component.d.ts +4 -3
- package/dist/components/sound-slot.d.ts +2 -2
- package/dist/components/splat-component.d.ts +36 -0
- package/dist/entity.d.ts +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/material.d.ts +3 -2
- package/dist/model.d.ts +6 -5
- package/dist/module.d.ts +3 -2
- package/dist/pwc.cjs +284 -87
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +284 -87
- 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 +284 -87
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +3 -2
- package/dist/sky.d.ts +64 -0
- package/package.json +23 -23
- package/src/app.ts +14 -10
- package/src/asset.ts +3 -2
- package/src/components/camera-component.ts +31 -3
- package/src/components/collision-component.ts +4 -3
- package/src/components/element-component.ts +84 -3
- package/src/components/light-component.ts +4 -3
- package/src/components/listener-component.ts +4 -3
- package/src/components/render-component.ts +4 -3
- package/src/components/rigidbody-component.ts +5 -4
- package/src/components/screen-component.ts +4 -3
- package/src/components/script-component.ts +4 -3
- package/src/components/sound-component.ts +4 -3
- package/src/components/sound-slot.ts +2 -2
- package/src/components/{gsplat-component.ts → splat-component.ts} +17 -8
- package/src/entity.ts +3 -2
- package/src/index.ts +2 -2
- package/src/material.ts +6 -5
- package/src/model.ts +8 -7
- package/src/module.ts +3 -2
- package/src/scene.ts +3 -2
- package/src/sky.ts +64 -0
- package/dist/components/gsplat-component.d.ts +0 -27
- package/dist/fog.d.ts +0 -28
- package/src/fog.ts +0 -121
package/dist/pwc.cjs
CHANGED
|
@@ -15,11 +15,11 @@ class AsyncElement extends HTMLElement {
|
|
|
15
15
|
}
|
|
16
16
|
get closestApp() {
|
|
17
17
|
var _a;
|
|
18
|
-
return (_a = this.parentElement) === null || _a ===
|
|
18
|
+
return (_a = this.parentElement) === null || _a === undefined ? undefined : _a.closest('pc-app');
|
|
19
19
|
}
|
|
20
20
|
get closestEntity() {
|
|
21
21
|
var _a;
|
|
22
|
-
return (_a = this.parentElement) === null || _a ===
|
|
22
|
+
return (_a = this.parentElement) === null || _a === undefined ? undefined : _a.closest('pc-entity');
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Called when the element is fully initialized and ready.
|
|
@@ -40,8 +40,9 @@ class AsyncElement extends HTMLElement {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* The ModuleElement interface provides properties and methods for manipulating
|
|
43
|
-
* `<pc-module>` elements.
|
|
44
|
-
*
|
|
43
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-module/ | `<pc-module>`} elements.
|
|
44
|
+
* The ModuleElement interface also inherits the properties and methods of the
|
|
45
|
+
* {@link HTMLElement} interface.
|
|
45
46
|
*/
|
|
46
47
|
class ModuleElement extends HTMLElement {
|
|
47
48
|
/** @ignore */
|
|
@@ -79,7 +80,10 @@ class ModuleElement extends HTMLElement {
|
|
|
79
80
|
customElements.define('pc-module', ModuleElement);
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
|
-
* The
|
|
83
|
+
* The AppElement interface provides properties and methods for manipulating
|
|
84
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-app/ | `<pc-app>`} elements.
|
|
85
|
+
* The AppElement interface also inherits the properties and methods of the
|
|
86
|
+
* {@link HTMLElement} interface.
|
|
83
87
|
*/
|
|
84
88
|
class AppElement extends AsyncElement {
|
|
85
89
|
/**
|
|
@@ -238,13 +242,14 @@ class AppElement extends AsyncElement {
|
|
|
238
242
|
// Get the currently hovered entity by walking up the hierarchy
|
|
239
243
|
let newHoverEntity = null;
|
|
240
244
|
if (selection.length > 0) {
|
|
241
|
-
let
|
|
242
|
-
while (
|
|
243
|
-
const entityElement = this.querySelector(`pc-entity[name="${
|
|
245
|
+
let currentNode = selection[0].node;
|
|
246
|
+
while (currentNode !== null) {
|
|
247
|
+
const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`);
|
|
244
248
|
if (entityElement) {
|
|
245
249
|
newHoverEntity = entityElement;
|
|
250
|
+
break;
|
|
246
251
|
}
|
|
247
|
-
|
|
252
|
+
currentNode = currentNode.parent;
|
|
248
253
|
}
|
|
249
254
|
}
|
|
250
255
|
// Handle enter/leave events
|
|
@@ -275,14 +280,14 @@ class AppElement extends AsyncElement {
|
|
|
275
280
|
this._picker.prepare(camera, this.app.scene);
|
|
276
281
|
const selection = this._picker.getSelection(x, y);
|
|
277
282
|
if (selection.length > 0) {
|
|
278
|
-
let
|
|
279
|
-
while (
|
|
280
|
-
const entityElement = this.querySelector(`pc-entity[name="${
|
|
283
|
+
let currentNode = selection[0].node;
|
|
284
|
+
while (currentNode !== null) {
|
|
285
|
+
const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`);
|
|
281
286
|
if (entityElement && entityElement.hasListeners('pointerdown')) {
|
|
282
287
|
entityElement.dispatchEvent(new PointerEvent('pointerdown', event));
|
|
283
288
|
break;
|
|
284
289
|
}
|
|
285
|
-
|
|
290
|
+
currentNode = currentNode.parent;
|
|
286
291
|
}
|
|
287
292
|
}
|
|
288
293
|
}
|
|
@@ -651,8 +656,9 @@ const parseVec4 = (value) => {
|
|
|
651
656
|
|
|
652
657
|
/**
|
|
653
658
|
* The EntityElement interface provides properties and methods for manipulating
|
|
654
|
-
* `<pc-entity>` elements.
|
|
655
|
-
*
|
|
659
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
|
|
660
|
+
* The EntityElement interface also inherits the properties and methods of the
|
|
661
|
+
* {@link HTMLElement} interface.
|
|
656
662
|
*/
|
|
657
663
|
class EntityElement extends AsyncElement {
|
|
658
664
|
constructor() {
|
|
@@ -742,7 +748,7 @@ class EntityElement extends AsyncElement {
|
|
|
742
748
|
if (!this.entity)
|
|
743
749
|
return;
|
|
744
750
|
const closestEntity = this.closestEntity;
|
|
745
|
-
if (closestEntity === null || closestEntity ===
|
|
751
|
+
if (closestEntity === null || closestEntity === undefined ? undefined : closestEntity.entity) {
|
|
746
752
|
closestEntity.entity.addChild(this.entity);
|
|
747
753
|
}
|
|
748
754
|
else {
|
|
@@ -964,7 +970,7 @@ class EntityElement extends AsyncElement {
|
|
|
964
970
|
}
|
|
965
971
|
hasListeners(type) {
|
|
966
972
|
var _a;
|
|
967
|
-
return Boolean((_a = this._listeners[type]) === null || _a ===
|
|
973
|
+
return Boolean((_a = this._listeners[type]) === null || _a === undefined ? undefined : _a.length);
|
|
968
974
|
}
|
|
969
975
|
}
|
|
970
976
|
customElements.define('pc-entity', EntityElement);
|
|
@@ -990,8 +996,9 @@ const extToType = new Map([
|
|
|
990
996
|
]);
|
|
991
997
|
/**
|
|
992
998
|
* The AssetElement interface provides properties and methods for manipulating
|
|
993
|
-
* `<pc-asset>` elements.
|
|
994
|
-
*
|
|
999
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
|
|
1000
|
+
* The AssetElement interface also inherits the properties and methods of the
|
|
1001
|
+
* {@link HTMLElement} interface.
|
|
995
1002
|
*/
|
|
996
1003
|
class AssetElement extends HTMLElement {
|
|
997
1004
|
constructor() {
|
|
@@ -1013,7 +1020,7 @@ class AssetElement extends HTMLElement {
|
|
|
1013
1020
|
// If no type is specified, try to infer it from the file extension.
|
|
1014
1021
|
if (!type) {
|
|
1015
1022
|
const ext = src.split('.').pop();
|
|
1016
|
-
type = (_a = extToType.get(ext || '')) !== null && _a !==
|
|
1023
|
+
type = (_a = extToType.get(ext || '')) !== null && _a !== undefined ? _a : null;
|
|
1017
1024
|
}
|
|
1018
1025
|
if (!type) {
|
|
1019
1026
|
console.warn(`Unsupported asset type: ${src}`);
|
|
@@ -1047,7 +1054,7 @@ class AssetElement extends HTMLElement {
|
|
|
1047
1054
|
}
|
|
1048
1055
|
static get(id) {
|
|
1049
1056
|
const assetElement = document.querySelector(`pc-asset[id="${id}"]`);
|
|
1050
|
-
return assetElement === null || assetElement ===
|
|
1057
|
+
return assetElement === null || assetElement === undefined ? undefined : assetElement.asset;
|
|
1051
1058
|
}
|
|
1052
1059
|
static get observedAttributes() {
|
|
1053
1060
|
return ['preload'];
|
|
@@ -1094,7 +1101,7 @@ class ComponentElement extends AsyncElement {
|
|
|
1094
1101
|
initComponent() { }
|
|
1095
1102
|
async connectedCallback() {
|
|
1096
1103
|
var _a;
|
|
1097
|
-
await ((_a = this.closestApp) === null || _a ===
|
|
1104
|
+
await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
1098
1105
|
await this.addComponent();
|
|
1099
1106
|
this.initComponent();
|
|
1100
1107
|
this._onReady();
|
|
@@ -1140,8 +1147,9 @@ class ComponentElement extends AsyncElement {
|
|
|
1140
1147
|
|
|
1141
1148
|
/**
|
|
1142
1149
|
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
1143
|
-
* `<pc-listener>` elements.
|
|
1144
|
-
* and methods of the
|
|
1150
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
|
|
1151
|
+
* The ListenerComponentElement interface also inherits the properties and methods of the
|
|
1152
|
+
* {@link HTMLElement} interface.
|
|
1145
1153
|
*
|
|
1146
1154
|
* @category Components
|
|
1147
1155
|
*/
|
|
@@ -1151,7 +1159,7 @@ class ListenerComponentElement extends ComponentElement {
|
|
|
1151
1159
|
super('audiolistener');
|
|
1152
1160
|
}
|
|
1153
1161
|
/**
|
|
1154
|
-
* Gets the audio listener component.
|
|
1162
|
+
* Gets the underlying PlayCanvas audio listener component.
|
|
1155
1163
|
* @returns The audio listener component.
|
|
1156
1164
|
*/
|
|
1157
1165
|
get component() {
|
|
@@ -1171,8 +1179,9 @@ const tonemaps = new Map([
|
|
|
1171
1179
|
]);
|
|
1172
1180
|
/**
|
|
1173
1181
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
1174
|
-
* `<pc-camera>` elements.
|
|
1175
|
-
*
|
|
1182
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
1183
|
+
* The CameraComponentElement interface also inherits the properties and methods of the
|
|
1184
|
+
* {@link HTMLElement} interface.
|
|
1176
1185
|
*
|
|
1177
1186
|
* @category Components
|
|
1178
1187
|
*/
|
|
@@ -1190,6 +1199,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1190
1199
|
this._fov = 45;
|
|
1191
1200
|
this._frustumCulling = true;
|
|
1192
1201
|
this._gamma = 'srgb';
|
|
1202
|
+
this._horizontalFov = false;
|
|
1193
1203
|
this._nearClip = 0.1;
|
|
1194
1204
|
this._orthographic = false;
|
|
1195
1205
|
this._orthoHeight = 10;
|
|
@@ -1210,6 +1220,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1210
1220
|
fov: this._fov,
|
|
1211
1221
|
frustumCulling: this._frustumCulling,
|
|
1212
1222
|
gammaCorrection: this._gamma === 'srgb' ? playcanvas.GAMMA_SRGB : playcanvas.GAMMA_NONE,
|
|
1223
|
+
horizontalFov: this._horizontalFov,
|
|
1213
1224
|
nearClip: this._nearClip,
|
|
1214
1225
|
orthographic: this._orthographic,
|
|
1215
1226
|
orthoHeight: this._orthoHeight,
|
|
@@ -1221,7 +1232,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1221
1232
|
}
|
|
1222
1233
|
get xrAvailable() {
|
|
1223
1234
|
var _a;
|
|
1224
|
-
const xrManager = (_a = this.component) === null || _a ===
|
|
1235
|
+
const xrManager = (_a = this.component) === null || _a === undefined ? undefined : _a.system.app.xr;
|
|
1225
1236
|
return xrManager && xrManager.supported && xrManager.isAvailable(playcanvas.XRTYPE_VR);
|
|
1226
1237
|
}
|
|
1227
1238
|
startXr(type, space) {
|
|
@@ -1240,7 +1251,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1240
1251
|
}
|
|
1241
1252
|
}
|
|
1242
1253
|
/**
|
|
1243
|
-
* Gets the camera component.
|
|
1254
|
+
* Gets the underlying PlayCanvas camera component.
|
|
1244
1255
|
* @returns The camera component.
|
|
1245
1256
|
*/
|
|
1246
1257
|
get component() {
|
|
@@ -1416,6 +1427,24 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1416
1427
|
get gamma() {
|
|
1417
1428
|
return this._gamma;
|
|
1418
1429
|
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Sets whether the camera's field of view (fov) is horizontal or vertical. Defaults to false
|
|
1432
|
+
* (meaning it is vertical be default).
|
|
1433
|
+
* @param value - Whether the camera's field of view is horizontal.
|
|
1434
|
+
*/
|
|
1435
|
+
set horizontalFov(value) {
|
|
1436
|
+
this._horizontalFov = value;
|
|
1437
|
+
if (this.component) {
|
|
1438
|
+
this.component.horizontalFov = value;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Gets whether the camera's field of view (fov) is horizontal or vertical.
|
|
1443
|
+
* @returns Whether the camera's field of view is horizontal.
|
|
1444
|
+
*/
|
|
1445
|
+
get horizontalFov() {
|
|
1446
|
+
return this._horizontalFov;
|
|
1447
|
+
}
|
|
1419
1448
|
/**
|
|
1420
1449
|
* Sets the near clip distance of the camera.
|
|
1421
1450
|
* @param value - The near clip distance.
|
|
@@ -1526,7 +1555,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1526
1555
|
var _a;
|
|
1527
1556
|
this._tonemap = value;
|
|
1528
1557
|
if (this.component) {
|
|
1529
|
-
this.component.toneMapping = (_a = tonemaps.get(value)) !== null && _a !==
|
|
1558
|
+
this.component.toneMapping = (_a = tonemaps.get(value)) !== null && _a !== undefined ? _a : playcanvas.TONEMAP_NONE;
|
|
1530
1559
|
}
|
|
1531
1560
|
}
|
|
1532
1561
|
/**
|
|
@@ -1549,6 +1578,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1549
1578
|
'fov',
|
|
1550
1579
|
'frustum-culling',
|
|
1551
1580
|
'gamma',
|
|
1581
|
+
'horizontal-fov',
|
|
1552
1582
|
'near-clip',
|
|
1553
1583
|
'orthographic',
|
|
1554
1584
|
'ortho-height',
|
|
@@ -1591,6 +1621,9 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1591
1621
|
case 'gamma':
|
|
1592
1622
|
this.gamma = newValue;
|
|
1593
1623
|
break;
|
|
1624
|
+
case 'horizontal-fov':
|
|
1625
|
+
this.horizontalFov = this.hasAttribute('horizontal-fov');
|
|
1626
|
+
break;
|
|
1594
1627
|
case 'near-clip':
|
|
1595
1628
|
this.nearClip = parseFloat(newValue);
|
|
1596
1629
|
break;
|
|
@@ -1619,8 +1652,9 @@ customElements.define('pc-camera', CameraComponentElement);
|
|
|
1619
1652
|
|
|
1620
1653
|
/**
|
|
1621
1654
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
1622
|
-
* `<pc-collision>` elements.
|
|
1623
|
-
* and methods of the
|
|
1655
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
1656
|
+
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
1657
|
+
* {@link HTMLElement} interface.
|
|
1624
1658
|
*
|
|
1625
1659
|
* @category Components
|
|
1626
1660
|
*/
|
|
@@ -1650,7 +1684,7 @@ class CollisionComponentElement extends ComponentElement {
|
|
|
1650
1684
|
};
|
|
1651
1685
|
}
|
|
1652
1686
|
/**
|
|
1653
|
-
* Gets the collision component.
|
|
1687
|
+
* Gets the underlying PlayCanvas collision component.
|
|
1654
1688
|
* @returns The collision component.
|
|
1655
1689
|
*/
|
|
1656
1690
|
get component() {
|
|
@@ -1765,8 +1799,9 @@ customElements.define('pc-collision', CollisionComponentElement);
|
|
|
1765
1799
|
|
|
1766
1800
|
/**
|
|
1767
1801
|
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
1768
|
-
* `<pc-element>` elements.
|
|
1769
|
-
*
|
|
1802
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-element/ | `<pc-element>`} elements.
|
|
1803
|
+
* The ElementComponentElement interface also inherits the properties and methods of the
|
|
1804
|
+
* {@link HTMLElement} interface.
|
|
1770
1805
|
*
|
|
1771
1806
|
* @category Components
|
|
1772
1807
|
*/
|
|
@@ -1805,21 +1840,33 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1805
1840
|
};
|
|
1806
1841
|
}
|
|
1807
1842
|
/**
|
|
1808
|
-
* Gets the element component.
|
|
1843
|
+
* Gets the underlying PlayCanvas element component.
|
|
1809
1844
|
* @returns The element component.
|
|
1810
1845
|
*/
|
|
1811
1846
|
get component() {
|
|
1812
1847
|
return super.component;
|
|
1813
1848
|
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Sets the anchor of the element component.
|
|
1851
|
+
* @param value - The anchor.
|
|
1852
|
+
*/
|
|
1814
1853
|
set anchor(value) {
|
|
1815
1854
|
this._anchor = value;
|
|
1816
1855
|
if (this.component) {
|
|
1817
1856
|
this.component.anchor = value;
|
|
1818
1857
|
}
|
|
1819
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Gets the anchor of the element component.
|
|
1861
|
+
* @returns The anchor.
|
|
1862
|
+
*/
|
|
1820
1863
|
get anchor() {
|
|
1821
1864
|
return this._anchor;
|
|
1822
1865
|
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Sets the id of the `pc-asset` to use for the font.
|
|
1868
|
+
* @param value - The asset ID.
|
|
1869
|
+
*/
|
|
1823
1870
|
set asset(value) {
|
|
1824
1871
|
this._asset = value;
|
|
1825
1872
|
const asset = AssetElement.get(value);
|
|
@@ -1827,60 +1874,112 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1827
1874
|
this.component.fontAsset = asset.id;
|
|
1828
1875
|
}
|
|
1829
1876
|
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Gets the id of the `pc-asset` to use for the font.
|
|
1879
|
+
* @returns The asset ID.
|
|
1880
|
+
*/
|
|
1830
1881
|
get asset() {
|
|
1831
1882
|
return this._asset;
|
|
1832
1883
|
}
|
|
1884
|
+
/**
|
|
1885
|
+
* Sets whether the element component should automatically adjust its width.
|
|
1886
|
+
* @param value - Whether to automatically adjust the width.
|
|
1887
|
+
*/
|
|
1833
1888
|
set autoWidth(value) {
|
|
1834
1889
|
this._autoWidth = value;
|
|
1835
1890
|
if (this.component) {
|
|
1836
1891
|
this.component.autoWidth = value;
|
|
1837
1892
|
}
|
|
1838
1893
|
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Gets whether the element component should automatically adjust its width.
|
|
1896
|
+
* @returns Whether to automatically adjust the width.
|
|
1897
|
+
*/
|
|
1839
1898
|
get autoWidth() {
|
|
1840
1899
|
return this._autoWidth;
|
|
1841
1900
|
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Sets the color of the element component.
|
|
1903
|
+
* @param value - The color.
|
|
1904
|
+
*/
|
|
1842
1905
|
set color(value) {
|
|
1843
1906
|
this._color = value;
|
|
1844
1907
|
if (this.component) {
|
|
1845
1908
|
this.component.color = value;
|
|
1846
1909
|
}
|
|
1847
1910
|
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Gets the color of the element component.
|
|
1913
|
+
* @returns The color.
|
|
1914
|
+
*/
|
|
1848
1915
|
get color() {
|
|
1849
1916
|
return this._color;
|
|
1850
1917
|
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Sets the font size of the element component.
|
|
1920
|
+
* @param value - The font size.
|
|
1921
|
+
*/
|
|
1851
1922
|
set fontSize(value) {
|
|
1852
1923
|
this._fontSize = value;
|
|
1853
1924
|
if (this.component) {
|
|
1854
1925
|
this.component.fontSize = value;
|
|
1855
1926
|
}
|
|
1856
1927
|
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Gets the font size of the element component.
|
|
1930
|
+
* @returns The font size.
|
|
1931
|
+
*/
|
|
1857
1932
|
get fontSize() {
|
|
1858
1933
|
return this._fontSize;
|
|
1859
1934
|
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Sets the line height of the element component.
|
|
1937
|
+
* @param value - The line height.
|
|
1938
|
+
*/
|
|
1860
1939
|
set lineHeight(value) {
|
|
1861
1940
|
this._lineHeight = value;
|
|
1862
1941
|
if (this.component) {
|
|
1863
1942
|
this.component.lineHeight = value;
|
|
1864
1943
|
}
|
|
1865
1944
|
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Gets the line height of the element component.
|
|
1947
|
+
* @returns The line height.
|
|
1948
|
+
*/
|
|
1866
1949
|
get lineHeight() {
|
|
1867
1950
|
return this._lineHeight;
|
|
1868
1951
|
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Sets the pivot of the element component.
|
|
1954
|
+
* @param value - The pivot.
|
|
1955
|
+
*/
|
|
1869
1956
|
set pivot(value) {
|
|
1870
1957
|
this._pivot = value;
|
|
1871
1958
|
if (this.component) {
|
|
1872
1959
|
this.component.pivot = value;
|
|
1873
1960
|
}
|
|
1874
1961
|
}
|
|
1962
|
+
/**
|
|
1963
|
+
* Gets the pivot of the element component.
|
|
1964
|
+
* @returns The pivot.
|
|
1965
|
+
*/
|
|
1875
1966
|
get pivot() {
|
|
1876
1967
|
return this._pivot;
|
|
1877
1968
|
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Sets the text of the element component.
|
|
1971
|
+
* @param value - The text.
|
|
1972
|
+
*/
|
|
1878
1973
|
set text(value) {
|
|
1879
1974
|
this._text = value;
|
|
1880
1975
|
if (this.component) {
|
|
1881
1976
|
this.component.text = value;
|
|
1882
1977
|
}
|
|
1883
1978
|
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Gets the text of the element component.
|
|
1981
|
+
* @returns The text.
|
|
1982
|
+
*/
|
|
1884
1983
|
get text() {
|
|
1885
1984
|
return this._text;
|
|
1886
1985
|
}
|
|
@@ -1901,21 +2000,37 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1901
2000
|
get type() {
|
|
1902
2001
|
return this._type;
|
|
1903
2002
|
}
|
|
2003
|
+
/**
|
|
2004
|
+
* Sets the width of the element component.
|
|
2005
|
+
* @param value - The width.
|
|
2006
|
+
*/
|
|
1904
2007
|
set width(value) {
|
|
1905
2008
|
this._width = value;
|
|
1906
2009
|
if (this.component) {
|
|
1907
2010
|
this.component.width = value;
|
|
1908
2011
|
}
|
|
1909
2012
|
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Gets the width of the element component.
|
|
2015
|
+
* @returns The width.
|
|
2016
|
+
*/
|
|
1910
2017
|
get width() {
|
|
1911
2018
|
return this._width;
|
|
1912
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Sets whether the element component should wrap lines.
|
|
2022
|
+
* @param value - Whether to wrap lines.
|
|
2023
|
+
*/
|
|
1913
2024
|
set wrapLines(value) {
|
|
1914
2025
|
this._wrapLines = value;
|
|
1915
2026
|
if (this.component) {
|
|
1916
2027
|
this.component.wrapLines = value;
|
|
1917
2028
|
}
|
|
1918
2029
|
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Gets whether the element component should wrap lines.
|
|
2032
|
+
* @returns Whether to wrap lines.
|
|
2033
|
+
*/
|
|
1919
2034
|
get wrapLines() {
|
|
1920
2035
|
return this._wrapLines;
|
|
1921
2036
|
}
|
|
@@ -1977,13 +2092,14 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1977
2092
|
customElements.define('pc-element', ElementComponentElement);
|
|
1978
2093
|
|
|
1979
2094
|
/**
|
|
1980
|
-
* The
|
|
1981
|
-
* `<pc-splat>` elements.
|
|
1982
|
-
*
|
|
2095
|
+
* The SplatComponentElement interface provides properties and methods for manipulating
|
|
2096
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
|
|
2097
|
+
* The SplatComponentElement interface also inherits the properties and methods of the
|
|
2098
|
+
* {@link HTMLElement} interface.
|
|
1983
2099
|
*
|
|
1984
2100
|
* @category Components
|
|
1985
2101
|
*/
|
|
1986
|
-
class
|
|
2102
|
+
class SplatComponentElement extends ComponentElement {
|
|
1987
2103
|
/** @ignore */
|
|
1988
2104
|
constructor() {
|
|
1989
2105
|
super('gsplat');
|
|
@@ -1995,12 +2111,16 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
1995
2111
|
};
|
|
1996
2112
|
}
|
|
1997
2113
|
/**
|
|
1998
|
-
* Gets the
|
|
1999
|
-
* @returns The
|
|
2114
|
+
* Gets the underlying PlayCanvas splat component.
|
|
2115
|
+
* @returns The splat component.
|
|
2000
2116
|
*/
|
|
2001
2117
|
get component() {
|
|
2002
2118
|
return super.component;
|
|
2003
2119
|
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Sets id of the `pc-asset` to use for the splat.
|
|
2122
|
+
* @param value - The asset ID.
|
|
2123
|
+
*/
|
|
2004
2124
|
set asset(value) {
|
|
2005
2125
|
this._asset = value;
|
|
2006
2126
|
const asset = AssetElement.get(value);
|
|
@@ -2008,6 +2128,10 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
2008
2128
|
this.component.asset = asset;
|
|
2009
2129
|
}
|
|
2010
2130
|
}
|
|
2131
|
+
/**
|
|
2132
|
+
* Gets the id of the `pc-asset` to use for the splat.
|
|
2133
|
+
* @returns The asset ID.
|
|
2134
|
+
*/
|
|
2011
2135
|
get asset() {
|
|
2012
2136
|
return this._asset;
|
|
2013
2137
|
}
|
|
@@ -2023,7 +2147,7 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
2023
2147
|
}
|
|
2024
2148
|
}
|
|
2025
2149
|
}
|
|
2026
|
-
customElements.define('pc-splat',
|
|
2150
|
+
customElements.define('pc-splat', SplatComponentElement);
|
|
2027
2151
|
|
|
2028
2152
|
const shadowTypes = new Map([
|
|
2029
2153
|
['pcf1-16f', playcanvas.SHADOW_PCF1_16F],
|
|
@@ -2038,8 +2162,9 @@ const shadowTypes = new Map([
|
|
|
2038
2162
|
]);
|
|
2039
2163
|
/**
|
|
2040
2164
|
* The LightComponentElement interface provides properties and methods for manipulating
|
|
2041
|
-
* `<pc-light>` elements.
|
|
2042
|
-
*
|
|
2165
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-light/ | `<pc-light>`} elements.
|
|
2166
|
+
* The LightComponentElement interface also inherits the properties and methods of the
|
|
2167
|
+
* {@link HTMLElement} interface.
|
|
2043
2168
|
*
|
|
2044
2169
|
* @category Components
|
|
2045
2170
|
*/
|
|
@@ -2081,7 +2206,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
2081
2206
|
};
|
|
2082
2207
|
}
|
|
2083
2208
|
/**
|
|
2084
|
-
* Gets the light component.
|
|
2209
|
+
* Gets the underlying PlayCanvas light component.
|
|
2085
2210
|
* @returns The light component.
|
|
2086
2211
|
*/
|
|
2087
2212
|
get component() {
|
|
@@ -2292,7 +2417,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
2292
2417
|
var _a;
|
|
2293
2418
|
this._shadowType = value;
|
|
2294
2419
|
if (this.component) {
|
|
2295
|
-
this.component.shadowType = (_a = shadowTypes.get(value)) !== null && _a !==
|
|
2420
|
+
this.component.shadowType = (_a = shadowTypes.get(value)) !== null && _a !== undefined ? _a : playcanvas.SHADOW_PCF3_32F;
|
|
2296
2421
|
}
|
|
2297
2422
|
}
|
|
2298
2423
|
/**
|
|
@@ -2411,8 +2536,9 @@ customElements.define('pc-light', LightComponentElement);
|
|
|
2411
2536
|
|
|
2412
2537
|
/**
|
|
2413
2538
|
* The MaterialElement interface provides properties and methods for manipulating
|
|
2414
|
-
* `<pc-material>` elements.
|
|
2415
|
-
*
|
|
2539
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-material/ | `<pc-material>`} elements.
|
|
2540
|
+
* The MaterialElement interface also inherits the properties and methods of the
|
|
2541
|
+
* {@link HTMLElement} interface.
|
|
2416
2542
|
*/
|
|
2417
2543
|
class MaterialElement extends HTMLElement {
|
|
2418
2544
|
constructor() {
|
|
@@ -2498,7 +2624,7 @@ class MaterialElement extends HTMLElement {
|
|
|
2498
2624
|
}
|
|
2499
2625
|
static get(id) {
|
|
2500
2626
|
const materialElement = document.querySelector(`pc-material[id="${id}"]`);
|
|
2501
|
-
return materialElement === null || materialElement ===
|
|
2627
|
+
return materialElement === null || materialElement === undefined ? undefined : materialElement.material;
|
|
2502
2628
|
}
|
|
2503
2629
|
static get observedAttributes() {
|
|
2504
2630
|
return ['diffuse', 'diffuse-map', 'metalness-map', 'normal-map', 'roughness-map'];
|
|
@@ -2527,8 +2653,9 @@ customElements.define('pc-material', MaterialElement);
|
|
|
2527
2653
|
|
|
2528
2654
|
/**
|
|
2529
2655
|
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
2530
|
-
* `<pc-render>` elements.
|
|
2531
|
-
*
|
|
2656
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-render/ | `<pc-render>`} elements.
|
|
2657
|
+
* The RenderComponentElement interface also inherits the properties and methods of the
|
|
2658
|
+
* {@link HTMLElement} interface.
|
|
2532
2659
|
*
|
|
2533
2660
|
* @category Components
|
|
2534
2661
|
*/
|
|
@@ -2550,7 +2677,7 @@ class RenderComponentElement extends ComponentElement {
|
|
|
2550
2677
|
};
|
|
2551
2678
|
}
|
|
2552
2679
|
/**
|
|
2553
|
-
* Gets the render component.
|
|
2680
|
+
* Gets the underlying PlayCanvas render component.
|
|
2554
2681
|
* @returns The render component.
|
|
2555
2682
|
*/
|
|
2556
2683
|
get component() {
|
|
@@ -2649,8 +2776,9 @@ customElements.define('pc-render', RenderComponentElement);
|
|
|
2649
2776
|
|
|
2650
2777
|
/**
|
|
2651
2778
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
2652
|
-
* `<pc-rigidbody>` elements.
|
|
2653
|
-
* and methods of the
|
|
2779
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
|
|
2780
|
+
* The RigidBodyComponentElement interface also inherits the properties and methods of the
|
|
2781
|
+
* {@link HTMLElement} interface.
|
|
2654
2782
|
*
|
|
2655
2783
|
* @category Components
|
|
2656
2784
|
*/
|
|
@@ -2709,8 +2837,8 @@ class RigidBodyComponentElement extends ComponentElement {
|
|
|
2709
2837
|
};
|
|
2710
2838
|
}
|
|
2711
2839
|
/**
|
|
2712
|
-
* Gets the
|
|
2713
|
-
* @returns The
|
|
2840
|
+
* Gets the underlying PlayCanvas rigidbody component.
|
|
2841
|
+
* @returns The rigidbody component.
|
|
2714
2842
|
*/
|
|
2715
2843
|
get component() {
|
|
2716
2844
|
return super.component;
|
|
@@ -2836,8 +2964,9 @@ customElements.define('pc-rigidbody', RigidBodyComponentElement);
|
|
|
2836
2964
|
|
|
2837
2965
|
/**
|
|
2838
2966
|
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
2839
|
-
* `<pc-screen>` elements.
|
|
2840
|
-
*
|
|
2967
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
|
|
2968
|
+
* The ScreenComponentElement interface also inherits the properties and methods of the
|
|
2969
|
+
* {@link HTMLElement} interface.
|
|
2841
2970
|
*
|
|
2842
2971
|
* @category Components
|
|
2843
2972
|
*/
|
|
@@ -2863,7 +2992,7 @@ class ScreenComponentElement extends ComponentElement {
|
|
|
2863
2992
|
};
|
|
2864
2993
|
}
|
|
2865
2994
|
/**
|
|
2866
|
-
* Gets the screen component.
|
|
2995
|
+
* Gets the underlying PlayCanvas screen component.
|
|
2867
2996
|
* @returns The screen component.
|
|
2868
2997
|
*/
|
|
2869
2998
|
get component() {
|
|
@@ -2962,8 +3091,9 @@ customElements.define('pc-screen', ScreenComponentElement);
|
|
|
2962
3091
|
|
|
2963
3092
|
/**
|
|
2964
3093
|
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
2965
|
-
* `<pc-scripts>` elements.
|
|
2966
|
-
*
|
|
3094
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
|
|
3095
|
+
* The ScriptComponentElement interface also inherits the properties and methods of the
|
|
3096
|
+
* {@link HTMLElement} interface.
|
|
2967
3097
|
*
|
|
2968
3098
|
* @category Components
|
|
2969
3099
|
*/
|
|
@@ -3110,10 +3240,10 @@ class ScriptComponentElement extends ComponentElement {
|
|
|
3110
3240
|
disconnectedCallback() {
|
|
3111
3241
|
var _a;
|
|
3112
3242
|
this.observer.disconnect();
|
|
3113
|
-
(_a = super.disconnectedCallback) === null || _a ===
|
|
3243
|
+
(_a = super.disconnectedCallback) === null || _a === undefined ? undefined : _a.call(this);
|
|
3114
3244
|
}
|
|
3115
3245
|
/**
|
|
3116
|
-
* Gets the script component.
|
|
3246
|
+
* Gets the underlying PlayCanvas script component.
|
|
3117
3247
|
* @returns The script component.
|
|
3118
3248
|
*/
|
|
3119
3249
|
get component() {
|
|
@@ -3205,8 +3335,9 @@ customElements.define('pc-script', ScriptElement);
|
|
|
3205
3335
|
|
|
3206
3336
|
/**
|
|
3207
3337
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
3208
|
-
* `<pc-sounds>` elements.
|
|
3209
|
-
*
|
|
3338
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
|
|
3339
|
+
* The SoundComponentElement interface also inherits the properties and methods of the
|
|
3340
|
+
* {@link HTMLElement} interface.
|
|
3210
3341
|
*
|
|
3211
3342
|
* @category Components
|
|
3212
3343
|
*/
|
|
@@ -3234,7 +3365,7 @@ class SoundComponentElement extends ComponentElement {
|
|
|
3234
3365
|
};
|
|
3235
3366
|
}
|
|
3236
3367
|
/**
|
|
3237
|
-
* Gets the sound component.
|
|
3368
|
+
* Gets the underlying PlayCanvas sound component.
|
|
3238
3369
|
* @returns The sound component.
|
|
3239
3370
|
*/
|
|
3240
3371
|
get component() {
|
|
@@ -3424,7 +3555,7 @@ class SoundSlotElement extends AsyncElement {
|
|
|
3424
3555
|
}
|
|
3425
3556
|
async connectedCallback() {
|
|
3426
3557
|
var _a;
|
|
3427
|
-
await ((_a = this.soundElement) === null || _a ===
|
|
3558
|
+
await ((_a = this.soundElement) === null || _a === undefined ? undefined : _a.ready());
|
|
3428
3559
|
const options = {
|
|
3429
3560
|
autoPlay: this._autoPlay,
|
|
3430
3561
|
loop: this._loop,
|
|
@@ -3453,21 +3584,21 @@ class SoundSlotElement extends AsyncElement {
|
|
|
3453
3584
|
return soundElement;
|
|
3454
3585
|
}
|
|
3455
3586
|
/**
|
|
3456
|
-
* Sets the
|
|
3587
|
+
* Sets the id of the `pc-asset` to use for the sound slot.
|
|
3457
3588
|
* @param value - The asset.
|
|
3458
3589
|
*/
|
|
3459
3590
|
set asset(value) {
|
|
3460
3591
|
var _a;
|
|
3461
3592
|
this._asset = value;
|
|
3462
3593
|
if (this.soundSlot) {
|
|
3463
|
-
const id = (_a = AssetElement.get(value)) === null || _a ===
|
|
3594
|
+
const id = (_a = AssetElement.get(value)) === null || _a === undefined ? undefined : _a.id;
|
|
3464
3595
|
if (id) {
|
|
3465
3596
|
this.soundSlot.asset = id;
|
|
3466
3597
|
}
|
|
3467
3598
|
}
|
|
3468
3599
|
}
|
|
3469
3600
|
/**
|
|
3470
|
-
* Gets the
|
|
3601
|
+
* Gets the id of the `pc-asset` to use for the sound slot.
|
|
3471
3602
|
* @returns The asset.
|
|
3472
3603
|
*/
|
|
3473
3604
|
get asset() {
|
|
@@ -3645,8 +3776,9 @@ customElements.define('pc-sound', SoundSlotElement);
|
|
|
3645
3776
|
|
|
3646
3777
|
/**
|
|
3647
3778
|
* The ModelElement interface provides properties and methods for manipulating
|
|
3648
|
-
* `<pc-model>` elements.
|
|
3649
|
-
*
|
|
3779
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-model/ | `<pc-model>`} elements.
|
|
3780
|
+
* The ModelElement interface also inherits the properties and methods of the
|
|
3781
|
+
* {@link HTMLElement} interface.
|
|
3650
3782
|
*/
|
|
3651
3783
|
class ModelElement extends AsyncElement {
|
|
3652
3784
|
constructor() {
|
|
@@ -3687,8 +3819,8 @@ class ModelElement extends AsyncElement {
|
|
|
3687
3819
|
async _loadModel() {
|
|
3688
3820
|
var _a;
|
|
3689
3821
|
this._unloadModel();
|
|
3690
|
-
const appElement = await ((_a = this.closestApp) === null || _a ===
|
|
3691
|
-
const app = appElement === null || appElement ===
|
|
3822
|
+
const appElement = await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
3823
|
+
const app = appElement === null || appElement === undefined ? undefined : appElement.app;
|
|
3692
3824
|
const asset = AssetElement.get(this._asset);
|
|
3693
3825
|
if (!asset) {
|
|
3694
3826
|
return;
|
|
@@ -3705,11 +3837,11 @@ class ModelElement extends AsyncElement {
|
|
|
3705
3837
|
}
|
|
3706
3838
|
_unloadModel() {
|
|
3707
3839
|
var _a;
|
|
3708
|
-
(_a = this._entity) === null || _a ===
|
|
3840
|
+
(_a = this._entity) === null || _a === undefined ? undefined : _a.destroy();
|
|
3709
3841
|
this._entity = null;
|
|
3710
3842
|
}
|
|
3711
3843
|
/**
|
|
3712
|
-
* Sets the asset
|
|
3844
|
+
* Sets the id of the `pc-asset` to use for the model.
|
|
3713
3845
|
* @param value - The asset ID.
|
|
3714
3846
|
*/
|
|
3715
3847
|
set asset(value) {
|
|
@@ -3719,8 +3851,8 @@ class ModelElement extends AsyncElement {
|
|
|
3719
3851
|
}
|
|
3720
3852
|
}
|
|
3721
3853
|
/**
|
|
3722
|
-
* Gets the
|
|
3723
|
-
* @returns The
|
|
3854
|
+
* Gets the id of the `pc-asset` to use for the model.
|
|
3855
|
+
* @returns The asset ID.
|
|
3724
3856
|
*/
|
|
3725
3857
|
get asset() {
|
|
3726
3858
|
return this._asset;
|
|
@@ -3740,8 +3872,9 @@ customElements.define('pc-model', ModelElement);
|
|
|
3740
3872
|
|
|
3741
3873
|
/**
|
|
3742
3874
|
* The SceneElement interface provides properties and methods for manipulating
|
|
3743
|
-
* `<pc-scene>` elements.
|
|
3744
|
-
*
|
|
3875
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
|
|
3876
|
+
* The SceneElement interface also inherits the properties and methods of the
|
|
3877
|
+
* {@link HTMLElement} interface.
|
|
3745
3878
|
*/
|
|
3746
3879
|
class SceneElement extends AsyncElement {
|
|
3747
3880
|
constructor() {
|
|
@@ -3773,7 +3906,7 @@ class SceneElement extends AsyncElement {
|
|
|
3773
3906
|
}
|
|
3774
3907
|
async connectedCallback() {
|
|
3775
3908
|
var _a;
|
|
3776
|
-
await ((_a = this.closestApp) === null || _a ===
|
|
3909
|
+
await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
3777
3910
|
this.scene = this.closestApp.app.scene;
|
|
3778
3911
|
this.updateSceneSettings();
|
|
3779
3912
|
this._onReady();
|
|
@@ -3947,8 +4080,8 @@ class SkyElement extends AsyncElement {
|
|
|
3947
4080
|
}
|
|
3948
4081
|
async _loadSkybox() {
|
|
3949
4082
|
var _a;
|
|
3950
|
-
const appElement = await ((_a = this.closestApp) === null || _a ===
|
|
3951
|
-
const app = appElement === null || appElement ===
|
|
4083
|
+
const appElement = await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
4084
|
+
const app = appElement === null || appElement === undefined ? undefined : appElement.app;
|
|
3952
4085
|
if (!app) {
|
|
3953
4086
|
return;
|
|
3954
4087
|
}
|
|
@@ -3971,74 +4104,134 @@ class SkyElement extends AsyncElement {
|
|
|
3971
4104
|
var _a, _b;
|
|
3972
4105
|
if (!this._scene)
|
|
3973
4106
|
return;
|
|
3974
|
-
(_a = this._scene.skybox) === null || _a ===
|
|
4107
|
+
(_a = this._scene.skybox) === null || _a === undefined ? undefined : _a.destroy();
|
|
3975
4108
|
// @ts-ignore
|
|
3976
4109
|
this._scene.skybox = null;
|
|
3977
|
-
(_b = this._scene.envAtlas) === null || _b ===
|
|
4110
|
+
(_b = this._scene.envAtlas) === null || _b === undefined ? undefined : _b.destroy();
|
|
3978
4111
|
// @ts-ignore
|
|
3979
4112
|
this._scene.envAtlas = null;
|
|
3980
4113
|
this._scene = null;
|
|
3981
4114
|
}
|
|
4115
|
+
/**
|
|
4116
|
+
* Sets the id of the `pc-asset` to use for the skybox.
|
|
4117
|
+
* @param value - The asset ID.
|
|
4118
|
+
*/
|
|
3982
4119
|
set asset(value) {
|
|
3983
4120
|
this._asset = value;
|
|
3984
4121
|
if (this.isConnected) {
|
|
3985
4122
|
this._loadSkybox();
|
|
3986
4123
|
}
|
|
3987
4124
|
}
|
|
4125
|
+
/**
|
|
4126
|
+
* Gets the id of the `pc-asset` to use for the skybox.
|
|
4127
|
+
* @returns The asset ID.
|
|
4128
|
+
*/
|
|
3988
4129
|
get asset() {
|
|
3989
4130
|
return this._asset;
|
|
3990
4131
|
}
|
|
4132
|
+
/**
|
|
4133
|
+
* Sets the center of the skybox.
|
|
4134
|
+
* @param value - The center.
|
|
4135
|
+
*/
|
|
3991
4136
|
set center(value) {
|
|
3992
4137
|
this._center = value;
|
|
3993
4138
|
if (this._scene) {
|
|
3994
4139
|
this._scene.sky.center = this._center;
|
|
3995
4140
|
}
|
|
3996
4141
|
}
|
|
4142
|
+
/**
|
|
4143
|
+
* Gets the center of the skybox.
|
|
4144
|
+
* @returns The center.
|
|
4145
|
+
*/
|
|
3997
4146
|
get center() {
|
|
3998
4147
|
return this._center;
|
|
3999
4148
|
}
|
|
4149
|
+
/**
|
|
4150
|
+
* Sets the intensity of the skybox.
|
|
4151
|
+
* @param value - The intensity.
|
|
4152
|
+
*/
|
|
4000
4153
|
set intensity(value) {
|
|
4001
4154
|
this._intensity = value;
|
|
4002
4155
|
if (this._scene) {
|
|
4003
4156
|
this._scene.skyboxIntensity = this._intensity;
|
|
4004
4157
|
}
|
|
4005
4158
|
}
|
|
4159
|
+
/**
|
|
4160
|
+
* Gets the intensity of the skybox.
|
|
4161
|
+
* @returns The intensity.
|
|
4162
|
+
*/
|
|
4006
4163
|
get intensity() {
|
|
4007
4164
|
return this._intensity;
|
|
4008
4165
|
}
|
|
4166
|
+
/**
|
|
4167
|
+
* Sets the mip level of the skybox.
|
|
4168
|
+
* @param value - The mip level.
|
|
4169
|
+
*/
|
|
4009
4170
|
set level(value) {
|
|
4010
4171
|
this._level = value;
|
|
4011
4172
|
if (this._scene) {
|
|
4012
4173
|
this._scene.skyboxMip = this._level;
|
|
4013
4174
|
}
|
|
4014
4175
|
}
|
|
4176
|
+
/**
|
|
4177
|
+
* Gets the mip level of the skybox.
|
|
4178
|
+
* @returns The mip level.
|
|
4179
|
+
*/
|
|
4015
4180
|
get level() {
|
|
4016
4181
|
return this._level;
|
|
4017
4182
|
}
|
|
4183
|
+
/**
|
|
4184
|
+
* Sets whether the skybox is used as a light source.
|
|
4185
|
+
* @param value - Whether to use lighting.
|
|
4186
|
+
*/
|
|
4018
4187
|
set lighting(value) {
|
|
4019
4188
|
this._lighting = value;
|
|
4020
4189
|
}
|
|
4190
|
+
/**
|
|
4191
|
+
* Gets whether the skybox is used as a light source.
|
|
4192
|
+
* @returns Whether to use lighting.
|
|
4193
|
+
*/
|
|
4021
4194
|
get lighting() {
|
|
4022
4195
|
return this._lighting;
|
|
4023
4196
|
}
|
|
4197
|
+
/**
|
|
4198
|
+
* Sets the Euler rotation of the skybox.
|
|
4199
|
+
* @param value - The rotation.
|
|
4200
|
+
*/
|
|
4024
4201
|
set rotation(value) {
|
|
4025
4202
|
this._rotation = value;
|
|
4026
4203
|
if (this._scene) {
|
|
4027
4204
|
this._scene.skyboxRotation = new playcanvas.Quat().setFromEulerAngles(value);
|
|
4028
4205
|
}
|
|
4029
4206
|
}
|
|
4207
|
+
/**
|
|
4208
|
+
* Gets the Euler rotation of the skybox.
|
|
4209
|
+
* @returns The rotation.
|
|
4210
|
+
*/
|
|
4030
4211
|
get rotation() {
|
|
4031
4212
|
return this._rotation;
|
|
4032
4213
|
}
|
|
4214
|
+
/**
|
|
4215
|
+
* Sets the scale of the skybox.
|
|
4216
|
+
* @param value - The scale.
|
|
4217
|
+
*/
|
|
4033
4218
|
set scale(value) {
|
|
4034
4219
|
this._scale = value;
|
|
4035
4220
|
if (this._scene) {
|
|
4036
4221
|
this._scene.sky.node.setLocalScale(this._scale);
|
|
4037
4222
|
}
|
|
4038
4223
|
}
|
|
4224
|
+
/**
|
|
4225
|
+
* Gets the scale of the skybox.
|
|
4226
|
+
* @returns The scale.
|
|
4227
|
+
*/
|
|
4039
4228
|
get scale() {
|
|
4040
4229
|
return this._scale;
|
|
4041
4230
|
}
|
|
4231
|
+
/**
|
|
4232
|
+
* Sets the type of the skybox.
|
|
4233
|
+
* @param value - The type.
|
|
4234
|
+
*/
|
|
4042
4235
|
set type(value) {
|
|
4043
4236
|
this._type = value;
|
|
4044
4237
|
if (this._scene) {
|
|
@@ -4049,6 +4242,10 @@ class SkyElement extends AsyncElement {
|
|
|
4049
4242
|
}
|
|
4050
4243
|
}
|
|
4051
4244
|
}
|
|
4245
|
+
/**
|
|
4246
|
+
* Gets the type of the skybox.
|
|
4247
|
+
* @returns The type.
|
|
4248
|
+
*/
|
|
4052
4249
|
get type() {
|
|
4053
4250
|
return this._type;
|
|
4054
4251
|
}
|
|
@@ -4094,7 +4291,6 @@ exports.CollisionComponentElement = CollisionComponentElement;
|
|
|
4094
4291
|
exports.ComponentElement = ComponentElement;
|
|
4095
4292
|
exports.ElementComponentElement = ElementComponentElement;
|
|
4096
4293
|
exports.EntityElement = EntityElement;
|
|
4097
|
-
exports.GSplatComponentElement = GSplatComponentElement;
|
|
4098
4294
|
exports.LightComponentElement = LightComponentElement;
|
|
4099
4295
|
exports.ListenerComponentElement = ListenerComponentElement;
|
|
4100
4296
|
exports.MaterialElement = MaterialElement;
|
|
@@ -4109,4 +4305,5 @@ exports.ScriptElement = ScriptElement;
|
|
|
4109
4305
|
exports.SkyElement = SkyElement;
|
|
4110
4306
|
exports.SoundComponentElement = SoundComponentElement;
|
|
4111
4307
|
exports.SoundSlotElement = SoundSlotElement;
|
|
4308
|
+
exports.SplatComponentElement = SplatComponentElement;
|
|
4112
4309
|
//# sourceMappingURL=pwc.cjs.map
|