Move orbit geometry onto runtime owner
This commit is contained in:
parent
bb38af3f6a
commit
7d176f4dc3
5 changed files with 12 additions and 8 deletions
Binary file not shown.
|
|
@ -153,7 +153,7 @@ public class Zone
|
|||
if (orbit.Period > .01f)
|
||||
{
|
||||
var phase = (float) frac(_time / orbit.Period);
|
||||
pos = OrbitData.Evaluate(frac(phase + orbit.Phase)) * orbit.Distance;
|
||||
pos = Orbit.Evaluate(frac(phase + orbit.Phase)) * orbit.Distance;
|
||||
|
||||
if (float.IsNaN(pos.x))
|
||||
{
|
||||
|
|
@ -221,7 +221,7 @@ public class Zone
|
|||
else size = Settings.AsteroidSize.Evaluate(asteroid.Size);
|
||||
|
||||
var rot = (float) (_time * asteroid.RotationSpeed % (PI * 2));
|
||||
var pos = OrbitData.Evaluate((float) frac(_time / Settings.OrbitPeriod.Evaluate(asteroid.Distance) +
|
||||
var pos = Orbit.Evaluate((float) frac(_time / Settings.OrbitPeriod.Evaluate(asteroid.Distance) +
|
||||
asteroid.Phase)) * asteroid.Distance + belt.NewOrbitPosition;
|
||||
//belt.NewPositions[i] = float3(pos.x, GetHeight(pos) + Settings.AsteroidVerticalOffset, pos.y);
|
||||
belt.NewTransforms[i] = float4(pos.x, pos.y, rot, size);
|
||||
|
|
@ -552,6 +552,12 @@ public class Orbit
|
|||
public float2 PreviousPosition = float2.zero;
|
||||
public float Period;
|
||||
|
||||
public static float2 Evaluate(float phase)
|
||||
{
|
||||
phase *= PI * 2;
|
||||
return new float2(cos(phase), sin(phase));
|
||||
}
|
||||
|
||||
public Orbit(PlanetSettings settings, OrbitData data)
|
||||
{
|
||||
ID = data.ID;
|
||||
|
|
|
|||
|
|
@ -115,9 +115,4 @@ public class OrbitData
|
|||
|
||||
public float2 FixedPosition = float2.zero;
|
||||
|
||||
public static float2 Evaluate(float phase)
|
||||
{
|
||||
phase *= PI * 2;
|
||||
return new float2(cos(phase), sin(phase));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ public class GeneratorPlanet
|
|||
var p0 = new float2(0, dist);
|
||||
|
||||
// Position of second child
|
||||
var p1 = OrbitData.Evaluate(1.0f / vertices) * dist;
|
||||
var p1 = Orbit.Evaluate(1.0f / vertices) * dist;
|
||||
|
||||
// Maximum child distance is half the distance to the neighbor minus the neighbor's radius
|
||||
var p0ChildDist = (distance(p0, p1) * proportion - Settings.PlanetSafetyRadius.Evaluate(sharedMass * (1 - proportion))) * .75f;
|
||||
|
|
|
|||
|
|
@ -1028,6 +1028,9 @@ First Aetheria surfaces to publish:
|
|||
`OrbitData`; `Zone`, `ActionGameManager`, and `ZoneRenderer` consume
|
||||
`Orbit` runtime properties, and the old `Orbit.ToData()` construction
|
||||
capture bridge is deleted.
|
||||
- Done: move orbit phase evaluation off `OrbitData`; runtime zone updates,
|
||||
asteroid transforms, and generator rosette spacing now use `Orbit.Evaluate`,
|
||||
leaving `OrbitData` as a construction row only.
|
||||
- Done: move live asteroid-belt simulation, scanning, and mesh setup reads
|
||||
off `AsteroidBeltData`; `Zone`, `ResourceScanner`, and `AsteroidBeltUI`
|
||||
consume `AsteroidBelt` runtime asteroid/resource/orbit properties, and
|
||||
|
|
|
|||
Loading…
Reference in a new issue