@playcanvas/web-components 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/app.d.ts +10 -1
  2. package/dist/asset.d.ts +3 -1
  3. package/dist/async-element.d.ts +2 -1
  4. package/dist/components/camera-component.d.ts +4 -4
  5. package/dist/components/collision-component.d.ts +4 -4
  6. package/dist/components/component.d.ts +3 -1
  7. package/dist/components/element-component.d.ts +4 -1
  8. package/dist/components/gsplat-component.d.ts +4 -1
  9. package/dist/components/light-component.d.ts +16 -4
  10. package/dist/components/listener-component.d.ts +4 -1
  11. package/dist/components/render-component.d.ts +4 -1
  12. package/dist/components/rigidbody-component.d.ts +4 -4
  13. package/dist/components/screen-component.d.ts +4 -1
  14. package/dist/components/script-component.d.ts +4 -1
  15. package/dist/components/script.d.ts +3 -1
  16. package/dist/components/sound-component.d.ts +4 -1
  17. package/dist/components/sound-slot.d.ts +3 -1
  18. package/dist/entity.d.ts +7 -3
  19. package/dist/material.d.ts +3 -1
  20. package/dist/model.d.ts +3 -1
  21. package/dist/module.d.ts +6 -0
  22. package/dist/pwc.cjs +195 -75
  23. package/dist/pwc.cjs.map +1 -1
  24. package/dist/pwc.js +195 -75
  25. package/dist/pwc.js.map +1 -1
  26. package/dist/pwc.min.js +1 -1
  27. package/dist/pwc.min.js.map +1 -1
  28. package/dist/pwc.mjs +196 -76
  29. package/dist/pwc.mjs.map +1 -1
  30. package/dist/scene.d.ts +3 -1
  31. package/dist/sky.d.ts +4 -2
  32. package/package.json +15 -13
  33. package/src/app.ts +28 -1
  34. package/src/asset.ts +3 -1
  35. package/src/async-element.ts +2 -1
  36. package/src/components/camera-component.ts +4 -4
  37. package/src/components/collision-component.ts +4 -4
  38. package/src/components/component.ts +3 -1
  39. package/src/components/element-component.ts +4 -2
  40. package/src/components/gsplat-component.ts +4 -1
  41. package/src/components/light-component.ts +30 -4
  42. package/src/components/listener-component.ts +4 -1
  43. package/src/components/render-component.ts +4 -1
  44. package/src/components/rigidbody-component.ts +4 -4
  45. package/src/components/screen-component.ts +4 -1
  46. package/src/components/script-component.ts +15 -1
  47. package/src/components/script.ts +3 -1
  48. package/src/components/sound-component.ts +4 -1
  49. package/src/components/sound-slot.ts +3 -1
  50. package/src/entity.ts +59 -27
  51. package/src/material.ts +3 -1
  52. package/src/model.ts +3 -1
  53. package/src/module.ts +6 -0
  54. package/src/scene.ts +13 -11
  55. package/src/sky.ts +5 -2
