]> git.localhorst.tv Git - blobs.git/blobdiff - src/graphics/Viewport.hpp
switch creatures with left click
[blobs.git] / src / graphics / Viewport.hpp
index 78178a620655df08b714c8fa1b8c09c3cd7e4fa5..ef227b41da9072175b0a157a81f50441ecf65bb6 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef BLOBS_GRAPHICS_VIEWPORT_HPP_
 #define BLOBS_GRAPHICS_VIEWPORT_HPP_
 
+#include "../math/geometry.hpp"
+
 
 namespace blobs {
 namespace graphics {
@@ -26,7 +28,15 @@ public:
        }
        void Resize(int w, int h);
 
+       math::Ray ShootPixel(int x, int y) const noexcept {
+               return math::Ray({
+                       ((double(x) / double(width)) * 2.0) - 1.0,
+                       1.0 - ((double(y) / double(height)) * 2.0),
+                       -1.0 }, { 0.0, 0.0, 1.0 });
+       }
+
        void Clear();
+       void ClearDepth();
 
 private:
        int width;