Re-enabled request dropping through exclusive region, except for last lod

This commit is contained in:
Marc Gilleron 2019-08-30 01:08:06 +01:00
parent 6a540a8720
commit 8574655c18
2 changed files with 9 additions and 11 deletions

View File

@ -51,6 +51,7 @@ public:
Vector3i priority_position; // In LOD0 block coordinates
Vector3 priority_direction; // Where the viewer is looking at
int exclusive_region_extent = 0; // Region beyond which the processor is allowed to discard requests
int exclusive_region_max_lod = MAX_LOD; // LOD beyond which exclusive region won't be used
bool use_exclusive_region = false;
int max_lod_index = 0;
@ -230,6 +231,7 @@ public:
if (input.use_exclusive_region) {
job.shared_input.use_exclusive_region = true;
job.shared_input.exclusive_region_extent = input.exclusive_region_extent;
job.shared_input.exclusive_region_max_lod = input.exclusive_region_max_lod;
}
bool should_run = !job.shared_input.is_empty();
@ -511,6 +513,7 @@ private:
if (data.shared_input.use_exclusive_region) {
data.input.use_exclusive_region = true;
data.input.exclusive_region_extent = data.shared_input.exclusive_region_extent;
data.input.exclusive_region_max_lod = data.shared_input.exclusive_region_max_lod;
}
data.shared_input.blocks.clear();
@ -546,7 +549,7 @@ private:
for (unsigned int i = 0; i < data.input.blocks.size(); ++i) {
const InputBlock &ib = data.input.blocks[i];
if (!ib.can_be_discarded) {
if (!ib.can_be_discarded || ib.lod >= data.input.exclusive_region_max_lod) {
continue;
}

View File

@ -852,11 +852,9 @@ void VoxelLodTerrain::_process() {
VoxelDataLoader::Input input;
input.priority_position = viewer_block_pos;
input.priority_direction = viewer_direction;
// TODO Temporarily turned off, need to fix it because beyond a given LOD, it needs to be different!
//input.use_exclusive_region = true;
input.use_exclusive_region = false;
input.use_exclusive_region = true;
// The last LOD may spread until end of view distance, it should not be discarded
input.exclusive_region_max_lod = get_lod_count() - 1;
input.exclusive_region_extent = get_block_region_extent();
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {
@ -946,11 +944,8 @@ void VoxelLodTerrain::_process() {
VoxelMeshUpdater::Input input;
input.priority_position = viewer_block_pos;
input.priority_direction = viewer_direction;
// TODO Temporarily turned off, need to fix it because beyond a given LOD, it needs to be different!
//input.use_exclusive_region = true;
input.use_exclusive_region = false;
input.use_exclusive_region = true;
input.exclusive_region_max_lod = get_lod_count() - 1;
input.exclusive_region_extent = get_block_region_extent();
for (unsigned int lod_index = 0; lod_index < get_lod_count(); ++lod_index) {