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 NullShape DEFAULT_SHAPE;
37 std::vector<glm::vec3> &vertices,
38 std::vector<glm::vec3> &colors,
39 std::vector<glm::vec3> &normals
42 void FillModel(const glm::vec3 &pos, Model &m) const {
43 FillVBO(pos, m.vertices, m.colors, m.normals);
49 std::vector<glm::vec3> &vertices,
50 std::vector<glm::vec3> &colors
53 void FillOutlineModel(OutlineModel &m) const {
54 FillOutlineVBO(m.vertices, m.colors);
61 class BlockTypeRegistry {
67 int Add(const BlockType &);
69 size_t Size() const { return types.size(); }
71 BlockType *operator [](int id) { return &types[id]; }
72 const BlockType *Get(int id) const { return &types[id]; }
75 std::vector<BlockType> types;
83 using Pos = glm::vec3;
87 constexpr explicit Block(int type = 0)