@playcanvas/web-components 0.2.5 → 0.2.7

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/app.d.ts +14 -3
  3. package/dist/asset.d.ts +1 -1
  4. package/dist/components/camera-component.d.ts +3 -3
  5. package/dist/components/collision-component.d.ts +1 -1
  6. package/dist/components/element-component.d.ts +1 -1
  7. package/dist/components/light-component.d.ts +2 -2
  8. package/dist/components/listener-component.d.ts +1 -1
  9. package/dist/components/particlesystem-component.d.ts +1 -1
  10. package/dist/components/render-component.d.ts +1 -1
  11. package/dist/components/rigidbody-component.d.ts +1 -1
  12. package/dist/components/screen-component.d.ts +2 -2
  13. package/dist/components/script-component.d.ts +1 -1
  14. package/dist/components/sound-component.d.ts +1 -1
  15. package/dist/components/splat-component.d.ts +13 -1
  16. package/dist/entity.d.ts +4 -4
  17. package/dist/material.d.ts +1 -1
  18. package/dist/model.d.ts +1 -1
  19. package/dist/module.d.ts +1 -1
  20. package/dist/pwc.cjs +155 -46
  21. package/dist/pwc.cjs.map +1 -1
  22. package/dist/pwc.js +155 -46
  23. package/dist/pwc.js.map +1 -1
  24. package/dist/pwc.min.js +1 -1
  25. package/dist/pwc.min.js.map +1 -1
  26. package/dist/pwc.mjs +156 -47
  27. package/dist/pwc.mjs.map +1 -1
  28. package/dist/scene.d.ts +1 -1
  29. package/package.json +16 -16
  30. package/src/app.ts +170 -15
  31. package/src/asset.ts +2 -1
  32. package/src/components/camera-component.ts +1 -1
  33. package/src/components/collision-component.ts +1 -1
  34. package/src/components/element-component.ts +1 -1
  35. package/src/components/light-component.ts +1 -1
  36. package/src/components/listener-component.ts +1 -1
  37. package/src/components/particlesystem-component.ts +1 -1
  38. package/src/components/render-component.ts +1 -1
  39. package/src/components/rigidbody-component.ts +1 -1
  40. package/src/components/screen-component.ts +1 -1
  41. package/src/components/script-component.ts +1 -1
  42. package/src/components/sound-component.ts +1 -1
  43. package/src/components/sound-slot.ts +3 -0
  44. package/src/components/splat-component.ts +33 -4
  45. package/src/entity.ts +4 -4
  46. package/src/material.ts +1 -1
  47. package/src/model.ts +1 -1
  48. package/src/module.ts +7 -14
  49. package/src/scene.ts +1 -1
