Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
Aspect_XRSession Class Referenceabstract

Extended Reality (XR) Session interface. More...

#include <Aspect_XRSession.hxx>

Inheritance diagram for Aspect_XRSession:
Inheritance graph
[legend]

Public Types

enum  TrackingUniverseOrigin { TrackingUniverseOrigin_Seated , TrackingUniverseOrigin_Standing }
 Identifies which style of tracking origin the application wants to use for the poses it is requesting. More...
 
enum  InfoString { InfoString_Vendor , InfoString_Device , InfoString_Tracker , InfoString_SerialNumber }
 Info string enumeration. More...
 
- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 

Public Member Functions

virtual bool IsOpen () const =0
 Return TRUE if session is opened.
 
virtual bool Open ()=0
 Initialize session.
 
virtual void Close ()=0
 Release session.
 
virtual bool WaitPoses ()=0
 Fetch actual poses of tracked devices.
 
virtual NCollection_Vec2< intRecommendedViewport () const =0
 Return recommended viewport Width x Height for rendering into VR.
 
virtual NCollection_Mat4< doubleEyeToHeadTransform (Aspect_Eye theEye) const =0
 Return transformation from eye to head.
 
NCollection_Mat4< doubleHeadToEyeTransform (Aspect_Eye theEye) const
 Return transformation from head to eye.
 
virtual NCollection_Mat4< doubleProjectionMatrix (Aspect_Eye theEye, double theZNear, double theZFar) const =0
 Return projection matrix.
 
virtual bool HasProjectionFrustums () const =0
 Return FALSE if projection frustums are unsupported and general 4x4 projection matrix should be fetched instead.
 
virtual void ProcessEvents ()=0
 Receive XR events.
 
virtual bool SubmitEye (void *theTexture, Aspect_GraphicsLibrary theGraphicsLib, Aspect_ColorSpace theColorSpace, Aspect_Eye theEye)=0
 Submit texture eye to XR Composer.
 
double UnitFactor () const
 Return unit scale factor defined as scale factor for m (meters); 1.0 by default.
 
void SetUnitFactor (double theFactor)
 Set unit scale factor.
 
double Aspect () const
 Return aspect ratio.
 
double FieldOfView () const
 Return field of view.
 
