| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef DEPTHGUIDE_RENDER_SCENE_H
- #define DEPTHGUIDE_RENDER_SCENE_H
- #include "core/image_utility_v2.h"
- #include "render_mesh.h"
- #include <variant>
- struct camera_info {
- glm::mat4 transform; // standard camera transform
- GLfloat fov = 60.0f; // field of view (degree)
- GLfloat near = 10.0f;
- GLfloat far = 1000.0f; // clip range (mm)
- glm::mat4 projection(float aspect) const;
- };
- struct scene_render_info {
- struct image_info {
- image_ptr img = nullptr;
- image_ptr depth = nullptr;
- bool flip_y = false;
- };
- struct mesh_info {
- mesh_ptr mesh = nullptr;
- material_type material = {};
- bool enable_depth_alpha = false;
- float alpha_factor = 0.1;
- };
- struct pc_info {
- pc_ptr pc = nullptr;
- GLfloat point_size = 1.0f;
- glm::vec3 color = glm::vec3(0.5f);
- };
- struct custom_info {
- std::function<void()> func;
- };
- struct line_info {
- glm::vec3 p1, p2; // in world coordinate
- glm::vec3 color;
- float line_width;
- };
- struct item_type {
- using item_store_type = std::variant<std::monostate,
- image_info, mesh_info, pc_info, custom_info, line_info>;
- item_store_type info;
- GLfloat alpha = 1.0f;
- glm::mat4 transform = glm::mat4(1.0f); // ignored with ITEM_IMAGE
- };
- using item_list_type =
- std::vector<item_type>;
- item_list_type items;
- camera_info camera;
- struct light_info {
- bool follow_camera = false;
- glm::vec3 direction = glm::vec3(0.0f, 0.0f, -1.0f);
- } light;
- smart_cuda_stream *stream = nullptr;
- };
- using scene_ptr = std::shared_ptr<scene_render_info>;
- void render_scene(const scene_ptr &info);
- #endif //DEPTHGUIDE_RENDER_SCENE_H
|