Browse Source

Update ambient_occlusion.h

Alec Jacobson 3 years ago
parent
commit
4fff4670d3
1 changed files with 18 additions and 8 deletions
  1. 18 8
      include/igl/embree/ambient_occlusion.h

+ 18 - 8
include/igl/embree/ambient_occlusion.h

@@ -13,12 +13,11 @@ namespace igl
 {
 {
   namespace embree
   namespace embree
   {
   {
-    // Forward define
-    class EmbreeIntersector;
     // Compute ambient occlusion per given point
     // Compute ambient occlusion per given point
     //
     //
     // Inputs:
     // Inputs:
-    //    ei  EmbreeIntersector containing (V,F)
+    //    V  #V by 3 list of mesh vertex positiosn
+    //    F  #F by 3 list of mesh triangle indices into rows of V
     //    P  #P by 3 list of origin points
     //    P  #P by 3 list of origin points
     //    N  #P by 3 list of origin normals
     //    N  #P by 3 list of origin normals
     // Outputs:
     // Outputs:
@@ -26,26 +25,37 @@ namespace igl
     //      0 (not occluded)
     //      0 (not occluded)
     //
     //
     template <
     template <
+      typename DerivedV,
+      typename DerivedF,
       typename DerivedP,
       typename DerivedP,
       typename DerivedN,
       typename DerivedN,
       typename DerivedS >
       typename DerivedS >
     IGL_INLINE void ambient_occlusion(
     IGL_INLINE void ambient_occlusion(
-      const EmbreeIntersector & ei,
+      const Eigen::MatrixBase<DerivedV> & V,
+      const Eigen::MatrixBase<DerivedF> & F,
       const Eigen::MatrixBase<DerivedP> & P,
       const Eigen::MatrixBase<DerivedP> & P,
       const Eigen::MatrixBase<DerivedN> & N,
       const Eigen::MatrixBase<DerivedN> & N,
       const int num_samples,
       const int num_samples,
       Eigen::PlainObjectBase<DerivedS> & S);
       Eigen::PlainObjectBase<DerivedS> & S);
     // Wrapper which builds new EmbreeIntersector for (V,F). That's expensive so
     // Wrapper which builds new EmbreeIntersector for (V,F). That's expensive so
     // avoid this if repeatedly calling.
     // avoid this if repeatedly calling.
+    //
+    // Inputs:
+    //    ei  EmbreeIntersector containing (V,F)
+    //    P  #P by 3 list of origin points
+    //    N  #P by 3 list of origin normals
+    // Outputs:
+    //    S  #P list of ambient occlusion values between 1 (fully occluded) and
+    //      0 (not occluded)
+    //
+    // Forward define
+    class EmbreeIntersector;
     template <
     template <
-      typename DerivedV,
-      typename DerivedF,
       typename DerivedP,
       typename DerivedP,
       typename DerivedN,
       typename DerivedN,
       typename DerivedS >
       typename DerivedS >
     IGL_INLINE void ambient_occlusion(
     IGL_INLINE void ambient_occlusion(
-      const Eigen::MatrixBase<DerivedV> & V,
-      const Eigen::MatrixBase<DerivedF> & F,
+      const EmbreeIntersector & ei,
       const Eigen::MatrixBase<DerivedP> & P,
       const Eigen::MatrixBase<DerivedP> & P,
       const Eigen::MatrixBase<DerivedN> & N,
       const Eigen::MatrixBase<DerivedN> & N,
       const int num_samples,
       const int num_samples,