package/dist/pwc.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { basisInitialize, WasmModule, Application, Mouse, Keyboard, FILLMODE_FILL_WINDOW, RESOLUTION_AUTO, Picker, Vec3, Vec4, Color, Quat, Vec2, Entity, Asset, GAMMA_SRGB, GAMMA_NONE, XRTYPE_VR, PROJECTION_ORTHOGRAPHIC, PROJECTION_PERSPECTIVE, TONEMAP_NONE, TONEMAP_LINEAR, TONEMAP_FILMIC, TONEMAP_HEJL, TONEMAP_ACES, TONEMAP_ACES2, TONEMAP_NEUTRAL, SHADOW_PCF3_32F, SHADOW_PCF1_16F, SHADOW_PCF1_32F, SHADOW_PCF3_16F, SHADOW_PCF5_16F, SHADOW_PCF5_32F, SHADOW_VSM_16F, SHADOW_VSM_32F, SHADOW_PCSS_32F, StandardMaterial, SCALEMODE_BLEND, SCALEMODE_NONE, EnvLighting, LAYERID_SKYBOX } from 'playcanvas';
1
+ import { basisInitialize, WasmModule, createGraphicsDevice, AppOptions, Keyboard, Mouse, AnimComponentSystem, AnimationComponentSystem, AudioListenerComponentSystem, ButtonComponentSystem, CameraComponentSystem, CollisionComponentSystem, ElementComponentSystem, GSplatComponentSystem, JointComponentSystem, LayoutChildComponentSystem, LayoutGroupComponentSystem, LightComponentSystem, ModelComponentSystem, ParticleSystemComponentSystem, RenderComponentSystem, RigidBodyComponentSystem, ScreenComponentSystem, ScriptComponentSystem, ScrollbarComponentSystem, ScrollViewComponentSystem, SoundComponentSystem, SpriteComponentSystem, ZoneComponentSystem, AnimClipHandler, AnimationHandler, AnimStateGraphHandler, AudioHandler, BinaryHandler, CssHandler, ContainerHandler, CubemapHandler, FolderHandler, FontHandler, GSplatHandler, HierarchyHandler, HtmlHandler, JsonHandler, MaterialHandler, ModelHandler, RenderHandler, ScriptHandler, SceneHandler, ShaderHandler, SpriteHandler, TemplateHandler, TextHandler, TextureAtlasHandler, TextureHandler, SoundManager, Lightmapper, BatchManager, XrManager, AppBase, FILLMODE_FILL_WINDOW, RESOLUTION_AUTO, Picker, Vec3, Vec4, Color, Quat, Vec2, Entity, Asset, GAMMA_SRGB, GAMMA_NONE, XRTYPE_VR, PROJECTION_ORTHOGRAPHIC, PROJECTION_PERSPECTIVE, TONEMAP_NONE, TONEMAP_LINEAR, TONEMAP_FILMIC, TONEMAP_HEJL, TONEMAP_ACES, TONEMAP_ACES2, TONEMAP_NEUTRAL, SHADOW_PCF3_32F, SHADOW_PCF1_16F, SHADOW_PCF1_32F, SHADOW_PCF3_16F, SHADOW_PCF5_16F, SHADOW_PCF5_32F, SHADOW_VSM_16F, SHADOW_VSM_32F, SHADOW_PCSS_32F, StandardMaterial, SCALEMODE_BLEND, SCALEMODE_NONE, EnvLighting, LAYERID_SKYBOX } from 'playcanvas';
2
2
 
3
3
  /**
4
4
  * Base class for all PlayCanvas Web Components that initialize asynchronously.
@@ -38,7 +38,7 @@ class AsyncElement extends HTMLElement {
38
38
 
39
39
  /**
40
40
  * The ModuleElement interface provides properties and methods for manipulating
41
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-module/ | `<pc-module>`} elements.
41
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/ | `<pc-module>`} elements.
42
42
  * The ModuleElement interface also inherits the properties and methods of the
43
43
  * {@link HTMLElement} interface.
44
44
  */
@@ -50,22 +50,15 @@ class ModuleElement extends HTMLElement {
50
50
  }
