acdream/src/AcDream.Core/Rendering/CameraDiagnostics.cs
Erik 67e64c79cf feat(camera): flip retail chase camera to default-on after visual ship
After visual verification 2026-05-18 (turn lag, coast-and-settle,
slope-tilt, jump tracking with contact-plane projection all working),
make the retail chase camera the default. Legacy ChaseCamera stays
available via the DebugPanel toggle (ACDREAM_RETAIL_CHASE=0 or the
checkbox) pending a follow-up deletion commit.

Env var polarity now matches AlignToSlope: default-on if unset, off
only when explicitly "0".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 09:47:33 +02:00

68 lines
2.9 KiB
C#

using System;
namespace AcDream.Core.Rendering;
/// <summary>
/// Runtime-tunable knobs for the retail-faithful chase camera. Mirrors
/// the <see cref="AcDream.Core.Physics.PhysicsDiagnostics"/> pattern:
/// static fields seeded from env vars at process start, runtime-settable
/// via property setters that the DebugPanel writes to.
///
/// <para>
/// Spec: <c>docs/superpowers/specs/2026-05-18-retail-chase-camera-design.md</c>.
/// </para>
/// </summary>
public static class CameraDiagnostics
{
/// <summary>
/// Master toggle. When true (default, after visual ship 2026-05-18)
/// the retail-faithful <c>AcDream.App.Rendering.RetailChaseCamera</c>
/// is the active chase camera; when false, the legacy
/// <c>AcDream.App.Rendering.ChaseCamera</c> rigid-follow camera is.
/// Initial state from <c>ACDREAM_RETAIL_CHASE</c> — default-on if
/// unset, off only when explicitly set to <c>"0"</c>. The legacy
/// camera stays available via the DebugPanel toggle pending the
/// follow-up deletion commit.
/// </summary>
public static bool UseRetailChaseCamera { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_RETAIL_CHASE") != "0";
/// <summary>
/// When true (default), the camera basis follows the player's
/// 5-frame averaged velocity vector — tilts with the terrain on
/// hills. When false, the basis is built from a flat (yaw, 0) vector
/// and the camera stays horizontal even on slopes. Initial state
/// from <c>ACDREAM_CAMERA_ALIGN_SLOPE</c>; default-on if unset.
/// </summary>
public static bool AlignToSlope { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_CAMERA_ALIGN_SLOPE") != "0";
/// <summary>
/// Per-frame translation damping rate. Retail default 0.45. Higher
/// (→ 1.0) snaps faster; lower (→ 0.0) lags more. Formula per frame:
/// <c>alpha = clamp(TranslationStiffness * dt * 10, 0, 1)</c>.
/// </summary>
public static float TranslationStiffness { get; set; } = 0.45f;
/// <summary>
/// Per-frame rotation damping rate. Independent of translation —
/// can be tuned higher so the camera swings to look at you faster
/// than it physically catches up. Retail default 0.45.
/// </summary>
public static float RotationStiffness { get; set; } = 0.45f;
/// <summary>
/// Mouse-delta low-pass window (seconds). Mouse deltas spaced
/// closer than this are averaged with the previous delta before
/// being fed to pitch/yaw adjustments. Smooths out jitter on
/// high-DPI mice. Retail default 0.25.
/// </summary>
public static float MouseLowPassWindowSec { get; set; } = 0.25f;
/// <summary>
/// Per-second rate that held-key offset adjustments
/// (CameraZoomIn/Out, CameraRaise/Lower) integrate into the
/// camera's Distance / Pitch. Retail default 40.0.
/// </summary>
public static float CameraAdjustmentSpeed { get; set; } = 40.0f;
}