1 | /*! |
---|
2 | * @file spatial_separation.h Definition of the generic spatial separation process of model data |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _SPATIAL_SEPARATION_H |
---|
6 | #define _SPATIAL_SEPARATION_H |
---|
7 | |
---|
8 | #include "base_object.h" |
---|
9 | #include "vector.h" |
---|
10 | |
---|
11 | |
---|
12 | class AbstractModel; |
---|
13 | class Quadtree; |
---|
14 | |
---|
15 | |
---|
16 | #define SEC_OFFSET 1.0 //!< the offset added to the overlapSize to ensure that there are no problems in |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | //! A class for spatial separation of vertices based arrays |
---|
21 | class SpatialSeparation : public BaseObject { |
---|
22 | |
---|
23 | public: |
---|
24 | SpatialSeparation(AbstractModel* model, float overlapSize); |
---|
25 | SpatialSeparation(AbstractModel* model, AbstractModel* playerModel); |
---|
26 | virtual ~SpatialSeparation(); |
---|
27 | |
---|
28 | void setTreeDepth(int depth) { this->treeDepth = depth; } |
---|
29 | void setMinLength(int minLength) { this->minLength = minLength; } |
---|
30 | |
---|
31 | Quadtree* createQuadtree(AbstractModel* model, float minLength); |
---|
32 | Quadtree* createQuadtree(AbstractModel* model, int treeDepth); |
---|
33 | Quadtree* createQuadtree(AbstractModel* model); |
---|
34 | |
---|
35 | inline Quadtree* getQuadtree() { return this->quadtree; } |
---|
36 | |
---|
37 | void drawQuadtree(); |
---|
38 | |
---|
39 | private: |
---|
40 | void separateZone(); |
---|
41 | |
---|
42 | |
---|
43 | private: |
---|
44 | AbstractModel* model; //!< the reference to the model that has to be handled |
---|
45 | Quadtree* quadtree; //!< the reference to the created quadtree |
---|
46 | |
---|
47 | AbstractModel* playerModel; //!< referece to the player model, if needed for overlap calculations |
---|
48 | float overlapSize; //!< the size of overlaping |
---|
49 | |
---|
50 | int treeDepth; //!< depth of the quadtree |
---|
51 | float minLength; //!< min length of a quadtree node |
---|
52 | }; |
---|
53 | |
---|
54 | #endif /* _SPATIAL_SEPARATION_H */ |
---|