ViewerCore.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef IGL_VIEWER_CORE_H
  2. #define IGL_VIEWER_CORE_H
  3. #include <igl/igl_inline.h>
  4. #include <igl/viewer/TextRenderer.h>
  5. namespace igl
  6. {
  7. class ViewerCore
  8. #ifdef ENABLE_XML_SERIALIZATION
  9. : public ::igl::XMLSerialization
  10. #endif
  11. {
  12. public:
  13. IGL_INLINE ViewerCore();
  14. IGL_INLINE void init();
  15. IGL_INLINE void shut();
  16. IGL_INLINE void InitSerialization();
  17. IGL_INLINE void align_camera_center(const Eigen::MatrixXd& V); // Adjust the view to see the entire model
  18. // Determines how much to zoom and shift such that the mesh fills the unit
  19. // box (centered at the origin)
  20. IGL_INLINE void get_scale_and_shift_to_fit_mesh(
  21. const Eigen::MatrixXd& V,
  22. float & zoom,
  23. Eigen::Vector3f& shift);
  24. IGL_INLINE void clear_framebuffers();
  25. // Draw everything
  26. IGL_INLINE void draw(ViewerData& data, OpenGL_state& opengl);
  27. TextRenderer textrenderer;
  28. // Shape material
  29. float shininess;
  30. // Colors
  31. Eigen::Vector3f background_color;
  32. Eigen::Vector3f line_color;
  33. // Lighting
  34. Eigen::Vector3f light_position;
  35. float lighting_factor;
  36. // Trackball angle (quaternion)
  37. Eigen::Vector4f trackball_angle;
  38. // Model viewing parameters
  39. float model_zoom;
  40. Eigen::Vector3f model_translation;
  41. // Model viewing paramters (uv coordinates)
  42. float model_zoom_uv;
  43. Eigen::Vector3f model_translation_uv;
  44. // Camera parameters
  45. float camera_zoom;
  46. bool orthographic;
  47. Eigen::Vector3f camera_eye;
  48. Eigen::Vector3f camera_up;
  49. Eigen::Vector3f camera_center;
  50. float camera_view_angle;
  51. float camera_dnear;
  52. float camera_dfar;
  53. // Visualization options
  54. bool show_overlay;
  55. bool show_overlay_depth;
  56. bool show_texture;
  57. bool show_faces;
  58. bool show_lines;
  59. bool show_vertid;
  60. bool show_faceid;
  61. bool invert_normals;
  62. // Point size / line width
  63. float point_size;
  64. float line_width;
  65. // Animation
  66. bool is_animating;
  67. double animation_max_fps;
  68. // Caches the two-norm between the min/max point of the bounding box
  69. float object_scale;
  70. // Window size
  71. Eigen::Vector4f viewport;
  72. // Save the OpenGL transformation matrices used for the previous rendering pass
  73. Eigen::Matrix4f view;
  74. Eigen::Matrix4f model;
  75. Eigen::Matrix4f proj;
  76. };
  77. }
  78. #ifndef IGL_STATIC_LIBRARY
  79. # include "ViewerCore.cpp"
  80. #endif
  81. #endif