package/dist/pwc.js CHANGED
@@ -5,9 +5,10 @@
5
5
  })(this, (function (exports, playcanvas) { 'use strict';
6
6
 
7
7
  /**
8
- * Base class for all PlayCanvas web components that initialize asynchronously.
8
+ * Base class for all PlayCanvas Web Components that initialize asynchronously.
9
9
  */
10
10
  class AsyncElement extends HTMLElement {
11
+ /** @ignore */
11
12
  constructor() {
12
13
  super();
13
14
  this._readyPromise = new Promise((resolve) => {
@@ -39,7 +40,13 @@
39
40
  }
40
41
  }
41
42
 
43
+ /**
44
+ * The ModuleElement interface provides properties and methods for manipulating
45
+ * `<pc-module>` elements. The ModuleElement interface also inherits the properties and
46
+ * methods of the {@link HTMLElement} interface.
47
+ */
42
48
  class ModuleElement extends HTMLElement {
49
+ /** @ignore */
43
50
  constructor() {
44
51
  super();
45
52
  this.loadPromise = this.loadModule();
@@ -78,7 +85,9 @@
78
85
  */
79
86
  class AppElement extends AsyncElement {
80
87
  /**
81
- * Creates a new AppElement.
88
+ * Creates a new AppElement instance.
89
+ *
90
+ * @ignore
82
91
  */
83
92
  constructor() {
84
93
  super();
@@ -91,6 +100,7 @@
91
100
  this._depth = true;
92
101
  this._stencil = true;
93
102
  this._highResolution = false;
103
+ this._hierarchyReady = false;
94
104
  /**
95
105
  * The PlayCanvas application instance.
96
106
  */
@@ -134,6 +144,16 @@
134
144
  Array.from(materialElements).forEach((materialElement) => {
135
145
  materialElement.createMaterial();
136
146
  });
147
+ // Create all entities
148
+ const entityElements = this.querySelectorAll('pc-entity');
149
+ Array.from(entityElements).forEach((entityElement) => {
150
+ entityElement.createEntity(this.app);
151
+ });
152
+ // Build hierarchy
153
+ entityElements.forEach((entityElement) => {
154
+ entityElement.buildHierarchy(this.app);
155
+ });
156
+ this._hierarchyReady = true;
137
157
  // Load assets before starting the application
138
158
  this.app.preload(() => {
139
159
  // Start the application
@@ -204,6 +224,14 @@
204
224
  get depth() {
205
225
  return this._depth;
206
226
  }
227
+ /**
228
+ * Gets the hierarchy ready flag.
229
+ * @returns The hierarchy ready flag.
230
+ * @ignore
231
+ */
232
+ get hierarchyReady() {
233
+ return this._hierarchyReady;
234
+ }
207
235
  /**
208
236
  * Sets the high resolution flag. When true, the application will render at the device's
209
237
  * physical resolution. When false, the application will render at CSS resolution.
@@ -475,7 +503,9 @@
475
503
  };
476
504
 
477
505
  /**
478
- * Represents an entity in the PlayCanvas engine.
506
+ * The EntityElement interface provides properties and methods for manipulating
507
+ * `<pc-entity>` elements. The EntityElement interface also inherits the properties and
508
+ * methods of the {@link HTMLElement} interface.
479
509
  */
480
510
  class EntityElement extends AsyncElement {
481
511
  constructor() {
@@ -509,41 +539,60 @@
509
539
  */
510
540
  this.entity = null;
511
541
  }
512
- async connectedCallback() {
513
- const closestApp = this.closestApp;
514
- if (!closestApp)
515
- return;
516
- // Wait for the app to complete initialization
517
- await closestApp.ready();
518
- const app = closestApp.app;
542
+ createEntity(app) {
519
543
  // Create a new entity
520
- this.entity = new playcanvas.Entity(this._name, app);
521
- // Initialize from attributes
522
- const nameAttr = this.getAttribute('name');
523
- const positionAttr = this.getAttribute('position');
524
- const rotationAttr = this.getAttribute('rotation');
525
- const scaleAttr = this.getAttribute('scale');
526
- const tagsAttr = this.getAttribute('tags');
527
- if (nameAttr)
528
- this.name = nameAttr;
529
- if (positionAttr)
530
- this.position = parseVec3(positionAttr);
531
- if (rotationAttr)
532
- this.rotation = parseVec3(rotationAttr);
533
- if (scaleAttr)
534
- this.scale = parseVec3(scaleAttr);
535
- if (tagsAttr)
536
- this.tags = tagsAttr.split(',').map(tag => tag.trim());
544
+ this.entity = new playcanvas.Entity(this.getAttribute('name') || this._name, app);
545
+ const enabled = this.getAttribute('enabled');
546
+ if (enabled) {
547
+ this.entity.enabled = enabled !== 'false';
548
+ }
549
+ const position = this.getAttribute('position');
550
+ if (position) {
551
+ this.entity.setLocalPosition(parseVec3(position));
552
+ }
553
+ const rotation = this.getAttribute('rotation');
554
+ if (rotation) {
555
+ this.entity.setLocalEulerAngles(parseVec3(rotation));
556
+ }
557
+ const scale = this.getAttribute('scale');
558
+ if (scale) {
559
+ this.entity.setLocalScale(parseVec3(scale));
560
+ }
561
+ const tags = this.getAttribute('tags');
562
+ if (tags) {
563
+ this.entity.tags.add(tags.split(',').map(tag => tag.trim()));
564
+ }
565
+ }
566
+ buildHierarchy(app) {
567
+ if (!this.entity)
568
+ return;
537
569
  const closestEntity = this.closestEntity;
538
- if (closestEntity) {
539
- closestEntity.ready().then(() => {
540
- closestEntity.entity.addChild(this.entity);
541
- this._onReady();
542
- });
570
+ if (closestEntity === null || closestEntity === void 0 ? void 0 : closestEntity.entity) {
571
+ closestEntity.entity.addChild(this.entity);
543
572
  }
544
573
  else {
545
574
  app.root.addChild(this.entity);
546
- this._onReady();
575
+ }
576
+ this._onReady();
577
+ }
578
+ connectedCallback() {
579
+ // Wait for app to be ready
580
+ const closestApp = this.closestApp;
581
+ if (!closestApp)
582
+ return;
583
+ // If app is already running, create entity immediately
584
+ if (closestApp.hierarchyReady) {
585
+ const app = closestApp.app;
586
+ this.createEntity(app);
587
+ this.buildHierarchy(app);
588
+ // Handle any child entities that might exist
589
+ const childEntities = this.querySelectorAll('pc-entity');
590
+ childEntities.forEach((child) => {
591
+ child.createEntity(app);
592
+ });
593
+ childEntities.forEach((child) => {
594
+ child.buildHierarchy(app);
595
+ });
547
596
  }
548
597
  }
549
598
  disconnectedCallback() {
@@ -553,6 +602,7 @@
553
602
  children.forEach((child) => {
554
603
  child.entity = null;
555
604
  });
605
+ // Destroy the entity
556
606
  this.entity.destroy();
557
607
  this.entity = null;
558
608
  }
@@ -708,7 +758,9 @@
708
758
  ['webp', 'texture']
709
759
  ]);
710
760
  /**
711
- * Loads an asset into the PlayCanvas engine.
761
+ * The AssetElement interface provides properties and methods for manipulating
762
+ * `<pc-asset>` elements. The AssetElement interface also inherits the properties and
763
+ * methods of the {@link HTMLElement} interface.
712
764
  */
713
765
  class AssetElement extends HTMLElement {
714
766
  constructor() {
@@ -784,8 +836,10 @@
784
836
  */
785
837
  class ComponentElement extends AsyncElement {
786
838
  /**
787
- * Constructor for the ComponentElement.
839
+ * Creates a new ComponentElement instance.
840
+ *
788
841
  * @param componentName - The name of the component.
842
+ * @ignore
789
843
  */
790
844
  constructor(componentName) {
791
845
  super();
@@ -854,11 +908,14 @@
854
908
  }
855
909
 
856
910
  /**
857
- * Represents a audio listener component in the PlayCanvas engine.
911
+ * The ListenerComponentElement interface provides properties and methods for manipulating
912
+ * `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
913
+ * and methods of the {@link HTMLElement} interface.
858
914
  *
859
915
  * @category Components
860
916
  */
861
917
  class ListenerComponentElement extends ComponentElement {
918
+ /** @ignore */
862
919
  constructor() {
863
920
  super('audiolistener');
864
921
  }
@@ -873,14 +930,14 @@
873
930
  customElements.define('pc-listener', ListenerComponentElement);
874
931
 
875
932
  /**
876
- * Represents a camera component in the PlayCanvas engine.
933
+ * The CameraComponentElement interface provides properties and methods for manipulating
934
+ * `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
935
+ * methods of the {@link HTMLElement} interface.
877
936
  *
878
937
  * @category Components
879
938
  */
880
939
  class CameraComponentElement extends ComponentElement {
881
- /**
882
- * Creates a new CameraComponentElement.
883
- */
940
+ /** @ignore */
884
941
  constructor() {
885
942
  super('camera');
886
943
  this._clearColor = new playcanvas.Color(0.75, 0.75, 0.75, 1);
@@ -1274,14 +1331,14 @@
1274
1331
  customElements.define('pc-camera', CameraComponentElement);
1275
1332
 
1276
1333
  /**
1277
- * Represents a collision component in the PlayCanvas engine.
1334
+ * The CollisionComponentElement interface provides properties and methods for manipulating
1335
+ * `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
1336
+ * and methods of the {@link HTMLElement} interface.
1278
1337
  *
1279
1338
  * @category Components
1280
1339
  */
1281
1340
  class CollisionComponentElement extends ComponentElement {
1282
- /**
1283
- * Creates a new CollisionComponentElement.
1284
- */
1341
+ /** @ignore */
1285
1342
  constructor() {
1286
1343
  super('collision');
1287
1344
  this._angularOffset = new playcanvas.Quat();
@@ -1420,11 +1477,14 @@
1420
1477
  customElements.define('pc-collision', CollisionComponentElement);
1421
1478
 
1422
1479
  /**
1423
- * Represents an element component in the PlayCanvas engine.
1480
+ * The ElementComponentElement interface provides properties and methods for manipulating
1481
+ * `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
1482
+ * methods of the {@link HTMLElement} interface.
1424
1483
  *
1425
1484
  * @category Components
1426
1485
  */
1427
1486
  class ElementComponentElement extends ComponentElement {
1487
+ /** @ignore */
1428
1488
  constructor() {
1429
1489
  super('element');
1430
1490
  this._anchor = new playcanvas.Vec4(0.5, 0.5, 0.5, 0.5);
@@ -1630,11 +1690,14 @@
1630
1690
  customElements.define('pc-element', ElementComponentElement);
1631
1691
 
1632
1692
  /**
1633
- * Represents a gsplat component in the PlayCanvas engine.
1693
+ * The GSplatComponentElement interface provides properties and methods for manipulating
1694
+ * `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
1695
+ * methods of the {@link HTMLElement} interface.
1634
1696
  *
1635
1697
  * @category Components
1636
1698
  */
1637
1699
  class GSplatComponentElement extends ComponentElement {
1700
+ /** @ignore */
1638
1701
  constructor() {
1639
1702
  super('gsplat');
1640
1703
  this._asset = '';
@@ -1676,14 +1739,14 @@
1676
1739
  customElements.define('pc-splat', GSplatComponentElement);
1677
1740
 
1678
1741
  /**
1679
- * Represents a light component in the PlayCanvas engine.
1742
+ * The LightComponentElement interface provides properties and methods for manipulating
1743
+ * `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
1744
+ * methods of the {@link HTMLElement} interface.
1680
1745
  *
1681
1746
  * @category Components
1682
1747
  */
1683
1748
  class LightComponentElement extends ComponentElement {
1684
- /**
1685
- * Creates a new LightComponentElement.
1686
- */
1749
+ /** @ignore */
1687
1750
  constructor() {
1688
1751
  super('light');
1689
1752
  this._castShadows = false;
@@ -1695,6 +1758,7 @@
1695
1758
  this._range = 10;
1696
1759
  this._shadowBias = 0.2;
1697
1760
  this._shadowDistance = 16;
1761
+ this._shadowResolution = 1024;
1698
1762
  this._type = 'directional';
1699
1763
  }
1700
1764
  getInitialComponentData() {
@@ -1708,6 +1772,7 @@
1708
1772
  range: this._range,
1709
1773
  shadowBias: this._shadowBias,
1710
1774
  shadowDistance: this._shadowDistance,
1775
+ shadowResolution: this._shadowResolution,
1711
1776
  type: this._type
1712
1777
  };
1713
1778
  }
@@ -1871,6 +1936,23 @@
1871
1936
  get shadowDistance() {
1872
1937
  return this._shadowDistance;
1873
1938
  }
1939
+ /**
1940
+ * Sets the shadow resolution of the light.
1941
+ * @param value - The shadow resolution.
1942
+ */
1943
+ set shadowResolution(value) {
1944
+ this._shadowResolution = value;
1945
+ if (this.component) {
1946
+ this.component.shadowResolution = value;
1947
+ }
1948
+ }
1949
+ /**
1950
+ * Gets the shadow resolution of the light.
1951
+ * @returns The shadow resolution.
1952
+ */
1953
+ get shadowResolution() {
1954
+ return this._shadowResolution;
1955
+ }
1874
1956
  /**
1875
1957
  * Sets the type of the light.
1876
1958
  * @param value - The type.
@@ -1904,6 +1986,7 @@
1904
1986
  'range',
1905
1987
  'shadow-bias',
1906
1988
  'shadow-distance',
1989
+ 'shadow-resolution',
1907
1990
  'type'
1908
1991
  ];
1909
1992
  }
@@ -1937,6 +2020,9 @@
1937
2020
  case 'shadow-distance':
1938
2021
  this.shadowDistance = Number(newValue);
1939
2022
  break;
2023
+ case 'shadow-resolution':
2024
+ this.shadowResolution = Number(newValue);
2025
+ break;
1940
2026
  case 'type':
1941
2027
  this.type = newValue;
1942
2028
  break;
@@ -1946,7 +2032,9 @@
1946
2032
  customElements.define('pc-light', LightComponentElement);
1947
2033
 
1948
2034
  /**
1949
- * Represents a material in the PlayCanvas engine.
2035
+ * The MaterialElement interface provides properties and methods for manipulating
2036
+ * `<pc-material>` elements. The MaterialElement interface also inherits the properties and
2037
+ * methods of the {@link HTMLElement} interface.
1950
2038
  */
1951
2039
  class MaterialElement extends HTMLElement {
1952
2040
  constructor() {
@@ -2060,11 +2148,14 @@
2060
2148
  customElements.define('pc-material', MaterialElement);
2061
2149
 
2062
2150
  /**
2063
- * Represents a render component in the PlayCanvas engine.
2151
+ * The RenderComponentElement interface provides properties and methods for manipulating
2152
+ * `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
2153
+ * methods of the {@link HTMLElement} interface.
2064
2154
  *
2065
2155
  * @category Components
2066
2156
  */
2067
2157
  class RenderComponentElement extends ComponentElement {
2158
+ /** @ignore */
2068
2159
  constructor() {
2069
2160
  super('render');
2070
2161
  this._castShadows = true;
@@ -2179,14 +2270,14 @@
2179
2270
  customElements.define('pc-render', RenderComponentElement);
2180
2271
 
2181
2272
  /**
2182
- * Represents a rigidbody component in the PlayCanvas engine.
2273
+ * The RigidBodyComponentElement interface provides properties and methods for manipulating
2274
+ * `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
2275
+ * and methods of the {@link HTMLElement} interface.
2183
2276
  *
2184
2277
  * @category Components
2185
2278
  */
2186
2279
  class RigidBodyComponentElement extends ComponentElement {
2187
- /**
2188
- * Creates a new RigidBodyComponentElement.
2189
- */
2280
+ /** @ignore */
2190
2281
  constructor() {
2191
2282
  super('rigidbody');
2192
2283
  /**
@@ -2366,11 +2457,14 @@
2366
2457
  customElements.define('pc-rigidbody', RigidBodyComponentElement);
2367
2458
 
2368
2459
  /**
2369
- * Represents a screen component in the PlayCanvas engine.
2460
+ * The ScreenComponentElement interface provides properties and methods for manipulating
2461
+ * `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
2462
+ * methods of the {@link HTMLElement} interface.
2370
2463
  *
2371
2464
  * @category Components
2372
2465
  */
2373
2466
  class ScreenComponentElement extends ComponentElement {
2467
+ /** @ignore */
2374
2468
  constructor() {
2375
2469
  super('screen');
2376
2470
  this._screenSpace = false;
@@ -2492,11 +2586,14 @@
2492
2586
  const tmpV3 = new playcanvas.Vec3();
2493
2587
  const tmpV4 = new playcanvas.Vec4();
2494
2588
  /**
2495
- * Represents a script component in the PlayCanvas engine.
2589
+ * The ScriptComponentElement interface provides properties and methods for manipulating
2590
+ * `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
2591
+ * methods of the {@link HTMLElement} interface.
2496
2592
  *
2497
2593
  * @category Components
2498
2594
  */
2499
2595
  class ScriptComponentElement extends ComponentElement {
2596
+ /** @ignore */
2500
2597
  constructor() {
2501
2598
  super('script');
2502
2599
  // Create mutation observer to watch for child script elements
@@ -2522,6 +2619,15 @@
2522
2619
  try {
2523
2620
  const attributesObject = attributes ? JSON.parse(attributes) : {};
2524
2621
  const applyValue = (target, key, value) => {
2622
+ // Handle asset references
2623
+ if (typeof value === 'string' && value.startsWith('asset:')) {
2624
+ const assetId = value.slice(6);
2625
+ const assetElement = document.querySelector(`pc-asset#${assetId}`);
2626
+ if (assetElement) {
2627
+ target[key] = assetElement.asset;
2628
+ return;
2629
+ }
2630
+ }
2525
2631
  // Handle vectors
2526
2632
  if (Array.isArray(value)) {
2527
2633
  if (target[key] instanceof playcanvas.Vec2) {
@@ -2630,7 +2736,9 @@
2630
2736
  customElements.define('pc-scripts', ScriptComponentElement);
2631
2737
 
2632
2738
  /**
2633
- * Represents a script in the PlayCanvas engine.
2739
+ * The ScriptElement interface provides properties and methods for manipulating
2740
+ * `<pc-script>` elements. The ScriptElement interface also inherits the properties and
2741
+ * methods of the {@link HTMLElement} interface.
2634
2742
  */
2635
2743
  class ScriptElement extends HTMLElement {
2636
2744
  constructor() {
@@ -2709,11 +2817,14 @@
2709
2817
  customElements.define('pc-script', ScriptElement);
2710
2818
 
2711
2819
  /**
2712
- * Represents a sound component in the PlayCanvas engine.
2820
+ * The SoundComponentElement interface provides properties and methods for manipulating
2821
+ * `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
2822
+ * methods of the {@link HTMLElement} interface.
2713
2823
  *
2714
2824
  * @category Components
2715
2825
  */
2716
2826
  class SoundComponentElement extends ComponentElement {
2827
+ /** @ignore */
2717
2828
  constructor() {
2718
2829
  super('sound');
2719
2830
  this._distanceModel = 'linear';
@@ -2903,7 +3014,9 @@
2903
3014
  customElements.define('pc-sounds', SoundComponentElement);
2904
3015
 
2905
3016
  /**
2906
- * Represents a sound slot in the PlayCanvas engine.
3017
+ * The SoundSlotElement interface provides properties and methods for manipulating
3018
+ * `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
3019
+ * methods of the {@link AsyncElement} interface.
2907
3020
  */
2908
3021
  class SoundSlotElement extends AsyncElement {
2909
3022
  constructor() {
@@ -3144,7 +3257,9 @@
3144
3257
  customElements.define('pc-sound', SoundSlotElement);
3145
3258
 
3146
3259
  /**
3147
- * Represents a model in the PlayCanvas engine.
3260
+ * The ModelElement interface provides properties and methods for manipulating
3261
+ * `<pc-model>` elements. The ModelElement interface also inherits the properties and
3262
+ * methods of the {@link HTMLElement} interface.
3148
3263
  */
3149
3264
  class ModelElement extends AsyncElement {
3150
3265
  constructor() {
@@ -3237,7 +3352,9 @@
3237
3352
  customElements.define('pc-model', ModelElement);
3238
3353
 
3239
3354
  /**
3240
- * Represents a scene in the PlayCanvas engine.
3355
+ * The SceneElement interface provides properties and methods for manipulating
3356
+ * `<pc-scene>` elements. The SceneElement interface also inherits the properties and
3357
+ * methods of the {@link HTMLElement} interface.
3241
3358
  */
3242
3359
  class SceneElement extends AsyncElement {
3243
3360
  constructor() {
@@ -3276,11 +3393,11 @@
3276
3393
  }
3277
3394
  updateSceneSettings() {
3278
3395
  if (this.scene) {
3279
- this.scene.rendering.fog = this._fog;
3280
- this.scene.rendering.fogColor = this._fogColor;
3281
- this.scene.rendering.fogDensity = this._fogDensity;
3282
- this.scene.rendering.fogStart = this._fogStart;
3283
- this.scene.rendering.fogEnd = this._fogEnd;
3396
+ this.scene.fog.type = this._fog;
3397
+ this.scene.fog.color = this._fogColor;
3398
+ this.scene.fog.density = this._fogDensity;
3399
+ this.scene.fog.start = this._fogStart;
3400
+ this.scene.fog.end = this._fogEnd;
3284
3401
  // ... set other properties on the scene as well
3285
3402
  }
3286
3403
  }
@@ -3291,7 +3408,7 @@
3291
3408
  set fog(value) {
3292
3409
  this._fog = value;
3293
3410
  if (this.scene) {
3294
- this.scene.rendering.fog = value;
3411
+ this.scene.fog.type = value;
3295
3412
  }
3296
3413
  }
3297
3414
  /**
@@ -3308,7 +3425,7 @@
3308
3425
  set fogColor(value) {
3309
3426
  this._fogColor = value;
3310
3427
  if (this.scene) {
3311
- this.scene.rendering.fogColor = value;
3428
+ this.scene.fog.color = value;
3312
3429
  }
3313
3430
  }
3314
3431
  /**
@@ -3325,7 +3442,7 @@
3325
3442
  set fogDensity(value) {
3326
3443
  this._fogDensity = value;
3327
3444
  if (this.scene) {
3328
- this.scene.rendering.fogDensity = value;
3445
+ this.scene.fog.density = value;
3329
3446
  }
3330
3447
  }
3331
3448
  /**
@@ -3342,7 +3459,7 @@
3342
3459
  set fogStart(value) {
3343
3460
  this._fogStart = value;
3344
3461
  if (this.scene) {
3345
- this.scene.rendering.fogStart = value;
3462
+ this.scene.fog.start = value;
3346
3463
  }
3347
3464
  }
3348
3465
  /**
@@ -3359,7 +3476,7 @@
3359
3476
  set fogEnd(value) {
3360
3477
  this._fogEnd = value;
3361
3478
  if (this.scene) {
3362
- this.scene.rendering.fogEnd = value;
3479
+ this.scene.fog.end = value;
3363
3480
  }
3364
3481
  }
3365
3482
  /**
@@ -3396,7 +3513,9 @@
3396
3513
  customElements.define('pc-scene', SceneElement);
3397
3514
 
3398
3515
  /**
3399
- * Represents a sky in the PlayCanvas engine.
3516
+ * The SkyElement interface provides properties and methods for manipulating
3517
+ * `<pc-sky>` elements. The SkyElement interface also inherits the properties and
3518
+ * methods of the {@link HTMLElement} interface.
3400
3519
  */
3401
3520
  class SkyElement extends AsyncElement {
3402
3521
  constructor() {
@@ -3422,8 +3541,8 @@
3422
3541
  if (!this._scene)
3423
3542
  return;
3424
3543
  const source = asset.resource;
3425
- source.anisotropy = 4;
3426
3544
  const skybox = playcanvas.EnvLighting.generateSkyboxCubemap(source);
3545
+ skybox.anisotropy = 4;
3427
3546
  this._scene.skybox = skybox;
3428
3547
  if (this._lighting) {
3429
3548
  const lighting = playcanvas.EnvLighting.generateLightingSource(source);
@@ -3437,6 +3556,7 @@
3437
3556
  this._scene.sky.type = this._type;
3438
3557
  this._scene.sky.node.setLocalScale(this._scale);
3439
3558
  this._scene.sky.center = this._center;
3559
+ this._scene.skyboxIntensity = this._intensity;
3440
3560
  }
3441
3561
  async _loadSkybox() {
3442
3562
  var _a;