X-Git-Url: http://git.tdb.fi/?p=libs%2Fvr.git;a=blobdiff_plain;f=source%2Fstereoview.h;h=75361ba13abd56acf8cc50feb0585e75daa41f24;hp=fe3d6d6b82f57de8a920ea01c326ccde6c817748;hb=HEAD;hpb=5244110fa8d347b8539f4fcff1bea729eecc2027 diff --git a/source/stereoview.h b/source/stereoview.h index fe3d6d6..75361ba 100644 --- a/source/stereoview.h +++ b/source/stereoview.h @@ -11,9 +11,11 @@ namespace Msp { namespace VR { +class HeadTrackingCamera; +class MotionController; class StereoCombiner; -class StereoView: public GL::Renderable +class StereoView { private: struct RenderTarget @@ -36,36 +38,47 @@ private: struct Eye { mutable GL::Camera camera; + GL::Matrix offset_matrix; RenderTarget *target; Eye(); + ~Eye(); void create_target(unsigned, unsigned); - void setup_frame(const GL::Camera &, const GL::Vector3 &, const EyeParams &) const; - void render(const GL::Renderable &, const GL::Tag &) const; + void setup_frame(const GL::Camera &, float, const EyeParams &) const; + void render(const GL::Renderable &) const; }; - unsigned width; - unsigned height; + const StereoCombiner &combiner; const GL::Camera &base_camera; - const GL::Renderable &renderable; - const StereoCombiner *combiner; + HeadTrackingCamera *head_camera; + const GL::Renderable *content; Eye left; Eye right; - float eye_spacing; - mutable GL::Vector3 offset_axis; + Geometry::Angle strabismus; + std::vector controllers; public: - StereoView(unsigned, unsigned, const GL::Camera &, const GL::Renderable &, const StereoCombiner &); + StereoView(const StereoCombiner &, const GL::Camera &); + StereoView(const StereoCombiner &, HeadTrackingCamera &); +private: + void init(); - void set_combiner(const StereoCombiner &); +public: + const GL::Camera &get_base_camera() const { return base_camera; } + const HeadTrackingCamera *get_head_camera() const { return head_camera; } + void set_content(const GL::Renderable *); void set_eye_spacing(float); + void set_eye_matrices(const GL::Matrix &, const GL::Matrix &); + void set_strabismus(const Geometry::Angle &); - virtual void setup_frame() const; - virtual void finish_frame() const; + void add_controller(MotionController &); + void remove_controller(MotionController &); - virtual void render(const GL::Tag & = GL::Tag()) const; - virtual void render(GL::Renderer &, const GL::Tag & = GL::Tag()) const; +private: + void setup_frame() const; +public: + void render() const; }; } // namespace VR