ViewerData.h 2.5 KB

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