cgv
Loading...
Searching...
No Matches
vr_emulated_kit Class Reference
Inheritance diagram for vr_emulated_kit:
vr::vr_kit vr::gl_vr_display

Public Member Functions

 vr_emulated_kit (float _body_direction, const cgv::vec3 &_body_position, float _body_height, unsigned _width, unsigned _height, vr::vr_driver *_driver, void *_handle, const std::string &_name, int _nr_trackers)
 
cgv::vec3 get_body_direction () const
 
const std::vector< std::pair< int, int > > & get_controller_throttles_and_sticks (int controller_index) const
 
const std::vector< std::pair< float, float > > & get_controller_throttles_and_sticks_deadzone_and_precision (int controller_index) const
 
bool set_vibration (unsigned controller_index, float low_frequency_strength, float high_frequency_strength)
 set the vibration strength between 0 and 1 of low and high frequency motors, return false if device is not connected anymore
 
void put_eye_to_head_matrix (int eye, float *pose_matrix) const
 access to 3x4 matrix in column major format for transformation from eye (0..left, 1..right) to head coordinates
 
void put_projection_matrix (int eye, float z_near, float z_far, float *projection_matrix, const float *hmd_pose) const
 access to 4x4 matrix in column major format for perspective transformation from eye (0..left, 1..right)
 
void submit_frame ()
 submit the rendered stereo frame to the hmd
 
- Public Member Functions inherited from vr::vr_kit
const vr_driverget_driver () const
 return driver
 
void * get_handle () const
 return handle of vr kit
 
vr_cameraget_camera () const
 return camera or nullptr if not available
 
const std::string & get_name () const
 return name of vr_kit
 
virtual ~vr_kit ()
 declare virtual destructor
 
const vr_kit_infoget_device_info () const
 return information on the currently attached devices
 
virtual void set_controller_input_config (int controller_index, int input_index, const controller_input_config &cic)
 set the configuration of a controller input
 
const controller_input_configget_controller_input_config (int controller_index, int input_index) const
 query the configuration of a controller input
 
bool query_state (vr_kit_state &state, int pose_query=2)
 query current state of vr kit and return whether this was successful
 
virtual void put_world_to_eye_transform (int eye, const float *hmd_pose, float *modelview_matrix) const
 access to 4x4 modelview transformation matrix of given eye in column major format, which is computed in default implementation from given 3x4 pose matrix and eye to head transformation
 
- Public Member Functions inherited from vr::gl_vr_display
 gl_vr_display (unsigned _width, unsigned _height, unsigned _nr_multi_samples)
 construct
 
virtual ~gl_vr_display ()
 declare virtual destructor
 
const std::string & get_last_error () const
 return last error of vr_kit
 
int get_width () const
 return width in pixel of view
 
int get_height () const
 return height in pixel of view
 
virtual void set_size (int new_width, int new_height)
 allow to set a different size
 
virtual bool init_fbos (EyeSelection es=ES_BOTH)
 initialize render targets and framebuffer objects in current opengl context
 
virtual bool blit_fbo (int eye, int x, int y, int w, int h)
 initialize render targets and framebuffer objects in current opengl context
 
virtual bool fbos_initialized (EyeSelection es=ES_BOTH) const
 check whether fbos have been initialized
 
virtual void destruct_fbos (EyeSelection es=ES_BOTH)
 destruct render targets and framebuffer objects in current opengl context
 
virtual void enable_fbo (int eye)
 enable the framebuffer object of given eye (0..left, 1..right)
 
virtual void disable_fbo (int eye)
 disable the framebuffer object of given eye
 
virtual void bind_texture (int eye)
 bind texture of given eye to current texture unit
 

Protected Types

typedef cgv::math::quaternion< float > quat
 

Protected Member Functions

cgv::mat3x4 construct_pos_matrix (const quat &orientation, const cgv::vec3 &position)
 helper functions to construct matrices
 
cgv::mat4 construct_homogeneous_matrix (const quat &orientation, const cgv::vec3 &position)
 
void set_pose_matrix (const cgv::mat4 &H, float *pose) const
 
void compute_state_poses ()
 
bool query_state_impl (vr::vr_kit_state &state, int pose_query=2)
 derived kits implement this without caring about calibration; vr_kit::query_state() will apply driver calibration
 
