@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.js
CHANGED
|
@@ -54,22 +54,15 @@
|
|
|
54
54
|
}
|
|
55
55
|
async loadModule() {
|
|
56
56
|
const name = this.getAttribute('name');
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
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;
|
|
@@ -2354,6 +2348,7 @@
|
|
|
2354
2348
|
this._shadowType = 'pcf3-32f';
|
|
2355
2349
|
this._type = 'directional';
|
|
2356
2350
|
this._vsmBias = 0.01;
|
|
2351
|
+
this._vsmBlurSize = 11;
|
|
2357
2352
|
}
|
|
2358
2353
|
getInitialComponentData() {
|
|
2359
2354
|
return {
|
|
@@ -2370,7 +2365,8 @@
|
|
|
2370
2365
|
shadowResolution: this._shadowResolution,
|
|
2371
2366
|
shadowType: shadowTypes.get(this._shadowType),
|
|
2372
2367
|
type: this._type,
|
|
2373
|
-
vsmBias: this._vsmBias
|
|
2368
|
+
vsmBias: this._vsmBias,
|
|
2369
|
+
vsmBlurSize: this._vsmBlurSize
|
|
2374
2370
|
};
|
|
2375
2371
|
}
|
|
2376
2372
|
/**
|
|
@@ -2633,6 +2629,23 @@
|
|
|
2633
2629
|
get vsmBias() {
|
|
2634
2630
|
return this._vsmBias;
|
|
2635
2631
|
}
|
|
2632
|
+
/**
|
|
2633
|
+
* Sets the VSM blur size of the light. Minimum is 1, maximum is 25. Default is 11.
|
|
2634
|
+
* @param value - The VSM blur size.
|
|
2635
|
+
*/
|
|
2636
|
+
set vsmBlurSize(value) {
|
|
2637
|
+
this._vsmBlurSize = value;
|
|
2638
|
+
if (this.component) {
|
|
2639
|
+
this.component.vsmBlurSize = value;
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Gets the VSM blur size of the light.
|
|
2644
|
+
* @returns The VSM blur size.
|
|
2645
|
+
*/
|
|
2646
|
+
get vsmBlurSize() {
|
|
2647
|
+
return this._vsmBlurSize;
|
|
2648
|
+
}
|
|
2636
2649
|
static get observedAttributes() {
|
|
2637
2650
|
return [
|
|
2638
2651
|
...super.observedAttributes,
|
|
@@ -2649,7 +2662,8 @@
|
|
|
2649
2662
|
'shadow-resolution',
|
|
2650
2663
|
'shadow-type',
|
|
2651
2664
|
'type',
|
|
2652
|
-
'vsm-bias'
|
|
2665
|
+
'vsm-bias',
|
|
2666
|
+
'vsm-blur-size'
|
|
2653
2667
|
];
|
|
2654
2668
|
}
|
|
2655
2669
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
@@ -2697,6 +2711,9 @@
|
|
|
2697
2711
|
case 'vsm-bias':
|
|
2698
2712
|
this.vsmBias = Number(newValue);
|
|
2699
2713
|
break;
|
|
2714
|
+
case 'vsm-blur-size':
|
|
2715
|
+
this.vsmBlurSize = Number(newValue);
|
|
2716
|
+
break;
|
|
2700
2717
|
}
|
|
2701
2718
|
}
|
|
2702
2719
|
}
|
|
@@ -4153,10 +4170,12 @@
|
|
|
4153
4170
|
constructor() {
|
|
4154
4171
|
super('gsplat');
|
|
4155
4172
|
this._asset = '';
|
|
4173
|
+
this._castShadows = false;
|
|
4156
4174
|
}
|
|
4157
4175
|
getInitialComponentData() {
|
|
4158
4176
|
return {
|
|
4159
|
-
asset: AssetElement.get(this._asset)
|
|
4177
|
+
asset: AssetElement.get(this._asset),
|
|
4178
|
+
castShadows: this._castShadows
|
|
4160
4179
|
};
|
|
4161
4180
|
}
|
|
4162
4181
|
/**
|
|
@@ -4184,8 +4203,29 @@
|
|
|
4184
4203
|
get asset() {
|
|
4185
4204
|
return this._asset;
|
|
4186
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
|
+
}
|
|
4187
4223
|
static get observedAttributes() {
|
|
4188
|
-
return [
|
|
4224
|
+
return [
|
|
4225
|
+
...super.observedAttributes,
|
|
4226
|
+
'asset',
|
|
4227
|
+
'cast-shadows'
|
|
4228
|
+
];
|
|
4189
4229
|
}
|
|
4190
4230
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
4191
4231
|
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
@@ -4193,6 +4233,9 @@
|
|
|
4193
4233
|
case 'asset':
|
|
4194
4234
|
this.asset = newValue;
|
|
4195
4235
|
break;
|
|
4236
|
+
case 'cast-shadows':
|
|
4237
|
+
this.castShadows = this.hasAttribute('cast-shadows');
|
|
4238
|
+
break;
|
|
4196
4239
|
}
|
|
4197
4240
|
}
|
|
4198
4241
|
}
|