X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FViewport.hpp;h=ef227b41da9072175b0a157a81f50441ecf65bb6;hb=a19fdf3d9f0d7ecbf6eeeec817856d85049a8336;hp=78178a620655df08b714c8fa1b8c09c3cd7e4fa5;hpb=be413456f57da06e918ae7bf4c4f35e5198ff7ce;p=blobs.git diff --git a/src/graphics/Viewport.hpp b/src/graphics/Viewport.hpp index 78178a6..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,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;