PCV.h 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //##########################################################################
  2. //# #
  3. //# PCV #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU Library General Public License as #
  7. //# published by the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  15. //# #
  16. //##########################################################################
  17. #ifndef MESH_ILLUMINATION_HEADER
  18. #define MESH_ILLUMINATION_HEADER
  19. //CCCoreLib
  20. #include <GenericCloud.h>
  21. #include <GenericIndexedMesh.h>
  22. #include <GenericProgressCallback.h>
  23. //Qt
  24. #include <QString>
  25. //System
  26. #include <vector>
  27. //! PCV (Portion de Ciel Visible) algorithm
  28. /** "Ambient Occlusion" in english!
  29. **/
  30. class PCV
  31. {
  32. public:
  33. //! Simulates global illumination on a cloud (or a mesh) with OpenGL - shortcut version
  34. /** Computes per-vertex illumination intensity as a scalar field.
  35. \param numberOfRays (approxiamate) number of rays to generate
  36. \param mode360 whether light rays should be generated on the half superior sphere (false) or the whole sphere (true)
  37. \param vertices vertices (eventually corresponding to a mesh - see below) to englight
  38. \param mesh optional mesh structure associated to the vertices
  39. \param meshIsClosed if a mesh is passed as argument (see above), specifies if the mesh surface is closed (enables optimization)
  40. \param width width of the OpenGL context used to simulate illumination
  41. \param height height of the OpenGL context used to simulate illumination
  42. \param progressCb optional progress bar (optional)
  43. \param entityName entity name (optional)
  44. \return number of 'light' directions actually used (or a value <0 if an error occurred)
  45. **/
  46. static int Launch( unsigned numberOfRays,
  47. CCCoreLib::GenericCloud* vertices,
  48. CCCoreLib::GenericMesh* mesh = nullptr,
  49. bool meshIsClosed = false,
  50. bool mode360 = true,
  51. unsigned width = 1024,
  52. unsigned height = 1024,
  53. CCCoreLib::GenericProgressCallback* progressCb = nullptr,
  54. const QString& entityName = QString());
  55. //! Simulates global illumination on a cloud (or a mesh) with OpenGL
  56. /** Computes per-vertex illumination intensity as a scalar field.
  57. \param rays light directions that will be used to compute global illumination
  58. \param vertices vertices (eventually corresponding to a mesh - see below) to englight
  59. \param mesh optional mesh structure associated to the vertices
  60. \param meshIsClosed if a mesh is passed as argument (see above), specifies if the mesh surface is closed (enables optimization)
  61. \param width width of the OpenGL context used to simulate illumination
  62. \param height height of the OpenGL context used to simulate illumination
  63. \param progressCb optional progress bar (optional)
  64. \param entityName entity name (optional)
  65. \return success
  66. **/
  67. static bool Launch( const std::vector<CCVector3>& rays,
  68. CCCoreLib::GenericCloud* vertices,
  69. CCCoreLib::GenericMesh* mesh = nullptr,
  70. bool meshIsClosed = false,
  71. unsigned width = 1024,
  72. unsigned height = 1024,
  73. CCCoreLib::GenericProgressCallback* progressCb = nullptr,
  74. const QString& entityName = QString());
  75. //! Generates a given number of rays
  76. static bool GenerateRays( unsigned numberOfRays,
  77. std::vector<CCVector3>& rays,
  78. bool mode360 = true);
  79. };
  80. #endif