#ifndef DEPTHGUIDE_RENDER_TOOLS_H #define DEPTHGUIDE_RENDER_TOOLS_H #include "core/object_manager.h" #include "render_utility.h" #include "render_texture.h" #include #include simple_rect calc_render_range(cv::Size img_size); class color_image_render { public: struct config_type { color_format fmt = COLOR_RGB; bool flip_y = false; float alpha = 1.0; std::optional range; smart_cuda_stream *stream = nullptr; }; void render(obj_name_type name, config_type conf); // note: use render_rgba() instead // void render_bw(const image_info_u8c1 &img, config_type conf); // void render_bw(obj_name_type name, config_type conf); // T = uchar{1-4} template void render_rgba(const image_info_type &img, config_type conf); // supports image_u8c{1-4} void render_rgba(obj_name_type name, config_type conf); // supports image_u8c1 void render_nv12(const image_info_u8c1 &img, config_type conf); // supports image_u8c1 void render_nv12(obj_name_type name, config_type conf); private: smart_texture img_tex; smart_texture ext_tex[2]; void render_tex(cv::Size img_size, config_type conf); }; class depth_image_render { public: struct config_type { bool flip_y = false; float alpha = 1.0; bool manual_depth_range = false; struct { float min = 0.15; // unit in meter float max = 10.0; // unit in meter } depth_range; smart_cuda_stream *stream = nullptr; }; void render(obj_name_type name, config_type conf); private: color_image_render color_render; }; class pc_render { public: struct config_type { struct { glm::mat4 transform = glm::mat4(1.0f); glm::vec3 color; float point_size = 1.0; } pc = {}; struct { glm::mat4 transform = glm::mat4(1.0f); float fov = 60.0f; float near = 1.0f, far = 1000.0f; // clip range } camera = {}; smart_cuda_stream *stream = nullptr; }; void render(obj_name_type name, const config_type &conf); }; #endif //DEPTHGUIDE_RENDER_TOOLS_H