00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __SIM_BVTree_h__
00017 #define __SIM_BVTree_h__
00018
00019 #include "SIM_API.h"
00020 #include "SIM_DataUtils.h"
00021
00022 #include <UT/UT_DMatrix4.h>
00023
00024 #define SIM_NAME_BVTREETYPE "bvtreetype"
00025
00026 #define SIM_NAME_GUIDE_DEPTH "guidedepth"
00027 #define SIM_NAME_GUIDE_PRIM "guideprim"
00028 #define SIM_NAME_GUIDE_COLOR "guidecolor"
00029
00030 class UT_IStream;
00031 class BV_LeafIterator;
00032 class BV_Tree;
00033
00034
00035 class SIM_API SIM_BVTreeBase : public SIM_Data
00036 {
00037 public:
00038 enum simBVTreeType
00039 {
00040 SIM_NOTREE = -1,
00041 SIM_OBBTREE,
00042 SIM_AABBTREE,
00043 SIM_14DOPTREE,
00044 SIM_18DOPTREE,
00045 SIM_26DOPTREE
00046 };
00047 simBVTreeType getBVTreeType() const
00048 { return myBVTreeType; }
00049
00050 protected:
00051 explicit SIM_BVTreeBase(const SIM_DataFactory *factory);
00052 virtual ~SIM_BVTreeBase();
00053
00054 virtual void makeEqualSubclass(const SIM_Data *source);
00055 virtual int64 getMemorySizeSubclass() const;
00056
00057 const BV_Tree *getTree() const
00058 { return myBVTree; }
00059 BV_Tree *getTree()
00060 { return myBVTree; }
00061
00062 protected:
00063
00064
00065 void createMyTree(simBVTreeType);
00066
00067 private:
00068 BV_Tree *myBVTree;
00069 simBVTreeType myBVTreeType;
00070
00071 DECLARE_STANDARD_GETCASTTOTYPE();
00072 DECLARE_CLASSNAME(SIM_BVTreeBase, SIM_Data);
00073 };
00074
00075
00076
00077
00078
00079
00080
00081
00082 class SIM_API SIM_BVTreeStructure : public SIM_BVTreeBase
00083 {
00084 public:
00085
00086 void createTree(simBVTreeType, BV_LeafIterator &leafIt);
00087
00088 protected:
00089 explicit SIM_BVTreeStructure(const SIM_DataFactory *factory);
00090 virtual ~SIM_BVTreeStructure();
00091
00092 virtual void saveSubclass(ostream &os) const;
00093 virtual bool loadSubclass(UT_IStream &is);
00094
00095 private:
00096 DECLARE_STANDARD_GETCASTTOTYPE();
00097 DECLARE_DATAFACTORY(SIM_BVTreeStructure,
00098 SIM_BVTreeBase,
00099 "Bounding Volume Tree Structure",
00100 getEmptyDopDescription());
00101 };
00102
00103
00104
00105
00106
00107 class SIM_API SIM_BVTree : public SIM_BVTreeBase
00108 {
00109 public:
00110
00111
00112
00113 void createTree(simBVTreeType, BV_LeafIterator &leafIt);
00114
00115
00116 void updateExtents(BV_LeafIterator &leafIt);
00117
00118 BV_Tree *getTree();
00119 const BV_Tree *getTree() const;
00120
00121 static PRM_Template theGuideTemplates[];
00122
00123 protected:
00124 explicit SIM_BVTree(const SIM_DataFactory *factory);
00125 virtual ~SIM_BVTree();
00126
00127 virtual bool getIsAlternateRepresentationSubclass() const;
00128 virtual void initAlternateRepresentationSubclass(const SIM_Data &);
00129
00130 virtual SIM_Guide *createGuideObjectSubclass() const;
00131 virtual void buildGuideGeometrySubclass(const SIM_RootData &root,
00132 const SIM_Options &options,
00133 const GU_DetailHandle &gdh,
00134 UT_DMatrix4 *xform,
00135 const SIM_Time &t) const;
00136
00137 private:
00138 static SIM_DopDescription *getBVTreeDopDescription();
00139
00140 DECLARE_STANDARD_GETCASTTOTYPE();
00141 DECLARE_DATAFACTORY(SIM_BVTree,
00142 SIM_BVTreeBase,
00143 "Bounding Volume Tree",
00144 getBVTreeDopDescription());
00145 };
00146 #endif