🚀 Auto-deploy: melhoria no snap e medição AR em 04/08/2026 20:30:55

This commit is contained in:
2026-08-04 20:30:55 +00:00
parent 5c6f3f4ab6
commit a63478a3ba
+31 -31
View File
@@ -7,7 +7,8 @@ import {
Environment,
PerspectiveCamera,
} from "@react-three/drei";
import { XR, createXRStore } from "@react-three/xr";
import { XR } from "@react-three/xr";
import { xrStore as store } from "@/stores/useXRStore";
import * as THREE from "three";
import {
Beaker,
@@ -17,6 +18,7 @@ import {
RotateCcw,
Hand,
} from "lucide-react";
import { Suspense } from "react";
/**
* ============================================================
@@ -39,10 +41,6 @@ const CUBE_SIZE = 1;
type AlignPhase = 'IDLE' | 'WAIT_SURFACE' | 'WAIT_FACE2' | 'WAIT_EDGE';
const store = createXRStore({
controller: { left: true, right: true },
});
// ===================================================================
// COMPONENTE: CuboControlado
// ===================================================================
@@ -411,36 +409,38 @@ const QuestCubeLab = () => {
</div>
<div style={{ height: 600 }}>
<Canvas shadows>
<Canvas shadows gl={{ antialias: true, alpha: true }}>
<XR store={store}>
<PerspectiveCamera makeDefault position={[3, 4, 6]} fov={50} />
<ambientLight intensity={0.5} />
<directionalLight position={[5, 8, 5]} intensity={1} castShadow shadow-mapSize-width={1024} shadow-mapSize-height={1024} />
<Suspense fallback={null}>
<PerspectiveCamera makeDefault position={[3, 4, 6]} fov={50} />
<ambientLight intensity={0.5} />
<directionalLight position={[5, 8, 5]} intensity={1} castShadow shadow-mapSize-width={1024} shadow-mapSize-height={1024} />
<CubeControlado
posRef={posRef}
rotRef={rotRef}
scaleRef={scaleRef}
lockedRef={lockedRef}
gamepadRef={gamepadRef}
alignPhase={alignPhase}
setAlignPhase={setAlignPhase}
face1Ref={face1Ref}
face2Ref={face2Ref}
/>
<CubeControlado
posRef={posRef}
rotRef={rotRef}
scaleRef={scaleRef}
lockedRef={lockedRef}
gamepadRef={gamepadRef}
alignPhase={alignPhase}
setAlignPhase={setAlignPhase}
face1Ref={face1Ref}
face2Ref={face2Ref}
/>
<Table
onSurfaceClick={handleSurfaceClick}
onEdgeClick={handleEdgeClick}
/>
<Table
onSurfaceClick={handleSurfaceClick}
onEdgeClick={handleEdgeClick}
/>
<Grid args={[20, 20]} cellSize={0.25} cellThickness={0.5} cellColor="#475569" sectionSize={1} sectionThickness={1} sectionColor="#94a3b8" fadeDistance={18} fadeStrength={1} infiniteGrid={false} position={[0, 0, 0]} />
<mesh receiveShadow rotation={[-Math.PI / 2, 0, 0]} position={[0, -0.001, 0]}>
<planeGeometry args={[20, 20]} />
<shadowMaterial transparent opacity={0.35} />
</mesh>
<OrbitControls makeDefault enableDamping />
<Environment preset="city" />
<Grid args={[20, 20]} cellSize={0.25} cellThickness={0.5} cellColor="#475569" sectionSize={1} sectionThickness={1} sectionColor="#94a3b8" fadeDistance={18} fadeStrength={1} infiniteGrid={false} position={[0, 0, 0]} />
<mesh receiveShadow rotation={[-Math.PI / 2, 0, 0]} position={[0, -0.001, 0]}>
<planeGeometry args={[20, 20]} />
<shadowMaterial transparent opacity={0.35} />
</mesh>
<OrbitControls makeDefault enableDamping />
<Environment preset="city" />
</Suspense>
</XR>
</Canvas>
</div>