summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/Game.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-21 13:11:52 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-21 13:11:52 +0800
commit76a6850bb88546fc21f5f78a53fbda04e77c8b52 (patch)
tree45e492b623ef820d452201421b85a0b642d349bd /src/LivingVillage.Desktop/Game.fs
parent000a0b00384806ce85d54dfcd2646cb340a26f01 (diff)
downloadliving-village-76a6850bb88546fc21f5f78a53fbda04e77c8b52.tar.gz
feat(desktop): 确定性昼夜光照过渡与夜灯暖光
新增 lightingBlend 纯函数(黎明明 4:00-6:00、暮色 20:00-22:00 线性过渡,边界与 isNightTick 对齐),天空底色/世界 tint 按混合插值渲染,夜晚灯笼暖光晕强度=LanternGlow(纯叠加矩形、无每帧分配风险);回归测试含锚点/单调斜坡/确定性/光晕开关。
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
-rw-r--r--src/LivingVillage.Desktop/Game.fs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs
index 1d50f3d..9464c8b 100644
--- a/src/LivingVillage.Desktop/Game.fs
+++ b/src/LivingVillage.Desktop/Game.fs
@@ -676,6 +676,21 @@ type LivingVillageGame() as this =
world.Tick
profile.WorldTint
+ // Warm lantern glows strengthen as night falls (pure function of tick phase).
+ if profile.LanternGlow > 0.3f then
+ let glow = profile.LanternGlow
+ let haloAlpha = int (90.0f * glow)
+ for prop in renderPlan.Props do
+ match prop.Kind with
+ | RiverLantern ->
+ let position = VillageArt.worldTile renderPlan prop.Position
+ let screenX = position.X * Sim.tilePixels - int camera.X + Sim.tilePixels / 2
+ let screenY = position.Y * Sim.tilePixels - int camera.Y - Sim.tilePixels / 2
+ spriteBatch.Draw(pixel, Rectangle(screenX - 22, screenY - 22, 60, 60), Color(252, 216, 148, int (float32 haloAlpha * 0.35f)))
+ spriteBatch.Draw(pixel, Rectangle(screenX - 14, screenY - 14, 44, 44), Color(252, 216, 148, haloAlpha))
+ spriteBatch.Draw(pixel, Rectangle(screenX - 8, screenY - 8, 32, 32), Color(255, 236, 180, haloAlpha))
+ | _ -> ()
+
let avatarSpec = VillageArt.avatarSpriteSpec avatarFacing world.Tick
VillageArt.drawCharacter spriteBatch artTextures camera world.Avatar.Pos avatarSpec profile.WorldTint