| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef DEPTHGUIDE_RENDER_MESH_H
- #define DEPTHGUIDE_RENDER_MESH_H
- #include "render_utility.h"
- #include <memory>
- class mesh_type {
- public:
- ~mesh_type();
- struct create_config {
- std::string path;
- };
- using this_type = mesh_type;
- using pointer = std::shared_ptr<mesh_type>;
- static pointer create(const create_config &conf);
- struct gl_info_type : private boost::noncopyable {
- GLuint vao = 0; // Vertex Array Object
- GLuint vbo = 0; // Vertex Buffer Object
- GLuint ebo = 0; // Element Buffer Object
- GLuint num_triangle = 0; // number of triangles
- ~gl_info_type();
- };
- gl_info_type *get_gl_info();
- private:
- struct impl;
- std::unique_ptr<impl> pimpl;
- };
- using mesh_ptr = mesh_type::pointer;
- enum mesh_render_mode {
- MESH_NORMAL,
- MESH_DEPTH_ALPHA
- };
- struct material_type {
- glm::vec3 ambient;
- glm::vec3 diffuse;
- };
- struct mesh_info_type {
- mesh_type *mesh = nullptr;
- glm::mat4 transform = {};
- // make scene_render happy
- using material_type = ::material_type;
- material_type material = {};
- };
- struct camera_info_type {
- glm::mat4 transform;
- glm::mat4 project;
- };
- struct light_info_type {
- glm::vec3 direction;
- };
- struct mesh_render_info {
- mesh_render_mode mode = MESH_NORMAL;
- mesh_info_type model = {};
- camera_info_type camera = {};
- light_info_type light = {};
- union {
- struct {
- } normal;
- struct {
- mesh_info_type bg;
- float alpha_factor;
- bool show_bg;
- } depth_alpha;
- } extra = {};
- };
- void render_mesh(const mesh_render_info &info);
- #endif //DEPTHGUIDE_RENDER_MESH_H
|