- Protected Member Functions inherited from vr::vr_kit
void destruct_camera ()
 destruct camera
 
vr_trackable_stateref_tracking_reference_state (const std::string &serial_nummer)
 write access to the state of the tracking reference with given serial number
 
vr_tracking_system_inforef_tracking_system_info ()
 write access to tracking system info
 
void clear_tracking_reference_states ()
 remove all reference states
 
void mark_tracking_references_as_untracked ()
 mark all reference states as untracked
 
 vr_kit (vr_driver *_driver, void *_handle, const std::string &_name, unsigned _width, unsigned _height, unsigned _nr_multi_samples=4)
 construct
 

Protected Attributes

vr::vr_kit_state state
 
float body_direction
 
float body_height
 
float hip_parameter
 
float yaw_parameter
 
float fovy
 
cgv::vec3 body_position
 
cgv::vec3 hand_position [2]
 
quat hand_orientation [2]
 
cgv::vec3 tracker_positions [4]
 
quat tracker_orientations [4]
 
bool tracker_enabled [4]
 
TrackerAttachment tracker_attachments [4]
 
- Protected Attributes inherited from vr::vr_kit
vr_driverdriver
 pointer to driver that created the vr kit
 
void * handle
 handle for internal use
 
vr_cameracamera
 pointer to camera
 
bool skip_calibration
 whether to skip driver calibration - defaults to false
 
std::string name
 name in case driver provides this information (not reliable)
 
vr_kit_info info
 store vr kit info to be filled and updated by driver implementations
 
controller_input_config input_configs [4][5]
 store controller input configs per controller and input
 
- Protected Attributes inherited from vr::gl_vr_display
unsigned width
 pixel dimensions of render targets
 
unsigned height
 
unsigned nr_multi_samples
 
unsigned multi_depth_buffer_id [2]
 ids of gl render objects
 
unsigned multi_tex_id [2]
 
unsigned multi_fbo_id [2]
 
unsigned tex_id [2]
 
unsigned fbo_id [2]
 
std::string last_error
 store last error message
 

Friends

class vr_emulator
 

Detailed Description

Definition at line 30 of file vr_emulator.h.

Member Typedef Documentation

◆ quat

typedef cgv::math::quaternion<float> vr_emulated_kit::quat
protected

Definition at line 35 of file vr_emulator.h.

Constructor & Destructor Documentation

◆ vr_emulated_kit()

vr_emulated_kit::vr_emulated_kit ( float  _body_direction,
const cgv::vec3 _body_position,
float  _body_height,
unsigned  _width,
unsigned  _height,
vr::vr_driver _driver,
void *  _handle,
const std::string &  _name,
int  _nr_trackers 
)

Definition at line 118 of file vr_emulator.cxx.

Member Function Documentation

◆ compute_state_poses()

void vr_emulated_kit::compute_state_poses ( )
protected

Definition at line 61 of file vr_emulator.cxx.

◆ construct_homogeneous_matrix()

cgv::mat4 vr_emulated_kit::construct_homogeneous_matrix ( const quat orientation,
const cgv::vec3 position 
)
protected

Definition at line 39 of file vr_emulator.cxx.

◆ construct_pos_matrix()

cgv::mat3x4 vr_emulated_kit::construct_pos_matrix ( const quat orientation,
const cgv::vec3 position 
)
protected

helper functions to construct matrices

Definition at line 27 of file vr_emulator.cxx.

References cgv::math::fmat< T, N, M >::col(), cgv::math::quaternion< T >::put_matrix(), and cgv::math::fmat< T, N, M >::set_col().

◆ get_body_direction()

cgv::vec3 vr_emulated_kit::get_body_direction ( ) const

Definition at line 51 of file vr_emulator.cxx.

◆ get_controller_throttles_and_sticks()

const std::vector< std::pair< int, int > > & vr_emulated_kit::get_controller_throttles_and_sticks ( int  controller_index) const

Definition at line 179 of file vr_emulator.cxx.

◆ get_controller_throttles_and_sticks_deadzone_and_precision()

const std::vector< std::pair< float, float > > & vr_emulated_kit::get_controller_throttles_and_sticks_deadzone_and_precision ( int  controller_index) const

Definition at line 191 of file vr_emulator.cxx.

◆ put_eye_to_head_matrix()

