Add fractal surface page planner
This commit is contained in:
parent
8225bbf19d
commit
f256dba418
9 changed files with 237 additions and 3 deletions
|
|
@ -511,8 +511,11 @@ Use parent summaries while child pages stream.
|
|||
|
||||
Current state: `AquariumFractalSurfacePageKey` and
|
||||
`AquariumFractalSurfacePage` define renderer-agnostic page metadata for height,
|
||||
2D signed-distance, material, and confidence pages. The page store and D3D12
|
||||
lowering remain open.
|
||||
2D signed-distance, material, and confidence pages. `FractalSurfacePagePlanner`
|
||||
turns a selected IFS cut into stable page metadata, and the Zyphos render plan
|
||||
now exposes height, 2D signed-distance, material, and confidence pages beside
|
||||
its structural probe reservoir. The page store, eviction policy, atlas, and
|
||||
D3D12 lowering remain open.
|
||||
|
||||
### Phase F: 3D SDF Splat Backend
|
||||
|
||||
|
|
|
|||
|
|
@ -402,6 +402,8 @@ Tasks:
|
|||
|
||||
- [x] Add renderer-agnostic surface page key/metadata contracts for height,
|
||||
2D signed-distance, material, and confidence pages.
|
||||
- [x] Add CPU surface page planner that lowers selected IFS cuts into stable
|
||||
page metadata.
|
||||
- [x] Add fake payload store with resident/missing states.
|
||||
- [x] Add child request queue.
|
||||
- [ ] Add score/cost eviction policy.
|
||||
|
|
|
|||
69
src/Aquarium.Engine.Fractal/Lod/FractalSurfacePagePlanner.cs
Normal file
69
src/Aquarium.Engine.Fractal/Lod/FractalSurfacePagePlanner.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using Aquarium.Engine.Fractal.Grammar;
|
||||
|
||||
namespace Aquarium.Engine.Fractal.Lod;
|
||||
|
||||
public static class FractalSurfacePagePlanner
|
||||
{
|
||||
public static AquariumFractalSurfacePage[] Plan(
|
||||
FractalOwnershipTree tree,
|
||||
IReadOnlyList<AquariumFractalSummary> summaries,
|
||||
IReadOnlyList<AquariumSelectedCut> selectedCut,
|
||||
AquariumFractalSurfacePageKind kind,
|
||||
int width,
|
||||
int height,
|
||||
int mipLevel = 0)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(tree);
|
||||
ArgumentNullException.ThrowIfNull(summaries);
|
||||
ArgumentNullException.ThrowIfNull(selectedCut);
|
||||
if (width <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(width), width, "Surface page width must be positive.");
|
||||
}
|
||||
|
||||
if (height <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(height), height, "Surface page height must be positive.");
|
||||
}
|
||||
|
||||
if (mipLevel < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(mipLevel), mipLevel, "Surface page mip level must not be negative.");
|
||||
}
|
||||
|
||||
var summariesByKey = summaries.ToDictionary(summary => summary.NodeKey.Value, StringComparer.Ordinal);
|
||||
var nodesByKey = tree.Nodes.ToDictionary(node => node.Key.Value, StringComparer.Ordinal);
|
||||
var pages = new List<AquariumFractalSurfacePage>(selectedCut.Count);
|
||||
for (var index = 0; index < selectedCut.Count; index++)
|
||||
{
|
||||
var cut = selectedCut[index];
|
||||
if (!summariesByKey.TryGetValue(cut.NodeKey.Value, out var summary)
|
||||
|| !nodesByKey.TryGetValue(cut.NodeKey.Value, out var node))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pages.Add(new AquariumFractalSurfacePage(
|
||||
new AquariumFractalSurfacePageKey(node.DomainKey, cut.NodeKey, kind, mipLevel),
|
||||
summary.BoundsMinMax,
|
||||
width,
|
||||
height,
|
||||
PayloadHandle: index,
|
||||
MaxError: MaxErrorForKind(summary, kind)));
|
||||
}
|
||||
|
||||
return pages.ToArray();
|
||||
}
|
||||
|
||||
private static float MaxErrorForKind(AquariumFractalSummary summary, AquariumFractalSurfacePageKind kind)
|
||||
{
|
||||
return kind switch
|
||||
{
|
||||
AquariumFractalSurfacePageKind.Height => MathF.Max(summary.MaxHeightError, 0.0f),
|
||||
AquariumFractalSurfacePageKind.SignedDistance2D => MathF.Max(summary.MaxHeightError, 0.0f),
|
||||
AquariumFractalSurfacePageKind.Material => MathF.Max(summary.MaxMaterialDelta, 0.0f),
|
||||
AquariumFractalSurfacePageKind.Confidence => MathF.Max(summary.MaxHeightError, summary.MaxMaterialDelta),
|
||||
_ => 0.0f,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ namespace Aquarium.Zyphos;
|
|||
public static class ZyphosFractalTerrain
|
||||
{
|
||||
private const string PatchRelativePath = "Worlds/zyphos-first-fractal-terrain.aquageo";
|
||||
private const int SurfacePageDimension = 128;
|
||||
|
||||
private static readonly Lazy<string> PatchSource = new(() => File.ReadAllText(PatchPath));
|
||||
private static readonly Lazy<FractalOwnershipTree> Tree = new(() => FractalDslCompiler.Compile(PatchSource.Value));
|
||||
|
|
@ -24,6 +25,13 @@ public static class ZyphosFractalTerrain
|
|||
MaxGpuEstimatedCost: 64.0f,
|
||||
MaxResidentPayloads: 64,
|
||||
MaxSsdRequests: 2);
|
||||
private static readonly AquariumFractalSurfacePageKind[] PlannedSurfacePageKinds =
|
||||
[
|
||||
AquariumFractalSurfacePageKind.Height,
|
||||
AquariumFractalSurfacePageKind.SignedDistance2D,
|
||||
AquariumFractalSurfacePageKind.Material,
|
||||
AquariumFractalSurfacePageKind.Confidence,
|
||||
];
|
||||
|
||||
public static string PatchPath => Path.Combine(AppContext.BaseDirectory, PatchRelativePath);
|
||||
|
||||
|
|
@ -60,6 +68,7 @@ public static class ZyphosFractalTerrain
|
|||
selectedCut,
|
||||
bucketPixelsPerWorld,
|
||||
new FractalXorShiftRandom(((uint)bucket ^ 0xC2B2AE35u) + (uint)selectedCut.Length));
|
||||
var surfacePages = PlanSurfacePages(selectedCut);
|
||||
var cutKey = CutCacheKey(selectedCut);
|
||||
AquariumHeightFieldBrush[] brushes;
|
||||
lock (PlanCacheLock)
|
||||
|
|
@ -76,8 +85,22 @@ public static class ZyphosFractalTerrain
|
|||
selectedCut,
|
||||
resourcePlan,
|
||||
structuralProbeReservoir,
|
||||
surfacePages,
|
||||
bucketPixelsPerWorld,
|
||||
$"{selectedCut.Length}/{Summaries.Value.Length} cuts / {brushes.Length}/{OwnershipTree.Claims.Count} brushes / {resourcePlan.UpdateNodes.Length}/{DefaultBudget.MaxCpuUpdates} cpu updates / {resourcePlan.GpuEstimatedCost:0.0}/{DefaultBudget.MaxGpuEstimatedCost:0.0} gpu cost / {resourcePlan.Residency.ResidentNodes.Count}/{DefaultBudget.MaxResidentPayloads} resident / {resourcePlan.Residency.RequestedNodes.Count}/{DefaultBudget.MaxSsdRequests} ssd requests / {(structuralProbeReservoir.HasSample ? structuralProbeReservoir.CandidateCount : 0)} probe candidates / {bucketPixelsPerWorld:0.00} px-wu");
|
||||
$"{selectedCut.Length}/{Summaries.Value.Length} cuts / {brushes.Length}/{OwnershipTree.Claims.Count} brushes / {resourcePlan.UpdateNodes.Length}/{DefaultBudget.MaxCpuUpdates} cpu updates / {resourcePlan.GpuEstimatedCost:0.0}/{DefaultBudget.MaxGpuEstimatedCost:0.0} gpu cost / {resourcePlan.Residency.ResidentNodes.Count}/{DefaultBudget.MaxResidentPayloads} resident / {resourcePlan.Residency.RequestedNodes.Count}/{DefaultBudget.MaxSsdRequests} ssd requests / {(structuralProbeReservoir.HasSample ? structuralProbeReservoir.CandidateCount : 0)} probe candidates / {surfacePages.Length} surface pages / {bucketPixelsPerWorld:0.00} px-wu");
|
||||
}
|
||||
|
||||
private static AquariumFractalSurfacePage[] PlanSurfacePages(IReadOnlyList<AquariumSelectedCut> selectedCut)
|
||||
{
|
||||
return PlannedSurfacePageKinds
|
||||
.SelectMany(kind => FractalSurfacePagePlanner.Plan(
|
||||
Tree.Value,
|
||||
Summaries.Value,
|
||||
selectedCut,
|
||||
kind,
|
||||
SurfacePageDimension,
|
||||
SurfacePageDimension))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private static string CutCacheKey(IReadOnlyList<AquariumSelectedCut> selectedCut)
|
||||
|
|
@ -114,6 +137,7 @@ public static class ZyphosFractalTerrain
|
|||
$" ssdRequests: {plan.ResourcePlan.Residency.RequestedNodes.Count}/{budget.MaxSsdRequests}",
|
||||
$" structuralProbe: {(plan.StructuralProbeReservoir.HasSample ? plan.StructuralProbeReservoir.NodeKey.Value : "none")}",
|
||||
$" structuralProbeWeight: {plan.StructuralProbeReservoir.WeightSum:0.000} candidates={plan.StructuralProbeReservoir.CandidateCount} contributionWeight={plan.StructuralProbeReservoir.ContributionWeight:0.000}",
|
||||
$" surfacePages: {plan.SurfacePages.Length} {SurfacePageDimension}x{SurfacePageDimension}",
|
||||
"selected:",
|
||||
};
|
||||
|
||||
|
|
@ -154,5 +178,6 @@ public readonly record struct ZyphosFractalRenderPlan(
|
|||
AquariumSelectedCut[] SelectedCuts,
|
||||
FractalResourcePlan ResourcePlan,
|
||||
FractalProbeReservoirSnapshot StructuralProbeReservoir,
|
||||
AquariumFractalSurfacePage[] SurfacePages,
|
||||
float PixelsPerWorld,
|
||||
string Summary);
|
||||
|
|
|
|||
|
|
@ -169,3 +169,4 @@
|
|||
{"timestamp":"2026-05-19T21:18:00+01:00","topic":"zyphos-structural-probe-reservoir","lesson":"Zyphos now exposes a structural probe reservoir beside its selected cut and resource plan. `FractalStructuralProbeReservoir` builds a selected-cut `FractalProbeSample` reservoir from the ownership tree, summaries, node domains, and projected pixels per world unit; `ZyphosFractalRenderPlan` carries the snapshot and the debug dump reports selected probe weight/candidate count. This connects the pure IFS structural-probe producer to a live client path before GPU reservoir buffers are introduced.","files":["src/Aquarium.Engine.Fractal/Lod/FractalStructuralProbeReservoir.cs","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","tests/Aquarium.Engine.Fractal.Tests/FractalStructuralProbeReservoirTests.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs","docs/perfect-machine-architecture.md","research/rendering/fractal-brush-implementation-roadmap.md"],"source":"continuing Perfect Machine Phase C after adding structural probe generation"}
|
||||
{"timestamp":"2026-05-19T21:42:00+01:00","topic":"fractal-probe-temporal-validation","lesson":"Fractal probe reuse now has a CPU temporal validation contract before GPU reuse exists. `FractalProbeReuseValidator.ValidateTemporal` composes domain/local-shift validation with renderer-facing gates for camera motion, disocclusion confidence, material delta, and visibility confidence, returning explicit rejection reasons. This keeps future ReSTIR/GRIS probe reuse from becoming private shader folklore.","files":["src/Aquarium.Engine.Fractal/Lod/FractalProbeSample.cs","tests/Aquarium.Engine.Fractal.Tests/FractalProbeSampleTests.cs","docs/perfect-machine-architecture.md","research/rendering/fractal-brush-implementation-roadmap.md","state/memory.json"],"source":"Perfect Machine Phase C validation contract work"}
|
||||
{"timestamp":"2026-05-19T22:03:00+01:00","topic":"fractal-surface-page-contract","lesson":"Phase E has a portable page contract before renderer lowering. `AquariumFractalSurfacePageKey` gives height, 2D signed-distance, material, and confidence pages stable domain/node/kind/mip identity; `AquariumFractalSurfacePage` carries bounds, dimensions, payload handle, and max error without D3D12 types. This lets the residency/page store evolve without treating current height brushes as the page model.","files":["src/Aquarium.Engine.Contracts/Fractal/AquariumFractalContracts.cs","tests/Aquarium.Engine.Fractal.Tests/FractalSurfacePageContractTests.cs","docs/perfect-machine-architecture.md","research/rendering/fractal-brush-implementation-roadmap.md","state/memory.json"],"source":"Perfect Machine Phase E groundwork after fractal probe validation"}
|
||||
{"timestamp":"2026-05-19T22:31:00+01:00","topic":"fractal-surface-page-planner","lesson":"Phase E now has a CPU page-planning boundary. `FractalSurfacePagePlanner` lowers selected IFS cuts into stable height, 2D signed-distance, material, and confidence page metadata; `ZyphosFractalRenderPlan` carries those pages beside brushes, resource planning, and structural probe reservoirs. This proves page identity and inspection before adding a page store, eviction policy, D3D12 atlas, or GPU lowering.","files":["src/Aquarium.Engine.Fractal/Lod/FractalSurfacePagePlanner.cs","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","tests/Aquarium.Engine.Fractal.Tests/FractalSurfacePagePlannerTests.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs","docs/perfect-machine-architecture.md","research/rendering/fractal-brush-implementation-roadmap.md","state/memory.json","state/map.yaml"],"source":"Perfect Machine Phase E CPU page planning"}
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ renderer_state:
|
|||
- Fractal resource planning is explicit: one plan coordinates CPU contribution updates, GPU selected-cut estimated cost, RAM resident payload budget, and SSD request pressure before backend packet compilation. This same budget language should generalize to Mimir-style sensor fusion because both fractal SDF probes and camera/microphone feature detections accumulate confidence-weighted spatial samples into temporal reservoirs.
|
||||
- The consolidated fractal brush architecture plan defines the intended pipeline: client intent -> domain roots -> semantic IFS brush grammar -> ownership tree -> node summaries -> contribution cache/residency scheduler -> backend packets -> renderer passes -> debug/evidence, with explicit module boundaries and mockable unit-test seams.
|
||||
- The Perfect Machine architecture lives in docs/perfect-machine-architecture.md. It is the current waterfall design authority for fast 2D SDF splats, 3D SDF splats, 2D-projected-to-3D surface splats, IFS `.aquageo` structural probes, Mimir-style camera/audio evidence candidates, ReSTIR/GRIS reservoir reuse, heuristic occupancy graph updates, resource-tier residency, and TAA guide-buffer integration.
|
||||
- Fractal surface page planning now has a CPU boundary: FractalSurfacePagePlanner lowers selected IFS cuts into stable height, 2D signed-distance, material, and confidence page metadata; ZyphosFractalRenderPlan exposes these pages, while the live D3D12 page store and atlas remain future work.
|
||||
- The actionable fractal brush implementation roadmap lives in research/rendering/fractal-brush-implementation-roadmap.md and is the execution authority for the first pass.
|
||||
- Bundled blue-noise texture assets are retained for future dithering/noise work even though the removed medium path no longer samples them.
|
||||
- D3D11 scene renderer, runtime volumetrics, cloud/fog research, medium/froxel render targets, and the SDF-field renderer plan are shelved and removed from live repo state.
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@
|
|||
"The consolidated fractal brush architecture lives in research/rendering/fractal-brush-architecture-plan.md. Its pipeline is client intent -> domain roots -> semantic IFS brush grammar -> ownership tree -> node summaries -> contribution cache/residency scheduler -> backend packets -> renderer passes -> debug/evidence. Its credibility depends on module boundaries and tests: contracts, pure CPU fractal core, D3D12 backend, client adapters, mock payload/probe/random/clock seams, shader parity tests, and deterministic performance fixtures.",
|
||||
"The Perfect Machine waterfall architecture lives in docs/perfect-machine-architecture.md. Treat it as the design authority before expanding SDF splat backends, sensor-fusion candidate adapters, reservoir guide buffers, occupancy graph state, resource-tier residency, or stochastic learned priority. Its core split is domains -> evidence candidates -> target evaluation -> ReSTIR/GRIS reservoirs -> occupancy graph -> residency -> 2D/3D/projected SDF splat packets -> TAA guide buffers.",
|
||||
"AquariumFractalSurfacePageKey and AquariumFractalSurfacePage are the renderer-agnostic page contracts for Phase E: height, SignedDistance2D, material, and confidence surface pages carry stable domain/node/kind/mip keys, bounds, dimensions, payload handles, and max error before any D3D12 page store exists.",
|
||||
"FractalSurfacePagePlanner lowers selected IFS cuts into stable surface page metadata without renderer dependencies. ZyphosFractalRenderPlan now exposes height, SignedDistance2D, material, and confidence pages beside brushes, resource plans, and structural probe reservoirs; the actual page store, eviction, atlas, and D3D12 lowering are still open.",
|
||||
"The actionable fractal brush roadmap lives in research/rendering/fractal-brush-implementation-roadmap.md. Start with the first work packet: add Aquarium.Engine.Fractal and tests, cube-face/tile key types, identity and tangent projection candidates, an area distortion sampler, face-edge tests, and a projection report before touching recursive detail."
|
||||
],
|
||||
"text_and_ui": [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
using System.Numerics;
|
||||
using Aquarium.Engine.Fractal;
|
||||
using Aquarium.Engine.Fractal.Grammar;
|
||||
using Aquarium.Engine.Fractal.Lod;
|
||||
|
||||
namespace Aquarium.Engine.Fractal.Tests;
|
||||
|
||||
public sealed class FractalSurfacePagePlannerTests
|
||||
{
|
||||
[Fact]
|
||||
public void SurfacePagePlannerBuildsStablePagesFromSelectedCut()
|
||||
{
|
||||
var domainKey = new AquariumFractalKey("domain/tile");
|
||||
var rootKey = new AquariumFractalKey("domain/tile/root");
|
||||
var domain = new AquariumFractalDomain(domainKey, AquariumFractalDomainKind.CubeSphereTile, default, Vector4.Zero, Vector4.Zero);
|
||||
var tree = FractalOwnershipTreeBuilder.BuildFlatUnion(domain, rootKey, [
|
||||
Claim("claim/a", domainKey, rootKey, Vector2.Zero, Vector2.One, amplitude: 2.0f),
|
||||
]);
|
||||
var summaries = FractalSummaryBuilder.Build(tree);
|
||||
var cut = FractalSelectedCutBuilder.Build(summaries, _ => 8.0f, maxEstimatedCost: 8.0f);
|
||||
|
||||
var pages = FractalSurfacePagePlanner.Plan(tree, summaries, cut, AquariumFractalSurfacePageKind.SignedDistance2D, 128, 128);
|
||||
|
||||
var page = Assert.Single(pages);
|
||||
Assert.Equal(domainKey, page.Key.DomainKey);
|
||||
Assert.Equal(rootKey, page.Key.NodeKey);
|
||||
Assert.Equal(AquariumFractalSurfacePageKind.SignedDistance2D, page.Key.Kind);
|
||||
Assert.Equal(128, page.Width);
|
||||
Assert.Equal(128, page.Height);
|
||||
Assert.Equal(0, page.PayloadHandle);
|
||||
Assert.Equal(2.0f, page.MaxError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SurfacePagePlannerRejectsInvalidDimensions()
|
||||
{
|
||||
var domainKey = new AquariumFractalKey("domain/tile");
|
||||
var rootKey = new AquariumFractalKey("domain/tile/root");
|
||||
var domain = new AquariumFractalDomain(domainKey, AquariumFractalDomainKind.CubeSphereTile, default, Vector4.Zero, Vector4.Zero);
|
||||
var tree = FractalOwnershipTreeBuilder.BuildFlatUnion(domain, rootKey, []);
|
||||
|
||||
var ex = Assert.Throws<ArgumentOutOfRangeException>(() => FractalSurfacePagePlanner.Plan(
|
||||
tree,
|
||||
[],
|
||||
[],
|
||||
AquariumFractalSurfacePageKind.Height,
|
||||
width: 0,
|
||||
height: 128));
|
||||
|
||||
Assert.Equal("width", ex.ParamName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SurfacePagePlannerRejectsInvalidMipEvenForEmptyCut()
|
||||
{
|
||||
var domainKey = new AquariumFractalKey("domain/tile");
|
||||
var rootKey = new AquariumFractalKey("domain/tile/root");
|
||||
var domain = new AquariumFractalDomain(domainKey, AquariumFractalDomainKind.CubeSphereTile, default, Vector4.Zero, Vector4.Zero);
|
||||
var tree = FractalOwnershipTreeBuilder.BuildFlatUnion(domain, rootKey, []);
|
||||
|
||||
var ex = Assert.Throws<ArgumentOutOfRangeException>(() => FractalSurfacePagePlanner.Plan(
|
||||
tree,
|
||||
[],
|
||||
[],
|
||||
AquariumFractalSurfacePageKind.Height,
|
||||
width: 128,
|
||||
height: 128,
|
||||
mipLevel: -1));
|
||||
|
||||
Assert.Equal("mipLevel", ex.ParamName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SurfacePagePlannerUsesKindSpecificErrorProxy()
|
||||
{
|
||||
var domainKey = new AquariumFractalKey("domain/tile");
|
||||
var rootKey = new AquariumFractalKey("domain/tile/root");
|
||||
var domain = new AquariumFractalDomain(domainKey, AquariumFractalDomainKind.CubeSphereTile, default, Vector4.Zero, Vector4.Zero);
|
||||
var tree = FractalOwnershipTreeBuilder.BuildFlatUnion(domain, rootKey, [
|
||||
Claim("claim/a", domainKey, rootKey, Vector2.Zero, Vector2.One, amplitude: 2.0f),
|
||||
]);
|
||||
var summary = new AquariumFractalSummary(
|
||||
rootKey,
|
||||
new Vector4(-1.0f, -2.0f, 3.0f, 4.0f),
|
||||
MaxHeightError: 0.25f,
|
||||
MaxMaterialDelta: 0.75f,
|
||||
EstimatedCost: 1.0f,
|
||||
DescendantCount: 0);
|
||||
var cut = new[] { new AquariumSelectedCut(rootKey, Score: 1.0f, Fade: 1.0f, UsesSummary: false, RequestedChildren: false) };
|
||||
|
||||
var height = FractalSurfacePagePlanner.Plan(tree, [summary], cut, AquariumFractalSurfacePageKind.Height, 128, 128);
|
||||
var material = FractalSurfacePagePlanner.Plan(tree, [summary], cut, AquariumFractalSurfacePageKind.Material, 128, 128);
|
||||
var confidence = FractalSurfacePagePlanner.Plan(tree, [summary], cut, AquariumFractalSurfacePageKind.Confidence, 128, 128);
|
||||
|
||||
Assert.Equal(0.25f, Assert.Single(height).MaxError);
|
||||
Assert.Equal(0.75f, Assert.Single(material).MaxError);
|
||||
Assert.Equal(0.75f, Assert.Single(confidence).MaxError);
|
||||
}
|
||||
|
||||
private static AquariumBrushClaim Claim(
|
||||
string key,
|
||||
AquariumFractalKey domainKey,
|
||||
AquariumFractalKey nodeKey,
|
||||
Vector2 center,
|
||||
Vector2 radii,
|
||||
float amplitude)
|
||||
{
|
||||
return new AquariumBrushClaim(
|
||||
new AquariumFractalKey(key),
|
||||
domainKey,
|
||||
nodeKey,
|
||||
AquariumFractalPayloadKind.Height,
|
||||
center,
|
||||
radii,
|
||||
RotationRadians: 0.0f,
|
||||
Falloff: 4.0f,
|
||||
ShapePower: 1.0f,
|
||||
Amplitude: amplitude,
|
||||
Seed: 17,
|
||||
Tags: "page");
|
||||
}
|
||||
}
|
||||
|
|
@ -53,9 +53,18 @@ public sealed class ZyphosFractalTerrainTests
|
|||
Assert.Contains("gpu cost", near.Summary, StringComparison.Ordinal);
|
||||
Assert.Contains("resident", near.Summary, StringComparison.Ordinal);
|
||||
Assert.Contains("probe candidates", near.Summary, StringComparison.Ordinal);
|
||||
Assert.Contains("surface pages", near.Summary, StringComparison.Ordinal);
|
||||
Assert.True(near.StructuralProbeReservoir.HasSample);
|
||||
Assert.True(near.StructuralProbeReservoir.CandidateCount > 0);
|
||||
Assert.True(near.StructuralProbeReservoir.WeightSum > 0.0f);
|
||||
Assert.Equal(near.SelectedCuts.Length * 4, near.SurfacePages.Length);
|
||||
Assert.Contains(near.SurfacePages, page => page.Key.Kind == AquariumFractalSurfacePageKind.SignedDistance2D);
|
||||
Assert.All(near.SurfacePages, page =>
|
||||
{
|
||||
Assert.Equal(128, page.Width);
|
||||
Assert.Equal(128, page.Height);
|
||||
Assert.Contains(near.SelectedCuts, cut => cut.NodeKey == page.Key.NodeKey);
|
||||
});
|
||||
Assert.Empty(near.ResourcePlan.Residency.RequestedNodes);
|
||||
Assert.True(MathF.Abs(near.HeightBrushes[0].Amplitude) * MathF.Max(near.HeightBrushes[0].Radius, near.HeightBrushes[0].RadiusY) >=
|
||||
MathF.Abs(near.HeightBrushes[^1].Amplitude) * MathF.Max(near.HeightBrushes[^1].Radius, near.HeightBrushes[^1].RadiusY));
|
||||
|
|
@ -74,6 +83,7 @@ public sealed class ZyphosFractalTerrainTests
|
|||
Assert.Contains("ssdRequests:", dump, StringComparison.Ordinal);
|
||||
Assert.Contains("structuralProbe:", dump, StringComparison.Ordinal);
|
||||
Assert.Contains("structuralProbeWeight:", dump, StringComparison.Ordinal);
|
||||
Assert.Contains("surfacePages:", dump, StringComparison.Ordinal);
|
||||
Assert.Contains("selected:", dump, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue