#include <msp/gl/renderer.h>
+#include "headtrackingcamera.h"
#include "stereocombiner.h"
#include "stereoview.h"
StereoView::StereoView(const StereoCombiner &c, const GL::Camera &a):
combiner(c),
base_camera(a),
- content(0)
+ head_camera(0)
{
+ init();
+}
+
+StereoView::StereoView(const StereoCombiner &c, HeadTrackingCamera &a):
+ combiner(c),
+ base_camera(a),
+ head_camera(&a)
+{
+ init();
+}
+
+void StereoView::init()
+{
+ content = 0;
+
unsigned w = combiner.get_target_width();
unsigned h = combiner.get_target_height();
left.create_target(w, h);
void StereoView::setup_frame() const
{
+ if(head_camera)
+ head_camera->update();
+
GL::Vector3 offset_axis = normalize(cross(base_camera.get_look_direction(), base_camera.get_up_direction()))*0.5f;
EyeParams params;
namespace Msp {
namespace VR {
+class HeadTrackingCamera;
class StereoCombiner;
class StereoView
const StereoCombiner &combiner;
const GL::Camera &base_camera;
+ HeadTrackingCamera *head_camera;
const GL::Renderable *content;
Eye left;
Eye right;
public:
StereoView(const StereoCombiner &, const GL::Camera &);
+ StereoView(const StereoCombiner &, HeadTrackingCamera &);
+private:
+ void init();
+public:
void set_content(const GL::Renderable *);
void set_eye_spacing(float);
void set_strabismus(const Geometry::Angle<float> &);