feat: add chunked grass and organize environment systems

This commit is contained in:
Tom Boullay
2026-05-28 00:07:02 +02:00
parent b1fca3a25b
commit 0230795f55
7 changed files with 565 additions and 50 deletions
+33
View File
@@ -0,0 +1,33 @@
import { TERRAIN_COLORS } from "@/data/world/terrainConfig";
export const GRASS_CONFIG = {
enabled: true,
chunkSize: 20,
loadRadius: 30,
unloadRadius: 34,
updateInterval: 250,
sampleStep: 1.15,
jitter: 0.42,
bladesPerCell: 2,
maxBladesPerChunk: 720,
bladeWidth: 0.12,
minBladeHeight: 0.42,
maxBladeHeight: 0.82,
surfaceOffset: 0.06,
baseColor: "#1f3512",
windBendStrength: 0.42,
windNoiseScale: 0.09,
} as const;
export const GRASS_SURFACE_KEYS = new Set([
"grass1",
"grass2",
"grass3",
] as const);
export function getGrassTipColor(surfaceKey: string | null): string {
if (surfaceKey === "grass1") return TERRAIN_COLORS.grass1.grassTipColor;
if (surfaceKey === "grass2") return TERRAIN_COLORS.grass2.grassTipColor;
if (surfaceKey === "grass3") return TERRAIN_COLORS.grass3.grassTipColor;
return TERRAIN_COLORS.grass1.grassTipColor;
}