From e06a9d9be77e1528dc6f7b77d691cec4066a76a8 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 19 四月 2024 09:56:37 +0800 Subject: [PATCH] # --- src/pages/base.jsx | 42 +++++++++++++++++++++--------------------- 1 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/pages/base.jsx b/src/pages/base.jsx index fc7f556..c56d04a 100644 --- a/src/pages/base.jsx +++ b/src/pages/base.jsx @@ -1,17 +1,33 @@ import { useRef, useState } from 'react' import { Canvas, useFrame } from '@react-three/fiber' import { OrbitControls } from '@react-three/drei' -import { Environment } from '@react-three/drei' +import { Environment, Sky } from '@react-three/drei' +import Help from '@/components/help' +import Lights from '@/components/light' +import Camera from '@/components/camera' + +const Base = (props) => { + return ( + <div style={{ height: '100%', width: '100%' }}> + <Canvas> + <Lights /> + {/* <Camera /> */} + <Sky distance={450000} sunPosition={[0, 1, 0]} inclination={0} azimuth={0.25} /> + <Box position={[0, 0, 0]} /> + <OrbitControls /> + <Environment background preset="warehouse" /> + <Help /> + </Canvas> + </div> + + ) +} const Box = (props) => { - const ref = useRef() - const [hovered, hover] = useState(false) const [clicked, click] = useState(false) - useFrame((state, delta) => (ref.current.rotation.x += delta)) - return ( <mesh {...props} @@ -23,22 +39,6 @@ <boxGeometry args={[1, 1, 1]} /> <meshStandardMaterial color={hovered ? 'hotpink' : 'orange'} /> </mesh> - ) -} - -const Base = () => { - return ( - <div style={{ height: '500px', width: '500px' }}> - <Canvas> - <ambientLight intensity={Math.PI / 2} /> - <spotLight position={[10, 10, 10]} angle={0.15} penumbra={1} decay={0} intensity={Math.PI} /> - <pointLight position={[-10, -10, -10]} decay={0} intensity={Math.PI} /> - <Box position={[0, 0, 0]} /> - <OrbitControls /> - <Environment preset="city" /> - </Canvas> - </div> - ) } -- Gitblit v1.9.1