Skip to content

File plugin.hpp

File List > hand_tracking > viewer > plugin.hpp

Go to the documentation of this file

#pragma once

// clang-format off
#include     // GLEW has to be loaded before other GL libraries
#include  // Also loading first, just to be safe
// clang-format on

#ifdef ILLIXR_HT_DIR
#    define STRINGIFY(x) #x
#    define TOSTRING(x)  STRINGIFY(x)
#    include TOSTRING(ILLIXR_HT_DIR / hand_tracking_data.hpp)
#else
#    error "Can not locate hand_tracking_data.hpp, please specify its path with -DILLIXR_HT_DIR"
#endif

#include "illixr/data_format/camera_data.hpp"
#include "illixr/imgui/imgui.h"
#include "illixr/plugin.hpp"
#include "illixr/switchboard.hpp"

#include 

namespace ILLIXR {
class viewer : public plugin {
public:
    viewer(const std::string& name_, phonebook* pb_);
    ~viewer() override;
    void start() override;
    void make_gui(const switchboard::ptr<const ht::ht_frame>& frame);

private:
    void make_detection_table(data_format::pose::side eye, int idx, const std::string& label) const;
    void make_position_table() const;

    std::shared_ptr<relative_clock>    clock_;
    const std::shared_ptr<switchboard> switchboard_;
    std::shared_ptr<ht::ht_frame>      ht_frame_;
    const data_format::pose::pose_base pose_;
#ifdef VIEW_DUMP
    std::map<data_format::ht::hand, data_format::ht::hand_points> _true_hand_positions;
#endif

    GLFWwindow* viewport_{};

    GLuint          textures_[2];
    Eigen::Vector2i raw_size       = Eigen::Vector2i::Zero();
    Eigen::Vector2i processed_size = Eigen::Vector2i::Zero();
    Eigen::Vector2i combined_size  = Eigen::Vector2i::Zero();

    Eigen::Matrix4f     basicProjection_;
    const ht::ht_frame* current_frame_;
    ImVec4              clear_color_ = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);

    bool                                                enabled_right_ = false;
    std::string                                         tab_label_;
    data_format::pose::side                             single_eye_ = data_format::pose::LEFT;
    std::vector<ILLIXR::data_format::image::image_type> detections_;

    std::map<uint64_t, ht::ht_frame> ht_frames_;
};

} // namespace ILLIXR