Zone.WellReference owns each body's reference zero (GetHeight uses it). Gravity.cginc mirrors GravityField.Potential; Brushes/Gravity Field draws depth = -h on layer 9 from a StructuredBuffer that GravityLowering.Lower fills from the zone each frame; GravityLowering.CreateField makes the one quad. GravityFieldParityVerify renders it and compares every texel with -Zone.GetHeight (max error 0.0059 u), the gradient with GetForce (0.03 degrees) and the wiring. Deleted: the Gravity Well children of Planet, Gas Giant, Sun and PlanetOutpost prefabs, Wormhole 1's three gravity children, their overrides in Main Menu and TestScene, five wormhole/wave materials and two brush shaders, Planet.GravityWellDepth/Radius, BodyData keys 6-7, PlanetSettings.GravityDepth/GravityRadius (and the Settings.asset keys). Surface Displacement culls layer 9 only. Headless build and tests not yet run at this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
1.3 KiB
C#
22 lines
1.3 KiB
C#
using CultMath;
|
|
using GameCult.Caching;
|
|
|
|
// The one fixture that gives a test zone a slope: a body on a parentless orbit (the origin unless `at` says otherwise; call again for more bodies), with the
|
|
// curves a body needs. Gravity is the sum of body wells (GravityField), so a test that wants ground to slide on
|
|
// digs it here and nowhere else. `strength` is the well's c (u^2/s^2) and `coreRadius` its softened core in u; the
|
|
// Roche limit curve sits at 2.5 cores so the body is a valid well.
|
|
internal static class WellFixture
|
|
{
|
|
public static void Dig(CultCache cache, ZonePack pack, PlanetSettings settings, float strength, float coreRadius, float2 at = default)
|
|
{
|
|
settings.BodyRadius = new ExponentialCurve();
|
|
settings.OrbitPeriod = new ExponentialCurve();
|
|
settings.WellStrength = new ExponentialCurve { Constant = strength };
|
|
settings.CoreRadius = new ExponentialCurve { Constant = coreRadius };
|
|
settings.RocheLimit = new ExponentialCurve { Constant = 2.5f * coreRadius };
|
|
var orbit = cache.Upsert(new OrbitData { FixedPosition = at }).Key;
|
|
var body = cache.Upsert(new PlanetData { Name = $"Well {at.x},{at.y}", Orbit = new CultRecordRef<OrbitData>(orbit) }).Key;
|
|
pack.Orbits.Add(new CultRecordRef<OrbitData>(orbit));
|
|
pack.Planets.Add(new CultRecordRef<BodyData>(body));
|
|
}
|
|
}
|