void vr_emulated_kit::put_eye_to_head_matrix ( int  eye,
float *  pose_matrix 
) const
virtual

access to 3x4 matrix in column major format for transformation from eye (0..left, 1..right) to head coordinates

Implements vr::vr_kit.

Definition at line 242 of file vr_emulator.cxx.

◆ put_projection_matrix()

void vr_emulated_kit::put_projection_matrix ( int  eye,
float  z_near,
float  z_far,
float *  projection_matrix,
const float *  hmd_pose 
) const
virtual

access to 4x4 matrix in column major format for perspective transformation from eye (0..left, 1..right)

pose matrix is not needed for most vr kits and can be set to nullptr; only in case of wall based vr kits the pose matrix needs to be specified

Implements vr::vr_kit.

Definition at line 252 of file vr_emulator.cxx.

References vr::gl_vr_display::width.

◆ query_state_impl()

bool vr_emulated_kit::query_state_impl ( vr::vr_kit_state state,
int  pose_query = 2 
)
protectedvirtual

derived kits implement this without caring about calibration; vr_kit::query_state() will apply driver calibration

Implements vr::vr_kit.

Definition at line 218 of file vr_emulator.cxx.

References vr::vr_kit_state::controller, vr::vr_kit::get_driver(), vr::vr_kit_state::hmd, vr::vr_trackable_state::pose, and cgv::math::quaternion< T >::put_matrix().

◆ set_pose_matrix()

void vr_emulated_kit::set_pose_matrix ( const cgv::mat4 H,
float *  pose 
) const
protected

Definition at line 202 of file vr_emulator.cxx.

◆ set_vibration()

bool vr_emulated_kit::set_vibration ( unsigned  controller_index,
float  low_frequency_strength,
float  high_frequency_strength 
)
virtual

set the vibration strength between 0 and 1 of low and high frequency motors, return false if device is not connected anymore

Implements vr::vr_kit.

Definition at line 235 of file vr_emulator.cxx.

References vr::vr_kit_state::controller, vr::vr_kit_info::force_feedback_support, vr::vr_kit::info, and vr::vr_controller_state::vibration.

◆ submit_frame()

void vr_emulated_kit::submit_frame ( )
virtual

submit the rendered stereo frame to the hmd

Implements vr::vr_kit.

Definition at line 258 of file vr_emulator.cxx.

Friends And Related Symbol Documentation

◆ vr_emulator

friend class vr_emulator
friend

Definition at line 33 of file vr_emulator.h.

Member Data Documentation

◆ body_direction

float vr_emulated_kit::body_direction
protected

Definition at line 36 of file vr_emulator.h.

◆ body_height

float vr_emulated_kit::body_height
protected

Definition at line 37 of file vr_emulator.h.

◆ body_position

cgv::vec3 vr_emulated_kit::body_position
protected

Definition at line 41 of file vr_emulator.h.

◆ fovy

float vr_emulated_kit::fovy
protected

Definition at line 40 of file vr_emulator.h.

◆ hand_orientation

quat vr_emulated_kit::hand_orientation[2]
protected

Definition at line 44 of file vr_emulator.h.

◆ hand_position

cgv::vec3 vr_emulated_kit::hand_position[2]
protected

Definition at line 43 of file vr_emulator.h.

◆ hip_parameter

float vr_emulated_kit::hip_parameter
protected

Definition at line 38 of file vr_emulator.h.

◆ state

vr::vr_kit_state vr_emulated_kit::state
protected

Definition at line 34 of file vr_emulator.h.

◆ tracker_attachments

TrackerAttachment vr_emulated_kit::tracker_attachments[4]
protected

Definition at line 49 of file vr_emulator.h.

◆ tracker_enabled

bool vr_emulated_kit::tracker_enabled[4]
protected

Definition at line 48 of file vr_emulator.h.

◆ tracker_orientations

quat vr_emulated_kit::tracker_orientations[4]
protected

Definition at line 47 of file vr_emulator.h.

◆ tracker_positions

cgv::vec3 vr_emulated_kit::tracker_positions[4]
protected

Definition at line 46 of file vr_emulator.h.

◆ yaw_parameter

float vr_emulated_kit::yaw_parameter
protected

Definition at line 39 of file vr_emulator.h.


The documentation for this class was generated from the following files: