#ifndef VOXEL_MESH_UPDATER_H #define VOXEL_MESH_UPDATER_H #include #include #include #include "../meshers/blocky/voxel_mesher_blocky.h" #include "../meshers/dmc/voxel_mesher_dmc.h" #include "../voxel_buffer.h" #include "block_thread_manager.h" class VoxelMeshUpdater { public: struct InputBlockData { Ref voxels; }; struct OutputBlockData { VoxelMesher::Output blocky_surfaces; VoxelMesher::Output smooth_surfaces; }; struct Processor { void process_block(const InputBlockData &input, OutputBlockData &output, Vector3i block_position, unsigned int lod); int get_required_padding(); Ref blocky_mesher; Ref smooth_mesher; }; struct MeshingParams { Ref library; bool baked_ao = true; float baked_ao_darkness = 0.75; bool smooth_surface = false; }; typedef VoxelBlockThreadManager Mgr; typedef Mgr::InputBlock InputBlock; typedef Mgr::OutputBlock OutputBlock; typedef Mgr::Input Input; typedef Mgr::Output Output; typedef Mgr::Stats Stats; VoxelMeshUpdater(unsigned int thread_count, MeshingParams params); ~VoxelMeshUpdater(); void push(const Input &input) { _mgr->push(input); } void pop(Output &output) { _mgr->pop(output); } int get_required_padding() const { return _required_padding; } private: Mgr *_mgr = nullptr; int _required_padding = 0; }; #endif // VOXEL_MESH_UPDATER_H