Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Configuration.cpp
Go to the documentation of this file.
1 #include "Application.hpp"
2 
3 using namespace libconfig;
4 
6  : m_hasResolution(false)
7  , m_isFullScreen(false)
8  , m_resolution(1024,768)
9  , m_windowTitle("Vis2 - Number5")
10  , m_pickerMode(PickerUpdateMode::Dynamic)
11  , m_pickerMaxDistance(80U)
12  , m_sceneName("Dynamic Plane")
13  , m_threadpoolSize(glm::max(2U, thread::hardware_concurrency()))
14  , m_skinnningMultiThreaded(true)
15  , m_pickerMultiThreaded(true)
16 {
17  Config cfg;
18 
19  try
20  {
21  cfg.readFile("Number5.cfg");
22  }
23  catch(const FileIOException &fioex)
24  {
25  (void)fioex;
26  return;
27  }
28  catch(const ParseException &pex)
29  {
30  cerr << "ERROR: Could not parse config-file (" << pex.getFile() << ":" << pex.getLine() << ")" << " - " << pex.getError() << endl;
31  exit(EXIT_FAILURE);
32  }
33 
34 
35  const Setting& root = cfg.getRoot();
36 
37  try
38  {
39  const Setting &window = root["window"];
40 
41  window.lookupValue("fullscreen", m_isFullScreen);
42 
43  if ( window.lookupValue("width", m_resolution.x)
44  && window.lookupValue("height", m_resolution.y) )
45  {
46  m_hasResolution = true;
47  }
48 
49  window.lookupValue("title", m_windowTitle);
50  }
51  catch(const SettingNotFoundException &nfex)
52  {
53  (void)nfex;
54  }
55 
56  try
57  {
58  const Setting &window = root["picker"];
59 
60  string mode;
61  if (window.lookupValue("mode", mode))
62  {
63  if (mode == "static")
65  }
66 
67  window.lookupValue("max-distance", *((int*)&m_pickerMaxDistance));
68  window.lookupValue("multithreaded", m_pickerMultiThreaded);
69  }
70  catch(const SettingNotFoundException &nfex)
71  {
72  (void)nfex;
73  }
74 
75  try
76  {
77  const Setting &window = root["skinning"];
78 
79  window.lookupValue("multithreaded", m_skinnningMultiThreaded);
80  }
81  catch(const SettingNotFoundException &nfex)
82  {
83  (void)nfex;
84  }
85 
86  try
87  {
88  const Setting &window = root["task-scheduler"];
89 
90  window.lookupValue("threadpool-size", m_threadpoolSize);
91  }
92  catch(const SettingNotFoundException &nfex)
93  {
94  (void)nfex;
95  }
96 
97  try
98  {
99  root.lookupValue("scene", m_sceneName);
100  }
101  catch(const SettingNotFoundException &nfex)
102  {
103  (void)nfex;
104  }
105 }
uint m_pickerMaxDistance
bool m_skinnningMultiThreaded
PickerUpdateMode
Definition: Picker.hpp:10
PickerUpdateMode m_pickerMode
string m_windowTitle
bool m_pickerMultiThreaded