draw_mesh.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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|#F by 3 eigen Matrix of 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|#F by 3 eigen Matrix of 3D normals
  26. // C #V|#F|1 by 3 eigen Matrix of 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. // Inputs:
  33. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  34. // F #F by 3 eigne Matrix of face (triangle) indices
  35. // N #V|#F by 3 eigen Matrix of 3D normals
  36. // C #V|#F|1 by 3 eigen Matrix of RGB colors
  37. // TC #V|#F|1 by 3 eigen Matrix of Texture Coordinates
  38. IGL_INLINE void draw_mesh(
  39. const Eigen::MatrixXd & V,
  40. const Eigen::MatrixXi & F,
  41. const Eigen::MatrixXd & N,
  42. const Eigen::MatrixXd & C,
  43. const Eigen::MatrixXd & TC);
  44. // Draw OpenGL commands needed to display a mesh with normals, per-vertex
  45. // colors and LBS weights
  46. //
  47. // Inputs:
  48. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  49. // F #F by 3 eigne Matrix of face (triangle) indices
  50. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  51. // C #V by 3 eigen Matrix of mesh vertex RGB colors
  52. // TC #V by 3 eigen Matrix of mesh vertex UC coorindates between 0 and 1
  53. // W #V by #H eigen Matrix of per mesh vertex, per handle weights
  54. // W_index Specifies the index of the "weight" vertex attribute: see
  55. // glBindAttribLocation, if W_index is 0 then weights are ignored
  56. // WI #V by #H eigen Matrix of per mesh vertex, per handle weight ids
  57. // WI_index Specifies the index of the "weight" vertex attribute: see
  58. // glBindAttribLocation, if WI_index is 0 then weight indices are ignored
  59. IGL_INLINE void draw_mesh(
  60. const Eigen::MatrixXd & V,
  61. const Eigen::MatrixXi & F,
  62. const Eigen::MatrixXd & N,
  63. const Eigen::MatrixXd & C,
  64. const Eigen::MatrixXd & TC,
  65. const Eigen::MatrixXd & W,
  66. const GLuint W_index,
  67. const Eigen::MatrixXi & WI,
  68. const GLuint WI_index);
  69. // Draw OpenGL commands needed to display a mesh with normals, per-vertex
  70. // colors and LBS weights
  71. //
  72. // Inputs:
  73. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  74. // F #F by 3 eigne Matrix of face (triangle) indices
  75. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  76. // NF #F by 3 eigen Matrix of face (triangle) normal indices, <0 means no
  77. // normal
  78. // C #V by 3 eigen Matrix of mesh vertex RGB colors
  79. // TC #V by 3 eigen Matrix of mesh vertex UC coorindates between 0 and 1
  80. // TF #F by 3 eigen Matrix of face (triangle) texture indices, <0 means no
  81. // texture
  82. // W #V by #H eigen Matrix of per mesh vertex, per handle weights
  83. // W_index Specifies the index of the "weight" vertex attribute: see
  84. // glBindAttribLocation, if W_index is 0 then weights are ignored
  85. // WI #V by #H eigen Matrix of per mesh vertex, per handle weight ids
  86. // WI_index Specifies the index of the "weight" vertex attribute: see
  87. // glBindAttribLocation, if WI_index is 0 then weight indices are ignored
  88. IGL_INLINE void draw_mesh(
  89. const Eigen::MatrixXd & V,
  90. const Eigen::MatrixXi & F,
  91. const Eigen::MatrixXd & N,
  92. const Eigen::MatrixXi & NF,
  93. const Eigen::MatrixXd & C,
  94. const Eigen::MatrixXd & TC,
  95. const Eigen::MatrixXi & TF,
  96. const Eigen::MatrixXd & W,
  97. const GLuint W_index,
  98. const Eigen::MatrixXi & WI,
  99. const GLuint WI_index);
  100. }
  101. #ifdef IGL_HEADER_ONLY
  102. # include "draw_mesh.cpp"
  103. #endif
  104. #endif
  105. #endif