VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCDBModelOptions.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright(c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 
12 #include <osgEarth/Common>
13 #include <osgEarth/ModelSource>
14 #include <osgEarth/URI>
15 #include <osgEarth/ShaderUtils>
16 
17 namespace makVrv
18 {
19  namespace oe
20  {
21  namespace CDB
22  {
23  using namespace osgEarth;
24 
28  class CDBModelOptions : public ModelSourceOptions // NO EXPORT; header only
29  {
30  public:
31 
35  optional<float>& getRangeFactor()
36  {
37  return myRangeFactor;
38  }
39 
43  const optional<float>& getRangeFactor() const
44  {
45  return myRangeFactor;
46  }
47 
49  optional<std::string>& getCdbRootDir()
50  {
51  return myCdbRootDir;
52  }
53 
55  const optional<std::string>& getCdbRootDir() const
56  {
57  return myCdbRootDir;
58  }
59 
61  void setCdbRootDir(const std::string& CdbRootDir)
62  {
63  myCdbRootDir = CdbRootDir;
64  }
65 
67  optional<bool>& getDebug()
68  {
69  return myDebug;
70  }
71 
73  const optional<bool>& getDebug() const
74  {
75  return myDebug;
76  }
77 
80  optional<bool>& getDebugModelColor()
81  {
82  return myDebugModelColor;
83  }
84 
87  const optional<bool>& getDebugModelColor() const
88  {
89  return myDebugModelColor;
90  }
91 
93  optional<int>& getCdbDataset()
94  {
95  return myCdbDataset;
96  }
97 
99  const optional<int>& getCdbDataset() const
100  {
101  return myCdbDataset;
102  }
103 
105  optional<int>& getCdbComponentSelector1()
106  {
107  return myCdbComponentSelector1;
108  }
109 
111  const optional<int>& getCdbComponentSelector1() const
112  {
113  return myCdbComponentSelector1;
114  }
115 
117  optional<int>& getCdbComponentSelector2()
118  {
119  return myCdbComponentSelector2;
120  }
121 
123  const optional<int>& getCdbComponentSelector2() const
124  {
125  return myCdbComponentSelector2;
126  }
127 
129  optional<std::string>& getRenderingMethod()
130  {
131  return myRenderingMethod;
132  }
133 
135  const optional<std::string>& getRenderingMethod() const
136  {
137  return myRenderingMethod;
138  }
139 
141  // Can be set from the GUI or the API (this will overwrite the earth file
142  // value)
143  void setRenderingMethod(const std::string& method)
144  {
145  myRenderingMethod = method;
146  }
147 
149  optional<bool>& getNodeCaching()
150  {
151  return myNodeCaching;
152  }
153 
155  const optional<bool>& getNodeCaching() const
156  {
157  return myNodeCaching;
158  }
159 
161  optional<bool>& getUseReverseDepthBuffer()
162  {
163  return myUseReverseZBuffer;
164  }
165 
167  const optional<bool>& getUseReverseDepthBuffer() const
168  {
169  return myUseReverseZBuffer;
170  }
171 
173  optional<std::string>& getCacheId()
174  {
175  return myCacheId;
176  }
177 
179  const optional<std::string>& getCacheId() const
180  {
181  return myCacheId;
182  }
183 
185  optional<std::string>& getSigSizeFile()
186  {
187  return mySigSizeFile;
188  }
189 
191  const optional<std::string>& getSigSizeFile() const
192  {
193  return mySigSizeFile;
194  }
195 
197  optional<std::string>& getPagingDistanceFile()
198  {
199  return myPagingDistanceFile;
200  }
201 
203  const optional<std::string>& getPagingDistanceFile() const
204  {
205  return myPagingDistanceFile;
206  }
207 
209  optional<std::string>& getLightDefaultValuesFile()
210  {
211  return myLightDefaultValuesFile;
212  }
213 
215  const optional<std::string>& getLightDefaultValuesFile() const
216  {
217  return myLightDefaultValuesFile;
218  }
219 
222  optional<std::string>& getGTSpeedTreeFile()
223  {
224  return myGTSpeedTreeFile;
225  }
226 
229  const optional<std::string>& getGTSpeedTreeFile() const
230  {
231  return myGTSpeedTreeFile;
232  }
233 
236  optional<bool>& getElevationCache()
237  {
238  return myElevationCache;
239  }
240 
243  const optional<bool>& getElevationCache() const
244  {
245  return myElevationCache;
246  }
247 
251  optional<int>& getTextureMipMapOffet()
252  {
253  return myTextureMipMapOffet;
254  }
255 
259  const optional<int>& getTextureMipMapOffet() const
260  {
261  return myTextureMipMapOffet;
262  }
263 
265  optional<bool>& getSpeedtreeVRF()
266  {
267  return mySpeedtreeForVRF;
268  }
269 
271  const optional<bool>& getSpeedtreeVRF() const
272  {
273  return mySpeedtreeForVRF;
274  }
275 
277  optional<bool>& getEnableCache()
278  {
279  return myEnableCache;
280  }
281 
283  const optional<bool>& getEnableCache() const
284  {
285  return myEnableCache;
286  }
287 
289  optional<bool>& getGSTextureReuse()
290  {
291  return myEnableGSTextureReuseOptimization;
292  }
293 
295  const optional<bool>& getGSTextureReuse() const
296  {
297  return myEnableGSTextureReuseOptimization;
298  }
299 
300  public:
301 
304  ModelSourceOptions(options),
305  myRangeFactor(1.0),
306  myDebug(false),
307  myDebugModelColor(false),
308  myCdbDataset(0),
309  myCdbComponentSelector1(0),
310  myCdbComponentSelector2(0),
311  myRenderingMethod("INDIRECT_RENDERING"),
312  myNodeCaching(false),
313  myCacheId(""),
314  mySigSizeFile(""),
315  myPagingDistanceFile(""),
316  myLightDefaultValuesFile(""),
317  myGTSpeedTreeFile(""),
318  myUseReverseZBuffer(false),
319  myElevationCache(true),
320  myTextureMipMapOffet(0),
321  mySpeedtreeForVRF(false),
322  myEnableCache(true),
323  myEnableGSTextureReuseOptimization(true)
324  {
325  setDriver("cdb");
326  fromConfig(_conf);
327  }
328 
330  virtual ~CDBModelOptions() { }
331 
332  public:
333 
336  {
337  Config conf = ModelSourceOptions::getConfig();
338  conf.set("range_factor", myRangeFactor);
339  conf.set("cdb_root", myCdbRootDir);
340  conf.set("debug", myDebug);
341  conf.set("debug_modelcolor", myDebugModelColor);
342  conf.set("cdb_dataset", myCdbDataset);
343  conf.set("cdb_component_selector1", myCdbComponentSelector1);
344  conf.set("cdb_component_selector2", myCdbComponentSelector2);
345  conf.set("rendering_method", myRenderingMethod);
346  conf.set("node_caching", myNodeCaching);
347  conf.set("use_reverse_depth", myUseReverseZBuffer);
348  conf.set("cacheid", myCacheId);
349  conf.set("sigsize_file", mySigSizeFile);
350  conf.set("pagingdistance_file", myPagingDistanceFile);
351  conf.set("lightdefaultvalues_file", myLightDefaultValuesFile);
352  conf.set("speedtree_catalog", myGTSpeedTreeFile);
353  conf.set("elevation_cache", myElevationCache);
354  conf.set("texture_mipmap_offset", myTextureMipMapOffet);
355  conf.set("speedtree_enabled", mySpeedtreeForVRF);
356  conf.set("enable_cache", myEnableCache);
357  conf.set("enable_gs_texture_reuse", myEnableGSTextureReuseOptimization);
358  return conf;
359  }
360 
361  protected:
362 
364  void mergeConfig(const Config& conf)
365  {
366  ModelSourceOptions::mergeConfig(conf);
367  fromConfig(conf);
368  }
369 
370  private:
371 
373  void fromConfig(const Config& conf) {
374  conf.get("range_factor", myRangeFactor);
375  conf.get("cdb_root", myCdbRootDir);
376  conf.get("debug", myDebug);
377  conf.get("debug_modelcolor", myDebugModelColor);
378  conf.get("cdb_dataset", myCdbDataset);
379  conf.get("cdb_component_selector1", myCdbComponentSelector1);
380  conf.get("cdb_component_selector2", myCdbComponentSelector2);
381  conf.get("rendering_method", myRenderingMethod);
382  conf.get("node_caching", myNodeCaching);
383  conf.get("use_reverse_depth", myUseReverseZBuffer);
384  conf.get("cacheid", myCacheId);
385  conf.get("sigsize_file", mySigSizeFile);
386  conf.get("pagingdistance_file", myPagingDistanceFile);
387  conf.get("lightdefaultvalues_file", myLightDefaultValuesFile);
388  conf.get("speedtree_catalog", myGTSpeedTreeFile);
389  conf.get("elevation_cache", myElevationCache);
390  conf.get("texture_mipmap_offset", myTextureMipMapOffet);
391  conf.get("speedtree_enabled", mySpeedtreeForVRF);
392  conf.get("enable_cache", myEnableCache);
393  conf.get("enable_gs_texture_reuse", myEnableGSTextureReuseOptimization);
394  }
395 
397  optional<float> myRangeFactor;
399  optional<std::string> myCdbRootDir;
401  optional<bool> myDebug;
403  optional<bool> myDebugModelColor;
405  optional<int> myCdbDataset;
407  optional<int> myCdbComponentSelector1;
409  optional<int> myCdbComponentSelector2;
411  optional<std::string> myRenderingMethod;
413  optional<bool> myNodeCaching;
415  optional<bool> myUseReverseZBuffer;
417  optional<std::string> myCacheId;
419  optional<std::string> mySigSizeFile;
421  optional<std::string> myPagingDistanceFile;
423  optional<std::string> myLightDefaultValuesFile;
425  optional<std::string> myGTSpeedTreeFile;
427  optional<bool> myElevationCache;
429  optional<int> myTextureMipMapOffet;
431  optional<bool> mySpeedtreeForVRF;
433  optional<bool> myEnableCache;
440 
441  };
442  }
443  }
444 } // namespace makVrv::oe::CDB
445 
446 
const optional< std::string > & getCdbRootDir() const
getter of the Cdb root folder
Definition: DtCDBModelOptions.h:55
const optional< float > & getRangeFactor() const
Optional getter of the range factor This value change the paging in/out distance of the current insta...
Definition: DtCDBModelOptions.h:43
optional< int > & getCdbDataset()
Optional getter of the Cdb dataset code (Dxxx)
Definition: DtCDBModelOptions.h:93
optional< bool > & getElevationCache()
Optional getter of the Elevation cache (default is true) This cache file will save the model clamp el...
Definition: DtCDBModelOptions.h:236
optional< bool > mySpeedtreeForVRF
Enable speedtree processing for VRF (it&#39;s slower on VRV so we add them differently for VRF) ...
Definition: DtCDBModelOptions.h:431
optional< bool > myElevationCache
Enable or disable elevation cache.
Definition: DtCDBModelOptions.h:427
CDBModelOptions(const ConfigOptions &options=ConfigOptions())
CTOR.
Definition: DtCDBModelOptions.h:303
Config getConfig() const
Associated the string found in the earth file to the member variable.
Definition: DtCDBModelOptions.h:335
const optional< std::string > & getPagingDistanceFile() const
getter of the specific Paging Distance configuration file
Definition: DtCDBModelOptions.h:203
const optional< bool > & getEnableCache() const
getter Whether to enable CDB textures and model to get cache (medf/meif). Default= true...
Definition: DtCDBModelOptions.h:283
void setRenderingMethod(const std::string &method)
Set rendering method &quot;INDIRECT_RENDERING&quot; or &quot;OSG_RENDERING&quot;.
Definition: DtCDBModelOptions.h:143
optional< std::string > myPagingDistanceFile
Specific Model_PagingDistance.xml file for this dataset and database.
Definition: DtCDBModelOptions.h:421
optional< std::string > myGTSpeedTreeFile
Specific file for GT speed tree replacement.
Definition: DtCDBModelOptions.h:425
optional< bool > & getGSTextureReuse()
getter Whether to enable CDB GS textures reuse optimization. Default= true.
Definition: DtCDBModelOptions.h:289
optional< bool > myDebugModelColor
In debug mode it will display the model with the same LOD colors (if set to true) ...
Definition: DtCDBModelOptions.h:403
optional< std::string > & getSigSizeFile()
Optional getter of the specific SigSize configuration file.
Definition: DtCDBModelOptions.h:185
optional< int > myCdbComponentSelector2
CDB Dataset Component Selector 2.
Definition: DtCDBModelOptions.h:409
optional< std::string > & getGTSpeedTreeFile()
Optional getter of the specific GT Speed tree configuration file Configuration file to replace GT tre...
Definition: DtCDBModelOptions.h:222
optional< bool > & getNodeCaching()
getter Whether to enable caching of actual OSG Nodes. Default= false.
Definition: DtCDBModelOptions.h:149
optional< std::string > & getCacheId()
Optional getter for the cache id.
Definition: DtCDBModelOptions.h:173
optional< bool > & getDebugModelColor()
Optional getter of the debug model color if set to true, it will color model to the tile debug color...
Definition: DtCDBModelOptions.h:80
void mergeConfig(const Config &conf)
Merge this configuration to the model driver configuration.
Definition: DtCDBModelOptions.h:364
optional< bool > & getEnableCache()
getter Whether to enable CDB textures and model to get cache (medf/meif). Default= true...
Definition: DtCDBModelOptions.h:277
const optional< std::string > & getRenderingMethod() const
getter of the gs rendering method
Definition: DtCDBModelOptions.h:135
optional< std::string > & getLightDefaultValuesFile()
Optional getter of the specific Light Default Values configuration file.
Definition: DtCDBModelOptions.h:209
const optional< std::string > & getGTSpeedTreeFile() const
getter of the specific GT Speed tree configuration file Configuration file to replace GT tree models ...
Definition: DtCDBModelOptions.h:229
optional< std::string > & getCdbRootDir()
Optional getter of the Cdb root folder.
Definition: DtCDBModelOptions.h:49
optional< bool > myDebug
Do we want the CDB pager in debug mode (display lod text and boxes)
Definition: DtCDBModelOptions.h:401
optional< float > myRangeFactor
Range factor to modify the paging distance.
Definition: DtCDBModelOptions.h:397
const optional< bool > & getElevationCache() const
getter of Elevation cache (default is true) This cache file will save the model clamp elevation to sp...
Definition: DtCDBModelOptions.h:243
optional< std::string > myCacheId
Cache Id string (sub folder)
Definition: DtCDBModelOptions.h:417
optional< int > myTextureMipMapOffet
FLT Model Texture Mip Map offset (if equal to 0 load the high res texture, if 1, try to load the 1 lo...
Definition: DtCDBModelOptions.h:429
void fromConfig(const Config &conf)
Associated the string found in the earth file to the member variable.
Definition: DtCDBModelOptions.h:373
optional< int > myCdbComponentSelector1
CDB Dataset Component Selector 1.
Definition: DtCDBModelOptions.h:407
const optional< bool > & getUseReverseDepthBuffer() const
getter of the use reverse depth buffer
Definition: DtCDBModelOptions.h:167
const optional< std::string > & getSigSizeFile() const
getter of the specific SigSize configuration file
Definition: DtCDBModelOptions.h:191
const optional< int > & getCdbDataset() const
getter of the Cdb dataset code (Dxxx)
Definition: DtCDBModelOptions.h:99
optional< bool > & getUseReverseDepthBuffer()
Optional getter of the use reverse depth buffer.
Definition: DtCDBModelOptions.h:161
optional< bool > myEnableGSTextureReuseOptimization
Enable or disable runtime GS Texture reuse optimization. Default=true this could potentially cause is...
Definition: DtCDBModelOptions.h:439
const optional< bool > & getGSTextureReuse() const
getter Whether to enable CDB GS textures reuse optimization. Default= true.
Definition: DtCDBModelOptions.h:295
optional< bool > myNodeCaching
Enable or disable caching for model graph.
Definition: DtCDBModelOptions.h:413
optional< bool > myUseReverseZBuffer
Are we using the reverse depth buffer (for OpenFlight loading)
Definition: DtCDBModelOptions.h:415
void setCdbRootDir(const std::string &CdbRootDir)
setter of the Cdb root folder (use to convert relative path to absolute)
Definition: DtCDBModelOptions.h:61
Used to pass option(s) Used to pass option from the OSG earth file this &quot;cdb&quot; model driver...
Definition: DtCDBModelOptions.h:28
optional< int > myCdbDataset
CDB Dataset code.
Definition: DtCDBModelOptions.h:405
const optional< int > & getCdbComponentSelector1() const
getter of the Cdb Component Selector 1 code (Sxxx)
Definition: DtCDBModelOptions.h:111
const optional< std::string > & getLightDefaultValuesFile() const
getter of the specific Light Default Values configuration file
Definition: DtCDBModelOptions.h:215
optional< std::string > & getPagingDistanceFile()
Optional getter of the specific Paging Distance configuration file.
Definition: DtCDBModelOptions.h:197
const optional< bool > & getSpeedtreeVRF() const
getter to see if the speedtree are added for VRF or VRV (default = false)
Definition: DtCDBModelOptions.h:271
optional< int > & getCdbComponentSelector1()
Optional getter of the Cdb Component Selector 1 code (Sxxx)
Definition: DtCDBModelOptions.h:105
optional< bool > & getSpeedtreeVRF()
Optional getter to see if the speedtree are added for VRF or VRV (default = false) ...
Definition: DtCDBModelOptions.h:265
optional< int > & getTextureMipMapOffet()
Optional getter Model Texture Mip Map offset Using 1 in this value will use the 1 lower lod of each t...
Definition: DtCDBModelOptions.h:251
const optional< bool > & getNodeCaching() const
getter Whether to enable caching of actual OSG Nodes. Default= false.
Definition: DtCDBModelOptions.h:155
optional< std::string > & getRenderingMethod()
getter of the gs rendering method
Definition: DtCDBModelOptions.h:129
const optional< int > & getCdbComponentSelector2() const
getter of the Cdb Component Selector 2 code (Txxx)
Definition: DtCDBModelOptions.h:123
optional< bool > & getDebug()
Optional getter of the debug displayed info (like tile name and model name)
Definition: DtCDBModelOptions.h:67
const optional< int > & getTextureMipMapOffet() const
getter of the Model Texture Mip Map offset Using 1 in this value will use the 1 lower lod of each tex...
Definition: DtCDBModelOptions.h:259
const optional< std::string > & getCacheId() const
getter of for the cache id
Definition: DtCDBModelOptions.h:179
optional< std::string > myLightDefaultValuesFile
Specific file to replace Lights_DefaultValues_3_2.xml for Light datasets.
Definition: DtCDBModelOptions.h:423
optional< std::string > myCdbRootDir
CDB root folder.
Definition: DtCDBModelOptions.h:399
optional< std::string > myRenderingMethod
Rendering selection (default=INDIRECT_RENDERING or OSG_RENDERING)
Definition: DtCDBModelOptions.h:411
virtual ~CDBModelOptions()
DTOR.
Definition: DtCDBModelOptions.h:330
const optional< bool > & getDebugModelColor() const
getter of the debug debug model color if set to true, it will color model to the tile debug color ...
Definition: DtCDBModelOptions.h:87
optional< int > & getCdbComponentSelector2()
Optional getter of the Cdb Component Selector 2 code (Txxx)
Definition: DtCDBModelOptions.h:117
optional< float > & getRangeFactor()
Optional getter of the range factor. This value change the paging in/out distance of the current inst...
Definition: DtCDBModelOptions.h:35
optional< bool > myEnableCache
Enable or disable caching for CDB models (medf) and texture (meif). Default=true. ...
Definition: DtCDBModelOptions.h:433
const optional< bool > & getDebug() const
getter of the debug displayed info (like tile name and model name)
Definition: DtCDBModelOptions.h:73
optional< std::string > mySigSizeFile
Specific SignificantSize to SwitchDistance.xml file for this dataset and database.
Definition: DtCDBModelOptions.h:419

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)