ccGLUtils.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #pragma once
  2. //##########################################################################
  3. //# #
  4. //# CLOUDCOMPARE #
  5. //# #
  6. //# This program is free software; you can redistribute it and/or modify #
  7. //# it under the terms of the GNU General Public License as published by #
  8. //# the Free Software Foundation; version 2 or later of the License. #
  9. //# #
  10. //# This program is distributed in the hope that it will be useful, #
  11. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  12. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  13. //# GNU General Public License for more details. #
  14. //# #
  15. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  16. //# #
  17. //##########################################################################
  18. #include "qCC_glWindow.h"
  19. //qCC_db
  20. #include <ccIncludeGL.h> //Always first!
  21. //Qt
  22. #include <QImage>
  23. //! View orientation
  24. enum CC_VIEW_ORIENTATION { CC_TOP_VIEW, /**< Top view (eye: +Z) **/
  25. CC_BOTTOM_VIEW, /**< Bottom view **/
  26. CC_FRONT_VIEW, /**< Front view **/
  27. CC_BACK_VIEW, /**< Back view **/
  28. CC_LEFT_VIEW, /**< Left view **/
  29. CC_RIGHT_VIEW, /**< Right view **/
  30. CC_ISO_VIEW_1, /**< Isometric view 1: front, right and top **/
  31. CC_ISO_VIEW_2, /**< Isometric view 2: back, left and top **/
  32. };
  33. class CCGLWINDOW_LIB_API ccGLUtils
  34. {
  35. public:
  36. /***************************************************
  37. OpenGL Textures
  38. ***************************************************/
  39. static void DisplayTexture2DPosition(QImage image, int x, int y, int w, int h, unsigned char alpha = 255);
  40. inline static void DisplayTexture2D(QImage image, int w, int h, unsigned char alpha = 255) { DisplayTexture2DPosition(image, -w / 2, -h / 2, w, h, alpha); }
  41. static void DisplayTexture2DPosition(GLuint texID, int x, int y, int w, int h, unsigned char alpha = 255);
  42. inline static void DisplayTexture2D(GLuint texID, int w, int h, unsigned char alpha = 255) { DisplayTexture2DPosition(texID, -w / 2, -h / 2, w, h, alpha); }
  43. /***************************************************
  44. OpenGL Matrices
  45. ***************************************************/
  46. //! Returns a 4x4 'OpenGL' matrix corresponding to a default 'view' orientation
  47. /** \param orientation view orientation
  48. \return corresponding GL matrix
  49. **/
  50. static ccGLMatrixd GenerateViewMat(CC_VIEW_ORIENTATION orientation);
  51. };