]> git.tdb.fi Git - libs/vr.git/commitdiff
Field of view is an angle too
authorMikko Rasa <tdb@tdb.fi>
Tue, 18 Jun 2013 21:30:18 +0000 (00:30 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 13 Sep 2013 11:36:13 +0000 (14:36 +0300)
source/stereocombiner.cpp
source/stereocombiner.h
source/stereoview.cpp
source/stereoview.h

index 27cbb8f7edd4edad0fc8dc14a7be666eeb44c78c..be0b01e986a76d99bd1abc25a2bade3b2e45e152 100644 (file)
@@ -6,8 +6,7 @@ namespace GL {
 StereoCombiner::StereoCombiner():
        width_div(1),
        height_div(1),
-       keep_aspect(false),
-       fov(0)
+       keep_aspect(false)
 { }
 
 } // namespace GL
index 10179309c6d0f3d81de53807997a30588a498353..a4b91bfbf9edfa82c477301a5df26e74e0961911 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef MSP_GL_STEREOCOMBINER_H_
 #define MSP_GL_STEREOCOMBINER_H_
 
+#include <msp/geometry/angle.h>
+
 namespace Msp {
 namespace GL {
 
@@ -12,7 +14,7 @@ protected:
        unsigned width_div;
        unsigned height_div;
        bool keep_aspect;
-       float fov;
+       Geometry::Angle<float> 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<float> &get_field_of_view() const { return fov; }
 
        virtual void render(const Texture2D &, const Texture2D &) const = 0;
 };
index 9a4b0e0c49dad965c6100d2847605bd54663bd55..419e95c5bde699a31e4bf9545298141d49cbe973 100644 (file)
@@ -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<float>::zero())
                params.fov = base_camera.get_field_of_view();
 
        params.aspect = base_camera.get_aspect();
index 63ee1834db7b27b2c9f67ea202c32bbf616198ba..4dce63b99870b96aa5c52cdb5296fcdba2311344 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_GL_STEREOVIEW_H_
 #define MSP_GL_STEREOVIEW_H_
 
+#include <msp/geometry/angle.h>
 #include "camera.h"
 #include "framebuffer.h"
 #include "renderable.h"
@@ -26,7 +27,7 @@ private:
 
        struct EyeParams
        {
-               float fov;
+               Geometry::Angle<float> fov;
                float aspect;
                float near_clip;
                float far_clip;