Terrain: stream the 3x3 blocks around the player
CMapOutdoor keeps the 3x3 terrain blocks around the player loaded and reloads them on a block change; we loaded only the warp block, so the map ended at its edge. Stitch the set into one TerrainHeightmap, fix the attr.atr cell mapping, and reload terrain, areadata and water per block from CPythonBackground::Update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
29f33b289a
commit
47e867252f
@@ -1232,9 +1232,11 @@ int main(int argc, char** argv) {
|
||||
|
||||
if (block_gx >= 0) {
|
||||
std::cout << "Found ATTR_BLOCK boundary at grid (" << block_gx << ", " << block_gy << ")" << std::endl;
|
||||
float b_world_x = pr_terrain.GetWorldMinX() + (static_cast<float>(block_gx) / (pr_terrain.GetAttrWidth() - 1)) * (pr_terrain.GetWorldMaxX() - pr_terrain.GetWorldMinX());
|
||||
float b_world_z = pr_terrain.GetWorldMinZ() + (static_cast<float>(block_gy) / (pr_terrain.GetAttrHeight() - 1)) * (pr_terrain.GetWorldMaxZ() - pr_terrain.GetWorldMinZ());
|
||||
float walk_z = pr_terrain.GetWorldMinZ() + (static_cast<float>(block_gy - 1) / (pr_terrain.GetAttrHeight() - 1)) * (pr_terrain.GetWorldMaxZ() - pr_terrain.GetWorldMinZ());
|
||||
// attr.atr cells are half a height cell, starting at the block origin one height cell in.
|
||||
const float attr_cell = pr_terrain.GetCellScale() * 0.5f;
|
||||
float b_world_x = pr_terrain.GetWorldMinX() + pr_terrain.GetCellScale() + (static_cast<float>(block_gx) + 0.5f) * attr_cell;
|
||||
float b_world_z = pr_terrain.GetWorldMinZ() + pr_terrain.GetCellScale() + (static_cast<float>(block_gy) + 0.5f) * attr_cell;
|
||||
float walk_z = pr_terrain.GetWorldMinZ() + pr_terrain.GetCellScale() + (static_cast<float>(block_gy - 1) + 0.5f) * attr_cell;
|
||||
assert(pr_terrain.IsAttrOn(b_world_x, b_world_z, ava2::TerrainAttr::ATTR_BLOCK));
|
||||
assert(!pr_terrain.IsAttrOn(b_world_x, walk_z, ava2::TerrainAttr::ATTR_BLOCK));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user