draw_floor.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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.
  9. //
  10. // Use glPushMatrix(), glScaled(), glTranslated() to arrange the floor.
  11. //
  12. // Inputs:
  13. // colorA float4 color
  14. // colorB float4 color
  15. //
  16. // Example:
  17. // // Draw a nice floor
  18. // glPushMatrix();
  19. // glCullFace(GL_BACK);
  20. // glEnable(GL_CULL_FACE);
  21. // glEnable(GL_LIGHTING);
  22. // glTranslated(0,-1,0);
  23. // if(project(Vector3d(0,0,0))(2) - project(Vector3d(0,1,0))(2) > -FLOAT_EPS)
  24. // {
  25. // draw_floor_outline();
  26. // }
  27. // draw_floor();
  28. // glPopMatrix();
  29. // glDisable(GL_CULL_FACE);
  30. //
  31. IGL_INLINE void draw_floor(const float * colorA, const float * colorB);
  32. // Wrapper with default colors
  33. IGL_INLINE void draw_floor();
  34. IGL_INLINE void draw_floor_outline(const float * colorA, const float * colorB);
  35. // Wrapper with default colors
  36. IGL_INLINE void draw_floor_outline();
  37. }
  38. #ifdef IGL_HEADER_ONLY
  39. # include "draw_floor.cpp"
  40. #endif
  41. #endif
  42. #endif