Monado OpenXR Runtime
rift_distortion.c File Reference

Handles calculating the distortion profile for Oculus Rift devices. More...

#include "rift_distortion.h"
#include "math/m_vec2.h"
#include "math/m_vec3.h"
Include dependency graph for rift_distortion.c:

Macros

#define TO_NDC(x)   ((x * 2) - 1)
 

Functions

static float rift_catmull_rom_spline (const struct rift_catmull_rom_distortion_data *catmull, float scaled_value)
 
static float rift_distortion_distance_scale_squared (const struct rift_lens_distortion *lens_distortion, float distance_squared)
 
struct xrt_vec3 rift_distortion_distance_scale_squared_split_chroma (const struct rift_lens_distortion *lens_distortion, float distance_squared)
 
struct rift_distortion_render_info rift_get_distortion_render_info (struct rift_hmd *hmd, uint32_t view)
 
static struct rift_viewport_fov_tan rift_calculate_fov_from_eye_position (float eye_relief, float offset_to_right, float offset_downwards, float lens_diameter, float extra_eye_rotation)
 
static struct xrt_vec2 rift_transform_screen_ndc_to_tan_fov_space (const struct rift_distortion_render_info *distortion, struct xrt_vec2 screen_ndc)
 
static struct rift_viewport_fov_tan rift_fov_find_range (struct xrt_vec2 from, struct xrt_vec2 to, int num_steps, const struct rift_distortion_render_info *distortion)
 
static struct rift_viewport_fov_tan rift_get_physical_screen_fov (const struct rift_distortion_render_info *distortion)
 
static struct rift_viewport_fov_tan rift_clamp_fov_to_physical_screen_fov (const struct rift_distortion_render_info *distortion, struct rift_viewport_fov_tan fov_port)
 
struct rift_viewport_fov_tan rift_calculate_fov_from_hmd (struct rift_hmd *hmd, const struct rift_distortion_render_info *distortion, uint32_t view)
 
struct rift_scale_and_offset rift_calculate_ndc_scale_and_offset_from_fov (const struct rift_viewport_fov_tan *fov)
 
struct rift_scale_and_offset rift_calculate_uv_scale_and_offset_from_ndc_scale_and_offset (struct rift_scale_and_offset eye_to_source_ndc)
 
static struct xrt_uv_triplet rift_transform_screen_ndc_to_tan_fov_space_chroma (const struct rift_distortion_render_info *distortion, struct xrt_vec2 screen_ndc)
 
xrt_result_t rift_hmd_compute_distortion (struct xrt_device *dev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
 
void rift_fill_in_default_distortions (struct rift_hmd *hmd)
 

Variables

static const struct rift_lens_distortion DK2_DISTORTIONS []
 
static const struct rift_lens_distortion CV1_DISTORTIONS []
 

Detailed Description

Handles calculating the distortion profile for Oculus Rift devices.

Author
Beyley Cardellio ep1cm.nosp@m.1n10.nosp@m.n123@.nosp@m.gmai.nosp@m.l.com

Variable Documentation

◆ CV1_DISTORTIONS

const struct rift_lens_distortion CV1_DISTORTIONS[]
static
Initial value:
= {{
.distortion_version = RIFT_LENS_DISTORTION_LCSV_CATMULL_ROM_10_VERSION_1,
.eye_relief = 0.015f,
.data =
{
.lcsv_catmull_rom_10 =
{
.meters_per_tan_angle_at_center = 0.0438f,
.max_r = 1.0f,
.chromatic_abberation = {-0.008f, -0.005f, 0.015f, 0.005f},
.k =
{
1.000f,
1.0312999f,
1.0698f,
1.1155f,
1.173f,
1.2460001f,
1.336f,
1.457f,
1.630f,
1.900f,
2.3599999f,
},
},
},
}}