From e4483eca01b48b943cd0461e24a74ae1a3139ed4 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 12 Feb 2025 21:57:46 +1100 Subject: Update to most recent version (old initial commit) --- src/client/world/block.hh | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/client/world/block.hh (limited to 'src/client/world/block.hh') diff --git a/src/client/world/block.hh b/src/client/world/block.hh new file mode 100644 index 0000000..9dfe303 --- /dev/null +++ b/src/client/world/block.hh @@ -0,0 +1,53 @@ +#ifndef CLIENT_WORLD_BLOCK_HH_ +#define CLIENT_WORLD_BLOCK_HH_ + +#include +#include +#include + +#include +#include +#include + +#include "shared/world/block.hh" + +namespace client { +namespace world { + +// Doesn't add any data, just information for rendering. +class block : public shared::world::block { +public: + struct glvert { + glm::vec3 vertice; + glm::vec3 texture; + }; + using glface_t = std::array; // array of verts (a face) + using glfaces_t = std::vector; // vector of faces (a block) + + // Render types refer to how the block should be culled when making the vbo. + enum class draw_type { + block, // face testing + custom, // no testing + }; + +public: + static enum draw_type get_draw_type(const enum block::type& type) noexcept; + static const glfaces_t& get_glfaces(const enum block::type& type) noexcept; + +public: + template + block(Args&&... args) noexcept : block(std::forward(args)...) {} + +public: + enum draw_type get_draw_type() const noexcept { + return get_draw_type(this->type); + } + const glfaces_t& get_glfaces() const noexcept { + return get_glfaces(this->type); + } +}; + +} // namespace world +} // namespace client + +#endif -- cgit v1.2.3