draw_mesh.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef IGL_DRAW_MESH_H
  2. #define IGL_DRAW_MESH_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Dense>
  5. #if __APPLE__
  6. # include <OpenGL/gl.h>
  7. #else
  8. # ifdef _WIN32
  9. # define NOMINMAX
  10. # include <Windows.h>
  11. # undef NOMINMAX
  12. # endif
  13. # define GL_GLEXT_PROTOTYPES
  14. # include <GL/gl.h>
  15. # include <GL/glext.h>
  16. #endif
  17. namespace igl
  18. {
  19. // Draw OpenGL commands needed to display a mesh with normals
  20. //
  21. // Inputs:
  22. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  23. // F #F by 3 eigne Matrix of face (triangle) indices
  24. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  25. IGL_INLINE void draw_mesh(
  26. const Eigen::MatrixXd & V,
  27. const Eigen::MatrixXi & F,
  28. const Eigen::MatrixXd & N);
  29. // Draw OpenGL commands needed to display a mesh with normals and per-vertex
  30. // colors
  31. //
  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 by 3 eigen Matrix of mesh vertex 3D normals
  36. // C #V by 3 eigen Matrix of mesh vertex RGB colors
  37. IGL_INLINE void draw_mesh(
  38. const Eigen::MatrixXd & V,
  39. const Eigen::MatrixXi & F,
  40. const Eigen::MatrixXd & N,
  41. const Eigen::MatrixXd & C);
  42. // Draw OpenGL commands needed to display a mesh with normals, per-vertex
  43. // colors and LBS weights
  44. //
  45. // Inputs:
  46. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  47. // F #F by 3 eigne Matrix of face (triangle) indices
  48. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  49. // TC #V by 3 eigen Matrix of mesh vertex UC coorindates between 0 and 1
  50. // C #V by 3 eigen Matrix of mesh vertex RGB colors
  51. // W #V by #H eigen Matrix of per mesh vertex, per handle weights
  52. // W_index Specifies the index of the "weight" vertex attribute: see
  53. // glBindAttribLocation, if W_index is 0 then weights are ignored
  54. // WI #V by #H eigen Matrix of per mesh vertex, per handle weight ids
  55. // WI_index Specifies the index of the "weight" vertex attribute: see
  56. // glBindAttribLocation, if WI_index is 0 then weight indices are ignored
  57. IGL_INLINE void draw_mesh(
  58. const Eigen::MatrixXd & V,
  59. const Eigen::MatrixXi & F,
  60. const Eigen::MatrixXd & N,
  61. const Eigen::MatrixXd & C,
  62. const Eigen::MatrixXd & TC,
  63. const Eigen::MatrixXd & W,
  64. const GLuint W_index,
  65. const Eigen::MatrixXi & WI,
  66. const GLuint WI_index);
  67. }
  68. #ifdef IGL_HEADER_ONLY
  69. # include "draw_mesh.cpp"
  70. #endif
  71. #endif