ambient_occlusion.h 1.5 KB

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