draw_mesh.h 2.3 KB

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