@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.cjs
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
var playcanvas = require('playcanvas');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Base class for all PlayCanvas
|
|
6
|
+
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
7
7
|
*/
|
|
8
8
|
class AsyncElement extends HTMLElement {
|
|
9
|
+
/** @ignore */
|
|
9
10
|
constructor() {
|
|
10
11
|
super();
|
|
11
12
|
this._readyPromise = new Promise((resolve) => {
|
|
@@ -37,7 +38,13 @@ class AsyncElement extends HTMLElement {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
/**
|
|
42
|
+
* The ModuleElement interface provides properties and methods for manipulating
|
|
43
|
+
* `<pc-module>` elements. The ModuleElement interface also inherits the properties and
|
|
44
|
+
* methods of the {@link HTMLElement} interface.
|
|
45
|
+
*/
|
|
40
46
|
class ModuleElement extends HTMLElement {
|
|
47
|
+
/** @ignore */
|
|
41
48
|
constructor() {
|
|
42
49
|
super();
|
|
43
50
|
this.loadPromise = this.loadModule();
|
|
@@ -76,7 +83,9 @@ customElements.define('pc-module', ModuleElement);
|
|
|
76
83
|
*/
|
|
77
84
|
class AppElement extends AsyncElement {
|
|
78
85
|
/**
|
|
79
|
-
* Creates a new AppElement.
|
|
86
|
+
* Creates a new AppElement instance.
|
|
87
|
+
*
|
|
88
|
+
* @ignore
|
|
80
89
|
*/
|
|
81
90
|
constructor() {
|
|
82
91
|
super();
|
|
@@ -89,6 +98,7 @@ class AppElement extends AsyncElement {
|
|
|
89
98
|
this._depth = true;
|
|
90
99
|
this._stencil = true;
|
|
91
100
|
this._highResolution = false;
|
|
101
|
+
this._hierarchyReady = false;
|
|
92
102
|
/**
|
|
93
103
|
* The PlayCanvas application instance.
|
|
94
104
|
*/
|
|
@@ -132,6 +142,16 @@ class AppElement extends AsyncElement {
|
|
|
132
142
|
Array.from(materialElements).forEach((materialElement) => {
|
|
133
143
|
materialElement.createMaterial();
|
|
134
144
|
});
|
|
145
|
+
// Create all entities
|
|
146
|
+
const entityElements = this.querySelectorAll('pc-entity');
|
|
147
|
+
Array.from(entityElements).forEach((entityElement) => {
|
|
148
|
+
entityElement.createEntity(this.app);
|
|
149
|
+
});
|
|
150
|
+
// Build hierarchy
|
|
151
|
+
entityElements.forEach((entityElement) => {
|
|
152
|
+
entityElement.buildHierarchy(this.app);
|
|
153
|
+
});
|
|
154
|
+
this._hierarchyReady = true;
|
|
135
155
|
// Load assets before starting the application
|
|
136
156
|
this.app.preload(() => {
|
|
137
157
|
// Start the application
|
|
@@ -202,6 +222,14 @@ class AppElement extends AsyncElement {
|
|
|
202
222
|
get depth() {
|
|
203
223
|
return this._depth;
|
|
204
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Gets the hierarchy ready flag.
|
|
227
|
+
* @returns The hierarchy ready flag.
|
|
228
|
+
* @ignore
|
|
229
|
+
*/
|
|
230
|
+
get hierarchyReady() {
|
|
231
|
+
return this._hierarchyReady;
|
|
232
|
+
}
|
|
205
233
|
/**
|
|
206
234
|
* Sets the high resolution flag. When true, the application will render at the device's
|
|
207
235
|
* physical resolution. When false, the application will render at CSS resolution.
|
|
@@ -473,7 +501,9 @@ const parseVec4 = (value) => {
|
|
|
473
501
|
};
|
|
474
502
|
|
|
475
503
|
/**
|
|
476
|
-
*
|
|
504
|
+
* The EntityElement interface provides properties and methods for manipulating
|
|
505
|
+
* `<pc-entity>` elements. The EntityElement interface also inherits the properties and
|
|
506
|
+
* methods of the {@link HTMLElement} interface.
|
|
477
507
|
*/
|
|
478
508
|
class EntityElement extends AsyncElement {
|
|
479
509
|
constructor() {
|
|
@@ -507,44 +537,60 @@ class EntityElement extends AsyncElement {
|
|
|
507
537
|
*/
|
|
508
538
|
this.entity = null;
|
|
509
539
|
}
|
|
510
|
-
|
|
511
|
-
const closestApp = this.closestApp;
|
|
512
|
-
if (!closestApp)
|
|
513
|
-
return;
|
|
514
|
-
// Wait for the app to complete initialization
|
|
515
|
-
await closestApp.ready();
|
|
516
|
-
const app = closestApp.app;
|
|
540
|
+
createEntity(app) {
|
|
517
541
|
// Create a new entity
|
|
518
|
-
this.entity = new playcanvas.Entity(this._name, app);
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
if (
|
|
529
|
-
this.
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if (
|
|
533
|
-
this.
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
if (
|
|
537
|
-
this.tags
|
|
542
|
+
this.entity = new playcanvas.Entity(this.getAttribute('name') || this._name, app);
|
|
543
|
+
const enabled = this.getAttribute('enabled');
|
|
544
|
+
if (enabled) {
|
|
545
|
+
this.entity.enabled = enabled !== 'false';
|
|
546
|
+
}
|
|
547
|
+
const position = this.getAttribute('position');
|
|
548
|
+
if (position) {
|
|
549
|
+
this.entity.setLocalPosition(parseVec3(position));
|
|
550
|
+
}
|
|
551
|
+
const rotation = this.getAttribute('rotation');
|
|
552
|
+
if (rotation) {
|
|
553
|
+
this.entity.setLocalEulerAngles(parseVec3(rotation));
|
|
554
|
+
}
|
|
555
|
+
const scale = this.getAttribute('scale');
|
|
556
|
+
if (scale) {
|
|
557
|
+
this.entity.setLocalScale(parseVec3(scale));
|
|
558
|
+
}
|
|
559
|
+
const tags = this.getAttribute('tags');
|
|
560
|
+
if (tags) {
|
|
561
|
+
this.entity.tags.add(tags.split(',').map(tag => tag.trim()));
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
buildHierarchy(app) {
|
|
565
|
+
if (!this.entity)
|
|
566
|
+
return;
|
|
538
567
|
const closestEntity = this.closestEntity;
|
|
539
|
-
if (closestEntity) {
|
|
540
|
-
closestEntity.
|
|
541
|
-
closestEntity.entity.addChild(this.entity);
|
|
542
|
-
this._onReady();
|
|
543
|
-
});
|
|
568
|
+
if (closestEntity === null || closestEntity === void 0 ? void 0 : closestEntity.entity) {
|
|
569
|
+
closestEntity.entity.addChild(this.entity);
|
|
544
570
|
}
|
|
545
571
|
else {
|
|
546
572
|
app.root.addChild(this.entity);
|
|
547
|
-
|
|
573
|
+
}
|
|
574
|
+
this._onReady();
|
|
575
|
+
}
|
|
576
|
+
connectedCallback() {
|
|
577
|
+
// Wait for app to be ready
|
|
578
|
+
const closestApp = this.closestApp;
|
|
579
|
+
if (!closestApp)
|
|
580
|
+
return;
|
|
581
|
+
// If app is already running, create entity immediately
|
|
582
|
+
if (closestApp.hierarchyReady) {
|
|
583
|
+
const app = closestApp.app;
|
|
584
|
+
this.createEntity(app);
|
|
585
|
+
this.buildHierarchy(app);
|
|
586
|
+
// Handle any child entities that might exist
|
|
587
|
+
const childEntities = this.querySelectorAll('pc-entity');
|
|
588
|
+
childEntities.forEach((child) => {
|
|
589
|
+
child.createEntity(app);
|
|
590
|
+
});
|
|
591
|
+
childEntities.forEach((child) => {
|
|
592
|
+
child.buildHierarchy(app);
|
|
593
|
+
});
|
|
548
594
|
}
|
|
549
595
|
}
|
|
550
596
|
disconnectedCallback() {
|
|
@@ -554,6 +600,7 @@ class EntityElement extends AsyncElement {
|
|
|
554
600
|
children.forEach((child) => {
|
|
555
601
|
child.entity = null;
|
|
556
602
|
});
|
|
603
|
+
// Destroy the entity
|
|
557
604
|
this.entity.destroy();
|
|
558
605
|
this.entity = null;
|
|
559
606
|
}
|
|
@@ -709,7 +756,9 @@ const extToType = new Map([
|
|
|
709
756
|
['webp', 'texture']
|
|
710
757
|
]);
|
|
711
758
|
/**
|
|
712
|
-
*
|
|
759
|
+
* The AssetElement interface provides properties and methods for manipulating
|
|
760
|
+
* `<pc-asset>` elements. The AssetElement interface also inherits the properties and
|
|
761
|
+
* methods of the {@link HTMLElement} interface.
|
|
713
762
|
*/
|
|
714
763
|
class AssetElement extends HTMLElement {
|
|
715
764
|
constructor() {
|
|
@@ -785,8 +834,10 @@ customElements.define('pc-asset', AssetElement);
|
|
|
785
834
|
*/
|
|
786
835
|
class ComponentElement extends AsyncElement {
|
|
787
836
|
/**
|
|
788
|
-
*
|
|
837
|
+
* Creates a new ComponentElement instance.
|
|
838
|
+
*
|
|
789
839
|
* @param componentName - The name of the component.
|
|
840
|
+
* @ignore
|
|
790
841
|
*/
|
|
791
842
|
constructor(componentName) {
|
|
792
843
|
super();
|
|
@@ -855,11 +906,14 @@ class ComponentElement extends AsyncElement {
|
|
|
855
906
|
}
|
|
856
907
|
|
|
857
908
|
/**
|
|
858
|
-
*
|
|
909
|
+
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
910
|
+
* `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
|
|
911
|
+
* and methods of the {@link HTMLElement} interface.
|
|
859
912
|
*
|
|
860
913
|
* @category Components
|
|
861
914
|
*/
|
|
862
915
|
class ListenerComponentElement extends ComponentElement {
|
|
916
|
+
/** @ignore */
|
|
863
917
|
constructor() {
|
|
864
918
|
super('audiolistener');
|
|
865
919
|
}
|
|
@@ -874,14 +928,14 @@ class ListenerComponentElement extends ComponentElement {
|
|
|
874
928
|
customElements.define('pc-listener', ListenerComponentElement);
|
|
875
929
|
|
|
876
930
|
/**
|
|
877
|
-
*
|
|
931
|
+
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
932
|
+
* `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
|
|
933
|
+
* methods of the {@link HTMLElement} interface.
|
|
878
934
|
*
|
|
879
935
|
* @category Components
|
|
880
936
|
*/
|
|
881
937
|
class CameraComponentElement extends ComponentElement {
|
|
882
|
-
/**
|
|
883
|
-
* Creates a new CameraComponentElement.
|
|
884
|
-
*/
|
|
938
|
+
/** @ignore */
|
|
885
939
|
constructor() {
|
|
886
940
|
super('camera');
|
|
887
941
|
this._clearColor = new playcanvas.Color(0.75, 0.75, 0.75, 1);
|
|
@@ -1275,14 +1329,14 @@ class CameraComponentElement extends ComponentElement {
|
|
|
1275
1329
|
customElements.define('pc-camera', CameraComponentElement);
|
|
1276
1330
|
|
|
1277
1331
|
/**
|
|
1278
|
-
*
|
|
1332
|
+
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
1333
|
+
* `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
|
|
1334
|
+
* and methods of the {@link HTMLElement} interface.
|
|
1279
1335
|
*
|
|
1280
1336
|
* @category Components
|
|
1281
1337
|
*/
|
|
1282
1338
|
class CollisionComponentElement extends ComponentElement {
|
|
1283
|
-
/**
|
|
1284
|
-
* Creates a new CollisionComponentElement.
|
|
1285
|
-
*/
|
|
1339
|
+
/** @ignore */
|
|
1286
1340
|
constructor() {
|
|
1287
1341
|
super('collision');
|
|
1288
1342
|
this._angularOffset = new playcanvas.Quat();
|
|
@@ -1421,11 +1475,14 @@ class CollisionComponentElement extends ComponentElement {
|
|
|
1421
1475
|
customElements.define('pc-collision', CollisionComponentElement);
|
|
1422
1476
|
|
|
1423
1477
|
/**
|
|
1424
|
-
*
|
|
1478
|
+
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
1479
|
+
* `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
|
|
1480
|
+
* methods of the {@link HTMLElement} interface.
|
|
1425
1481
|
*
|
|
1426
1482
|
* @category Components
|
|
1427
1483
|
*/
|
|
1428
1484
|
class ElementComponentElement extends ComponentElement {
|
|
1485
|
+
/** @ignore */
|
|
1429
1486
|
constructor() {
|
|
1430
1487
|
super('element');
|
|
1431
1488
|
this._anchor = new playcanvas.Vec4(0.5, 0.5, 0.5, 0.5);
|
|
@@ -1631,11 +1688,14 @@ class ElementComponentElement extends ComponentElement {
|
|
|
1631
1688
|
customElements.define('pc-element', ElementComponentElement);
|
|
1632
1689
|
|
|
1633
1690
|
/**
|
|
1634
|
-
*
|
|
1691
|
+
* The GSplatComponentElement interface provides properties and methods for manipulating
|
|
1692
|
+
* `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
|
|
1693
|
+
* methods of the {@link HTMLElement} interface.
|
|
1635
1694
|
*
|
|
1636
1695
|
* @category Components
|
|
1637
1696
|
*/
|
|
1638
1697
|
class GSplatComponentElement extends ComponentElement {
|
|
1698
|
+
/** @ignore */
|
|
1639
1699
|
constructor() {
|
|
1640
1700
|
super('gsplat');
|
|
1641
1701
|
this._asset = '';
|
|
@@ -1677,14 +1737,14 @@ class GSplatComponentElement extends ComponentElement {
|
|
|
1677
1737
|
customElements.define('pc-splat', GSplatComponentElement);
|
|
1678
1738
|
|
|
1679
1739
|
/**
|
|
1680
|
-
*
|
|
1740
|
+
* The LightComponentElement interface provides properties and methods for manipulating
|
|
1741
|
+
* `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
|
|
1742
|
+
* methods of the {@link HTMLElement} interface.
|
|
1681
1743
|
*
|
|
1682
1744
|
* @category Components
|
|
1683
1745
|
*/
|
|
1684
1746
|
class LightComponentElement extends ComponentElement {
|
|
1685
|
-
/**
|
|
1686
|
-
* Creates a new LightComponentElement.
|
|
1687
|
-
*/
|
|
1747
|
+
/** @ignore */
|
|
1688
1748
|
constructor() {
|
|
1689
1749
|
super('light');
|
|
1690
1750
|
this._castShadows = false;
|
|
@@ -1970,7 +2030,9 @@ class LightComponentElement extends ComponentElement {
|
|
|
1970
2030
|
customElements.define('pc-light', LightComponentElement);
|
|
1971
2031
|
|
|
1972
2032
|
/**
|
|
1973
|
-
*
|
|
2033
|
+
* The MaterialElement interface provides properties and methods for manipulating
|
|
2034
|
+
* `<pc-material>` elements. The MaterialElement interface also inherits the properties and
|
|
2035
|
+
* methods of the {@link HTMLElement} interface.
|
|
1974
2036
|
*/
|
|
1975
2037
|
class MaterialElement extends HTMLElement {
|
|
1976
2038
|
constructor() {
|
|
@@ -2084,11 +2146,14 @@ class MaterialElement extends HTMLElement {
|
|
|
2084
2146
|
customElements.define('pc-material', MaterialElement);
|
|
2085
2147
|
|
|
2086
2148
|
/**
|
|
2087
|
-
*
|
|
2149
|
+
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
2150
|
+
* `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
|
|
2151
|
+
* methods of the {@link HTMLElement} interface.
|
|
2088
2152
|
*
|
|
2089
2153
|
* @category Components
|
|
2090
2154
|
*/
|
|
2091
2155
|
class RenderComponentElement extends ComponentElement {
|
|
2156
|
+
/** @ignore */
|
|
2092
2157
|
constructor() {
|
|
2093
2158
|
super('render');
|
|
2094
2159
|
this._castShadows = true;
|
|
@@ -2203,14 +2268,14 @@ class RenderComponentElement extends ComponentElement {
|
|
|
2203
2268
|
customElements.define('pc-render', RenderComponentElement);
|
|
2204
2269
|
|
|
2205
2270
|
/**
|
|
2206
|
-
*
|
|
2271
|
+
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
2272
|
+
* `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
|
|
2273
|
+
* and methods of the {@link HTMLElement} interface.
|
|
2207
2274
|
*
|
|
2208
2275
|
* @category Components
|
|
2209
2276
|
*/
|
|
2210
2277
|
class RigidBodyComponentElement extends ComponentElement {
|
|
2211
|
-
/**
|
|
2212
|
-
* Creates a new RigidBodyComponentElement.
|
|
2213
|
-
*/
|
|
2278
|
+
/** @ignore */
|
|
2214
2279
|
constructor() {
|
|
2215
2280
|
super('rigidbody');
|
|
2216
2281
|
/**
|
|
@@ -2390,11 +2455,14 @@ class RigidBodyComponentElement extends ComponentElement {
|
|
|
2390
2455
|
customElements.define('pc-rigidbody', RigidBodyComponentElement);
|
|
2391
2456
|
|
|
2392
2457
|
/**
|
|
2393
|
-
*
|
|
2458
|
+
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
2459
|
+
* `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
|
|
2460
|
+
* methods of the {@link HTMLElement} interface.
|
|
2394
2461
|
*
|
|
2395
2462
|
* @category Components
|
|
2396
2463
|
*/
|
|
2397
2464
|
class ScreenComponentElement extends ComponentElement {
|
|
2465
|
+
/** @ignore */
|
|
2398
2466
|
constructor() {
|
|
2399
2467
|
super('screen');
|
|
2400
2468
|
this._screenSpace = false;
|
|
@@ -2516,11 +2584,14 @@ const tmpV2 = new playcanvas.Vec2();
|
|
|
2516
2584
|
const tmpV3 = new playcanvas.Vec3();
|
|
2517
2585
|
const tmpV4 = new playcanvas.Vec4();
|
|
2518
2586
|
/**
|
|
2519
|
-
*
|
|
2587
|
+
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
2588
|
+
* `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
|
|
2589
|
+
* methods of the {@link HTMLElement} interface.
|
|
2520
2590
|
*
|
|
2521
2591
|
* @category Components
|
|
2522
2592
|
*/
|
|
2523
2593
|
class ScriptComponentElement extends ComponentElement {
|
|
2594
|
+
/** @ignore */
|
|
2524
2595
|
constructor() {
|
|
2525
2596
|
super('script');
|
|
2526
2597
|
// Create mutation observer to watch for child script elements
|
|
@@ -2663,7 +2734,9 @@ class ScriptComponentElement extends ComponentElement {
|
|
|
2663
2734
|
customElements.define('pc-scripts', ScriptComponentElement);
|
|
2664
2735
|
|
|
2665
2736
|
/**
|
|
2666
|
-
*
|
|
2737
|
+
* The ScriptElement interface provides properties and methods for manipulating
|
|
2738
|
+
* `<pc-script>` elements. The ScriptElement interface also inherits the properties and
|
|
2739
|
+
* methods of the {@link HTMLElement} interface.
|
|
2667
2740
|
*/
|
|
2668
2741
|
class ScriptElement extends HTMLElement {
|
|
2669
2742
|
constructor() {
|
|
@@ -2742,11 +2815,14 @@ class ScriptElement extends HTMLElement {
|
|
|
2742
2815
|
customElements.define('pc-script', ScriptElement);
|
|
2743
2816
|
|
|
2744
2817
|
/**
|
|
2745
|
-
*
|
|
2818
|
+
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
2819
|
+
* `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
|
|
2820
|
+
* methods of the {@link HTMLElement} interface.
|
|
2746
2821
|
*
|
|
2747
2822
|
* @category Components
|
|
2748
2823
|
*/
|
|
2749
2824
|
class SoundComponentElement extends ComponentElement {
|
|
2825
|
+
/** @ignore */
|
|
2750
2826
|
constructor() {
|
|
2751
2827
|
super('sound');
|
|
2752
2828
|
this._distanceModel = 'linear';
|
|
@@ -2936,7 +3012,9 @@ class SoundComponentElement extends ComponentElement {
|
|
|
2936
3012
|
customElements.define('pc-sounds', SoundComponentElement);
|
|
2937
3013
|
|
|
2938
3014
|
/**
|
|
2939
|
-
*
|
|
3015
|
+
* The SoundSlotElement interface provides properties and methods for manipulating
|
|
3016
|
+
* `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
|
|
3017
|
+
* methods of the {@link AsyncElement} interface.
|
|
2940
3018
|
*/
|
|
2941
3019
|
class SoundSlotElement extends AsyncElement {
|
|
2942
3020
|
constructor() {
|
|
@@ -3177,7 +3255,9 @@ class SoundSlotElement extends AsyncElement {
|
|
|
3177
3255
|
customElements.define('pc-sound', SoundSlotElement);
|
|
3178
3256
|
|
|
3179
3257
|
/**
|
|
3180
|
-
*
|
|
3258
|
+
* The ModelElement interface provides properties and methods for manipulating
|
|
3259
|
+
* `<pc-model>` elements. The ModelElement interface also inherits the properties and
|
|
3260
|
+
* methods of the {@link HTMLElement} interface.
|
|
3181
3261
|
*/
|
|
3182
3262
|
class ModelElement extends AsyncElement {
|
|
3183
3263
|
constructor() {
|
|
@@ -3270,7 +3350,9 @@ class ModelElement extends AsyncElement {
|
|
|
3270
3350
|
customElements.define('pc-model', ModelElement);
|
|
3271
3351
|
|
|
3272
3352
|
/**
|
|
3273
|
-
*
|
|
3353
|
+
* The SceneElement interface provides properties and methods for manipulating
|
|
3354
|
+
* `<pc-scene>` elements. The SceneElement interface also inherits the properties and
|
|
3355
|
+
* methods of the {@link HTMLElement} interface.
|
|
3274
3356
|
*/
|
|
3275
3357
|
class SceneElement extends AsyncElement {
|
|
3276
3358
|
constructor() {
|
|
@@ -3309,11 +3391,11 @@ class SceneElement extends AsyncElement {
|
|
|
3309
3391
|
}
|
|
3310
3392
|
updateSceneSettings() {
|
|
3311
3393
|
if (this.scene) {
|
|
3312
|
-
this.scene.
|
|
3313
|
-
this.scene.
|
|
3314
|
-
this.scene.
|
|
3315
|
-
this.scene.
|
|
3316
|
-
this.scene.
|
|
3394
|
+
this.scene.fog.type = this._fog;
|
|
3395
|
+
this.scene.fog.color = this._fogColor;
|
|
3396
|
+
this.scene.fog.density = this._fogDensity;
|
|
3397
|
+
this.scene.fog.start = this._fogStart;
|
|
3398
|
+
this.scene.fog.end = this._fogEnd;
|
|
3317
3399
|
// ... set other properties on the scene as well
|
|
3318
3400
|
}
|
|
3319
3401
|
}
|
|
@@ -3324,7 +3406,7 @@ class SceneElement extends AsyncElement {
|
|
|
3324
3406
|
set fog(value) {
|
|
3325
3407
|
this._fog = value;
|
|
3326
3408
|
if (this.scene) {
|
|
3327
|
-
this.scene.
|
|
3409
|
+
this.scene.fog.type = value;
|
|
3328
3410
|
}
|
|
3329
3411
|
}
|
|
3330
3412
|
/**
|
|
@@ -3341,7 +3423,7 @@ class SceneElement extends AsyncElement {
|
|
|
3341
3423
|
set fogColor(value) {
|
|
3342
3424
|
this._fogColor = value;
|
|
3343
3425
|
if (this.scene) {
|
|
3344
|
-
this.scene.
|
|
3426
|
+
this.scene.fog.color = value;
|
|
3345
3427
|
}
|
|
3346
3428
|
}
|
|
3347
3429
|
/**
|
|
@@ -3358,7 +3440,7 @@ class SceneElement extends AsyncElement {
|
|
|
3358
3440
|
set fogDensity(value) {
|
|
3359
3441
|
this._fogDensity = value;
|
|
3360
3442
|
if (this.scene) {
|
|
3361
|
-
this.scene.
|
|
3443
|
+
this.scene.fog.density = value;
|
|
3362
3444
|
}
|
|
3363
3445
|
}
|
|
3364
3446
|
/**
|
|
@@ -3375,7 +3457,7 @@ class SceneElement extends AsyncElement {
|
|
|
3375
3457
|
set fogStart(value) {
|
|
3376
3458
|
this._fogStart = value;
|
|
3377
3459
|
if (this.scene) {
|
|
3378
|
-
this.scene.
|
|
3460
|
+
this.scene.fog.start = value;
|
|
3379
3461
|
}
|
|
3380
3462
|
}
|
|
3381
3463
|
/**
|
|
@@ -3392,7 +3474,7 @@ class SceneElement extends AsyncElement {
|
|
|
3392
3474
|
set fogEnd(value) {
|
|
3393
3475
|
this._fogEnd = value;
|
|
3394
3476
|
if (this.scene) {
|
|
3395
|
-
this.scene.
|
|
3477
|
+
this.scene.fog.end = value;
|
|
3396
3478
|
}
|
|
3397
3479
|
}
|
|
3398
3480
|
/**
|
|
@@ -3429,7 +3511,9 @@ class SceneElement extends AsyncElement {
|
|
|
3429
3511
|
customElements.define('pc-scene', SceneElement);
|
|
3430
3512
|
|
|
3431
3513
|
/**
|
|
3432
|
-
*
|
|
3514
|
+
* The SkyElement interface provides properties and methods for manipulating
|
|
3515
|
+
* `<pc-sky>` elements. The SkyElement interface also inherits the properties and
|
|
3516
|
+
* methods of the {@link HTMLElement} interface.
|
|
3433
3517
|
*/
|
|
3434
3518
|
class SkyElement extends AsyncElement {
|
|
3435
3519
|
constructor() {
|