Monado OpenXR Runtime
vp2_config.h
Go to the documentation of this file.
1// Copyright 2025, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Code to parse and handle the Vive Pro 2 configuration data.
6 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
7 * @ingroup drv_vp2
8 */
9
10#pragma once
11
12#include "xrt/xrt_defines.h"
13
14#include <stdint.h>
15
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21
22enum vp2_distortion_model
23{
24 VP2_DISTORTION_MODEL_INVALID = 0,
25 VP2_DISTORTION_MODEL_TRADITIONAL_SIMPLE = 1,
26 VP2_DISTORTION_MODEL_TRADITIONAL_WITH_TANGENTIAL = 2,
27 VP2_DISTORTION_MODEL_NON_MODEL_SVR = 3,
28 VP2_DISTORTION_MODEL_RATIONAL = 4,
29 VP2_DISTORTION_MODEL_SECTIONAL = 5,
30 VP2_DISTORTION_MODEL_TANGENTIAL_WEIGHT = 6,
31 VP2_DISTORTION_MODEL_RADIAL_TANGENTIAL_PRISM = 7,
32 VP2_DISTORTION_MODEL_PRISM_WITH_PROGRESSIVE = 8,
33 VP2_DISTORTION_MODEL_STRENGTHEN_RADIAL = 9,
34 VP2_DISTORTION_MODEL_STRENGTHEN = 10,
35 VP2_DISTORTION_MODEL_STRENGTHEN_HIGH_ORDER = 11,
36 VP2_DISTORTION_MODEL_WVR_RADIAL = 12,
37 VP2_DISTORTION_MODEL_RADIAL_ROTATE_MODIFY = 13,
38};
39
41{
42 double k[13]; // radial
43 double p[6]; // tangential
44 double s[4]; // prism
45};
46
48{
49 double k[6];
50};
51
53{
54 double k[11];
55 double theta;
56};
57
59{
60 uint8_t major;
61 uint8_t minor;
62};
63
65{
66 struct xrt_matrix_3x3 post;
67 struct xrt_matrix_3x3 pre;
68 float max_radius;
69};
70
72{
73 struct xrt_vec2 center;
74 enum vp2_distortion_model model;
75
76 struct vp2_eye_coefficients coeffecients[3];
77
78 struct vp2_wvr_coefficients wvr[3];
79
80 struct vp2_modify_coefficients modify; // Only contains blue
81
82 double enlarge_ratio;
83 double grow_for_undistort[4];
84
85 struct xrt_matrix_3x3 intrinsics[2];
86
87 struct xrt_vec2_i32 resolution;
88 double scale;
89 double scale_ratio;
90
91 double normalized_radius;
92
93 struct vp2_distortion_version version;
94
95 struct vp2_warp_parameters warp;
96};
97
99{
100 struct
101 {
102 uint32_t eye_target_width_in_pixels;
103 uint32_t eye_target_height_in_pixels;
104 } device;
105
106 uint32_t direct_mode_edid_pid;
107 uint32_t direct_mode_edid_vid;
108
109 struct
110 {
111 struct vp2_eye_distortion eyes[2];
112
113 struct xrt_vec2_i32 resolution; // The resolution to use for distorting
114 } lens_correction;
115};
116
117enum vp2_distortion_model
118vp2_string_to_distortion_model(const char *model_str);
119
120bool
121vp2_config_parse(const char *config_data, size_t config_size, struct vp2_config *out_config);
122
123bool
124vp2_distort(struct vp2_config *config, int eye, const struct xrt_vec2 *in, struct xrt_uv_triplet *out_result);
125
126void
127vp2_get_fov(struct vp2_config *config, int eye, struct xrt_fov *out_fov);
128
129
130#ifdef __cplusplus
131}
132#endif
Definition: vp2_config.h:99
Definition: vp2_config.h:59
Definition: vp2_config.h:41
Definition: vp2_config.h:72
Definition: vp2_config.h:53
Definition: vp2_config.h:65
Definition: vp2_config.h:48
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.