VR-Forces 4.7 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) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvCore/vrvCore.h>
13 #include <boost/signals.hpp>
14 #include <boost/unordered_set.hpp>
15 #include <string>
16 #include <deque>
17 #include <map>
18 
19 namespace makArchives
20 {
21  class DtCacheSettingsRecord;
22 }
23 
24 namespace makVrv
25 {
26  class DtDe;
27  class DtRecordSettingsBackupInterface;
28 
34  {
35  public:
36 
38  typedef boost::unordered_set<std::string> ExcludedExtensions;
39  typedef std::deque<std::string> FilePathList;
40 
42  {
44  unsigned int myCacheHint;
45 
46  std::multimap<std::string,std::string> customOptionStrings;
47  std::multimap<std::string, void*> customPluginData;
48 
49  std::string myCacheDir;
50  std::string myOriginalPath;
53 
59 
63  };
64 
67  friend class DtFileCacheCreator;
68 
70  friend class DtDeSharedState;
71 
73  virtual ~DtFileCache();
74 
76  virtual void init();
77 
79  LoadFileOptions defaultOptions() const;
80 
83  virtual bool getCachedNodeFile(const std::string& filePathIn,
84  const FilePathList& paths, std::string& cachedFilePathOut,
85  bool emitError );
86 
89  virtual bool getCachedImageFile(const std::string& filePathIn,
90  const FilePathList& paths, std::string& cachedFilePathOut,
91  bool emitError);
92 
94  virtual void setCachingEnabled(bool flag);
95 
97  virtual bool acceleratedCachingEnabled() const;
98 
103  virtual void setCompressTextures(bool compress);
104 
106  virtual bool compressTexturesEnabled() const;
107 
109  virtual void releaseResources();
110 
112  virtual void clearAccelerationCache();
113 
115  virtual void setInstancingEnabled(bool enabled);
116 
118  virtual bool instancingEnabled() const;
119 
121  bool clearInstancesOnNewScene() const;
122 
124  void setClearInstancesOnNewScene(bool clearInstances);
125 
127  void clearInstancingCache();
128 
133  void flushInstanceCache(bool multipass,bool flushNodes,
134  bool flushTextures, bool flushImages);
135 
138  unsigned int flushCycleCount();
139 
141  virtual void ts_clearInstancingCache();
142 
144  virtual void setFromRecord(const makArchives::DtCacheSettingsRecord& rec);
145 
147  virtual void getRecord(makArchives::DtCacheSettingsRecord& rec);
148 
151  virtual void getSplitRecord(std::vector<makArchives::DtCacheSettingsRecord>& rec,
152  std::vector<std::string>& fileNames) {};
153 
156  virtual void addRecords(makArchives::DtCacheSettingsRecord& recs,
157  makArchives::DtCacheSettingsRecord& combinedRec) {};
158 
160  void loadDefaults(bool loadOnlyFactorySettings = false);
161 
163  void saveAsDefaults();
164 
166  void exportSettings(const std::string& fileName);
167 
169  void importSettings(const std::string& fileName);
170 
172  virtual ExcludedExtensions& excludedExtensions();
173 
175  inline bool isExcludedExtension(const std::string& ext) const
176  {
177  return ts_isExcludedExtension(ext);
178  }
179 
180  const DtRecordSettingsBackupInterface* settingsBackup() const
181  {
182  return mySettingsBackup;
183  }
184 
186  {
187  return mySettingsBackup;
188  }
189 
192  boost::signal<void ()> signal_clearInstanceCache;
193 
194  protected:
195 
197  virtual void autoSaveDefaultsIfNeeded();
198 
200  virtual bool ts_isExcludedExtension(const std::string& ext) const;
201 
203  virtual void ts_flushInstancingCache(bool multiPass,
204  bool flushNodes, bool flushTextures, bool flushImages);
205 
208  virtual void addExcludedExtension(const std::string &ext);
209 
212  virtual void removeExcludedExtension(const std::string &ext);
213 
217  DtFileCache(DtDe& de);
218 
221  virtual bool save(const std::string& origFilename,
222  const std::string& cachedFilename, bool optimize);
223 
224  protected:
225 
231  unsigned int myFlushCycleCount;
232 
234 
236  };
237 
241  {
242 
243  public:
244 
247  static DtFileCacheCreator& instance(DtDe& theIG);
248 
250  static void registerInstance(DtDe& de, DtFileCacheCreator* instance);
251 
253  virtual DtFileCache* create(DtDe& de);
254 
255  };
256 
257 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)