feat: apply dark mode contrast corrections to all 3D modules

This commit is contained in:
2026-07-10 16:34:03 +00:00
parent bcca3738d0
commit 9d01915704
8 changed files with 158 additions and 66 deletions
+14 -3
View File
@@ -4,6 +4,7 @@ import { OrbitControls, Grid, Environment, Text } from '@react-three/drei';
import * as THREE from 'three';
import SceneCanvas from '../SceneCanvas';
import FallbackDiagram from '../FallbackDiagram';
import { useCanvasTheme } from '@/lib/theme';
export interface Dynamics3DInput {
/** Altura da estrutura (m) */
@@ -138,11 +139,13 @@ function VortexStreet({
}
function DynamicsModel(props: Dynamics3DInput) {
const theme = useCanvasTheme();
const isDark = theme === 'dark';
return (
<group>
<mesh rotation={[-Math.PI / 2, 0, 0]} position={[0, -0.01, 0]} receiveShadow>
<planeGeometry args={[20, 20]} />
<meshStandardMaterial color="#94a3b8" transparent opacity={0.15} />
<meshStandardMaterial color={isDark ? "#1e293b" : "#94a3b8"} transparent opacity={0.15} />
</mesh>
<OscillatingBuilding
@@ -164,7 +167,7 @@ function DynamicsModel(props: Dynamics3DInput) {
<Text
position={[0, props.height * SCALE + 0.8, 0]}
fontSize={0.5}
color="#1e40af"
color={isDark ? "#93c5fd" : "#1e40af"}
anchorX="center"
anchorY="bottom"
>
@@ -175,6 +178,8 @@ function DynamicsModel(props: Dynamics3DInput) {
}
export default function Dynamics3DViewer(props: Dynamics3DInput) {
const theme = useCanvasTheme();
const isDark = theme === 'dark';
const cameraDistance = Math.max(props.height * SCALE * 2, 6);
const fallback = (
@@ -201,7 +206,13 @@ export default function Dynamics3DViewer(props: Dynamics3DInput) {
shadow-mapSize-height={1024}
/>
<DynamicsModel {...props} />
<Grid infiniteGrid fadeDistance={50} sectionColor="#94a3b8" cellColor="#cbd5e1" position={[0, -0.01, 0]} />
<Grid
infiniteGrid
fadeDistance={50}
sectionColor={isDark ? "#475569" : "#94a3b8"}
cellColor={isDark ? "#1e293b" : "#cbd5e1"}
position={[0, -0.01, 0]}
/>
<OrbitControls makeDefault minPolarAngle={0} maxPolarAngle={Math.PI / 2 - 0.05} />
<Environment preset="city" />
</SceneCanvas>