From 3f01190559d6f10208e0997141c82ed2387d376b Mon Sep 17 00:00:00 2001 From: Hermes Date: Wed, 5 Aug 2026 00:16:48 +0000 Subject: [PATCH] =?UTF-8?q?fix(lab):=20AR=20Passthrough=20=E2=80=94=20prop?= =?UTF-8?q?=20isAR=20no=20ARBackground=20pra=20evitar=20background=20preto?= =?UTF-8?q?=20permanente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lab/QuestCubeLab.tsx | 108 ++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/src/lab/QuestCubeLab.tsx b/src/lab/QuestCubeLab.tsx index da535f7..5eb5bdf 100644 --- a/src/lab/QuestCubeLab.tsx +++ b/src/lab/QuestCubeLab.tsx @@ -314,59 +314,63 @@ const PhysicsScene = ({ // =================================================================== // SCENE WRAPPER — junta o Canvas + R3F // =================================================================== -const SceneContent = ({ locked, resetSignal }: { locked: boolean; resetSignal: number }) => ( - <> - {/* Em modo AR Passthrough, NÃO pinta cor de fundo — ela veda o passthrough */} - {/* Em modo desktop (fora do XR), pinta fundo escuro pra não ficar transparente estranho */} - - - - - - {/* Grid estilo HLA — funciona em ambos os modos */} - - - - - - - - - {/* Controles pra visualização fora do XR (mouse) */} - - -); - -// =================================================================== -// FUNDO DINÂMICO — VR imersivo fica preto; AR Passthrough fica transparente -// =================================================================== -const ARBackground = () => { +const SceneContent = ({ locked, resetSignal }: { locked: boolean; resetSignal: number }) => { + // Detecta modo AR para ajustar iluminação e fundo const session = useXR((s) => s.session); - const isAR = session && "environmentBlendMode" in session && (session as any).environmentBlendMode === "additive"; - if (isAR) return null; // AR = transparente (mostra passthrough do Quest 3) + const isAR = !!(session && (session as any).environmentBlendMode === "additive"); + + return ( + <> + + + + + + {/* Grid estilo HLA — funciona em ambos os modos */} + + + + + + + + + + + ); +}; + +// =================================================================== +// FUNDO DINÂMICO — Recebe prop isAR para evitar montagem/desmontagem +// =================================================================== +const ARBackground = ({ isAR }: { isAR: boolean }) => { + // Em AR Passthrough: nada (canal alpha fica livre pra passthrough) + if (isAR) return null; + + // Fora de AR (modo desktop ou VR): fundo preto return ( <>