| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef OSGXR_OPENXR_GRAPHICS_BINDING |
| 5 |
#define OSGXR_OPENXR_GRAPHICS_BINDING 1 |
| 6 |
|
| 7 |
#include <osg/Referenced> |
| 8 |
#include <osg/ref_ptr> |
| 9 |
#include <osgViewer/GraphicsWindow> |
| 10 |
|
| 11 |
namespace osgXR { |
| 12 |
|
| 13 |
namespace OpenXR { |
| 14 |
|
| 15 |
class GraphicsBinding : public osg::Referenced |
| 16 |
{ |
| 17 |
public: |
| 18 |
virtual ~GraphicsBinding() { } |
| 19 |
|
| 20 |
virtual void *getXrGraphicsBinding() = 0; |
| 21 |
}; |
| 22 |
|
| 23 |
template <typename GRAPHICS_WINDOW, typename XR_BINDING> |
| 24 |
class GraphicsBindingImpl : public GraphicsBinding |
| 25 |
{ |
| 26 |
public: |
| 27 |
typedef GRAPHICS_WINDOW GraphicsWindow; |
| 28 |
|
| 29 |
GraphicsBindingImpl(GraphicsWindow *window); |
| 30 |
virtual ~GraphicsBindingImpl() {} |
| 31 |
|
| 32 |
void *getXrGraphicsBinding() override |
| 33 |
{ |
| 34 |
return &_binding; |
| 35 |
} |
| 36 |
|
| 37 |
protected: |
| 38 |
|
| 39 |
XR_BINDING _binding; |
| 40 |
}; |
| 41 |
|
| 42 |
osg::ref_ptr<GraphicsBinding> createGraphicsBinding(osgViewer::GraphicsWindow *window); |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
#endif |