|
@@ -1,11 +1,13 @@
|
|
|
import UseThree from '../../../../utils/threejs/useThree';
|
|
|
import balancePressBase from './balancePress.threejs.base';
|
|
|
+import balancePressTun from './balancePress.threejs.tun';
|
|
|
import { animateCamera } from '/@/utils/threejs/util';
|
|
|
import useEvent from '../../../../utils/threejs/useEvent';
|
|
|
|
|
|
// 模型对象、 文字对象
|
|
|
let model,
|
|
|
balancePressBaseObj: balancePressBase | undefined,
|
|
|
+ balancePressTunObj: balancePressTun | undefined,
|
|
|
group: THREE.Object3D | undefined,
|
|
|
balancePressType = 'balancePressBase'; // workerFaceFiber
|
|
|
|
|
@@ -47,11 +49,14 @@ export const play = (controlType, deviceType, frequency, state, duration?) => {
|
|
|
export const updateText = (selectData) => {
|
|
|
if (balancePressType === 'balancePressBase') {
|
|
|
return balancePressBaseObj?.addText.call(balancePressBaseObj, selectData);
|
|
|
+ } else if (balancePressType === 'balancePressTun') {
|
|
|
+ return balancePressTunObj?.addText.call(balancePressTunObj, selectData);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// 切换模型类型
|
|
|
export const setModelType = (type) => {
|
|
|
+ debugger;
|
|
|
balancePressType = type;
|
|
|
return new Promise((resolve) => {
|
|
|
if (balancePressType === 'balancePressBase' && balancePressBaseObj && balancePressBaseObj.group) {
|
|
@@ -72,6 +77,24 @@ export const setModelType = (type) => {
|
|
|
}
|
|
|
|
|
|
resolve(null);
|
|
|
+ } else if (balancePressType === 'balancePressTun' && balancePressTunObj && balancePressTunObj.group) {
|
|
|
+ group = balancePressTunObj.group;
|
|
|
+ if (group) {
|
|
|
+ const oldCameraPosition = { x: 27.9165, y: 17.3763, z: 51.3388 };
|
|
|
+ setTimeout(async () => {
|
|
|
+ model.scene.add(balancePressTunObj?.group);
|
|
|
+ await animateCamera(
|
|
|
+ oldCameraPosition,
|
|
|
+ { x: 3.9025, y: 0.7782, z: 6.6307 },
|
|
|
+ { x: 1.4763946591400468, y: 28.41203761378685, z: 14.142784066252352 },
|
|
|
+ { x: 1.334507975656787, y: 1.6848765189635717, z: -1.5733583795572064 },
|
|
|
+ model,
|
|
|
+ 0.8
|
|
|
+ );
|
|
|
+ }, 300);
|
|
|
+ }
|
|
|
+
|
|
|
+ resolve(null);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
@@ -84,6 +107,9 @@ export const mountedThree = () => {
|
|
|
balancePressBaseObj = new balancePressBase(model);
|
|
|
await balancePressBaseObj.mountedThree();
|
|
|
|
|
|
+ balancePressTunObj = new balancePressTun(model);
|
|
|
+ await balancePressTunObj.mountedThree();
|
|
|
+
|
|
|
addMouseEvent();
|
|
|
model.animate();
|
|
|
resolve(null);
|
|
@@ -96,6 +122,8 @@ export const destroy = () => {
|
|
|
console.log('场景销毁前信息----------->', model.renderer?.info);
|
|
|
balancePressBaseObj?.destroy();
|
|
|
balancePressBaseObj = undefined;
|
|
|
+ balancePressTunObj?.destroy();
|
|
|
+ balancePressTunObj = undefined;
|
|
|
group = undefined;
|
|
|
model.destroy();
|
|
|
model = undefined;
|