godot_voxel/server/load_block_data_task.h
Marc Gilleron 320cc7422c Rename tasks:
- As verbs for the task they do
- Suffixed with Task instead of Request,
  to avoid confusion with network stuff
2022-02-06 13:45:51 +00:00

45 lines
1.2 KiB
C++

#ifndef LOAD_BLOCK_DATA_TASK_H
#define LOAD_BLOCK_DATA_TASK_H
#include "../util/tasks/threaded_task.h"
#include "priority_dependency.h"
#include "streaming_dependency.h"
namespace zylann::voxel {
class LoadBlockDataTask : public IThreadedTask {
public:
LoadBlockDataTask(uint32_t p_volume_id, Vector3i p_block_pos, uint8_t p_lod, uint8_t p_block_size,
bool p_request_instances, std::shared_ptr<StreamingDependency> p_stream_dependency,
PriorityDependency p_priority_dependency);
~LoadBlockDataTask();
void run(ThreadedTaskContext ctx) override;
int get_priority() override;
bool is_cancelled() override;
void apply_result() override;
static int debug_get_running_count();
private:
PriorityDependency _priority_dependency;
std::shared_ptr<VoxelBufferInternal> _voxels;
std::unique_ptr<InstanceBlockData> _instances;
Vector3i _position; // In data blocks of the specified lod
uint32_t _volume_id;
uint8_t _lod;
uint8_t _block_size;
bool _has_run = false;
bool _too_far = false;
bool _request_instances = false;
bool _request_voxels = false;
bool _max_lod_hint = false;
bool _fallback_on_generator = false;
std::shared_ptr<StreamingDependency> _stream_dependency;
};
} // namespace zylann::voxel
#endif // LOAD_BLOCK_DATA_TASK_H