diff --git a/src/data/world/mapLodConfig.ts b/src/data/world/mapLodConfig.ts index b7860b9..d1fd006 100644 --- a/src/data/world/mapLodConfig.ts +++ b/src/data/world/mapLodConfig.ts @@ -25,6 +25,20 @@ export function getMapLodModelPath(modelName: string): string | null { ); } + +export const MAP_LOD_SCALE_MULTIPLIERS = { + sapin: 0.35, + buisson: 0.7, +} as const satisfies Partial>; + +export function getMapLodScaleMultiplier(modelName: string): number { + return ( + MAP_LOD_SCALE_MULTIPLIERS[ + modelName as keyof typeof MAP_LOD_SCALE_MULTIPLIERS + ] ?? 1 + ); +} + export function selectMapModelPathByDistance({ distance, modelName, diff --git a/src/world/vegetation/VegetationSystem.tsx b/src/world/vegetation/VegetationSystem.tsx index 00c9b37..a9f6431 100644 --- a/src/world/vegetation/VegetationSystem.tsx +++ b/src/world/vegetation/VegetationSystem.tsx @@ -8,7 +8,11 @@ import { } from "react"; import { useFrame, useThree } from "@react-three/fiber"; import { CHUNK_CONFIG } from "@/data/world/chunkStreamingConfig"; -import { selectMapModelPathByDistance } from "@/data/world/mapLodConfig"; +import { + getMapLodModelPath, + getMapLodScaleMultiplier, + selectMapModelPathByDistance, +} from "@/data/world/mapLodConfig"; import { useCameraMode } from "@/hooks/debug/useCameraMode"; import { useSceneMode } from "@/hooks/debug/useSceneMode"; import { @@ -205,12 +209,17 @@ export function VegetationSystem({ {visibleChunks.map((chunk) => { const modelPath = chunkModelPaths.get(chunk.key) ?? chunk.modelPath; + const mapName = VEGETATION_TYPES[chunk.type].mapName; + const isLod = modelPath === getMapLodModelPath(mapName); + const scaleMultiplier = + chunk.scaleMultiplier * + (isLod ? getMapLodScaleMultiplier(mapName) : 1); return (