![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtCachedIntersectorManager.h,v $ $Revision: 1.9 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00018 00019 #pragma once 00020 #include <vrvCore/vrvCore.h> 00021 #include <vrvCore/DtIntersector.h> 00022 #include <boost/unordered_map.hpp> 00023 00024 #include <matrix/vlVector.h> 00025 #include <map> 00026 00027 namespace makVrv 00028 { 00029 class DtIntersectorCache; 00030 class DtCachedIntersector; 00031 00034 class DT_DLL_VRVCORE DtCachedIntersectorManager : public DtVirtualBaseClass 00035 { 00036 public: 00037 virtual ~DtCachedIntersectorManager(); 00038 00041 static DtCachedIntersectorManager& instance(DtDe& de); 00042 00044 static void registerInstance(DtDe& de, DtCachedIntersectorManager* anInstance); 00045 00047 DtCachedIntersector& modelSetIntersector(int modelSet); 00048 00052 virtual void setShareIntersectionResults(bool); 00053 bool shareIntersectionResults() const; 00054 00058 virtual void setCacheIsPermanent(bool); 00059 00061 bool cacheIsPermanent() const; 00062 00064 virtual void setCacheLimit(int); 00065 00067 int cacheLimit() const; 00068 00070 virtual void setCacheClearTime(double); 00071 00073 double cacheClearTime() const; 00074 00075 protected: 00077 virtual void onPostTick(); 00078 00079 DtCachedIntersectorManager(DtDe& de); 00080 00081 protected: 00082 typedef boost::unordered_map<int, DtCachedIntersector*> IntersectorMap; 00083 DtDe& myDe; 00084 IntersectorMap myIntersectors; 00085 00086 bool myCacheIsPermanent; 00087 double myClearTime; 00088 double myLastClearTime; 00089 int myCacheLimit; 00090 DtIntersectorCache* myCache; 00091 }; 00092 }