#
luxiaotao1123
2024-04-19 508d1f3d73a06bfd71f842552711c4e6064da11e
src/components/light.jsx
@@ -1,11 +1,14 @@
import React, { useRef } from 'react';
import { SpotLight, useDepthBuffer, useHelper } from '@react-three/drei';
// import { SpotLightHelper } from 'three';
import { DEBUG } from '../config/setting';
import { SpotLightHelper } from 'three';
const Lights = () => {
    const spotLightRef = useRef();
    // useHelper(spotLightRef, SpotLightHelper, 'teal');
    if (DEBUG) {
        useHelper(spotLightRef, SpotLightHelper, 'teal');
    }
    return (
        <>
@@ -13,15 +16,15 @@
            <directionalLight color={0xffffff} intensity={3} position={[10, 10, 0]} />
            <SpotLight
                ref={spotLightRef}
                intensity={DEBUG ? 10 : 5}
                color="#ffffff"
                position={[3, 900, 2]}
                position={[3, DEBUG ? 5000 : 900, 2]}
                castShadow
                penumbra={2}
                distance={5000}
                distance={DEBUG ? 10000 : 5000}
                angle={Math.PI * 0.6}
                attenuation={5}
                anglePower={Math.PI / 2}
                intensity={5}
                shadow-mapSize={[1024, 1024]}
                shadow-camera-near={200}
                shadow-camera-far={2000}