1 #ifndef BLANK_WORLD_BLOCKTYPE_HPP_
2 #define BLANK_WORLD_BLOCKTYPE_HPP_
5 #include "../model/BlockModel.hpp"
6 #include "../model/EntityModel.hpp"
7 #include "../model/OutlineModel.hpp"
8 #include "../model/shapes.hpp"
10 #include <glm/glm.hpp>
16 /// attributes of a type of block
22 glm::vec3 outline_color;
24 /// a string to display to the user
29 /// light level that blocks of this type emit
34 /// if true, stops light from propagating and fixes level to luminosity
37 /// whether to check for collisions at all
39 /// if the block should be impenetrable
42 // generation properties
43 /// whether to use this block in generation at all
45 // min/mid/max points for the respective properties
46 // should all be in the (-1,1) range
53 float min_temperature;
54 float mid_temperature;
55 float max_temperature;
59 /// commonness factor, random chance is multiplied by this
63 bool face[Block::FACE_COUNT];
64 Faces &operator =(const Faces &other) noexcept {
65 for (int i = 0; i < Block::FACE_COUNT; ++i) {
66 face[i] = other.face[i];
70 bool operator [](Block::Face f) const noexcept {
77 const glm::vec3 &color = { 1, 1, 1 },
78 const Shape *shape = &DEFAULT_SHAPE
81 static const NullShape DEFAULT_SHAPE;
83 bool FaceFilled(const Block &block, Block::Face face) const noexcept {
84 return fill[block.OrientedFace(face)];
88 EntityModel::Buffer &m,
89 const glm::mat4 &transform = glm::mat4(1.0f),
90 EntityModel::Index idx_offset = 0
93 BlockModel::Buffer &m,
94 const glm::mat4 &transform = glm::mat4(1.0f),
95 BlockModel::Index idx_offset = 0
97 void FillOutlineModel(OutlineModel::Buffer &m) const noexcept;