Monado OpenXR Runtime
Loading...
Searching...
No Matches
htc_config.h
Go to the documentation of this file.
1// Copyright 2025-2026, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Code to parse and handle the modern non-LH HTC configuration data.
6 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
7 * @ingroup aux_htc
8 */
9
10#pragma once
11
12#include "xrt/xrt_defines.h"
13
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19enum htc_distortion_model
20{
21 HTC_DISTORTION_MODEL_INVALID = 0,
22 HTC_DISTORTION_MODEL_TRADITIONAL_SIMPLE = 1,
23 HTC_DISTORTION_MODEL_TRADITIONAL_WITH_TANGENTIAL = 2,
24 HTC_DISTORTION_MODEL_NON_MODEL_SVR = 3,
25 HTC_DISTORTION_MODEL_RATIONAL = 4,
26 HTC_DISTORTION_MODEL_SECTIONAL = 5,
27 HTC_DISTORTION_MODEL_TANGENTIAL_WEIGHT = 6,
28 HTC_DISTORTION_MODEL_RADIAL_TANGENTIAL_PRISM = 7,
29 HTC_DISTORTION_MODEL_PRISM_WITH_PROGRESSIVE = 8,
30 HTC_DISTORTION_MODEL_STRENGTHEN_RADIAL = 9,
31 HTC_DISTORTION_MODEL_STRENGTHEN = 10,
32 HTC_DISTORTION_MODEL_STRENGTHEN_HIGH_ORDER = 11,
33 HTC_DISTORTION_MODEL_WVR_RADIAL = 12,
34 HTC_DISTORTION_MODEL_RADIAL_ROTATE_MODIFY = 13,
35};
36
38{
39 double k[13]; // radial
40 double p[6]; // tangential
41 double s[4]; // prism
42};
43
45{
46 double k[6];
47};
48
50{
51 double k[11];
52 double theta;
53};
54
56{
57 uint8_t major;
58 uint8_t minor;
59};
60
62{
63 struct xrt_matrix_3x3 post;
64 struct xrt_matrix_3x3 pre;
65 float max_radius;
66};
67
69{
70 struct xrt_vec2 center;
71 enum htc_distortion_model model;
72
73 struct htc_eye_coefficients coeffecients[3];
74
75 struct htc_wvr_coefficients wvr[3];
76
77 struct htc_modify_coefficients modify; // Only contains blue
78
79 double enlarge_ratio;
80 double grow_for_undistort[4];
81
82 struct xrt_matrix_3x3 intrinsics[2];
83
84 struct xrt_vec2_i32 resolution;
85 double scale;
86 double scale_ratio;
87
88 double normalized_radius;
89
90 struct htc_distortion_version version;
91
92 struct htc_warp_parameters warp;
93};
94
96{
97 struct
98 {
99 uint32_t eye_target_width_in_pixels;
100 uint32_t eye_target_height_in_pixels;
101 } device;
102
103 struct
104 {
105 struct htc_eye_distortion eyes[2];
106
107 struct xrt_vec2_i32 resolution; // The resolution to use for distorting
108 } lens_correction;
109};
110
111/*!
112 * Converts a string to an HTC distortion model enum value.
113 *
114 * @param model_str The string representation of the distortion model.
115 * @return The corresponding htc_distortion_model enum value, or HTC_DISTORTION_MODEL_INVALID if the string is
116 * unrecognized.
117 */
118enum htc_distortion_model
119htc_string_to_distortion_model(const char *model_str);
120
121bool
122htc_config_parse(const char *config_data, size_t config_size, struct htc_config *out_config);
123
124bool
125htc_config_compute_distortion(struct htc_config *config,
126 int eye,
127 const struct xrt_vec2 *in,
128 struct xrt_uv_triplet *out_result);
129
130void
131htc_config_get_fov(struct htc_config *config, int eye, struct xrt_fov *out_fov);
132
133#ifdef __cplusplus
134}
135#endif
enum htc_distortion_model htc_string_to_distortion_model(const char *model_str)
Converts a string to an HTC distortion model enum value.
Definition htc_config.cpp:781
Definition htc_config.h:96
Definition htc_config.h:56
Definition htc_config.h:38
Definition htc_config.h:69
Definition htc_config.h:50
Definition htc_config.h:62
Definition htc_config.h:45
Describes a projection matrix fov.
Definition xrt_defines.h:499
A tightly packed 3x3 matrix of floats.
Definition xrt_defines.h:546
Represents a uv triplet for distortion, basically just three xrt_vec2.
Definition xrt_defines.h:279
A 2 element vector with 32 bit integers.
Definition xrt_defines.h:362
A 2 element vector with single floats.
Definition xrt_defines.h:268
Common defines and enums for XRT.