Decrease MAX_LOD to avoid potential integer overflows
I preferred doing this instead of using 64-bit integers, because I tink there are no use cases for LOD blocks that big
This commit is contained in:
parent
59a7c3192e
commit
325406ede1
@ -14,7 +14,12 @@ static const unsigned int MAX_BLOCK_SIZE = 32;
|
||||
|
||||
static const unsigned int MAX_BLOCK_COUNT_PER_REQUEST = 4 * 4 * 4;
|
||||
|
||||
static const unsigned int MAX_LOD = 32;
|
||||
// 24 should be largely enough.
|
||||
// With a block size of 32 voxels, and if 1 voxel is 1m large,
|
||||
// then the largest blocks will span 268,435.456 kilometers, which is roughly 20 times Earth's diameter.
|
||||
// Using a higher maximum can cause int32 overflows when calculating dimensions. There is no use case for it.
|
||||
static const unsigned int MAX_LOD = 24;
|
||||
|
||||
static const unsigned int MAX_VOLUME_EXTENT = 0x1fffffff;
|
||||
static const unsigned int MAX_VOLUME_SIZE = 2 * MAX_VOLUME_EXTENT; // 1,073,741,822 voxels
|
||||
|
||||
|
@ -40,6 +40,7 @@ Ongoing development - `master`
|
||||
- `VoxelInstanceGenerator`: `EMIT_FROM_FACES` got renamed `EMIT_FROM_FACES_FAST`. `EMIT_FROM_FACES` still exists but is a different algorithm.
|
||||
- `VoxelServer`: `get_stats()` format has changed, check documentation
|
||||
- `VoxelLodTerrain`: `get_statistics()` format has changed: `time_process_update_responses` and `remaining_main_thread_blocks` are no longer available
|
||||
- `VoxelLodTerrain`: Maximum LOD count was decreased to 24, which is still largely enough. Higher maximums were likely to cause integer overflows.
|
||||
- `VoxelTerrain`: `get_statistics()` format has changed: `time_process_update_responses` and `remaining_main_thread_blocks` are no longer available
|
||||
- `VoxelViewer`: `requires_collisions` is now `true` by default
|
||||
|
||||
|
@ -356,6 +356,7 @@ void VoxelLodTerrain::_on_stream_params_changed() {
|
||||
}*/
|
||||
|
||||
void VoxelLodTerrain::set_mesh_block_size(unsigned int mesh_block_size) {
|
||||
// Mesh block size cannot be smaller than data block size, for now
|
||||
mesh_block_size = clamp(mesh_block_size, get_data_block_size(), VoxelConstants::MAX_BLOCK_SIZE);
|
||||
|
||||
unsigned int po2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user