The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

xrt: Add visibility mask interface

authored by

Jakob Bornecrantz and committed by
Simon Zeni
69afb627 a77e35fd

+89
+12
src/xrt/include/xrt/xrt_defines.h
··· 1293 1293 XRT_FORM_FACTOR_HANDHELD, //!< Handheld display. 1294 1294 }; 1295 1295 1296 + /*! 1297 + * Visibility mask, mirror of XrVisibilityMaskKHR 1298 + * 1299 + * @ingroup xrt_iface 1300 + */ 1301 + enum xrt_visibility_mask_type 1302 + { 1303 + XRT_VISIBILITY_MASK_TYPE_HIDDEN_TRIANGLE_MESH = 1, 1304 + XRT_VISIBILITY_MASK_TYPE_VISIBLE_TRIANGLE_MESH = 2, 1305 + XRT_VISIBILITY_MASK_TYPE_LINE_LOOP = 3, 1306 + }; 1307 + 1296 1308 #ifdef __cplusplus 1297 1309 } 1298 1310 #endif
+8
src/xrt/include/xrt/xrt_device.h
··· 11 11 #pragma once 12 12 13 13 #include "xrt/xrt_defines.h" 14 + #include "xrt/xrt_visibility_mask.h" 14 15 15 16 16 17 #ifdef __cplusplus ··· 395 396 */ 396 397 bool (*compute_distortion)( 397 398 struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result); 399 + 400 + /*! 401 + * Get the visibility mask for this device. 402 + */ 403 + void (*get_visibility_mask)(struct xrt_device *xdev, 404 + enum xrt_visibility_mask_type type, 405 + struct xrt_visibility_mask **out_mask); 398 406 399 407 /*! 400 408 * Destroy device.
+69
src/xrt/include/xrt/xrt_visibility_mask.h
··· 1 + // Copyright 2023, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Header defining visibility mask helper struct. 6 + * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @ingroup xrt_iface 8 + */ 9 + 10 + #pragma once 11 + 12 + #include "xrt/xrt_defines.h" 13 + 14 + #ifdef __cplusplus 15 + extern "C" { 16 + #endif 17 + 18 + /*! 19 + * Visibility mask helper, the indices and vertices are tightly packed after 20 + * this struct. 21 + * 22 + * @ingroup xrt_iface 23 + */ 24 + struct xrt_visibility_mask 25 + { 26 + enum xrt_visibility_mask_type type; 27 + uint32_t index_count; 28 + uint32_t vertex_count; 29 + }; 30 + 31 + /*! 32 + * Visibility mask helper function to get the indices. 33 + * 34 + * @ingroup xrt_iface 35 + */ 36 + static inline uint32_t * 37 + xrt_visibility_mask_get_indices(const struct xrt_visibility_mask *mask) 38 + { 39 + return (uint32_t *)&mask[1]; 40 + } 41 + 42 + /*! 43 + * Visibility mask helper function to get the vertices. 44 + * 45 + * @ingroup xrt_iface 46 + */ 47 + static inline struct xrt_vec2 * 48 + xrt_visibility_mask_get_vertices(const struct xrt_visibility_mask *mask) 49 + { 50 + const uint32_t *indices = xrt_visibility_mask_get_indices(mask); 51 + return (struct xrt_vec2 *)&indices[mask->index_count]; 52 + } 53 + 54 + /*! 55 + * Visibility mask helper function to get the total size of the struct. 56 + * 57 + * @ingroup xrt_iface 58 + */ 59 + static inline size_t 60 + xrt_visibility_mask_get_size(const struct xrt_visibility_mask *mask) 61 + { 62 + return sizeof(*mask) + // 63 + sizeof(uint32_t) * mask->index_count + // 64 + sizeof(struct xrt_vec2) * mask->vertex_count; // 65 + } 66 + 67 + #ifdef __cplusplus 68 + } 69 + #endif