Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::XR::HMD Class Referenceabstract


Display attached to the head. More...

Inherits G3D::XR::Object.

Inherited by G3D::EmulatedXR::EmulatedHMD.

Public Member Functions

virtual float displayFrequency () const =0
 In Hz. More...
 
const CFrameframe () const
 Where the AR/VR system estimates the object will be at the time of the next HMD::submit() call, in the room coordinate frame. More...
 
const shared_ptr< GazeTracker > & gazeTracker () const
 If the HMD has no true gaze tracker, it will create an emulation one that always looks forward. More...
 
virtual void getPassThroughVideo (shared_ptr< Texture > &left, shared_ptr< Texture > &right) const =0
 The left and right may be the same Texture. More...
 
virtual void getResolution (Vector2uint32 *resPerView) const =0
 Device-requested resolution for each view, before warping. More...
 
virtual void getViewCameraMatrices (float nearPlaneZ, float farPlaneZ, CFrame *viewToHead, Projection *viewProjection) const =0
 
const int index () const
 Zero-based index in the XR::objectArray. More...
 
virtual bool isController () const
 
virtual bool isHMD () const
 
const shared_ptr< Controller > & leftController () const
 If there is no tracked left controller, one is created and fixed relative to the head. More...
 
const shared_ptr< Hand > & leftHand () const
 If there is no hand tracking, it is inferred from the controller. More...
 
const Stringname () const
 Unique identifier. More...
 
int nativeAPIIndex () const
 Index of this object in the underlying OS API (e.g., OVR, OpenVR, SteamVR) More...
 
virtual int numViews () const =0
 
const CFramepreviousFrame () const
 Frame that was predicted at the previous HMD::submit() time. More...
 
const shared_ptr< Controller > & rightController () const
 If there is no tracked right controller, one is created and fixed relative to the head. More...
 
virtual bool rightEyeDominant () const =0
 Is the user's right (true) or left (false) eye dominant? More...
 
const shared_ptr< Hand > & rightHand () const
 If there is no hand tracking, it is inferred from the controller. More...
 
virtual bool rightHanded () const =0
 Does the user prefer to use the right (true) or left (false) hand? More...
 
virtual float standingHeadHeight () const =0
 Top of the user's head in the real world when standing. More...
 
virtual void submitFrame (RenderDevice *rd, const shared_ptr< Framebuffer > *hmdDeviceFramebuffer)=0
 

Static Public Member Functions

static shared_ptr< Objectcreate (int index, int nativeAPIIndex, const String &name)
 

Public Attributes

bool allowGameControllerToDriveHead = true
 

Protected Member Functions

 HMD (int index, int nativeAPIIndex, const String &name)
 

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

CFrame m_frame
 
shared_ptr< GazeTrackerm_gazeTracker
 
int m_index
 
shared_ptr< Controllerm_leftController
 
shared_ptr< Handm_leftHand
 
String m_name
 
int m_nativeAPIIndex
 
CFrame m_previousFrame
 
shared_ptr< Controllerm_rightController
 
shared_ptr< Handm_rightHand
 

Detailed Description


Display attached to the head.


GameController automatically runs in emulation mode, overriding/supplementing any actual controllers found. It defaults to XR::Controller mode.

In emulation mode using an GameController:

Head mode:

XR::Controller mode:

Constructor & Destructor Documentation

◆ HMD()

G3D::XR::HMD::HMD ( int  index,
int  nativeAPIIndex,
const String name 
)
inlineprotected

Member Function Documentation

◆ create()

static shared_ptr<Object> G3D::XR::Object::create ( int  index,
int  nativeAPIIndex,
const String name 
)
inlinestaticinherited

◆ 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>.

◆ displayFrequency()

virtual float G3D::XR::HMD::displayFrequency ( ) const
pure virtual

In Hz.

Implemented in G3D::EmulatedXR::EmulatedHMD.

◆ frame()

const CFrame& G3D::XR::Object::frame ( ) const
inlineinherited

Where the AR/VR system estimates the object will be at the time of the next HMD::submit() call, in the room coordinate frame.

◆ gazeTracker()

const shared_ptr<GazeTracker>& G3D::XR::HMD::gazeTracker ( ) const
inline

If the HMD has no true gaze tracker, it will create an emulation one that always looks forward.

◆ getPassThroughVideo()

virtual void G3D::XR::HMD::getPassThroughVideo ( shared_ptr< Texture > &  left,
shared_ptr< Texture > &  right 
) const
pure virtual

The left and right may be the same Texture.

They may also be Texture::black() if there is no passthrough video.

Implemented in G3D::EmulatedXR::EmulatedHMD.

◆ getResolution()

virtual void G3D::XR::HMD::getResolution ( Vector2uint32 resPerView) const
pure virtual

Device-requested resolution for each view, before warping.

