]> git.localhorst.tv Git - blobs.git/blobdiff - src/graphics/Viewport.hpp
switch creatures with left click
[blobs.git] / src / graphics / Viewport.hpp
index eab642bae94ff76cf4facadb4e7d4a13c16c0b42..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,6 +28,13 @@ 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();