cgv
Loading...
Searching...
No Matches
vr_render_helpers.h
1#pragma once
2
3#include <vr/vr_kit.h>
4#include <vr/vr_state.h>
5#include <cgv/render/shader_program.h>
6#include <cgv_gl/gl/mesh_render_info.h>
7
8#include "lib_begin.h"
9
12
14
17namespace vr {
19 extern CGV_API cgv::mat4 get_mat4_from_pose(const float pose_matrix[12]);
21 extern CGV_API cgv::mat4 get_world_to_eye_transform(const vr_kit* vr_kit_ptr, const vr_kit_state& state, int eye);
23 extern CGV_API cgv::mat4 get_world_to_camera_transform(const vr_kit* vr_kit_ptr, const vr_kit_state& state, int eye);
25 extern CGV_API cgv::mat4 get_eye_projection_transform(const vr_kit* vr_kit_ptr, const vr_kit_state& state, float z_near, float z_far, int eye);
27 extern CGV_API cgv::mat4 get_camera_projection_transform(const vr_kit* vr_kit_ptr, float z_near, float z_far, int eye, bool undistorted);
29 extern CGV_API cgv::mat4 get_texture_transform(const vr_kit* vr_kit_ptr, const vr_kit_state& state, float z_near, float z_far, int eye, bool undistorted);
31
34 uint32_t frame_width, uint32_t frame_height, const vr_kit* vr_kit_ptr, const vr_kit_state& state, float z_near, float z_far, int eye, bool undistorted);
36 enum VRMeshId {
37 VRM_HMD,
38 VRM_CONTROLLER,
39 VRM_TRACKER,
40 VRM_BASE
41 };
43 extern CGV_API const std::string& get_vrmesh_file_name(VRMeshId id);
45 extern CGV_API void set_vrmesh_file_name(VRMeshId id, const std::string& file_name);
48}
50
51#include <cgv/config/lib_end.h>
base class for all drawables, which is independent of the used rendering API.
Definition context.h:621
the mesh_render_info structure manages vertex buffer objects for attribute and element buffers as wel...
a shader program combines several shader code fragments to a complete definition of the shading pipel...
the vr namespace for virtual reality support
void set_vrmesh_file_name(VRMeshId id, const std::string &file_name)
set the file name for the given vrmesh type
cgv::mat4 get_eye_projection_transform(const vr_kit *vr_kit_ptr, const vr_kit_state &state, float z_near, float z_far, int eye)
query projection matrix for a given eye (0 ... left, 1 ... right)
bool configure_seethrough_shader_program(cgv::render::context &ctx, cgv::render::shader_program &prog, uint32_t frame_width, uint32_t frame_height, const vr_kit *vr_kit_ptr, const vr_kit_state &state, float z_near, float z_far, int eye, bool undistorted)
set all uniforms of seethrough shader program for a given camera (0 ... left or mono,...
VRMeshId
enumerate for different mesh types
cgv::mat4 get_mat4_from_pose(const float pose_matrix[12])
convert pose to mat4
cgv::render::mesh_render_info * get_vrmesh_render_info(cgv::render::context &ctx, VRMeshId id)
return a pointer to a mesh info structure for the given mesh type (read and construct if necessary); ...
cgv::mat4 get_world_to_eye_transform(const vr_kit *vr_kit_ptr, const vr_kit_state &state, int eye)
compute lookat matrix for a given eye (0 ... left, 1 ... right)
cgv::mat4 get_camera_projection_transform(const vr_kit *vr_kit_ptr, float z_near, float z_far, int eye, bool undistorted)
query projection matrix for a given camera (0 ... left or mono, 1 ... right only for stereo cameras)
cgv::mat4 get_texture_transform(const vr_kit *vr_kit_ptr, const vr_kit_state &state, float z_near, float z_far, int eye, bool undistorted)
query the texture matrix needed for projective texture mapping for a given camera (0 ....
cgv::mat4 get_world_to_camera_transform(const vr_kit *vr_kit_ptr, const vr_kit_state &state, int eye)
compute lookat matrix for a given camera (0 ... left, 1 ... right)
const std::string & get_vrmesh_file_name(VRMeshId id)
return the file name for the given vrmesh type
defines types to store the state vr::vr_kit_state of a vr kit, which is split into sub states for the...