1 #ifndef MSP_VR_OPENVRSYSTEM_H_
2 #define MSP_VR_OPENVRSYSTEM_H_
4 #include <msp/gl/material.h>
5 #include <msp/gl/matrix.h>
6 #include <msp/gl/object.h>
7 #include <msp/gl/technique.h>
8 #include <msp/vr/system.h>
9 #include "openvrcamera.h"
10 #include "openvrcombiner.h"
11 #include "openvrcontroller.h"
16 class OpenVRSystem: public System
21 unsigned n_tracked_devices;
22 std::vector<GL::Matrix> tracking_matrices;
23 std::vector<OpenVRController *> controllers;
24 std::vector<unsigned> unclaimed_controllers;
26 GL::Program render_shprog;
27 GL::Program render_shprog_textured;
28 GL::Material render_material;
29 std::map<std::string, RenderModel *> render_models;
30 std::map<unsigned, GL::Texture2D *> render_textures;
31 std::list<std::string> loading_render_models;
32 std::list<unsigned> loading_textures;
34 static unsigned n_instances;
40 static bool is_maybe_available();
42 virtual void configure_window(Graphics::Window &) const { }
43 virtual void configure_view(StereoView &) const;
44 virtual bool is_absolute_tracking_supported() const { return true; }
45 virtual void set_absolute_tracking(bool);
46 virtual bool get_absolute_tracking() const;
47 virtual OpenVRCamera *create_camera(const GL::Camera &);
48 virtual OpenVRCombiner *create_combiner(GL::View &);
49 virtual OpenVRController *create_controller();
53 void update_pose_matrices();
54 const GL::Matrix &get_tracking_matrix(unsigned) const;
55 const GL::Matrix &get_hmd_matrix() const;
56 void add_controller(OpenVRController &);
57 void remove_controller(OpenVRController &);
59 const GL::Object *get_render_model(const std::string &);
61 bool check_loading_render_model(const std::string &);
62 const GL::Texture2D *get_texture(unsigned);
63 bool check_loading_texture(unsigned);