diff options
Diffstat (limited to 'src/client/world/block.hh')
| -rw-r--r-- | src/client/world/block.hh | 53 |
1 files changed, 53 insertions, 0 deletions
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 <algorithm> +#include <array> +#include <vector> + +#include <glm/glm.hpp> +#include <glm/gtc/matrix_access.hpp> +#include <glm/gtc/matrix_transform.hpp> + +#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<glvert, 6>; // array of verts (a face) + using glfaces_t = std::vector<glface_t>; // 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 <typename... Args> + block(Args&&... args) noexcept : block(std::forward<Args>(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 |
