diff --git a/components/models/about-model.tsx b/components/models/about-model.tsx index 9166c3b..0a5c72e 100644 --- a/components/models/about-model.tsx +++ b/components/models/about-model.tsx @@ -3,10 +3,14 @@ import { Canvas } from '@react-three/fiber'; import clsx from 'clsx'; import { Suspense, lazy } from 'react'; +import useStore from 'store'; +import Loading from 'components/rua/loading/rua-loading'; const CloudModel = lazy(() => import('components/models/cloud-model')); const AboutModel = () => { + const modelLoading = useStore((state) => state.modelLoading); + return ( <>
@@ -16,6 +20,19 @@ const AboutModel = () => { + +
+ +
{/* */}
diff --git a/components/models/cat-model.tsx b/components/models/cat-model.tsx index 295ffde..efc8cfb 100644 --- a/components/models/cat-model.tsx +++ b/components/models/cat-model.tsx @@ -16,6 +16,7 @@ const CatModel = () => { GLTFLoader, './models/just_a_hungry_cat/modelDraco.gltf', (loader) => { + toggleLoading(true); const dracoLoader = new DRACOLoader(); dracoLoader.setDecoderPath('./libs/draco/'); loader.setDRACOLoader(dracoLoader); diff --git a/components/models/cloud-model.tsx b/components/models/cloud-model.tsx index 7e39865..db7a1b5 100644 --- a/components/models/cloud-model.tsx +++ b/components/models/cloud-model.tsx @@ -7,10 +7,11 @@ import * as THREE from 'three'; import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; import { rotationX, rotationY } from './home-model'; +import useStore from 'store'; const CloudModel = () => { const mixer = useRef(null); - + const toggleLoading = useStore((state) => state.toggleLoading); const camera = useThree((state) => state.camera); // After model loading, set theme to dark mode. @@ -49,6 +50,7 @@ const CloudModel = () => { GLTFLoader, './models/cloud_station/modelDraco.gltf', (loader) => { + toggleLoading(true); const dracoLoader = new DRACOLoader(); dracoLoader.setDecoderPath('./libs/draco/'); loader.setDRACOLoader(dracoLoader); @@ -61,6 +63,7 @@ const CloudModel = () => { }); gltf.scene.position.set(0, 0, 0); camera.lookAt(0, 1, 0); + toggleLoading(false); const halfWidth = Math.floor(window.innerWidth / 2); const halfHeight = Math.floor(window.innerHeight / 2);