ambient_occlusion.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef IGL_AMBIENT_OCCLUSION_H
  2. #define IGL_AMBIENT_OCCLUSION_H
  3. #include <igl/igl_inline.h>
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Forward define
  8. class EmbreeIntersector;
  9. // Compute ambient occlusion per given point
  10. //
  11. // Inputs:
  12. // ei EmbreeIntersector containing (V,F)
  13. // P #P by 3 list of origin points
  14. // N #P by 3 list of origin normals
  15. // Outputs:
  16. // S #P list of ambient occlusion values between 1 (fully occluded) and 0
  17. // (not occluded)
  18. //
  19. template <
  20. typename DerivedP,
  21. typename DerivedN,
  22. typename DerivedS >
  23. void ambient_occlusion(
  24. const igl::EmbreeIntersector & ei,
  25. const Eigen::PlainObjectBase<DerivedP> & P,
  26. const Eigen::PlainObjectBase<DerivedN> & N,
  27. const int num_samples,
  28. Eigen::PlainObjectBase<DerivedS> & S);
  29. // Wrapper which builds new EmbreeIntersector for (V,F). That's expensive so
  30. // avoid this if repeatedly calling.
  31. template <
  32. typename DerivedV,
  33. typename DerivedF,
  34. typename DerivedP,
  35. typename DerivedN,
  36. typename DerivedS >
  37. void ambient_occlusion(
  38. const Eigen::PlainObjectBase<DerivedV> & V,
  39. const Eigen::PlainObjectBase<DerivedF> & F,
  40. const Eigen::PlainObjectBase<DerivedP> & P,
  41. const Eigen::PlainObjectBase<DerivedN> & N,
  42. const int num_samples,
  43. Eigen::PlainObjectBase<DerivedS> & S);
  44. };
  45. #ifdef IGL_HEADER_ONLY
  46. # include "ambient_occlusion.cpp"
  47. #endif
  48. #endif