From 14b01f05efe60ef0073ae261a3d254499e3bc248 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 19 四月 2024 11:21:43 +0800 Subject: [PATCH] # --- src/components/light.jsx | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/light.jsx b/src/components/light.jsx index 655d83c..977f3f3 100644 --- a/src/components/light.jsx +++ b/src/components/light.jsx @@ -1,21 +1,30 @@ import React, { useRef } from 'react'; import { SpotLight, useDepthBuffer, useHelper } from '@react-three/drei'; +import { DEBUG } from '../config/setting'; +import { SpotLightHelper } from 'three'; const Lights = () => { + const spotLightRef = useRef(); + + if (DEBUG) { + useHelper(spotLightRef, SpotLightHelper, 'teal'); + } + return ( <> <ambientLight intensity={0.5} /> <directionalLight color={0xffffff} intensity={3} position={[10, 10, 0]} /> <SpotLight - color="#fff" - position={[3, 2000, 2]} + ref={spotLightRef} + intensity={DEBUG ? 10 : 5} + color="#ffffff" + position={[3, DEBUG ? 5000 : 900, 2]} castShadow penumbra={2} - distance={6000} + distance={DEBUG ? 10000 : 5000} angle={Math.PI * 0.6} attenuation={5} anglePower={Math.PI / 2} - intensity={6} shadow-mapSize={[1024, 1024]} shadow-camera-near={200} shadow-camera-far={2000} -- Gitblit v1.9.1