]> git.localhorst.tv Git - blank.git/blob - src/block.cpp
some cleanup
[blank.git] / src / block.cpp
1 #include "block.hpp"
2
3
4 namespace blank {
5
6 const BlockType BlockType::DEFAULT;
7 const NullShape BlockType::DEFAULT_SHAPE;
8
9 void BlockType::FillVBO(
10         const glm::vec3 &pos,
11         std::vector<glm::vec3> &vertices,
12         std::vector<glm::vec3> &colors,
13         std::vector<glm::vec3> &normals
14 ) const {
15         shape->Vertices(vertices, pos);
16         colors.insert(colors.end(), shape->VertexCount(), color);
17         shape->Normals(normals);
18 }
19
20 void BlockType::FillOutlineVBO(
21         std::vector<glm::vec3> &vertices,
22         std::vector<glm::vec3> &colors
23 ) const {
24         shape->Outline(vertices);
25         colors.insert(colors.end(), shape->OutlineCount(), outline_color);
26 }
27
28
29 BlockTypeRegistry::BlockTypeRegistry() {
30         Add(BlockType::DEFAULT);
31 }
32
33 int BlockTypeRegistry::Add(const BlockType &t) {
34         int id = types.size();
35         types.push_back(t);
36         types.back().id = id;
37         return id;
38 }
39
40 }