HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_BVTree.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  */
7 
8 #ifndef __SIM_BVTree_h__
9 #define __SIM_BVTree_h__
10 
11 #include "SIM_API.h"
12 #include "SIM_DataUtils.h"
13 
14 #include <UT/UT_DMatrix4.h>
15 
16 #define SIM_NAME_BVTREETYPE "bvtreetype"
17 
18 #define SIM_NAME_GUIDE_DEPTH "guidedepth"
19 #define SIM_NAME_GUIDE_PRIM "guideprim"
20 #define SIM_NAME_GUIDE_COLOR "guidecolor"
21 
22 class UT_IStream;
23 class BV_LeafIterator;
24 class BV_Tree;
25 
26 /// A base class for bounding volume trees.
28 {
29 public:
31  {
32  SIM_NOTREE = -1,
37  SIM_26DOPTREE
38  };
40  { return myBVTreeType; }
41 
42 protected:
43  explicit SIM_BVTreeBase(const SIM_DataFactory *factory);
44  ~SIM_BVTreeBase() override;
45 
46  void makeEqualSubclass(const SIM_Data *source) override;
47  int64 getMemorySizeSubclass() const override;
48 
49  const BV_Tree *getTree() const
50  { return myBVTree; }
52  { return myBVTree; }
53 
54 protected:
55  /// Sets myBVTree to a tree of the given type. Any existing tree of the
56  /// wrong type will be destroyed.
57  void createMyTree(simBVTreeType);
58 
59 private:
60  BV_Tree *myBVTree;
61  simBVTreeType myBVTreeType;
62 
65 };
66 
67 /// This class is intended to store the *structure* of a BV tree. For
68 /// algorithms that rely on building a BV tree once and then just
69 /// updating its extents over time, the structure of that BV tree is
70 /// important, and needs to be saved to disk. This class does exactly that:
71 /// it stores structure (but not extents) to disk.
72 ///
73 /// See the SIM_ColliderBFA class for an example of usage.
75 {
76 public:
77  /// Build the OBB tree from some geometry. Takes ownership of leafIt.
78  void createTree(simBVTreeType, BV_LeafIterator &leafIt);
79 
80 protected:
81  explicit SIM_BVTreeStructure(const SIM_DataFactory *factory);
82  ~SIM_BVTreeStructure() override;
83 
84  void saveSubclass(std::ostream &os) const override;
85  bool loadSubclass(UT_IStream &is) override;
86 
87 private:
91  "Bounding Volume Tree Structure",
93 };
94 
95 /// This class is a regular BV tree. It is implemented as an "alternate
96 /// representation". When being initialized, it does not grab data directly
97 /// from the parent data, but looks for a child SIM_BVTreeStructure of
98 /// the parent, and builds itself from that.
100 {
101 public:
102  /// Creation is unnecessary if using the auxiliary BVStructure data.
103  /// If BVStructure is not being used, however, this method can be used
104  /// to set up a vanilla bv tree.
105  void createTree(simBVTreeType, BV_LeafIterator &leafIt);
106  /// Initialize usingany structure data on the parent, then update the
107  /// extents.
108  void updateExtents(BV_LeafIterator &leafIt);
109 
110  BV_Tree *getTree();
111  const BV_Tree *getTree() const;
112 
113  static PRM_Template theGuideTemplates[];
114 
115 protected:
116  explicit SIM_BVTree(const SIM_DataFactory *factory);
117  ~SIM_BVTree() override;
118 
119  bool getIsAlternateRepresentationSubclass() const override;
121  const SIM_Data &) override;
122 
123  SIM_Guide *createGuideObjectSubclass() const override;
125  const SIM_RootData &root,
126  const SIM_Options &options,
127  const GU_DetailHandle &gdh,
128  UT_DMatrix4 *xform,
129  const SIM_Time &t) const override;
130 
131 private:
132  static SIM_DopDescription *getBVTreeDopDescription();
133 
137  "Bounding Volume Tree",
138  getBVTreeDopDescription());
139 };
140 #endif
virtual void makeEqualSubclass(const SIM_Data *source)
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
#define DECLARE_CLASSNAME(DataClass, SuperClass)
Definition: SIM_DataUtils.h:20
virtual bool loadSubclass(UT_IStream &is)
virtual bool getIsAlternateRepresentationSubclass() const
simBVTreeType getBVTreeType() const
Definition: SIM_BVTree.h:39
virtual int64 getMemorySizeSubclass() const
virtual void buildGuideGeometrySubclass(const SIM_RootData &root, const SIM_Options &options, const GU_DetailHandle &gdh, UT_DMatrix4 *xform, const SIM_Time &t) const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
virtual void saveSubclass(std::ostream &os) const
long long int64
Definition: SYS_Types.h:116
BV_Tree * getTree()
Definition: SIM_BVTree.h:51
GLdouble t
Definition: glad.h:2397
const BV_Tree * getTree() const
Definition: SIM_BVTree.h:49
#define SIM_API
Definition: SIM_API.h:12
virtual void initAlternateRepresentationSubclass(const SIM_Data &)
static const SIM_DopDescription * getEmptyDopDescription()
A DOP description that says not to create an automatic DOP.
A base class for bounding volume trees.
Definition: SIM_BVTree.h:27
virtual SIM_Guide * createGuideObjectSubclass() const