mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-11-11 20:35:08 +01:00
Fixed VoxelMap.get_buffer_copy() introducing voxels in channel 0 even if they don't exist
This commit is contained in:
parent
8c6defee09
commit
c86a5c53e1
@ -120,6 +120,7 @@ void VoxelMap::get_buffer_copy(Vector3i min_pos, VoxelBuffer &dst_buffer, unsign
|
|||||||
|
|
||||||
Vector3i min_block_pos = voxel_to_block(min_pos);
|
Vector3i min_block_pos = voxel_to_block(min_pos);
|
||||||
Vector3i max_block_pos = voxel_to_block(max_pos - Vector3i(1, 1, 1)) + Vector3i(1, 1, 1);
|
Vector3i max_block_pos = voxel_to_block(max_pos - Vector3i(1, 1, 1)) + Vector3i(1, 1, 1);
|
||||||
|
// TODO Why is this function limited by this check?
|
||||||
ERR_FAIL_COND((max_block_pos - min_block_pos) != Vector3i(3, 3, 3));
|
ERR_FAIL_COND((max_block_pos - min_block_pos) != Vector3i(3, 3, 3));
|
||||||
|
|
||||||
const Vector3i block_size_v(_block_size, _block_size, _block_size);
|
const Vector3i block_size_v(_block_size, _block_size, _block_size);
|
||||||
@ -148,7 +149,8 @@ void VoxelMap::get_buffer_copy(Vector3i min_pos, VoxelBuffer &dst_buffer, unsign
|
|||||||
dst_buffer.fill_area(
|
dst_buffer.fill_area(
|
||||||
_default_voxel[channel],
|
_default_voxel[channel],
|
||||||
offset - min_pos,
|
offset - min_pos,
|
||||||
offset - min_pos + block_size_v);
|
offset - min_pos + block_size_v,
|
||||||
|
channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user