From: Mikko Rasa Date: Tue, 18 Jun 2013 21:30:18 +0000 (+0300) Subject: Field of view is an angle too X-Git-Url: http://git.tdb.fi/?p=libs%2Fvr.git;a=commitdiff_plain;h=cf1b08401da851dd98cde45d9e4acf6e1d185224 Field of view is an angle too --- diff --git a/source/stereocombiner.cpp b/source/stereocombiner.cpp index 27cbb8f..be0b01e 100644 --- a/source/stereocombiner.cpp +++ b/source/stereocombiner.cpp @@ -6,8 +6,7 @@ namespace GL { StereoCombiner::StereoCombiner(): width_div(1), height_div(1), - keep_aspect(false), - fov(0) + keep_aspect(false) { } } // namespace GL diff --git a/source/stereocombiner.h b/source/stereocombiner.h index 1017930..a4b91bf 100644 --- a/source/stereocombiner.h +++ b/source/stereocombiner.h @@ -1,6 +1,8 @@ #ifndef MSP_GL_STEREOCOMBINER_H_ #define MSP_GL_STEREOCOMBINER_H_ +#include + namespace Msp { namespace GL { @@ -12,7 +14,7 @@ protected: unsigned width_div; unsigned height_div; bool keep_aspect; - float fov; + Geometry::Angle fov; StereoCombiner(); public: @@ -21,7 +23,7 @@ public: unsigned get_width_divisor() const { return width_div; } unsigned get_height_divisor() const { return height_div; } bool is_aspect_kept() const { return keep_aspect; } - float get_field_of_view() const { return fov; } + const Geometry::Angle &get_field_of_view() const { return fov; } virtual void render(const Texture2D &, const Texture2D &) const = 0; }; diff --git a/source/stereoview.cpp b/source/stereoview.cpp index 9a4b0e0..419e95c 100644 --- a/source/stereoview.cpp +++ b/source/stereoview.cpp @@ -39,7 +39,7 @@ void StereoView::setup_frame() const EyeParams params; params.fov = combiner->get_field_of_view(); - if(!params.fov) + if(params.fov==Geometry::Angle::zero()) params.fov = base_camera.get_field_of_view(); params.aspect = base_camera.get_aspect(); diff --git a/source/stereoview.h b/source/stereoview.h index 63ee183..4dce63b 100644 --- a/source/stereoview.h +++ b/source/stereoview.h @@ -1,6 +1,7 @@ #ifndef MSP_GL_STEREOVIEW_H_ #define MSP_GL_STEREOVIEW_H_ +#include #include "camera.h" #include "framebuffer.h" #include "renderable.h" @@ -26,7 +27,7 @@ private: struct EyeParams { - float fov; + Geometry::Angle fov; float aspect; float near_clip; float far_clip;