Draw every moving body at the drawn time T = ExactTime + Lead

Planets, belts, wells, loot, mines, stations, the chunk reticle and the flow
clock are evaluated through DrawAhead (Time, Orbit, Height, Position) at one
drawn time; the rail law lives once in Zone.Offset; OrbitPositionAt, GetHeight,
ChunkPose, EvaluateBelt and RideHeight take a time. Fixes the planet jumping
against a co-moving ship at display rates above the step rate.

Not yet built or run (Unity presenter files are verified by compile only on
Starfire).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-15 21:26:36 +02:00
commit b57207045d
14 changed files with 429 additions and 62 deletions

View file

@ -32,9 +32,10 @@ public static class GravityLowering
/// <summary>
/// Fills one record per body of the zone (a null zone has none) and sets the shader globals. The buffer is the
/// caller's, (re)allocated to the body count (at least one, so the global is always bound).
/// caller's, (re)allocated to the body count (at least one, so the global is always bound). Wells are lowered at the
/// drawn time (DrawAhead.Time), the same T the planets and a ship's ride height use.
/// </summary>
public static void Lower(Zone zone, ref ComputeBuffer wells)
public static void Lower(Zone zone, float lead, ref ComputeBuffer wells)
{
var count = zone?.PlanetInstances.Count ?? 0;
var capacity = Mathf.Max(count, 1);
@ -50,7 +51,7 @@ public static class GravityLowering
foreach (var body in zone.PlanetInstances.Values)
_records[i++] = new WellRecord
{
Position = new Vector2(body.Orbit.Position.x, body.Orbit.Position.y),
Position = DrawAhead.Orbit(zone, body.BodyData.Orbit.Key, lead).ToUnity(),
Strength = body.WellStrength,
CoreRadius = body.RocheLimit,
Reference = zone.WellReference(body)