diff options
author | Peter Kim <pk15950@gmail.com> | 2021-10-12 10:18:05 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2021-10-12 10:18:05 +0300 |
commit | 9dda65455b54336fe3efef91eba9e41866dac1c1 (patch) | |
tree | 2f8fd6edf8d190e018b63c6b6bdacb38ab7905bd /intern/ghost/GHOST_Types.h | |
parent | cfa59b3fabe729e49a57154ce21c5a4b88aa5812 (diff) |
XR Controller Support Step 4: Controller Drawing
Addresses T77127 (Controller Drawing).
Adds VR controller visualization and custom drawing via draw
handlers. Add-ons can draw to the XR surface (headset display) and
mirror window by adding a View3D draw handler of region type 'XR' and
draw type 'POST_VIEW'. Controller drawing and custom overlays can be
toggled individually as XR session options, which will be added in a
future update to the VR Scene Inspection add-on.
For the actual drawing, the OpenXR XR_MSFT_controller_model extension
is used to load a glTF model provided by the XR runtime. The model's
vertex data is then used to create a GPUBatch in the XR session
state. Finally, this batch is drawn via the XR surface draw handler
mentioned above.
For runtimes that do not support the controller model extension, a
a simple fallback shape (sphere) is drawn instead.
Reviewed By: Severin, fclem
Differential Revision: https://developer.blender.org/D10948
Diffstat (limited to 'intern/ghost/GHOST_Types.h')
-rw-r--r-- | intern/ghost/GHOST_Types.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index 898ee451baf..2c8014a08cc 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -754,8 +754,31 @@ typedef struct GHOST_XrActionProfileInfo { const char *profile_path; uint32_t count_subaction_paths; const char **subaction_paths; - /* Bindings for each subaction path. */ + /** Bindings for each subaction path. */ const GHOST_XrActionBindingInfo *bindings; } GHOST_XrActionProfileInfo; +typedef struct GHOST_XrControllerModelVertex { + float position[3]; + float normal[3]; +} GHOST_XrControllerModelVertex; + +typedef struct GHOST_XrControllerModelComponent { + /** World space transform. */ + float transform[4][4]; + uint32_t vertex_offset; + uint32_t vertex_count; + uint32_t index_offset; + uint32_t index_count; +} GHOST_XrControllerModelComponent; + +typedef struct GHOST_XrControllerModelData { + uint32_t count_vertices; + const GHOST_XrControllerModelVertex *vertices; + uint32_t count_indices; + const uint32_t *indices; + uint32_t count_components; + const GHOST_XrControllerModelComponent *components; +} GHOST_XrControllerModelData; + #endif /* WITH_XR_OPENXR */ |