00001 /* $Id: IteratorBVH.h,v 1.4 2002/11/05 14:31:15 anonymous Exp $ */ 00002 00003 #ifndef __ITERATOR_BVH_H 00004 #define __ITERATOR_BVH_H 00005 00006 #include <esg/SceneGraphObject.h> 00007 #include <esg/spacesorting/SDS.h> 00008 #include <esg/spacesorting/BVH.h> 00009 #include <esg/iterator/Iterator.h> 00010 #include <esg/iterator/IteratorSDS.h> 00011 #include <esg/Statistics.h> 00012 00013 #include <vector> 00014 00015 namespace esg { 00016 00017 class OGSCENE_EXPORT IteratorBVH : public IteratorSDS { 00018 #ifdef ESG_STATISTICS 00019 private: 00020 unsigned long _bvTestsCounter; 00021 unsigned long _bvTestsSucCounter; 00022 #endif // ESG_STATISTICS 00023 00024 protected: 00025 std::vector<BVH::Node*> _stack; // or std::stack<> over a vector container 00026 00027 protected: 00028 SceneGraphObject* _first_ray_intersection (BVH::Node*); 00029 SceneGraphObject* _next_ray_intersection (void); 00030 SceneGraphObject* _halfspace_search (void); 00031 SceneGraphObject* _area_search (void); 00032 SceneGraphObject* _children_search (void); 00033 00034 virtual SceneGraphObject* _first_child (void); 00035 virtual SceneGraphObject* _next_child (void); 00036 00037 protected: 00038 BVH::Node * _pLastUsedChild; 00039 BVH::Node * _pBottomUpNode;; 00040 00041 public: 00042 IteratorBVH (BVH* bvh); 00043 00044 virtual ~IteratorBVH () { while (!_stack.empty()) { _stack.pop_back(); }} 00045 00046 virtual const void* lastExploitedElement (void) const { 00047 return _pLastUsedChild; 00048 } 00049 }; 00050 00051 }; // namespace 00052 00053 #endif // __ITERATOR_BVH_H