|
@@ -301,121 +301,119 @@ export const play = (rotationParam, flag) => {
|
|
|
|
|
|
// 切换风窗类型
|
|
|
export const setModelType = (type) => {
|
|
|
- if (!model) return;
|
|
|
- // if (!model || !model.scene) return;
|
|
|
- windowType = type;
|
|
|
- const windowConfigurations = {
|
|
|
- sdFc1: {
|
|
|
- render: sdFc1 ? () => sdFc1.render() : null,
|
|
|
- group: sdFc1 ? sdFc1.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- ddFc5: {
|
|
|
- render: ddFc5 ? () => ddFc5.render() : null,
|
|
|
- group: ddFc5 ? ddFc5.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- ddFc6: {
|
|
|
- render: ddFc6 ? () => ddFc6.render() : null,
|
|
|
- group: ddFc6 ? ddFc6.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- ddFc7: {
|
|
|
- render: ddFc7 ? () => ddFc7.render() : null,
|
|
|
- group: ddFc7 ? ddFc7.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- ddFc8: {
|
|
|
- render: ddFc8 ? () => ddFc8.render() : null,
|
|
|
- group: ddFc8 ? ddFc8.group : null,
|
|
|
- newP: { x: 32.78, y: 64.88, z: 106.78 },
|
|
|
- newT: { x: -6.12, y: 13.27, z: -4.64 },
|
|
|
- },
|
|
|
- ddFc1: {
|
|
|
- render: ddFc1 ? () => ddFc1.render() : null,
|
|
|
- group: ddFc1 ? ddFc1.group : null,
|
|
|
- newP: { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 },
|
|
|
- newT: { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 },
|
|
|
- },
|
|
|
- ddFc2: {
|
|
|
- render: ddFc2 ? () => ddFc2.render() : null,
|
|
|
- group: ddFc2 ? ddFc2.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- ddFc4: {
|
|
|
- render: ddFc4 ? () => ddFc4.render() : null,
|
|
|
- group: ddFc4 ? ddFc4.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- sdFc3: {
|
|
|
- render: sdFc3 ? () => sdFc3.render() : null,
|
|
|
- group: sdFc3 ? sdFc3.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- sdFc4: {
|
|
|
- render: sdFc4 ? () => sdFc4.render() : null,
|
|
|
- group: sdFc4 ? sdFc4.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- sdFc2: {
|
|
|
- render: sdFc2 ? () => sdFc2.render() : null,
|
|
|
- group: sdFc2 ? sdFc2.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: 0, y: 0, z: 0 },
|
|
|
- },
|
|
|
- sdFc5: {
|
|
|
- render: sdFc5 ? () => sdFc5.render() : null,
|
|
|
- group: sdFc5 ? sdFc5.group : null,
|
|
|
- newP: { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 },
|
|
|
- newT: { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 },
|
|
|
- },
|
|
|
- threeFc8: {
|
|
|
- render: threeFc8 ? () => threeFc8.render() : null,
|
|
|
- group: threeFc8 ? threeFc8.group : null,
|
|
|
- newP: { x: 70.79925059068043, y: 61.89235869996884, z: 107.07997293517579 },
|
|
|
- newT: { x: 15.353809053159333, y: 8.712511207091119, z: -13.223119892513122 },
|
|
|
- },
|
|
|
- singleXkWindow: {
|
|
|
- render: singleWindowXkObj ? () => singleWindowXkObj.render() : null,
|
|
|
- group: singleWindowXkObj ? singleWindowXkObj.group : null,
|
|
|
- newP: { x: 116.08531358656566, y: 81.45510733175816, z: 193.00752046594465 },
|
|
|
- newT: { x: 23.446366480086372, y: -12.335134633777185, z: -5.63294282643405 },
|
|
|
- },
|
|
|
- sdFcZhq: {
|
|
|
- render: sdFcZhq ? () => sdFcZhq.render() : null,
|
|
|
- group: sdFcZhq ? sdFcZhq.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: -2.28, y: -0.91, z: -5.68 },
|
|
|
- },
|
|
|
- };
|
|
|
- const oldCameraPosition = { x: 100, y: 0, z: 10 };
|
|
|
- model.scene?.remove(group);
|
|
|
- function handleWindowType(windowType: string, model: any) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ if (!model) resolve(null);
|
|
|
+ windowType = type;
|
|
|
+ const windowConfigurations = {
|
|
|
+ sdFc1: {
|
|
|
+ render: sdFc1 ? () => sdFc1.render() : null,
|
|
|
+ group: sdFc1 ? sdFc1.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ ddFc5: {
|
|
|
+ render: ddFc5 ? () => ddFc5.render() : null,
|
|
|
+ group: ddFc5 ? ddFc5.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ ddFc6: {
|
|
|
+ render: ddFc6 ? () => ddFc6.render() : null,
|
|
|
+ group: ddFc6 ? ddFc6.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ ddFc7: {
|
|
|
+ render: ddFc7 ? () => ddFc7.render() : null,
|
|
|
+ group: ddFc7 ? ddFc7.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ ddFc8: {
|
|
|
+ render: ddFc8 ? () => ddFc8.render() : null,
|
|
|
+ group: ddFc8 ? ddFc8.group : null,
|
|
|
+ newP: { x: 32.78, y: 64.88, z: 106.78 },
|
|
|
+ newT: { x: -6.12, y: 13.27, z: -4.64 },
|
|
|
+ },
|
|
|
+ ddFc1: {
|
|
|
+ render: ddFc1 ? () => ddFc1.render() : null,
|
|
|
+ group: ddFc1 ? ddFc1.group : null,
|
|
|
+ newP: { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 },
|
|
|
+ newT: { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 },
|
|
|
+ },
|
|
|
+ ddFc2: {
|
|
|
+ render: ddFc2 ? () => ddFc2.render() : null,
|
|
|
+ group: ddFc2 ? ddFc2.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ ddFc4: {
|
|
|
+ render: ddFc4 ? () => ddFc4.render() : null,
|
|
|
+ group: ddFc4 ? ddFc4.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ sdFc3: {
|
|
|
+ render: sdFc3 ? () => sdFc3.render() : null,
|
|
|
+ group: sdFc3 ? sdFc3.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ sdFc4: {
|
|
|
+ render: sdFc4 ? () => sdFc4.render() : null,
|
|
|
+ group: sdFc4 ? sdFc4.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ sdFc2: {
|
|
|
+ render: sdFc2 ? () => sdFc2.render() : null,
|
|
|
+ group: sdFc2 ? sdFc2.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: 0, y: 0, z: 0 },
|
|
|
+ },
|
|
|
+ sdFc5: {
|
|
|
+ render: sdFc5 ? () => sdFc5.render() : null,
|
|
|
+ group: sdFc5 ? sdFc5.group : null,
|
|
|
+ newP: { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 },
|
|
|
+ newT: { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 },
|
|
|
+ },
|
|
|
+ threeFc8: {
|
|
|
+ render: threeFc8 ? () => threeFc8.render() : null,
|
|
|
+ group: threeFc8 ? threeFc8.group : null,
|
|
|
+ newP: { x: 70.79925059068043, y: 61.89235869996884, z: 107.07997293517579 },
|
|
|
+ newT: { x: 15.353809053159333, y: 8.712511207091119, z: -13.223119892513122 },
|
|
|
+ },
|
|
|
+ singleXkWindow: {
|
|
|
+ render: singleWindowXkObj ? () => singleWindowXkObj.render() : null,
|
|
|
+ group: singleWindowXkObj ? singleWindowXkObj.group : null,
|
|
|
+ newP: { x: 116.08531358656566, y: 81.45510733175816, z: 193.00752046594465 },
|
|
|
+ newT: { x: 23.446366480086372, y: -12.335134633777185, z: -5.63294282643405 },
|
|
|
+ },
|
|
|
+ sdFcZhq: {
|
|
|
+ render: sdFcZhq ? () => sdFcZhq.render() : null,
|
|
|
+ group: sdFcZhq ? sdFcZhq.group : null,
|
|
|
+ newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
+ newT: { x: -2.28, y: -0.91, z: -5.68 },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ const oldCameraPosition = { x: 100, y: 0, z: 10 };
|
|
|
+ model.scene?.remove(group);
|
|
|
const config = windowConfigurations[windowType];
|
|
|
|
|
|
if (config && config.group) {
|
|
|
model.startAnimation = config.render;
|
|
|
group = config.group;
|
|
|
- return new Promise((resolve) => {
|
|
|
- setTimeout(async () => {
|
|
|
- await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, config.newP, config.newT, model);
|
|
|
- model.scene?.add(config.group);
|
|
|
- resolve(null);
|
|
|
- }, 1000);
|
|
|
- });
|
|
|
+
|
|
|
+ setTimeout(async () => {
|
|
|
+ await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, config.newP, config.newT, model);
|
|
|
+ model.scene?.add(config.group);
|
|
|
+ resolve(null);
|
|
|
+ }, 1000);
|
|
|
} else {
|
|
|
+ resolve(null);
|
|
|
throw new Error(`Unsupported windowType: ${windowType}`);
|
|
|
}
|
|
|
- }
|
|
|
- return handleWindowType(windowType, model);
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
export const mountedThree = () => {
|