diff --git a/apps/web/src/components/viewers/Scene.tsx b/apps/web/src/components/viewers/Scene.tsx index d7c4529..111a209 100644 --- a/apps/web/src/components/viewers/Scene.tsx +++ b/apps/web/src/components/viewers/Scene.tsx @@ -1,6 +1,6 @@ import { Suspense, type ReactNode } from 'react'; import { Canvas } from '@react-three/fiber'; -import { Bounds, ContactShadows, OrbitControls } from '@react-three/drei'; +import { Bounds, ContactShadows, OrbitControls, useProgress } from '@react-three/drei'; import { Bloom, EffectComposer, Vignette } from '@react-three/postprocessing'; /** @@ -15,7 +15,8 @@ import { Bloom, EffectComposer, Vignette } from '@react-three/postprocessing'; */ export default function Scene({ children }: { children: ReactNode }) { return ( -
+
+ ); } + +/** + * A loading overlay shown while assets (textures, models, traces) are being + * fetched. Reads drei's global progress store, which tracks every loader in + * the scene, so it works outside the Canvas. Hidden once loading completes. + */ +function LoadingOverlay() { + const { active, progress, item, loaded, total } = useProgress(); + if (!active) return null; + return ( +
+
+ + Loading assets… {Math.round(progress)}% +
+ + {loaded}/{total} {item} + +
+ ); +}