67 lines
2.6 KiB
C++
67 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include "Abstract.hpp"
|
|
#include "surrounding.hpp"
|
|
|
|
#include "../../core/data/safe_queue.hpp"
|
|
#include "../../core/data/safe_priority_queue.hpp"
|
|
#include "../render/gl/buffer/LodShortIndexed.hpp"
|
|
#include "../../core/data/math.hpp"
|
|
#include <thread>
|
|
|
|
using namespace data;
|
|
namespace contouring {
|
|
/// Dual Marching Cube 1:1 contouring
|
|
class FlatDualMC: public Abstract {
|
|
public:
|
|
FlatDualMC(const std::string&);
|
|
virtual ~FlatDualMC();
|
|
|
|
void update(const voxel_pos&, const world::client::area_map&) override;
|
|
|
|
void onGui() override;
|
|
|
|
std::string getOptions() const override;
|
|
std::pair<float, float> getFarRange() const override;
|
|
size_t getQueueSize() override;
|
|
|
|
/// Chunk data change
|
|
void onUpdate(const area_<chunk_pos> &, const chunk_pos &, const world::ChunkContainer &, geometry::Faces) override;
|
|
/// Chunk existante ping
|
|
/// @note notify for chunks entering view while moving
|
|
void onNotify(const area_<chunk_pos> &, const chunk_pos &, const world::ChunkContainer &) override;
|
|
|
|
/// Get buffers in frustum with model matrices
|
|
/// @note buffers invalidated after update
|
|
void getModels(draw_call draw, const std::optional<geometry::Frustum> &frustum, const glm::llvec3 &offset, int density) override;
|
|
/// Get buffers hitting occlusion rays with model matrices
|
|
/// @note buffers invalidated after update
|
|
void getModels(draw_call draw, const glm::ifvec3 &from, float far, const std::vector<glm::vec3> &occlusion, const glm::llvec3 &offset, int density) override;
|
|
|
|
protected:
|
|
robin_hood::unordered_map<area_id, robin_hood::pair<area_info, robin_hood::unordered_map<chunk_pos, buffer::Abstract *>>> buffers;
|
|
|
|
safe_priority_queue_map<area_<chunk_pos>, surrounding::corners, int, area_hash> loadQueue;
|
|
safe_queue<std::pair<area_<chunk_pos>, buffer::LodShortIndexed::LodData>> loadedQueue;
|
|
|
|
bool running = true;
|
|
std::vector<std::thread> workers;
|
|
|
|
void enqueue(const area_<chunk_pos> &, const chunk_pos &offset, const world::ChunkContainer &);
|
|
|
|
ushort loadDistance = 3;
|
|
ushort keepDistance = 4;
|
|
bool transparency = false;
|
|
float iso = .1f;
|
|
bool manifold = true;
|
|
bool reordering = true;
|
|
float lod_strength = .15;
|
|
float lod_quality = 0;
|
|
std::deque<bool> lod_levels;
|
|
|
|
std::vector<std::pair<float, float>> loadedLevels;
|
|
|
|
void render(const surrounding::corners &surrounding, buffer::LodShortIndexed::LodData& out, std::vector<buffer::VertexData>& tmp) const;
|
|
};
|
|
}
|