Monado OpenXR Runtime
svr_hmd.c File Reference

SimulaVR driver code. More...

#include "math/m_mathinclude.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "svr_interface.h"
#include "xrt/xrt_defines.h"
#include "xrt/xrt_device.h"
#include "math/m_api.h"
#include "math/m_space.h"
#include "math/m_vec2.h"
#include "os/os_time.h"
#include "os/os_threading.h"
#include "util/u_var.h"
#include "util/u_debug.h"
#include "util/u_device.h"
#include "util/u_time.h"
#include "util/u_json.h"
#include "util/u_misc.h"
#include "util/u_logging.h"
#include "util/u_distortion_mesh.h"
Include dependency graph for svr_hmd.c:

Data Structures

struct  svr_hmd
 

Macros

#define SVR_TRACE(d, ...)   U_LOG_XDEV_IFL_T(&d->base, d->log_level, __VA_ARGS__)
 
#define SVR_DEBUG(d, ...)   U_LOG_XDEV_IFL_D(&d->base, d->log_level, __VA_ARGS__)
 
#define SVR_INFO(d, ...)   U_LOG_XDEV_IFL_I(&d->base, d->log_level, __VA_ARGS__)
 
#define SVR_WARN(d, ...)   U_LOG_XDEV_IFL_W(&d->base, d->log_level, __VA_ARGS__)
 
#define SVR_ERROR(d, ...)   U_LOG_XDEV_IFL_E(&d->base, d->log_level, __VA_ARGS__)
 
#define DEG_TO_RAD(DEG)   (DEG * M_PI / 180.)
 

Functions

static struct svr_hmdsvr_hmd (struct xrt_device *xdev)
 
static void svr_hmd_destroy (struct xrt_device *xdev)
 
static void svr_hmd_get_tracked_pose (struct xrt_device *xdev, enum xrt_input_name name, uint64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
static void svr_hmd_get_view_poses (struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, uint64_t at_timestamp_ns, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses)
 
bool svr_mesh_calc (struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *result)
 
struct xrt_devicesvr_hmd_create (struct svr_two_displays_distortion *distortion)
 

Detailed Description

SimulaVR driver code.

Author
Moses Turner moses.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ svr_hmd_create()

struct xrt_device* svr_hmd_create ( struct svr_two_displays_distortion distortion)
Todo:
these should be true for the final product iirc but possibly not for the demo unit

◆ svr_hmd_get_view_poses()

static void svr_hmd_get_view_poses ( struct xrt_device xdev,
const struct xrt_vec3 default_eye_relation,
uint64_t  at_timestamp_ns,
uint32_t  view_count,
struct xrt_space_relation out_head_relation,
struct xrt_fov out_fovs,
struct xrt_pose out_poses 
)
static
Todo:
: default_eye_relation inherits from the env var OXR_DEBUG_IPD_MM / oxr_session.c
Todo:
you may need to invert this - I can't test locally

References xrt_quat::math_quat_from_angle_vector(), u_device_get_view_poses(), and xrt_vec3::XRT_VEC3_UNIT_Y.

◆ svr_mesh_calc()

bool svr_mesh_calc ( struct xrt_device xdev,
uint32_t  view,
float  u,
float  v,
struct xrt_uv_triplet result 
)
Todo:
: remove hard-coding and move to u_distortion_mesh