Browse Source

fixed bug in embreeintersector

Former-commit-id: 325969146f4fe1b89b0f39f63bdf3bf6e6913c7f
Daniele Panozzo 10 years ago
parent
commit
97cf5e5073
1 changed files with 6 additions and 4 deletions
  1. 6 4
      include/igl/embree/EmbreeIntersector.h

+ 6 - 4
include/igl/embree/EmbreeIntersector.h

@@ -137,7 +137,7 @@ namespace igl
       std::vector<Hit > &hits,
       int& num_rays,
       float tnear = 0,
-      float tfar = -1,
+      float tfar = std::numeric_limits<float>::infinity(),
       int mask = 0xFFFFFFFF) const;
 
     // Given a ray find the first hit
@@ -436,7 +436,9 @@ igl::EmbreeIntersector
   {
     ray.tnear = min_t;
     ray.tfar = tfar;
-    ray.primID = -1;
+    ray.geomID = RTC_INVALID_GEOMETRY_ID;
+    ray.primID = RTC_INVALID_GEOMETRY_ID;
+    ray.instID = RTC_INVALID_GEOMETRY_ID;
     num_rays++;
     rtcIntersect(scene,ray);
     if(ray.geomID != RTC_INVALID_GEOMETRY_ID)
@@ -447,9 +449,9 @@ igl::EmbreeIntersector
         // push min_t a bit more
         //double t_push = pow(2.0,self_hits-4)*(hit.t<eps?eps:hit.t);
         double t_push = pow(2.0,self_hits)*eps;
-#ifdef IGL_VERBOSE
+        #ifdef IGL_VERBOSE
         std::cerr<<"  t_push: "<<t_push<<endl;
-#endif
+        #endif
         //o = o+t_push*d;
         min_t += t_push;
         self_hits++;