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 dependency graph for rift_distortion.c:

Macros

#define HMD_TRACE(hmd, ...)   U_LOG_XDEV_IFL_T(&hmd->base, hmd->log_level, __VA_ARGS__)
 
#define HMD_DEBUG(hmd, ...)   U_LOG_XDEV_IFL_D(&hmd->base, hmd->log_level, __VA_ARGS__)
 
#define HMD_INFO(hmd, ...)   U_LOG_XDEV_IFL_I(&hmd->base, hmd->log_level, __VA_ARGS__)
 
#define HMD_WARN(hmd, ...)   U_LOG_XDEV_IFL_W(&hmd->base, hmd->log_level, __VA_ARGS__)
 
#define HMD_ERROR(hmd, ...)   U_LOG_XDEV_IFL_E(&hmd->base, hmd->log_level, __VA_ARGS__)
 
#define TO_NDC(x)   ((x * 2) - 1)
 

Functions

static float rift_catmull_rom_spline (struct rift_catmull_rom_distortion_data *catmull, float scaled_value)
 
static float rift_distortion_distance_scale_squared (struct rift_lens_distortion *lens_distortion, float distance_squared)
 
struct xrt_vec3 rift_distortion_distance_scale_squared_split_chroma (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 (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, struct rift_distortion_render_info *distortion)
 
static struct rift_viewport_fov_tan rift_get_physical_screen_fov (struct rift_distortion_render_info *distortion)
 
static struct rift_viewport_fov_tan rift_clamp_fov_to_physical_screen_fov (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, struct rift_distortion_render_info *distortion, uint32_t view)
 
struct rift_scale_and_offset rift_calculate_ndc_scale_and_offset_from_fov (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 (struct rift_distortion_render_info *distortion, struct xrt_vec2 screen_ndc)
 
bool 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)
 

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