51
51
  async loadModule() {
52
52
  const name = this.getAttribute('name');
53
- const glue = this.getAttribute('glue');
54
- const wasm = this.getAttribute('wasm');
55
- const fallback = this.getAttribute('fallback');
53
+ const glueUrl = this.getAttribute('glue');
54
+ const wasmUrl = this.getAttribute('wasm');
55
+ const fallbackUrl = this.getAttribute('fallback');
56
+ const config = { glueUrl, wasmUrl, fallbackUrl };
56
57
  if (name === 'Basis') {
57
- basisInitialize({
58
- glueUrl: glue,
59
- wasmUrl: wasm,
60
- fallbackUrl: fallback
61
- });
58
+ basisInitialize(config);
62
59
  }
63
60
  else {
64
- WasmModule.setConfig(name, {
65
- glueUrl: glue,
66
- wasmUrl: wasm,
67
- fallbackUrl: fallback
68
- });
61
+ WasmModule.setConfig(name, config);
69
62
  await new Promise((resolve) => {
70
63
  WasmModule.getInstance(name, () => resolve());
71
64
  });
@@ -79,7 +72,7 @@ customElements.define('pc-module', ModuleElement);
79
72
 
80
73
  /**
81
74
  * 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.
75
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/ | `<pc-app>`} elements.
83
76
  * The AppElement interface also inherits the properties and methods of the
84
77
  * {@link HTMLElement} interface.
85
78
  */
@@ -96,6 +89,7 @@ class AppElement extends AsyncElement {
96
89
  */
97
90
  this._canvas = null;
98
91
  this._alpha = true;
92
+ this._backend = 'webgl2';
99
93
  this._antialias = true;
100
94
  this._depth = true;
101
95
  this._stencil = true;
@@ -130,18 +124,84 @@ class AppElement extends AsyncElement {
130
124
  // Create and append the canvas to the element
131
125
  this._canvas = document.createElement('canvas');
132
126
  this.appendChild(this._canvas);
133
- // Initialize the PlayCanvas application
134
- this.app = new Application(this._canvas, {
135
- graphicsDeviceOptions: {
136
- alpha: this._alpha,
137
- antialias: this._antialias,
138
- depth: this._depth,
139
- stencil: this._stencil
140
- },
141
- keyboard: new Keyboard(window),
142
- mouse: new Mouse(this._canvas)
127
+ // Configure device types based on backend selection
128
+ const backendToDeviceTypes = {
129
+ webgpu: ['webgpu', 'webgl2'], // fallback to webgl2 if webgpu not available
130
+ webgl2: ['webgl2'],
131
+ null: ['null']
132
+ };
133
+ const deviceTypes = backendToDeviceTypes[this._backend] || [];
134
+ const device = await createGraphicsDevice(this._canvas, {
135
+ // @ts-ignore - alpha needs to be documented
136
+ alpha: this._alpha,
137
+ antialias: this._antialias,
138
+ depth: this._depth,
139
+ deviceTypes: deviceTypes,
140
+ stencil: this._stencil
143
141
  });
144
- this.app.graphicsDevice.maxPixelRatio = this._highResolution ? window.devicePixelRatio : 1;
142
+ device.maxPixelRatio = this._highResolution ? window.devicePixelRatio : 1;
143
+ const createOptions = new AppOptions();
144
+ createOptions.graphicsDevice = device;
145
+ createOptions.keyboard = new Keyboard(window);
146
+ createOptions.mouse = new Mouse(this._canvas);
147
+ createOptions.componentSystems = [
148
+ AnimComponentSystem,
149
+ AnimationComponentSystem,
150
+ AudioListenerComponentSystem,
151
+ ButtonComponentSystem,
152
+ CameraComponentSystem,
153
+ CollisionComponentSystem,
154
+ ElementComponentSystem,
155
+ GSplatComponentSystem,
156
+ JointComponentSystem,
157
+ LayoutChildComponentSystem,
158
+ LayoutGroupComponentSystem,
159
+ LightComponentSystem,
160
+ ModelComponentSystem,
161
+ ParticleSystemComponentSystem,
162
+ RenderComponentSystem,
163
+ RigidBodyComponentSystem,
164
+ ScreenComponentSystem,
165
+ ScriptComponentSystem,
166
+ ScrollbarComponentSystem,
167
+ ScrollViewComponentSystem,
168
+ SoundComponentSystem,
169
+ SpriteComponentSystem,
170
+ ZoneComponentSystem
171
+ ];
172
+ createOptions.resourceHandlers = [
173
+ AnimClipHandler,
174
+ AnimationHandler,
175
+ AnimStateGraphHandler,
176
+ AudioHandler,
177
+ BinaryHandler,
178
+ CssHandler,
179
+ ContainerHandler,
180
+ CubemapHandler,
181
+ FolderHandler,
182
+ FontHandler,
183
+ GSplatHandler,
184
+ HierarchyHandler,
185
+ HtmlHandler,
186
+ JsonHandler,
187
+ MaterialHandler,
188
+ ModelHandler,
189
+ RenderHandler,
190
+ ScriptHandler,
191
+ SceneHandler,
192
+ ShaderHandler,
193
+ SpriteHandler,
194
+ TemplateHandler,
195
+ TextHandler,
196
+ TextureAtlasHandler,
197
+ TextureHandler
198
+ ];
199
+ createOptions.soundManager = new SoundManager();
200
+ createOptions.lightmapper = Lightmapper;
201
+ createOptions.batchManager = BatchManager;
202
+ createOptions.xr = XrManager;
203
+ this.app = new AppBase(this._canvas);
204
+ this.app.init(createOptions);
145
205
  this.app.setCanvasFillMode(FILLMODE_FILL_WINDOW);
146
206
  this.app.setCanvasResolution(RESOLUTION_AUTO);
147
207
  this._pickerCreate();
@@ -369,6 +429,20 @@ class AppElement extends AsyncElement {
369
429
  get antialias() {
370
430
  return this._antialias;
371
431
  }
432
+ /**
433
+ * Sets the graphics backend.
434
+ * @param value - The graphics backend ('webgpu', 'webgl2', or 'null').
435
+ */
436
+ set backend(value) {
437
+ this._backend = value;
438
+ }
439
+ /**
440
+ * Gets the graphics backend.
441
+ * @returns The graphics backend.
442
+ */
443
+ get backend() {
444
+ return this._backend;
445
+ }
372
446
  /**
373
447
  * Sets the depth flag.
374
448
  * @param value - The depth flag.
@@ -424,7 +498,7 @@ class AppElement extends AsyncElement {
424
498
  return this._stencil;
425
499
  }
426
500
  static get observedAttributes() {
427
- return ['alpha', 'antialias', 'depth', 'stencil', 'high-resolution'];
501
+ return ['alpha', 'antialias', 'backend', 'depth', 'stencil', 'high-resolution'];
428
502
  }
429
503
  attributeChangedCallback(name, _oldValue, newValue) {
430
504
  switch (name) {
@@ -434,6 +508,11 @@ class AppElement extends AsyncElement {
434
508
  case 'antialias':
435
509
  this.antialias = newValue !== 'false';
436
510
  break;
511
+ case 'backend':
512
+ if (newValue === 'webgpu' || newValue === 'webgl2' || newValue === 'null') {
513
+ this.backend = newValue;
514
+ }
515
+ break;
437
516
  case 'depth':
438
517
  this.depth = newValue !== 'false';
439
518
  break;
@@ -663,7 +742,7 @@ const parseVec4 = (value) => {
663
742
 
664
743
  /**
665
744
  * The EntityElement interface provides properties and methods for manipulating
666
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
745
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
667
746
  * The EntityElement interface also inherits the properties and methods of the
668
747
  * {@link HTMLElement} interface.
669
748
  */
@@ -1200,7 +1279,7 @@ const processBufferView = (gltfBuffer, buffers, continuation) => {
1200
1279
  };
1201
1280
  /**
1202
1281
  * The AssetElement interface provides properties and methods for manipulating
1203
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
1282
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
1204
1283
  * The AssetElement interface also inherits the properties and methods of the
1205
1284
  * {@link HTMLElement} interface.
1206
1285
  */
@@ -1239,6 +1318,7 @@ class AssetElement extends HTMLElement {
1239
1318
  });
1240
1319
  }
1241
1320
  else {
1321
+ // @ts-ignore
1242
1322
  this.asset = new Asset(id, type, { url: src });
1243
1323
  }
1244
1324
  this.asset.preload = !this._lazy;
@@ -1361,7 +1441,7 @@ class ComponentElement extends AsyncElement {
1361
1441
 
1362
1442
  /**
1363
1443
  * The ListenerComponentElement interface provides properties and methods for manipulating
1364
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
1444
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
1365
1445
  * The ListenerComponentElement interface also inherits the properties and methods of the
1366
1446
  * {@link HTMLElement} interface.
1367
1447
  *
@@ -1393,7 +1473,7 @@ const tonemaps = new Map([
1393
1473
  ]);
1394
1474
  /**
1395
1475
  * The CameraComponentElement interface provides properties and methods for manipulating
1396
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
1476
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
1397
1477
  * The CameraComponentElement interface also inherits the properties and methods of the
1398
1478
  * {@link HTMLElement} interface.
1399
1479
  *
@@ -1874,7 +1954,7 @@ customElements.define('pc-camera', CameraComponentElement);
1874
1954
 
1875
1955
  /**
1876
1956
  * The CollisionComponentElement interface provides properties and methods for manipulating
1877
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
1957
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
1878
1958
  * The CollisionComponentElement interface also inherits the properties and methods of the
1879
1959
  * {@link HTMLElement} interface.
1880
1960
  *
@@ -2021,7 +2101,7 @@ customElements.define('pc-collision', CollisionComponentElement);
2021
2101
 
2022
2102
  /**
2023
2103
  * The ElementComponentElement interface provides properties and methods for manipulating
2024
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-element/ | `<pc-element>`} elements.
2104
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-element/ | `<pc-element>`} elements.
2025
2105
  * The ElementComponentElement interface also inherits the properties and methods of the
2026
2106
  * {@link HTMLElement} interface.
2027
2107
  *
@@ -2326,7 +2406,7 @@ const shadowTypes = new Map([
2326
2406
  ]);
2327
2407
  /**
2328
2408
  * The LightComponentElement interface provides properties and methods for manipulating
2329
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-light/ | `<pc-light>`} elements.
2409
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-light/ | `<pc-light>`} elements.
2330
2410
  * The LightComponentElement interface also inherits the properties and methods of the
2331
2411
  * {@link HTMLElement} interface.
2332
2412
  *
@@ -2723,7 +2803,7 @@ customElements.define('pc-light', LightComponentElement);
2723
2803
 
2724
2804
  /**
2725
2805
  * The ParticleSystemComponentElement interface provides properties and methods for manipulating
2726
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-particles/ | `<pc-particles>`} elements.
2806
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-particles/ | `<pc-particles>`} elements.
2727
2807
  * The ParticleSystemComponentElement interface also inherits the properties and methods of the
2728
2808
  * {@link HTMLElement} interface.
2729
2809
  *
@@ -2855,7 +2935,7 @@ customElements.define('pc-particles', ParticleSystemComponentElement);
2855
2935
 
2856
2936
  /**
2857
2937
  * The MaterialElement interface provides properties and methods for manipulating
2858
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-material/ | `<pc-material>`} elements.
2938
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/ | `<pc-material>`} elements.
2859
2939
  * The MaterialElement interface also inherits the properties and methods of the
2860
2940
  * {@link HTMLElement} interface.
2861
2941
  */
@@ -2972,7 +3052,7 @@ customElements.define('pc-material', MaterialElement);
2972
3052
 
2973
3053
  /**
2974
3054
  * The RenderComponentElement interface provides properties and methods for manipulating
2975
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-render/ | `<pc-render>`} elements.
3055
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-render/ | `<pc-render>`} elements.
2976
3056
  * The RenderComponentElement interface also inherits the properties and methods of the
2977
3057
  * {@link HTMLElement} interface.
2978
3058
  *
@@ -3095,7 +3175,7 @@ customElements.define('pc-render', RenderComponentElement);
3095
3175
 
3096
3176
  /**
3097
3177
  * The RigidBodyComponentElement interface provides properties and methods for manipulating
3098
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
3178
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
3099
3179
  * The RigidBodyComponentElement interface also inherits the properties and methods of the
3100
3180
  * {@link HTMLElement} interface.
3101
3181
  *
@@ -3283,7 +3363,7 @@ customElements.define('pc-rigidbody', RigidBodyComponentElement);
3283
3363
 
3284
3364
  /**
3285
3365
  * The ScreenComponentElement interface provides properties and methods for manipulating
3286
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
3366
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
3287
3367
  * The ScreenComponentElement interface also inherits the properties and methods of the
3288
3368
  * {@link HTMLElement} interface.
3289
3369
  *
@@ -3410,7 +3490,7 @@ customElements.define('pc-screen', ScreenComponentElement);
3410
3490
 
3411
3491
  /**
3412
3492
  * The ScriptComponentElement interface provides properties and methods for manipulating
3413
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
3493
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
3414
3494
  * The ScriptComponentElement interface also inherits the properties and methods of the
3415
3495
  * {@link HTMLElement} interface.
3416
3496
  *
@@ -3718,7 +3798,7 @@ customElements.define('pc-script', ScriptElement);
3718
3798
 
3719
3799
  /**
3720
3800
  * The SoundComponentElement interface provides properties and methods for manipulating
3721
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
3801
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
3722
3802
  * The SoundComponentElement interface also inherits the properties and methods of the
3723
3803
  * {@link HTMLElement} interface.
3724
3804
  *
@@ -3952,6 +4032,9 @@ class SoundSlotElement extends AsyncElement {
3952
4032
  }
3953
4033
  this.soundSlot = this.soundElement.component.addSlot(this._name, options);
3954
4034
  this.asset = this._asset;
4035
+ if (this._autoPlay) {
4036
+ this.soundSlot.play();
4037
+ }
3955
4038
  this._onReady();
3956
4039
  }
3957
4040
  disconnectedCallback() {
@@ -4161,7 +4244,7 @@ customElements.define('pc-sound', SoundSlotElement);
4161
4244
 
4162
4245
  /**
4163
4246
  * The SplatComponentElement interface provides properties and methods for manipulating
4164
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
4247
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
4165
4248
  * The SplatComponentElement interface also inherits the properties and methods of the
4166
4249
  * {@link HTMLElement} interface.
4167
4250
  *
@@ -4172,10 +4255,12 @@ class SplatComponentElement extends ComponentElement {
4172
4255
  constructor() {
4173
4256
  super('gsplat');
4174
4257
  this._asset = '';
4258
+ this._castShadows = false;
4175
4259
  }
4176
4260
  getInitialComponentData() {
4177
4261
  return {
4178
- asset: AssetElement.get(this._asset)
4262
+ asset: AssetElement.get(this._asset),
4263
+ castShadows: this._castShadows
4179
4264
  };
4180
4265
  }
4181
4266
  /**
@@ -4203,8 +4288,29 @@ class SplatComponentElement extends ComponentElement {
4203
4288
  get asset() {
4204
4289
  return this._asset;
4205
4290
  }
4291
+ /**
4292
+ * Sets whether the splat casts shadows.
4293
+ * @param value - Whether the splat casts shadows.
4294
+ */
4295
+ set castShadows(value) {
4296
+ this._castShadows = value;
4297
+ if (this.component) {
4298
+ this.component.castShadows = value;
4299
+ }
4300
+ }
4301
+ /**
4302
+ * Gets whether the splat casts shadows.
4303
+ * @returns Whether the splat casts shadows.
4304
+ */
4305
+ get castShadows() {
4306
+ return this._castShadows;
4307
+ }
4206
4308
  static get observedAttributes() {
4207
- return [...super.observedAttributes, 'asset'];
4309
+ return [
4310
+ ...super.observedAttributes,
4311
+ 'asset',
4312
+ 'cast-shadows'
4313
+ ];
4208
4314
  }
4209
4315
  attributeChangedCallback(name, _oldValue, newValue) {
4210
4316
  super.attributeChangedCallback(name, _oldValue, newValue);
@@ -4212,6 +4318,9 @@ class SplatComponentElement extends ComponentElement {
4212
4318
  case 'asset':
4213
4319
  this.asset = newValue;
4214
4320
  break;
4321
+ case 'cast-shadows':
4322
+ this.castShadows = this.hasAttribute('cast-shadows');
4323
+ break;
4215
4324
  }
4216
4325
  }
4217
4326
  }
@@ -4219,7 +4328,7 @@ customElements.define('pc-splat', SplatComponentElement);
4219
4328
 
4220
4329
  /**
4221
4330
  * The ModelElement interface provides properties and methods for manipulating
4222
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-model/ | `<pc-model>`} elements.
4331
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-model/ | `<pc-model>`} elements.
4223
4332
  * The ModelElement interface also inherits the properties and methods of the
4224
4333
  * {@link HTMLElement} interface.
4225
4334
  */
@@ -4315,7 +4424,7 @@ customElements.define('pc-model', ModelElement);
4315
4424
 
4316
4425
  /**
4317
4426
  * The SceneElement interface provides properties and methods for manipulating
4318
- * {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
4427
+ * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
4319
4428
  * The SceneElement interface also inherits the properties and methods of the
4320
4429
  * {@link HTMLElement} interface.
4321
4430
  */