mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 19:16:21 +00:00
a/vive: Add tweaks for FoV values
This commit is contained in:
parent
7b691ccab7
commit
9f5e8963a9
|
@ -11,6 +11,8 @@ add_library(
|
|||
vive_config.c
|
||||
vive_poses.h
|
||||
vive_poses.c
|
||||
vive_tweaks.c
|
||||
vive_tweaks.h
|
||||
)
|
||||
target_link_libraries(
|
||||
aux_vive
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "tracking/t_tracking.h"
|
||||
|
||||
#include "vive_config.h"
|
||||
#include "vive_tweaks.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -381,6 +382,9 @@ _calculate_fov(struct vive_config *d)
|
|||
}
|
||||
}
|
||||
|
||||
// Apply any tweaks to the FoV.
|
||||
vive_tweak_fov(d);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
77
src/xrt/auxiliary/vive/vive_tweaks.c
Normal file
77
src/xrt/auxiliary/vive/vive_tweaks.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Copyright 2023, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Tweaks for various bits on Vive and Index headsets.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup drv_vive
|
||||
*/
|
||||
|
||||
#include "xrt/xrt_defines.h"
|
||||
|
||||
#include "vive_config.h"
|
||||
#include "vive_tweaks.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Tweaks for FOV.
|
||||
*
|
||||
*/
|
||||
|
||||
struct fov_entry
|
||||
{
|
||||
const char *device_serial_number;
|
||||
const struct xrt_fov fovs[2];
|
||||
};
|
||||
|
||||
static const struct fov_entry fovs[1] = {
|
||||
{
|
||||
.device_serial_number = "LHR-4DC3ADD6",
|
||||
.fovs =
|
||||
{
|
||||
{
|
||||
.angle_left = -0.907983,
|
||||
.angle_right = 0.897738,
|
||||
.angle_up = 0.954823,
|
||||
.angle_down = -0.953044,
|
||||
},
|
||||
{
|
||||
|
||||
.angle_left = -0.897050,
|
||||
.angle_right = 0.908661,
|
||||
.angle_up = 0.954474,
|
||||
.angle_down = -0.953057,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* 'Exported' functions.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
vive_tweak_fov(struct vive_config *config)
|
||||
{
|
||||
const char *device_serial_number = config->firmware.device_serial_number;
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(fovs); i++) {
|
||||
const struct fov_entry *e = &fovs[i];
|
||||
|
||||
if (strcmp(device_serial_number, e->device_serial_number) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
U_LOG_I("Applying FoV tweaks to device serial '%s'", device_serial_number);
|
||||
|
||||
config->distortion.fov[0] = e->fovs[0];
|
||||
config->distortion.fov[1] = e->fovs[1];
|
||||
}
|
||||
}
|
33
src/xrt/auxiliary/vive/vive_tweaks.h
Normal file
33
src/xrt/auxiliary/vive/vive_tweaks.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2023, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Tweaks for various bits on Vive and Index headsets.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup drv_vive
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "xrt/xrt_compiler.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct vive_config;
|
||||
|
||||
|
||||
/*!
|
||||
* Tweak the fov for the views on the given config, to make it better.
|
||||
*
|
||||
* @ingroup drv_vive
|
||||
*/
|
||||
void
|
||||
vive_tweak_fov(struct vive_config *config);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
Loading…
Reference in a new issue