00001
00002
00003 #ifndef __ITERATOR_SDS_H
00004 #define __ITERATOR_SDS_H
00005
00006 #include <esg/Definitions.h>
00007 #include <esg/Group.h>
00008 #include <esg/SceneGraphObject.h>
00009 #include <esg/iterator/Iterator.h>
00010 #include <esg/geometry/Geometry.h>
00011 #include <esg/spacesorting/SDS.h>
00012 #include <esg/List.h>
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 namespace esg {
00034
00035 class OGSCENE_EXPORT IteratorSDS : public Iterator {
00036 public:
00037 enum Traverse {
00038 NONE,
00039 RAY_INTERSECTION,
00040 HALF_SPACE,
00041 AREA,
00042 CHILDREN
00043 };
00044
00045 protected:
00046 struct RIAttr {
00047 Vector3 origin;
00048 Vector3 direction;
00049 PointEnv iEnv;
00050 float distLimit;
00051 const void* parentElement;
00052 RIAttr(const Vector3& o, const Vector3& d, float l, const void* e)
00053 : origin(o), direction(d), distLimit(l), parentElement(e) {}
00054 };
00055
00056 struct HSAttr {
00057 Vector3 origin;
00058 Vector3 direction;
00059 HSAttr(const Vector3& o, const Vector3& d)
00060 : origin(o), direction(d) {}
00061 };
00062
00063 struct ARAttr {
00064 Geometry* area;
00065 ARAttr(Geometry* e) : area(e) {}
00066 };
00067
00068 protected:
00069 RIAttr* _riAttr;
00070 HSAttr* _hsAttr;
00071 ARAttr* _arAttr;
00072 Traverse _traverse;
00073 SDS* _pAggregate;
00074 bool _iterateTangible;
00075
00076 protected:
00077 virtual SceneGraphObject* _first_child (void) = 0;
00078 virtual SceneGraphObject* _next_child (void) = 0;
00079
00080 public:
00081 IteratorSDS (SDS* );
00082 virtual ~IteratorSDS();
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 virtual void initRayIntersection (const Vector3& o ,
00093 const Vector3& d ,
00094 bool clearCache,
00095 float distLimit = MAXFLOAT,
00096 const void* parentElement = NULL);
00097
00098 virtual void initHalfSpaceSearch (const Vector3& ,
00099 const Vector3& );
00100
00101 virtual void initAreaSearch (Geometry* );
00102
00103 virtual void initChildrenSearch (void);
00104
00105
00106
00107
00108
00109 virtual SceneGraphObject* firstChild (void);
00110 virtual SceneGraphObject* nextChild (void);
00111
00112
00113
00114
00115
00116
00117
00118 virtual const void* lastExploitedElement (void) const { return NULL; }
00119 };
00120
00121 };
00122
00123 #endif // __ITERATOR_SDS_H