🚀 Auto-deploy: melhoria no snap e medição AR em 30/05/2026 13:30:39
This commit is contained in:
+16
-21
@@ -606,21 +606,20 @@ function HologramModel({ model, presentationState, isPresenter, onPresentationCh
|
|||||||
if (!clone || !presentationState) return;
|
if (!clone || !presentationState) return;
|
||||||
const { sectionEnabled, sectionAxis, sectionLevel, sectionInvert } = presentationState;
|
const { sectionEnabled, sectionAxis, sectionLevel, sectionInvert } = presentationState;
|
||||||
|
|
||||||
if (!sectionEnabled) {
|
// Limites rígidos (Bounding Box invisível sobre a mesa) em coordenadas mundiais (World Space).
|
||||||
clone.traverse((obj) => {
|
// Impede que a peça, mesmo com zoom máximo, invada o espaço da sala ou atravesse a mesa.
|
||||||
if (obj instanceof THREE.Mesh) {
|
const tableLimitPlanes = [
|
||||||
const mats = Array.isArray(obj.material) ? obj.material : [obj.material];
|
new THREE.Plane(new THREE.Vector3(-1, 0, 0), 1.0), // Limite Direita (x < 1.0)
|
||||||
mats.forEach((mat) => {
|
new THREE.Plane(new THREE.Vector3(1, 0, 0), 1.0), // Limite Esquerda (x > -1.0)
|
||||||
if (mat) {
|
new THREE.Plane(new THREE.Vector3(0, -1, 0), 2.5), // Limite Teto (y < 2.5)
|
||||||
mat.clippingPlanes = [];
|
new THREE.Plane(new THREE.Vector3(0, 1, 0), -0.801), // Limite Chão da Mesa (y > 0.801)
|
||||||
mat.needsUpdate = true;
|
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)
|
||||||
});
|
];
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
let finalPlanes = [...tableLimitPlanes];
|
||||||
|
|
||||||
|
if (sectionEnabled) {
|
||||||
const normal = new THREE.Vector3();
|
const normal = new THREE.Vector3();
|
||||||
if (sectionAxis === 'x') normal.set(sectionInvert ? -1 : 1, 0, 0);
|
if (sectionAxis === 'x') normal.set(sectionInvert ? -1 : 1, 0, 0);
|
||||||
else if (sectionAxis === 'y') normal.set(0, sectionInvert ? -1 : 1, 0);
|
else if (sectionAxis === 'y') normal.set(0, sectionInvert ? -1 : 1, 0);
|
||||||
@@ -635,13 +634,15 @@ function HologramModel({ model, presentationState, isPresenter, onPresentationCh
|
|||||||
const distance = minVal + (maxVal - minVal) * sectionLevel;
|
const distance = minVal + (maxVal - minVal) * sectionLevel;
|
||||||
|
|
||||||
const plane = new THREE.Plane(normal, -distance);
|
const plane = new THREE.Plane(normal, -distance);
|
||||||
|
finalPlanes.push(plane);
|
||||||
|
}
|
||||||
|
|
||||||
clone.traverse((obj) => {
|
clone.traverse((obj) => {
|
||||||
if (obj instanceof THREE.Mesh) {
|
if (obj instanceof THREE.Mesh) {
|
||||||
const mats = Array.isArray(obj.material) ? obj.material : [obj.material];
|
const mats = Array.isArray(obj.material) ? obj.material : [obj.material];
|
||||||
mats.forEach((mat) => {
|
mats.forEach((mat) => {
|
||||||
if (mat) {
|
if (mat) {
|
||||||
mat.clippingPlanes = [plane];
|
mat.clippingPlanes = finalPlanes;
|
||||||
mat.clipShadows = true;
|
mat.clipShadows = true;
|
||||||
mat.needsUpdate = true;
|
mat.needsUpdate = true;
|
||||||
}
|
}
|
||||||
@@ -783,12 +784,6 @@ function ThreeMeetingRoomScene({ currentActiveModel, presentationState, isFocusM
|
|||||||
</mesh>
|
</mesh>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Projetor de Holograma / Círculo centralizado desenhado na mesa */}
|
|
||||||
<mesh position={[0, 0.861, 0]} rotation={[-Math.PI / 2, 0, 0]}>
|
|
||||||
<ringGeometry args={[0.22, 0.25, 32]} />
|
|
||||||
<meshBasicMaterial color="#0ea5e9" transparent opacity={0.6} />
|
|
||||||
</mesh>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user