Monado OpenXR Runtime
xrt_visibility_mask.h
Go to the documentation of this file.
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
15extern "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 */
25{
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 */
36static inline uint32_t *
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 */
47static inline struct xrt_vec2 *
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 */
59static inline size_t
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
xrt_visibility_mask_type
Visibility mask, mirror of XrVisibilityMaskKHR.
Definition: xrt_defines.h:1968
static size_t xrt_visibility_mask_get_size(const struct xrt_visibility_mask *mask)
Visibility mask helper function to get the total size of the struct.
Definition: xrt_visibility_mask.h:60
static struct xrt_vec2 * xrt_visibility_mask_get_vertices(const struct xrt_visibility_mask *mask)
Visibility mask helper function to get the vertices.
Definition: xrt_visibility_mask.h:48
static uint32_t * xrt_visibility_mask_get_indices(const struct xrt_visibility_mask *mask)
Visibility mask helper function to get the indices.
Definition: xrt_visibility_mask.h:37
A 2 element vector with single floats.
Definition: xrt_defines.h:250
Visibility mask helper, the indices and vertices are tightly packed after this struct.
Definition: xrt_visibility_mask.h:25
Common defines and enums for XRT.