|
@@ -8,7 +8,7 @@ import { useAppStore } from '/@/store/modules/app';
|
|
|
// const gui = new dat.GUI();
|
|
|
// gui.domElement.style = 'position:absolute;top:10px;right:10px;z-index:99999999999999';
|
|
|
|
|
|
-class Fm1 {
|
|
|
+class Fm2 {
|
|
|
modelName = 'fm';
|
|
|
model; //
|
|
|
group;
|
|
@@ -319,7 +319,6 @@ class Fm1 {
|
|
|
this.deviceDetailCSS3D.visible = true;
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
this.deviceDetailCSS3D.visible = false;
|
|
|
console.log('[ 点击事件 ] >');
|
|
@@ -500,78 +499,81 @@ class Fm1 {
|
|
|
this.model.scene?.add(this.group);
|
|
|
this.group?.layers.enableAll();
|
|
|
|
|
|
- this.model.setGLTFModel(['Fm-door', 'Fm-wire', 'Fm-wall'], this.group).then(() => {
|
|
|
+ this.model.setGLTFModel(['fmThree', 'fmThreeBase'], this.group).then(() => {
|
|
|
+ this.group.name = 'fmThree';
|
|
|
this.setModalPosition();
|
|
|
// 初始化左右摇摆动画;
|
|
|
- this.initAnimation();
|
|
|
- this.drawHots();
|
|
|
+ // this.initAnimation();
|
|
|
+ // this.drawHots();
|
|
|
|
|
|
- this.deviceDetailCard();
|
|
|
+ // this.deviceDetailCard();
|
|
|
this.model.animate();
|
|
|
- if (this.model.camera.layers.mask == -1) this.model.camera.layers.toggle(1);
|
|
|
- setTimeout(async () => {
|
|
|
- const videoPlayer1 = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
|
|
|
- const videoPlayer2 = document.getElementById('fm-player2')?.getElementsByClassName('vjs-tech')[0];
|
|
|
- if (!videoPlayer1 || !videoPlayer2) {
|
|
|
- const textArr = [
|
|
|
- {
|
|
|
- text: `无信号输入`,
|
|
|
- font: 'normal 40px Arial',
|
|
|
- color: '#009900',
|
|
|
- strokeStyle: '#002200',
|
|
|
- x: 170,
|
|
|
- y: 40,
|
|
|
- },
|
|
|
- ];
|
|
|
- getTextCanvas(560, 346, textArr, '').then((canvas: HTMLCanvasElement) => {
|
|
|
- const textMap = new THREE.CanvasTexture(canvas); // 关键一步
|
|
|
- const textMaterial = new THREE.MeshBasicMaterial({
|
|
|
- map: textMap, // 设置纹理贴图
|
|
|
- transparent: true,
|
|
|
- side: THREE.DoubleSide, // 这里是双面渲染的意思
|
|
|
- });
|
|
|
- textMaterial.blending = THREE.CustomBlending;
|
|
|
- const monitorPlane = this.group?.getObjectByName('noPlayer');
|
|
|
- if (monitorPlane) {
|
|
|
- monitorPlane.material = textMaterial;
|
|
|
- } else {
|
|
|
- const planeGeometry = new THREE.PlaneGeometry(100, 100); // 平面3维几何体PlaneGeometry
|
|
|
- const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
|
|
|
- if (!videoPlayer1) {
|
|
|
- planeMesh.name = 'noPlayer1';
|
|
|
- planeMesh.scale.set(0.011, 0.008, 0.011);
|
|
|
- planeMesh.position.set(-4.23, -0.28, -0.39);
|
|
|
- this.group?.add(planeMesh.clone());
|
|
|
- }
|
|
|
- if (!videoPlayer2) {
|
|
|
- planeMesh.name = 'noPlayer2';
|
|
|
- planeMesh.scale.set(0.012, 0.009, 0.012);
|
|
|
- planeMesh.position.set(4.33, -0.33, -0.39);
|
|
|
- this.group?.add(planeMesh.clone());
|
|
|
- }
|
|
|
- textMaterial.dispose();
|
|
|
- planeGeometry.dispose();
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- if (videoPlayer2) {
|
|
|
- const mesh = renderVideo(this.group, videoPlayer1, 'player1');
|
|
|
- mesh?.scale.set(-0.028, 0.0285, 1);
|
|
|
- mesh?.position.set(4.298, 0.02, -0.4);
|
|
|
- mesh.rotation.y = -Math.PI;
|
|
|
- this.group.add(mesh);
|
|
|
- }
|
|
|
- if (videoPlayer1) {
|
|
|
- const mesh = renderVideo(this.group, videoPlayer2, 'player2');
|
|
|
- mesh?.scale.set(-0.028, 0.0285, 1);
|
|
|
- mesh?.position.set(-4.262, 0.02, -0.4);
|
|
|
- mesh.rotation.y = -Math.PI;
|
|
|
- this.group.add(mesh);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- resolve(this.model);
|
|
|
- }, 0);
|
|
|
+ // if (this.model.camera.layers.mask == -1) this.model.camera.layers.toggle(1);
|
|
|
+ // setTimeout(async () => {
|
|
|
+ // const videoPlayer1 = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
|
|
|
+ // const videoPlayer2 = document.getElementById('fm-player2')?.getElementsByClassName('vjs-tech')[0];
|
|
|
+ // if (!videoPlayer1 || !videoPlayer2) {
|
|
|
+ // const textArr = [
|
|
|
+ // {
|
|
|
+ // text: `无信号输入`,
|
|
|
+ // font: 'normal 40px Arial',
|
|
|
+ // color: '#009900',
|
|
|
+ // strokeStyle: '#002200',
|
|
|
+ // x: 170,
|
|
|
+ // y: 40,
|
|
|
+ // },
|
|
|
+ // ];
|
|
|
+ // getTextCanvas(560, 346, textArr, '').then((canvas: HTMLCanvasElement) => {
|
|
|
+ // const textMap = new THREE.CanvasTexture(canvas); // 关键一步
|
|
|
+ // const textMaterial = new THREE.MeshBasicMaterial({
|
|
|
+ // map: textMap, // 设置纹理贴图
|
|
|
+ // transparent: true,
|
|
|
+ // side: THREE.DoubleSide, // 这里是双面渲染的意思
|
|
|
+ // });
|
|
|
+ // textMaterial.blending = THREE.CustomBlending;
|
|
|
+ // const monitorPlane = this.group?.getObjectByName('noPlayer');
|
|
|
+ // if (monitorPlane) {
|
|
|
+ // monitorPlane.material = textMaterial;
|
|
|
+ // } else {
|
|
|
+ // const planeGeometry = new THREE.PlaneGeometry(100, 100); // 平面3维几何体PlaneGeometry
|
|
|
+ // const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
|
|
|
+ // if (!videoPlayer1) {
|
|
|
+ // planeMesh.name = 'noPlayer1';
|
|
|
+ // planeMesh.scale.set(0.011, 0.008, 0.011);
|
|
|
+ // planeMesh.position.set(-4.23, -0.28, -0.39);
|
|
|
+ // this.group?.add(planeMesh.clone());
|
|
|
+ // }
|
|
|
+ // if (!videoPlayer2) {
|
|
|
+ // planeMesh.name = 'noPlayer2';
|
|
|
+ // planeMesh.scale.set(0.012, 0.009, 0.012);
|
|
|
+ // planeMesh.position.set(4.33, -0.33, -0.39);
|
|
|
+ // this.group?.add(planeMesh.clone());
|
|
|
+ // }
|
|
|
+ // textMaterial.dispose();
|
|
|
+ // planeGeometry.dispose();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // if (videoPlayer2) {
|
|
|
+ // const mesh = renderVideo(this.group, videoPlayer1, 'player1');
|
|
|
+ // mesh?.scale.set(-0.028, 0.0285, 1);
|
|
|
+ // mesh?.position.set(4.298, 0.02, -0.4);
|
|
|
+ // mesh.rotation.y = -Math.PI;
|
|
|
+ // this.group.add(mesh);
|
|
|
+ // }
|
|
|
+ // if (videoPlayer1) {
|
|
|
+ // const mesh = renderVideo(this.group, videoPlayer2, 'player2');
|
|
|
+ // mesh?.scale.set(-0.028, 0.0285, 1);
|
|
|
+ // mesh?.position.set(-4.262, 0.02, -0.4);
|
|
|
+ // mesh.rotation.y = -Math.PI;
|
|
|
+ // this.group.add(mesh);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // resolve(this.model);
|
|
|
+ // }, 0);
|
|
|
+
|
|
|
+ resolve(null)
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -605,4 +607,4 @@ class Fm1 {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-export default Fm1;
|
|
|
+export default Fm2;
|