@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.mjs
CHANGED
|
@@ -13,11 +13,11 @@ class AsyncElement extends HTMLElement {
|
|
|
13
13
|
}
|
|
14
14
|
get closestApp() {
|
|
15
15
|
var _a;
|
|
16
|
-
return (_a = this.parentElement) === null || _a ===
|
|
16
|
+
return (_a = this.parentElement) === null || _a === undefined ? undefined : _a.closest('pc-app');
|
|
17
17
|
}
|
|
18
18
|
get closestEntity() {
|
|
19
19
|
var _a;
|
|
20
|
-
return (_a = this.parentElement) === null || _a ===
|
|
20
|
+
return (_a = this.parentElement) === null || _a === undefined ? undefined : _a.closest('pc-entity');
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Called when the element is fully initialized and ready.
|
|
@@ -38,8 +38,9 @@ class AsyncElement extends HTMLElement {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* The ModuleElement interface provides properties and methods for manipulating
|
|
41
|
-
* `<pc-module>` elements.
|
|
42
|
-
*
|
|
41
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-module/ | `<pc-module>`} elements.
|
|
42
|
+
* The ModuleElement interface also inherits the properties and methods of the
|
|
43
|
+
* {@link HTMLElement} interface.
|
|
43
44
|
*/
|
|
44
45
|
class ModuleElement extends HTMLElement {
|
|
45
46
|
/** @ignore */
|
|
@@ -77,7 +78,10 @@ class ModuleElement extends HTMLElement {
|
|
|
77
78
|
customElements.define('pc-module', ModuleElement);
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
|
-
* The
|
|
81
|
+
* The AppElement interface provides properties and methods for manipulating
|
|
82
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-app/ | `<pc-app>`} elements.
|
|
83
|
+
* The AppElement interface also inherits the properties and methods of the
|
|
84
|
+
* {@link HTMLElement} interface.
|
|
81
85
|
*/
|
|
82
86
|
class AppElement extends AsyncElement {
|
|
83
87
|
/**
|
|
@@ -236,13 +240,14 @@ class AppElement extends AsyncElement {
|
|
|
236
240
|
// Get the currently hovered entity by walking up the hierarchy
|
|
237
241
|
let newHoverEntity = null;
|
|
238
242
|
if (selection.length > 0) {
|
|
239
|
-
let
|
|
240
|
-
while (
|
|
241
|
-
const entityElement = this.querySelector(`pc-entity[name="${
|
|
243
|
+
let currentNode = selection[0].node;
|
|
244
|
+
while (currentNode !== null) {
|
|
245
|
+
const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`);
|
|
242
246
|
if (entityElement) {
|
|
243
247
|
newHoverEntity = entityElement;
|
|
248
|
+
break;
|
|
244
249
|
}
|
|
245
|
-
|
|
250
|
+
currentNode = currentNode.parent;
|
|
246
251
|
}
|
|
247
252
|
}
|
|
248
253
|
// Handle enter/leave events
|
|
@@ -273,14 +278,14 @@ class AppElement extends AsyncElement {
|
|
|
273
278
|
this._picker.prepare(camera, this.app.scene);
|
|
274
279
|
const selection = this._picker.getSelection(x, y);
|
|
275
280
|
if (selection.length > 0) {
|
|
276
|
-
let
|
|
277
|
-
while (
|
|
278
|
-
const entityElement = this.querySelector(`pc-entity[name="${
|
|
281
|
+
let currentNode = selection[0].node;
|
|
282
|
+
while (currentNode !== null) {
|
|
283
|
+
const entityElement = this.querySelector(`pc-entity[name="${currentNode.name}"]`);
|
|
279
284
|
if (entityElement && entityElement.hasListeners('pointerdown')) {
|
|
280
285
|
entityElement.dispatchEvent(new PointerEvent('pointerdown', event));
|
|
281
286
|
break;
|
|
282
287
|
}
|
|
283
|
-
|
|
288
|
+
currentNode = currentNode.parent;
|
|
284
289
|
}
|
|
285
290
|
}
|
|
286
291
|
}
|
|
@@ -649,8 +654,9 @@ const parseVec4 = (value) => {
|
|
|
649
654
|
|
|
650
655
|
/**
|
|
651
656
|
* The EntityElement interface provides properties and methods for manipulating
|
|
652
|
-
* `<pc-entity>` elements.
|
|
653
|
-
*
|
|
657
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
|
|
658
|
+
* The EntityElement interface also inherits the properties and methods of the
|
|
659
|
+
* {@link HTMLElement} interface.
|
|
654
660
|
*/
|
|
655
661
|
class EntityElement extends AsyncElement {
|
|
656
662
|
constructor() {
|
|
@@ -740,7 +746,7 @@ class EntityElement extends AsyncElement {
|
|
|
740
746
|
if (!this.entity)
|
|
741
747
|
return;
|
|
742
748
|
const closestEntity = this.closestEntity;
|
|
743
|
-
if (closestEntity === null || closestEntity ===
|
|
749
|
+
if (closestEntity === null || closestEntity === undefined ? undefined : closestEntity.entity) {
|
|
744
750
|
closestEntity.entity.addChild(this.entity);
|
|
745
751
|
}
|
|
746
752
|
else {
|
|
@@ -962,7 +968,7 @@ class EntityElement extends AsyncElement {
|
|
|
962
968
|
}
|
|
963
969
|
hasListeners(type) {
|
|
964
970
|
var _a;
|
|
965
|
-
return Boolean((_a = this._listeners[type]) === null || _a ===
|
|
971
|
+
return Boolean((_a = this._listeners[type]) === null || _a === undefined ? undefined : _a.length);
|
|
966
972
|
}
|
|
967
973
|
}
|
|
968
974
|
customElements.define('pc-entity', EntityElement);
|
|
@@ -988,8 +994,9 @@ const extToType = new Map([
|
|
|
988
994
|
]);
|
|
989
995
|
/**
|
|
990
996
|
* The AssetElement interface provides properties and methods for manipulating
|
|
991
|
-
* `<pc-asset>` elements.
|
|
992
|
-
*
|
|
997
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
|
|
998
|
+
* The AssetElement interface also inherits the properties and methods of the
|
|
999
|
+
* {@link HTMLElement} interface.
|
|
993
1000
|
*/
|
|
994
1001
|
class AssetElement extends HTMLElement {
|
|
995
1002
|
constructor() {
|
|
@@ -1011,7 +1018,7 @@ class AssetElement extends HTMLElement {
|
|
|
1011
1018
|
// If no type is specified, try to infer it from the file extension.
|
|
1012
1019
|
if (!type) {
|
|
1013
1020
|
const ext = src.split('.').pop();
|
|
1014
|
-
type = (_a = extToType.get(ext || '')) !== null && _a !==
|
|
1021
|
+
type = (_a = extToType.get(ext || '')) !== null && _a !== undefined ? _a : null;
|
|
1015
1022
|
}
|
|
1016
1023
|
if (!type) {
|
|
1017
1024
|
console.warn(`Unsupported asset type: ${src}`);
|
|
@@ -1045,7 +1052,7 @@ class AssetElement extends HTMLElement {
|
|
|
1045
1052
|
}
|
|
1046
1053
|
static get(id) {
|
|
1047
1054
|
const assetElement = document.querySelector(`pc-asset[id="${id}"]`);
|
|
1048
|
-
return assetElement === null || assetElement ===
|
|
1055
|
+
return assetElement === null || assetElement === undefined ? undefined : assetElement.asset;
|
|
1049
1056
|
}
|
|
1050
1057
|
static get observedAttributes() {
|
|
1051
1058
|
return ['preload'];
|
|
@@ -1092,7 +1099,7 @@ class ComponentElement extends AsyncElement {
|
|
|
1092
1099
|
initComponent() { }
|
|
1093
1100
|
async connectedCallback() {
|
|
1094
1101
|
var _a;
|
|
1095
|
-
await ((_a = this.closestApp) === null || _a ===
|
|
1102
|
+
await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
1096
1103
|
await this.addComponent();
|
|
1097
1104
|
this.initComponent();
|
|
1098
1105
|
this._onReady();
|
|
@@ -1138,8 +1145,9 @@ class ComponentElement extends AsyncElement {
|
|
|
1138
1145
|
|
|
1139
1146
|
/**
|
|
1140
1147
|
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
1141
|
-
* `<pc-listener>` elements.
|
|
1142
|
-
* and methods of the
|
|
1148
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
|
|
1149
|
+
* The ListenerComponentElement interface also inherits the properties and methods of the
|
|
1150
|
+
* {@link HTMLElement} interface.
|
|
1143
1151
|
*
|
|
1144
1152
|
* @category Components
|
|
1145
1153
|
*/
|
|
@@ -1149,7 +1157,7 @@ class ListenerComponentElement extends ComponentElement {
|
|
|
1149
1157
|
super('audiolistener');
|
|
1150
1158
|
}
|
|
1151
1159
|
/**
|
|
1152
|
-
* Gets the audio listener component.
|
|
1160
|
+
* Gets the underlying PlayCanvas audio listener component.
|
|
1153
1161
|
* @returns The audio listener component.
|
|
1154
1162
|
*/
|
|
1155
1163
|
get component() {
|
|
@@ -1169,8 +1177,9 @@ const tonemaps = new Map([
|
|
|
1169
1177
|
]);
|
|
1170
1178
|
/**
|
|
1171
1179
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
1172
|
-
* `<pc-camera>` elements.
|
|
1173
|
-
*
|
|
1180
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
1181
|
+
* The CameraComponentElement interface also inherits the properties and methods of the
|
|
1182
|
+
* {@link HTMLElement} interface.
|
|
1174
1183
|
*
|
|
1175
1184
|
* @category Components
|
|
1176
1185
|
*/
|
|
@@ -1188,6 +1197,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1188
1197
|
this._fov = 45;
|
|
1189
1198
|
this._frustumCulling = true;
|
|
1190
1199
|
this._gamma = 'srgb';
|
|
1200
|
+
this._horizontalFov = false;
|
|
1191
1201
|
this._nearClip = 0.1;
|
|
1192
1202
|
this._orthographic = false;
|
|
1193
1203
|
this._orthoHeight = 10;
|
|
@@ -1208,6 +1218,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1208
1218
|
fov: this._fov,
|
|
1209
1219
|
frustumCulling: this._frustumCulling,
|
|
1210
1220
|
gammaCorrection: this._gamma === 'srgb' ? GAMMA_SRGB : GAMMA_NONE,
|
|
1221
|
+
horizontalFov: this._horizontalFov,
|
|
1211
1222
|
nearClip: this._nearClip,
|
|
1212
1223
|
orthographic: this._orthographic,
|
|
1213
1224
|
orthoHeight: this._orthoHeight,
|
|
@@ -1219,7 +1230,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1219
1230
|
}
|
|
1220
1231
|
get xrAvailable() {
|
|
1221
1232
|
var _a;
|
|
1222
|
-
const xrManager = (_a = this.component) === null || _a ===
|
|
1233
|
+
const xrManager = (_a = this.component) === null || _a === undefined ? undefined : _a.system.app.xr;
|
|
1223
1234
|
return xrManager && xrManager.supported && xrManager.isAvailable(XRTYPE_VR);
|
|
1224
1235
|
}
|
|
1225
1236
|
startXr(type, space) {
|
|
@@ -1238,7 +1249,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1238
1249
|
}
|
|
1239
1250
|
}
|
|
1240
1251
|
/**
|
|
1241
|
-
* Gets the camera component.
|
|
1252
|
+
* Gets the underlying PlayCanvas camera component.
|
|
1242
1253
|
* @returns The camera component.
|
|
1243
1254
|
*/
|
|
1244
1255
|
get component() {
|
|
@@ -1414,6 +1425,24 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1414
1425
|
get gamma() {
|
|
1415
1426
|
return this._gamma;
|
|
1416
1427
|
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Sets whether the camera's field of view (fov) is horizontal or vertical. Defaults to false
|
|
1430
|
+
* (meaning it is vertical be default).
|
|
1431
|
+
* @param value - Whether the camera's field of view is horizontal.
|
|
1432
|
+
*/
|
|
1433
|
+
set horizontalFov(value) {
|
|
1434
|
+
this._horizontalFov = value;
|
|
1435
|
+
if (this.component) {
|
|
1436
|
+
this.component.horizontalFov = value;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Gets whether the camera's field of view (fov) is horizontal or vertical.
|
|
1441
|
+
* @returns Whether the camera's field of view is horizontal.
|
|
1442
|
+
*/
|
|
1443
|
+
get horizontalFov() {
|
|
1444
|
+
return this._horizontalFov;
|
|
1445
|
+
}
|
|
1417
1446
|
/**
|
|
1418
1447
|
* Sets the near clip distance of the camera.
|
|
1419
1448
|
* @param value - The near clip distance.
|
|
@@ -1524,7 +1553,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1524
1553
|
var _a;
|
|
1525
1554
|
this._tonemap = value;
|
|
1526
1555
|
if (this.component) {
|
|
1527
|
-
this.component.toneMapping = (_a = tonemaps.get(value)) !== null && _a !==
|
|
1556
|
+
this.component.toneMapping = (_a = tonemaps.get(value)) !== null && _a !== undefined ? _a : TONEMAP_NONE;
|
|
1528
1557
|
}
|
|
1529
1558
|
}
|
|
1530
1559
|
/**
|
|
@@ -1547,6 +1576,7 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1547
1576
|
'fov',
|
|
1548
1577
|
'frustum-culling',
|
|
1549
1578
|
'gamma',
|
|
1579
|
+
'horizontal-fov',
|
|
1550
1580
|
'near-clip',
|
|
1551
1581
|
'orthographic',
|
|
1552
1582
|
'ortho-height',
|
|
@@ -1589,6 +1619,9 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1589
1619
|
case 'gamma':
|
|
1590
1620
|
this.gamma = newValue;
|
|
1591
1621
|
break;
|
|
1622
|
+
case 'horizontal-fov':
|
|
1623
|
+
this.horizontalFov = this.hasAttribute('horizontal-fov');
|
|
1624
|
+
break;
|
|
1592
1625
|
case 'near-clip':
|
|
1593
1626
|
this.nearClip = parseFloat(newValue);
|
|
1594
1627
|
break;
|
|
@@ -1617,8 +1650,9 @@ customElements.define('pc-camera', CameraComponentElement);
|
|
|
1617
1650
|
|
|
1618
1651
|
/**
|
|
1619
1652
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
1620
|
-
* `<pc-collision>` elements.
|
|
1621
|
-
* and methods of the
|
|
1653
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
1654
|
+
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
1655
|
+
* {@link HTMLElement} interface.
|
|
1622
1656
|
*
|
|
1623
1657
|
* @category Components
|
|
1624
1658
|
*/
|
|
@@ -1648,7 +1682,7 @@ class CollisionComponentElement extends ComponentElement {
|
|
|
1648
1682
|
};
|
|
1649
1683
|
}
|
|
1650
1684
|
/**
|
|
1651
|
-
* Gets the collision component.
|
|
1685
|
+
* Gets the underlying PlayCanvas collision component.
|
|
1652
1686
|
* @returns The collision component.
|
|
1653
1687
|
*/
|
|
1654
1688
|
get component() {
|
|
@@ -1763,8 +1797,9 @@ customElements.define('pc-collision', CollisionComponentElement);
|
|
|
1763
1797
|
|
|
1764
1798
|
/**
|
|
1765
1799
|
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
1766
|
-
* `<pc-element>` elements.
|
|
1767
|
-
*
|
|
1800
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-element/ | `<pc-element>`} elements.
|
|
1801
|
+
* The ElementComponentElement interface also inherits the properties and methods of the
|
|
1802
|
+
* {@link HTMLElement} interface.
|
|
1768
1803
|
*
|
|
1769
1804
|
* @category Components
|
|
1770
1805
|
*/
|
|
@@ -1803,21 +1838,33 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1803
1838
|
};
|
|
1804
1839
|
}
|
|
1805
1840
|
/**
|
|
1806
|
-
* Gets the element component.
|
|
1841
|
+
* Gets the underlying PlayCanvas element component.
|
|
1807
1842
|
* @returns The element component.
|
|
1808
1843
|
*/
|
|
1809
1844
|
get component() {
|
|
1810
1845
|
return super.component;
|
|
1811
1846
|
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Sets the anchor of the element component.
|
|
1849
|
+
* @param value - The anchor.
|
|
1850
|
+
*/
|
|
1812
1851
|
set anchor(value) {
|
|
1813
1852
|
this._anchor = value;
|
|
1814
1853
|
if (this.component) {
|
|
1815
1854
|
this.component.anchor = value;
|
|
1816
1855
|
}
|
|
1817
1856
|
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Gets the anchor of the element component.
|
|
1859
|
+
* @returns The anchor.
|
|
1860
|
+
*/
|
|
1818
1861
|
get anchor() {
|
|
1819
1862
|
return this._anchor;
|
|
1820
1863
|
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Sets the id of the `pc-asset` to use for the font.
|
|
1866
|
+
* @param value - The asset ID.
|
|
1867
|
+
*/
|
|
1821
1868
|
set asset(value) {
|
|
1822
1869
|
this._asset = value;
|
|
1823
1870
|
const asset = AssetElement.get(value);
|
|
@@ -1825,60 +1872,112 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1825
1872
|
this.component.fontAsset = asset.id;
|
|
1826
1873
|
}
|
|
1827
1874
|
}
|
|
1875
|
+
/**
|
|
1876
|
+
* Gets the id of the `pc-asset` to use for the font.
|
|
1877
|
+
* @returns The asset ID.
|
|
1878
|
+
*/
|
|
1828
1879
|
get asset() {
|
|
1829
1880
|
return this._asset;
|
|
1830
1881
|
}
|
|
1882
|
+
/**
|
|
1883
|
+
* Sets whether the element component should automatically adjust its width.
|
|
1884
|
+
* @param value - Whether to automatically adjust the width.
|
|
1885
|
+
*/
|
|
1831
1886
|
set autoWidth(value) {
|
|
1832
1887
|
this._autoWidth = value;
|
|
1833
1888
|
if (this.component) {
|
|
1834
1889
|
this.component.autoWidth = value;
|
|
1835
1890
|
}
|
|
1836
1891
|
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Gets whether the element component should automatically adjust its width.
|
|
1894
|
+
* @returns Whether to automatically adjust the width.
|
|
1895
|
+
*/
|
|
1837
1896
|
get autoWidth() {
|
|
1838
1897
|
return this._autoWidth;
|
|
1839
1898
|
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Sets the color of the element component.
|
|
1901
|
+
* @param value - The color.
|
|
1902
|
+
*/
|
|
1840
1903
|
set color(value) {
|
|
1841
1904
|
this._color = value;
|
|
1842
1905
|
if (this.component) {
|
|
1843
1906
|
this.component.color = value;
|
|
1844
1907
|
}
|
|
1845
1908
|
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Gets the color of the element component.
|
|
1911
|
+
* @returns The color.
|
|
1912
|
+
*/
|
|
1846
1913
|
get color() {
|
|
1847
1914
|
return this._color;
|
|
1848
1915
|
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Sets the font size of the element component.
|
|
1918
|
+
* @param value - The font size.
|
|
1919
|
+
*/
|
|
1849
1920
|
set fontSize(value) {
|
|
1850
1921
|
this._fontSize = value;
|
|
1851
1922
|
if (this.component) {
|
|
1852
1923
|
this.component.fontSize = value;
|
|
1853
1924
|
}
|
|
1854
1925
|
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Gets the font size of the element component.
|
|
1928
|
+
* @returns The font size.
|
|
1929
|
+
*/
|
|
1855
1930
|
get fontSize() {
|
|
1856
1931
|
return this._fontSize;
|
|
1857
1932
|
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Sets the line height of the element component.
|
|
1935
|
+
* @param value - The line height.
|
|
1936
|
+
*/
|
|
1858
1937
|
set lineHeight(value) {
|
|
1859
1938
|
this._lineHeight = value;
|
|
1860
1939
|
if (this.component) {
|
|
1861
1940
|
this.component.lineHeight = value;
|
|
1862
1941
|
}
|
|
1863
1942
|
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Gets the line height of the element component.
|
|
1945
|
+
* @returns The line height.
|
|
1946
|
+
*/
|
|
1864
1947
|
get lineHeight() {
|
|
1865
1948
|
return this._lineHeight;
|
|
1866
1949
|
}
|
|
1950
|
+
/**
|
|
1951
|
+
* Sets the pivot of the element component.
|
|
1952
|
+
* @param value - The pivot.
|
|
1953
|
+
*/
|
|
1867
1954
|
set pivot(value) {
|
|
1868
1955
|
this._pivot = value;
|
|
1869
1956
|
if (this.component) {
|
|
1870
1957
|
this.component.pivot = value;
|
|
1871
1958
|
}
|
|
1872
1959
|
}
|
|
1960
|
+
/**
|
|
1961
|
+
* Gets the pivot of the element component.
|
|
1962
|
+
* @returns The pivot.
|
|
1963
|
+
*/
|
|
1873
1964
|
get pivot() {
|
|
1874
1965
|
return this._pivot;
|
|
1875
1966
|
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Sets the text of the element component.
|
|
1969
|
+
* @param value - The text.
|
|
1970
|
+
*/
|
|
1876
1971
|
set text(value) {
|
|
1877
1972
|
this._text = value;
|
|
1878
1973
|
if (this.component) {
|
|
1879
1974
|
this.component.text = value;
|
|
1880
1975
|
}
|
|
1881
1976
|
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Gets the text of the element component.
|
|
1979
|
+
* @returns The text.
|
|
1980
|
+
*/
|
|
1882
1981
|
get text() {
|
|
1883
1982
|
return this._text;
|
|
1884
1983
|
}
|
|
@@ -1899,21 +1998,37 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1899
1998
|
get type() {
|
|
1900
1999
|
return this._type;
|
|
1901
2000
|
}
|
|
2001
|
+
/**
|
|
2002
|
+
* Sets the width of the element component.
|
|
2003
|
+
* @param value - The width.
|
|
2004
|
+
*/
|
|
1902
2005
|
set width(value) {
|
|
1903
2006
|
this._width = value;
|
|
1904
2007
|
if (this.component) {
|
|
1905
2008
|
this.component.width = value;
|
|
1906
2009
|
}
|
|
1907
2010
|
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Gets the width of the element component.
|
|
2013
|
+
* @returns The width.
|
|
2014
|
+
*/
|
|
1908
2015
|
get width() {
|
|
1909
2016
|
return this._width;
|
|
1910
2017
|
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Sets whether the element component should wrap lines.
|
|
2020
|
+
* @param value - Whether to wrap lines.
|
|
2021
|
+
*/
|
|
1911
2022
|
set wrapLines(value) {
|
|
1912
2023
|
this._wrapLines = value;
|
|
1913
2024
|
if (this.component) {
|
|
1914
2025
|
this.component.wrapLines = value;
|
|
1915
2026
|
}
|
|
1916
2027
|
}
|
|
2028
|
+
/**
|
|
2029
|
+
* Gets whether the element component should wrap lines.
|
|
2030
|
+
* @returns Whether to wrap lines.
|
|
2031
|
+
*/
|
|
1917
2032
|
get wrapLines() {
|
|
1918
2033
|
return this._wrapLines;
|
|
1919
2034
|
}
|
|
@@ -1975,13 +2090,14 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1975
2090
|
customElements.define('pc-element', ElementComponentElement);
|
|
1976
2091
|
|
|
1977
2092
|
/**
|
|
1978
|
-
* The
|
|
1979
|
-
* `<pc-splat>` elements.
|
|
1980
|
-
*
|
|
2093
|
+
* The SplatComponentElement interface provides properties and methods for manipulating
|
|
2094
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
|
|
2095
|
+
* The SplatComponentElement interface also inherits the properties and methods of the
|
|
2096
|
+
* {@link HTMLElement} interface.
|
|
1981
2097
|
*
|
|
1982
2098
|
* @category Components
|
|
1983
2099
|
*/
|
|
1984
|
-
class
|
|
2100
|
+
class SplatComponentElement extends ComponentElement {
|
|
1985
2101
|
/** @ignore */
|
|
1986
2102
|
constructor() {
|
|
1987
2103
|
super('gsplat');
|
|
@@ -1993,12 +2109,16 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
1993
2109
|
};
|
|
1994
2110
|
}
|
|
1995
2111
|
/**
|
|
1996
|
-
* Gets the
|
|
1997
|
-
* @returns The
|
|
2112
|
+
* Gets the underlying PlayCanvas splat component.
|
|
2113
|
+
* @returns The splat component.
|
|
1998
2114
|
*/
|
|
1999
2115
|
get component() {
|
|
2000
2116
|
return super.component;
|
|
2001
2117
|
}
|
|
2118
|
+
/**
|
|
2119
|
+
* Sets id of the `pc-asset` to use for the splat.
|
|
2120
|
+
* @param value - The asset ID.
|
|
2121
|
+
*/
|
|
2002
2122
|
set asset(value) {
|
|
2003
2123
|
this._asset = value;
|
|
2004
2124
|
const asset = AssetElement.get(value);
|
|
@@ -2006,6 +2126,10 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
2006
2126
|
this.component.asset = asset;
|
|
2007
2127
|
}
|
|
2008
2128
|
}
|
|
2129
|
+
/**
|
|
2130
|
+
* Gets the id of the `pc-asset` to use for the splat.
|
|
2131
|
+
* @returns The asset ID.
|
|
2132
|
+
*/
|
|
2009
2133
|
get asset() {
|
|
2010
2134
|
return this._asset;
|
|
2011
2135
|
}
|
|
@@ -2021,7 +2145,7 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
2021
2145
|
}
|
|
2022
2146
|
}
|
|
2023
2147
|
}
|
|
2024
|
-
customElements.define('pc-splat',
|
|
2148
|
+
customElements.define('pc-splat', SplatComponentElement);
|
|
2025
2149
|
|
|
2026
2150
|
const shadowTypes = new Map([
|
|
2027
2151
|
['pcf1-16f', SHADOW_PCF1_16F],
|
|
@@ -2036,8 +2160,9 @@ const shadowTypes = new Map([
|
|
|
2036
2160
|
]);
|
|
2037
2161
|
/**
|
|
2038
2162
|
* The LightComponentElement interface provides properties and methods for manipulating
|
|
2039
|
-
* `<pc-light>` elements.
|
|
2040
|
-
*
|
|
2163
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-light/ | `<pc-light>`} elements.
|
|
2164
|
+
* The LightComponentElement interface also inherits the properties and methods of the
|
|
2165
|
+
* {@link HTMLElement} interface.
|
|
2041
2166
|
*
|
|
2042
2167
|
* @category Components
|
|
2043
2168
|
*/
|
|
@@ -2079,7 +2204,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
2079
2204
|
};
|
|
2080
2205
|
}
|
|
2081
2206
|
/**
|
|
2082
|
-
* Gets the light component.
|
|
2207
|
+
* Gets the underlying PlayCanvas light component.
|
|
2083
2208
|
* @returns The light component.
|
|
2084
2209
|
*/
|
|
2085
2210
|
get component() {
|
|
@@ -2290,7 +2415,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
2290
2415
|
var _a;
|
|
2291
2416
|
this._shadowType = value;
|
|
2292
2417
|
if (this.component) {
|
|
2293
|
-
this.component.shadowType = (_a = shadowTypes.get(value)) !== null && _a !==
|
|
2418
|
+
this.component.shadowType = (_a = shadowTypes.get(value)) !== null && _a !== undefined ? _a : SHADOW_PCF3_32F;
|
|
2294
2419
|
}
|
|
2295
2420
|
}
|
|
2296
2421
|
/**
|
|
@@ -2409,8 +2534,9 @@ customElements.define('pc-light', LightComponentElement);
|
|
|
2409
2534
|
|
|
2410
2535
|
/**
|
|
2411
2536
|
* The MaterialElement interface provides properties and methods for manipulating
|
|
2412
|
-
* `<pc-material>` elements.
|
|
2413
|
-
*
|
|
2537
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-material/ | `<pc-material>`} elements.
|
|
2538
|
+
* The MaterialElement interface also inherits the properties and methods of the
|
|
2539
|
+
* {@link HTMLElement} interface.
|
|
2414
2540
|
*/
|
|
2415
2541
|
class MaterialElement extends HTMLElement {
|
|
2416
2542
|
constructor() {
|
|
@@ -2496,7 +2622,7 @@ class MaterialElement extends HTMLElement {
|
|
|
2496
2622
|
}
|
|
2497
2623
|
static get(id) {
|
|
2498
2624
|
const materialElement = document.querySelector(`pc-material[id="${id}"]`);
|
|
2499
|
-
return materialElement === null || materialElement ===
|
|
2625
|
+
return materialElement === null || materialElement === undefined ? undefined : materialElement.material;
|
|
2500
2626
|
}
|
|
2501
2627
|
static get observedAttributes() {
|
|
2502
2628
|
return ['diffuse', 'diffuse-map', 'metalness-map', 'normal-map', 'roughness-map'];
|
|
@@ -2525,8 +2651,9 @@ customElements.define('pc-material', MaterialElement);
|
|
|
2525
2651
|
|
|
2526
2652
|
/**
|
|
2527
2653
|
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
2528
|
-
* `<pc-render>` elements.
|
|
2529
|
-
*
|
|
2654
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-render/ | `<pc-render>`} elements.
|
|
2655
|
+
* The RenderComponentElement interface also inherits the properties and methods of the
|
|
2656
|
+
* {@link HTMLElement} interface.
|
|
2530
2657
|
*
|
|
2531
2658
|
* @category Components
|
|
2532
2659
|
*/
|
|
@@ -2548,7 +2675,7 @@ class RenderComponentElement extends ComponentElement {
|
|
|
2548
2675
|
};
|
|
2549
2676
|
}
|
|
2550
2677
|
/**
|
|
2551
|
-
* Gets the render component.
|
|
2678
|
+
* Gets the underlying PlayCanvas render component.
|
|
2552
2679
|
* @returns The render component.
|
|
2553
2680
|
*/
|
|
2554
2681
|
get component() {
|
|
@@ -2647,8 +2774,9 @@ customElements.define('pc-render', RenderComponentElement);
|
|
|
2647
2774
|
|
|
2648
2775
|
/**
|
|
2649
2776
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
2650
|
-
* `<pc-rigidbody>` elements.
|
|
2651
|
-
* and methods of the
|
|
2777
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
|
|
2778
|
+
* The RigidBodyComponentElement interface also inherits the properties and methods of the
|
|
2779
|
+
* {@link HTMLElement} interface.
|
|
2652
2780
|
*
|
|
2653
2781
|
* @category Components
|
|
2654
2782
|
*/
|
|
@@ -2707,8 +2835,8 @@ class RigidBodyComponentElement extends ComponentElement {
|
|
|
2707
2835
|
};
|
|
2708
2836
|
}
|
|
2709
2837
|
/**
|
|
2710
|
-
* Gets the
|
|
2711
|
-
* @returns The
|
|
2838
|
+
* Gets the underlying PlayCanvas rigidbody component.
|
|
2839
|
+
* @returns The rigidbody component.
|
|
2712
2840
|
*/
|
|
2713
2841
|
get component() {
|
|
2714
2842
|
return super.component;
|
|
@@ -2834,8 +2962,9 @@ customElements.define('pc-rigidbody', RigidBodyComponentElement);
|
|
|
2834
2962
|
|
|
2835
2963
|
/**
|
|
2836
2964
|
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
2837
|
-
* `<pc-screen>` elements.
|
|
2838
|
-
*
|
|
2965
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
|
|
2966
|
+
* The ScreenComponentElement interface also inherits the properties and methods of the
|
|
2967
|
+
* {@link HTMLElement} interface.
|
|
2839
2968
|
*
|
|
2840
2969
|
* @category Components
|
|
2841
2970
|
*/
|
|
@@ -2861,7 +2990,7 @@ class ScreenComponentElement extends ComponentElement {
|
|
|
2861
2990
|
};
|
|
2862
2991
|
}
|
|
2863
2992
|
/**
|
|
2864
|
-
* Gets the screen component.
|
|
2993
|
+
* Gets the underlying PlayCanvas screen component.
|
|
2865
2994
|
* @returns The screen component.
|
|
2866
2995
|
*/
|
|
2867
2996
|
get component() {
|
|
@@ -2960,8 +3089,9 @@ customElements.define('pc-screen', ScreenComponentElement);
|
|
|
2960
3089
|
|
|
2961
3090
|
/**
|
|
2962
3091
|
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
2963
|
-
* `<pc-scripts>` elements.
|
|
2964
|
-
*
|
|
3092
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
|
|
3093
|
+
* The ScriptComponentElement interface also inherits the properties and methods of the
|
|
3094
|
+
* {@link HTMLElement} interface.
|
|
2965
3095
|
*
|
|
2966
3096
|
* @category Components
|
|
2967
3097
|
*/
|
|
@@ -3108,10 +3238,10 @@ class ScriptComponentElement extends ComponentElement {
|
|
|
3108
3238
|
disconnectedCallback() {
|
|
3109
3239
|
var _a;
|
|
3110
3240
|
this.observer.disconnect();
|
|
3111
|
-
(_a = super.disconnectedCallback) === null || _a ===
|
|
3241
|
+
(_a = super.disconnectedCallback) === null || _a === undefined ? undefined : _a.call(this);
|
|
3112
3242
|
}
|
|
3113
3243
|
/**
|
|
3114
|
-
* Gets the script component.
|
|
3244
|
+
* Gets the underlying PlayCanvas script component.
|
|
3115
3245
|
* @returns The script component.
|
|
3116
3246
|
*/
|
|
3117
3247
|
get component() {
|
|
@@ -3203,8 +3333,9 @@ customElements.define('pc-script', ScriptElement);
|
|
|
3203
3333
|
|
|
3204
3334
|
/**
|
|
3205
3335
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
3206
|
-
* `<pc-sounds>` elements.
|
|
3207
|
-
*
|
|
3336
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
|
|
3337
|
+
* The SoundComponentElement interface also inherits the properties and methods of the
|
|
3338
|
+
* {@link HTMLElement} interface.
|
|
3208
3339
|
*
|
|
3209
3340
|
* @category Components
|
|
3210
3341
|
*/
|
|
@@ -3232,7 +3363,7 @@ class SoundComponentElement extends ComponentElement {
|
|
|
3232
3363
|
};
|
|
3233
3364
|
}
|
|
3234
3365
|
/**
|
|
3235
|
-
* Gets the sound component.
|
|
3366
|
+
* Gets the underlying PlayCanvas sound component.
|
|
3236
3367
|
* @returns The sound component.
|
|
3237
3368
|
*/
|
|
3238
3369
|
get component() {
|
|
@@ -3422,7 +3553,7 @@ class SoundSlotElement extends AsyncElement {
|
|
|
3422
3553
|
}
|
|
3423
3554
|
async connectedCallback() {
|
|
3424
3555
|
var _a;
|
|
3425
|
-
await ((_a = this.soundElement) === null || _a ===
|
|
3556
|
+
await ((_a = this.soundElement) === null || _a === undefined ? undefined : _a.ready());
|
|
3426
3557
|
const options = {
|
|
3427
3558
|
autoPlay: this._autoPlay,
|
|
3428
3559
|
loop: this._loop,
|
|
@@ -3451,21 +3582,21 @@ class SoundSlotElement extends AsyncElement {
|
|
|
3451
3582
|
return soundElement;
|
|
3452
3583
|
}
|
|
3453
3584
|
/**
|
|
3454
|
-
* Sets the
|
|
3585
|
+
* Sets the id of the `pc-asset` to use for the sound slot.
|
|
3455
3586
|
* @param value - The asset.
|
|
3456
3587
|
*/
|
|
3457
3588
|
set asset(value) {
|
|
3458
3589
|
var _a;
|
|
3459
3590
|
this._asset = value;
|
|
3460
3591
|
if (this.soundSlot) {
|
|
3461
|
-
const id = (_a = AssetElement.get(value)) === null || _a ===
|
|
3592
|
+
const id = (_a = AssetElement.get(value)) === null || _a === undefined ? undefined : _a.id;
|
|
3462
3593
|
if (id) {
|
|
3463
3594
|
this.soundSlot.asset = id;
|
|
3464
3595
|
}
|
|
3465
3596
|
}
|
|
3466
3597
|
}
|
|
3467
3598
|
/**
|
|
3468
|
-
* Gets the
|
|
3599
|
+
* Gets the id of the `pc-asset` to use for the sound slot.
|
|
3469
3600
|
* @returns The asset.
|
|
3470
3601
|
*/
|
|
3471
3602
|
get asset() {
|
|
@@ -3643,8 +3774,9 @@ customElements.define('pc-sound', SoundSlotElement);
|
|
|
3643
3774
|
|
|
3644
3775
|
/**
|
|
3645
3776
|
* The ModelElement interface provides properties and methods for manipulating
|
|
3646
|
-
* `<pc-model>` elements.
|
|
3647
|
-
*
|
|
3777
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-model/ | `<pc-model>`} elements.
|
|
3778
|
+
* The ModelElement interface also inherits the properties and methods of the
|
|
3779
|
+
* {@link HTMLElement} interface.
|
|
3648
3780
|
*/
|
|
3649
3781
|
class ModelElement extends AsyncElement {
|
|
3650
3782
|
constructor() {
|
|
@@ -3685,8 +3817,8 @@ class ModelElement extends AsyncElement {
|
|
|
3685
3817
|
async _loadModel() {
|
|
3686
3818
|
var _a;
|
|
3687
3819
|
this._unloadModel();
|
|
3688
|
-
const appElement = await ((_a = this.closestApp) === null || _a ===
|
|
3689
|
-
const app = appElement === null || appElement ===
|
|
3820
|
+
const appElement = await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
3821
|
+
const app = appElement === null || appElement === undefined ? undefined : appElement.app;
|
|
3690
3822
|
const asset = AssetElement.get(this._asset);
|
|
3691
3823
|
if (!asset) {
|
|
3692
3824
|
return;
|
|
@@ -3703,11 +3835,11 @@ class ModelElement extends AsyncElement {
|
|
|
3703
3835
|
}
|
|
3704
3836
|
_unloadModel() {
|
|
3705
3837
|
var _a;
|
|
3706
|
-
(_a = this._entity) === null || _a ===
|
|
3838
|
+
(_a = this._entity) === null || _a === undefined ? undefined : _a.destroy();
|
|
3707
3839
|
this._entity = null;
|
|
3708
3840
|
}
|
|
3709
3841
|
/**
|
|
3710
|
-
* Sets the asset
|
|
3842
|
+
* Sets the id of the `pc-asset` to use for the model.
|
|
3711
3843
|
* @param value - The asset ID.
|
|
3712
3844
|
*/
|
|
3713
3845
|
set asset(value) {
|
|
@@ -3717,8 +3849,8 @@ class ModelElement extends AsyncElement {
|
|
|
3717
3849
|
}
|
|
3718
3850
|
}
|
|
3719
3851
|
/**
|
|
3720
|
-
* Gets the
|
|
3721
|
-
* @returns The
|
|
3852
|
+
* Gets the id of the `pc-asset` to use for the model.
|
|
3853
|
+
* @returns The asset ID.
|
|
3722
3854
|
*/
|
|
3723
3855
|
get asset() {
|
|
3724
3856
|
return this._asset;
|
|
@@ -3738,8 +3870,9 @@ customElements.define('pc-model', ModelElement);
|
|
|
3738
3870
|
|
|
3739
3871
|
/**
|
|
3740
3872
|
* The SceneElement interface provides properties and methods for manipulating
|
|
3741
|
-
* `<pc-scene>` elements.
|
|
3742
|
-
*
|
|
3873
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
|
|
3874
|
+
* The SceneElement interface also inherits the properties and methods of the
|
|
3875
|
+
* {@link HTMLElement} interface.
|
|
3743
3876
|
*/
|
|
3744
3877
|
class SceneElement extends AsyncElement {
|
|
3745
3878
|
constructor() {
|
|
@@ -3771,7 +3904,7 @@ class SceneElement extends AsyncElement {
|
|
|
3771
3904
|
}
|
|
3772
3905
|
async connectedCallback() {
|
|
3773
3906
|
var _a;
|
|
3774
|
-
await ((_a = this.closestApp) === null || _a ===
|
|
3907
|
+
await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
3775
3908
|
this.scene = this.closestApp.app.scene;
|
|
3776
3909
|
this.updateSceneSettings();
|
|
3777
3910
|
this._onReady();
|
|
@@ -3945,8 +4078,8 @@ class SkyElement extends AsyncElement {
|
|
|
3945
4078
|
}
|
|
3946
4079
|
async _loadSkybox() {
|
|
3947
4080
|
var _a;
|
|
3948
|
-
const appElement = await ((_a = this.closestApp) === null || _a ===
|
|
3949
|
-
const app = appElement === null || appElement ===
|
|
4081
|
+
const appElement = await ((_a = this.closestApp) === null || _a === undefined ? undefined : _a.ready());
|
|
4082
|
+
const app = appElement === null || appElement === undefined ? undefined : appElement.app;
|
|
3950
4083
|
if (!app) {
|
|
3951
4084
|
return;
|
|
3952
4085
|
}
|
|
@@ -3969,74 +4102,134 @@ class SkyElement extends AsyncElement {
|
|
|
3969
4102
|
var _a, _b;
|
|
3970
4103
|
if (!this._scene)
|
|
3971
4104
|
return;
|
|
3972
|
-
(_a = this._scene.skybox) === null || _a ===
|
|
4105
|
+
(_a = this._scene.skybox) === null || _a === undefined ? undefined : _a.destroy();
|
|
3973
4106
|
// @ts-ignore
|
|
3974
4107
|
this._scene.skybox = null;
|
|
3975
|
-
(_b = this._scene.envAtlas) === null || _b ===
|
|
4108
|
+
(_b = this._scene.envAtlas) === null || _b === undefined ? undefined : _b.destroy();
|
|
3976
4109
|
// @ts-ignore
|
|
3977
4110
|
this._scene.envAtlas = null;
|
|
3978
4111
|
this._scene = null;
|
|
3979
4112
|
}
|
|
4113
|
+
/**
|
|
4114
|
+
* Sets the id of the `pc-asset` to use for the skybox.
|
|
4115
|
+
* @param value - The asset ID.
|
|
4116
|
+
*/
|
|
3980
4117
|
set asset(value) {
|
|
3981
4118
|
this._asset = value;
|
|
3982
4119
|
if (this.isConnected) {
|
|
3983
4120
|
this._loadSkybox();
|
|
3984
4121
|
}
|
|
3985
4122
|
}
|
|
4123
|
+
/**
|
|
4124
|
+
* Gets the id of the `pc-asset` to use for the skybox.
|
|
4125
|
+
* @returns The asset ID.
|
|
4126
|
+
*/
|
|
3986
4127
|
get asset() {
|
|
3987
4128
|
return this._asset;
|
|
3988
4129
|
}
|
|
4130
|
+
/**
|
|
4131
|
+
* Sets the center of the skybox.
|
|
4132
|
+
* @param value - The center.
|
|
4133
|
+
*/
|
|
3989
4134
|
set center(value) {
|
|
3990
4135
|
this._center = value;
|
|
3991
4136
|
if (this._scene) {
|
|
3992
4137
|
this._scene.sky.center = this._center;
|
|
3993
4138
|
}
|
|
3994
4139
|
}
|
|
4140
|
+
/**
|
|
4141
|
+
* Gets the center of the skybox.
|
|
4142
|
+
* @returns The center.
|
|
4143
|
+
*/
|
|
3995
4144
|
get center() {
|
|
3996
4145
|
return this._center;
|
|
3997
4146
|
}
|
|
4147
|
+
/**
|
|
4148
|
+
* Sets the intensity of the skybox.
|
|
4149
|
+
* @param value - The intensity.
|
|
4150
|
+
*/
|
|
3998
4151
|
set intensity(value) {
|
|
3999
4152
|
this._intensity = value;
|
|
4000
4153
|
if (this._scene) {
|
|
4001
4154
|
this._scene.skyboxIntensity = this._intensity;
|
|
4002
4155
|
}
|
|
4003
4156
|
}
|
|
4157
|
+
/**
|
|
4158
|
+
* Gets the intensity of the skybox.
|
|
4159
|
+
* @returns The intensity.
|
|
4160
|
+
*/
|
|
4004
4161
|
get intensity() {
|
|
4005
4162
|
return this._intensity;
|
|
4006
4163
|
}
|
|
4164
|
+
/**
|
|
4165
|
+
* Sets the mip level of the skybox.
|
|
4166
|
+
* @param value - The mip level.
|
|
4167
|
+
*/
|
|
4007
4168
|
set level(value) {
|
|
4008
4169
|
this._level = value;
|
|
4009
4170
|
if (this._scene) {
|
|
4010
4171
|
this._scene.skyboxMip = this._level;
|
|
4011
4172
|
}
|
|
4012
4173
|
}
|
|
4174
|
+
/**
|
|
4175
|
+
* Gets the mip level of the skybox.
|
|
4176
|
+
* @returns The mip level.
|
|
4177
|
+
*/
|
|
4013
4178
|
get level() {
|
|
4014
4179
|
return this._level;
|
|
4015
4180
|
}
|
|
4181
|
+
/**
|
|
4182
|
+
* Sets whether the skybox is used as a light source.
|
|
4183
|
+
* @param value - Whether to use lighting.
|
|
4184
|
+
*/
|
|
4016
4185
|
set lighting(value) {
|
|
4017
4186
|
this._lighting = value;
|
|
4018
4187
|
}
|
|
4188
|
+
/**
|
|
4189
|
+
* Gets whether the skybox is used as a light source.
|
|
4190
|
+
* @returns Whether to use lighting.
|
|
4191
|
+
*/
|
|
4019
4192
|
get lighting() {
|
|
4020
4193
|
return this._lighting;
|
|
4021
4194
|
}
|
|
4195
|
+
/**
|
|
4196
|
+
* Sets the Euler rotation of the skybox.
|
|
4197
|
+
* @param value - The rotation.
|
|
4198
|
+
*/
|
|
4022
4199
|
set rotation(value) {
|
|
4023
4200
|
this._rotation = value;
|
|
4024
4201
|
if (this._scene) {
|
|
4025
4202
|
this._scene.skyboxRotation = new Quat().setFromEulerAngles(value);
|
|
4026
4203
|
}
|
|
4027
4204
|
}
|
|
4205
|
+
/**
|
|
4206
|
+
* Gets the Euler rotation of the skybox.
|
|
4207
|
+
* @returns The rotation.
|
|
4208
|
+
*/
|
|
4028
4209
|
get rotation() {
|
|
4029
4210
|
return this._rotation;
|
|
4030
4211
|
}
|
|
4212
|
+
/**
|
|
4213
|
+
* Sets the scale of the skybox.
|
|
4214
|
+
* @param value - The scale.
|
|
4215
|
+
*/
|
|
4031
4216
|
set scale(value) {
|
|
4032
4217
|
this._scale = value;
|
|
4033
4218
|
if (this._scene) {
|
|
4034
4219
|
this._scene.sky.node.setLocalScale(this._scale);
|
|
4035
4220
|
}
|
|
4036
4221
|
}
|
|
4222
|
+
/**
|
|
4223
|
+
* Gets the scale of the skybox.
|
|
4224
|
+
* @returns The scale.
|
|
4225
|
+
*/
|
|
4037
4226
|
get scale() {
|
|
4038
4227
|
return this._scale;
|
|
4039
4228
|
}
|
|
4229
|
+
/**
|
|
4230
|
+
* Sets the type of the skybox.
|
|
4231
|
+
* @param value - The type.
|
|
4232
|
+
*/
|
|
4040
4233
|
set type(value) {
|
|
4041
4234
|
this._type = value;
|
|
4042
4235
|
if (this._scene) {
|
|
@@ -4047,6 +4240,10 @@ class SkyElement extends AsyncElement {
|
|
|
4047
4240
|
}
|
|
4048
4241
|
}
|
|
4049
4242
|
}
|
|
4243
|
+
/**
|
|
4244
|
+
* Gets the type of the skybox.
|
|
4245
|
+
* @returns The type.
|
|
4246
|
+
*/
|
|
4050
4247
|
get type() {
|
|
4051
4248
|
return this._type;
|
|
4052
4249
|
}
|
|
@@ -4084,5 +4281,5 @@ class SkyElement extends AsyncElement {
|
|
|
4084
4281
|
}
|
|
4085
4282
|
customElements.define('pc-sky', SkyElement);
|
|
4086
4283
|
|
|
4087
|
-
export { AppElement, AssetElement, AsyncElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, EntityElement,
|
|
4284
|
+
export { AppElement, AssetElement, AsyncElement, CameraComponentElement, CollisionComponentElement, ComponentElement, ElementComponentElement, EntityElement, LightComponentElement, ListenerComponentElement, MaterialElement, ModelElement, ModuleElement, RenderComponentElement, RigidBodyComponentElement, SceneElement, ScreenComponentElement, ScriptComponentElement, ScriptElement, SkyElement, SoundComponentElement, SoundSlotElement, SplatComponentElement };
|
|
4088
4285
|
//# sourceMappingURL=pwc.mjs.map
|