Blender V4.3
GHOST_XrContext Class Reference

Main GHOST container to manage OpenXR through. More...

#include <GHOST_XrContext.hh>

Inherits GHOST_IXrContext.

Public Member Functions

Session management

Manage session lifetime and delegate public calls to GHOST_XrSession.

void startSession (const GHOST_XrSessionBeginInfo *begin_info) override
 
void endSession () override
 
bool isSessionRunning () const override
 
void drawSessionViews (void *draw_customdata) override
 
void handleSessionStateChange (const XrEventDataSessionStateChanged &lifecycle)
 
Public Accessors and Mutators

Public as in, exposed in the Ghost API.

GHOST_XrSessiongetSession () override
 
const GHOST_XrSessiongetSession () const override
 
void setGraphicsContextBindFuncs (GHOST_XrGraphicsContextBindFn bind_fn, GHOST_XrGraphicsContextUnbindFn unbind_fn) override
 
void setDrawViewFunc (GHOST_XrDrawViewFn draw_view_fn) override
 
void setPassthroughEnabledFunc (GHOST_XrPassthroughEnabledFn passthrough_enabled_fn) override
 
void setDisablePassthroughFunc (GHOST_XrDisablePassthroughFn disable_passthrough_fn) override
 
bool needsUpsideDownDrawing () const override
 
Ghost Internal Accessors and Mutators
GHOST_TXrOpenXRRuntimeID getOpenXRRuntimeID () const
 
const GHOST_XrCustomFuncsgetCustomFuncs () const
 
GHOST_TXrGraphicsBinding getGraphicsBindingType () const
 
XrInstance getInstance () const
 
bool isDebugMode () const
 
bool isDebugTimeMode () const
 
bool isExtensionEnabled (const char *ext) const
 
- Public Member Functions inherited from GHOST_IXrContext
virtual ~GHOST_IXrContext ()=default
 

Create, Initialize and Destruct

 GHOST_XrContext (const GHOST_XrContextCreateInfo *create_info)
 
 ~GHOST_XrContext ()
 
void initialize (const GHOST_XrContextCreateInfo *create_info)
 

Error handling

void dispatchErrorMessage (const class GHOST_XrException *exception) const override
 
static void setErrorHandler (GHOST_XrErrorHandlerFn handler_fn, void *customdata)
 

Detailed Description

Main GHOST container to manage OpenXR through.

Creating a context using GHOST_XrContextCreate involves dynamically connecting to the OpenXR runtime, likely reading the OS OpenXR configuration (i.e. active_runtime.json). So this is something that should better be done using lazy-initialization.

Definition at line 60 of file GHOST_XrContext.hh.

Constructor & Destructor Documentation

◆ GHOST_XrContext()

GHOST_XrContext::GHOST_XrContext ( const GHOST_XrContextCreateInfo * create_info)

Definition at line 49 of file GHOST_XrContext.cc.

◆ ~GHOST_XrContext()

GHOST_XrContext::~GHOST_XrContext ( )

Definition at line 56 of file GHOST_XrContext.cc.

References CHECK_XR_ASSERT.

Member Function Documentation

◆ dispatchErrorMessage()

void GHOST_XrContext::dispatchErrorMessage ( const class GHOST_XrException * exception) const
overridevirtual

Implements GHOST_IXrContext.

Definition at line 248 of file GHOST_XrContext.cc.

References error(), and isDebugMode().

◆ drawSessionViews()

void GHOST_XrContext::drawSessionViews ( void * draw_customdata)
overridevirtual

Implements GHOST_IXrContext.

Definition at line 549 of file GHOST_XrContext.cc.

◆ endSession()

void GHOST_XrContext::endSession ( )
overridevirtual

Implements GHOST_IXrContext.

Definition at line 532 of file GHOST_XrContext.cc.

◆ getCustomFuncs()

const GHOST_XrCustomFuncs & GHOST_XrContext::getCustomFuncs ( ) const

◆ getGraphicsBindingType()

GHOST_TXrGraphicsBinding GHOST_XrContext::getGraphicsBindingType ( ) const

