cgv
|
extends the stereo view interactor for vr support More...
#include <vr_view_interactor.h>
Public Member Functions | |
vr event processing | |
cgv::gui::VREventTypeFlags | get_event_type_flags () const |
query the currently set event type flags | |
void | set_event_type_flags (cgv::gui::VREventTypeFlags flags) |
set the event type flags of to be emitted events | |
bool | vr_event_debugging_enabled () const |
check whether vr events are printed to the console window | |
void | enable_vr_event_debugging (bool enable=true) |
set whether vr events should be printed to the console window | |
const vr::vr_kit_state * | get_current_vr_state () const |
return a pointer to the state of the current vr kit | |
vr::vr_kit * | get_current_vr_kit () const |
return a pointer to the current vr kit | |
void | query_vr_states () |
vr viewing | |
dvec3 | get_view_dir_of_kit (int vr_kit_idx=-1) const |
query view direction of a vr kit More... | |
dvec3 | get_view_up_dir_of_kit (int vr_kit_idx=-1) const |
query view up direction of a vr kit More... | |
dvec3 | get_eye_of_kit (int eye=0, int vr_kit_idx=-1) const |
query the eye position of a vr kit. More... | |
vr rendering | |
bool | seperate_view_drawn () const |
check whether separate view is rendered | |
void | draw_separate_view (bool do_draw) |
set whether to draw separate view | |
bool | vr_kits_drawn () const |
check whether vr kits are drawn | |
void | draw_vr_kits (bool do_draw) |
set whether to draw vr kits More... | |
bool | action_zone_drawn () const |
check whether action zone is drawn | |
void | draw_action_zone (bool do_draw) |
whether to draw action zone | |
bool | blit_vr_views_enabled () const |
check whether vr views are blitted | |
void | enable_blit_vr_views (bool enable) |
enable vr view blitting | |
int | get_blit_vr_view_width () const |
return width of vr view blitting | |
void | set_blit_vr_view_width (int width) |
set the width with which vr views are blit | |
vr render process | |
int | get_rendered_eye () const |
return the currently rendered eye | |
vr::gl_vr_display * | get_rendered_display () const |
vr::vr_kit * | get_rendered_vr_kit () const |
void | on_set (void *member_ptr) |
void | stream_stats (std::ostream &) |
overload to show the content of this object | |
bool | init (cgv::render::context &ctx) |
void | clear (cgv::render::context &ctx) |
bool | handle_vr_events (cgv::gui::event &e) |
overload and implement this method to handle events More... | |
bool | handle (cgv::gui::event &e) |
overload and implement this method to handle events | |
void | stream_help (std::ostream &os) |
overload to stream help information to the given output stream | |
void | render_vr_kits (cgv::render::context &ctx) |
void | init_frame (cgv::render::context &) |
this method is called in one pass over all drawables before the draw method | |
void | draw_vr_kits (cgv::render::context &ctx) |
draw the vr kits in the current view | |
void | draw_action_zone (cgv::render::context &ctx) |
draw the action zone of the current vr kit | |
void | draw (cgv::render::context &) |
draw all | |
void | finish_frame (cgv::render::context &) |
this method is called in one pass over all drawables after drawing | |
void | after_finish (cgv::render::context &ctx) |
this method is called in one pass over all drawables after finish frame | |
bool | self_reflect (cgv::reflect::reflection_handler &srh) |
you must overload this for gui creation | |
void | create_gui () |
you must overload this for gui creation | |
Protected Member Functions | |
void | set_driver_calibration_matrix (vr_driver *driver, const float calibration_matrix[12]) const |
single point of write access to calibration transformation of vr drivers | |
Protected Attributes | |
head tracking | |
mat3 | head_tracker_orientation |
head orientation from tracker orientation | |
vec3 | head_tracker_position |
head position from tracker location | |
calibation of tracker coordinate system | |
the calibration affects the tracked poses as follows: mat3 rotation = cgv::math::rotate3<float>(tracking_rotation, vec3(0, 1, 0)); mat3 orientation_world = rotation * orientation_raw; vec3 position_world = rotation * (position_raw - tracking_rotation_origin) + tracking_origin; or more brief: O = R*Q; p = R*(q-q0) + o; p = R*(q-q0) + o; o = p - R*(q - q0); to identify the current focus point f in world coordinates with the raw tracker position q and the rotation origin also with q we compute q0 = q; o = p; Now rotation will happen around calibration point. | |
typedef cgv::math::fmat< float, 3, 4 > | mat34 |
float | tracking_rotation |
rotation angle around the y-axis | |
vec3 | tracking_rotation_origin |
location in tracking coordinate system around which rotation is defined | |
vec3 | tracking_origin |
origin of tracking coordinate system given in world coordinates | |
std::string | calibration_file_path |
path to calibration file | |
bool | separate_view |
whether the window shows a separate view onto the scene or the one of the current vr kit | |
bool | dont_render_kits |
whether to not render for kits | |
bool | blit_vr_views |
whether to blit in the views of the vr kits | |
int | blit_width |
float | blit_aspect_scale |
scale of aspect ratio used for blitting | |
int | none_separate_view |
selection of view of current hmd used in case of no separate view (1 ... left, 2 ... right, 3 ... both) | |
int | head_tracker |
int | rendered_eye |
vr::gl_vr_display * | rendered_display_ptr |
int | rendered_display_index |
cgv::gui::VREventTypeFlags | event_flags |
bool | debug_vr_events |
VRkitVisType | vis_type |
VRkitVisType | hmd_vis_type |
VRkitVisType | controller_vis_type |
VRkitVisType | tracker_vis_type |
VRkitVisType | base_vis_type |
bool | show_action_zone |
rgb | fence_color1 |
rgb | fence_color2 |
float | fence_frequency |
float | fence_line_width |
void * | current_vr_handle |
int | current_vr_handle_index |
std::string | kit_enum_definition |
std::vector< vr::vr_kit_state > | kit_states |
std::vector< void * > | new_kits |
std::vector< void * > | kits |
std::vector< void * > | old_kits |
int | pose_query |
type of pose query according to vr::vr_kit::query_state function's 2nd parameter | |
cgv::render::box_renderer | br |
cgv::render::surface_render_style | brs |
cgv::render::sphere_render_style | srs |
std::string | hmd_mesh_file_name |
std::string | controller_mesh_file_name |
std::string | tracker_mesh_file_name |
std::string | base_mesh_file_name |
float | mesh_scales [4] |
void | calibrate_driver () |
perform driver calibration | |
vr::vr_kit * | get_vr_kit_from_index (int i) const |
void | configure_kits () |
void | on_status_change (void *handle, int controller_index, vr::VRStatus old_status, vr::VRStatus new_status) |
virtual void | on_device_change (void *handle, bool attach) |
void | add_trackable_spheres (const float *pose, int i, std::vector< vec4 > &spheres, std::vector< rgb > &sphere_colors) |
helper to visualize pose with colored spheres | |
void | set_tracking_rotation (float tr) |
float | get_tracking_rotation () |
void | set_tracking_origin (vec3 ori) |
vec3 | get_tracking_origin () |
vr_view_interactor (const char *name) | |
std::string | get_type_name () const |
return the type name | |
extends the stereo view interactor for vr support
Besides adding the crg_vr_view plugin to your project, you can configure the vr_view_interactor in your cgv::render::drawable::init() function similar to the following example:
void vr_view_interactor::draw_vr_kits | ( | bool | do_draw | ) |
set whether to draw vr kits
whether to draw vr kits
vr_view_interactor::dvec3 vr_view_interactor::get_eye_of_kit | ( | int | eye = 0 , |
int | vr_kit_idx = -1 |
||
) | const |
query the eye position of a vr kit.
parameter eye
is one of -1 .. left eye 0 .. cyclopic eye 1 .. right eye if parameter vr_kit_idx defaults to -1, the eye position of the current vr kit is returned if there are not vr kits or the vr_kit_idx
parameter is invalid the eye position of the vr_view_interactor
is returned
|
inline |
return the vr kit currently rendered return a pointer to the current vr kit
vr_view_interactor::dvec3 vr_view_interactor::get_view_dir_of_kit | ( | int | vr_kit_idx = -1 | ) | const |
query view direction of a vr kit
if parameter vr_kit_idx defaults to -1, the view direction of the current vr kit is returned if there are not vr kits or the vr_kit_idx
parameter is invalid the view direction of the vr_view_interactor
is returned
vr_view_interactor::dvec3 vr_view_interactor::get_view_up_dir_of_kit | ( | int | vr_kit_idx = -1 | ) | const |
query view up direction of a vr kit
if parameter vr_kit_idx defaults to -1, the view up direction of the current vr kit is returned if there are not vr kits or the vr_kit_idx
parameter is invalid the view up direction of the vr_view_interactor
is returned
bool vr_view_interactor::handle_vr_events | ( | cgv::gui::event & | e | ) |
overload and implement this method to handle events
factored our vr event handling