summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/MenuAmbience.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-29 02:05:39 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-29 02:05:39 +0800
commitcbd89dbff21a66725132eaf1c37e2fb870e72f8d (patch)
tree0696454739e3479ecb697d000c02841c06d7319e /src/LivingVillage.Desktop/MenuAmbience.fs
parent1a67f2bf57e58ef748e71e1bcc2affe901444c39 (diff)
downloadliving-village-cbd89dbff21a66725132eaf1c37e2fb870e72f8d.tar.gz
p57: 菜单/启动水面第二层高光波光——逐列相位错开(步进2.4rad)/更快(周期80 vs 96 tick)/更亮更窄细高光条 + 昼夜 tint 衰减参数 + 帧计数纯函数回归;ANALYZE splash hl/main std=274.97 corr=-0.017、menu hl/main std=279.77 corr=-0.011、层间相关<0.95、相位差2.4rad、无黑块白块
Diffstat (limited to 'src/LivingVillage.Desktop/MenuAmbience.fs')
-rw-r--r--src/LivingVillage.Desktop/MenuAmbience.fs57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/MenuAmbience.fs b/src/LivingVillage.Desktop/MenuAmbience.fs
index 74fefeb..6d258c5 100644
--- a/src/LivingVillage.Desktop/MenuAmbience.fs
+++ b/src/LivingVillage.Desktop/MenuAmbience.fs
@@ -41,6 +41,49 @@ module MenuAmbience =
let waterColumnCrest (frame: int64) (column: int) (rowIndex: int) : bool =
waterWave frame column rowIndex > 0.7f
+ // ---------------- ①.5 第二层高光波光(P57) ----------------
+ // P46 验收遗留:主水带波光层次偏弱。在**主水带之上**再叠一层细高光条:
+ // * 更快/更细:周期 80 tick(主水带连续相位 96 tick),故推进速度略不同;
+ // * 逐列相位错开:相邻列固定差 highlightColumnStep(=2.4 rad,非零且异于主水带的 120°);
+ // * 更亮:纯白 (255,255,255),亮于主水带波峰色 (225,240,245);
+ // * 更窄:条高 2px(主波峰 3px)、段宽 20px(满格 32px),且亮列阈值更高(0.86 > 0.7)。
+ // 全为帧计数纯函数:无随机、无时钟;`light` 参数用于昼夜 tint 衰减(日场 1.0,夜场 <1)。
+
+ let highlightPeriodTicks = 80.0f
+ let highlightColumnStep = 2.4f
+ let highlightRowStep = 0.9f
+ let highlightCrestThreshold = 0.86f
+ let highlightThickness = 2
+ let highlightBarWidth = 20
+ let highlightRowDelta = 1
+ let highlightRgb : int * int * int = (255, 255, 255)
+ let highlightMaxAlpha = 220
+ let highlightDayLight = 1.0f
+ let highlightNightLight = 0.42f
+
+ /// 高光层相位(弧度)。帧推进用 highlightPeriodTicks(与主水带的 96 tick 不同),
+ /// 逐列差 highlightColumnStep、逐行差 highlightRowStep;帧号取模保持有界、无浮点漂移。
+ let highlightPhase (frame: int64) (column: int) (rowIndex: int) : float32 =
+ let t = float32 (frame % 100000L)
+ (t / highlightPeriodTicks) * (2.0f * float32 Math.PI)
+ + float32 column * highlightColumnStep
+ + float32 rowIndex * highlightRowStep
+
+ /// 高光层正弦波值,范围 [-1, 1]。
+ let highlightWave (frame: int64) (column: int) (rowIndex: int) : float32 =
+ sin (highlightPhase frame column rowIndex)
+
+ /// 该列是否出现细高光条(阈值比主水带高 → 更稀疏)。
+ let highlightVisible (frame: int64) (column: int) (rowIndex: int) : bool =
+ highlightWave frame column rowIndex > highlightCrestThreshold
+
+ /// 高光条 alpha:波峰处最亮,随 `light`(昼夜 tint)线性衰减,钳 [0,255]。
+ let highlightAlpha (light: float32) (frame: int64) (column: int) (rowIndex: int) : int =
+ let wave = highlightWave frame column rowIndex
+ let raw = float32 highlightMaxAlpha * light * (0.6f + 0.4f * wave)
+ let rounded = int (Math.Round(float raw, MidpointRounding.AwayFromZero))
+ max 0 (min 255 rounded)
+
// ---------------- ② 灯笼呼吸光晕 ----------------
/// 灯笼呼吸 alpha,界于 [40, 96];相位随帧与灯序号推进,邻灯不同步。
@@ -115,3 +158,17 @@ module P46ShotScript =
// menuEntranceFrame 在 Update 末尾 +1,故设置值取目标相位帧的前一帧。
let menuPeakFrame = 172L
let menuTroughFrame = 241L
+
+/// P57 取证:第二层高光波光证据帧表(60Hz 帧号纯数据,Game 与回归测试共用)。
+/// 对同一帧各拍「高光层关 / 开」两帧,像素差即高光层贡献;splash 与 menu 各一组。
+module P57ShotScript =
+
+ let splashBaseName = "p57-splash-base"
+ let splashHighlightName = "p57-splash-highlight"
+ let menuBaseName = "p57-menu-base"
+ let menuHighlightName = "p57-menu-highlight"
+
+ /// splash 水面仍可见(reveal<1)。
+ let splashFrame = 16L
+ /// menu 入场完成后的稳定帧(>=120)。
+ let menuFrame = 180L