1 #ifndef BLANK_WORLD_BLOCKTYPE_HPP_
2 #define BLANK_WORLD_BLOCKTYPE_HPP_
5 #include "../model/BlockModel.hpp"
6 #include "../model/Model.hpp"
7 #include "../model/OutlineModel.hpp"
8 #include "../model/shapes.hpp"
10 #include <glm/glm.hpp>
16 /// attributes of a type of block
21 glm::vec3 outline_color;
23 // a string to display to the user
28 // light level that blocks of this type emit
33 // if true, stops light from propagating and fixes level to luminosity
36 // whether to check for collisions at all
38 // if the block should be impenetrable
42 bool face[Block::FACE_COUNT];
43 Faces &operator =(const Faces &other) noexcept {
44 for (int i = 0; i < Block::FACE_COUNT; ++i) {
45 face[i] = other.face[i];
49 bool operator [](Block::Face f) const noexcept {
56 const glm::vec3 &color = { 1, 1, 1 },
57 const Shape *shape = &DEFAULT_SHAPE
60 static const NullShape DEFAULT_SHAPE;
62 bool FaceFilled(const Block &block, Block::Face face) const noexcept {
63 return fill[block.OrientedFace(face)];
68 const glm::mat4 &transform = glm::mat4(1.0f),
69 Model::Index idx_offset = 0
72 BlockModel::Buffer &m,
73 const glm::mat4 &transform = glm::mat4(1.0f),
74 BlockModel::Index idx_offset = 0
76 void FillOutlineModel(
78 const glm::vec3 &pos_offset = { 0, 0, 0 },
79 OutlineModel::Index idx_offset = 0