Implemented in G3D::EmulatedXR::EmulatedHMD.

◆ getViewCameraMatrices()

virtual void G3D::XR::HMD::getViewCameraMatrices ( float  nearPlaneZ,
float  farPlaneZ,
CFrame viewToHead,
Projection viewProjection 
) const
pure virtual
Parameters
viewToHeadMust have numViews() elements.
viewProjectionMust have numViews() elements.

These may change every frame in some displays, such as those with dynamic foveal insets or that adjust the eyebox based on gaze tracking.

Implemented in G3D::EmulatedXR::EmulatedHMD.

◆ index()

const int G3D::XR::Object::index ( ) const
inlineinherited

◆ isController()

virtual bool G3D::XR::Object::isController ( ) const
inlinevirtualinherited

Reimplemented in G3D::XR::Controller.

◆ isHMD()

virtual bool G3D::XR::HMD::isHMD ( ) const
inlinevirtual

Reimplemented from G3D::XR::Object.

◆ leftController()

const shared_ptr<Controller>& G3D::XR::HMD::leftController ( ) const
inline

If there is no tracked left controller, one is created and fixed relative to the head.

It can be driven using an GameController.

◆ leftHand()

const shared_ptr<Hand>& G3D::XR::HMD::leftHand ( ) const
inline

If there is no hand tracking, it is inferred from the controller.

◆ name()

const String& G3D::XR::Object::name ( ) const
inlineinherited

◆ nativeAPIIndex()

int G3D::XR::Object::nativeAPIIndex ( ) const
inlineinherited

Index of this object in the underlying OS API (e.g., OVR, OpenVR, SteamVR)

Referenced by G3D::XR::Object::create(), G3D::EmulatedXR::EmulatedHMD::create(), and G3D::XR::Hand::create().

◆ numViews()

virtual int G3D::XR::HMD::numViews ( ) const
pure virtual

◆ previousFrame()

const CFrame& G3D::XR::Object::previousFrame ( ) const
inlineinherited

Frame that was predicted at the previous HMD::submit() time.

◆ rightController()

const shared_ptr<Controller>& G3D::XR::HMD::rightController ( ) const
inline

If there is no tracked right controller, one is created and fixed relative to the head.

It can be driven using an GameController.

◆ rightEyeDominant()

virtual bool G3D::XR::HMD::rightEyeDominant ( ) const
pure virtual

Is the user's right (true) or left (false) eye dominant?

Implemented in G3D::EmulatedXR::EmulatedHMD.

◆ rightHand()

const shared_ptr<Hand>& G3D::XR::HMD::rightHand ( ) const
inline

If there is no hand tracking, it is inferred from the controller.

◆ rightHanded()

virtual bool G3D::XR::HMD::rightHanded ( ) const
pure virtual

Does the user prefer to use the right (true) or left (false) hand?

Implemented in G3D::EmulatedXR::EmulatedHMD.

◆ standingHeadHeight()

virtual float G3D::XR::HMD::standingHeadHeight ( ) const
pure virtual

Top of the user's head in the real world when standing.

Implemented in G3D::EmulatedXR::EmulatedHMD.

◆ submitFrame()

virtual void G3D::XR::HMD::submitFrame ( RenderDevice rd,
const shared_ptr< Framebuffer > *  hmdDeviceFramebuffer 
)
pure virtual

Member Data Documentation

◆ allowGameControllerToDriveHead

bool G3D::XR::HMD::allowGameControllerToDriveHead = true

◆ m_frame

CFrame G3D::XR::Object::m_frame
protectedinherited

Referenced by G3D::XR::Object::frame().

◆ m_gazeTracker

shared_ptr<GazeTracker> G3D::XR::HMD::m_gazeTracker
protected

Referenced by gazeTracker().

◆ m_index

int G3D::XR::Object::m_index
protectedinherited

Referenced by G3D::XR::Object::index().

◆ m_leftController

shared_ptr<Controller> G3D::XR::HMD::m_leftController
protected

Referenced by leftController().

◆ m_leftHand

shared_ptr<Hand> G3D::XR::HMD::m_leftHand
protected

Referenced by leftHand().

◆ m_name

String G3D::XR::Object::m_name
protectedinherited

Referenced by G3D::XR::Object::name().

◆ m_nativeAPIIndex

int G3D::XR::Object::m_nativeAPIIndex
protectedinherited

◆ m_previousFrame

CFrame G3D::XR::Object::m_previousFrame
protectedinherited

◆ m_rightController

shared_ptr<Controller> G3D::XR::HMD::m_rightController
protected

Referenced by rightController().

◆ m_rightHand

shared_ptr<Hand> G3D::XR::HMD::m_rightHand
protected

Referenced by rightHand().


documentation generated on Wed Nov 24 2021 08:02:03 using doxygen 1.8.15