HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RBD_ObjectTree.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RBD_ObjectTree.h ( RBD Library, C++)
7  *
8  * COMMENTS:
9  * This provides an implementation independent way to
10  * do quick culling of RBD_Objects
11  */
12 
13 #ifndef __RBD_ObjectTree_H__
14 #define __RBD_ObjectTree_H__
15 
16 #include "RBD_API.h"
17 
18 #include <UT/UT_ValArray.h>
19 #include <UT/UT_IntArray.h>
20 #include <GEO/GEO_PointTree.h>
21 
22 class RBD_Object;
23 class BV_OBBTree;
24 
25 ///
26 /// RBD_ObjectTree is the consistent interface for object culling trees.
27 ///
29 {
30 public:
32  virtual ~RBD_ObjectTree() {}
33 
34  void appendObject(RBD_Object *obj, int idx);
35  void findOverlapIdx(RBD_Object *obj, UT_IntArray &overlap);
36  void setDirty();
37 
38 protected:
39  virtual void appendObjectSubclass(RBD_Object *obj, int idx) = 0;
40  virtual void findOverlapIdxSubclass(RBD_Object *obj,
41  UT_IntArray &overlap) = 0;
42  virtual void setDirtySubclass() = 0;
43 };
44 
45 ///
46 /// RBD_ObjectTreeSphere treats each object like a sphere and acts accordingly.
47 ///
49 {
50 public:
52  virtual ~RBD_ObjectTreeSphere();
53 
54 protected:
55  virtual void appendObjectSubclass(RBD_Object *obj, int idx);
56  virtual void findOverlapIdxSubclass(RBD_Object *obj,
57  UT_IntArray &overlap);
58  virtual void setDirtySubclass();
59 
60 private:
61  void rebuildTree();
62 
63  UT_ValArray<RBD_Object *> myObjList;
64  UT_IntArray myInfiniteObjIdx;
65  UT_IntArray myIndices;
66  GEO_PointTreeInt myPointTree;
67  bool myDirty;
68 };
69 
70 ///
71 /// RBD_ObjectTreeOBB builds a BV_OBBTree to manage the tree.
72 ///
74 {
75 public:
77  virtual ~RBD_ObjectTreeOBB();
78 
79 protected:
80  virtual void appendObjectSubclass(RBD_Object *obj, int idx);
81  virtual void findOverlapIdxSubclass(RBD_Object *obj,
82  UT_IntArray &overlap);
83  virtual void setDirtySubclass();
84 
85 private:
86  void rebuildTree();
87 
88  UT_ValArray<RBD_Object *> myObjList;
89  UT_IntArray myInfiniteObjIdx;
90  UT_IntArray myIndices;
91  bool myDirty;
92  BV_OBBTree *myOBBTree;
93 };
94 
95 ///
96 /// This is a no-op tree. All objects are returned as possilbe
97 /// overlaps. (Useful verifying behaviour)
98 ///
100 {
101 public:
103  virtual ~RBD_ObjectTreeNone();
104 
105 protected:
106  virtual void appendObjectSubclass(RBD_Object *obj, int idx);
107  virtual void findOverlapIdxSubclass(RBD_Object *obj,
108  UT_IntArray &overlap);
109  virtual void setDirtySubclass();
110 
111 private:
112  UT_IntArray myIndices;
113 };
114 
115 #endif
virtual void appendObjectSubclass(RBD_Object *obj, int idx)
#define RBD_API
Definition: RBD_API.h:10
virtual void findOverlapIdxSubclass(RBD_Object *obj, UT_IntArray &overlap)
virtual void findOverlapIdxSubclass(RBD_Object *obj, UT_IntArray &overlap)=0
virtual void appendObjectSubclass(RBD_Object *obj, int idx)=0
virtual ~RBD_ObjectTreeNone()
virtual void setDirtySubclass()
virtual ~RBD_ObjectTree()
virtual void setDirtySubclass()=0