lythreeframe 1.2.42 → 1.2.44
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/bundle.cjs.js
CHANGED
|
@@ -81,6 +81,9 @@ class Component extends BaseObject {
|
|
|
81
81
|
}
|
|
82
82
|
set name(name) {
|
|
83
83
|
this._name = name;
|
|
84
|
+
if (this.obj) {
|
|
85
|
+
this.obj.name = name;
|
|
86
|
+
}
|
|
84
87
|
}
|
|
85
88
|
constructor(uuid) {
|
|
86
89
|
super(uuid ? uuid : webgpu.MathUtils.generateUUID());
|
|
@@ -642,6 +645,7 @@ class SceneComponent extends Component {
|
|
|
642
645
|
throw Error("targetComponent threeObject is invalid");
|
|
643
646
|
}
|
|
644
647
|
this.obj.remove(targetComponent.threeObject);
|
|
648
|
+
console.log("removeChildComponent");
|
|
645
649
|
targetComponent.destroy();
|
|
646
650
|
}
|
|
647
651
|
detachFromParentComponent() {
|
|
@@ -1499,8 +1503,11 @@ class WebGPUPostProcessFactory {
|
|
|
1499
1503
|
}
|
|
1500
1504
|
|
|
1501
1505
|
class Viewport {
|
|
1506
|
+
get uiDom() {
|
|
1507
|
+
return this._uiDom;
|
|
1508
|
+
}
|
|
1502
1509
|
get canvas() {
|
|
1503
|
-
return this.
|
|
1510
|
+
return this._canvasContainer;
|
|
1504
1511
|
}
|
|
1505
1512
|
get renderer() {
|
|
1506
1513
|
if (!this._renderer) {
|
|
@@ -1515,18 +1522,20 @@ class Viewport {
|
|
|
1515
1522
|
return this._app;
|
|
1516
1523
|
}
|
|
1517
1524
|
constructor(app, viewportParam, rendererParam, postProcessParam) {
|
|
1525
|
+
this._uiDom = null;
|
|
1518
1526
|
this._renderer = null;
|
|
1519
1527
|
this.labelRenderer = null;
|
|
1520
1528
|
this._app = null;
|
|
1521
1529
|
this.resizeObserver = null;
|
|
1522
|
-
this.
|
|
1530
|
+
this._outerContainer = null;
|
|
1531
|
+
this._canvasContainer = null;
|
|
1523
1532
|
this.isRenderStateDirty = true;
|
|
1524
1533
|
this.postProcessing = null;
|
|
1525
1534
|
this.outlineObjects = [];
|
|
1526
1535
|
this.postProcessParam = Object.assign({}, postProcessParam);
|
|
1527
1536
|
this._app = app;
|
|
1528
1537
|
if (viewportParam.elementId) {
|
|
1529
|
-
this.
|
|
1538
|
+
this._outerContainer = document.getElementById(viewportParam.elementId);
|
|
1530
1539
|
}
|
|
1531
1540
|
this.createRenderer(rendererParam);
|
|
1532
1541
|
if (viewportParam.isLabelRendererNeeded) {
|
|
@@ -1535,7 +1544,7 @@ class Viewport {
|
|
|
1535
1544
|
if (viewportParam.isUILayerNeeded) {
|
|
1536
1545
|
this.createUILayer();
|
|
1537
1546
|
}
|
|
1538
|
-
if (this.
|
|
1547
|
+
if (this._outerContainer) {
|
|
1539
1548
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1540
1549
|
for (let entry of entries) {
|
|
1541
1550
|
if (entry.contentBoxSize) {
|
|
@@ -1543,14 +1552,22 @@ class Viewport {
|
|
|
1543
1552
|
}
|
|
1544
1553
|
}
|
|
1545
1554
|
});
|
|
1546
|
-
this.resizeObserver.observe(this.
|
|
1555
|
+
this.resizeObserver.observe(this._outerContainer);
|
|
1547
1556
|
}
|
|
1548
1557
|
this.app.onCameraChangedDelegate.add(() => {
|
|
1549
1558
|
this.setupPostProcess();
|
|
1550
1559
|
});
|
|
1551
1560
|
}
|
|
1552
1561
|
createRenderer(rendererParam) {
|
|
1553
|
-
|
|
1562
|
+
if (this._outerContainer) {
|
|
1563
|
+
this._canvasContainer = document.createElement("div");
|
|
1564
|
+
this._canvasContainer.style.left = "0px";
|
|
1565
|
+
this._canvasContainer.style.top = "0px";
|
|
1566
|
+
this._canvasContainer.style.width = "100%";
|
|
1567
|
+
this._canvasContainer.style.height = "100%";
|
|
1568
|
+
this._outerContainer.appendChild(this._canvasContainer);
|
|
1569
|
+
}
|
|
1570
|
+
const element = this._canvasContainer;
|
|
1554
1571
|
if (this._renderer) {
|
|
1555
1572
|
if (element) {
|
|
1556
1573
|
element.removeChild(this._renderer.domElement);
|
|
@@ -1580,12 +1597,12 @@ class Viewport {
|
|
|
1580
1597
|
}
|
|
1581
1598
|
}
|
|
1582
1599
|
createLabelRenderer() {
|
|
1583
|
-
const element = this.
|
|
1600
|
+
const element = this._outerContainer;
|
|
1584
1601
|
if (this.labelRenderer) {
|
|
1585
1602
|
if (element) {
|
|
1586
1603
|
element.removeChild(this.labelRenderer.domElement);
|
|
1587
1604
|
}
|
|
1588
|
-
this.labelRenderer.dispose();
|
|
1605
|
+
// this.labelRenderer.dispose();
|
|
1589
1606
|
}
|
|
1590
1607
|
let width = element ? element.clientWidth : 512;
|
|
1591
1608
|
let height = element ? element.clientHeight : 512;
|
|
@@ -1600,13 +1617,14 @@ class Viewport {
|
|
|
1600
1617
|
}
|
|
1601
1618
|
}
|
|
1602
1619
|
createUILayer() {
|
|
1603
|
-
if (!this.
|
|
1620
|
+
if (!this._outerContainer)
|
|
1604
1621
|
return;
|
|
1605
1622
|
// 检查是否已存在 UI 层,避免重复创建
|
|
1606
|
-
let uiLayer = this.
|
|
1623
|
+
let uiLayer = this._outerContainer.querySelector('.scene-uiLayer');
|
|
1607
1624
|
if (!uiLayer) {
|
|
1608
1625
|
uiLayer = document.createElement('div');
|
|
1609
1626
|
uiLayer.className = 'scene-uiLayer';
|
|
1627
|
+
uiLayer.id = "scene-uiLayer";
|
|
1610
1628
|
uiLayer.style.position = 'absolute';
|
|
1611
1629
|
uiLayer.style.left = '0';
|
|
1612
1630
|
uiLayer.style.top = '0';
|
|
@@ -1614,22 +1632,13 @@ class Viewport {
|
|
|
1614
1632
|
uiLayer.style.height = '100%';
|
|
1615
1633
|
uiLayer.style.pointerEvents = 'none'; // UI层默认不响应鼠标事件
|
|
1616
1634
|
uiLayer.style.zIndex = '10'; // 保证在渲染层之上
|
|
1617
|
-
this.
|
|
1635
|
+
this._outerContainer.appendChild(uiLayer);
|
|
1636
|
+
this._uiDom = uiLayer;
|
|
1618
1637
|
}
|
|
1619
1638
|
}
|
|
1620
1639
|
init() {
|
|
1621
1640
|
this.setupPostProcess();
|
|
1622
1641
|
}
|
|
1623
|
-
addWidget(widget) {
|
|
1624
|
-
if (!this._canvas)
|
|
1625
|
-
return;
|
|
1626
|
-
let uiLayer = this._canvas.querySelector('.scene-uiLayer');
|
|
1627
|
-
if (!uiLayer) {
|
|
1628
|
-
console.warn("UI Layer not found, check your settings.");
|
|
1629
|
-
return;
|
|
1630
|
-
}
|
|
1631
|
-
uiLayer.appendChild(widget);
|
|
1632
|
-
}
|
|
1633
1642
|
setupPostProcess() {
|
|
1634
1643
|
if (this.postProcessParam.steps.length === 0) {
|
|
1635
1644
|
this.destroyPostProcess();
|
|
@@ -1788,7 +1797,7 @@ class Viewport {
|
|
|
1788
1797
|
}
|
|
1789
1798
|
onWindowResize() {
|
|
1790
1799
|
//console.log("resize")
|
|
1791
|
-
let ele = this.
|
|
1800
|
+
let ele = this._outerContainer;
|
|
1792
1801
|
if (!ele) {
|
|
1793
1802
|
return;
|
|
1794
1803
|
}
|
|
@@ -1825,6 +1834,17 @@ class Viewport {
|
|
|
1825
1834
|
else {
|
|
1826
1835
|
await this.renderer.renderAsync(this.app.world.scene, this.app.camera);
|
|
1827
1836
|
}
|
|
1837
|
+
// 检查 renderer.domElement 的尺寸
|
|
1838
|
+
const sourceWidth = this.renderer.domElement.width;
|
|
1839
|
+
const sourceHeight = this.renderer.domElement.height;
|
|
1840
|
+
// 如果源尺寸为0,则使用容器尺寸
|
|
1841
|
+
let actualWidth = sourceWidth || width;
|
|
1842
|
+
let actualHeight = sourceHeight || height;
|
|
1843
|
+
if (actualWidth <= 0 || actualHeight <= 0) {
|
|
1844
|
+
// 如果仍然无效,则使用默认值
|
|
1845
|
+
actualWidth = width;
|
|
1846
|
+
actualHeight = height;
|
|
1847
|
+
}
|
|
1828
1848
|
const offscreenCanvas = document.createElement('canvas');
|
|
1829
1849
|
offscreenCanvas.width = width;
|
|
1830
1850
|
offscreenCanvas.height = height;
|
|
@@ -1832,7 +1852,8 @@ class Viewport {
|
|
|
1832
1852
|
if (!context) {
|
|
1833
1853
|
throw Error("Can not create context");
|
|
1834
1854
|
}
|
|
1835
|
-
|
|
1855
|
+
// 使用实际尺寸进行绘制
|
|
1856
|
+
context.drawImage(this.renderer.domElement, 0, 0, actualWidth, actualHeight, 0, 0, width, height);
|
|
1836
1857
|
const ret = offscreenCanvas.toDataURL('image/jpeg');
|
|
1837
1858
|
offscreenCanvas.remove();
|
|
1838
1859
|
resolve(ret);
|
|
@@ -1908,7 +1929,7 @@ class Viewport {
|
|
|
1908
1929
|
this._renderer = null;
|
|
1909
1930
|
}
|
|
1910
1931
|
(_a = this.postProcessing) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
1911
|
-
this.
|
|
1932
|
+
this._outerContainer = null;
|
|
1912
1933
|
this._app = null;
|
|
1913
1934
|
this._renderer = null;
|
|
1914
1935
|
this.outlineObjects = [];
|
|
@@ -2112,10 +2133,12 @@ class Controller {
|
|
|
2112
2133
|
}
|
|
2113
2134
|
updateCamera() {
|
|
2114
2135
|
var _a, _b;
|
|
2136
|
+
let isPawnEnabled = this.pawn.enabled;
|
|
2115
2137
|
(_a = this._pawn) === null || _a === void 0 ? void 0 : _a.unpossess();
|
|
2116
2138
|
(_b = this._pawn) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
2117
2139
|
this._pawn = new Orbital(this);
|
|
2118
2140
|
this.pawn.possess();
|
|
2141
|
+
this.pawn.enabled = isPawnEnabled;
|
|
2119
2142
|
}
|
|
2120
2143
|
init() {
|
|
2121
2144
|
if (this.viewPort.canvas) {
|
|
@@ -2914,7 +2937,8 @@ class ThreeJsApp {
|
|
|
2914
2937
|
this._controller = new this._appParam.classes.controllerClass(this);
|
|
2915
2938
|
this._assetManager = new this._appParam.classes.assetManagerClass(this);
|
|
2916
2939
|
this.viewport.renderer.setAnimationLoop(() => {
|
|
2917
|
-
this.
|
|
2940
|
+
const delta = this._clock.getDelta();
|
|
2941
|
+
this.tick(delta);
|
|
2918
2942
|
});
|
|
2919
2943
|
this.postConstruct();
|
|
2920
2944
|
}
|
|
@@ -2925,12 +2949,11 @@ class ThreeJsApp {
|
|
|
2925
2949
|
}
|
|
2926
2950
|
init() {
|
|
2927
2951
|
}
|
|
2928
|
-
tick() {
|
|
2929
|
-
|
|
2930
|
-
this.
|
|
2931
|
-
this.world.tick(delta);
|
|
2952
|
+
tick(deltaTime) {
|
|
2953
|
+
this._controller.tick(deltaTime);
|
|
2954
|
+
this.world.tick(deltaTime);
|
|
2932
2955
|
this._tickingFunctions.forEach(func => {
|
|
2933
|
-
func(
|
|
2956
|
+
func(deltaTime);
|
|
2934
2957
|
});
|
|
2935
2958
|
if (this._appParam.isRenderEveryFrame) {
|
|
2936
2959
|
this.viewport.markRenderStateDirty();
|
|
@@ -2958,9 +2981,9 @@ class ThreeJsApp {
|
|
|
2958
2981
|
this._camera = CameraFactory.updataCamera(param, this.camera);
|
|
2959
2982
|
if (previousCam !== this.camera) {
|
|
2960
2983
|
this._onCameraChangedDelegate.broadcast();
|
|
2984
|
+
this.controller.updateCamera();
|
|
2961
2985
|
}
|
|
2962
2986
|
this._camera.updateProjectionMatrix();
|
|
2963
|
-
this.controller.updateCamera();
|
|
2964
2987
|
this.viewport.markRenderStateDirty();
|
|
2965
2988
|
}
|
|
2966
2989
|
onWindowResize(width, height) {
|
package/dist/bundle.esm.js
CHANGED
|
@@ -79,6 +79,9 @@ class Component extends BaseObject {
|
|
|
79
79
|
}
|
|
80
80
|
set name(name) {
|
|
81
81
|
this._name = name;
|
|
82
|
+
if (this.obj) {
|
|
83
|
+
this.obj.name = name;
|
|
84
|
+
}
|
|
82
85
|
}
|
|
83
86
|
constructor(uuid) {
|
|
84
87
|
super(uuid ? uuid : MathUtils.generateUUID());
|
|
@@ -640,6 +643,7 @@ class SceneComponent extends Component {
|
|
|
640
643
|
throw Error("targetComponent threeObject is invalid");
|
|
641
644
|
}
|
|
642
645
|
this.obj.remove(targetComponent.threeObject);
|
|
646
|
+
console.log("removeChildComponent");
|
|
643
647
|
targetComponent.destroy();
|
|
644
648
|
}
|
|
645
649
|
detachFromParentComponent() {
|
|
@@ -1497,8 +1501,11 @@ class WebGPUPostProcessFactory {
|
|
|
1497
1501
|
}
|
|
1498
1502
|
|
|
1499
1503
|
class Viewport {
|
|
1504
|
+
get uiDom() {
|
|
1505
|
+
return this._uiDom;
|
|
1506
|
+
}
|
|
1500
1507
|
get canvas() {
|
|
1501
|
-
return this.
|
|
1508
|
+
return this._canvasContainer;
|
|
1502
1509
|
}
|
|
1503
1510
|
get renderer() {
|
|
1504
1511
|
if (!this._renderer) {
|
|
@@ -1513,18 +1520,20 @@ class Viewport {
|
|
|
1513
1520
|
return this._app;
|
|
1514
1521
|
}
|
|
1515
1522
|
constructor(app, viewportParam, rendererParam, postProcessParam) {
|
|
1523
|
+
this._uiDom = null;
|
|
1516
1524
|
this._renderer = null;
|
|
1517
1525
|
this.labelRenderer = null;
|
|
1518
1526
|
this._app = null;
|
|
1519
1527
|
this.resizeObserver = null;
|
|
1520
|
-
this.
|
|
1528
|
+
this._outerContainer = null;
|
|
1529
|
+
this._canvasContainer = null;
|
|
1521
1530
|
this.isRenderStateDirty = true;
|
|
1522
1531
|
this.postProcessing = null;
|
|
1523
1532
|
this.outlineObjects = [];
|
|
1524
1533
|
this.postProcessParam = Object.assign({}, postProcessParam);
|
|
1525
1534
|
this._app = app;
|
|
1526
1535
|
if (viewportParam.elementId) {
|
|
1527
|
-
this.
|
|
1536
|
+
this._outerContainer = document.getElementById(viewportParam.elementId);
|
|
1528
1537
|
}
|
|
1529
1538
|
this.createRenderer(rendererParam);
|
|
1530
1539
|
if (viewportParam.isLabelRendererNeeded) {
|
|
@@ -1533,7 +1542,7 @@ class Viewport {
|
|
|
1533
1542
|
if (viewportParam.isUILayerNeeded) {
|
|
1534
1543
|
this.createUILayer();
|
|
1535
1544
|
}
|
|
1536
|
-
if (this.
|
|
1545
|
+
if (this._outerContainer) {
|
|
1537
1546
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1538
1547
|
for (let entry of entries) {
|
|
1539
1548
|
if (entry.contentBoxSize) {
|
|
@@ -1541,14 +1550,22 @@ class Viewport {
|
|
|
1541
1550
|
}
|
|
1542
1551
|
}
|
|
1543
1552
|
});
|
|
1544
|
-
this.resizeObserver.observe(this.
|
|
1553
|
+
this.resizeObserver.observe(this._outerContainer);
|
|
1545
1554
|
}
|
|
1546
1555
|
this.app.onCameraChangedDelegate.add(() => {
|
|
1547
1556
|
this.setupPostProcess();
|
|
1548
1557
|
});
|
|
1549
1558
|
}
|
|
1550
1559
|
createRenderer(rendererParam) {
|
|
1551
|
-
|
|
1560
|
+
if (this._outerContainer) {
|
|
1561
|
+
this._canvasContainer = document.createElement("div");
|
|
1562
|
+
this._canvasContainer.style.left = "0px";
|
|
1563
|
+
this._canvasContainer.style.top = "0px";
|
|
1564
|
+
this._canvasContainer.style.width = "100%";
|
|
1565
|
+
this._canvasContainer.style.height = "100%";
|
|
1566
|
+
this._outerContainer.appendChild(this._canvasContainer);
|
|
1567
|
+
}
|
|
1568
|
+
const element = this._canvasContainer;
|
|
1552
1569
|
if (this._renderer) {
|
|
1553
1570
|
if (element) {
|
|
1554
1571
|
element.removeChild(this._renderer.domElement);
|
|
@@ -1578,12 +1595,12 @@ class Viewport {
|
|
|
1578
1595
|
}
|
|
1579
1596
|
}
|
|
1580
1597
|
createLabelRenderer() {
|
|
1581
|
-
const element = this.
|
|
1598
|
+
const element = this._outerContainer;
|
|
1582
1599
|
if (this.labelRenderer) {
|
|
1583
1600
|
if (element) {
|
|
1584
1601
|
element.removeChild(this.labelRenderer.domElement);
|
|
1585
1602
|
}
|
|
1586
|
-
this.labelRenderer.dispose();
|
|
1603
|
+
// this.labelRenderer.dispose();
|
|
1587
1604
|
}
|
|
1588
1605
|
let width = element ? element.clientWidth : 512;
|
|
1589
1606
|
let height = element ? element.clientHeight : 512;
|
|
@@ -1598,13 +1615,14 @@ class Viewport {
|
|
|
1598
1615
|
}
|
|
1599
1616
|
}
|
|
1600
1617
|
createUILayer() {
|
|
1601
|
-
if (!this.
|
|
1618
|
+
if (!this._outerContainer)
|
|
1602
1619
|
return;
|
|
1603
1620
|
// 检查是否已存在 UI 层,避免重复创建
|
|
1604
|
-
let uiLayer = this.
|
|
1621
|
+
let uiLayer = this._outerContainer.querySelector('.scene-uiLayer');
|
|
1605
1622
|
if (!uiLayer) {
|
|
1606
1623
|
uiLayer = document.createElement('div');
|
|
1607
1624
|
uiLayer.className = 'scene-uiLayer';
|
|
1625
|
+
uiLayer.id = "scene-uiLayer";
|
|
1608
1626
|
uiLayer.style.position = 'absolute';
|
|
1609
1627
|
uiLayer.style.left = '0';
|
|
1610
1628
|
uiLayer.style.top = '0';
|
|
@@ -1612,22 +1630,13 @@ class Viewport {
|
|
|
1612
1630
|
uiLayer.style.height = '100%';
|
|
1613
1631
|
uiLayer.style.pointerEvents = 'none'; // UI层默认不响应鼠标事件
|
|
1614
1632
|
uiLayer.style.zIndex = '10'; // 保证在渲染层之上
|
|
1615
|
-
this.
|
|
1633
|
+
this._outerContainer.appendChild(uiLayer);
|
|
1634
|
+
this._uiDom = uiLayer;
|
|
1616
1635
|
}
|
|
1617
1636
|
}
|
|
1618
1637
|
init() {
|
|
1619
1638
|
this.setupPostProcess();
|
|
1620
1639
|
}
|
|
1621
|
-
addWidget(widget) {
|
|
1622
|
-
if (!this._canvas)
|
|
1623
|
-
return;
|
|
1624
|
-
let uiLayer = this._canvas.querySelector('.scene-uiLayer');
|
|
1625
|
-
if (!uiLayer) {
|
|
1626
|
-
console.warn("UI Layer not found, check your settings.");
|
|
1627
|
-
return;
|
|
1628
|
-
}
|
|
1629
|
-
uiLayer.appendChild(widget);
|
|
1630
|
-
}
|
|
1631
1640
|
setupPostProcess() {
|
|
1632
1641
|
if (this.postProcessParam.steps.length === 0) {
|
|
1633
1642
|
this.destroyPostProcess();
|
|
@@ -1786,7 +1795,7 @@ class Viewport {
|
|
|
1786
1795
|
}
|
|
1787
1796
|
onWindowResize() {
|
|
1788
1797
|
//console.log("resize")
|
|
1789
|
-
let ele = this.
|
|
1798
|
+
let ele = this._outerContainer;
|
|
1790
1799
|
if (!ele) {
|
|
1791
1800
|
return;
|
|
1792
1801
|
}
|
|
@@ -1823,6 +1832,17 @@ class Viewport {
|
|
|
1823
1832
|
else {
|
|
1824
1833
|
await this.renderer.renderAsync(this.app.world.scene, this.app.camera);
|
|
1825
1834
|
}
|
|
1835
|
+
// 检查 renderer.domElement 的尺寸
|
|
1836
|
+
const sourceWidth = this.renderer.domElement.width;
|
|
1837
|
+
const sourceHeight = this.renderer.domElement.height;
|
|
1838
|
+
// 如果源尺寸为0,则使用容器尺寸
|
|
1839
|
+
let actualWidth = sourceWidth || width;
|
|
1840
|
+
let actualHeight = sourceHeight || height;
|
|
1841
|
+
if (actualWidth <= 0 || actualHeight <= 0) {
|
|
1842
|
+
// 如果仍然无效,则使用默认值
|
|
1843
|
+
actualWidth = width;
|
|
1844
|
+
actualHeight = height;
|
|
1845
|
+
}
|
|
1826
1846
|
const offscreenCanvas = document.createElement('canvas');
|
|
1827
1847
|
offscreenCanvas.width = width;
|
|
1828
1848
|
offscreenCanvas.height = height;
|
|
@@ -1830,7 +1850,8 @@ class Viewport {
|
|
|
1830
1850
|
if (!context) {
|
|
1831
1851
|
throw Error("Can not create context");
|
|
1832
1852
|
}
|
|
1833
|
-
|
|
1853
|
+
// 使用实际尺寸进行绘制
|
|
1854
|
+
context.drawImage(this.renderer.domElement, 0, 0, actualWidth, actualHeight, 0, 0, width, height);
|
|
1834
1855
|
const ret = offscreenCanvas.toDataURL('image/jpeg');
|
|
1835
1856
|
offscreenCanvas.remove();
|
|
1836
1857
|
resolve(ret);
|
|
@@ -1906,7 +1927,7 @@ class Viewport {
|
|
|
1906
1927
|
this._renderer = null;
|
|
1907
1928
|
}
|
|
1908
1929
|
(_a = this.postProcessing) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
1909
|
-
this.
|
|
1930
|
+
this._outerContainer = null;
|
|
1910
1931
|
this._app = null;
|
|
1911
1932
|
this._renderer = null;
|
|
1912
1933
|
this.outlineObjects = [];
|
|
@@ -2110,10 +2131,12 @@ class Controller {
|
|
|
2110
2131
|
}
|
|
2111
2132
|
updateCamera() {
|
|
2112
2133
|
var _a, _b;
|
|
2134
|
+
let isPawnEnabled = this.pawn.enabled;
|
|
2113
2135
|
(_a = this._pawn) === null || _a === void 0 ? void 0 : _a.unpossess();
|
|
2114
2136
|
(_b = this._pawn) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
2115
2137
|
this._pawn = new Orbital(this);
|
|
2116
2138
|
this.pawn.possess();
|
|
2139
|
+
this.pawn.enabled = isPawnEnabled;
|
|
2117
2140
|
}
|
|
2118
2141
|
init() {
|
|
2119
2142
|
if (this.viewPort.canvas) {
|
|
@@ -2912,7 +2935,8 @@ class ThreeJsApp {
|
|
|
2912
2935
|
this._controller = new this._appParam.classes.controllerClass(this);
|
|
2913
2936
|
this._assetManager = new this._appParam.classes.assetManagerClass(this);
|
|
2914
2937
|
this.viewport.renderer.setAnimationLoop(() => {
|
|
2915
|
-
this.
|
|
2938
|
+
const delta = this._clock.getDelta();
|
|
2939
|
+
this.tick(delta);
|
|
2916
2940
|
});
|
|
2917
2941
|
this.postConstruct();
|
|
2918
2942
|
}
|
|
@@ -2923,12 +2947,11 @@ class ThreeJsApp {
|
|
|
2923
2947
|
}
|
|
2924
2948
|
init() {
|
|
2925
2949
|
}
|
|
2926
|
-
tick() {
|
|
2927
|
-
|
|
2928
|
-
this.
|
|
2929
|
-
this.world.tick(delta);
|
|
2950
|
+
tick(deltaTime) {
|
|
2951
|
+
this._controller.tick(deltaTime);
|
|
2952
|
+
this.world.tick(deltaTime);
|
|
2930
2953
|
this._tickingFunctions.forEach(func => {
|
|
2931
|
-
func(
|
|
2954
|
+
func(deltaTime);
|
|
2932
2955
|
});
|
|
2933
2956
|
if (this._appParam.isRenderEveryFrame) {
|
|
2934
2957
|
this.viewport.markRenderStateDirty();
|
|
@@ -2956,9 +2979,9 @@ class ThreeJsApp {
|
|
|
2956
2979
|
this._camera = CameraFactory.updataCamera(param, this.camera);
|
|
2957
2980
|
if (previousCam !== this.camera) {
|
|
2958
2981
|
this._onCameraChangedDelegate.broadcast();
|
|
2982
|
+
this.controller.updateCamera();
|
|
2959
2983
|
}
|
|
2960
2984
|
this._camera.updateProjectionMatrix();
|
|
2961
|
-
this.controller.updateCamera();
|
|
2962
2985
|
this.viewport.markRenderStateDirty();
|
|
2963
2986
|
}
|
|
2964
2987
|
onWindowResize(width, height) {
|
|
@@ -4,6 +4,8 @@ import { PostProcessParam, PostProcessStepParam } from './../PostProcess/PostPro
|
|
|
4
4
|
import { RendererParameters } from './Parameters/RendererParameters';
|
|
5
5
|
import { ViewportParam } from './Parameters/ViewportParameters';
|
|
6
6
|
export declare class Viewport {
|
|
7
|
+
get uiDom(): HTMLDivElement | null;
|
|
8
|
+
protected _uiDom: HTMLDivElement | null;
|
|
7
9
|
get canvas(): HTMLElement | null;
|
|
8
10
|
get renderer(): WebGPURenderer;
|
|
9
11
|
get app(): ThreeJsApp;
|
|
@@ -11,7 +13,8 @@ export declare class Viewport {
|
|
|
11
13
|
private labelRenderer;
|
|
12
14
|
protected _app: ThreeJsApp | null;
|
|
13
15
|
private resizeObserver;
|
|
14
|
-
private
|
|
16
|
+
private _outerContainer;
|
|
17
|
+
private _canvasContainer;
|
|
15
18
|
private isRenderStateDirty;
|
|
16
19
|
private postProcessParam;
|
|
17
20
|
private postProcessing;
|
|
@@ -21,7 +24,6 @@ export declare class Viewport {
|
|
|
21
24
|
protected createLabelRenderer(): void;
|
|
22
25
|
protected createUILayer(): void;
|
|
23
26
|
init(): void;
|
|
24
|
-
addWidget(widget: HTMLElement): void;
|
|
25
27
|
setupPostProcess(): void;
|
|
26
28
|
updatePostProcess(steps: PostProcessStepParam[]): void;
|
|
27
29
|
updateRendererSettings(data: RendererParameters): void;
|
|
@@ -27,7 +27,7 @@ export declare class ThreeJsApp {
|
|
|
27
27
|
constructor(appParam?: AppParam);
|
|
28
28
|
protected postConstruct(): void;
|
|
29
29
|
init(): void;
|
|
30
|
-
tick(): void;
|
|
30
|
+
protected tick(deltaTime: number): void;
|
|
31
31
|
addTickingFunction(func: (deltaTime: number) => void): void;
|
|
32
32
|
removeTickingFunction(func: (deltaTime: number) => void): void;
|
|
33
33
|
destroy(): void;
|