ambient_occlusion.h 1.6 KB

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