feat: wire SurfaceWorld (biome-less) + fix a column-memo perf trap
All six checks green, 9399 samples inside the overhang window. The single-entry column memo was correct only if the caller walks a Z column before changing XY, which the mesher does not promise. Iterating X first within a Z slice would miss on every voxel and re-run the whole height stack per voxel, cliff resamples included — an order of magnitude on the plugin's most expensive archetype. The tests could not have caught it: they sample random XY, where a one-entry memo and a 256-entry one behave identically. Only reading the access pattern finds this. Replaced with a direct-mapped 256-entry thread_local table hashed on the XY bit patterns, full key compared on hit, so a collision costs a recompute and never returns the wrong column. Wiring: UsesOperatorStackForChunk returns true for SurfaceWorld only when the strate has no biomes. The original blends heights toward the neighbouring biome across the border band; the stack evaluates one param set, so a biome strate would get a hard seam at every border rather than a subtle shift. The guard sits beside the archetype list so "can this strate take the stack?" stays one question in one place, and GetDensityAt keeps a defensive CP_BiomeCtx check that falls back if the two disagree. UNVERIFIED: not compiled. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4dc55b1af3
commit
f7ed9407bf
4 files changed
+107
-6
No files matched your search
@@ -578,6 +578,26 @@ float UVoxelGenerator::GetDensityAt(float WorldX, float WorldY, float WorldZ) co
|
||||
VoxelDensityOps::BuildSlabStack(CP_OpStack, CP_Slab, Seed,
|
||||
OriginSpineRadius, StrateManager);
|
||||
break;
|
||||
|
||||
case ECaveGeneratorType::SurfaceWorld:
|
||||
// Même garde dégénérée que les autres, et une SECONDE garde : la pile ne sait
|
||||
// pas encore mélanger les biomes. `UsesOperatorStackForChunk` refuse déjà les
|
||||
// strates à biomes, mais un `CP_BiomeCtx` valide ici voudrait dire que les deux
|
||||
// sources d'information se contredisent — auquel cas on retombe sur le `switch`,
|
||||
// parce qu'un monde non porté est récupérable et un monde faux ne l'est pas.
|
||||
// A valid biome context here would mean the two sources of truth disagree; fall
|
||||
// back rather than generate a world with seams at every biome border.
|
||||
if (CP_Surface.StrateTopWorldZ - CP_Surface.StrateBottomWorldZ <= 0.0f
|
||||
|| CP_BiomeCtx.IsValid())
|
||||
{
|
||||
CP_UseOpStack = false;
|
||||
break;
|
||||
}
|
||||
OpCtx.StrateTopWorldZ = CP_Surface.StrateTopWorldZ;
|
||||
OpCtx.StrateBottomWorldZ = CP_Surface.StrateBottomWorldZ;
|
||||
VoxelDensityOps::BuildSurfaceStack(CP_OpStack, CP_Surface, Seed,
|
||||
OriginSpineRadius, StrateManager);
|
||||
break;
|
||||
default:
|
||||
// UsesOperatorStackForChunk ne rend true que pour les archétypes portés, donc
|
||||
// on ne devrait jamais arriver ici. Si ça arrive, retomber sur le `switch`
|
||||
|
||||
Reference in new issue
Block a user