2020-07-18 15:42:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-25 16:45:03 +00:00
|
|
|
#include "../render/buffer/Abstract.hpp"
|
2020-07-18 15:42:45 +00:00
|
|
|
#include "../data/geometry/Frustum.hpp"
|
2020-07-22 20:55:13 +00:00
|
|
|
#include "../data/geometry/Faces.hpp"
|
2020-07-31 17:09:44 +00:00
|
|
|
#include "../world/forward.h"
|
2020-07-18 15:42:45 +00:00
|
|
|
|
2020-07-25 16:45:03 +00:00
|
|
|
/// Mesh creation
|
2020-07-18 15:42:45 +00:00
|
|
|
namespace contouring {
|
|
|
|
/// Generating mesh from world data
|
|
|
|
class Abstract {
|
|
|
|
public:
|
|
|
|
Abstract() { }
|
|
|
|
virtual ~Abstract() { }
|
|
|
|
|
|
|
|
/// Each frame ping.
|
|
|
|
/// Mostly used for cleanup and to flush buffers data using main thread
|
2020-08-02 20:15:53 +00:00
|
|
|
virtual void update(const voxel_pos &pos, const world::area_map &areas) = 0;
|
2020-07-18 15:42:45 +00:00
|
|
|
|
|
|
|
/// Chunk data change
|
2020-08-03 16:15:02 +00:00
|
|
|
/// @param offset priority position offset
|
|
|
|
virtual void onUpdate(const area_<chunk_pos> &pos, const chunk_pos &offset, const world::ChunkContainer &data, geometry::Faces neighbors) = 0;
|
2020-07-18 15:42:45 +00:00
|
|
|
/// Chunk existante ping
|
|
|
|
/// @note notify for chunks entering view while moving
|
2020-08-03 16:15:02 +00:00
|
|
|
virtual void onNotify(const area_<chunk_pos> &pos, const chunk_pos &offset, const world::ChunkContainer &data) = 0;
|
2020-07-18 15:42:45 +00:00
|
|
|
/// Display ImGui config
|
|
|
|
virtual void onGui() = 0;
|
2020-07-22 20:55:13 +00:00
|
|
|
/// Get options
|
2020-08-05 13:14:57 +00:00
|
|
|
virtual std::string getOptions() const = 0;
|
|
|
|
// Get camera recommended far range
|
|
|
|
virtual std::pair<float, float> getFarRange() const = 0;
|
2020-07-18 15:42:45 +00:00
|
|
|
|
|
|
|
/// Get buffers in frustum with model matrices
|
|
|
|
/// @note buffers invalidated after update
|
2020-08-01 21:31:01 +00:00
|
|
|
virtual void getModels(std::vector<std::pair<glm::mat4, buffer::Abstract *const>> &buffers, const std::optional<geometry::Frustum>& frustum, const glm::llvec3& offset, int density) = 0;
|
2020-07-18 15:42:45 +00:00
|
|
|
};
|
|
|
|
}
|