double IOD () const
 Return Intra-ocular Distance (IOD); also known as Interpupillary Distance (IPD). Defined in meters by default (.
 
float DisplayFrequency () const
 Return display frequency or 0 if unknown.
 
const Aspect_FrustumLRBT< double > & ProjectionFrustum (Aspect_Eye theEye) const
 Return projection frustum.
 
const gp_TrsfHeadPose () const
 Return head orientation in right-handed system: +y is up +x is to the right -z is forward Distance unit is meters by default (.
 
gp_Trsf LeftHandPose () const
 Return left hand orientation.
 
gp_Trsf RightHandPose () const
 Return right hand orientation.
 
const NCollection_Array1< Aspect_TrackedDevicePose > & TrackedPoses () const
 Return number of tracked poses array.
 
bool HasTrackedPose (int theDevice) const
 Return TRUE if device orientation is defined.
 
virtual int NamedTrackedDevice (Aspect_XRTrackedDeviceRole theDevice) const =0
 Return index of tracked device of known role, or -1 if undefined.
 
occ::handle< Graphic3d_ArrayOfTrianglesLoadRenderModel (int theDevice, occ::handle< Image_Texture > &theTexture)
 Load model for displaying device.
 
occ::handle< Graphic3d_ArrayOfTrianglesLoadRenderModel (int theDevice, bool theToApplyUnitFactor, occ::handle< Image_Texture > &theTexture)
 Load model for displaying device.
 
virtual Aspect_XRDigitalActionData GetDigitalActionData (const occ::handle< Aspect_XRAction > &theAction) const =0
 Fetch data for digital input action (like button).
 
virtual Aspect_XRAnalogActionData GetAnalogActionData (const occ::handle< Aspect_XRAction > &theAction) const =0
 Fetch data for digital input action (like axis).
 
virtual Aspect_XRPoseActionData GetPoseActionDataForNextFrame (const occ::handle< Aspect_XRAction > &theAction) const =0
 Fetch data for pose input action (like fingertip position). The returned values will match the values returned by the last call to WaitPoses().
 
void TriggerHapticVibrationAction (const occ::handle< Aspect_XRAction > &theAction, const Aspect_XRHapticActionData &theParams)
 Trigger vibration.
 
void AbortHapticVibrationAction (const occ::handle< Aspect_XRAction > &theAction)
 Abort vibration.
 
TrackingUniverseOrigin TrackingOrigin () const
 Return tracking origin.
 
virtual void SetTrackingOrigin (TrackingUniverseOrigin theOrigin)
 Set tracking origin.
 
const occ::handle< Aspect_XRAction > & GenericAction (Aspect_XRTrackedDeviceRole theDevice, Aspect_XRGenericAction theAction) const
 Return generic action for specific hand or NULL if undefined.
 
virtual TCollection_AsciiString GetString (InfoString theInfo) const =0
 Query information.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Member Functions

 Aspect_XRSession ()
 Empty constructor.
 
virtual occ::handle< Graphic3d_ArrayOfTrianglesloadRenderModel (int theDevice, bool theToApplyUnitFactor, occ::handle< Image_Texture > &theTexture)=0
 Load model for displaying device.
 
virtual void triggerHapticVibrationAction (const occ::handle< Aspect_XRAction > &theAction, const Aspect_XRHapticActionData &theParams)=0
 Trigger vibration.
 

Protected Attributes

NCollection_Array1< occ::handle< Aspect_XRAction > > myRoleActions [Aspect_XRTrackedDeviceRole_NB]
 generic actions
 
NCollection_IndexedDataMap< TCollection_AsciiString, occ::handle< Aspect_XRActionSet > > myActionSets
 actions sets
 
TrackingUniverseOrigin myTrackOrigin
 tracking origin
 
NCollection_Array1< Aspect_TrackedDevicePosemyTrackedPoses
 array of tracked poses
 
gp_Trsf myHeadPose
 head orientation
 
NCollection_Vec2< intmyRendSize
 viewport Width x Height for rendering into VR
 
Aspect_FrustumLRBT< doublemyFrustumL
 left eye projection frustum
 
Aspect_FrustumLRBT< doublemyFrustumR
 right eye projection frustum
 
double myUnitFactor
 unit scale factor defined as scale factor for m (meters)
 
double myAspect
 aspect ratio
 
double myFieldOfView
 field of view
 
double myIod
 intra-ocular distance in meters
 
float myDispFreq
 display frequency
 

Additional Inherited Members

- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Detailed Description

Extended Reality (XR) Session interface.

Member Enumeration Documentation

◆ InfoString

Info string enumeration.

Enumerator
InfoString_Vendor 
InfoString_Device 
InfoString_Tracker 
InfoString_SerialNumber 

◆ TrackingUniverseOrigin

Identifies which style of tracking origin the application wants to use for the poses it is requesting.

Enumerator
TrackingUniverseOrigin_Seated 
TrackingUniverseOrigin_Standing 

poses are provided relative to the seated zero pose

Constructor & Destructor Documentation

◆ Aspect_XRSession()

Aspect_XRSession::Aspect_XRSession ( )
protected

Empty constructor.

Member Function Documentation

◆ AbortHapticVibrationAction()

void Aspect_XRSession::AbortHapticVibrationAction ( const occ::handle< Aspect_XRAction > & theAction)

Abort vibration.

◆ Aspect()

double Aspect_XRSession::Aspect ( ) const
inline

Return aspect ratio.

◆ Close()

virtual void Aspect_XRSession::Close ( )
pure virtual

Release session.

Implemented in Aspect_OpenVRSession.

◆ DisplayFrequency()

float Aspect_XRSession::DisplayFrequency ( ) const
inline

Return display frequency or 0 if unknown.

◆ EyeToHeadTransform()

virtual NCollection_Mat4< double > Aspect_XRSession::EyeToHeadTransform ( Aspect_Eye theEye) const
pure virtual

Return transformation from eye to head.

Implemented in Aspect_OpenVRSession.

◆ FieldOfView()

double Aspect_XRSession::FieldOfView ( ) const
inline

Return field of view.

◆ GenericAction()

const occ::handle< Aspect_XRAction > & Aspect_XRSession::GenericAction ( Aspect_XRTrackedDeviceRole theDevice,
Aspect_XRGenericAction theAction ) const
inline

Return generic action for specific hand or NULL if undefined.

◆ GetAnalogActionData()

virtual Aspect_XRAnalogActionData Aspect_XRSession::GetAnalogActionData ( const occ::handle< Aspect_XRAction > & theAction) const
pure virtual

Fetch data for digital input action (like axis).

Parameters
[in]theActionaction of Aspect_XRActionType_InputAnalog type

Implemented in Aspect_OpenVRSession.

◆ GetDigitalActionData()

virtual Aspect_XRDigitalActionData Aspect_XRSession::GetDigitalActionData ( const occ::handle< Aspect_XRAction > & theAction) const
pure virtual

Fetch data for digital input action (like button).

Parameters
[in]theActionaction of Aspect_XRActionType_InputDigital type

Implemented in Aspect_OpenVRSession.

◆ GetPoseActionDataForNextFrame()

virtual Aspect_XRPoseActionData Aspect_XRSession::GetPoseActionDataForNextFrame ( const occ::handle< Aspect_XRAction > & theAction) const
pure virtual

Fetch data for pose input action (like fingertip position). The returned values will match the values returned by the last call to WaitPoses().

Parameters
[in]theActionaction of Aspect_XRActionType_InputPose type

Implemented in Aspect_OpenVRSession.

◆ GetString()

virtual TCollection_AsciiString Aspect_XRSession::GetString ( InfoString theInfo) const
pure virtual

Query information.

Implemented in Aspect_OpenVRSession.

◆ HasProjectionFrustums()

virtual bool Aspect_XRSession::HasProjectionFrustums ( ) const
pure virtual

Return FALSE if projection frustums are unsupported and general 4x4 projection matrix should be fetched instead.

Implemented in Aspect_OpenVRSession.

◆ HasTrackedPose()

bool Aspect_XRSession::HasTrackedPose ( int theDevice) const
inline

Return TRUE if device orientation is defined.

◆ HeadPose()

const gp_Trsf & Aspect_XRSession::HeadPose ( ) const
inline

Return head orientation in right-handed system: +y is up +x is to the right -z is forward Distance unit is meters by default (.

See also
UnitFactor()).

◆ HeadToEyeTransform()

NCollection_Mat4< double > Aspect_XRSession::HeadToEyeTransform ( Aspect_Eye theEye) const
inline

Return transformation from head to eye.

◆ IOD()

double Aspect_XRSession::IOD ( ) const
inline

Return Intra-ocular Distance (IOD); also known as Interpupillary Distance (IPD). Defined in meters by default (.

See also
UnitFactor()).

◆ IsOpen()

virtual bool Aspect_XRSession::IsOpen ( ) const
pure virtual

Return TRUE if session is opened.

Implemented in Aspect_OpenVRSession.

◆ LeftHandPose()

gp_Trsf Aspect_XRSession::LeftHandPose ( ) const
inline

Return left hand orientation.

◆ LoadRenderModel() [1/2]

occ::handle< Graphic3d_ArrayOfTriangles > Aspect_XRSession::LoadRenderModel ( int theDevice,
bool theToApplyUnitFactor,
occ::handle< Image_Texture > & theTexture )
inline

Load model for displaying device.

Parameters
[in]theDevicedevice index
[in]theToApplyUnitFactorflag to apply unit scale factor
[out]theTexturetexture source
Returns
model triangulation or NULL if not found

◆ loadRenderModel()

virtual occ::handle< Graphic3d_ArrayOfTriangles > Aspect_XRSession::loadRenderModel ( int theDevice,
bool theToApplyUnitFactor,
occ::handle< Image_Texture > & theTexture )
protectedpure virtual

Load model for displaying device.

Parameters
[in]theDevicedevice index
[in]theToApplyUnitFactorflag to apply unit scale factor
[out]theTexturetexture source
Returns
model triangulation or NULL if not found

Implemented in Aspect_OpenVRSession.

◆ LoadRenderModel() [2/2]

occ::handle< Graphic3d_ArrayOfTriangles > Aspect_XRSession::LoadRenderModel ( int theDevice,
occ::handle< Image_Texture > & theTexture )
inline

Load model for displaying device.

Parameters
[in]theDevicedevice index
[out]theTexturetexture source
Returns
model triangulation or NULL if not found

◆ NamedTrackedDevice()

virtual int Aspect_XRSession::NamedTrackedDevice ( Aspect_XRTrackedDeviceRole theDevice) const
pure virtual

Return index of tracked device of known role, or -1 if undefined.

Implemented in Aspect_OpenVRSession.

◆ Open()

virtual bool Aspect_XRSession::Open ( )
pure virtual

Initialize session.

Implemented in Aspect_OpenVRSession.

◆ ProcessEvents()

virtual void Aspect_XRSession::ProcessEvents ( )
pure virtual

Receive XR events.

Implemented in Aspect_OpenVRSession.

◆ ProjectionFrustum()

const Aspect_FrustumLRBT< double > & Aspect_XRSession::ProjectionFrustum ( Aspect_Eye theEye) const
inline

Return projection frustum.

See also
HasProjectionFrustums().

◆ ProjectionMatrix()

virtual NCollection_Mat4< double > Aspect_XRSession::ProjectionMatrix ( Aspect_Eye theEye,
double theZNear,
double theZFar ) const
pure virtual

Return projection matrix.

Implemented in Aspect_OpenVRSession.

◆ RecommendedViewport()

virtual NCollection_Vec2< int > Aspect_XRSession::RecommendedViewport ( ) const
pure virtual

Return recommended viewport Width x Height for rendering into VR.

Implemented in Aspect_OpenVRSession.

◆ RightHandPose()

gp_Trsf Aspect_XRSession::RightHandPose ( ) const
inline

Return right hand orientation.

◆ SetTrackingOrigin()

virtual void Aspect_XRSession::SetTrackingOrigin ( TrackingUniverseOrigin theOrigin)
inlinevirtual

Set tracking origin.

Reimplemented in Aspect_OpenVRSession.

◆ SetUnitFactor()

void Aspect_XRSession::SetUnitFactor ( double theFactor)
inline

Set unit scale factor.

◆ SubmitEye()

virtual bool Aspect_XRSession::SubmitEye ( void * theTexture,
Aspect_GraphicsLibrary theGraphicsLib,
Aspect_ColorSpace theColorSpace,
Aspect_Eye theEye )
pure virtual

Submit texture eye to XR Composer.

Parameters
[in]theTexturetexture handle
[in]theGraphicsLibgraphics library in which texture handle is defined
[in]theColorSpacetexture color space; sRGB means no color conversion by composer; Linear means to sRGB color conversion by composer
[in]theEyeeye to display
Returns
FALSE on error

Implemented in Aspect_OpenVRSession.

◆ TrackedPoses()

const NCollection_Array1< Aspect_TrackedDevicePose > & Aspect_XRSession::TrackedPoses ( ) const
inline

Return number of tracked poses array.

◆ TrackingOrigin()

TrackingUniverseOrigin Aspect_XRSession::TrackingOrigin ( ) const
inline

Return tracking origin.

◆ TriggerHapticVibrationAction()

void Aspect_XRSession::TriggerHapticVibrationAction ( const occ::handle< Aspect_XRAction > & theAction,
const Aspect_XRHapticActionData & theParams )

Trigger vibration.

◆ triggerHapticVibrationAction()

virtual void Aspect_XRSession::triggerHapticVibrationAction ( const occ::handle< Aspect_XRAction > & theAction,
const Aspect_XRHapticActionData & theParams )
protectedpure virtual

Trigger vibration.

Implemented in Aspect_OpenVRSession.

◆ UnitFactor()

double Aspect_XRSession::UnitFactor ( ) const
inline

Return unit scale factor defined as scale factor for m (meters); 1.0 by default.

◆ WaitPoses()

virtual bool Aspect_XRSession::WaitPoses ( )
pure virtual

Fetch actual poses of tracked devices.

Implemented in Aspect_OpenVRSession.

Field Documentation

◆ myActionSets

actions sets

◆ myAspect

double Aspect_XRSession::myAspect
protected

aspect ratio

◆ myDispFreq

float Aspect_XRSession::myDispFreq
protected

display frequency

◆ myFieldOfView

double Aspect_XRSession::myFieldOfView
protected

field of view

◆ myFrustumL

Aspect_FrustumLRBT<double> Aspect_XRSession::myFrustumL
protected

left eye projection frustum

◆ myFrustumR

Aspect_FrustumLRBT<double> Aspect_XRSession::myFrustumR
protected

right eye projection frustum

◆ myHeadPose

gp_Trsf Aspect_XRSession::myHeadPose
protected

head orientation

◆ myIod

double Aspect_XRSession::myIod
protected

intra-ocular distance in meters

◆ myRendSize

NCollection_Vec2<int> Aspect_XRSession::myRendSize
protected

viewport Width x Height for rendering into VR

◆ myRoleActions

NCollection_Array1<occ::handle<Aspect_XRAction> > Aspect_XRSession::myRoleActions[Aspect_XRTrackedDeviceRole_NB]
protected

generic actions

◆ myTrackedPoses

NCollection_Array1<Aspect_TrackedDevicePose> Aspect_XRSession::myTrackedPoses
protected

array of tracked poses

◆ myTrackOrigin

TrackingUniverseOrigin Aspect_XRSession::myTrackOrigin
protected

tracking origin

◆ myUnitFactor

double Aspect_XRSession::myUnitFactor
protected

unit scale factor defined as scale factor for m (meters)


The documentation for this class was generated from the following file: