11import { Canvas } from '@react-three/fiber'
2- import { Environment , Loader , OrbitControls , Stats } from "@react-three/drei"
2+ import { Environment , Loader , OrbitControls , Stats , useProgress } from "@react-three/drei"
33import Lamborghini from "./components/Models/Lamborghini"
4- import Scene from "./components/Models/Scene"
5- import { useControls } from 'leva'
4+ import Scene from "./components/Models/Autobianchi Stellina"
5+ import Maserati from "./components/Models/Maserati_mc20"
6+ import { Leva , useControls } from 'leva'
67import { Suspense } from 'react'
78
89export default function App ( ) {
9- const { Interior, Exterior, rotation , hideStats , select } = useControls ( {
10- select : { options : [ 'Lamborghini' , 'Scene' ] } ,
10+ const { Interior, Exterior, Rotation , Select , Stats : stats } = useControls ( {
11+ Select : { options : [ 'Lamborghini Aventador J ' , 'Autobianchi Stellina' , "Maserati MC20" ] } ,
1112 Interior : '#aa5252' ,
1213 Exterior : '#9a9898' ,
13- rotation : false ,
14- hideStats : false ,
14+ Rotation : false ,
15+ Stats : true ,
1516 } ) ;
17+ const { progress } = useProgress ( )
1618
1719 return (
1820 < >
1921 < Canvas camera = { { position : [ 0 , 0 , 10 ] } } shadows = { true } frameloop = "demand" >
2022 < Suspense fallback = { null } >
21- { select === "Lamborghini" && < Lamborghini interior = { Interior } exterior = { Exterior } /> }
22- { select === "Scene" && < Scene interior = { Interior } exterior = { Exterior } /> }
23+ < Lamborghini interior = { Interior } exterior = { Exterior } visible = { Select === "Lamborghini Aventador J" } />
24+ < Scene interior = { Interior } exterior = { Exterior } visible = { Select === "Autobianchi Stellina" } />
25+ < Maserati interior = { Interior } exterior = { Exterior } visible = { Select === "Maserati MC20" } />
2326 </ Suspense >
2427 < Environment
2528 background
2629 files = { 'venice_sunset_1k.hdr' }
2730 blur = { 0.5 }
2831 />
29- { ! hideStats ? < Stats /> : undefined }
30- < OrbitControls maxPolarAngle = { 7 * Math . PI / 18 } maxDistance = { 20 } autoRotate = { rotation } />
32+ { stats ? < Stats /> : undefined }
33+ < OrbitControls maxPolarAngle = { 7 * Math . PI / 18 } maxDistance = { 20 } autoRotate = { Rotation } />
3134 </ Canvas >
3235 < Loader />
36+ < Leva
37+ hidden = { progress === 100 ? false : true }
38+ />
3339 </ >
3440 )
3541}
0 commit comments