draw_floor.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef IGL_DRAW_FLOOR_H
  2. #define IGL_DRAW_FLOOR_H
  3. #ifndef IGL_NO_OPENGL
  4. #include "igl_inline.h"
  5. namespace igl
  6. {
  7. // Draw a checkerboard floor aligned with current (X,Z) plane using OpenGL
  8. // calls. side=50 centered at (0,0):
  9. // (-25,-25)-->(-25,25)-->(25,25)-->(25,-25)
  10. //
  11. // Use glPushMatrix(), glScaled(), glTranslated() to arrange the floor.
  12. //
  13. // Inputs:
  14. // colorA float4 color
  15. // colorB float4 color
  16. //
  17. // Example:
  18. // // Draw a nice floor
  19. // glPushMatrix();
  20. // glCullFace(GL_BACK);
  21. // glEnable(GL_CULL_FACE);
  22. // glEnable(GL_LIGHTING);
  23. // glTranslated(0,-1,0);
  24. // if(project(Vector3d(0,0,0))(2) - project(Vector3d(0,1,0))(2) > -FLOAT_EPS)
  25. // {
  26. // draw_floor_outline();
  27. // }
  28. // draw_floor();
  29. // glPopMatrix();
  30. // glDisable(GL_CULL_FACE);
  31. //
  32. IGL_INLINE void draw_floor(const float * colorA, const float * colorB);
  33. // Wrapper with default colors
  34. IGL_INLINE void draw_floor();
  35. IGL_INLINE void draw_floor_outline(const float * colorA, const float * colorB);
  36. // Wrapper with default colors
  37. IGL_INLINE void draw_floor_outline();
  38. }
  39. #ifdef IGL_HEADER_ONLY
  40. # include "draw_floor.cpp"
  41. #endif
  42. #endif
  43. #endif