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