Skip to content

Commit

Permalink
Fixed missing chasm walls on chunk edges.
Browse files Browse the repository at this point in the history
Needed to mark added/changed/removed chasm wall instances as dirty.
  • Loading branch information
afritz1 committed Jul 28, 2024
1 parent 45ad6fc commit a21854e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions OpenTESArena/src/Voxels/VoxelChunkManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,25 @@ void VoxelChunkManager::updateChasmWallInst(VoxelChunk &chunk, SNInt x, int y, W
// The instance is still needed. Update its chasm walls.
BufferView<VoxelChasmWallInstance> chasmWallInsts = chunk.getChasmWallInsts();
VoxelChasmWallInstance &chasmWallInst = chasmWallInsts[chasmInstIndex];

const bool shouldDirtyChasmWallInst = (chasmWallInst.north != hasNorthFace) || (chasmWallInst.east != hasEastFace) ||
(chasmWallInst.south != hasSouthFace) || (chasmWallInst.west != hasWestFace);

chasmWallInst.north = hasNorthFace;
chasmWallInst.east = hasEastFace;
chasmWallInst.south = hasSouthFace;
chasmWallInst.west = hasWestFace;

if (shouldDirtyChasmWallInst)
{
chunk.addDirtyChasmWallInstPosition(voxel);
}
}
else
{
// The chasm wall instance no longer has any interesting data.
chunk.removeChasmWallInst(voxel);
chunk.addDirtyChasmWallInstPosition(voxel);
}
}
else
Expand All @@ -642,6 +652,7 @@ void VoxelChunkManager::updateChasmWallInst(VoxelChunk &chunk, SNInt x, int y, W
VoxelChasmWallInstance chasmWallInst;
chasmWallInst.init(x, y, z, hasNorthFace, hasEastFace, hasSouthFace, hasWestFace);
chunk.addChasmWallInst(std::move(chasmWallInst));
chunk.addDirtyChasmWallInstPosition(voxel);
}
}
}
Expand Down

0 comments on commit a21854e

Please sign in to comment.