| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- #ifndef DEPTHGUIDE_CAMERA_AUGMENT_HELPER_V2_IMPL_H
- #define DEPTHGUIDE_CAMERA_AUGMENT_HELPER_V2_IMPL_H
- #include "module/camera_augment_helper_v2.h"
- #include "module/viewport_downloader.hpp"
- struct camera_augment_helper_v2::impl {
- std::string transform_var; // sophiar
- std::optional<glm::mat4> tracked_transform; // transform matrix from sophiar
- bool is_missing = false;
- bool ignore_missing = false;
- augment_manager_v2 *manager = nullptr;
- using sophiar_conn_type = create_config::sophiar_conn_type;
- sophiar_conn_type *sophiar_conn = nullptr;
- using io_context = boost::asio::io_context;
- io_context *ctx = nullptr;
- // for all
- float fov = 60.0f; // field of view
- float near = 10.0f;
- float far = 1000.0f; // clip range (mm)
- glm::mat4 transform; // standard camera transform
- struct fixed_info_type {
- glm::vec3 extra_offset = glm::vec3();
- glm::vec3 extra_rotation = glm::vec3();
- glm::mat4 extra_transform() const;
- } fixed_info;
- struct freedom_info_type {
- glm::vec3 eye = glm::vec3();
- glm::vec3 center = glm::vec3(0.0f, 0.0f, 100.0f); // focus
- glm::vec3 view_up = glm::vec3(0.0f, -1.0f, 0.0f);
- float angle_speed = 5.0f; // degree
- float linear_speed = 20.0f; // mm
- impl *pimpl = nullptr;
- void reset();
- glm::vec3 view_dir() const;
- float view_dis() const;
- void translate(glm::vec3 offset);
- void forward(float dis);
- void move_right(float dis);
- void move_up(float dis);
- void center_forward(float dis);
- void roll(float deg);
- void yaw(float deg);
- void pitch(float deg);
- glm::mat4 to_transform();
- } freedom_info;
- struct {
- impl *parent;
- glm::mat4 transform;
- } relative_info;
- enum {
- MODE_FIXED,
- MODE_RELATIVE,
- MODE_FREEDOM
- } mode;
- // for off-screen rendering
- smart_frame_buffer::create_config fbo_conf = {};
- smart_frame_buffer fbo;
- std::unique_ptr<viewport_downloader> img_downloader;
- // for interaction
- using conn_type = boost::signals2::connection;
- conn_type pre_render_conn;
- bool is_interactive = false;
- camera_info last_camera;
- cv::Size last_vp_size;
- bool enable_cursor_guide = false;
- std::optional<glm::vec3> cursor_pos; // in world coordinate
- mesh_ptr cursor_symbol;
- explicit impl(const create_config &conf);
- ~impl();
- void update_tracked_transform();
- void update_freedom();
- void update_fixed();
- void update_relative();
- void update_transform();
- void update_camera();
- void render();
- void render_image(output_config conf);
- void show_freedom();
- void show_fixed();
- void show();
- void update_cursor_coordinate();
- void cursor_guide_slot(const scene_ptr &info);
- void pre_render_slot(const scene_ptr &info);
- void set_interactive(bool flag);
- };
- #endif //DEPTHGUIDE_CAMERA_AUGMENT_HELPER_V2_IMPL_H
|