1 #ifndef BLANK_BLOCK_HPP_
2 #define BLANK_BLOCK_HPP_
4 #include "geometry.hpp"
17 using Type = unsigned short;
18 using Pos = glm::vec3;
40 constexpr explicit Block(Type type = 0, Direction dir = DIR_UP, Rotation rot = ROT_NONE)
41 : type(type), orient(dir * ROT_COUNT + rot) { }
43 const glm::mat4 &Transform() const;
48 /// attributes of a type of block
53 glm::vec3 outline_color;
70 const glm::vec3 &color = { 1, 1, 1 },
71 const Shape *shape = &DEFAULT_SHAPE
74 static const NullShape DEFAULT_SHAPE;
79 const glm::mat4 &transform = glm::mat4(1.0f),
80 Model::Index idx_offset = 0
82 void FillOutlineModel(
84 const glm::vec3 &pos_offset = { 0, 0, 0 },
85 OutlineModel::Index idx_offset = 0
91 class BlockTypeRegistry {
97 Block::Type Add(const BlockType &);
99 size_t Size() const { return types.size(); }
101 BlockType *operator [](Block::Type id) { return &types[id]; }
102 const BlockType *Get(Block::Type id) const { return &types[id]; }
105 std::vector<BlockType> types;