Support Forum       G3D Web Page     
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::OpenVR Class Reference


Implementation of the G3D::XR interface using the OpenVR API by Valve. More...

Inherits G3D::XR.

Classes

class  OpenVRController
 
class  OpenVRHMD
 

Public Member Functions

virtual const StringclassName () const override
 Which subclass of XR is this? More...
 
virtual void cleanup () override
 
const Array< shared_ptr< HMD > > & hmdArray () const
 
virtual shared_ptr< EventnextEvent ()
 Returns nullptr when out of events. More...
 
const Array< shared_ptr< Object > > & objectArray () const
 All tracked objects, including HMDs. More...
 
virtual void postGraphicsInit (const Settings &settings) override
 
virtual void preGraphicsInit (const Settings &settings) override
 
const TrackedVolumetrackedVolume () const
 
virtual void updateTrackingData () override
 Call once per frame. More...
 

Static Public Member Functions

static bool available ()
 Returns true if there is a HMD available on this machine. More...
 
static shared_ptr< OpenVRcreate ()
 
static void setFrame (const shared_ptr< Object > &t, const CFrame &f, const CFrame &p)
 Allows XR subclasses to access protected variables inside a tracked object. More...
 

Protected Member Functions

 OpenVR ()
 
void setLeftController (const shared_ptr< OpenVRController > &controller)
 
void setRightController (const shared_ptr< OpenVRController > &controller)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

Array< shared_ptr< OpenVRController > > m_controllerArray
 
float m_displayFrequency = 0.0f
 
Queue< shared_ptr< XR::Event > > m_eventQueue
 
bool m_hasTouchpad
 
shared_ptr< OpenVRHMDm_hmd
 
Array< shared_ptr< HMD > > m_hmdArray
 
shared_ptr< OpenVRControllerm_leftController
 
Array< shared_ptr< Object > > m_objectArray
 
Vector2uint32 m_resolution
 
shared_ptr< OpenVRControllerm_rightController
 
vr::IVRSystem * m_system = nullptr
 
TrackedVolume m_trackedVolume
 

Detailed Description


Implementation of the G3D::XR interface using the OpenVR API by Valve.

Supports Oculus Rift, Vive, DK2, and OSVR devices.

This class is G3D-gfx because it directly makes use of graphics-API specific calls such as vr::IVRTrackedCamera::GetVideoStreamTextureGL and vr::IVRCompositor::Submit.

See also
G3D::VRApp, G3D::XRWidget

Constructor & Destructor Documentation

◆ OpenVR()

G3D::OpenVR::OpenVR ( )
inlineprotected

Member Function Documentation

◆ available()

static bool G3D::OpenVR::available ( )
static

Returns true if there is a HMD available on this machine.

◆ className()

virtual const String& G3D::OpenVR::className ( ) const
inlineoverridevirtual

Which subclass of XR is this?

Implements G3D::XR.

◆ cleanup()

virtual void G3D::OpenVR::cleanup ( )
overridevirtual

Reimplemented from G3D::XR.

◆ create()

static shared_ptr<OpenVR> G3D::OpenVR::create ( )
inlinestatic

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ hmdArray()

const Array<shared_ptr<HMD> >& G3D::XR::hmdArray ( ) const
inlineinherited

◆ nextEvent()

virtual shared_ptr<Event> G3D::XR::nextEvent ( )
inlinevirtualinherited

Returns nullptr when out of events.

◆ objectArray()

const Array<shared_ptr<Object> >& G3D::XR::objectArray ( ) const
inlineinherited

All tracked objects, including HMDs.

◆ postGraphicsInit()

virtual void G3D::OpenVR::postGraphicsInit ( const Settings settings)
overridevirtual

Reimplemented from G3D::XR.

◆ preGraphicsInit()

virtual void G3D::OpenVR::preGraphicsInit ( const Settings settings)
overridevirtual

Reimplemented from G3D::XR.

◆ setFrame()

static void G3D::XR::setFrame ( const shared_ptr< Object > &  t,
const CFrame f,
const CFrame p 
)
staticinherited

Allows XR subclasses to access protected variables inside a tracked object.

◆ setLeftController()

void G3D::OpenVR::setLeftController ( const shared_ptr< OpenVRController > &  controller)
protected

◆ setRightController()

void G3D::OpenVR::setRightController ( const shared_ptr< OpenVRController > &  controller)
protected

◆ trackedVolume()

const TrackedVolume& G3D::XR::trackedVolume ( ) const
inlineinherited

◆ updateTrackingData()

virtual void G3D::OpenVR::updateTrackingData ( )
overridevirtual

Call once per frame.

Implements G3D::XR.

Member Data Documentation

◆ m_controllerArray

Array<shared_ptr<OpenVRController> > G3D::OpenVR::m_controllerArray
protected

◆ m_displayFrequency

float G3D::OpenVR::m_displayFrequency = 0.0f
protected

◆ m_eventQueue

Queue<shared_ptr<XR::Event> > G3D::XR::m_eventQueue
protectedinherited

Referenced by G3D::XR::nextEvent().

◆ m_hasTouchpad

bool G3D::OpenVR::m_hasTouchpad
protected

◆ m_hmd

shared_ptr<OpenVRHMD> G3D::OpenVR::m_hmd
protected

◆ m_hmdArray

Array<shared_ptr<HMD> > G3D::XR::m_hmdArray
protectedinherited

Referenced by G3D::XR::hmdArray().

◆ m_leftController

shared_ptr<OpenVRController> G3D::OpenVR::m_leftController
protected

◆ m_objectArray

Array<shared_ptr<Object> > G3D::XR::m_objectArray
protectedinherited

Referenced by G3D::XR::objectArray().

◆ m_resolution

Vector2uint32 G3D::OpenVR::m_resolution
protected

◆ m_rightController

shared_ptr<OpenVRController> G3D::OpenVR::m_rightController
protected

◆ m_system

vr::IVRSystem* G3D::OpenVR::m_system = nullptr
protected

◆ m_trackedVolume

TrackedVolume G3D::XR::m_trackedVolume
protectedinherited

Referenced by G3D::XR::trackedVolume().


documentation generated on Wed Nov 24 2021 08:01:58 using doxygen 1.8.15