Open cuilantao opened 4 years ago
@chl9797 Can you elaborate please? I'm not sure if I get what you mean
Just a little confusing when to use descendent->ray_intersection
vs left->
and what to pass as the last argument. As I can see from the header files, once we are at the leafs that last argument doesn't even matter, is this correct? Not really sure descendent
comes into play tbh
If you're currently evaluating a leaf node (non-AABBTree object), and you determine that this object is being hit before any other object, we need to set a reference to this object, so that when we go up in the chain of recursive call, the caller will still have a reference to the object that has been hit. Otherwise, how would the caller know which specific object the ray has hit?
If the hit was found at a descendant, pass along a pointer to that descendant (only necessary for hierarchical Objects) (see object.h). Note that "AABBTree_ray_intersect" can be called recursively, and the "descendant" is set to the pointer to the leaf node being hit (if there is a hit).