Fix debug drawing of edited data blocks showing non-edited data blocks

master
Marc Gilleron 2022-07-23 00:05:13 +01:00
parent 01328fb905
commit 1c8ecc1b89
2 changed files with 8 additions and 4 deletions

View File

@ -109,6 +109,7 @@ public:
int get_block_count() const;
// op(Vector3i bpos, VoxelDataBlock &block)
template <typename Op_T>
inline void for_each_block(Op_T op) {
for (auto it = _blocks_map.begin(); it != _blocks_map.end(); ++it) {
@ -116,6 +117,7 @@ public:
}
}
// op(Vector3i bpos, const VoxelDataBlock &block)
template <typename Op_T>
inline void for_each_block(Op_T op) const {
for (auto it = _blocks_map.begin(); it != _blocks_map.end(); ++it) {

View File

@ -2457,10 +2457,12 @@ void VoxelLodTerrain::update_gizmos() {
RWLockRead rlock(data_lod.map_lock);
data_lod.map.for_each_block(
[&dr, parent_transform, data_block_size, basis](const Vector3i &bpos, const VoxelDataBlock &block) {
const Transform3D local_transform(basis, bpos * data_block_size);
const Transform3D t = parent_transform * local_transform;
const Color8 c = Color8(block.is_modified() ? 255 : 0, 255, 0, 255);
dr.draw_box_mm(t, c);
if (block.is_edited()) {
const Transform3D local_transform(basis, bpos * data_block_size);
const Transform3D t = parent_transform * local_transform;
const Color8 c = block.is_modified() ? Color8(255, 255, 0, 255) : Color8(0, 255, 0, 255);
dr.draw_box_mm(t, c);
}
});
}