ViewerData.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef IGL_VIEWER_DATA_H
  2. #define IGL_VIEWER_DATA_H
  3. #include <igl/igl_inline.h>
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. class ViewerData
  8. #ifdef ENABLE_XML_SERIALIZATION
  9. : public ::igl::XMLSerialization
  10. #endif
  11. {
  12. public:
  13. ViewerData()
  14. #ifdef ENABLE_XML_SERIALIZATION
  15. : XMLSerialization("Data"), dirty(DIRTY_ALL)
  16. #endif
  17. {};
  18. IGL_INLINE void InitSerialization();
  19. Eigen::MatrixXd V; // Vertices of the current mesh (#V x 3)
  20. Eigen::MatrixXi F; // Faces of the mesh (#F x 3)
  21. // Per face attributes
  22. Eigen::MatrixXd F_normals; // One normal per face
  23. Eigen::MatrixXd F_material_ambient; // Per face ambient color
  24. Eigen::MatrixXd F_material_diffuse; // Per face diffuse color
  25. Eigen::MatrixXd F_material_specular; // Per face specular color
  26. // Per vertex attributes
  27. Eigen::MatrixXd V_normals; // One normal per vertex
  28. Eigen::MatrixXd V_material_ambient; // Per vertex ambient color
  29. Eigen::MatrixXd V_material_diffuse; // Per vertex diffuse color
  30. Eigen::MatrixXd V_material_specular; // Per vertex specular color
  31. // UV parametrization
  32. Eigen::MatrixXd V_uv; // UV vertices
  33. Eigen::MatrixXi F_uv; // optional faces for UVs
  34. // Texture
  35. Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic> texture_R;
  36. Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic> texture_G;
  37. Eigen::Matrix<char,Eigen::Dynamic,Eigen::Dynamic> texture_B;
  38. // Overlays
  39. // Lines plotted over the scene
  40. // (Every row contains 9 doubles in the following format S_x, S_y, S_z, T_x, T_y, T_z, C_r, C_g, C_b),
  41. // with S and T the coordinates of the two vertices of the line in global coordinates, and C the color in floating point rgb format
  42. Eigen::MatrixXd lines;
  43. // Points plotted over the scene
  44. // (Every row contains 6 doubles in the following format P_x, P_y, P_z, C_r, C_g, C_b),
  45. // with P the position in global coordinates of the center of the point, and C the color in floating point rgb format
  46. Eigen::MatrixXd points;
  47. // Text labels plotted over the scene
  48. // Textp contains, in the i-th row, the position in global coordinates where the i-th label should be anchored
  49. // Texts contains in the i-th position the text of the i-th label
  50. Eigen::MatrixXd labels_positions;
  51. std::vector<std::string > labels_strings;
  52. // Marks dirty buffers that need to be uploaded to OpenGL
  53. uint32_t dirty;
  54. // Caches the two-norm between the min/max point of the bounding box
  55. float object_scale;
  56. /*********************************/
  57. };
  58. }
  59. #ifndef IGL_STATIC_LIBRARY
  60. # include "ViewerData.cpp"
  61. #endif
  62. #endif