@playcanvas/web-components 0.1.8 → 0.1.9
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/app.d.ts +10 -1
- package/dist/asset.d.ts +3 -1
- package/dist/async-element.d.ts +2 -1
- package/dist/components/camera-component.d.ts +4 -4
- package/dist/components/collision-component.d.ts +4 -4
- package/dist/components/component.d.ts +3 -1
- package/dist/components/element-component.d.ts +4 -1
- package/dist/components/gsplat-component.d.ts +4 -1
- package/dist/components/light-component.d.ts +4 -4
- package/dist/components/listener-component.d.ts +4 -1
- package/dist/components/render-component.d.ts +4 -1
- package/dist/components/rigidbody-component.d.ts +4 -4
- package/dist/components/screen-component.d.ts +4 -1
- package/dist/components/script-component.d.ts +4 -1
- package/dist/components/script.d.ts +3 -1
- package/dist/components/sound-component.d.ts +4 -1
- package/dist/components/sound-slot.d.ts +3 -1
- package/dist/entity.d.ts +7 -3
- package/dist/material.d.ts +3 -1
- package/dist/model.d.ts +3 -1
- package/dist/module.d.ts +6 -0
- package/dist/pwc.cjs +161 -77
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +161 -77
- 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 +161 -77
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +3 -1
- package/dist/sky.d.ts +3 -1
- package/package.json +8 -8
- package/src/app.ts +28 -1
- package/src/asset.ts +3 -1
- package/src/async-element.ts +2 -1
- package/src/components/camera-component.ts +4 -4
- package/src/components/collision-component.ts +4 -4
- package/src/components/component.ts +3 -1
- package/src/components/element-component.ts +4 -2
- package/src/components/gsplat-component.ts +4 -1
- package/src/components/light-component.ts +4 -4
- package/src/components/listener-component.ts +4 -1
- package/src/components/render-component.ts +4 -1
- package/src/components/rigidbody-component.ts +4 -4
- package/src/components/screen-component.ts +4 -1
- package/src/components/script-component.ts +4 -1
- package/src/components/script.ts +3 -1
- package/src/components/sound-component.ts +4 -1
- package/src/components/sound-slot.ts +3 -1
- package/src/entity.ts +61 -31
- package/src/material.ts +3 -1
- package/src/model.ts +3 -1
- package/src/module.ts +6 -0
- package/src/scene.ts +13 -11
- package/src/sky.ts +3 -1
package/dist/pwc.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { basisInitialize, WasmModule, Application, Keyboard, Mouse, FILLMODE_FILL_WINDOW, RESOLUTION_AUTO, Color, Quat, Vec2, Vec3, Vec4, Entity, Asset, XRTYPE_VR, PROJECTION_ORTHOGRAPHIC, PROJECTION_PERSPECTIVE, StandardMaterial, SCALEMODE_BLEND, SCALEMODE_NONE, EnvLighting, LAYERID_SKYBOX } from 'playcanvas';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Base class for all PlayCanvas
|
|
4
|
+
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
5
5
|
*/
|
|
6
6
|
class AsyncElement extends HTMLElement {
|
|
7
|
+
/** @ignore */
|
|
7
8
|
constructor() {
|
|
8
9
|
super();
|
|
9
10
|
this._readyPromise = new Promise((resolve) => {
|
|
@@ -35,7 +36,13 @@ class AsyncElement extends HTMLElement {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
/**
|
|
40
|
+
* The ModuleElement interface provides properties and methods for manipulating
|
|
41
|
+
* `<pc-module>` elements. The ModuleElement interface also inherits the properties and
|
|
42
|
+
* methods of the {@link HTMLElement} interface.
|
|
43
|
+
*/
|
|
38
44
|
class ModuleElement extends HTMLElement {
|
|
45
|
+
/** @ignore */
|
|
39
46
|
constructor() {
|
|
40
47
|
super();
|
|
41
48
|
this.loadPromise = this.loadModule();
|
|
@@ -74,7 +81,9 @@ customElements.define('pc-module', ModuleElement);
|
|
|
74
81
|
*/
|
|
75
82
|
class AppElement extends AsyncElement {
|
|
76
83
|
/**
|
|
77
|
-
* Creates a new AppElement.
|
|
84
|
+
* Creates a new AppElement instance.
|
|
85
|
+
*
|
|
86
|
+
* @ignore
|
|
78
87
|
*/
|
|
79
88
|
constructor() {
|
|
80
89
|
super();
|
|
@@ -87,6 +96,7 @@ class AppElement extends AsyncElement {
|
|
|
87
96
|
this._depth = true;
|
|
88
97
|
this._stencil = true;
|
|
89
98
|
this._highResolution = false;
|
|
99
|
+
this._hierarchyReady = false;
|
|
90
100
|
/**
|
|
91
101
|
* The PlayCanvas application instance.
|
|
92
102
|
*/
|
|
@@ -130,6 +140,16 @@ class AppElement extends AsyncElement {
|
|
|
130
140
|
Array.from(materialElements).forEach((materialElement) => {
|
|
131
141
|
materialElement.createMaterial();
|
|
132
142
|
});
|
|
143
|
+
// Create all entities
|
|
144
|
+
const entityElements = this.querySelectorAll('pc-entity');
|
|
145
|
+
Array.from(entityElements).forEach((entityElement) => {
|
|
146
|
+
entityElement.createEntity(this.app);
|
|
147
|
+
});
|
|
148
|
+
// Build hierarchy
|
|
149
|
+
entityElements.forEach((entityElement) => {
|
|
150
|
+
entityElement.buildHierarchy(this.app);
|
|
151
|
+
});
|
|
152
|
+
this._hierarchyReady = true;
|
|
133
153
|
// Load assets before starting the application
|
|
134
154
|
this.app.preload(() => {
|
|
135
155
|
// Start the application
|
|
@@ -200,6 +220,14 @@ class AppElement extends AsyncElement {
|
|
|
200
220
|
get depth() {
|
|
201
221
|
return this._depth;
|
|
202
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Gets the hierarchy ready flag.
|
|
225
|
+
* @returns The hierarchy ready flag.
|
|
226
|
+
* @ignore
|
|
227
|
+
*/
|
|
228
|
+
get hierarchyReady() {
|
|
229
|
+
return this._hierarchyReady;
|
|
230
|
+
}
|
|
203
231
|
/**
|
|
204
232
|
* Sets the high resolution flag. When true, the application will render at the device's
|
|
205
233
|
* physical resolution. When false, the application will render at CSS resolution.
|
|
@@ -471,7 +499,9 @@ const parseVec4 = (value) => {
|
|
|
471
499
|
};
|
|
472
500
|
|
|
473
501
|
/**
|
|
474
|
-
*
|
|
502
|
+
* The EntityElement interface provides properties and methods for manipulating
|
|
503
|
+
* `<pc-entity>` elements. The EntityElement interface also inherits the properties and
|
|
504
|
+
* methods of the {@link HTMLElement} interface.
|
|
475
505
|
*/
|
|
476
506
|
class EntityElement extends AsyncElement {
|
|
477
507
|
constructor() {
|
|
@@ -505,44 +535,60 @@ class EntityElement extends AsyncElement {
|
|
|
505
535
|
*/
|
|
506
536
|
this.entity = null;
|
|
507
537
|
}
|
|
508
|
-
|
|
509
|
-
const closestApp = this.closestApp;
|
|
510
|
-
if (!closestApp)
|
|
511
|
-
return;
|
|
512
|
-
// Wait for the app to complete initialization
|
|
513
|
-
await closestApp.ready();
|
|
514
|
-
const app = closestApp.app;
|
|
538
|
+
createEntity(app) {
|
|
515
539
|
// Create a new entity
|
|
516
|
-
this.entity = new Entity(this._name, app);
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
if (
|
|
527
|
-
this.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (
|
|
531
|
-
this.
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if (
|
|
535
|
-
this.tags
|
|
540
|
+
this.entity = new Entity(this.getAttribute('name') || this._name, app);
|
|
541
|
+
const enabled = this.getAttribute('enabled');
|
|
542
|
+
if (enabled) {
|
|
543
|
+
this.entity.enabled = enabled !== 'false';
|
|
544
|
+
}
|
|
545
|
+
const position = this.getAttribute('position');
|
|
546
|
+
if (position) {
|
|
547
|
+
this.entity.setLocalPosition(parseVec3(position));
|
|
548
|
+
}
|
|
549
|
+
const rotation = this.getAttribute('rotation');
|
|
550
|
+
if (rotation) {
|
|
551
|
+
this.entity.setLocalEulerAngles(parseVec3(rotation));
|
|
552
|
+
}
|
|
553
|
+
const scale = this.getAttribute('scale');
|
|
554
|
+
if (scale) {
|
|
555
|
+
this.entity.setLocalScale(parseVec3(scale));
|
|
556
|
+
}
|
|
557
|
+
const tags = this.getAttribute('tags');
|
|
558
|
+
if (tags) {
|
|
559
|
+
this.entity.tags.add(tags.split(',').map(tag => tag.trim()));
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
buildHierarchy(app) {
|
|
563
|
+
if (!this.entity)
|
|
564
|
+
return;
|
|
536
565
|
const closestEntity = this.closestEntity;
|
|
537
|
-
if (closestEntity) {
|
|
538
|
-
closestEntity.
|
|
539
|
-
closestEntity.entity.addChild(this.entity);
|
|
540
|
-
this._onReady();
|
|
541
|
-
});
|
|
566
|
+
if (closestEntity === null || closestEntity === void 0 ? void 0 : closestEntity.entity) {
|
|
567
|
+
closestEntity.entity.addChild(this.entity);
|
|
542
568
|
}
|
|
543
569
|
else {
|
|
544
570
|
app.root.addChild(this.entity);
|
|
545
|
-
|
|
571
|
+
}
|
|
572
|
+
this._onReady();
|
|
573
|
+
}
|
|
574
|
+
connectedCallback() {
|
|
575
|
+
// Wait for app to be ready
|
|
576
|
+
const closestApp = this.closestApp;
|
|
577
|
+
if (!closestApp)
|
|
578
|
+
return;
|
|
579
|
+
// If app is already running, create entity immediately
|
|
580
|
+
if (closestApp.hierarchyReady) {
|
|
581
|
+
const app = closestApp.app;
|
|
582
|
+
this.createEntity(app);
|
|
583
|
+
this.buildHierarchy(app);
|
|
584
|
+
// Handle any child entities that might exist
|
|
585
|
+
const childEntities = this.querySelectorAll('pc-entity');
|
|
586
|
+
childEntities.forEach((child) => {
|
|
587
|
+
child.createEntity(app);
|
|
588
|
+
});
|
|
589
|
+
childEntities.forEach((child) => {
|
|
590
|
+
child.buildHierarchy(app);
|
|
591
|
+
});
|
|
546
592
|
}
|
|
547
593
|
}
|
|
548
594
|
disconnectedCallback() {
|
|
@@ -552,6 +598,7 @@ class EntityElement extends AsyncElement {
|
|
|
552
598
|
children.forEach((child) => {
|
|
553
599
|
child.entity = null;
|
|
554
600
|
});
|
|
601
|
+
// Destroy the entity
|
|
555
602
|
this.entity.destroy();
|
|
556
603
|
this.entity = null;
|
|
557
604
|
}
|
|
@@ -707,7 +754,9 @@ const extToType = new Map([
|
|
|
707
754
|
['webp', 'texture']
|
|
708
755
|
]);
|
|
709
756
|
/**
|
|
710
|
-
*
|
|
757
|
+
* The AssetElement interface provides properties and methods for manipulating
|
|
758
|
+
* `<pc-asset>` elements. The AssetElement interface also inherits the properties and
|
|
759
|
+
* methods of the {@link HTMLElement} interface.
|
|
711
760
|
*/
|
|
712
761
|
class AssetElement extends HTMLElement {
|
|
713
762
|
constructor() {
|
|
@@ -783,8 +832,10 @@ customElements.define('pc-asset', AssetElement);
|
|
|
783
832
|
*/
|
|
784
833
|
class ComponentElement extends AsyncElement {
|
|
785
834
|
/**
|
|
786
|
-
*
|
|
835
|
+
* Creates a new ComponentElement instance.
|
|
836
|
+
*
|
|
787
837
|
* @param componentName - The name of the component.
|
|
838
|
+
* @ignore
|
|
788
839
|
*/
|
|
789
840
|
constructor(componentName) {
|
|
790
841
|
super();
|
|
@@ -853,11 +904,14 @@ class ComponentElement extends AsyncElement {
|
|
|
853
904
|
}
|
|
854
905
|
|
|
855
906
|
/**
|
|
856
|
-
*
|
|
907
|
+
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
908
|
+
* `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
|
|
909
|
+
* and methods of the {@link HTMLElement} interface.
|
|
857
910
|
*
|
|
858
911
|
* @category Components
|
|
859
912
|
*/
|
|
860
913
|
class ListenerComponentElement extends ComponentElement {
|
|
914
|
+
/** @ignore */
|
|
861
915
|
constructor() {
|
|
862
916
|
super('audiolistener');
|
|
863
917
|
}
|
|
@@ -872,14 +926,14 @@ class ListenerComponentElement extends ComponentElement {
|
|
|
872
926
|
customElements.define('pc-listener', ListenerComponentElement);
|
|
873
927
|
|
|
874
928
|
/**
|
|
875
|
-
*
|
|
929
|
+
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
930
|
+
* `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
|
|
931
|
+
* methods of the {@link HTMLElement} interface.
|
|
876
932
|
*
|
|
877
933
|
* @category Components
|
|
878
934
|
*/
|
|
879
935
|
class CameraComponentElement extends ComponentElement {
|
|
880
|
-
/**
|
|
881
|
-
* Creates a new CameraComponentElement.
|
|
882
|
-
*/
|
|
936
|
+
/** @ignore */
|
|
883
937
|
constructor() {
|
|
884
938
|
super('camera');
|
|
885
939
|
this._clearColor = new Color(0.75, 0.75, 0.75, 1);
|
|
@@ -1273,14 +1327,14 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1273
1327
|
customElements.define('pc-camera', CameraComponentElement);
|
|
1274
1328
|
|
|
1275
1329
|
/**
|
|
1276
|
-
*
|
|
1330
|
+
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
1331
|
+
* `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
|
|
1332
|
+
* and methods of the {@link HTMLElement} interface.
|
|
1277
1333
|
*
|
|
1278
1334
|
* @category Components
|
|
1279
1335
|
*/
|
|
1280
1336
|
class CollisionComponentElement extends ComponentElement {
|
|
1281
|
-
/**
|
|
1282
|
-
* Creates a new CollisionComponentElement.
|
|
1283
|
-
*/
|
|
1337
|
+
/** @ignore */
|
|
1284
1338
|
constructor() {
|
|
1285
1339
|
super('collision');
|
|
1286
1340
|
this._angularOffset = new Quat();
|
|
@@ -1419,11 +1473,14 @@ class CollisionComponentElement extends ComponentElement {
|
|
|
1419
1473
|
customElements.define('pc-collision', CollisionComponentElement);
|
|
1420
1474
|
|
|
1421
1475
|
/**
|
|
1422
|
-
*
|
|
1476
|
+
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
1477
|
+
* `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
|
|
1478
|
+
* methods of the {@link HTMLElement} interface.
|
|
1423
1479
|
*
|
|
1424
1480
|
* @category Components
|
|
1425
1481
|
*/
|
|
1426
1482
|
class ElementComponentElement extends ComponentElement {
|
|
1483
|
+
/** @ignore */
|
|
1427
1484
|
constructor() {
|
|
1428
1485
|
super('element');
|
|
1429
1486
|
this._anchor = new Vec4(0.5, 0.5, 0.5, 0.5);
|
|
@@ -1629,11 +1686,14 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1629
1686
|
customElements.define('pc-element', ElementComponentElement);
|
|
1630
1687
|
|
|
1631
1688
|
/**
|
|
1632
|
-
*
|
|
1689
|
+
* The GSplatComponentElement interface provides properties and methods for manipulating
|
|
1690
|
+
* `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
|
|
1691
|
+
* methods of the {@link HTMLElement} interface.
|
|
1633
1692
|
*
|
|
1634
1693
|
* @category Components
|
|
1635
1694
|
*/
|
|
1636
1695
|
class GSplatComponentElement extends ComponentElement {
|
|
1696
|
+
/** @ignore */
|
|
1637
1697
|
constructor() {
|
|
1638
1698
|
super('gsplat');
|
|
1639
1699
|
this._asset = '';
|
|
@@ -1675,14 +1735,14 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
1675
1735
|
customElements.define('pc-splat', GSplatComponentElement);
|
|
1676
1736
|
|
|
1677
1737
|
/**
|
|
1678
|
-
*
|
|
1738
|
+
* The LightComponentElement interface provides properties and methods for manipulating
|
|
1739
|
+
* `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
|
|
1740
|
+
* methods of the {@link HTMLElement} interface.
|
|
1679
1741
|
*
|
|
1680
1742
|
* @category Components
|
|
1681
1743
|
*/
|
|
1682
1744
|
class LightComponentElement extends ComponentElement {
|
|
1683
|
-
/**
|
|
1684
|
-
* Creates a new LightComponentElement.
|
|
1685
|
-
*/
|
|
1745
|
+
/** @ignore */
|
|
1686
1746
|
constructor() {
|
|
1687
1747
|
super('light');
|
|
1688
1748
|
this._castShadows = false;
|
|
@@ -1968,7 +2028,9 @@ class LightComponentElement extends ComponentElement {
|
|
|
1968
2028
|
customElements.define('pc-light', LightComponentElement);
|
|
1969
2029
|
|
|
1970
2030
|
/**
|
|
1971
|
-
*
|
|
2031
|
+
* The MaterialElement interface provides properties and methods for manipulating
|
|
2032
|
+
* `<pc-material>` elements. The MaterialElement interface also inherits the properties and
|
|
2033
|
+
* methods of the {@link HTMLElement} interface.
|
|
1972
2034
|
*/
|
|
1973
2035
|
class MaterialElement extends HTMLElement {
|
|
1974
2036
|
constructor() {
|
|
@@ -2082,11 +2144,14 @@ class MaterialElement extends HTMLElement {
|
|
|
2082
2144
|
customElements.define('pc-material', MaterialElement);
|
|
2083
2145
|
|
|
2084
2146
|
/**
|
|
2085
|
-
*
|
|
2147
|
+
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
2148
|
+
* `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
|
|
2149
|
+
* methods of the {@link HTMLElement} interface.
|
|
2086
2150
|
*
|
|
2087
2151
|
* @category Components
|
|
2088
2152
|
*/
|
|
2089
2153
|
class RenderComponentElement extends ComponentElement {
|
|
2154
|
+
/** @ignore */
|
|
2090
2155
|
constructor() {
|
|
2091
2156
|
super('render');
|
|
2092
2157
|
this._castShadows = true;
|
|
@@ -2201,14 +2266,14 @@ class RenderComponentElement extends ComponentElement {
|
|
|
2201
2266
|
customElements.define('pc-render', RenderComponentElement);
|
|
2202
2267
|
|
|
2203
2268
|
/**
|
|
2204
|
-
*
|
|
2269
|
+
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
2270
|
+
* `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
|
|
2271
|
+
* and methods of the {@link HTMLElement} interface.
|
|
2205
2272
|
*
|
|
2206
2273
|
* @category Components
|
|
2207
2274
|
*/
|
|
2208
2275
|
class RigidBodyComponentElement extends ComponentElement {
|
|
2209
|
-
/**
|
|
2210
|
-
* Creates a new RigidBodyComponentElement.
|
|
2211
|
-
*/
|
|
2276
|
+
/** @ignore */
|
|
2212
2277
|
constructor() {
|
|
2213
2278
|
super('rigidbody');
|
|
2214
2279
|
/**
|
|
@@ -2388,11 +2453,14 @@ class RigidBodyComponentElement extends ComponentElement {
|
|
|
2388
2453
|
customElements.define('pc-rigidbody', RigidBodyComponentElement);
|
|
2389
2454
|
|
|
2390
2455
|
/**
|
|
2391
|
-
*
|
|
2456
|
+
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
2457
|
+
* `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
|
|
2458
|
+
* methods of the {@link HTMLElement} interface.
|
|
2392
2459
|
*
|
|
2393
2460
|
* @category Components
|
|
2394
2461
|
*/
|
|
2395
2462
|
class ScreenComponentElement extends ComponentElement {
|
|
2463
|
+
/** @ignore */
|
|
2396
2464
|
constructor() {
|
|
2397
2465
|
super('screen');
|
|
2398
2466
|
this._screenSpace = false;
|
|
@@ -2514,11 +2582,14 @@ const tmpV2 = new Vec2();
|
|
|
2514
2582
|
const tmpV3 = new Vec3();
|
|
2515
2583
|
const tmpV4 = new Vec4();
|
|
2516
2584
|
/**
|
|
2517
|
-
*
|
|
2585
|
+
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
2586
|
+
* `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
|
|
2587
|
+
* methods of the {@link HTMLElement} interface.
|
|
2518
2588
|
*
|
|
2519
2589
|
* @category Components
|
|
2520
2590
|
*/
|
|
2521
2591
|
class ScriptComponentElement extends ComponentElement {
|
|
2592
|
+
/** @ignore */
|
|
2522
2593
|
constructor() {
|
|
2523
2594
|
super('script');
|
|
2524
2595
|
// Create mutation observer to watch for child script elements
|
|
@@ -2661,7 +2732,9 @@ class ScriptComponentElement extends ComponentElement {
|
|
|
2661
2732
|
customElements.define('pc-scripts', ScriptComponentElement);
|
|
2662
2733
|
|
|
2663
2734
|
/**
|
|
2664
|
-
*
|
|
2735
|
+
* The ScriptElement interface provides properties and methods for manipulating
|
|
2736
|
+
* `<pc-script>` elements. The ScriptElement interface also inherits the properties and
|
|
2737
|
+
* methods of the {@link HTMLElement} interface.
|
|
2665
2738
|
*/
|
|
2666
2739
|
class ScriptElement extends HTMLElement {
|
|
2667
2740
|
constructor() {
|
|
@@ -2740,11 +2813,14 @@ class ScriptElement extends HTMLElement {
|
|
|
2740
2813
|
customElements.define('pc-script', ScriptElement);
|
|
2741
2814
|
|
|
2742
2815
|
/**
|
|
2743
|
-
*
|
|
2816
|
+
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
2817
|
+
* `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
|
|
2818
|
+
* methods of the {@link HTMLElement} interface.
|
|
2744
2819
|
*
|
|
2745
2820
|
* @category Components
|
|
2746
2821
|
*/
|
|
2747
2822
|
class SoundComponentElement extends ComponentElement {
|
|
2823
|
+
/** @ignore */
|
|
2748
2824
|
constructor() {
|
|
2749
2825
|
super('sound');
|
|
2750
2826
|
this._distanceModel = 'linear';
|
|
@@ -2934,7 +3010,9 @@ class SoundComponentElement extends ComponentElement {
|
|
|
2934
3010
|
customElements.define('pc-sounds', SoundComponentElement);
|
|
2935
3011
|
|
|
2936
3012
|
/**
|
|
2937
|
-
*
|
|
3013
|
+
* The SoundSlotElement interface provides properties and methods for manipulating
|
|
3014
|
+
* `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
|
|
3015
|
+
* methods of the {@link AsyncElement} interface.
|
|
2938
3016
|
*/
|
|
2939
3017
|
class SoundSlotElement extends AsyncElement {
|
|
2940
3018
|
constructor() {
|
|
@@ -3175,7 +3253,9 @@ class SoundSlotElement extends AsyncElement {
|
|
|
3175
3253
|
customElements.define('pc-sound', SoundSlotElement);
|
|
3176
3254
|
|
|
3177
3255
|
/**
|
|
3178
|
-
*
|
|
3256
|
+
* The ModelElement interface provides properties and methods for manipulating
|
|
3257
|
+
* `<pc-model>` elements. The ModelElement interface also inherits the properties and
|
|
3258
|
+
* methods of the {@link HTMLElement} interface.
|
|
3179
3259
|
*/
|
|
3180
3260
|
class ModelElement extends AsyncElement {
|
|
3181
3261
|
constructor() {
|
|
@@ -3268,7 +3348,9 @@ class ModelElement extends AsyncElement {
|
|
|
3268
3348
|
customElements.define('pc-model', ModelElement);
|
|
3269
3349
|
|
|
3270
3350
|
/**
|
|
3271
|
-
*
|
|
3351
|
+
* The SceneElement interface provides properties and methods for manipulating
|
|
3352
|
+
* `<pc-scene>` elements. The SceneElement interface also inherits the properties and
|
|
3353
|
+
* methods of the {@link HTMLElement} interface.
|
|
3272
3354
|
*/
|
|
3273
3355
|
class SceneElement extends AsyncElement {
|
|
3274
3356
|
constructor() {
|
|
@@ -3307,11 +3389,11 @@ class SceneElement extends AsyncElement {
|
|
|
3307
3389
|
}
|
|
3308
3390
|
updateSceneSettings() {
|
|
3309
3391
|
if (this.scene) {
|
|
3310
|
-
this.scene.
|
|
3311
|
-
this.scene.
|
|
3312
|
-
this.scene.
|
|
3313
|
-
this.scene.
|
|
3314
|
-
this.scene.
|
|
3392
|
+
this.scene.fog.type = this._fog;
|
|
3393
|
+
this.scene.fog.color = this._fogColor;
|
|
3394
|
+
this.scene.fog.density = this._fogDensity;
|
|
3395
|
+
this.scene.fog.start = this._fogStart;
|
|
3396
|
+
this.scene.fog.end = this._fogEnd;
|
|
3315
3397
|
// ... set other properties on the scene as well
|
|
3316
3398
|
}
|
|
3317
3399
|
}
|
|
@@ -3322,7 +3404,7 @@ class SceneElement extends AsyncElement {
|
|
|
3322
3404
|
set fog(value) {
|
|
3323
3405
|
this._fog = value;
|
|
3324
3406
|
if (this.scene) {
|
|
3325
|
-
this.scene.
|
|
3407
|
+
this.scene.fog.type = value;
|
|
3326
3408
|
}
|
|
3327
3409
|
}
|
|
3328
3410
|
/**
|
|
@@ -3339,7 +3421,7 @@ class SceneElement extends AsyncElement {
|
|
|
3339
3421
|
set fogColor(value) {
|
|
3340
3422
|
this._fogColor = value;
|
|
3341
3423
|
if (this.scene) {
|
|
3342
|
-
this.scene.
|
|
3424
|
+
this.scene.fog.color = value;
|
|
3343
3425
|
}
|
|
3344
3426
|
}
|
|
3345
3427
|
/**
|
|
@@ -3356,7 +3438,7 @@ class SceneElement extends AsyncElement {
|
|
|
3356
3438
|
set fogDensity(value) {
|
|
3357
3439
|
this._fogDensity = value;
|
|
3358
3440
|
if (this.scene) {
|
|
3359
|
-
this.scene.
|
|
3441
|
+
this.scene.fog.density = value;
|
|
3360
3442
|
}
|
|
3361
3443
|
}
|
|
3362
3444
|
/**
|
|
@@ -3373,7 +3455,7 @@ class SceneElement extends AsyncElement {
|
|
|
3373
3455
|
set fogStart(value) {
|
|
3374
3456
|
this._fogStart = value;
|
|
3375
3457
|
if (this.scene) {
|
|
3376
|
-
this.scene.
|
|
3458
|
+
this.scene.fog.start = value;
|
|
3377
3459
|
}
|
|
3378
3460
|
}
|
|
3379
3461
|
/**
|
|
@@ -3390,7 +3472,7 @@ class SceneElement extends AsyncElement {
|
|
|
3390
3472
|
set fogEnd(value) {
|
|
3391
3473
|
this._fogEnd = value;
|
|
3392
3474
|
if (this.scene) {
|
|
3393
|
-
this.scene.
|
|
3475
|
+
this.scene.fog.end = value;
|
|
3394
3476
|
}
|
|
3395
3477
|
}
|
|
3396
3478
|
/**
|
|
@@ -3427,7 +3509,9 @@ class SceneElement extends AsyncElement {
|
|
|
3427
3509
|
customElements.define('pc-scene', SceneElement);
|
|
3428
3510
|
|
|
3429
3511
|
/**
|
|
3430
|
-
*
|
|
3512
|
+
* The SkyElement interface provides properties and methods for manipulating
|
|
3513
|
+
* `<pc-sky>` elements. The SkyElement interface also inherits the properties and
|
|
3514
|
+
* methods of the {@link HTMLElement} interface.
|
|
3431
3515
|
*/
|
|
3432
3516
|
class SkyElement extends AsyncElement {
|
|
3433
3517
|
constructor() {
|