1
0
Fork 0
Univerxel/src/client/contouring/Abstract.hpp

47 lines
2.1 KiB
C++

#pragma once
#include "../../core/world/forward.h"
#include "../../core/geometry/Frustum.hpp"
#include "../../core/geometry/Ray.hpp"
#include "../../core/geometry/Faces.hpp"
namespace render { class LodModel; }
/// Mesh creation (from world to render)
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
virtual void update(const voxel_pos &pos, const world::client::area_map &areas) = 0;
/// Chunk data change
/// @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;
/// Chunk existante ping
/// @note notify for chunks entering view while moving
virtual void onNotify(const area_<chunk_pos> &pos, const chunk_pos &offset, const world::ChunkContainer &data) = 0;
/// Display ImGui config
virtual void onGui() = 0;
/// Get options
virtual std::string getOptions() const = 0;
/// Get camera recommended far range
virtual std::pair<float, float> getFarRange() const = 0;
/// Get pending elements
virtual size_t getQueueSize() = 0;
using area_info = std::tuple<area_pos, voxel_pos::value_type, float>;
using draw_call = const std::function<void(glm::mat4, render::LodModel *const, const area_info&, const voxel_pos&)> &;
/// Get buffers in frustum with model matrices
/// @note buffers invalidated after update
virtual void getModels(draw_call draw, const std::optional<geometry::Frustum>& frustum, const glm::llvec3& offset, int density, bool solid) = 0;
/// Get buffers hitting occlusion rays with model matrices
/// @note buffers invalidated after update
virtual void getModels(draw_call draw, const glm::ifvec3 &from, float far, const std::vector<glm::vec3> &occlusion, const glm::llvec3 &offset, int density, bool solid) = 0;
};
}