MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AbstractWindow.H
Go to the documentation of this file.
1 //========================================================================
2 // MinVR
3 // Platform: Any
4 // API version: 1.0
5 //------------------------------------------------------------------------
6 // The MIT License (MIT)
7 //
8 // Copyright (c) 2013 Regents of the University of Minnesota
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy of
11 // this software and associated documentation files (the "Software"), to deal in
12 // the Software without restriction, including without limitation the rights to
13 // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
14 // the Software, and to permit persons to whom the Software is furnished to do so,
15 // subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included in all
18 // copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23 // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 //========================================================================
27 
28 #ifndef WINDOW_H
29 #define WINDOW_H
30 
31 #include <boost/shared_ptr.hpp>
32 #include <glm/glm.hpp>
33 #include "MVRCore/AbstractCamera.H"
34 #include "MVRCore/Event.H"
35 #include "MVRCore/WindowSettings.H"
36 #include "MVRCore/Rect2D.H"
37 #include <vector>
38 
39 namespace MinVR {
40 
41 typedef boost::shared_ptr<class AbstractWindow> WindowRef;
42 
46 {
47 public:
48 
49  AbstractWindow(WindowSettingsRef settings, std::vector<AbstractCameraRef> cameras);
50  virtual ~AbstractWindow();
51 
57  virtual void pollForInput(std::vector<EventRef> &events) = 0;
58 
64  virtual void swapBuffers() = 0;
65 
73  virtual void makeContextCurrent() = 0;
74 
82  virtual void releaseContext() = 0;
83 
90  virtual void updateHeadTrackingForAllViewports(glm::mat4 headFrame);
91 
93  int getNumViewports() { return _viewports.size(); }
94  MinVR::Rect2D getViewport(int n) { return _viewports[n]; }
95  AbstractCameraRef getCamera(int n) { return _cameras[n]; }
97 
98  virtual int getWidth() = 0;
99  virtual int getHeight() = 0;
100  virtual int getXPos() = 0;
101  virtual int getYPos() = 0;
102 
103 protected:
104 
106  std::vector<MinVR::Rect2D> _viewports;
107  std::vector<AbstractCameraRef> _cameras;
108 };
109 
110 
111 } // end namespace
112 
113 #endif