diff --git a/libs/geom/include/psemek/geom/camera.hpp b/libs/geom/include/psemek/geom/camera.hpp index 08cf74f0..8008967f 100644 --- a/libs/geom/include/psemek/geom/camera.hpp +++ b/libs/geom/include/psemek/geom/camera.hpp @@ -24,6 +24,8 @@ namespace psemek::geom virtual vector axis_y() const; virtual vector axis_z() const; + virtual vector direction() const; + // x, y are in clip-space [-1, 1] // NB: this vector is not necessarily normalized virtual vector direction(float x, float y) const; diff --git a/libs/geom/source/camera.cpp b/libs/geom/source/camera.cpp index cb433bc8..45e31eb2 100644 --- a/libs/geom/source/camera.cpp +++ b/libs/geom/source/camera.cpp @@ -46,6 +46,11 @@ namespace psemek::geom return { b[0], b[1], b[2] }; } + vector camera::direction() const + { + return -axis_z(); + } + vector camera::direction(float x, float y) const { vector b{ x, y, -1.f, 1.f};