@playcanvas/web-components 0.1.8 → 0.1.10

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 (58) hide show
  1. package/README.md +2 -2
  2. package/dist/app.d.ts +21 -1
  3. package/dist/asset.d.ts +3 -1
  4. package/dist/async-element.d.ts +2 -1
  5. package/dist/components/camera-component.d.ts +28 -4
  6. package/dist/components/collision-component.d.ts +4 -4
  7. package/dist/components/component.d.ts +3 -1
  8. package/dist/components/element-component.d.ts +4 -1
  9. package/dist/components/gsplat-component.d.ts +4 -1
  10. package/dist/components/light-component.d.ts +50 -4
  11. package/dist/components/listener-component.d.ts +4 -1
  12. package/dist/components/render-component.d.ts +4 -1
  13. package/dist/components/rigidbody-component.d.ts +4 -4
  14. package/dist/components/screen-component.d.ts +4 -1
  15. package/dist/components/script-component.d.ts +4 -1
  16. package/dist/components/script.d.ts +3 -1
  17. package/dist/components/sound-component.d.ts +5 -2
  18. package/dist/components/sound-slot.d.ts +3 -1
  19. package/dist/entity.d.ts +14 -3
  20. package/dist/fog.d.ts +28 -0
  21. package/dist/material.d.ts +3 -1
  22. package/dist/model.d.ts +3 -1
  23. package/dist/module.d.ts +6 -0
  24. package/dist/pwc.cjs +569 -96
  25. package/dist/pwc.cjs.map +1 -1
  26. package/dist/pwc.js +569 -96
  27. package/dist/pwc.js.map +1 -1
  28. package/dist/pwc.min.js +1 -1
  29. package/dist/pwc.min.js.map +1 -1
  30. package/dist/pwc.mjs +570 -97
  31. package/dist/pwc.mjs.map +1 -1
  32. package/dist/scene.d.ts +3 -1
  33. package/dist/sky.d.ts +3 -1
  34. package/package.json +10 -9
  35. package/src/app.ts +208 -2
  36. package/src/asset.ts +3 -1
  37. package/src/async-element.ts +2 -1
  38. package/src/components/camera-component.ts +69 -7
  39. package/src/components/collision-component.ts +4 -4
  40. package/src/components/component.ts +3 -1
  41. package/src/components/element-component.ts +4 -2
  42. package/src/components/gsplat-component.ts +4 -1
  43. package/src/components/light-component.ts +107 -7
  44. package/src/components/listener-component.ts +4 -1
  45. package/src/components/render-component.ts +4 -1
  46. package/src/components/rigidbody-component.ts +4 -4
  47. package/src/components/screen-component.ts +4 -1
  48. package/src/components/script-component.ts +26 -14
  49. package/src/components/script.ts +3 -1
  50. package/src/components/sound-component.ts +4 -1
  51. package/src/components/sound-slot.ts +3 -1
  52. package/src/entity.ts +149 -32
  53. package/src/fog.ts +121 -0
  54. package/src/material.ts +5 -3
  55. package/src/model.ts +3 -1
  56. package/src/module.ts +6 -0
  57. package/src/scene.ts +13 -11
  58. package/src/sky.ts +3 -1
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,21 @@
91
100
  this._depth = true;
92
101
  this._stencil = true;
93
102
  this._highResolution = false;
103
+ this._hierarchyReady = false;
104
+ this._picker = null;
105
+ this._hasPointerListeners = {
106
+ pointerenter: false,
107
+ pointerleave: false,
108
+ pointerdown: false,
109
+ pointerup: false,
110
+ pointermove: false
111
+ };
112
+ this._hoveredEntity = null;
113
+ this._pointerHandlers = {
114
+ pointermove: null,
115
+ pointerdown: null,
116
+ pointerup: null
117
+ };
94
118
  /**
95
119
  * The PlayCanvas application instance.
96
120
  */
@@ -120,6 +144,7 @@
120
144
  this.app.graphicsDevice.maxPixelRatio = this._highResolution ? window.devicePixelRatio : 1;
121
145
  this.app.setCanvasFillMode(playcanvas.FILLMODE_FILL_WINDOW);
122
146
  this.app.setCanvasResolution(playcanvas.RESOLUTION_AUTO);
147
+ this._pickerCreate();
123
148
  // Get all pc-asset elements that are direct children of the pc-app element
124
149
  const assetElements = this.querySelectorAll(':scope > pc-asset');
