wip(assembler): round S1 -- one Core voxel-size source; per-tile feature lists (islands)
AVoxelWorld::CoreVoxelSizeCm (default 25, 32 voxels/tile) flows through plan, field, mesher, content, water, atmosphere, edits and collision. Staged-owner BuildHost passes at 20 cm (SurfaceWorld + islands, W1/W8/W16, anchors, BP edits, collision) with a fixed-25cm negative control; default-size hashes match round 4; Core off stays legacy 12.5 cm. Reusable BuildWorldAssemblyFeatureTileListV1; wired into FloatingIslands only so far. 256-island stress: tile p95 112.5 -> 2.0 ms, 0 mismatches, dropped-feature control fails. Content placement measured (no populated cells): island ground search 7.25 ms/cell vs legacy 0.29 ms -- open. Outside-review evaluation in Round5/REPORT.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
1 parent
111cf3d262
commit
d6e69420e8
25 files changed
+2136
-250
No files matched your search
@@ -11,9 +11,47 @@
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace VoxelForgeCore
|
||||
{
|
||||
std::vector<std::uint32_t> BuildWorldAssemblyFeatureTileListV1(
|
||||
std::span<const WorldAssemblyFeatureBoundsV1> features,
|
||||
const std::array<std::int64_t, 3>& tileMinimumSubvoxels,
|
||||
const std::array<std::int64_t, 3>& tileMaximumSubvoxels)
|
||||
{
|
||||
if (features.size() > std::numeric_limits<std::uint32_t>::max())
|
||||
throw std::length_error("world-assembly feature list exceeds 32-bit indexing");
|
||||
|
||||
const auto allFeatures = [&]()
|
||||
{
|
||||
std::vector<std::uint32_t> result;
|
||||
result.reserve(features.size());
|
||||
for (std::size_t index = 0; index < features.size(); ++index)
|
||||
result.push_back(static_cast<std::uint32_t>(index));
|
||||
return result;
|
||||
};
|
||||
for (std::size_t axis = 0; axis < 3; ++axis)
|
||||
if (tileMinimumSubvoxels[axis] > tileMaximumSubvoxels[axis]) return allFeatures();
|
||||
for (const auto& feature : features)
|
||||
for (std::size_t axis = 0; axis < 3; ++axis)
|
||||
if (feature.minimumSubvoxels[axis] > feature.maximumSubvoxels[axis]) return allFeatures();
|
||||
|
||||
std::vector<std::uint32_t> result;
|
||||
result.reserve(features.size());
|
||||
for (std::size_t index = 0; index < features.size(); ++index)
|
||||
{
|
||||
const auto& feature = features[index];
|
||||
bool intersects = true;
|
||||
for (std::size_t axis = 0; axis < 3; ++axis)
|
||||
intersects = intersects
|
||||
&& feature.minimumSubvoxels[axis] <= tileMaximumSubvoxels[axis]
|
||||
&& feature.maximumSubvoxels[axis] >= tileMinimumSubvoxels[axis];
|
||||
if (intersects) result.push_back(static_cast<std::uint32_t>(index));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
namespace world_assembly_detail
|
||||
{
|
||||
constexpr std::int64_t Q16 = 1ll << 16;
|
||||
@@ -1514,14 +1552,20 @@ bool WorldAssemblyManifest::finalize(std::string& error)
|
||||
if (!islands.manifest.validate(error)) return false;
|
||||
if (islands.manifest.recipe.seed != recipe.seed)
|
||||
{ error = "floating-island seed does not match the world assembly season seed"; return false; }
|
||||
constexpr std::int64_t CoreVoxelsPerLegacyChunk = 16;
|
||||
const std::int64_t bottomQ = static_cast<std::int64_t>(islands.bottomChunkZ)
|
||||
* CoreVoxelsPerLegacyChunk * WorldAssemblySubvoxelsPerVoxel;
|
||||
const std::int64_t topQ = (static_cast<std::int64_t>(islands.topChunkZ) + 1)
|
||||
* CoreVoxelsPerLegacyChunk * WorldAssemblySubvoxelsPerVoxel;
|
||||
const auto& Scale = islands.manifest.recipe;
|
||||
if (Scale.ownerToCoreScaleNumerator == 0 || Scale.ownerToCoreScaleDenominator == 0)
|
||||
{ error = "floating-island owner-to-Core scale is invalid"; return false; }
|
||||
const double CoreVoxelsPerOwnerChunk = static_cast<double>(CoreTileVoxelCount)
|
||||
* Scale.ownerToCoreScaleNumerator / Scale.ownerToCoreScaleDenominator;
|
||||
const std::int64_t bottomQ = static_cast<std::int64_t>(std::llround(
|
||||
static_cast<double>(islands.bottomChunkZ) * CoreVoxelsPerOwnerChunk
|
||||
* WorldAssemblySubvoxelsPerVoxel));
|
||||
const std::int64_t topQ = static_cast<std::int64_t>(std::llround(
|
||||
static_cast<double>(static_cast<std::int64_t>(islands.topChunkZ) + 1)
|
||||
* CoreVoxelsPerOwnerChunk * WorldAssemblySubvoxelsPerVoxel));
|
||||
if (islands.manifest.recipe.layoutMinimumZSubvoxels < bottomQ
|
||||
|| islands.manifest.recipe.layoutMaximumZSubvoxels > topQ)
|
||||
{ error = "floating-island recipe layout escapes the resolved 12.5 cm legacy strate bounds"; return false; }
|
||||
{ error = "floating-island recipe layout escapes the resolved owner strate bounds"; return false; }
|
||||
islandStrateIds.push_back(islands.strateIndex);
|
||||
}
|
||||
recipe.contentHash = world_assembly_detail::HashRecipe(recipe);
|
||||
|
||||
Reference in new issue
Block a user