X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=blobdiff_plain;f=src%2Fgraphics%2FViewport.hpp;h=ef227b41da9072175b0a157a81f50441ecf65bb6;hp=eab642bae94ff76cf4facadb4e7d4a13c16c0b42;hb=200f9da6241613a1c19431896b09d1715c262c6d;hpb=76c09039792065ca1c259fb4b681c84c29a9dbd8 diff --git a/src/graphics/Viewport.hpp b/src/graphics/Viewport.hpp index eab642b..ef227b4 100644 --- a/src/graphics/Viewport.hpp +++ b/src/graphics/Viewport.hpp @@ -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();