add: world config (wind, graphics, terrain, fog)

This commit is contained in:
Tom Boullay
2026-05-13 15:00:13 +02:00
parent 23cab2da5e
commit 1d3aa1c9f2
8 changed files with 323 additions and 1 deletions
+58
View File
@@ -0,0 +1,58 @@
import { useWorldSettingsStore } from "@/managers/stores/useWorldSettingsStore";
import type { GraphicsState } from "@/data/world/graphicsConfig";
export function useGraphicsSettings(): GraphicsState {
return useWorldSettingsStore((state) => state.graphics);
}
export function useSetGraphicsSettings(): (
graphics: Partial<GraphicsState>
) => void {
return useWorldSettingsStore((state) => state.setGraphics);
}
export function useDynamicGrass(): boolean {
return useWorldSettingsStore((state) => state.graphics.dynamicGrass);
}
export function useDynamicTrees(): boolean {
return useWorldSettingsStore((state) => state.graphics.dynamicTrees);
}
export function useDynamicClouds(): boolean {
return useWorldSettingsStore((state) => state.graphics.dynamicClouds);
}
export function useShadowsEnabled(): boolean {
return useWorldSettingsStore((state) => state.graphics.shadowsEnabled);
}
export function useGrassDensity(): number {
return useWorldSettingsStore((state) => state.graphics.grassDensity);
}
export function useGraphicsSetters() {
const setDynamicGrass = useWorldSettingsStore(
(state) => state.setDynamicGrass
);
const setDynamicTrees = useWorldSettingsStore(
(state) => state.setDynamicTrees
);
const setDynamicClouds = useWorldSettingsStore(
(state) => state.setDynamicClouds
);
const setShadowsEnabled = useWorldSettingsStore(
(state) => state.setShadowsEnabled
);
const setGrassDensity = useWorldSettingsStore(
(state) => state.setGrassDensity
);
return {
setDynamicGrass,
setDynamicTrees,
setDynamicClouds,
setShadowsEnabled,
setGrassDensity,
};
}
+22
View File
@@ -0,0 +1,22 @@
import { useWorldSettingsStore } from "@/managers/stores/useWorldSettingsStore";
import type { WindState } from "@/data/world/windConfig";
export function useWind(): WindState {
return useWorldSettingsStore((state) => state.wind);
}
export function useSetWind(): (wind: Partial<WindState>) => void {
return useWorldSettingsStore((state) => state.setWind);
}
export function useWindSpeed(): number {
return useWorldSettingsStore((state) => state.wind.speed);
}
export function useWindDirection(): number {
return useWorldSettingsStore((state) => state.wind.direction);
}
export function useWindStrength(): number {
return useWorldSettingsStore((state) => state.wind.strength);
}