]> git.localhorst.tv Git - blank.git/blob - src/world/WorldCollision.hpp
ebf01c17cd0362bfda3f1ba15f674367b8205bc2
[blank.git] / src / world / WorldCollision.hpp
1 #ifndef BLANK_WORLD_WORLDCOLLISION_HPP_
2 #define BLANK_WORLD_WORLDCOLLISION_HPP_
3
4 #include "BlockType.hpp"
5 #include "Chunk.hpp"
6
7 #include <glm/glm.hpp>
8
9
10 namespace blank {
11
12 struct WorldCollision {
13
14         const Chunk *chunk;
15         int block;
16
17         float depth;
18         glm::vec3 normal;
19
20         WorldCollision(const Chunk *c, int b, float d, const glm::vec3 &n)
21         : chunk(c), block(b), depth(d), normal(n) { }
22
23         bool Blocks() const noexcept { return chunk->Type(block).collide_block; }
24
25         glm::vec3 BlockCoords() const noexcept { return Chunk::ToCoords(block); }
26
27 };
28
29 }
30
31 #endif