Definition at line 634 of file GHOST_XrContext.cc.

Referenced by GHOST_XrSession::start().

◆ getInstance()

◆ getOpenXRRuntimeID()

GHOST_TXrOpenXRRuntimeID GHOST_XrContext::getOpenXRRuntimeID ( ) const

Definition at line 624 of file GHOST_XrContext.cc.

◆ getSession() [1/2]

const GHOST_XrSession * GHOST_XrContext::getSession ( ) const
overridevirtual

Implements GHOST_IXrContext.

Definition at line 579 of file GHOST_XrContext.cc.

◆ getSession() [2/2]

GHOST_XrSession * GHOST_XrContext::getSession ( )
overridevirtual

Needed for the GHOST C api.

Implements GHOST_IXrContext.

Definition at line 574 of file GHOST_XrContext.cc.

◆ handleSessionStateChange()

void GHOST_XrContext::handleSessionStateChange ( const XrEventDataSessionStateChanged & lifecycle)

Delegates event to session, allowing context to destruct the session if needed.

Definition at line 557 of file GHOST_XrContext.cc.

References GHOST_XrSession::SESSION_DESTROY.

Referenced by GHOST_XrEventsHandle().

◆ initialize()

void GHOST_XrContext::initialize ( const GHOST_XrContextCreateInfo * create_info)

Definition at line 72 of file GHOST_XrContext.cc.

References isDebugMode().

◆ isDebugMode()

bool GHOST_XrContext::isDebugMode ( ) const

◆ isDebugTimeMode()

bool GHOST_XrContext::isDebugTimeMode ( ) const

Definition at line 649 of file GHOST_XrContext.cc.

◆ isExtensionEnabled()

bool GHOST_XrContext::isExtensionEnabled ( const char * ext) const

Definition at line 654 of file GHOST_XrContext.cc.

Referenced by GHOST_XrSession::loadControllerModel().

◆ isSessionRunning()

bool GHOST_XrContext::isSessionRunning ( ) const
overridevirtual

Implements GHOST_IXrContext.

Definition at line 544 of file GHOST_XrContext.cc.

◆ needsUpsideDownDrawing()

bool GHOST_XrContext::needsUpsideDownDrawing ( ) const
overridevirtual

Implements GHOST_IXrContext.

Definition at line 611 of file GHOST_XrContext.cc.

◆ setDisablePassthroughFunc()

void GHOST_XrContext::setDisablePassthroughFunc ( GHOST_XrDisablePassthroughFn disable_passthrough_fn)
overridevirtual

Implements GHOST_IXrContext.

Definition at line 605 of file GHOST_XrContext.cc.

References GHOST_XrCustomFuncs::disable_passthrough_fn.

◆ setDrawViewFunc()

void GHOST_XrContext::setDrawViewFunc ( GHOST_XrDrawViewFn draw_view_fn)
overridevirtual

Implements GHOST_IXrContext.

Definition at line 594 of file GHOST_XrContext.cc.

References GHOST_XrCustomFuncs::draw_view_fn.

◆ setErrorHandler()

void GHOST_XrContext::setErrorHandler ( GHOST_XrErrorHandlerFn handler_fn,
void * customdata )
static

Definition at line 266 of file GHOST_XrContext.cc.

Referenced by GHOST_XrErrorHandler().

◆ setGraphicsContextBindFuncs()

void GHOST_XrContext::setGraphicsContextBindFuncs ( GHOST_XrGraphicsContextBindFn bind_fn,
GHOST_XrGraphicsContextUnbindFn unbind_fn )
overridevirtual

◆ setPassthroughEnabledFunc()

void GHOST_XrContext::setPassthroughEnabledFunc ( GHOST_XrPassthroughEnabledFn passthrough_enabled_fn)
overridevirtual

Implements GHOST_IXrContext.

Definition at line 599 of file GHOST_XrContext.cc.

References GHOST_XrCustomFuncs::passthrough_enabled_fn.

◆ startSession()

void GHOST_XrContext::startSession ( const GHOST_XrSessionBeginInfo * begin_info)
overridevirtual

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