X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fworld.hpp;h=67ee355ccbc386d5d8fb08f75ec5c0b7d7fb27df;hb=8881c507009521d08648560984c0f50166224542;hp=58f7a25faeea7e8c8a622cf65d247a0bb022bf99;hpb=ac8765b510707d77cac9620778f40ddf3a4ad2a2;p=blank.git diff --git a/src/world.hpp b/src/world.hpp index 58f7a25..67ee355 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -2,6 +2,7 @@ #define BLANK_WORLD_HPP_ #include "model.hpp" +#include "geometry.hpp" #include #include @@ -92,8 +93,17 @@ public: void Invalidate() { dirty = true; } - Block &BlockAt(const glm::vec3 &pos) { return blocks[ToIndex(pos)]; } - const Block &BlockAt(const glm::vec3 &pos) const { return blocks[ToIndex(pos)]; } + Block &BlockAt(int index) { return blocks[index]; } + const Block &BlockAt(int index) const { return blocks[index]; } + Block &BlockAt(const glm::vec3 &pos) { return BlockAt(ToIndex(pos)); } + const Block &BlockAt(const glm::vec3 &pos) const { return BlockAt(ToIndex(pos)); } + + bool Intersection( + const Ray &, + const glm::mat4 &M, + int *blkid = nullptr, + float *dist = nullptr, + glm::vec3 *normal = nullptr) const; void Draw();