Skip to content

Commit

Permalink
3D computer Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Saeid-Soodi committed Jan 17, 2024
1 parent 04ad43b commit 2b6a060
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions src/components/canvas/Computers.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
import React from 'react'
import React ,{Suspense,useEffect ,useState} from 'react'
import { Canvas } from '@react-three/fiber'
import { OrbitControls ,Preload ,useGLTF } from '@react-three/drei'
import CanvasLoader from '../Loader'
import { Mesh } from 'three'

const Computers = () => {
const computer =useGLTF('./desktop_pc/scene.gltf')
return (
<div>Computers</div>
<mesh>
<hemisphereLight intensity={0.15}
groundColor="black"/>
<pointLight intensity={100}/>
<primitive
object={computer.scene}
scale={0.75}
position={[0,-4.25,-1.25]}
rotation ={[-0.01,-0.2,-0.1]}
/>
</mesh>
)
}
const ComputersCanvas =()=>{
return(
<Canvas
frameloop='demand'
shadows
camera={{position:[20,3,5] ,fov:25}}
gl={{ preserveDrawingBuffer: true }}
>
<Suspense fallback={<CanvasLoader />}>
<OrbitControls
enableZoom={false}
maxPolarAngle={Math.PI / 2}
minPolarAngle={Math.PI / 2}
/>
<Computers/>
</Suspense>

export default Computers
<Preload all />
</Canvas>
)
}


export default ComputersCanvas

0 comments on commit 2b6a060

Please sign in to comment.