draw_mesh.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef IGL_DRAW_MESH_H
  2. #define IGL_DRAW_MESH_H
  3. #ifndef IGL_NO_OPENGL
  4. #include "igl_inline.h"
  5. #include <Eigen/Dense>
  6. #include "OpenGL_convenience.h"
  7. namespace igl
  8. {
  9. // Draw OpenGL commands needed to display a mesh with normals
  10. //
  11. // Inputs:
  12. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  13. // F #F by 3 eigne Matrix of face (triangle) indices
  14. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  15. IGL_INLINE void draw_mesh(
  16. const Eigen::MatrixXd & V,
  17. const Eigen::MatrixXi & F,
  18. const Eigen::MatrixXd & N);
  19. // Draw OpenGL commands needed to display a mesh with normals and per-vertex
  20. // colors
  21. //
  22. // Inputs:
  23. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  24. // F #F by 3 eigne Matrix of face (triangle) indices
  25. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  26. // C #V by 3 eigen Matrix of mesh vertex RGB colors
  27. IGL_INLINE void draw_mesh(
  28. const Eigen::MatrixXd & V,
  29. const Eigen::MatrixXi & F,
  30. const Eigen::MatrixXd & N,
  31. const Eigen::MatrixXd & C);
  32. // Draw OpenGL commands needed to display a mesh with normals, per-vertex
  33. // colors and LBS weights
  34. //
  35. // Inputs:
  36. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  37. // F #F by 3 eigne Matrix of face (triangle) indices
  38. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  39. // C #V by 3 eigen Matrix of mesh vertex RGB colors
  40. // TC #V by 3 eigen Matrix of mesh vertex UC coorindates between 0 and 1
  41. // W #V by #H eigen Matrix of per mesh vertex, per handle weights
  42. // W_index Specifies the index of the "weight" vertex attribute: see
  43. // glBindAttribLocation, if W_index is 0 then weights are ignored
  44. // WI #V by #H eigen Matrix of per mesh vertex, per handle weight ids
  45. // WI_index Specifies the index of the "weight" vertex attribute: see
  46. // glBindAttribLocation, if WI_index is 0 then weight indices are ignored
  47. IGL_INLINE void draw_mesh(
  48. const Eigen::MatrixXd & V,
  49. const Eigen::MatrixXi & F,
  50. const Eigen::MatrixXd & N,
  51. const Eigen::MatrixXd & C,
  52. const Eigen::MatrixXd & TC,
  53. const Eigen::MatrixXd & W,
  54. const GLuint W_index,
  55. const Eigen::MatrixXi & WI,
  56. const GLuint WI_index);
  57. // Draw OpenGL commands needed to display a mesh with normals, per-vertex
  58. // colors and LBS weights
  59. //
  60. // Inputs:
  61. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  62. // F #F by 3 eigne Matrix of face (triangle) indices
  63. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  64. // NF #F by 3 eigen Matrix of face (triangle) normal indices, <0 means no
  65. // normal
  66. // C #V by 3 eigen Matrix of mesh vertex RGB colors
  67. // TC #V by 3 eigen Matrix of mesh vertex UC coorindates between 0 and 1
  68. // TF #F by 3 eigen Matrix of face (triangle) texture indices, <0 means no
  69. // texture
  70. // W #V by #H eigen Matrix of per mesh vertex, per handle weights
  71. // W_index Specifies the index of the "weight" vertex attribute: see
  72. // glBindAttribLocation, if W_index is 0 then weights are ignored
  73. // WI #V by #H eigen Matrix of per mesh vertex, per handle weight ids
  74. // WI_index Specifies the index of the "weight" vertex attribute: see
  75. // glBindAttribLocation, if WI_index is 0 then weight indices are ignored
  76. IGL_INLINE void draw_mesh(
  77. const Eigen::MatrixXd & V,
  78. const Eigen::MatrixXi & F,
  79. const Eigen::MatrixXd & N,
  80. const Eigen::MatrixXi & NF,
  81. const Eigen::MatrixXd & C,
  82. const Eigen::MatrixXd & TC,
  83. const Eigen::MatrixXi & TF,
  84. const Eigen::MatrixXd & W,
  85. const GLuint W_index,
  86. const Eigen::MatrixXi & WI,
  87. const GLuint WI_index);
  88. }
  89. #ifdef IGL_HEADER_ONLY
  90. # include "draw_mesh.cpp"
  91. #endif
  92. #endif
  93. #endif