Blender
V3.3
intern
ghost
intern
GHOST_XrEvent.cpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later */
2
7
#include <iostream>
8
9
#include "
GHOST_C-api.h
"
10
#include "
GHOST_XrContext.h
"
11
#include "
GHOST_Xr_intern.h
"
12
13
static
bool
GHOST_XrEventPollNext
(XrInstance
instance
, XrEventDataBuffer &r_event_data)
14
{
15
/* (Re-)initialize as required by specification. */
16
r_event_data.type = XR_TYPE_EVENT_DATA_BUFFER;
17
r_event_data.next =
nullptr
;
18
19
return
(xrPollEvent(
instance
, &r_event_data) == XR_SUCCESS);
20
}
21
22
GHOST_TSuccess
GHOST_XrEventsHandle
(GHOST_XrContextHandle xr_contexthandle)
23
{
24
if
(xr_contexthandle ==
nullptr
) {
25
return
GHOST_kFailure
;
26
}
27
28
GHOST_XrContext
&xr_context = *(
GHOST_XrContext
*)xr_contexthandle;
29
XrEventDataBuffer event_buffer;
/* Structure big enough to hold all possible events. */
30
31
while
(
GHOST_XrEventPollNext
(xr_context.
getInstance
(), event_buffer)) {
32
XrEventDataBaseHeader *
event
= (XrEventDataBaseHeader *)&event_buffer;
33
34
switch
(event->type) {
35
case
XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED:
36
xr_context.
handleSessionStateChange
((XrEventDataSessionStateChanged &)*event);
37
return
GHOST_kSuccess
;
38
case
XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING:
39
GHOST_XrContextDestroy
(xr_contexthandle);
40
return
GHOST_kSuccess
;
41
default
:
42
if
(xr_context.
isDebugMode
()) {
43
printf(
"Unhandled event: %i\n"
, event->type);
44
}
45
return
GHOST_kFailure
;
46
}
47
}
48
49
return
GHOST_kFailure
;
50
}
GHOST_C-api.h
GHOST C-API function and type declarations.
GHOST_TSuccess
GHOST_TSuccess
Definition:
GHOST_Types.h:74
GHOST_kFailure
@ GHOST_kFailure
Definition:
GHOST_Types.h:74
GHOST_kSuccess
@ GHOST_kSuccess
Definition:
GHOST_Types.h:74
GHOST_XrContext.h
GHOST_XrEventPollNext
static bool GHOST_XrEventPollNext(XrInstance instance, XrEventDataBuffer &r_event_data)
Definition:
GHOST_XrEvent.cpp:13
GHOST_XrEventsHandle
GHOST_TSuccess GHOST_XrEventsHandle(GHOST_XrContextHandle xr_contexthandle)
Definition:
GHOST_XrEvent.cpp:22
GHOST_XrContextDestroy
void GHOST_XrContextDestroy(GHOST_XrContextHandle xr_contexthandle)
Definition:
GHOST_Xr.cpp:36
GHOST_Xr_intern.h
instance
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object instance
Definition:
NOD_static_types.h:83
GHOST_XrContext
Main GHOST container to manage OpenXR through.
Definition:
GHOST_XrContext.h:52
GHOST_XrContext::getInstance
XrInstance getInstance() const
Definition:
GHOST_XrContext.cpp:616
GHOST_XrContext::handleSessionStateChange
void handleSessionStateChange(const XrEventDataSessionStateChanged &lifecycle)
Definition:
GHOST_XrContext.cpp:547
GHOST_XrContext::isDebugMode
bool isDebugMode() const
Definition:
GHOST_XrContext.cpp:621
Generated on Tue Oct 22 2024 13:18:25 for Blender by
doxygen
1.9.1