#include "ambient_occlusion.h" #include "EmbreeIntersector.h" #include #include template < typename DerivedP, typename DerivedN, typename DerivedS > void igl::ambient_occlusion( const igl::EmbreeIntersector & ei, const Eigen::PlainObjectBase & P, const Eigen::PlainObjectBase & N, const int num_samples, Eigen::PlainObjectBase & S) { using namespace Eigen; using namespace igl; const int n = P.rows(); // Resize output S.resize(n,1); // Embree seems to be parallel when constructing but not when tracing rays #pragma omp parallel for // loop over mesh vertices for(int p = 0;p(); const Vector3f normal = N.row(p).template cast(); int num_hits = 0; MatrixXf D = random_dir_stratified(num_samples).cast(); for(int s = 0;s void igl::ambient_occlusion( const Eigen::PlainObjectBase & V, const Eigen::PlainObjectBase & F, const Eigen::PlainObjectBase & P, const Eigen::PlainObjectBase & N, const int num_samples, Eigen::PlainObjectBase & S) { using namespace igl; using namespace Eigen; EmbreeIntersector ei; ei.init(V.template cast(),F.template cast()); ambient_occlusion(ei,P,N,num_samples,S); } #ifndef IGL_HEADER_ONLY // Explicit template instanciation template void igl::ambient_occlusion, Eigen::Matrix, Eigen::Matrix >(igl::EmbreeIntersector const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, int, Eigen::PlainObjectBase >&); template void igl::ambient_occlusion, Eigen::Matrix, Eigen::Matrix >(igl::EmbreeIntersector const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, int, Eigen::PlainObjectBase >&); template void igl::ambient_occlusion, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, int, Eigen::PlainObjectBase >&); #endif