@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/README.md +1 -1
- package/dist/components/camera-component.d.ts +2 -2
- package/dist/components/light-component.d.ts +1 -1
- package/dist/components/screen-component.d.ts +1 -1
- package/dist/components/splat-component.d.ts +12 -0
- package/dist/pwc.cjs +35 -15
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +35 -15
- 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 +35 -15
- package/dist/pwc.mjs.map +1 -1
- package/package.json +10 -10
- package/src/asset.ts +1 -0
- package/src/components/splat-component.ts +32 -3
- package/src/module.ts +6 -13
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/playcanvas/web-components/blob/main/LICENSE)
|
|
6
6
|
[](https://github.com/playcanvas/web-components/actions/workflows/deploy.yml)
|
|
7
7
|
|
|
8
|
-
| [User Guide](https://developer.playcanvas.com/user-manual/engine/web-components) | [API Reference](https://api.playcanvas.com/
|
|
8
|
+
| [User Guide](https://developer.playcanvas.com/user-manual/engine/web-components) | [API Reference](https://api.playcanvas.com/web-components/) | [Examples](https://playcanvas.github.io/web-components/examples) | [Blog](https://blog.playcanvas.com/) | [Forum](https://forum.playcanvas.com/) | [Discord](https://discord.gg/RSaMRzg) |
|
|
9
9
|
|
|
10
10
|
PlayCanvas Web Components are a set of custom HTML elements for building 3D interactive web apps. Using the declarative nature of HTML makes it both easy and fun to incorporate 3D into your website. Check out this simple example:
|
|
11
11
|
|
|
@@ -39,7 +39,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
39
39
|
flipFaces: boolean;
|
|
40
40
|
fov: number;
|
|
41
41
|
frustumCulling: boolean;
|
|
42
|
-
gammaCorrection:
|
|
42
|
+
gammaCorrection: 0 | 1;
|
|
43
43
|
horizontalFov: boolean;
|
|
44
44
|
nearClip: number;
|
|
45
45
|
orthographic: boolean;
|
|
@@ -47,7 +47,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
47
47
|
priority: number;
|
|
48
48
|
rect: Vec4;
|
|
49
49
|
scissorRect: Vec4;
|
|
50
|
-
toneMapping:
|
|
50
|
+
toneMapping: 0 | 2 | 1 | 3 | 4 | 5 | 6 | undefined;
|
|
51
51
|
};
|
|
52
52
|
get xrAvailable(): boolean | null | undefined;
|
|
53
53
|
/**
|
|
@@ -38,7 +38,7 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
38
38
|
shadowDistance: number;
|
|
39
39
|
shadowIntensity: number;
|
|
40
40
|
shadowResolution: number;
|
|
41
|
-
shadowType:
|
|
41
|
+
shadowType: 0 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
|
|
42
42
|
type: string;
|
|
43
43
|
vsmBias: number;
|
|
44
44
|
vsmBlurSize: number;
|
|
@@ -10,10 +10,12 @@ import { ComponentElement } from './component';
|
|
|
10
10
|
*/
|
|
11
11
|
declare class SplatComponentElement extends ComponentElement {
|
|
12
12
|
private _asset;
|
|
13
|
+
private _castShadows;
|
|
13
14
|
/** @ignore */
|
|
14
15
|
constructor();
|
|
15
16
|
getInitialComponentData(): {
|
|
16
17
|
asset: import("playcanvas").Asset | null | undefined;
|
|
18
|
+
castShadows: boolean;
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* Gets the underlying PlayCanvas splat component.
|
|
@@ -30,6 +32,16 @@ declare class SplatComponentElement extends ComponentElement {
|
|
|
30
32
|
* @returns The asset ID.
|
|
31
33
|
*/
|
|
32
34
|
get asset(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Sets whether the splat casts shadows.
|
|
37
|
+
* @param value - Whether the splat casts shadows.
|
|
38
|
+
*/
|
|
39
|
+
set castShadows(value: boolean);
|
|
40
|
+
/**
|
|
41
|
+
* Gets whether the splat casts shadows.
|
|
42
|
+
* @returns Whether the splat casts shadows.
|
|
43
|
+
*/
|
|
44
|
+
get castShadows(): boolean;
|
|
33
45
|
static get observedAttributes(): string[];
|
|
34
46
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
35
47
|
}
|
package/dist/pwc.cjs
CHANGED
|
@@ -52,22 +52,15 @@ class ModuleElement extends HTMLElement {
|
|
|
52
52
|
}
|
|
53
53
|
async loadModule() {
|
|
54
54
|
const name = this.getAttribute('name');
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
55
|
+
const glueUrl = this.getAttribute('glue');
|
|
56
|
+
const wasmUrl = this.getAttribute('wasm');
|
|
57
|
+
const fallbackUrl = this.getAttribute('fallback');
|
|
58
|
+
const config = { glueUrl, wasmUrl, fallbackUrl };
|
|
58
59
|
if (name === 'Basis') {
|
|
59
|
-
playcanvas.basisInitialize(
|
|
60
|
-
glueUrl: glue,
|
|
61
|
-
wasmUrl: wasm,
|
|
62
|
-
fallbackUrl: fallback
|
|
63
|
-
});
|
|
60
|
+
playcanvas.basisInitialize(config);
|
|
64
61
|
}
|
|
65
62
|
else {
|
|
66
|
-
playcanvas.WasmModule.setConfig(name,
|
|
67
|
-
glueUrl: glue,
|
|
68
|
-
wasmUrl: wasm,
|
|
69
|
-
fallbackUrl: fallback
|
|
70
|
-
});
|
|
63
|
+
playcanvas.WasmModule.setConfig(name, config);
|
|
71
64
|
await new Promise((resolve) => {
|
|
72
65
|
playcanvas.WasmModule.getInstance(name, () => resolve());
|
|
73
66
|
});
|
|
@@ -1241,6 +1234,7 @@ class AssetElement extends HTMLElement {
|
|
|
1241
1234
|
});
|
|
1242
1235
|
}
|
|
1243
1236
|
else {
|
|
1237
|
+
// @ts-ignore
|
|
1244
1238
|
this.asset = new playcanvas.Asset(id, type, { url: src });
|
|
1245
1239
|
}
|
|
1246
1240
|
this.asset.preload = !this._lazy;
|
|
@@ -4174,10 +4168,12 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4174
4168
|
constructor() {
|
|
4175
4169
|
super('gsplat');
|
|
4176
4170
|
this._asset = '';
|
|
4171
|
+
this._castShadows = false;
|
|
4177
4172
|
}
|
|
4178
4173
|
getInitialComponentData() {
|
|
4179
4174
|
return {
|
|
4180
|
-
asset: AssetElement.get(this._asset)
|
|
4175
|
+
asset: AssetElement.get(this._asset),
|
|
4176
|
+
castShadows: this._castShadows
|
|
4181
4177
|
};
|
|
4182
4178
|
}
|
|
4183
4179
|
/**
|
|
@@ -4205,8 +4201,29 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4205
4201
|
get asset() {
|
|
4206
4202
|
return this._asset;
|
|
4207
4203
|
}
|
|
4204
|
+
/**
|
|
4205
|
+
* Sets whether the splat casts shadows.
|
|
4206
|
+
* @param value - Whether the splat casts shadows.
|
|
4207
|
+
*/
|
|
4208
|
+
set castShadows(value) {
|
|
4209
|
+
this._castShadows = value;
|
|
4210
|
+
if (this.component) {
|
|
4211
|
+
this.component.castShadows = value;
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
/**
|
|
4215
|
+
* Gets whether the splat casts shadows.
|
|
4216
|
+
* @returns Whether the splat casts shadows.
|
|
4217
|
+
*/
|
|
4218
|
+
get castShadows() {
|
|
4219
|
+
return this._castShadows;
|
|
4220
|
+
}
|
|
4208
4221
|
static get observedAttributes() {
|
|
4209
|
-
return [
|
|
4222
|
+
return [
|
|
4223
|
+
...super.observedAttributes,
|
|
4224
|
+
'asset',
|
|
4225
|
+
'cast-shadows'
|
|
4226
|
+
];
|
|
4210
4227
|
}
|
|
4211
4228
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
4212
4229
|
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
@@ -4214,6 +4231,9 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4214
4231
|
case 'asset':
|
|
4215
4232
|
this.asset = newValue;
|
|
4216
4233
|
break;
|
|
4234
|
+
case 'cast-shadows':
|
|
4235
|
+
this.castShadows = this.hasAttribute('cast-shadows');
|
|
4236
|
+
break;
|
|
4217
4237
|
}
|
|
4218
4238
|
}
|
|
4219
4239
|
}
|