feat(camera): add CameraDiagnostics static tunable owner

Six knobs for the upcoming retail chase camera: UseRetailChaseCamera
master toggle (env ACDREAM_RETAIL_CHASE), AlignToSlope (env
ACDREAM_CAMERA_ALIGN_SLOPE, default on), TranslationStiffness +
RotationStiffness (both 0.45 retail default), MouseLowPassWindowSec
(0.25), CameraAdjustmentSpeed (40.0). DebugPanel mirror lands later;
this commit just stands up the static surface + defaults + tests.

Per spec docs/superpowers/specs/2026-05-18-retail-chase-camera-design.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-18 19:29:11 +02:00
parent 73dee43d14
commit 5945f1d915
2 changed files with 110 additions and 0 deletions

View file

@ -0,0 +1,46 @@
using AcDream.Core.Rendering;
using Xunit;
namespace AcDream.Core.Tests.Rendering;
public class CameraDiagnosticsTests
{
// NOTE: These tests assume the env vars ACDREAM_RETAIL_CHASE and
// ACDREAM_CAMERA_ALIGN_SLOPE are NOT set when running the test
// suite. Static class is initialised on first access; values reflect
// the env state at that time.
[Fact]
public void Defaults_AreRetailValues()
{
// Reset to defaults explicitly (test isolation; another test may
// have flipped these earlier in the run).
CameraDiagnostics.TranslationStiffness = 0.45f;
CameraDiagnostics.RotationStiffness = 0.45f;
CameraDiagnostics.MouseLowPassWindowSec = 0.25f;
CameraDiagnostics.CameraAdjustmentSpeed = 40.0f;
CameraDiagnostics.AlignToSlope = true;
CameraDiagnostics.UseRetailChaseCamera = false;
Assert.Equal(0.45f, CameraDiagnostics.TranslationStiffness);
Assert.Equal(0.45f, CameraDiagnostics.RotationStiffness);
Assert.Equal(0.25f, CameraDiagnostics.MouseLowPassWindowSec);
Assert.Equal(40.0f, CameraDiagnostics.CameraAdjustmentSpeed);
Assert.True(CameraDiagnostics.AlignToSlope);
Assert.False(CameraDiagnostics.UseRetailChaseCamera);
}
[Fact]
public void Setters_PersistRuntimeChanges()
{
CameraDiagnostics.TranslationStiffness = 0.8f;
CameraDiagnostics.UseRetailChaseCamera = true;
Assert.Equal(0.8f, CameraDiagnostics.TranslationStiffness);
Assert.True(CameraDiagnostics.UseRetailChaseCamera);
// Reset so other tests aren't poisoned.
CameraDiagnostics.TranslationStiffness = 0.45f;
CameraDiagnostics.UseRetailChaseCamera = false;
}
}