@playcanvas/web-components 0.2.4 → 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/README.md +1 -1
- package/dist/components/camera-component.d.ts +2 -2
- package/dist/components/light-component.d.ts +13 -1
- package/dist/components/screen-component.d.ts +1 -1
- package/dist/components/splat-component.d.ts +12 -0
- package/dist/pwc.cjs +60 -17
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +60 -17
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.mjs +60 -17
- package/dist/pwc.mjs.map +1 -1
- package/package.json +11 -11
- package/src/asset.ts +2 -1
- package/src/components/light-component.ts +28 -2
- package/src/components/splat-component.ts +32 -3
- package/src/module.ts +6 -13
package/dist/pwc.mjs
CHANGED
|
@@ -50,22 +50,15 @@ class ModuleElement extends HTMLElement {
|
|
|
50
50
|
}
|
|
51
51
|
async loadModule() {
|
|
52
52
|
const name = this.getAttribute('name');
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
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
|
});
|
|
@@ -1239,6 +1232,7 @@ class AssetElement extends HTMLElement {
|
|
|
1239
1232
|
});
|
|
1240
1233
|
}
|
|
1241
1234
|
else {
|
|
1235
|
+
// @ts-ignore
|
|
1242
1236
|
this.asset = new Asset(id, type, { url: src });
|
|
1243
1237
|
}
|
|
1244
1238
|
this.asset.preload = !this._lazy;
|
|
@@ -2350,6 +2344,7 @@ class LightComponentElement extends ComponentElement {
|
|
|
2350
2344
|
this._shadowType = 'pcf3-32f';
|
|
2351
2345
|
this._type = 'directional';
|
|
2352
2346
|
this._vsmBias = 0.01;
|
|
2347
|
+
this._vsmBlurSize = 11;
|
|
2353
2348
|
}
|
|
2354
2349
|
getInitialComponentData() {
|
|
2355
2350
|
return {
|
|
@@ -2366,7 +2361,8 @@ class LightComponentElement extends ComponentElement {
|
|
|
2366
2361
|
shadowResolution: this._shadowResolution,
|
|
2367
2362
|
shadowType: shadowTypes.get(this._shadowType),
|
|
2368
2363
|
type: this._type,
|
|
2369
|
-
vsmBias: this._vsmBias
|
|
2364
|
+
vsmBias: this._vsmBias,
|
|
2365
|
+
vsmBlurSize: this._vsmBlurSize
|
|
2370
2366
|
};
|
|
2371
2367
|
}
|
|
2372
2368
|
/**
|
|
@@ -2629,6 +2625,23 @@ class LightComponentElement extends ComponentElement {
|
|
|
2629
2625
|
get vsmBias() {
|
|
2630
2626
|
return this._vsmBias;
|
|
2631
2627
|
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Sets the VSM blur size of the light. Minimum is 1, maximum is 25. Default is 11.
|
|
2630
|
+
* @param value - The VSM blur size.
|
|
2631
|
+
*/
|
|
2632
|
+
set vsmBlurSize(value) {
|
|
2633
|
+
this._vsmBlurSize = value;
|
|
2634
|
+
if (this.component) {
|
|
2635
|
+
this.component.vsmBlurSize = value;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* Gets the VSM blur size of the light.
|
|
2640
|
+
* @returns The VSM blur size.
|
|
2641
|
+
*/
|
|
2642
|
+
get vsmBlurSize() {
|
|
2643
|
+
return this._vsmBlurSize;
|
|
2644
|
+
}
|
|
2632
2645
|
static get observedAttributes() {
|
|
2633
2646
|
return [
|
|
2634
2647
|
...super.observedAttributes,
|
|
@@ -2645,7 +2658,8 @@ class LightComponentElement extends ComponentElement {
|
|
|
2645
2658
|
'shadow-resolution',
|
|
2646
2659
|
'shadow-type',
|
|
2647
2660
|
'type',
|
|
2648
|
-
'vsm-bias'
|
|
2661
|
+
'vsm-bias',
|
|
2662
|
+
'vsm-blur-size'
|
|
2649
2663
|
];
|
|
2650
2664
|
}
|
|
2651
2665
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
@@ -2693,6 +2707,9 @@ class LightComponentElement extends ComponentElement {
|
|
|
2693
2707
|
case 'vsm-bias':
|
|
2694
2708
|
this.vsmBias = Number(newValue);
|
|
2695
2709
|
break;
|
|
2710
|
+
case 'vsm-blur-size':
|
|
2711
|
+
this.vsmBlurSize = Number(newValue);
|
|
2712
|
+
break;
|
|
2696
2713
|
}
|
|
2697
2714
|
}
|
|
2698
2715
|
}
|
|
@@ -4149,10 +4166,12 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4149
4166
|
constructor() {
|
|
4150
4167
|
super('gsplat');
|
|
4151
4168
|
this._asset = '';
|
|
4169
|
+
this._castShadows = false;
|
|
4152
4170
|
}
|
|
4153
4171
|
getInitialComponentData() {
|
|
4154
4172
|
return {
|
|
4155
|
-
asset: AssetElement.get(this._asset)
|
|
4173
|
+
asset: AssetElement.get(this._asset),
|
|
4174
|
+
castShadows: this._castShadows
|
|
4156
4175
|
};
|
|
4157
4176
|
}
|
|
4158
4177
|
/**
|
|
@@ -4180,8 +4199,29 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4180
4199
|
get asset() {
|
|
4181
4200
|
return this._asset;
|
|
4182
4201
|
}
|
|
4202
|
+
/**
|
|
4203
|
+
* Sets whether the splat casts shadows.
|
|
4204
|
+
* @param value - Whether the splat casts shadows.
|
|
4205
|
+
*/
|
|
4206
|
+
set castShadows(value) {
|
|
4207
|
+
this._castShadows = value;
|
|
4208
|
+
if (this.component) {
|
|
4209
|
+
this.component.castShadows = value;
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
/**
|
|
4213
|
+
* Gets whether the splat casts shadows.
|
|
4214
|
+
* @returns Whether the splat casts shadows.
|
|
4215
|
+
*/
|
|
4216
|
+
get castShadows() {
|
|
4217
|
+
return this._castShadows;
|
|
4218
|
+
}
|
|
4183
4219
|
static get observedAttributes() {
|
|
4184
|
-
return [
|
|
4220
|
+
return [
|
|
4221
|
+
...super.observedAttributes,
|
|
4222
|
+
'asset',
|
|
4223
|
+
'cast-shadows'
|
|
4224
|
+
];
|
|
4185
4225
|
}
|
|
4186
4226
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
4187
4227
|
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
@@ -4189,6 +4229,9 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4189
4229
|
case 'asset':
|
|
4190
4230
|
this.asset = newValue;
|
|
4191
4231
|
break;
|
|
4232
|
+
case 'cast-shadows':
|
|
4233
|
+
this.castShadows = this.hasAttribute('cast-shadows');
|
|
4234
|
+
break;
|
|
4192
4235
|
}
|
|
4193
4236
|
}
|
|
4194
4237
|
}
|