mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-27 09:01:46 +00:00
d/survive: Add vive ipd range
This commit is contained in:
parent
0efb008492
commit
c248670f2f
|
@ -21,6 +21,14 @@
|
|||
#define INDEX_MIN_IPD 0.058
|
||||
#define INDEX_MAX_IPD 0.07
|
||||
|
||||
// https://vr-compare.com/headset/htcvive
|
||||
// #define VIVE_MIN_IPD 0.061
|
||||
// #define VIVE_MAX_IPD 0.072
|
||||
|
||||
// steamvr goes from ~60 to 75
|
||||
#define VIVE_MIN_IPD 0.060
|
||||
#define VIVE_MAX_IPD 0.075
|
||||
|
||||
// arbitrary default values
|
||||
#define DEFAULT_HAPTIC_FREQ 150.0f
|
||||
#define MIN_HAPTIC_DURATION 0.05f
|
||||
|
|
|
@ -712,9 +712,27 @@ _process_hmd_button_event(struct survive_device *survive, const struct SurviveSi
|
|||
|
||||
if (e->axis_ids[i] == SURVIVE_AXIS_IPD) {
|
||||
float ipd = val;
|
||||
float range = INDEX_MAX_IPD - INDEX_MIN_IPD;
|
||||
|
||||
// arbitrary default values
|
||||
float max = 70;
|
||||
float min = 60;
|
||||
if (survive->hmd.config.variant == VIVE_VARIANT_INDEX) {
|
||||
max = INDEX_MAX_IPD;
|
||||
min = INDEX_MIN_IPD;
|
||||
} else if (survive->hmd.config.variant == VIVE_VARIANT_VIVE) {
|
||||
max = VIVE_MAX_IPD;
|
||||
min = VIVE_MIN_IPD;
|
||||
} else {
|
||||
if (!survive->hmd.use_default_ipd) {
|
||||
SURVIVE_WARN(survive,
|
||||
"No IPD range for this HMD, falling back to default");
|
||||
survive->hmd.use_default_ipd = true;
|
||||
}
|
||||
}
|
||||
|
||||
float range = max - min;
|
||||
ipd *= range;
|
||||
ipd += INDEX_MIN_IPD;
|
||||
ipd += min;
|
||||
survive->hmd.ipd = ipd;
|
||||
|
||||
// SURVIVE_DEBUG(survive, "ipd: %f meter", ipd);
|
||||
|
|
Loading…
Reference in a new issue