1 #ifndef BLANK_BLOCK_HPP_
2 #define BLANK_BLOCK_HPP_
4 #include "geometry.hpp"
14 /// attributes of a type of block
23 glm::vec3 outline_color;
27 const glm::vec3 &color = { 1, 1, 1 },
28 const Shape *shape = &DEFAULT_SHAPE,
29 const glm::vec3 &outline_color = { -1, -1, -1 })
30 : id(-1), visible(v), shape(shape), color(color), outline_color(outline_color) { }
32 static const BlockType DEFAULT;
33 static const NullShape DEFAULT_SHAPE;
38 std::vector<glm::vec3> &vertices,
39 std::vector<glm::vec3> &colors,
40 std::vector<glm::vec3> &normals
43 void FillModel(const glm::vec3 &pos, Model &m) const {
44 FillVBO(pos, m.vertices, m.colors, m.normals);
50 std::vector<glm::vec3> &vertices,
51 std::vector<glm::vec3> &colors
54 void FillOutlineModel(OutlineModel &m) const {
55 FillOutlineVBO(m.vertices, m.colors);
62 class BlockTypeRegistry {
68 int Add(const BlockType &);
70 size_t Size() const { return types.size(); }
72 BlockType *operator [](int id) { return &types[id]; }
73 const BlockType *Get(int id) const { return &types[id]; }
76 std::vector<BlockType> types;
84 using Pos = glm::vec3;
86 const BlockType *type;
88 constexpr explicit Block(const BlockType *t = &BlockType::DEFAULT)