]> git.localhorst.tv Git - blank.git/blobdiff - src/world.hpp
place and remove blocks via mouse
[blank.git] / src / world.hpp
index b7ed84bd5a71fbfa60415b70c9e84b74b72d8739..67ee355ccbc386d5d8fb08f75ec5c0b7d7fb27df 100644 (file)
@@ -93,10 +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)]; }
-
-       bool Intersection(const Ray &, const glm::mat4 &M, int *blkid = nullptr, float *dist = nullptr) const;
+       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();