@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.
- package/README.md +1 -1
- package/dist/app.d.ts +14 -3
- package/dist/asset.d.ts +1 -1
- package/dist/components/camera-component.d.ts +3 -3
- package/dist/components/collision-component.d.ts +1 -1
- package/dist/components/element-component.d.ts +1 -1
- package/dist/components/light-component.d.ts +2 -2
- package/dist/components/listener-component.d.ts +1 -1
- package/dist/components/particlesystem-component.d.ts +1 -1
- package/dist/components/render-component.d.ts +1 -1
- package/dist/components/rigidbody-component.d.ts +1 -1
- package/dist/components/screen-component.d.ts +2 -2
- package/dist/components/script-component.d.ts +1 -1
- package/dist/components/sound-component.d.ts +1 -1
- package/dist/components/splat-component.d.ts +13 -1
- package/dist/entity.d.ts +4 -4
- package/dist/material.d.ts +1 -1
- package/dist/model.d.ts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/pwc.cjs +155 -46
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +155 -46
- 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 +156 -47
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +1 -1
- package/package.json +16 -16
- package/src/app.ts +170 -15
- package/src/asset.ts +2 -1
- package/src/components/camera-component.ts +1 -1
- package/src/components/collision-component.ts +1 -1
- package/src/components/element-component.ts +1 -1
- package/src/components/light-component.ts +1 -1
- package/src/components/listener-component.ts +1 -1
- package/src/components/particlesystem-component.ts +1 -1
- package/src/components/render-component.ts +1 -1
- package/src/components/rigidbody-component.ts +1 -1
- package/src/components/screen-component.ts +1 -1
- package/src/components/script-component.ts +1 -1
- package/src/components/sound-component.ts +1 -1
- package/src/components/sound-slot.ts +3 -0
- package/src/components/splat-component.ts +33 -4
- package/src/entity.ts +4 -4
- package/src/material.ts +1 -1
- package/src/model.ts +1 -1
- package/src/module.ts +7 -14
- package/src/scene.ts +1 -1
package/dist/pwc.cjs
CHANGED
|
@@ -40,7 +40,7 @@ class AsyncElement extends HTMLElement {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* The ModuleElement interface provides properties and methods for manipulating
|
|
43
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
43
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-module/ | `<pc-module>`} elements.
|
|
44
44
|
* The ModuleElement interface also inherits the properties and methods of the
|
|
45
45
|
* {@link HTMLElement} interface.
|
|
46
46
|
*/
|
|
@@ -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
|
});
|
|
@@ -81,7 +74,7 @@ customElements.define('pc-module', ModuleElement);
|
|
|
81
74
|
|
|
82
75
|
/**
|
|
83
76
|
* The AppElement interface provides properties and methods for manipulating
|
|
84
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
77
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-app/ | `<pc-app>`} elements.
|
|
85
78
|
* The AppElement interface also inherits the properties and methods of the
|
|
86
79
|
* {@link HTMLElement} interface.
|
|
87
80
|
*/
|
|
@@ -98,6 +91,7 @@ class AppElement extends AsyncElement {
|
|
|
98
91
|
*/
|
|
99
92
|
this._canvas = null;
|
|
100
93
|
this._alpha = true;
|
|
94
|
+
this._backend = 'webgl2';
|
|
101
95
|
this._antialias = true;
|
|
102
96
|
this._depth = true;
|
|
103
97
|
this._stencil = true;
|
|
@@ -132,18 +126,84 @@ class AppElement extends AsyncElement {
|
|
|
132
126
|
// Create and append the canvas to the element
|
|
133
127
|
this._canvas = document.createElement('canvas');
|
|
134
128
|
this.appendChild(this._canvas);
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
129
|
+
// Configure device types based on backend selection
|
|
130
|
+
const backendToDeviceTypes = {
|
|
131
|
+
webgpu: ['webgpu', 'webgl2'], // fallback to webgl2 if webgpu not available
|
|
132
|
+
webgl2: ['webgl2'],
|
|
133
|
+
null: ['null']
|
|
134
|
+
};
|
|
135
|
+
const deviceTypes = backendToDeviceTypes[this._backend] || [];
|
|
136
|
+
const device = await playcanvas.createGraphicsDevice(this._canvas, {
|
|
137
|
+
// @ts-ignore - alpha needs to be documented
|
|
138
|
+
alpha: this._alpha,
|
|
139
|
+
antialias: this._antialias,
|
|
140
|
+
depth: this._depth,
|
|
141
|
+
deviceTypes: deviceTypes,
|
|
142
|
+
stencil: this._stencil
|
|
145
143
|
});
|
|
146
|
-
|
|
144
|
+
device.maxPixelRatio = this._highResolution ? window.devicePixelRatio : 1;
|
|
145
|
+
const createOptions = new playcanvas.AppOptions();
|
|
146
|
+
createOptions.graphicsDevice = device;
|
|
147
|
+
createOptions.keyboard = new playcanvas.Keyboard(window);
|
|
148
|
+
createOptions.mouse = new playcanvas.Mouse(this._canvas);
|
|
149
|
+
createOptions.componentSystems = [
|
|
150
|
+
playcanvas.AnimComponentSystem,
|
|
151
|
+
playcanvas.AnimationComponentSystem,
|
|
152
|
+
playcanvas.AudioListenerComponentSystem,
|
|
153
|
+
playcanvas.ButtonComponentSystem,
|
|
154
|
+
playcanvas.CameraComponentSystem,
|
|
155
|
+
playcanvas.CollisionComponentSystem,
|
|
156
|
+
playcanvas.ElementComponentSystem,
|
|
157
|
+
playcanvas.GSplatComponentSystem,
|
|
158
|
+
playcanvas.JointComponentSystem,
|
|
159
|
+
playcanvas.LayoutChildComponentSystem,
|
|
160
|
+
playcanvas.LayoutGroupComponentSystem,
|
|
161
|
+
playcanvas.LightComponentSystem,
|
|
162
|
+
playcanvas.ModelComponentSystem,
|
|
163
|
+
playcanvas.ParticleSystemComponentSystem,
|
|
164
|
+
playcanvas.RenderComponentSystem,
|
|
165
|
+
playcanvas.RigidBodyComponentSystem,
|
|
166
|
+
playcanvas.ScreenComponentSystem,
|
|
167
|
+
playcanvas.ScriptComponentSystem,
|
|
168
|
+
playcanvas.ScrollbarComponentSystem,
|
|
169
|
+
playcanvas.ScrollViewComponentSystem,
|
|
170
|
+
playcanvas.SoundComponentSystem,
|
|
171
|
+
playcanvas.SpriteComponentSystem,
|
|
172
|
+
playcanvas.ZoneComponentSystem
|
|
173
|
+
];
|
|
174
|
+
createOptions.resourceHandlers = [
|
|
175
|
+
playcanvas.AnimClipHandler,
|
|
176
|
+
playcanvas.AnimationHandler,
|
|
177
|
+
playcanvas.AnimStateGraphHandler,
|
|
178
|
+
playcanvas.AudioHandler,
|
|
179
|
+
playcanvas.BinaryHandler,
|
|
180
|
+
playcanvas.CssHandler,
|
|
181
|
+
playcanvas.ContainerHandler,
|
|
182
|
+
playcanvas.CubemapHandler,
|
|
183
|
+
playcanvas.FolderHandler,
|
|
184
|
+
playcanvas.FontHandler,
|
|
185
|
+
playcanvas.GSplatHandler,
|
|
186
|
+
playcanvas.HierarchyHandler,
|
|
187
|
+
playcanvas.HtmlHandler,
|
|
188
|
+
playcanvas.JsonHandler,
|
|
189
|
+
playcanvas.MaterialHandler,
|
|
190
|
+
playcanvas.ModelHandler,
|
|
191
|
+
playcanvas.RenderHandler,
|
|
192
|
+
playcanvas.ScriptHandler,
|
|
193
|
+
playcanvas.SceneHandler,
|
|
194
|
+
playcanvas.ShaderHandler,
|
|
195
|
+
playcanvas.SpriteHandler,
|
|
196
|
+
playcanvas.TemplateHandler,
|
|
197
|
+
playcanvas.TextHandler,
|
|
198
|
+
playcanvas.TextureAtlasHandler,
|
|
199
|
+
playcanvas.TextureHandler
|
|
200
|
+
];
|
|
201
|
+
createOptions.soundManager = new playcanvas.SoundManager();
|
|
202
|
+
createOptions.lightmapper = playcanvas.Lightmapper;
|
|
203
|
+
createOptions.batchManager = playcanvas.BatchManager;
|
|
204
|
+
createOptions.xr = playcanvas.XrManager;
|
|
205
|
+
this.app = new playcanvas.AppBase(this._canvas);
|
|
206
|
+
this.app.init(createOptions);
|
|
147
207
|
this.app.setCanvasFillMode(playcanvas.FILLMODE_FILL_WINDOW);
|
|
148
208
|
this.app.setCanvasResolution(playcanvas.RESOLUTION_AUTO);
|
|
149
209
|
this._pickerCreate();
|
|
@@ -371,6 +431,20 @@ class AppElement extends AsyncElement {
|
|
|
371
431
|
get antialias() {
|
|
372
432
|
return this._antialias;
|
|
373
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Sets the graphics backend.
|
|
436
|
+
* @param value - The graphics backend ('webgpu', 'webgl2', or 'null').
|
|
437
|
+
*/
|
|
438
|
+
set backend(value) {
|
|
439
|
+
this._backend = value;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Gets the graphics backend.
|
|
443
|
+
* @returns The graphics backend.
|
|
444
|
+
*/
|
|
445
|
+
get backend() {
|
|
446
|
+
return this._backend;
|
|
447
|
+
}
|
|
374
448
|
/**
|
|
375
449
|
* Sets the depth flag.
|
|
376
450
|
* @param value - The depth flag.
|
|
@@ -426,7 +500,7 @@ class AppElement extends AsyncElement {
|
|
|
426
500
|
return this._stencil;
|
|
427
501
|
}
|
|
428
502
|
static get observedAttributes() {
|
|
429
|
-
return ['alpha', 'antialias', 'depth', 'stencil', 'high-resolution'];
|
|
503
|
+
return ['alpha', 'antialias', 'backend', 'depth', 'stencil', 'high-resolution'];
|
|
430
504
|
}
|
|
431
505
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
432
506
|
switch (name) {
|
|
@@ -436,6 +510,11 @@ class AppElement extends AsyncElement {
|
|
|
436
510
|
case 'antialias':
|
|
437
511
|
this.antialias = newValue !== 'false';
|
|
438
512
|
break;
|
|
513
|
+
case 'backend':
|
|
514
|
+
if (newValue === 'webgpu' || newValue === 'webgl2' || newValue === 'null') {
|
|
515
|
+
this.backend = newValue;
|
|
516
|
+
}
|
|
517
|
+
break;
|
|
439
518
|
case 'depth':
|
|
440
519
|
this.depth = newValue !== 'false';
|
|
441
520
|
break;
|
|
@@ -665,7 +744,7 @@ const parseVec4 = (value) => {
|
|
|
665
744
|
|
|
666
745
|
/**
|
|
667
746
|
* The EntityElement interface provides properties and methods for manipulating
|
|
668
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
747
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
|
|
669
748
|
* The EntityElement interface also inherits the properties and methods of the
|
|
670
749
|
* {@link HTMLElement} interface.
|
|
671
750
|
*/
|
|
@@ -1202,7 +1281,7 @@ const processBufferView = (gltfBuffer, buffers, continuation) => {
|
|
|
1202
1281
|
};
|
|
1203
1282
|
/**
|
|
1204
1283
|
* The AssetElement interface provides properties and methods for manipulating
|
|
1205
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
1284
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
|
|
1206
1285
|
* The AssetElement interface also inherits the properties and methods of the
|
|
1207
1286
|
* {@link HTMLElement} interface.
|
|
1208
1287
|
*/
|
|
@@ -1241,6 +1320,7 @@ class AssetElement extends HTMLElement {
|
|
|
1241
1320
|
});
|
|
1242
1321
|
}
|
|
1243
1322
|
else {
|
|
1323
|
+
// @ts-ignore
|
|
1244
1324
|
this.asset = new playcanvas.Asset(id, type, { url: src });
|
|
1245
1325
|
}
|
|
1246
1326
|
this.asset.preload = !this._lazy;
|
|
@@ -1363,7 +1443,7 @@ class ComponentElement extends AsyncElement {
|
|
|
1363
1443
|
|
|
1364
1444
|
/**
|
|
1365
1445
|
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
1366
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
1446
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
|
|
1367
1447
|
* The ListenerComponentElement interface also inherits the properties and methods of the
|
|
1368
1448
|
* {@link HTMLElement} interface.
|
|
1369
1449
|
*
|
|
@@ -1395,7 +1475,7 @@ const tonemaps = new Map([
|
|
|
1395
1475
|
]);
|
|
1396
1476
|
/**
|
|
1397
1477
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
1398
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
1478
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
1399
1479
|
* The CameraComponentElement interface also inherits the properties and methods of the
|
|
1400
1480
|
* {@link HTMLElement} interface.
|
|
1401
1481
|
*
|
|
@@ -1876,7 +1956,7 @@ customElements.define('pc-camera', CameraComponentElement);
|
|
|
1876
1956
|
|
|
1877
1957
|
/**
|
|
1878
1958
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
1879
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
1959
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
1880
1960
|
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
1881
1961
|
* {@link HTMLElement} interface.
|
|
1882
1962
|
*
|
|
@@ -2023,7 +2103,7 @@ customElements.define('pc-collision', CollisionComponentElement);
|
|
|
2023
2103
|
|
|
2024
2104
|
/**
|
|
2025
2105
|
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
2026
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
2106
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-element/ | `<pc-element>`} elements.
|
|
2027
2107
|
* The ElementComponentElement interface also inherits the properties and methods of the
|
|
2028
2108
|
* {@link HTMLElement} interface.
|
|
2029
2109
|
*
|
|
@@ -2328,7 +2408,7 @@ const shadowTypes = new Map([
|
|
|
2328
2408
|
]);
|
|
2329
2409
|
/**
|
|
2330
2410
|
* The LightComponentElement interface provides properties and methods for manipulating
|
|
2331
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
2411
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-light/ | `<pc-light>`} elements.
|
|
2332
2412
|
* The LightComponentElement interface also inherits the properties and methods of the
|
|
2333
2413
|
* {@link HTMLElement} interface.
|
|
2334
2414
|
*
|
|
@@ -2725,7 +2805,7 @@ customElements.define('pc-light', LightComponentElement);
|
|
|
2725
2805
|
|
|
2726
2806
|
/**
|
|
2727
2807
|
* The ParticleSystemComponentElement interface provides properties and methods for manipulating
|
|
2728
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
2808
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-particles/ | `<pc-particles>`} elements.
|
|
2729
2809
|
* The ParticleSystemComponentElement interface also inherits the properties and methods of the
|
|
2730
2810
|
* {@link HTMLElement} interface.
|
|
2731
2811
|
*
|
|
@@ -2857,7 +2937,7 @@ customElements.define('pc-particles', ParticleSystemComponentElement);
|
|
|
2857
2937
|
|
|
2858
2938
|
/**
|
|
2859
2939
|
* The MaterialElement interface provides properties and methods for manipulating
|
|
2860
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
2940
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-material/ | `<pc-material>`} elements.
|
|
2861
2941
|
* The MaterialElement interface also inherits the properties and methods of the
|
|
2862
2942
|
* {@link HTMLElement} interface.
|
|
2863
2943
|
*/
|
|
@@ -2974,7 +3054,7 @@ customElements.define('pc-material', MaterialElement);
|
|
|
2974
3054
|
|
|
2975
3055
|
/**
|
|
2976
3056
|
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
2977
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
3057
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-render/ | `<pc-render>`} elements.
|
|
2978
3058
|
* The RenderComponentElement interface also inherits the properties and methods of the
|
|
2979
3059
|
* {@link HTMLElement} interface.
|
|
2980
3060
|
*
|
|
@@ -3097,7 +3177,7 @@ customElements.define('pc-render', RenderComponentElement);
|
|
|
3097
3177
|
|
|
3098
3178
|
/**
|
|
3099
3179
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
3100
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
3180
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
|
|
3101
3181
|
* The RigidBodyComponentElement interface also inherits the properties and methods of the
|
|
3102
3182
|
* {@link HTMLElement} interface.
|
|
3103
3183
|
*
|
|
@@ -3285,7 +3365,7 @@ customElements.define('pc-rigidbody', RigidBodyComponentElement);
|
|
|
3285
3365
|
|
|
3286
3366
|
/**
|
|
3287
3367
|
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
3288
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
3368
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-screen/ | `<pc-screen>`} elements.
|
|
3289
3369
|
* The ScreenComponentElement interface also inherits the properties and methods of the
|
|
3290
3370
|
* {@link HTMLElement} interface.
|
|
3291
3371
|
*
|
|
@@ -3412,7 +3492,7 @@ customElements.define('pc-screen', ScreenComponentElement);
|
|
|
3412
3492
|
|
|
3413
3493
|
/**
|
|
3414
3494
|
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
3415
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
3495
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scripts/ | `<pc-scripts>`} elements.
|
|
3416
3496
|
* The ScriptComponentElement interface also inherits the properties and methods of the
|
|
3417
3497
|
* {@link HTMLElement} interface.
|
|
3418
3498
|
*
|
|
@@ -3720,7 +3800,7 @@ customElements.define('pc-script', ScriptElement);
|
|
|
3720
3800
|
|
|
3721
3801
|
/**
|
|
3722
3802
|
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
3723
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
3803
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-sounds/ | `<pc-sounds>`} elements.
|
|
3724
3804
|
* The SoundComponentElement interface also inherits the properties and methods of the
|
|
3725
3805
|
* {@link HTMLElement} interface.
|
|
3726
3806
|
*
|
|
@@ -3954,6 +4034,9 @@ class SoundSlotElement extends AsyncElement {
|
|
|
3954
4034
|
}
|
|
3955
4035
|
this.soundSlot = this.soundElement.component.addSlot(this._name, options);
|
|
3956
4036
|
this.asset = this._asset;
|
|
4037
|
+
if (this._autoPlay) {
|
|
4038
|
+
this.soundSlot.play();
|
|
4039
|
+
}
|
|
3957
4040
|
this._onReady();
|
|
3958
4041
|
}
|
|
3959
4042
|
disconnectedCallback() {
|
|
@@ -4163,7 +4246,7 @@ customElements.define('pc-sound', SoundSlotElement);
|
|
|
4163
4246
|
|
|
4164
4247
|
/**
|
|
4165
4248
|
* The SplatComponentElement interface provides properties and methods for manipulating
|
|
4166
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
4249
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-splat/ | `<pc-splat>`} elements.
|
|
4167
4250
|
* The SplatComponentElement interface also inherits the properties and methods of the
|
|
4168
4251
|
* {@link HTMLElement} interface.
|
|
4169
4252
|
*
|
|
@@ -4174,10 +4257,12 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4174
4257
|
constructor() {
|
|
4175
4258
|
super('gsplat');
|
|
4176
4259
|
this._asset = '';
|
|
4260
|
+
this._castShadows = false;
|
|
4177
4261
|
}
|
|
4178
4262
|
getInitialComponentData() {
|
|
4179
4263
|
return {
|
|
4180
|
-
asset: AssetElement.get(this._asset)
|
|
4264
|
+
asset: AssetElement.get(this._asset),
|
|
4265
|
+
castShadows: this._castShadows
|
|
4181
4266
|
};
|
|
4182
4267
|
}
|
|
4183
4268
|
/**
|
|
@@ -4205,8 +4290,29 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4205
4290
|
get asset() {
|
|
4206
4291
|
return this._asset;
|
|
4207
4292
|
}
|
|
4293
|
+
/**
|
|
4294
|
+
* Sets whether the splat casts shadows.
|
|
4295
|
+
* @param value - Whether the splat casts shadows.
|
|
4296
|
+
*/
|
|
4297
|
+
set castShadows(value) {
|
|
4298
|
+
this._castShadows = value;
|
|
4299
|
+
if (this.component) {
|
|
4300
|
+
this.component.castShadows = value;
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
/**
|
|
4304
|
+
* Gets whether the splat casts shadows.
|
|
4305
|
+
* @returns Whether the splat casts shadows.
|
|
4306
|
+
*/
|
|
4307
|
+
get castShadows() {
|
|
4308
|
+
return this._castShadows;
|
|
4309
|
+
}
|
|
4208
4310
|
static get observedAttributes() {
|
|
4209
|
-
return [
|
|
4311
|
+
return [
|
|
4312
|
+
...super.observedAttributes,
|
|
4313
|
+
'asset',
|
|
4314
|
+
'cast-shadows'
|
|
4315
|
+
];
|
|
4210
4316
|
}
|
|
4211
4317
|
attributeChangedCallback(name, _oldValue, newValue) {
|
|
4212
4318
|
super.attributeChangedCallback(name, _oldValue, newValue);
|
|
@@ -4214,6 +4320,9 @@ class SplatComponentElement extends ComponentElement {
|
|
|
4214
4320
|
case 'asset':
|
|
4215
4321
|
this.asset = newValue;
|
|
4216
4322
|
break;
|
|
4323
|
+
case 'cast-shadows':
|
|
4324
|
+
this.castShadows = this.hasAttribute('cast-shadows');
|
|
4325
|
+
break;
|
|
4217
4326
|
}
|
|
4218
4327
|
}
|
|
4219
4328
|
}
|
|
@@ -4221,7 +4330,7 @@ customElements.define('pc-splat', SplatComponentElement);
|
|
|
4221
4330
|
|
|
4222
4331
|
/**
|
|
4223
4332
|
* The ModelElement interface provides properties and methods for manipulating
|
|
4224
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
4333
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-model/ | `<pc-model>`} elements.
|
|
4225
4334
|
* The ModelElement interface also inherits the properties and methods of the
|
|
4226
4335
|
* {@link HTMLElement} interface.
|
|
4227
4336
|
*/
|
|
@@ -4317,7 +4426,7 @@ customElements.define('pc-model', ModelElement);
|
|
|
4317
4426
|
|
|
4318
4427
|
/**
|
|
4319
4428
|
* The SceneElement interface provides properties and methods for manipulating
|
|
4320
|
-
* {@link https://developer.playcanvas.com/user-manual/
|
|
4429
|
+
* {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-scene/ | `<pc-scene>`} elements.
|
|
4321
4430
|
* The SceneElement interface also inherits the properties and methods of the
|
|
4322
4431
|
* {@link HTMLElement} interface.
|
|
4323
4432
|
*/
|