]> git.tdb.fi Git - libs/vr.git/blob - source/stereocombiner.h
Remove extra blank line
[libs/vr.git] / source / stereocombiner.h
1 #ifndef MSP_VR_STEREOCOMBINER_H_
2 #define MSP_VR_STEREOCOMBINER_H_
3
4 #include <msp/geometry/angle.h>
5 #include <msp/gl/mesh.h>
6 #include <msp/gl/program.h>
7 #include <msp/gl/programdata.h>
8 #include <msp/gl/texture2d.h>
9
10 namespace Msp {
11 namespace VR {
12
13 class StereoCombiner
14 {
15 protected:
16         struct Frustum
17         {
18                 float left;
19                 float right;
20                 float bottom;
21                 float top;
22
23                 Frustum();
24                 Frustum(float, float, float, float);
25         };
26
27         struct MirrorView
28         {
29                 GL::Mesh mesh;
30                 GL::Program shader;
31                 GL::ProgramData shdata;
32
33                 MirrorView();
34         };
35
36         unsigned target_width;
37         unsigned target_height;
38         float render_aspect;
39         Geometry::Angle<float> fov;
40         float frustum_skew;
41         MirrorView *mirror;
42
43         StereoCombiner();
44 public:
45         virtual ~StereoCombiner() { }
46
47 protected:
48         void configure_eye_frustums(const Frustum &, const Frustum &);
49 public:
50         float get_target_width() const { return target_width; }
51         float get_target_height() const { return target_height; }
52         float get_render_aspect() const { return render_aspect; }
53         const Geometry::Angle<float> &get_field_of_view() const { return fov; }
54         float get_frustum_skew() const { return frustum_skew; }
55
56         virtual bool is_mirroring_supported() const { return false; }
57         void set_mirroring(bool);
58         bool get_mirroring() const { return mirror; }
59
60         virtual void prepare() const { }
61         virtual void render(const GL::Texture2D &, const GL::Texture2D &) const = 0;
62 protected:
63         void render_mirror(const GL::Texture2D &) const;
64 };
65
66 } // namespace VR
67 } // namespace Msp
68
69 #endif