From 6eacee38f0aa34ad34b65ad2d30d8c4da4660b7d Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 16 Oct 2020 07:33:03 +0300 Subject: [PATCH] Add constructors to camera classes --- libs/geom/include/psemek/geom/camera.hpp | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/libs/geom/include/psemek/geom/camera.hpp b/libs/geom/include/psemek/geom/camera.hpp index 62f55a1b..3fc5142e 100644 --- a/libs/geom/include/psemek/geom/camera.hpp +++ b/libs/geom/include/psemek/geom/camera.hpp @@ -41,6 +41,13 @@ namespace psemek::geom { float width, height; + window_camera() = default; + + window_camera(float width, float height) + : width{width} + , height{height} + {} + matrix view() const override; matrix projection() const override; }; @@ -50,6 +57,12 @@ namespace psemek::geom { geom::box box; + orthographic_camera() = default; + + orthographic_camera(geom::box const & box) + : box{box} + {} + matrix view() const override; matrix projection() const override; }; @@ -63,6 +76,15 @@ namespace psemek::geom float near_clip; float far_clip; + perspective_camera() = default; + + perspective_camera(float fov_x, float fov_y, float near_clip, float far_clip) + : fov_x{fov_x} + , fov_y{fov_y} + , near_clip{near_clip} + , far_clip{far_clip} + {} + matrix projection() const override; // aspect_ratio = width / height @@ -90,6 +112,16 @@ namespace psemek::geom float distance; point target; + spherical_camera() = default; + + spherical_camera(float fov_x, float fov_y, float near_clip, float far_clip, float azimuthal_angle, float elevation_angle, float distance, point const & target) + : perspective_camera(fov_x, fov_y, near_clip, far_clip) + , azimuthal_angle{azimuthal_angle} + , elevation_angle{elevation_angle} + , distance{distance} + , target{target} + {} + matrix view() const override; }; @@ -104,6 +136,15 @@ namespace psemek::geom float elevation_angle; point pos; + free_camera() = default; + + free_camera(float fov_x, float fov_y, float near_clip, float far_clip, float azimuthal_angle, float elevation_angle, point const & pos) + : perspective_camera(fov_x, fov_y, near_clip, far_clip) + , azimuthal_angle{azimuthal_angle} + , elevation_angle{elevation_angle} + , pos{pos} + {} + matrix view() const override; }; }