125
150
  Array.from(assetElements).forEach((assetElement) => {
@@ -134,6 +159,16 @@
134
159
  Array.from(materialElements).forEach((materialElement) => {
135
160
  materialElement.createMaterial();
136
161
  });
162
+ // Create all entities
163
+ const entityElements = this.querySelectorAll('pc-entity');
164
+ Array.from(entityElements).forEach((entityElement) => {
165
+ entityElement.createEntity(this.app);
166
+ });
167
+ // Build hierarchy
168
+ entityElements.forEach((entityElement) => {
169
+ entityElement.buildHierarchy(this.app);
170
+ });
171
+ this._hierarchyReady = true;
137
172
  // Load assets before starting the application
138
173
  this.app.preload(() => {
139
174
  // Start the application
@@ -144,6 +179,7 @@
144
179
  });
145
180
  }
146
181
  disconnectedCallback() {
182
+ this._pickerDestroy();
147
183
  // Clean up the application
148
184
  if (this.app) {
149
185
  this.app.destroy();
@@ -162,6 +198,139 @@
162
198
  this.app.resizeCanvas();
163
199
  }
164
200
  }
201
+ _pickerCreate() {
202
+ const { width, height } = this.app.graphicsDevice;
203
+ this._picker = new playcanvas.Picker(this.app, width, height);
204
+ // Create bound handlers but don't attach them yet
205
+ this._pointerHandlers.pointermove = this._onPointerMove.bind(this);
206
+ this._pointerHandlers.pointerdown = this._onPointerDown.bind(this);
207
+ this._pointerHandlers.pointerup = this._onPointerUp.bind(this);
208
+ // Listen for pointer listeners being added/removed
209
+ ['pointermove', 'pointerdown', 'pointerup', 'pointerenter', 'pointerleave'].forEach((type) => {
210
+ this.addEventListener(`${type}:connect`, () => this._onPointerListenerAdded(type));
211
+ this.addEventListener(`${type}:disconnect`, () => this._onPointerListenerRemoved(type));
212
+ });
213
+ }
214
+ _pickerDestroy() {
215
+ if (this._canvas) {
216
+ Object.entries(this._pointerHandlers).forEach(([type, handler]) => {
217
+ if (handler) {
218
+ this._canvas.removeEventListener(type, handler);
219
+ }
220
+ });
221
+ }
222
+ this._picker = null;
223
+ this._pointerHandlers = {
224
+ pointermove: null,
225
+ pointerdown: null,
226
+ pointerup: null
227
+ };
228
+ }
229
+ _onPointerMove(event) {
230
+ if (!this._picker || !this.app)
231
+ return;
232
+ const camera = this.app.root.findComponent('camera');
233
+ if (!camera)
234
+ return;
235
+ const canvasRect = this._canvas.getBoundingClientRect();
236
+ const x = event.clientX - canvasRect.left;
237
+ const y = event.clientY - canvasRect.top;
238
+ this._picker.prepare(camera, this.app.scene);
239
+ const selection = this._picker.getSelection(x, y);
240
+ // Get the currently hovered entity by walking up the hierarchy
241
+ let newHoverEntity = null;
242
+ if (selection.length > 0) {
243
+ let node = selection[0].node;
244
+ while (node && !newHoverEntity) {
245
+ const entityElement = this.querySelector(`pc-entity[name="${node.name}"]`);
246
+ if (entityElement) {
247
+ newHoverEntity = entityElement;
248
+ }
249
+ node = node.parent;
250
+ }
251
+ }
252
+ // Handle enter/leave events
253
+ if (this._hoveredEntity !== newHoverEntity) {
254
+ if (this._hoveredEntity && this._hoveredEntity.hasListeners('pointerleave')) {
255
+ this._hoveredEntity.dispatchEvent(new PointerEvent('pointerleave', event));
256
+ }
257
+ if (newHoverEntity && newHoverEntity.hasListeners('pointerenter')) {
258
+ newHoverEntity.dispatchEvent(new PointerEvent('pointerenter', event));
259
+ }
260
+ }
261
+ // Update hover state
262
+ this._hoveredEntity = newHoverEntity;
263
+ // Handle pointermove event
264
+ if (newHoverEntity && newHoverEntity.hasListeners('pointermove')) {
265
+ newHoverEntity.dispatchEvent(new PointerEvent('pointermove', event));
266
+ }
267
+ }
268
+ _onPointerDown(event) {
269
+ if (!this._picker || !this.app)
270
+ return;
271
+ const camera = this.app.root.findComponent('camera');
272
+ if (!camera)
273
+ return;
274
+ const canvasRect = this._canvas.getBoundingClientRect();
275
+ const x = event.clientX - canvasRect.left;
276
+ const y = event.clientY - canvasRect.top;
277
+ this._picker.prepare(camera, this.app.scene);
278
+ const selection = this._picker.getSelection(x, y);
279
+ if (selection.length > 0) {
280
+ let node = selection[0].node;
281
+ while (node) {
282
+ const entityElement = this.querySelector(`pc-entity[name="${node.name}"]`);
283
+ if (entityElement && entityElement.hasListeners('pointerdown')) {
284
+ entityElement.dispatchEvent(new PointerEvent('pointerdown', event));
285
+ break;
286
+ }
287
+ node = node.parent;
288
+ }
289
+ }
290
+ }
291
+ _onPointerUp(event) {
292
+ if (!this._picker || !this.app)
293
+ return;
294
+ const camera = this.app.root.findComponent('camera');
295
+ if (!camera)
296
+ return;
297
+ const canvasRect = this._canvas.getBoundingClientRect();
298
+ const x = event.clientX - canvasRect.left;
299
+ const y = event.clientY - canvasRect.top;
300
+ this._picker.prepare(camera, this.app.scene);
301
+ const selection = this._picker.getSelection(x, y);
302
+ if (selection.length > 0) {
303
+ const entityElement = this.querySelector(`pc-entity[name="${selection[0].node.name}"]`);
304
+ if (entityElement && entityElement.hasListeners('pointerup')) {
305
+ entityElement.dispatchEvent(new PointerEvent('pointerup', event));
306
+ }
307
+ }
308
+ }
309
+ _onPointerListenerAdded(type) {
310
+ if (!this._hasPointerListeners[type] && this._canvas) {
311
+ this._hasPointerListeners[type] = true;
312
+ // For enter/leave events, we need the move handler
313
+ const handler = (type === 'pointerenter' || type === 'pointerleave') ?
314
+ this._pointerHandlers.pointermove :
315
+ this._pointerHandlers[type];
316
+ if (handler) {
317
+ this._canvas.addEventListener(type === 'pointerenter' || type === 'pointerleave' ? 'pointermove' : type, handler);
318
+ }
319
+ }
320
+ }
321
+ _onPointerListenerRemoved(type) {
322
+ const hasListeners = Array.from(this.querySelectorAll('pc-entity'))
323
+ .some(entity => entity.hasListeners(type));
324
+ if (!hasListeners && this._canvas) {
325
+ this._hasPointerListeners[type] = false;
326
+ const handler = (type === 'pointerenter' || type === 'pointerleave') ?
327
+ this._pointerHandlers.pointermove :
328
+ this._pointerHandlers[type];
329
+ if (handler) {
330
+ this._canvas.removeEventListener(type === 'pointerenter' || type === 'pointerleave' ? 'pointermove' : type, handler);
331
+ }
332
+ }
333
+ }
165
334
  /**
166
335
  * Sets the alpha flag.
167
336
  * @param value - The alpha flag.
@@ -204,6 +373,14 @@
204
373
  get depth() {
205
374
  return this._depth;
206
375
  }
376
+ /**
377
+ * Gets the hierarchy ready flag.
378
+ * @returns The hierarchy ready flag.
379
+ * @ignore
380
+ */
381
+ get hierarchyReady() {
382
+ return this._hierarchyReady;
383
+ }
207
384
  /**
208
385
  * Sets the high resolution flag. When true, the application will render at the device's
209
386
  * physical resolution. When false, the application will render at CSS resolution.
@@ -475,7 +652,9 @@
475
652
  };
476
653
 
477
654
  /**
478
- * Represents an entity in the PlayCanvas engine.
655
+ * The EntityElement interface provides properties and methods for manipulating
656
+ * `<pc-entity>` elements. The EntityElement interface also inherits the properties and
657
+ * methods of the {@link HTMLElement} interface.
479
658
  */
480
659
  class EntityElement extends AsyncElement {
481
660
  constructor() {
@@ -504,49 +683,93 @@
504
683
  * The tags of the entity.
505
684
  */
506
685
  this._tags = [];
686
+ /**
687
+ * The pointer event listeners for the entity.
688
+ */
689
+ this._listeners = {};
507
690
  /**
508
691
  * The PlayCanvas entity instance.
509
692
  */
510
693
  this.entity = null;
511
694
  }
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;
695
+ createEntity(app) {
519
696
  // Create a new entity
520
- this.entity = new playcanvas.Entity(this._name, app);
521
- // Initialize from attributes
522
- const enabledAttr = this.getAttribute('enabled');
523
- const nameAttr = this.getAttribute('name');
524
- const positionAttr = this.getAttribute('position');
525
- const rotationAttr = this.getAttribute('rotation');
526
- const scaleAttr = this.getAttribute('scale');
527
- const tagsAttr = this.getAttribute('tags');
528
- if (enabledAttr)
529
- this.enabled = enabledAttr !== 'false';
530
- if (nameAttr)
531
- this.name = nameAttr;
532
- if (positionAttr)
533
- this.position = parseVec3(positionAttr);
534
- if (rotationAttr)
535
- this.rotation = parseVec3(rotationAttr);
536
- if (scaleAttr)
537
- this.scale = parseVec3(scaleAttr);
538
- if (tagsAttr)
539
- this.tags = tagsAttr.split(',').map(tag => tag.trim());
697
+ this.entity = new playcanvas.Entity(this.getAttribute('name') || this._name, app);
698
+ const enabled = this.getAttribute('enabled');
699
+ if (enabled) {
700
+ this.entity.enabled = enabled !== 'false';
701
+ }
702
+ const position = this.getAttribute('position');
703
+ if (position) {
704
+ this.entity.setLocalPosition(parseVec3(position));
705
+ }
706
+ const rotation = this.getAttribute('rotation');
707
+ if (rotation) {
708
+ this.entity.setLocalEulerAngles(parseVec3(rotation));
709
+ }
710
+ const scale = this.getAttribute('scale');
711
+ if (scale) {
712
+ this.entity.setLocalScale(parseVec3(scale));
713
+ }
714
+ const tags = this.getAttribute('tags');
715
+ if (tags) {
716
+ this.entity.tags.add(tags.split(',').map(tag => tag.trim()));
717
+ }
718
+ // Handle pointer events
719
+ const pointerEvents = [
720
+ 'onpointerenter',
721
+ 'onpointerleave',
722
+ 'onpointerdown',
723
+ 'onpointerup',
724
+ 'onpointermove'
725
+ ];
726
+ pointerEvents.forEach((eventName) => {
727
+ const handler = this.getAttribute(eventName);
728
+ if (handler) {
729
+ const eventType = eventName.substring(2); // remove 'on' prefix
730
+ const eventHandler = (event) => {
731
+ try {
732
+ /* eslint-disable-next-line no-new-func */
733
+ new Function('event', handler).call(this, event);
734
+ }
735
+ catch (e) {
736
+ console.error('Error in event handler:', e);
737
+ }
738
+ };
739
+ this.addEventListener(eventType, eventHandler);
740
+ }
741
+ });
742
+ }
743
+ buildHierarchy(app) {
744
+ if (!this.entity)
745
+ return;
540
746
  const closestEntity = this.closestEntity;
541
- if (closestEntity) {
542
- closestEntity.ready().then(() => {
543
- closestEntity.entity.addChild(this.entity);
544
- this._onReady();
545
- });
747
+ if (closestEntity === null || closestEntity === void 0 ? void 0 : closestEntity.entity) {
748
+ closestEntity.entity.addChild(this.entity);
546
749
  }
547
750
  else {
548
751
  app.root.addChild(this.entity);
549
- this._onReady();
752
+ }
753
+ this._onReady();
754
+ }
755
+ connectedCallback() {
756
+ // Wait for app to be ready
757
+ const closestApp = this.closestApp;
758
+ if (!closestApp)
759
+ return;
760
+ // If app is already running, create entity immediately
761
+ if (closestApp.hierarchyReady) {
762
+ const app = closestApp.app;
763
+ this.createEntity(app);
764
+ this.buildHierarchy(app);
765
+ // Handle any child entities that might exist
766
+ const childEntities = this.querySelectorAll('pc-entity');
767
+ childEntities.forEach((child) => {
768
+ child.createEntity(app);
769
+ });
770
+ childEntities.forEach((child) => {
771
+ child.buildHierarchy(app);
772
+ });
550
773
  }
551
774
  }
552
775
  disconnectedCallback() {
@@ -556,6 +779,7 @@
556
779
  children.forEach((child) => {
557
780
  child.entity = null;
558
781
  });
782
+ // Destroy the entity
559
783
  this.entity.destroy();
560
784
  this.entity = null;
561
785
  }
@@ -664,7 +888,19 @@
664
888
  return this._tags;
665
889
  }
666
890
  static get observedAttributes() {
667
- return ['enabled', 'name', 'position', 'rotation', 'scale', 'tags'];
891
+ return [
892
+ 'enabled',
893
+ 'name',
894
+ 'position',
895
+ 'rotation',
896
+ 'scale',
897
+ 'tags',
898
+ 'onpointerenter',
899
+ 'onpointerleave',
900
+ 'onpointerdown',
901
+ 'onpointerup',
902
+ 'onpointermove'
903
+ ];
668
904
  }
669
905
  attributeChangedCallback(name, _oldValue, newValue) {
670
906
  switch (name) {
@@ -686,7 +922,51 @@
686
922
  case 'tags':
687
923
  this.tags = newValue.split(',').map(tag => tag.trim());
688
924
  break;
925
+ case 'onpointerenter':
926
+ case 'onpointerleave':
927
+ case 'onpointerdown':
928
+ case 'onpointerup':
929
+ case 'onpointermove':
930
+ if (newValue) {
931
+ const eventName = name.substring(2);
932
+ // Use Function.prototype.bind to avoid new Function
933
+ const handler = (event) => {
934
+ try {
935
+ const handlerStr = this.getAttribute(eventName) || '';
936
+ /* eslint-disable-next-line no-new-func */
937
+ new Function('event', handlerStr).call(this, event);
938
+ }
939
+ catch (e) {
940
+ console.error('Error in event handler:', e);
941
+ }
942
+ };
943
+ this.addEventListener(eventName, handler);
944
+ }
945
+ break;
946
+ }
947
+ }
948
+ addEventListener(type, listener, options) {
949
+ if (!this._listeners[type]) {
950
+ this._listeners[type] = [];
689
951
  }
952
+ this._listeners[type].push(listener);
953
+ super.addEventListener(type, listener, options);
954
+ if (type.startsWith('pointer')) {
955
+ this.dispatchEvent(new CustomEvent(`${type}:connect`, { bubbles: true }));
956
+ }
957
+ }
958
+ removeEventListener(type, listener, options) {
959
+ if (this._listeners[type]) {
960
+ this._listeners[type] = this._listeners[type].filter(l => l !== listener);
961
+ }
962
+ super.removeEventListener(type, listener, options);
963
+ if (type.startsWith('pointer')) {
964
+ this.dispatchEvent(new CustomEvent(`${type}:disconnect`, { bubbles: true }));
965
+ }
966
+ }
967
+ hasListeners(type) {
968
+ var _a;
969
+ return Boolean((_a = this._listeners[type]) === null || _a === void 0 ? void 0 : _a.length);
690
970
  }
691
971
  }
692
972
  customElements.define('pc-entity', EntityElement);
@@ -711,7 +991,9 @@
711
991
  ['webp', 'texture']
712
992
  ]);
