|
@@ -165,9 +165,10 @@ class singleWindowBet {
|
|
|
/* 提取风门序列帧,初始化前后门动画 */
|
|
|
initAnimation() {
|
|
|
const meshArr01: THREE.Object3D[] = [];
|
|
|
- this.group?.children.forEach((obj) => {
|
|
|
+ const ddFc = this.group.getObjectByName('ddFc-bet');
|
|
|
+ ddFc?.children.forEach((obj) => {
|
|
|
if (obj.type === 'Mesh' && obj.name && obj.name.startsWith('FCshanye')) {
|
|
|
- obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 0);
|
|
|
+ obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 90);
|
|
|
meshArr01.push(obj);
|
|
|
}
|
|
|
});
|
|
@@ -182,7 +183,7 @@ class singleWindowBet {
|
|
|
// 前风窗动画
|
|
|
this.windowsActionArr.frontWindow.forEach((mesh: THREE.Mesh) => {
|
|
|
gsap.to(mesh.rotation, {
|
|
|
- y: THREE.MathUtils.degToRad(rotationParam.frontDeg1),
|
|
|
+ y: THREE.MathUtils.degToRad(90 - rotationParam.frontDeg1),
|
|
|
duration: (1 / 9) * Math.abs(rotationParam.frontDeg1 - mesh.rotation.y),
|
|
|
overwrite: true,
|
|
|
});
|
|
@@ -190,7 +191,7 @@ class singleWindowBet {
|
|
|
} else if (flag === 0) {
|
|
|
([...this.windowsActionArr.frontWindow] as THREE.Mesh[]).forEach((mesh) => {
|
|
|
gsap.to(mesh.rotation, {
|
|
|
- y: 0,
|
|
|
+ y: THREE.MathUtils.degToRad(90),
|
|
|
overwrite: true,
|
|
|
});
|
|
|
});
|
|
@@ -246,52 +247,6 @@ class singleWindowBet {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async initCamera(dom1?) {
|
|
|
- const videoPlayer1 = dom1;
|
|
|
- let monitorPlane: THREE.Mesh | null = null;
|
|
|
- const canvas = await getTextCanvas(320, 180, '', 'noSinge.png');
|
|
|
- const textMap = new THREE.CanvasTexture(canvas); // 关键一步
|
|
|
- const textMaterial = new THREE.MeshBasicMaterial({
|
|
|
- map: textMap, // 设置纹理贴图
|
|
|
- transparent: true,
|
|
|
- side: THREE.DoubleSide, // 这里是双面渲染的意思
|
|
|
- });
|
|
|
- textMaterial.blending = THREE.CustomBlending;
|
|
|
- monitorPlane = this.group?.getObjectByName('noPlayer');
|
|
|
- if (monitorPlane) {
|
|
|
- monitorPlane.material = textMaterial;
|
|
|
- } else {
|
|
|
- const planeGeometry = new THREE.PlaneGeometry(100, 100); // 平面3维几何体PlaneGeometry
|
|
|
- monitorPlane = new THREE.Mesh(planeGeometry, textMaterial);
|
|
|
- textMaterial.dispose();
|
|
|
- planeGeometry.dispose();
|
|
|
- }
|
|
|
- const videoPlayer = this.group.getObjectByName('player1');
|
|
|
- if (videoPlayer) {
|
|
|
- this.model.clearMesh(videoPlayer);
|
|
|
- this.group.remove(videoPlayer);
|
|
|
- }
|
|
|
- const noPlayer1 = this.group.getObjectByName('noPlayer1');
|
|
|
- if (noPlayer1) {
|
|
|
- this.model.clearMesh(noPlayer1);
|
|
|
- this.group.remove(noPlayer1);
|
|
|
- }
|
|
|
- if (!videoPlayer1 && videoPlayer1 === null) {
|
|
|
- monitorPlane.name = 'noPlayer1';
|
|
|
- monitorPlane.scale.set(0.015, 0.007, 0.011);
|
|
|
- monitorPlane.position.set(4.04, 0.02, -0.46);
|
|
|
- this.group?.add(monitorPlane);
|
|
|
- } else if (videoPlayer1) {
|
|
|
- const mesh = renderVideo(this.group, videoPlayer1, 'player1');
|
|
|
- if (mesh) {
|
|
|
- mesh?.scale.set(-0.038, 0.029, 1);
|
|
|
- mesh?.position.set(-4.302, 0.15, -0.23);
|
|
|
- mesh.rotation.y = -Math.PI;
|
|
|
- this.group.add(mesh);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
mountedThree() {
|
|
|
return new Promise((resolve) => {
|
|
|
this.model.setGLTFModel(['ddFc-bet'], this.group).then(() => {
|