From 7f2edbbb3c346e414b2d7de5d3a25514d86af3e3 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Sat, 30 May 2026 14:03:35 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Auto-deploy:=20melhoria=20no=20s?= =?UTF-8?q?nap=20e=20medi=C3=A7=C3=A3o=20AR=20em=2030/05/2026=2014:03:35?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MeetingRoom.tsx | 59 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/src/pages/MeetingRoom.tsx b/src/pages/MeetingRoom.tsx index cccd8cb..bf8c180 100644 --- a/src/pages/MeetingRoom.tsx +++ b/src/pages/MeetingRoom.tsx @@ -606,43 +606,42 @@ function HologramModel({ model, presentationState, isPresenter, onPresentationCh if (!clone || !presentationState) return; const { sectionEnabled, sectionAxis, sectionLevel, sectionInvert } = presentationState; - // Limites rígidos (Bounding Box invisível sobre a mesa) em coordenadas mundiais (World Space). - // Impede que a peça, mesmo com zoom máximo, invada o espaço da sala ou atravesse a mesa. - const tableLimitPlanes = [ - new THREE.Plane(new THREE.Vector3(-1, 0, 0), 1.0), // Limite Direita (x < 1.0) - new THREE.Plane(new THREE.Vector3(1, 0, 0), 1.0), // Limite Esquerda (x > -1.0) - new THREE.Plane(new THREE.Vector3(0, -1, 0), 2.5), // Limite Teto (y < 2.5) - new THREE.Plane(new THREE.Vector3(0, 1, 0), -0.801), // Limite Chão da Mesa (y > 0.801) - new THREE.Plane(new THREE.Vector3(0, 0, -1), 0.6), // Limite Frente (z < 0.6) - new THREE.Plane(new THREE.Vector3(0, 0, 1), 0.6), // Limite Trás (z > -0.6) - ]; - - const finalPlanes = [...tableLimitPlanes]; - - if (sectionEnabled) { - const normal = new THREE.Vector3(); - if (sectionAxis === 'x') normal.set(sectionInvert ? -1 : 1, 0, 0); - else if (sectionAxis === 'y') normal.set(0, sectionInvert ? -1 : 1, 0); - else if (sectionAxis === 'z') normal.set(0, 0, sectionInvert ? -1 : 1); - - // Ajusta a distância baseado no bounding box original e no nível do corte - const box = new THREE.Box3().setFromObject(clone); - const size = new THREE.Vector3(); - box.getSize(size); - const minVal = sectionAxis === 'x' ? box.min.x : sectionAxis === 'y' ? box.min.y : box.min.z; - const maxVal = sectionAxis === 'x' ? box.max.x : sectionAxis === 'y' ? box.max.y : box.max.z; - const distance = minVal + (maxVal - minVal) * sectionLevel; - - const plane = new THREE.Plane(normal, -distance); - finalPlanes.push(plane); + if (!sectionEnabled) { + clone.traverse((obj) => { + if (obj instanceof THREE.Mesh) { + const mats = Array.isArray(obj.material) ? obj.material : [obj.material]; + mats.forEach((mat) => { + if (mat) { + mat.clippingPlanes = []; + mat.needsUpdate = true; + } + }); + } + }); + return; } + const normal = new THREE.Vector3(); + if (sectionAxis === 'x') normal.set(sectionInvert ? -1 : 1, 0, 0); + else if (sectionAxis === 'y') normal.set(0, sectionInvert ? -1 : 1, 0); + else if (sectionAxis === 'z') normal.set(0, 0, sectionInvert ? -1 : 1); + + // Ajusta a distância baseado no bounding box original e no nível do corte + const box = new THREE.Box3().setFromObject(clone); + const size = new THREE.Vector3(); + box.getSize(size); + const minVal = sectionAxis === 'x' ? box.min.x : sectionAxis === 'y' ? box.min.y : box.min.z; + const maxVal = sectionAxis === 'x' ? box.max.x : sectionAxis === 'y' ? box.max.y : box.max.z; + const distance = minVal + (maxVal - minVal) * sectionLevel; + + const plane = new THREE.Plane(normal, -distance); + clone.traverse((obj) => { if (obj instanceof THREE.Mesh) { const mats = Array.isArray(obj.material) ? obj.material : [obj.material]; mats.forEach((mat) => { if (mat) { - mat.clippingPlanes = finalPlanes; + mat.clippingPlanes = [plane]; mat.clipShadows = true; mat.needsUpdate = true; }