713
993
  /**
714
- * Loads an asset into the PlayCanvas engine.
994
+ * The AssetElement interface provides properties and methods for manipulating
995
+ * `<pc-asset>` elements. The AssetElement interface also inherits the properties and
996
+ * methods of the {@link HTMLElement} interface.
715
997
  */
716
998
  class AssetElement extends HTMLElement {
717
999
  constructor() {
@@ -787,8 +1069,10 @@
787
1069
  */
788
1070
  class ComponentElement extends AsyncElement {
789
1071
  /**
790
- * Constructor for the ComponentElement.
1072
+ * Creates a new ComponentElement instance.
1073
+ *
791
1074
  * @param componentName - The name of the component.
1075
+ * @ignore
792
1076
  */
793
1077
  constructor(componentName) {
794
1078
  super();
@@ -857,11 +1141,14 @@
857
1141
  }
858
1142
 
859
1143
  /**
860
- * Represents a audio listener component in the PlayCanvas engine.
1144
+ * The ListenerComponentElement interface provides properties and methods for manipulating
1145
+ * `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
1146
+ * and methods of the {@link HTMLElement} interface.
861
1147
  *
862
1148
  * @category Components
863
1149
  */
864
1150
  class ListenerComponentElement extends ComponentElement {
1151
+ /** @ignore */
865
1152
  constructor() {
866
1153
  super('audiolistener');
867
1154
  }
@@ -875,15 +1162,24 @@
875
1162
  }
876
1163
  customElements.define('pc-listener', ListenerComponentElement);
877
1164
 
1165
+ const tonemaps = new Map([
1166
+ ['none', playcanvas.TONEMAP_NONE],
1167
+ ['linear', playcanvas.TONEMAP_LINEAR],
1168
+ ['filmic', playcanvas.TONEMAP_FILMIC],
1169
+ ['hejl', playcanvas.TONEMAP_HEJL],
1170
+ ['aces', playcanvas.TONEMAP_ACES],
1171
+ ['aces2', playcanvas.TONEMAP_ACES2],
1172
+ ['neutral', playcanvas.TONEMAP_NEUTRAL]
1173
+ ]);
878
1174
  /**
879
- * Represents a camera component in the PlayCanvas engine.
1175
+ * The CameraComponentElement interface provides properties and methods for manipulating
1176
+ * `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
1177
+ * methods of the {@link HTMLElement} interface.
880
1178
  *
881
1179
  * @category Components
882
1180
  */
883
1181
  class CameraComponentElement extends ComponentElement {
884
- /**
885
- * Creates a new CameraComponentElement.
886
- */
1182
+ /** @ignore */
887
1183
  constructor() {
888
1184
  super('camera');
889
1185
  this._clearColor = new playcanvas.Color(0.75, 0.75, 0.75, 1);
@@ -895,12 +1191,14 @@
895
1191
  this._flipFaces = false;
896
1192
  this._fov = 45;
897
1193
  this._frustumCulling = true;
1194
+ this._gamma = 'srgb';
898
1195
  this._nearClip = 0.1;
899
1196
  this._orthographic = false;
900
1197
  this._orthoHeight = 10;
901
1198
  this._priority = 0;
902
1199
  this._rect = new playcanvas.Vec4(0, 0, 1, 1);
903
1200
  this._scissorRect = new playcanvas.Vec4(0, 0, 1, 1);
1201
+ this._tonemap = 'none';
904
1202
  }
905
1203
  getInitialComponentData() {
906
1204
  return {
@@ -913,12 +1211,14 @@
913
1211
  flipFaces: this._flipFaces,
914
1212
  fov: this._fov,
915
1213
  frustumCulling: this._frustumCulling,
1214
+ gammaCorrection: this._gamma === 'srgb' ? playcanvas.GAMMA_SRGB : playcanvas.GAMMA_NONE,
916
1215
  nearClip: this._nearClip,
917
1216
  orthographic: this._orthographic,
918
1217
  orthoHeight: this._orthoHeight,
919
1218
  priority: this._priority,
920
1219
  rect: this._rect,
921
- scissorRect: this._scissorRect
1220
+ scissorRect: this._scissorRect,
1221
+ toneMapping: tonemaps.get(this._tonemap)
922
1222
  };
923
1223
  }
924
1224
  get xrAvailable() {
@@ -1101,6 +1401,23 @@
1101
1401
  get frustumCulling() {
1102
1402
  return this._frustumCulling;
1103
1403
  }
1404
+ /**
1405
+ * Sets the gamma correction of the camera.
1406
+ * @param value - The gamma correction.
1407
+ */
1408
+ set gamma(value) {
1409
+ this._gamma = value;
1410
+ if (this.component) {
1411
+ this.component.gammaCorrection = value === 'srgb' ? playcanvas.GAMMA_SRGB : playcanvas.GAMMA_NONE;
1412
+ }
1413
+ }
1414
+ /**
1415
+ * Gets the gamma correction of the camera.
1416
+ * @returns The gamma correction.
1417
+ */
1418
+ get gamma() {
1419
+ return this._gamma;
1420
+ }
1104
1421
  /**
1105
1422
  * Sets the near clip distance of the camera.
1106
1423
  * @param value - The near clip distance.
@@ -1203,6 +1520,24 @@
1203
1520
  get scissorRect() {
1204
1521
  return this._scissorRect;
1205
1522
  }
1523
+ /**
1524
+ * Sets the tone mapping of the camera.
1525
+ * @param value - The tone mapping.
1526
+ */
1527
+ set tonemap(value) {
1528
+ var _a;
1529
+ this._tonemap = value;
1530
+ if (this.component) {
1531
+ this.component.toneMapping = (_a = tonemaps.get(value)) !== null && _a !== void 0 ? _a : playcanvas.TONEMAP_NONE;
1532
+ }
1533
+ }
1534
+ /**
1535
+ * Gets the tone mapping of the camera.
1536
+ * @returns The tone mapping.
1537
+ */
1538
+ get tonemap() {
1539
+ return this._tonemap;
1540
+ }
1206
1541
  static get observedAttributes() {
1207
1542
  return [
1208
1543
  ...super.observedAttributes,
@@ -1215,12 +1550,14 @@
1215
1550
  'flip-faces',
1216
1551
  'fov',
1217
1552
  'frustum-culling',
1553
+ 'gamma',
1218
1554
  'near-clip',
1219
1555
  'orthographic',
1220
1556
  'ortho-height',
1221
1557
  'priority',
1222
1558
  'rect',
1223
- 'scissor-rect'
1559
+ 'scissor-rect',
1560
+ 'tonemap'
1224
1561
  ];
1225
1562
  }
1226
1563
  attributeChangedCallback(name, _oldValue, newValue) {
@@ -1253,6 +1590,9 @@
1253
1590
  case 'frustum-culling':
1254
1591
  this.frustumCulling = newValue !== 'false';
1255
1592
  break;
1593
+ case 'gamma':
1594
+ this.gamma = newValue;
1595
+ break;
1256
1596
  case 'near-clip':
1257
1597
  this.nearClip = parseFloat(newValue);
1258
1598
  break;
@@ -1271,20 +1611,23 @@
1271
1611
  case 'scissor-rect':
1272
1612
  this.scissorRect = parseVec4(newValue);
1273
1613
  break;
1614
+ case 'tonemap':
1615
+ this.tonemap = newValue;
1616
+ break;
1274
1617
  }
1275
1618
  }
1276
1619
  }
1277
1620
  customElements.define('pc-camera', CameraComponentElement);
1278
1621
 
1279
1622
  /**
1280
- * Represents a collision component in the PlayCanvas engine.
1623
+ * The CollisionComponentElement interface provides properties and methods for manipulating
1624
+ * `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
1625
+ * and methods of the {@link HTMLElement} interface.
1281
1626
  *
1282
1627
  * @category Components
1283
1628
  */
1284
1629
  class CollisionComponentElement extends ComponentElement {
1285
- /**
1286
- * Creates a new CollisionComponentElement.
1287
- */
1630
+ /** @ignore */
1288
1631
  constructor() {
1289
1632
  super('collision');
1290
1633
  this._angularOffset = new playcanvas.Quat();
@@ -1423,11 +1766,14 @@
1423
1766
  customElements.define('pc-collision', CollisionComponentElement);
1424
1767
 
1425
1768
  /**
1426
- * Represents an element component in the PlayCanvas engine.
1769
+ * The ElementComponentElement interface provides properties and methods for manipulating
1770
+ * `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
1771
+ * methods of the {@link HTMLElement} interface.
1427
1772
  *
1428
1773
  * @category Components
1429
1774
  */
1430
1775
  class ElementComponentElement extends ComponentElement {
1776
+ /** @ignore */
1431
1777
  constructor() {
1432
1778
  super('element');
1433
1779
  this._anchor = new playcanvas.Vec4(0.5, 0.5, 0.5, 0.5);
@@ -1633,11 +1979,14 @@
1633
1979
  customElements.define('pc-element', ElementComponentElement);
1634
1980
 
1635
1981
  /**
1636
- * Represents a gsplat component in the PlayCanvas engine.
1982
+ * The GSplatComponentElement interface provides properties and methods for manipulating
1983
+ * `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
1984
+ * methods of the {@link HTMLElement} interface.
1637
1985
  *
1638
1986
  * @category Components
1639
1987
  */
1640
1988
  class GSplatComponentElement extends ComponentElement {
1989
+ /** @ignore */
1641
1990
  constructor() {
1642
1991
  super('gsplat');
1643
1992
  this._asset = '';
@@ -1678,15 +2027,26 @@
1678
2027
  }
1679
2028
  customElements.define('pc-splat', GSplatComponentElement);
1680
2029
 
2030
+ const shadowTypes = new Map([
2031
+ ['pcf1-16f', playcanvas.SHADOW_PCF1_16F],
2032
+ ['pcf1-32f', playcanvas.SHADOW_PCF1_32F],
2033
+ ['pcf3-16f', playcanvas.SHADOW_PCF3_16F],
2034
+ ['pcf3-32f', playcanvas.SHADOW_PCF3_32F],
2035
+ ['pcf5-16f', playcanvas.SHADOW_PCF5_16F],
2036
+ ['pcf5-32f', playcanvas.SHADOW_PCF5_32F],
2037
+ ['vsm-16f', playcanvas.SHADOW_VSM_16F],
2038
+ ['vsm-32f', playcanvas.SHADOW_VSM_32F],
2039
+ ['pcss-32f', playcanvas.SHADOW_PCSS_32F]
2040
+ ]);
1681
2041
  /**
1682
- * Represents a light component in the PlayCanvas engine.
2042
+ * The LightComponentElement interface provides properties and methods for manipulating
2043
+ * `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
2044
+ * methods of the {@link HTMLElement} interface.
1683
2045
  *
1684
2046
  * @category Components
1685
2047
  */
1686
2048
  class LightComponentElement extends ComponentElement {
1687
- /**
1688
- * Creates a new LightComponentElement.
1689
- */
2049
+ /** @ignore */
1690
2050
  constructor() {
1691
2051
  super('light');
1692
2052
  this._castShadows = false;
@@ -1698,8 +2058,11 @@
1698
2058
  this._range = 10;
1699
2059
  this._shadowBias = 0.2;
1700
2060
  this._shadowDistance = 16;
2061
+ this._shadowIntensity = 1;
1701
2062
  this._shadowResolution = 1024;
2063
+ this._shadowType = 'pcf3-32f';
1702
2064
  this._type = 'directional';
2065
+ this._vsmBias = 0.01;
1703
2066
  }
1704
2067
  getInitialComponentData() {
1705
2068
  return {
@@ -1712,8 +2075,11 @@
1712
2075
  range: this._range,
1713
2076
  shadowBias: this._shadowBias,
1714
2077
  shadowDistance: this._shadowDistance,
2078
+ shadowIntensity: this._shadowIntensity,
1715
2079
  shadowResolution: this._shadowResolution,
1716
- type: this._type
2080
+ shadowType: shadowTypes.get(this._shadowType),
2081
+ type: this._type,
2082
+ vsmBias: this._vsmBias
1717
2083
  };
1718
2084
  }
1719
2085
  /**
@@ -1876,6 +2242,23 @@
1876
2242
  get shadowDistance() {
1877
2243
  return this._shadowDistance;
1878
2244
  }
2245
+ /**
2246
+ * Sets the shadow intensity of the light.
2247
+ * @param value - The shadow intensity.
2248
+ */
2249
+ set shadowIntensity(value) {
2250
+ this._shadowIntensity = value;
2251
+ if (this.component) {
2252
+ this.component.shadowIntensity = value;
2253
+ }
2254
+ }
2255
+ /**
2256
+ * Gets the shadow intensity of the light.
2257
+ * @returns The shadow intensity.
2258
+ */
2259
+ get shadowIntensity() {
2260
+ return this._shadowIntensity;
2261
+ }
1879
2262
  /**
1880
2263
  * Sets the shadow resolution of the light.
1881
2264
  * @param value - The shadow resolution.
@@ -1893,6 +2276,34 @@
1893
2276
  get shadowResolution() {
1894
2277
  return this._shadowResolution;
1895
2278
  }
2279
+ /**
2280
+ * Sets the shadow type of the light.
2281
+ * @param value - The shadow type. Can be:
2282
+ *
2283
+ * - `pcf1-16f` - 1-tap percentage-closer filtered shadow map with 16-bit depth.
2284
+ * - `pcf1-32f` - 1-tap percentage-closer filtered shadow map with 32-bit depth.
2285
+ * - `pcf3-16f` - 3-tap percentage-closer filtered shadow map with 16-bit depth.
2286
+ * - `pcf3-32f` - 3-tap percentage-closer filtered shadow map with 32-bit depth.
2287
+ * - `pcf5-16f` - 5-tap percentage-closer filtered shadow map with 16-bit depth.
2288
+ * - `pcf5-32f` - 5-tap percentage-closer filtered shadow map with 32-bit depth.
2289
+ * - `vsm-16f` - Variance shadow map with 16-bit depth.
2290
+ * - `vsm-32f` - Variance shadow map with 32-bit depth.
2291
+ * - `pcss-32f` - Percentage-closer soft shadow with 32-bit depth.
2292
+ */
2293
+ set shadowType(value) {
2294
+ var _a;
2295
+ this._shadowType = value;
2296
+ if (this.component) {
2297
+ this.component.shadowType = (_a = shadowTypes.get(value)) !== null && _a !== void 0 ? _a : playcanvas.SHADOW_PCF3_32F;
2298
+ }
2299
+ }
2300
+ /**
2301
+ * Gets the shadow type of the light.
2302
+ * @returns The shadow type.
2303
+ */
2304
+ get shadowType() {
2305
+ return this._shadowType;
2306
+ }
1896
2307
  /**
1897
2308
  * Sets the type of the light.
1898
2309
  * @param value - The type.
@@ -1914,6 +2325,23 @@
1914
2325
  get type() {
1915
2326
  return this._type;
1916
2327
  }
2328
+ /**
2329
+ * Sets the VSM bias of the light.
2330
+ * @param value - The VSM bias.
2331
+ */
2332
+ set vsmBias(value) {
2333
+ this._vsmBias = value;
2334
+ if (this.component) {
2335
+ this.component.vsmBias = value;
2336
+ }
2337
+ }
2338
+ /**
2339
+ * Gets the VSM bias of the light.
2340
+ * @returns The VSM bias.
2341
+ */
2342
+ get vsmBias() {
2343
+ return this._vsmBias;
2344
+ }
1917
2345
  static get observedAttributes() {
1918
2346
  return [
1919
2347
  ...super.observedAttributes,
@@ -1926,8 +2354,11 @@
1926
2354
  'range',
1927
2355
  'shadow-bias',
1928
2356
  'shadow-distance',
2357
+ 'shadow-intensity',
1929
2358
  'shadow-resolution',
1930
- 'type'
2359
+ 'shadow-type',
2360
+ 'type',
2361
+ 'vsm-bias'
1931
2362
  ];
1932
2363
  }
1933
2364
  attributeChangedCallback(name, _oldValue, newValue) {
@@ -1963,16 +2394,27 @@
1963
2394
  case 'shadow-resolution':
1964
2395
  this.shadowResolution = Number(newValue);
1965
2396
  break;
2397
+ case 'shadow-intensity':
2398
+ this.shadowIntensity = Number(newValue);
2399
+ break;
2400
+ case 'shadow-type':
2401
+ this.shadowType = newValue;
2402
+ break;
1966
2403
  case 'type':
1967
2404
  this.type = newValue;
1968
2405
  break;
2406
+ case 'vsm-bias':
2407
+ this.vsmBias = Number(newValue);
2408
+ break;
1969
2409
  }
1970
2410
  }
1971
2411
  }
1972
2412
  customElements.define('pc-light', LightComponentElement);
1973
2413
 
1974
2414
  /**
1975
- * Represents a material in the PlayCanvas engine.
2415
+ * The MaterialElement interface provides properties and methods for manipulating
2416
+ * `<pc-material>` elements. The MaterialElement interface also inherits the properties and
2417
+ * methods of the {@link HTMLElement} interface.
1976
2418
  */
1977
2419
  class MaterialElement extends HTMLElement {
1978
2420
  constructor() {
@@ -1986,8 +2428,8 @@
1986
2428
  }
1987
2429
  createMaterial() {
1988
2430
  this.material = new playcanvas.StandardMaterial();
1989
- this.material.glossInvert = true;
1990
- this.material.useMetalness = true;
2431
+ this.material.glossInvert = false;
2432
+ this.material.useMetalness = false;
1991
2433
  this.material.diffuse = this._diffuse;
1992
2434
  this.diffuseMap = this._diffuseMap;
1993
2435
  this.metalnessMap = this._metalnessMap;
@@ -2086,11 +2528,14 @@
2086
2528
  customElements.define('pc-material', MaterialElement);
2087
2529
 
2088
2530
  /**
2089
- * Represents a render component in the PlayCanvas engine.
2531
+ * The RenderComponentElement interface provides properties and methods for manipulating
2532
+ * `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
2533
+ * methods of the {@link HTMLElement} interface.
2090
2534
  *
2091
2535
  * @category Components
2092
2536
  */
2093
2537
  class RenderComponentElement extends ComponentElement {
2538
+ /** @ignore */
2094
2539
  constructor() {
2095
2540
  super('render');
2096
2541
  this._castShadows = true;
@@ -2205,14 +2650,14 @@
2205
2650
  customElements.define('pc-render', RenderComponentElement);
2206
2651
 
2207
2652
  /**
2208
- * Represents a rigidbody component in the PlayCanvas engine.
2653
+ * The RigidBodyComponentElement interface provides properties and methods for manipulating
2654
+ * `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
2655
+ * and methods of the {@link HTMLElement} interface.
2209
2656
  *
2210
2657
  * @category Components
2211
2658
  */
2212
2659
  class RigidBodyComponentElement extends ComponentElement {
2213
- /**
2214
- * Creates a new RigidBodyComponentElement.
2215
- */
2660
+ /** @ignore */
2216
2661
  constructor() {
2217
2662
  super('rigidbody');
2218
2663
  /**
@@ -2392,11 +2837,14 @@
2392
2837
  customElements.define('pc-rigidbody', RigidBodyComponentElement);
2393
2838
 
2394
2839
  /**
2395
- * Represents a screen component in the PlayCanvas engine.
2840
+ * The ScreenComponentElement interface provides properties and methods for manipulating
2841
+ * `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
2842
+ * methods of the {@link HTMLElement} interface.
2396
2843
  *
2397
2844
  * @category Components
2398
2845
  */
2399
2846
  class ScreenComponentElement extends ComponentElement {
2847
+ /** @ignore */
2400
2848
  constructor() {
2401
2849
  super('screen');
2402
2850
  this._screenSpace = false;
@@ -2514,15 +2962,15 @@
2514
2962
  }
2515
2963
  customElements.define('pc-screen', ScreenComponentElement);
2516
2964
 
2517
- const tmpV2 = new playcanvas.Vec2();
2518
- const tmpV3 = new playcanvas.Vec3();
2519
- const tmpV4 = new playcanvas.Vec4();
2520
2965
  /**
2521
- * Represents a script component in the PlayCanvas engine.
2966
+ * The ScriptComponentElement interface provides properties and methods for manipulating
2967
+ * `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
2968
+ * methods of the {@link HTMLElement} interface.
2522
2969
  *
2523
2970
  * @category Components
2524
2971
  */
2525
2972
  class ScriptComponentElement extends ComponentElement {
2973
+ /** @ignore */
2526
2974
  constructor() {
2527
2975
  super('script');
2528
2976
  // Create mutation observer to watch for child script elements
@@ -2557,22 +3005,34 @@
2557
3005
  return;
2558
3006
  }
2559
3007
  }
2560
- // Handle vectors
2561
- if (Array.isArray(value)) {
2562
- if (target[key] instanceof playcanvas.Vec2) {
2563
- target[key] = tmpV2.set(value[0], value[1]);
3008
+ // Handle arrays
3009
+ if (value && typeof value === 'object' && Array.isArray(value)) {
3010
+ // If it's an array of objects, recursively apply to each object
3011
+ if (value.length > 0 && typeof value[0] === 'object') {
3012
+ target[key] = value.map((item) => {
3013
+ const obj = {};
3014
+ for (const itemKey in item) {
3015
+ applyValue(obj, itemKey, item[itemKey]);
3016
+ }
3017
+ return obj;
3018
+ });
3019
+ return;
3020
+ }
3021
+ // Handle vectors
3022
+ if (value.length === 2 && typeof value[0] === 'number') {
3023
+ target[key] = new playcanvas.Vec2(value[0], value[1]);
2564
3024
  return;
2565
3025
  }
2566
- if (target[key] instanceof playcanvas.Vec3) {
2567
- target[key] = tmpV3.set(value[0], value[1], value[2]);
3026
+ if (value.length === 3 && typeof value[0] === 'number') {
3027
+ target[key] = new playcanvas.Vec3(value[0], value[1], value[2]);
2568
3028
  return;
2569
3029
  }
2570
- if (target[key] instanceof playcanvas.Vec4) {
2571
- target[key] = tmpV4.set(value[0], value[1], value[2], value[3]);
3030
+ if (value.length === 4 && typeof value[0] === 'number') {
3031
+ target[key] = new playcanvas.Vec4(value[0], value[1], value[2], value[3]);
2572
3032
  return;
2573
3033
  }
2574
3034
  }
2575
- // Handle nested objects
3035
+ // Handle nested objects (non-array)
2576
3036
  if (value && typeof value === 'object' && !Array.isArray(value)) {
2577
3037
  if (!target[key] || typeof target[key] !== 'object') {
2578
3038
  target[key] = {};
@@ -2665,7 +3125,9 @@
2665
3125
  customElements.define('pc-scripts', ScriptComponentElement);
2666
3126
 
2667
3127
  /**
2668
- * Represents a script in the PlayCanvas engine.
3128
+ * The ScriptElement interface provides properties and methods for manipulating
3129
+ * `<pc-script>` elements. The ScriptElement interface also inherits the properties and
3130
+ * methods of the {@link HTMLElement} interface.
2669
3131
  */
2670
3132
  class ScriptElement extends HTMLElement {
2671
3133
  constructor() {
@@ -2744,11 +3206,14 @@
2744
3206
  customElements.define('pc-script', ScriptElement);
2745
3207
 
2746
3208
  /**
2747
- * Represents a sound component in the PlayCanvas engine.
3209
+ * The SoundComponentElement interface provides properties and methods for manipulating
3210
+ * `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
3211
+ * methods of the {@link HTMLElement} interface.
2748
3212
  *
2749
3213
  * @category Components
2750
3214
  */
2751
3215
  class SoundComponentElement extends ComponentElement {
3216
+ /** @ignore */
2752
3217
  constructor() {
2753
3218
  super('sound');
2754
3219
  this._distanceModel = 'linear';
@@ -2938,7 +3403,9 @@
2938
3403
  customElements.define('pc-sounds', SoundComponentElement);
2939
3404
 
2940
3405
  /**
2941
- * Represents a sound slot in the PlayCanvas engine.
3406
+ * The SoundSlotElement interface provides properties and methods for manipulating
3407
+ * `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
3408
+ * methods of the {@link AsyncElement} interface.
2942
3409
  */
2943
3410
  class SoundSlotElement extends AsyncElement {
2944
3411
  constructor() {
@@ -3179,7 +3646,9 @@
3179
3646
  customElements.define('pc-sound', SoundSlotElement);
3180
3647
 
3181
3648
  /**
3182
- * Represents a model in the PlayCanvas engine.
3649
+ * The ModelElement interface provides properties and methods for manipulating
3650
+ * `<pc-model>` elements. The ModelElement interface also inherits the properties and
3651
+ * methods of the {@link HTMLElement} interface.
3183
3652
  */
3184
3653
  class ModelElement extends AsyncElement {
3185
3654
  constructor() {
@@ -3272,7 +3741,9 @@
3272
3741
  customElements.define('pc-model', ModelElement);
3273
3742
 
3274
3743
  /**
3275
- * Represents a scene in the PlayCanvas engine.
3744
+ * The SceneElement interface provides properties and methods for manipulating
3745
+ * `<pc-scene>` elements. The SceneElement interface also inherits the properties and
3746
+ * methods of the {@link HTMLElement} interface.
3276
3747
  */
3277
3748
  class SceneElement extends AsyncElement {
3278
3749
  constructor() {
@@ -3311,11 +3782,11 @@
3311
3782
  }
3312
3783
  updateSceneSettings() {
3313
3784
  if (this.scene) {
3314
- this.scene.rendering.fog = this._fog;
3315
- this.scene.rendering.fogColor = this._fogColor;
3316
- this.scene.rendering.fogDensity = this._fogDensity;
3317
- this.scene.rendering.fogStart = this._fogStart;
3318
- this.scene.rendering.fogEnd = this._fogEnd;
3785
+ this.scene.fog.type = this._fog;
3786
+ this.scene.fog.color = this._fogColor;
3787
+ this.scene.fog.density = this._fogDensity;
3788
+ this.scene.fog.start = this._fogStart;
3789
+ this.scene.fog.end = this._fogEnd;
3319
3790
  // ... set other properties on the scene as well
3320
3791
  }
3321
3792
  }
@@ -3326,7 +3797,7 @@
3326
3797
  set fog(value) {
3327
3798
  this._fog = value;
3328
3799
  if (this.scene) {
3329
- this.scene.rendering.fog = value;
3800
+ this.scene.fog.type = value;
3330
3801
  }
3331
3802
  }
3332
3803
  /**
@@ -3343,7 +3814,7 @@
3343
3814
  set fogColor(value) {
3344
3815
  this._fogColor = value;
3345
3816
  if (this.scene) {
3346
- this.scene.rendering.fogColor = value;
3817
+ this.scene.fog.color = value;
3347
3818
  }
3348
3819
  }
3349
3820
  /**
@@ -3360,7 +3831,7 @@
3360
3831
  set fogDensity(value) {
3361
3832
  this._fogDensity = value;
3362
3833
  if (this.scene) {
3363
- this.scene.rendering.fogDensity = value;
3834
+ this.scene.fog.density = value;
3364
3835
  }
3365
3836
  }
3366
3837
  /**
@@ -3377,7 +3848,7 @@
3377
3848
  set fogStart(value) {
3378
3849
  this._fogStart = value;
3379
3850
  if (this.scene) {
3380
- this.scene.rendering.fogStart = value;
3851
+ this.scene.fog.start = value;
3381
3852
  }
3382
3853
  }
3383
3854
  /**
@@ -3394,7 +3865,7 @@
3394
3865
  set fogEnd(value) {
3395
3866
  this._fogEnd = value;
3396
3867
  if (this.scene) {
3397
- this.scene.rendering.fogEnd = value;
3868
+ this.scene.fog.end = value;
3398
3869
  }
3399
3870
  }
3400
3871
  /**
@@ -3431,7 +3902,9 @@
3431
3902
  customElements.define('pc-scene', SceneElement);
3432
3903
 
3433
3904
  /**
3434
- * Represents a sky in the PlayCanvas engine.
3905
+ * The SkyElement interface provides properties and methods for manipulating
3906
+ * `<pc-sky>` elements. The SkyElement interface also inherits the properties and
3907
+ * methods of the {@link HTMLElement} interface.
3435
3908
  */
3436
3909
  class SkyElement extends AsyncElement {
3437
3910
  constructor() {