1 #ifndef BLANK_WORLD_BLOCKTYPE_HPP_
2 #define BLANK_WORLD_BLOCKTYPE_HPP_
5 #include "../graphics/BlockMesh.hpp"
6 #include "../graphics/EntityMesh.hpp"
7 #include "../graphics/OutlineMesh.hpp"
8 #include "../model/bounds.hpp"
10 #include <glm/glm.hpp>
17 /// attributes of a type of block
20 const CollisionBounds *shape;
21 std::vector<float> textures;
24 glm::vec3 outline_color;
26 /// a string to display to the user
31 /// light level that blocks of this type emit
36 /// if true, stops light from propagating and fixes level to luminosity
39 /// whether to check for collisions at all
41 /// if the block should be impenetrable
44 // generation properties
45 /// whether to use this block in generation at all
47 // min/mid/max points for the respective properties
48 // should all be in the (-1,1) range
55 float min_temperature;
56 float mid_temperature;
57 float max_temperature;
61 /// commonness factor, random chance is multiplied by this
65 bool face[Block::FACE_COUNT];
66 Faces &operator =(const Faces &other) noexcept {
67 for (int i = 0; i < Block::FACE_COUNT; ++i) {
68 face[i] = other.face[i];
72 bool operator [](Block::Face f) const noexcept {
79 static const NullBounds DEFAULT_SHAPE;
81 bool FaceFilled(const Block &block, Block::Face face) const noexcept {
82 return fill[block.OrientedFace(face)];
86 EntityMesh::Buffer &m,
87 const glm::mat4 &transform = glm::mat4(1.0f),
88 EntityMesh::Index idx_offset = 0
92 const glm::mat4 &transform = glm::mat4(1.0f),
93 BlockMesh::Index idx_offset = 0
95 void FillOutlineMesh(OutlineMesh::Buffer &m) const noexcept;