fix(lab): AR Passthrough — prop isAR no ARBackground pra evitar background preto permanente
This commit is contained in:
+18
-14
@@ -314,16 +314,19 @@ 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 */}
|
||||
<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 && (session as any).environmentBlendMode === "additive");
|
||||
|
||||
<ambientLight intensity={0.6} />
|
||||
return (
|
||||
<>
|
||||
<ARBackground isAR={isAR} />
|
||||
|
||||
<ambientLight intensity={isAR ? 1.2 : 0.6} />
|
||||
<directionalLight
|
||||
position={[5, 5, 5]}
|
||||
intensity={1.2}
|
||||
intensity={isAR ? 1.5 : 1.2}
|
||||
castShadow
|
||||
shadow-mapSize={[1024, 1024]}
|
||||
/>
|
||||
@@ -349,7 +352,6 @@ const SceneContent = ({ locked, resetSignal }: { locked: boolean; resetSignal: n
|
||||
|
||||
<PhysicsScene locked={locked} resetSignal={resetSignal} />
|
||||
|
||||
{/* Controles pra visualização fora do XR (mouse) */}
|
||||
<OrbitControls
|
||||
makeDefault
|
||||
target={[0, 0.5, 0]}
|
||||
@@ -358,15 +360,17 @@ const SceneContent = ({ locked, resetSignal }: { locked: boolean; resetSignal: n
|
||||
maxDistance={10}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
// ===================================================================
|
||||
// FUNDO DINÂMICO — VR imersivo fica preto; AR Passthrough fica transparente
|
||||
// FUNDO DINÂMICO — Recebe prop isAR para evitar montagem/desmontagem
|
||||
// ===================================================================
|
||||
const ARBackground = () => {
|
||||
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 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 (
|
||||
<>
|
||||
<color attach="background" args={["#0a0a0a"]} />
|
||||
|
||||
Reference in New Issue
Block a user