From 508d1f3d73a06bfd71f842552711c4e6064da11e Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 19 四月 2024 11:17:42 +0800 Subject: [PATCH] # --- src/components/house.jsx | 7 ++++--- src/config/setting.js | 2 +- src/components/light.jsx | 13 ++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/house.jsx b/src/components/house.jsx index cbdd896..90a6a18 100644 --- a/src/components/house.jsx +++ b/src/components/house.jsx @@ -3,14 +3,15 @@ import { extend } from '@react-three/fiber'; import { Geometry, Base, Subtraction, Addition } from '@react-three/csg'; import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry'; +import { DEBUG } from '../config/setting'; extend({ TextGeometry }); const House = (props) => { const { wallThickness = 2, - width = 1400, - length = 1200, - height = 400, + width = DEBUG ? 14000 : 1400, + length = DEBUG ? 12000 : 1200, + height = DEBUG ? 4000 : 400, aside_width = 130, aside_length = 130, position = new THREE.Vector3(200, 0, 0), diff --git a/src/components/light.jsx b/src/components/light.jsx index 972a91f..977f3f3 100644 --- a/src/components/light.jsx +++ b/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} diff --git a/src/config/setting.js b/src/config/setting.js index ea20bf7..f660253 100644 --- a/src/config/setting.js +++ b/src/config/setting.js @@ -4,4 +4,4 @@ export const UN_AUTH_CODE = 403; - +export const DEBUG = true; -- Gitblit v1.9.1