]> git.tdb.fi Git - libs/vr.git/blobdiff - source/libovr/libovrcombiner.h
Name LibOVR classes after the API, not the device
[libs/vr.git] / source / libovr / libovrcombiner.h
diff --git a/source/libovr/libovrcombiner.h b/source/libovr/libovrcombiner.h
new file mode 100644 (file)
index 0000000..789de55
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef MSP_VR_LIBOVRCOMBINER_H_
+#define MSP_VR_LIBOVRCOMBINER_H_
+
+#include <msp/gl/mesh.h>
+#include <msp/gl/program.h>
+#include <msp/gl/programdata.h>
+#include <msp/gl/view.h>
+#include <msp/vr/stereocombiner.h>
+
+namespace Msp {
+namespace VR {
+
+class LibOVRSystem;
+
+/**
+Presents a stereo view in a way suitable for an Oculus Rift HMD.  All distances
+are specified in multiples of the screen width.
+*/
+class LibOVRCombiner: public StereoCombiner
+{
+private:
+       struct Frustum;
+
+       LibOVRSystem &device;
+       GL::View &view;
+       GL::Mesh left_mesh;
+       GL::Mesh right_mesh;
+       GL::Program shprog;
+       mutable GL::ProgramData left_shdata;
+       mutable GL::ProgramData right_shdata;
+
+public:
+       LibOVRCombiner(LibOVRSystem &, GL::View &);
+
+       virtual void prepare() const;
+       virtual void render(const GL::Texture2D &, const GL::Texture2D &) const;
+};
+
+} // namespace VR
+} // namespace Msp
+
+#endif