1 #ifndef BLANK_WORLD_BLOCKTYPE_HPP_
2 #define BLANK_WORLD_BLOCKTYPE_HPP_
5 #include "BlockGravity.hpp"
6 #include "../graphics/BlockMesh.hpp"
7 #include "../graphics/EntityMesh.hpp"
8 #include "../graphics/PrimitiveMesh.hpp"
9 #include "../model/Shape.hpp"
11 #include <glm/glm.hpp>
19 class TokenStreamReader;
22 /// attributes of a type of block
26 std::vector<float> textures;
27 glm::tvec3<unsigned char> hsl_mod;
28 glm::tvec3<unsigned char> rgb_mod;
29 glm::tvec3<unsigned char> outline_color;
31 /// gravity configuration or null if not emitting gravity
32 std::unique_ptr<BlockGravity> gravity;
34 /// a string identifying in contexts where numbers just won't do
35 /// must be unique within any given set
37 /// a string to display to the user
45 /// light level that blocks of this type emit
50 /// if true, stops light from propagating and fixes level to luminosity
53 /// whether to check for collisions at all
55 /// if the block should be impenetrable
58 // generation properties
59 /// whether to use this block in generation at all
61 // min/mid/max points for the respective properties
62 // should all be in the (-1,1) range
69 float min_temperature;
70 float mid_temperature;
71 float max_temperature;
75 /// commonness factor, random chance is multiplied by this
80 /// clone values of given type
81 /// this copies everything except for ID, name, label, and gravity
82 void Copy(const BlockType &) noexcept;
85 TokenStreamReader &in,
86 ResourceIndex &snd_index,
87 ResourceIndex &tex_index,
88 const ShapeRegistry &shapes);
90 bool FaceFilled(const Block &block, Block::Face face) const noexcept {
91 return shape && shape->FaceFilled(block.OrientedFace(face));
95 EntityMesh::Buffer &m,
96 const glm::mat4 &transform = glm::mat4(1.0f)
100 const glm::mat4 &transform = glm::mat4(1.0f),
101 BlockMesh::Index idx_offset = 0
103 void OutlinePrimitiveMesh(PrimitiveMesh::Buffer &) const noexcept;