VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtFileCache.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2008 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtFileCache.h,v $ $Revision: 1.14 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 #include <vrvCore/vrvCore.h>
16 #include <boost/signals.hpp>
17 #include <boost/unordered_set.hpp>
18 #include <string>
19 #include <deque>
20 #include <map>
21 
22 namespace makArchives
23 {
24  class DtCacheSettingsRecord;
25 }
26 
27 namespace makVrv
28 {
29  class DtDe;
30  class DtRecordSettingsBackupInterface;
31 
37  {
38  public:
39 
41  typedef boost::unordered_set<std::string> ExcludedExtensions;
42  typedef std::deque<std::string> FilePathList;
43 
45  {
47  unsigned int myCacheHint;
48 
49  std::multimap<std::string,std::string> customOptionStrings;
50  std::multimap<std::string, void*> customPluginData;
51 
52  std::string myCacheDir;
53  std::string myOriginalPath;
56 
61 
65  };
66 
69  friend class DtFileCacheCreator;
70 
72  friend class DtDeSharedState;
73 
75  virtual ~DtFileCache();
76 
78  virtual void init();
79 
81  LoadFileOptions defaultOptions() const;
82 
85  virtual bool getCachedNodeFile(const std::string& filePathIn,
86  const FilePathList& paths, std::string& cachedFilePathOut,
87  bool emitError );
88 
91  virtual bool getCachedImageFile(const std::string& filePathIn,
92  const FilePathList& paths, std::string& cachedFilePathOut,
93  bool emitError);
94 
96  virtual void setCachingEnabled(bool flag);
97 
99  virtual bool acceleratedCachingEnabled() const;
100 
105  virtual void setCompressTextures(bool compress);
106 
108  virtual bool compressTexturesEnabled() const;
109 
111  virtual void releaseResources();
112 
114  virtual void clearAccelerationCache();
115 
117  virtual void setInstancingEnabled(bool enabled);
118 
120  virtual bool instancingEnabled() const;
121 
123  bool clearInstancesOnNewScene() const;
124 
126  void setClearInstancesOnNewScene(bool clearInstances);
127 
129  void clearInstancingCache();
130 
135  void flushInstanceCache(bool multipass,bool flushNodes,
136  bool flushTextures, bool flushImages);
137 
140  unsigned int flushCycleCount();
141 
143  virtual void ts_clearInstancingCache();
144 
146  virtual void setFromRecord(const makArchives::DtCacheSettingsRecord& rec);
147 
149  virtual void getRecord(makArchives::DtCacheSettingsRecord& rec);
150 
153  virtual void getSplitRecord(std::vector<makArchives::DtCacheSettingsRecord>& rec,
154  std::vector<std::string>& fileNames) {};
155 
158  virtual void addRecords(makArchives::DtCacheSettingsRecord& recs,
159  makArchives::DtCacheSettingsRecord& combinedRec) {};
160 
162  void loadDefaults(bool loadOnlyFactorySettings = false);
163 
165  void saveAsDefaults();
166 
168  void exportSettings(const std::string& fileName);
169 
171  void importSettings(const std::string& fileName);
172 
174  virtual ExcludedExtensions& excludedExtensions();
175 
177  inline bool isExcludedExtension(const std::string& ext) const
178  {
179  return ts_isExcludedExtension(ext);
180  }
181 
182  const DtRecordSettingsBackupInterface* settingsBackup() const
183  {
184  return mySettingsBackup;
185  }
186 
188  {
189  return mySettingsBackup;
190  }
191 
194  boost::signal<void ()> signal_clearInstanceCache;
195 
196  protected:
197 
199  virtual void autoSaveDefaultsIfNeeded();
200 
202  virtual bool ts_isExcludedExtension(const std::string& ext) const;
203 
205  virtual void ts_flushInstancingCache(bool multiPass,
206  bool flushNodes, bool flushTextures, bool flushImages);
207 
210  virtual void addExcludedExtension(const std::string &ext);
211 
214  virtual void removeExcludedExtension(const std::string &ext);
215 
219  DtFileCache(DtDe& de);
220 
223  virtual bool save(const std::string& origFilename,
224  const std::string& cachedFilename, bool optimize);
225 
226  protected:
227 
233  unsigned int myFlushCycleCount;
234 
236 
238  };
239 
243  {
244 
245  public:
246 
249  static DtFileCacheCreator& instance(DtDe& theIG);
250 
252  static void registerInstance(DtDe& de, DtFileCacheCreator* instance);
253 
255  virtual DtFileCache* create(DtDe& de);
256 
257  };
258 
259 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)