![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2007 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtOsgForest.h,v $ $Revision: 1.35 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtOsgForest_H_ 00014 #define DtOsgForest_H_ 00015 00016 #include <vrvOsg/vrvOsg.h> 00017 #include <vrvCore/DtForestObject.h> 00018 #include <vrvCore/DtAgentManager.h> 00019 #include <osg/ref_ptr> 00020 #include <osg/Group> 00021 00022 namespace makVrv 00023 { 00024 class DtOsgModelInstance; 00025 00028 class DT_DLL_VRVOSG DtOsgForest : public DtForestObject 00029 { 00030 00031 public: 00032 00033 typedef std::map<DtUniqueID, osg::PositionAttitudeTransform*> TreePatMap; 00034 00036 friend class DtOsgForestClassesCreator; 00037 friend class DtOsgForestCreator; 00038 00040 virtual ~DtOsgForest(); 00041 00045 00046 00048 virtual void removeTree(DtUniqueID id); 00049 00051 virtual void removeAllTrees(); 00052 00054 virtual void setTreeClippingPlane(float fFar); 00055 00057 virtual void setTreeLodDistances(float fNear, float fFar); 00058 00060 virtual void getTreeClippingPlane(float& fFar); 00061 00063 virtual void getTreeLodDistances(float& fNear, float& fFar); 00064 00066 virtual void setPerformanceProfile(int profile); 00067 00069 00073 00074 00076 virtual void addUniqueTree(const DtTreeRecord& record); 00077 00079 unsigned int treeCount() const; 00080 00082 virtual DtTreeRecord* findTreeRecord(DtUniqueID id); 00083 00085 virtual DtTreeModel* findTreeModel( const std::string& modelDef); 00086 00088 virtual DtModelInstance* findModelInstance( const std::string& modelDef); 00089 00091 virtual osg::Group* rootGroup(); 00092 00094 00095 protected: 00096 00098 DtOsgForest(DtDe& de, DtUniqueID id); 00099 00101 virtual bool createTree(const DtTreeRecord& record); 00102 00103 virtual osg::PositionAttitudeTransform* createPat( const DtTreeRecord &record ); 00104 00106 virtual DtOsgModelInstance* findOsgModelInstance( const std::string& modelDef); 00107 00109 virtual osg::PositionAttitudeTransform* findPat(const DtUniqueID id); 00110 00112 virtual void removePat(const DtUniqueID id); 00113 00115 virtual void slot_treeModelInstanceToBeDestroyed(const std::string& modelDef); 00116 00118 virtual void removeTreeModel( const std::string& modelDef); 00119 00121 virtual void slot_treeModelInstanceCreated(const std::string& modelDef); 00122 00123 protected: 00124 00125 TreePatMap myTreePatMap; 00126 00128 osg::ref_ptr<osg::Group> myRoot; 00129 float myFarPlane; 00130 float myNearLOD; 00131 float myFarLOD; 00132 00133 }; 00134 00137 class DT_DLL_VRVOSG DtOsgForestCreator : public DtForestCreator 00138 { 00139 00140 public: 00141 00143 virtual DtForestObject* create(DtDe& de, DtUniqueID id); 00144 00145 }; 00146 00147 } 00148 00149 #endif 00150