#
luxiaotao1123
2024-04-26 e6de6ddae28dec5bf092b66d77ee8d522d39ff04
src/pages/base.jsx
@@ -1,19 +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 Help from '@/components/help'
import { Environment, Sky } from '@react-three/drei'
import Help from '../components/help'
import Lights from '../components/light'
import Camera from '../components/camera'
import Buildings from '../components/buidings'
import TreeGroup from '../components/tree-group'
import House from '../components/house'
import Warehouse from '../core/warehouse'
const Base = () => {
const Base = (props) => {
    return (
        <div style={{ height: '100%', width: '100%' }}>
            <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]} />
            <Canvas
                shadows
                gl={{
                    logarithmicDepthBuffer: true,
                }}
            >
                <Lights />
                <Camera />
                <Sky distance={450000} sunPosition={[0, 1, 0]} inclination={0} azimuth={0.25} />
                <Buildings />
                <TreeGroup />
                <House />
                <Warehouse />
                <OrbitControls />
                <Environment background preset="warehouse" />
                <Environment background preset="night" />
                <Help />
            </Canvas>
        </div>
@@ -21,7 +35,7 @@
    )
}
const Box = (props) => {
const Demo = (props) => {
    const ref = useRef()
    const [hovered, hover] = useState(false)
    const [clicked, click] = useState(false)
@@ -34,7 +48,7 @@
            onClick={(event) => click(!clicked)}
            onPointerOver={(event) => (event.stopPropagation(), hover(true))}
            onPointerOut={(event) => hover(false)}>
            <boxGeometry args={[1, 1, 1]} />
            <boxGeometry args={[10, 10, 10]} />
            <meshStandardMaterial color={hovered ? 'hotpink' : 'orange'} />
        </mesh>
    )