@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.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
})(this, (function (exports, playcanvas) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Base class for all PlayCanvas
|
|
8
|
+
* Base class for all PlayCanvas Web Components that initialize asynchronously.
|
|
9
9
|
*/
|
|
10
10
|
class AsyncElement extends HTMLElement {
|
|
11
|
+
/** @ignore */
|
|
11
12
|
constructor() {
|
|
12
13
|
super();
|
|
13
14
|
this._readyPromise = new Promise((resolve) => {
|
|
@@ -39,7 +40,13 @@
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The ModuleElement interface provides properties and methods for manipulating
|
|
45
|
+
* `<pc-module>` elements. The ModuleElement interface also inherits the properties and
|
|
46
|
+
* methods of the {@link HTMLElement} interface.
|
|
47
|
+
*/
|
|
42
48
|
class ModuleElement extends HTMLElement {
|
|
49
|
+
/** @ignore */
|
|
43
50
|
constructor() {
|
|
44
51
|
super();
|
|
45
52
|
this.loadPromise = this.loadModule();
|
|
@@ -78,7 +85,9 @@
|
|
|
78
85
|
*/
|
|
79
86
|
class AppElement extends AsyncElement {
|
|
80
87
|
/**
|
|
81
|
-
* Creates a new AppElement.
|
|
88
|
+
* Creates a new AppElement instance.
|
|
89
|
+
*
|
|
90
|
+
* @ignore
|
|
82
91
|
*/
|
|
83
92
|
constructor() {
|
|
84
93
|
super();
|
|
@@ -91,6 +100,7 @@
|
|
|
91
100
|
this._depth = true;
|
|
92
101
|
this._stencil = true;
|
|
93
102
|
this._highResolution = false;
|
|
103
|
+
this._hierarchyReady = false;
|
|
94
104
|
/**
|
|
95
105
|
* The PlayCanvas application instance.
|
|
96
106
|
*/
|
|
@@ -134,6 +144,16 @@
|
|
|
134
144
|
Array.from(materialElements).forEach((materialElement) => {
|
|
135
145
|
materialElement.createMaterial();
|
|
136
146
|
});
|
|
147
|
+
// Create all entities
|
|
148
|
+
const entityElements = this.querySelectorAll('pc-entity');
|
|
149
|
+
Array.from(entityElements).forEach((entityElement) => {
|
|
150
|
+
entityElement.createEntity(this.app);
|
|
151
|
+
});
|
|
152
|
+
// Build hierarchy
|
|
153
|
+
entityElements.forEach((entityElement) => {
|
|
154
|
+
entityElement.buildHierarchy(this.app);
|
|
155
|
+
});
|
|
156
|
+
this._hierarchyReady = true;
|
|
137
157
|
// Load assets before starting the application
|
|
138
158
|
this.app.preload(() => {
|
|
139
159
|
// Start the application
|
|
@@ -204,6 +224,14 @@
|
|
|
204
224
|
get depth() {
|
|
205
225
|
return this._depth;
|
|
206
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Gets the hierarchy ready flag.
|
|
229
|
+
* @returns The hierarchy ready flag.
|
|
230
|
+
* @ignore
|
|
231
|
+
*/
|
|
232
|
+
get hierarchyReady() {
|
|
233
|
+
return this._hierarchyReady;
|
|
234
|
+
}
|
|
207
235
|
/**
|
|
208
236
|
* Sets the high resolution flag. When true, the application will render at the device's
|
|
209
237
|
* physical resolution. When false, the application will render at CSS resolution.
|
|
@@ -475,7 +503,9 @@
|
|
|
475
503
|
};
|
|
476
504
|
|
|
477
505
|
/**
|
|
478
|
-
*
|
|
506
|
+
* The EntityElement interface provides properties and methods for manipulating
|
|
507
|
+
* `<pc-entity>` elements. The EntityElement interface also inherits the properties and
|
|
508
|
+
* methods of the {@link HTMLElement} interface.
|
|
479
509
|
*/
|
|
480
510
|
class EntityElement extends AsyncElement {
|
|
481
511
|
constructor() {
|
|
@@ -509,44 +539,60 @@
|
|
|
509
539
|
*/
|
|
510
540
|
this.entity = null;
|
|
511
541
|
}
|
|
512
|
-
|
|
513
|
-
const closestApp = this.closestApp;
|
|
514
|
-
if (!closestApp)
|
|
515
|
-
return;
|
|
516
|
-
// Wait for the app to complete initialization
|
|
517
|
-
await closestApp.ready();
|
|
518
|
-
const app = closestApp.app;
|
|
542
|
+
createEntity(app) {
|
|
519
543
|
// Create a new entity
|
|
520
|
-
this.entity = new playcanvas.Entity(this._name, app);
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (
|
|
531
|
-
this.
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if (
|
|
535
|
-
this.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if (
|
|
539
|
-
this.tags
|
|
544
|
+
this.entity = new playcanvas.Entity(this.getAttribute('name') || this._name, app);
|
|
545
|
+
const enabled = this.getAttribute('enabled');
|
|
546
|
+
if (enabled) {
|
|
547
|
+
this.entity.enabled = enabled !== 'false';
|
|
548
|
+
}
|
|
549
|
+
const position = this.getAttribute('position');
|
|
550
|
+
if (position) {
|
|
551
|
+
this.entity.setLocalPosition(parseVec3(position));
|
|
552
|
+
}
|
|
553
|
+
const rotation = this.getAttribute('rotation');
|
|
554
|
+
if (rotation) {
|
|
555
|
+
this.entity.setLocalEulerAngles(parseVec3(rotation));
|
|
556
|
+
}
|
|
557
|
+
const scale = this.getAttribute('scale');
|
|
558
|
+
if (scale) {
|
|
559
|
+
this.entity.setLocalScale(parseVec3(scale));
|
|
560
|
+
}
|
|
561
|
+
const tags = this.getAttribute('tags');
|
|
562
|
+
if (tags) {
|
|
563
|
+
this.entity.tags.add(tags.split(',').map(tag => tag.trim()));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
buildHierarchy(app) {
|
|
567
|
+
if (!this.entity)
|
|
568
|
+
return;
|
|
540
569
|
const closestEntity = this.closestEntity;
|
|
541
|
-
if (closestEntity) {
|
|
542
|
-
closestEntity.
|
|
543
|
-
closestEntity.entity.addChild(this.entity);
|
|
544
|
-
this._onReady();
|
|
545
|
-
});
|
|
570
|
+
if (closestEntity === null || closestEntity === void 0 ? void 0 : closestEntity.entity) {
|
|
571
|
+
closestEntity.entity.addChild(this.entity);
|
|
546
572
|
}
|
|
547
573
|
else {
|
|
548
574
|
app.root.addChild(this.entity);
|
|
549
|
-
|
|
575
|
+
}
|
|
576
|
+
this._onReady();
|
|
577
|
+
}
|
|
578
|
+
connectedCallback() {
|
|
579
|
+
// Wait for app to be ready
|
|
580
|
+
const closestApp = this.closestApp;
|
|
581
|
+
if (!closestApp)
|
|
582
|
+
return;
|
|
583
|
+
// If app is already running, create entity immediately
|
|
584
|
+
if (closestApp.hierarchyReady) {
|
|
585
|
+
const app = closestApp.app;
|
|
586
|
+
this.createEntity(app);
|
|
587
|
+
this.buildHierarchy(app);
|
|
588
|
+
// Handle any child entities that might exist
|
|
589
|
+
const childEntities = this.querySelectorAll('pc-entity');
|
|
590
|
+
childEntities.forEach((child) => {
|
|
591
|
+
child.createEntity(app);
|
|
592
|
+
});
|
|
593
|
+
childEntities.forEach((child) => {
|
|
594
|
+
child.buildHierarchy(app);
|
|
595
|
+
});
|
|
550
596
|
}
|
|
551
597
|
}
|
|
552
598
|
disconnectedCallback() {
|
|
@@ -556,6 +602,7 @@
|
|
|
556
602
|
children.forEach((child) => {
|
|
557
603
|
child.entity = null;
|
|
558
604
|
});
|
|
605
|
+
// Destroy the entity
|
|
559
606
|
this.entity.destroy();
|
|
560
607
|
this.entity = null;
|
|
561
608
|
}
|
|
@@ -711,7 +758,9 @@
|
|
|
711
758
|
['webp', 'texture']
|
|
712
759
|
]);
|
|
713
760
|
/**
|
|
714
|
-
*
|
|
761
|
+
* The AssetElement interface provides properties and methods for manipulating
|
|
762
|
+
* `<pc-asset>` elements. The AssetElement interface also inherits the properties and
|
|
763
|
+
* methods of the {@link HTMLElement} interface.
|
|
715
764
|
*/
|
|
716
765
|
class AssetElement extends HTMLElement {
|
|
717
766
|
constructor() {
|
|
@@ -787,8 +836,10 @@
|
|
|
787
836
|
*/
|
|
788
837
|
class ComponentElement extends AsyncElement {
|
|
789
838
|
/**
|
|
790
|
-
*
|
|
839
|
+
* Creates a new ComponentElement instance.
|
|
840
|
+
*
|
|
791
841
|
* @param componentName - The name of the component.
|
|
842
|
+
* @ignore
|
|
792
843
|
*/
|
|
793
844
|
constructor(componentName) {
|
|
794
845
|
super();
|
|
@@ -857,11 +908,14 @@
|
|
|
857
908
|
}
|
|
858
909
|
|
|
859
910
|
/**
|
|
860
|
-
*
|
|
911
|
+
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
912
|
+
* `<pc-listener>` elements. The ListenerComponentElement interface also inherits the properties
|
|
913
|
+
* and methods of the {@link HTMLElement} interface.
|
|
861
914
|
*
|
|
862
915
|
* @category Components
|
|
863
916
|
*/
|
|
864
917
|
class ListenerComponentElement extends ComponentElement {
|
|
918
|
+
/** @ignore */
|
|
865
919
|
constructor() {
|
|
866
920
|
super('audiolistener');
|
|
867
921
|
}
|
|
@@ -876,14 +930,14 @@
|
|
|
876
930
|
customElements.define('pc-listener', ListenerComponentElement);
|
|
877
931
|
|
|
878
932
|
/**
|
|
879
|
-
*
|
|
933
|
+
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
934
|
+
* `<pc-camera>` elements. The CameraComponentElement interface also inherits the properties and
|
|
935
|
+
* methods of the {@link HTMLElement} interface.
|
|
880
936
|
*
|
|
881
937
|
* @category Components
|
|
882
938
|
*/
|
|
883
939
|
class CameraComponentElement extends ComponentElement {
|
|
884
|
-
/**
|
|
885
|
-
* Creates a new CameraComponentElement.
|
|
886
|
-
*/
|
|
940
|
+
/** @ignore */
|
|
887
941
|
constructor() {
|
|
888
942
|
super('camera');
|
|
889
943
|
this._clearColor = new playcanvas.Color(0.75, 0.75, 0.75, 1);
|
|
@@ -1277,14 +1331,14 @@
|
|
|
1277
1331
|
customElements.define('pc-camera', CameraComponentElement);
|
|
1278
1332
|
|
|
1279
1333
|
/**
|
|
1280
|
-
*
|
|
1334
|
+
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
1335
|
+
* `<pc-collision>` elements. The CollisionComponentElement interface also inherits the properties
|
|
1336
|
+
* and methods of the {@link HTMLElement} interface.
|
|
1281
1337
|
*
|
|
1282
1338
|
* @category Components
|
|
1283
1339
|
*/
|
|
1284
1340
|
class CollisionComponentElement extends ComponentElement {
|
|
1285
|
-
/**
|
|
1286
|
-
* Creates a new CollisionComponentElement.
|
|
1287
|
-
*/
|
|
1341
|
+
/** @ignore */
|
|
1288
1342
|
constructor() {
|
|
1289
1343
|
super('collision');
|
|
1290
1344
|
this._angularOffset = new playcanvas.Quat();
|
|
@@ -1423,11 +1477,14 @@
|
|
|
1423
1477
|
customElements.define('pc-collision', CollisionComponentElement);
|
|
1424
1478
|
|
|
1425
1479
|
/**
|
|
1426
|
-
*
|
|
1480
|
+
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
1481
|
+
* `<pc-element>` elements. The ElementComponentElement interface also inherits the properties and
|
|
1482
|
+
* methods of the {@link HTMLElement} interface.
|
|
1427
1483
|
*
|
|
1428
1484
|
* @category Components
|
|
1429
1485
|
*/
|
|
1430
1486
|
class ElementComponentElement extends ComponentElement {
|
|
1487
|
+
/** @ignore */
|
|
1431
1488
|
constructor() {
|
|
1432
1489
|
super('element');
|
|
1433
1490
|
this._anchor = new playcanvas.Vec4(0.5, 0.5, 0.5, 0.5);
|
|
@@ -1633,11 +1690,14 @@
|
|
|
1633
1690
|
customElements.define('pc-element', ElementComponentElement);
|
|
1634
1691
|
|
|
1635
1692
|
/**
|
|
1636
|
-
*
|
|
1693
|
+
* The GSplatComponentElement interface provides properties and methods for manipulating
|
|
1694
|
+
* `<pc-splat>` elements. The GSplatComponentElement interface also inherits the properties and
|
|
1695
|
+
* methods of the {@link HTMLElement} interface.
|
|
1637
1696
|
*
|
|
1638
1697
|
* @category Components
|
|
1639
1698
|
*/
|
|
1640
1699
|
class GSplatComponentElement extends ComponentElement {
|
|
1700
|
+
/** @ignore */
|
|
1641
1701
|
constructor() {
|
|
1642
1702
|
super('gsplat');
|
|
1643
1703
|
this._asset = '';
|
|
@@ -1679,14 +1739,14 @@
|
|
|
1679
1739
|
customElements.define('pc-splat', GSplatComponentElement);
|
|
1680
1740
|
|
|
1681
1741
|
/**
|
|
1682
|
-
*
|
|
1742
|
+
* The LightComponentElement interface provides properties and methods for manipulating
|
|
1743
|
+
* `<pc-light>` elements. The LightComponentElement interface also inherits the properties and
|
|
1744
|
+
* methods of the {@link HTMLElement} interface.
|
|
1683
1745
|
*
|
|
1684
1746
|
* @category Components
|
|
1685
1747
|
*/
|
|
1686
1748
|
class LightComponentElement extends ComponentElement {
|
|
1687
|
-
/**
|
|
1688
|
-
* Creates a new LightComponentElement.
|
|
1689
|
-
*/
|
|
1749
|
+
/** @ignore */
|
|
1690
1750
|
constructor() {
|
|
1691
1751
|
super('light');
|
|
1692
1752
|
this._castShadows = false;
|
|
@@ -1972,7 +2032,9 @@
|
|
|
1972
2032
|
customElements.define('pc-light', LightComponentElement);
|
|
1973
2033
|
|
|
1974
2034
|
/**
|
|
1975
|
-
*
|
|
2035
|
+
* The MaterialElement interface provides properties and methods for manipulating
|
|
2036
|
+
* `<pc-material>` elements. The MaterialElement interface also inherits the properties and
|
|
2037
|
+
* methods of the {@link HTMLElement} interface.
|
|
1976
2038
|
*/
|
|
1977
2039
|
class MaterialElement extends HTMLElement {
|
|
1978
2040
|
constructor() {
|
|
@@ -2086,11 +2148,14 @@
|
|
|
2086
2148
|
customElements.define('pc-material', MaterialElement);
|
|
2087
2149
|
|
|
2088
2150
|
/**
|
|
2089
|
-
*
|
|
2151
|
+
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
2152
|
+
* `<pc-render>` elements. The RenderComponentElement interface also inherits the properties and
|
|
2153
|
+
* methods of the {@link HTMLElement} interface.
|
|
2090
2154
|
*
|
|
2091
2155
|
* @category Components
|
|
2092
2156
|
*/
|
|
2093
2157
|
class RenderComponentElement extends ComponentElement {
|
|
2158
|
+
/** @ignore */
|
|
2094
2159
|
constructor() {
|
|
2095
2160
|
super('render');
|
|
2096
2161
|
this._castShadows = true;
|
|
@@ -2205,14 +2270,14 @@
|
|
|
2205
2270
|
customElements.define('pc-render', RenderComponentElement);
|
|
2206
2271
|
|
|
2207
2272
|
/**
|
|
2208
|
-
*
|
|
2273
|
+
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
2274
|
+
* `<pc-rigidbody>` elements. The RigidBodyComponentElement interface also inherits the properties
|
|
2275
|
+
* and methods of the {@link HTMLElement} interface.
|
|
2209
2276
|
*
|
|
2210
2277
|
* @category Components
|
|
2211
2278
|
*/
|
|
2212
2279
|
class RigidBodyComponentElement extends ComponentElement {
|
|
2213
|
-
/**
|
|
2214
|
-
* Creates a new RigidBodyComponentElement.
|
|
2215
|
-
*/
|
|
2280
|
+
/** @ignore */
|
|
2216
2281
|
constructor() {
|
|
2217
2282
|
super('rigidbody');
|
|
2218
2283
|
/**
|
|
@@ -2392,11 +2457,14 @@
|
|
|
2392
2457
|
customElements.define('pc-rigidbody', RigidBodyComponentElement);
|
|
2393
2458
|
|
|
2394
2459
|
/**
|
|
2395
|
-
*
|
|
2460
|
+
* The ScreenComponentElement interface provides properties and methods for manipulating
|
|
2461
|
+
* `<pc-screen>` elements. The ScreenComponentElement interface also inherits the properties and
|
|
2462
|
+
* methods of the {@link HTMLElement} interface.
|
|
2396
2463
|
*
|
|
2397
2464
|
* @category Components
|
|
2398
2465
|
*/
|
|
2399
2466
|
class ScreenComponentElement extends ComponentElement {
|
|
2467
|
+
/** @ignore */
|
|
2400
2468
|
constructor() {
|
|
2401
2469
|
super('screen');
|
|
2402
2470
|
this._screenSpace = false;
|
|
@@ -2518,11 +2586,14 @@
|
|
|
2518
2586
|
const tmpV3 = new playcanvas.Vec3();
|
|
2519
2587
|
const tmpV4 = new playcanvas.Vec4();
|
|
2520
2588
|
/**
|
|
2521
|
-
*
|
|
2589
|
+
* The ScriptComponentElement interface provides properties and methods for manipulating
|
|
2590
|
+
* `<pc-scripts>` elements. The ScriptComponentElement interface also inherits the properties and
|
|
2591
|
+
* methods of the {@link HTMLElement} interface.
|
|
2522
2592
|
*
|
|
2523
2593
|
* @category Components
|
|
2524
2594
|
*/
|
|
2525
2595
|
class ScriptComponentElement extends ComponentElement {
|
|
2596
|
+
/** @ignore */
|
|
2526
2597
|
constructor() {
|
|
2527
2598
|
super('script');
|
|
2528
2599
|
// Create mutation observer to watch for child script elements
|
|
@@ -2665,7 +2736,9 @@
|
|
|
2665
2736
|
customElements.define('pc-scripts', ScriptComponentElement);
|
|
2666
2737
|
|
|
2667
2738
|
/**
|
|
2668
|
-
*
|
|
2739
|
+
* The ScriptElement interface provides properties and methods for manipulating
|
|
2740
|
+
* `<pc-script>` elements. The ScriptElement interface also inherits the properties and
|
|
2741
|
+
* methods of the {@link HTMLElement} interface.
|
|
2669
2742
|
*/
|
|
2670
2743
|
class ScriptElement extends HTMLElement {
|
|
2671
2744
|
constructor() {
|
|
@@ -2744,11 +2817,14 @@
|
|
|
2744
2817
|
customElements.define('pc-script', ScriptElement);
|
|
2745
2818
|
|
|
2746
2819
|
/**
|
|
2747
|
-
*
|
|
2820
|
+
* The SoundComponentElement interface provides properties and methods for manipulating
|
|
2821
|
+
* `<pc-sounds>` elements. The SoundComponentElement interface also inherits the properties and
|
|
2822
|
+
* methods of the {@link HTMLElement} interface.
|
|
2748
2823
|
*
|
|
2749
2824
|
* @category Components
|
|
2750
2825
|
*/
|
|
2751
2826
|
class SoundComponentElement extends ComponentElement {
|
|
2827
|
+
/** @ignore */
|
|
2752
2828
|
constructor() {
|
|
2753
2829
|
super('sound');
|
|
2754
2830
|
this._distanceModel = 'linear';
|
|
@@ -2938,7 +3014,9 @@
|
|
|
2938
3014
|
customElements.define('pc-sounds', SoundComponentElement);
|
|
2939
3015
|
|
|
2940
3016
|
/**
|
|
2941
|
-
*
|
|
3017
|
+
* The SoundSlotElement interface provides properties and methods for manipulating
|
|
3018
|
+
* `<pc-sound>` elements. The SoundSlotElement interface also inherits the properties and
|
|
3019
|
+
* methods of the {@link AsyncElement} interface.
|
|
2942
3020
|
*/
|
|
2943
3021
|
class SoundSlotElement extends AsyncElement {
|
|
2944
3022
|
constructor() {
|
|
@@ -3179,7 +3257,9 @@
|
|
|
3179
3257
|
customElements.define('pc-sound', SoundSlotElement);
|
|
3180
3258
|
|
|
3181
3259
|
/**
|
|
3182
|
-
*
|
|
3260
|
+
* The ModelElement interface provides properties and methods for manipulating
|
|
3261
|
+
* `<pc-model>` elements. The ModelElement interface also inherits the properties and
|
|
3262
|
+
* methods of the {@link HTMLElement} interface.
|
|
3183
3263
|
*/
|
|
3184
3264
|
class ModelElement extends AsyncElement {
|
|
3185
3265
|
constructor() {
|
|
@@ -3272,7 +3352,9 @@
|
|
|
3272
3352
|
customElements.define('pc-model', ModelElement);
|
|
3273
3353
|
|
|
3274
3354
|
/**
|
|
3275
|
-
*
|
|
3355
|
+
* The SceneElement interface provides properties and methods for manipulating
|
|
3356
|
+
* `<pc-scene>` elements. The SceneElement interface also inherits the properties and
|
|
3357
|
+
* methods of the {@link HTMLElement} interface.
|
|
3276
3358
|
*/
|
|
3277
3359
|
class SceneElement extends AsyncElement {
|
|
3278
3360
|
constructor() {
|
|
@@ -3311,11 +3393,11 @@
|
|
|
3311
3393
|
}
|
|
3312
3394
|
updateSceneSettings() {
|
|
3313
3395
|
if (this.scene) {
|
|
3314
|
-
this.scene.
|
|
3315
|
-
this.scene.
|
|
3316
|
-
this.scene.
|
|
3317
|
-
this.scene.
|
|
3318
|
-
this.scene.
|
|
3396
|
+
this.scene.fog.type = this._fog;
|
|
3397
|
+
this.scene.fog.color = this._fogColor;
|
|
3398
|
+
this.scene.fog.density = this._fogDensity;
|
|
3399
|
+
this.scene.fog.start = this._fogStart;
|
|
3400
|
+
this.scene.fog.end = this._fogEnd;
|
|
3319
3401
|
// ... set other properties on the scene as well
|
|
3320
3402
|
}
|
|
3321
3403
|
}
|
|
@@ -3326,7 +3408,7 @@
|
|
|
3326
3408
|
set fog(value) {
|
|
3327
3409
|
this._fog = value;
|
|
3328
3410
|
if (this.scene) {
|
|
3329
|
-
this.scene.
|
|
3411
|
+
this.scene.fog.type = value;
|
|
3330
3412
|
}
|
|
3331
3413
|
}
|
|
3332
3414
|
/**
|
|
@@ -3343,7 +3425,7 @@
|
|
|
3343
3425
|
set fogColor(value) {
|
|
3344
3426
|
this._fogColor = value;
|
|
3345
3427
|
if (this.scene) {
|
|
3346
|
-
this.scene.
|
|
3428
|
+
this.scene.fog.color = value;
|
|
3347
3429
|
}
|
|
3348
3430
|
}
|
|
3349
3431
|
/**
|
|
@@ -3360,7 +3442,7 @@
|
|
|
3360
3442
|
set fogDensity(value) {
|
|
3361
3443
|
this._fogDensity = value;
|
|
3362
3444
|
if (this.scene) {
|
|
3363
|
-
this.scene.
|
|
3445
|
+
this.scene.fog.density = value;
|
|
3364
3446
|
}
|
|
3365
3447
|
}
|
|
3366
3448
|
/**
|
|
@@ -3377,7 +3459,7 @@
|
|
|
3377
3459
|
set fogStart(value) {
|
|
3378
3460
|
this._fogStart = value;
|
|
3379
3461
|
if (this.scene) {
|
|
3380
|
-
this.scene.
|
|
3462
|
+
this.scene.fog.start = value;
|
|
3381
3463
|
}
|
|
3382
3464
|
}
|
|
3383
3465
|
/**
|
|
@@ -3394,7 +3476,7 @@
|
|
|
3394
3476
|
set fogEnd(value) {
|
|
3395
3477
|
this._fogEnd = value;
|
|
3396
3478
|
if (this.scene) {
|
|
3397
|
-
this.scene.
|
|
3479
|
+
this.scene.fog.end = value;
|
|
3398
3480
|
}
|
|
3399
3481
|
}
|
|
3400
3482
|
/**
|
|
@@ -3431,7 +3513,9 @@
|
|
|
3431
3513
|
customElements.define('pc-scene', SceneElement);
|
|
3432
3514
|
|
|
3433
3515
|
/**
|
|
3434
|
-
*
|
|
3516
|
+
* The SkyElement interface provides properties and methods for manipulating
|
|
3517
|
+
* `<pc-sky>` elements. The SkyElement interface also inherits the properties and
|
|
3518
|
+
* methods of the {@link HTMLElement} interface.
|
|
3435
3519
|
*/
|
|
3436
3520
|
class SkyElement extends AsyncElement {
|
|
3437
3521
|
constructor() {
|