ambient_occlusion.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_AMBIENT_OCCLUSION_H
  9. #define IGL_AMBIENT_OCCLUSION_H
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Forward define
  15. class EmbreeIntersector;
  16. // Compute ambient occlusion per given point
  17. //
  18. // Inputs:
  19. // ei EmbreeIntersector containing (V,F)
  20. // P #P by 3 list of origin points
  21. // N #P by 3 list of origin normals
  22. // Outputs:
  23. // S #P list of ambient occlusion values between 1 (fully occluded) and 0
  24. // (not occluded)
  25. //
  26. template <
  27. typename DerivedP,
  28. typename DerivedN,
  29. typename DerivedS >
  30. void ambient_occlusion(
  31. const igl::EmbreeIntersector & 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