@playcanvas/web-components 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pwc.js CHANGED
@@ -54,22 +54,15 @@
54
54
  }
55
55
  async loadModule() {
56
56
  const name = this.getAttribute('name');
57
- const glue = this.getAttribute('glue');
58
- const wasm = this.getAttribute('wasm');
59
- const fallback = this.getAttribute('fallback');
57
+ const glueUrl = this.getAttribute('glue');
58
+ const wasmUrl = this.getAttribute('wasm');
59
+ const fallbackUrl = this.getAttribute('fallback');
60
+ const config = { glueUrl, wasmUrl, fallbackUrl };
60
61
  if (name === 'Basis') {
61
- playcanvas.basisInitialize({
62
- glueUrl: glue,
63
- wasmUrl: wasm,
64
- fallbackUrl: fallback
65
- });
62
+ playcanvas.basisInitialize(config);
66
63
  }
67
64
  else {
68
- playcanvas.WasmModule.setConfig(name, {
69
- glueUrl: glue,
70
- wasmUrl: wasm,
71
- fallbackUrl: fallback
72
- });
65
+ playcanvas.WasmModule.setConfig(name, config);
73
66
  await new Promise((resolve) => {
74
67
  playcanvas.WasmModule.getInstance(name, () => resolve());
75
68
  });
@@ -1243,6 +1236,7 @@
1243
1236
  });
1244
1237
  }
1245
1238
  else {
1239
+ // @ts-ignore
1246
1240
  this.asset = new playcanvas.Asset(id, type, { url: src });
1247
1241
  }
1248
1242
  this.asset.preload = !this._lazy;
@@ -4176,10 +4170,12 @@
4176
4170
  constructor() {
4177
4171
  super('gsplat');
4178
4172
  this._asset = '';
4173
+ this._castShadows = false;
4179
4174
  }
4180
4175
  getInitialComponentData() {
4181
4176
  return {
4182
- asset: AssetElement.get(this._asset)
4177
+ asset: AssetElement.get(this._asset),
4178
+ castShadows: this._castShadows
4183
4179
  };
4184
4180
  }
4185
4181
  /**
@@ -4207,8 +4203,29 @@
4207
4203
  get asset() {
4208
4204
  return this._asset;
4209
4205
  }
4206
+ /**
4207
+ * Sets whether the splat casts shadows.
4208
+ * @param value - Whether the splat casts shadows.
4209
+ */
4210
+ set castShadows(value) {
4211
+ this._castShadows = value;
4212
+ if (this.component) {
4213
+ this.component.castShadows = value;
4214
+ }
4215
+ }
4216
+ /**
4217
+ * Gets whether the splat casts shadows.
4218
+ * @returns Whether the splat casts shadows.
4219
+ */
4220
+ get castShadows() {
4221
+ return this._castShadows;
4222
+ }
4210
4223
  static get observedAttributes() {
4211
- return [...super.observedAttributes, 'asset'];
4224
+ return [
4225
+ ...super.observedAttributes,
4226
+ 'asset',
4227
+ 'cast-shadows'
4228
+ ];
4212
4229
  }
4213
4230
  attributeChangedCallback(name, _oldValue, newValue) {
4214
4231
  super.attributeChangedCallback(name, _oldValue, newValue);
@@ -4216,6 +4233,9 @@
4216
4233
  case 'asset':
4217
4234
  this.asset = newValue;
4218
4235
  break;
4236
+ case 'cast-shadows':
4237
+ this.castShadows = this.hasAttribute('cast-shadows');
4238
+ break;
4219
4239
  }
4220
4240
  }
4221
4241
  }