// Scenarios of the fix list after the Critique of M1-M3 (Docs/critique/M3.md, Docs/status/fixes_m3.md). // look_rock: requirement V1, "your own light is precious, so it has to show something": rock in the headlamp must read as rock. #include "Debug/DescentScenario.h" #include "Debug/DescentStateRegistry.h" #include "Core/Tuning/DescentTune_Look.h" #include "World/DescentWorldScenarioSteps.h" using namespace DescentWorldScn; namespace { /** The view Distance metres before the rock wall east of the Great Void (the place of look_near_wall), looking at it. */ bool FixPlaceBeforeWall(UWorld* World, double DistanceM, double ZOffset, double YOffset) { UDescentTerrainSubsystem* T = UDescentTerrainSubsystem::Get(World); if (!T) { return false; } const FVector Origin(880.0, -230.0 + YOffset, -700.0 + ZOffset); const double Hit = T->Raycast(Origin, FVector(1, 0, 0), 300.0); if (Hit <= 0.0) { return false; } const FVector Wall = Origin + FVector(Hit, 0, 0); return PlaceView(World, Wall - FVector(DistanceM, 0, 0), Wall, 60.f); } void FixLogShot(FDescentScenarioBuilder& S, const FString& Label) { ShotAllowDark(S, Label); S.Do(TEXT("numbers of ") + Label, [Label](FDescentScenarioContext& C) { const FDescentLumaStats& St = C.LastShotStats; UE_LOG(LogDescent, Display, TEXT("FIX shot %s: centre luma %.4f, centre detail %.4f, centre rms %.4f, mean %.4f, p99 %.4f"), *Label, St.CentreLuma, St.CentreDetail, St.CentreRms, St.MeanLuma, St.P99Luma); }); } } DESCENT_SCENARIO(look_rock, "V1: rock in the headlamp reads as rock. The wall east of the Great Void from 5, 10 and 15 m with the lamp on: the block contrast inside the beam (sidecar centre_detail) is at least 0.03 (it was 0.006 before the terrain material got surface detail), the brightness stays in the calibration's band, and a place 2 m beside the beam stays dark.") { S.TimeLimit(300.f); StartWithFlyPawn(S); S.Exec(TEXT("Descent.Look.Set Lamp 1")); for (const double Distance : { 5.0, 10.0, 15.0 }) { S.Do(FString::Printf(TEXT("%.0f m before the east wall"), Distance), [Distance](FDescentScenarioContext& C) { if (!FixPlaceBeforeWall(C.World, Distance, 0.0, 0.0)) { C.Fail(TEXT("no wall east of the Great Void")); } }); WaitStreamIdle(S); const FString Label = FString::Printf(TEXT("rock_%02.0fm"), Distance); FixLogShot(S, Label); S.Expect(Label + TEXT(": detail inside the beam >= 0.03, centre luma 0.06 - 0.60"), [](FDescentScenarioContext& C) { const FDescentLumaStats& St = C.LastShotStats; return St.CentreDetail >= 0.03 && St.CentreLuma >= 0.06 && St.CentreLuma <= 0.60; }); } S.Exec(TEXT("Descent.ShotRegion look_rock_rock_15m 0.0 0.0 0.12 0.2")); S.Exec(TEXT("Descent.Look.Set Lamp 0")); S.WaitFrames(5); FixLogShot(S, TEXT("rock_lamp_off")); S.Expect(TEXT("lamp off: the same wall is dark (mean luma < 0.03)"), [](FDescentScenarioContext& C) { return C.LastShotStats.MeanLuma < Descent::Tune::Look::DeepDarkMax; }); S.DumpState(TEXT("end")); S.Quit(); }