ChunkHeight puts a rock's top on the floater layer: its centre is a drawn radius below (ruling asteroid-tops-at-layer)
DrawAhead.ChunkHeight subtracts pose.w, the radius the renderer scales the rock by; reticle and renderer both read it. DrawnPoseTests pins top == layer at radii 2..9. Builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
da2a7cc56a
commit
72ed5cc15f
2 changed files with 11 additions and 5 deletions
|
|
@ -30,8 +30,9 @@ public static class DrawAhead
|
|||
public static float FloaterHeight(Zone zone, GameplaySettings settings, float2 planar, float lead) => Height(zone, planar, lead) + settings.FloaterLayerHeight;
|
||||
|
||||
// A belt rock's drawn position (ruling asteroids-on-floater-layer): its planar pose at the drawn time, on the floater layer over the field.
|
||||
// Open question asteroid-clearance: the rock centre sits at the layer. ChunkHeight is the one line that changes if its top should (pose.w is the radius).
|
||||
public static float ChunkHeight(Zone zone, GameplaySettings settings, float4 pose, float lead) => FloaterHeight(zone, settings, pose.xy, lead);
|
||||
// Ruling asteroid-tops-at-layer: the rock's top sits at the layer, so its centre is a drawn radius below it. pose.w is that radius:
|
||||
// the renderer scales the unit rock mesh by it.
|
||||
public static float ChunkHeight(Zone zone, GameplaySettings settings, float4 pose, float lead) => FloaterHeight(zone, settings, pose.xy, lead) - pose.w;
|
||||
|
||||
public static float3 Chunk(Zone zone, GameplaySettings settings, ChunkId chunk, float lead)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -349,9 +349,10 @@ public sealed class DrawnPoseTests : IDisposable
|
|||
}
|
||||
|
||||
// The reticle (DrawAhead.Chunk) and the renderer's per-rock instance (DrawAhead.ChunkHeight on EvaluateBelt's drawn pose)
|
||||
// are one height: the field at the rock's planar position at the drawn time, plus the floater layer. Ruling asteroids-on-floater-layer.
|
||||
// are one height: the field at the rock's planar position at the drawn time, plus the floater layer, less its drawn radius, so its top
|
||||
// is at the layer. Rulings asteroids-on-floater-layer, asteroid-tops-at-layer.
|
||||
[Fact]
|
||||
public void AChunkIsDrawnOnTheFloaterLayerOverTheField()
|
||||
public void AChunkIsDrawnWithItsTopOnTheFloaterLayerOverTheField()
|
||||
{
|
||||
var w = Build();
|
||||
Step(w, 1f / 60f, 301);
|
||||
|
|
@ -367,7 +368,11 @@ public sealed class DrawnPoseTests : IDisposable
|
|||
var reticle = DrawAhead.Chunk(w.Zone, settings, new ChunkId(w.Belt, i), lead);
|
||||
var field = FieldAt(w, drawn[i].xy, time);
|
||||
AssertNear(drawn[i].xy, reticle.xz, 1e-3f, $"chunk {i} reticle xz");
|
||||
Assert.Equal(field + FloaterLayerHeight, reticle.y, 3);
|
||||
var radius = w.Zone.ChunkRadius(new ChunkId(w.Belt, i));
|
||||
Assert.True(radius > 2f, $"chunk {i} has a radius that any scaling of it would move");
|
||||
Assert.Equal(radius, drawn[i].w, 4);
|
||||
Assert.Equal(field + FloaterLayerHeight - radius, reticle.y, 3);
|
||||
Assert.Equal(field + FloaterLayerHeight, reticle.y + radius, 3);
|
||||
Assert.Equal(reticle.y, DrawAhead.ChunkHeight(w.Zone, settings, drawn[i], lead), 4);
|
||||
if (abs(field) > 1f) deep++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue