RigsofRods
Soft-body Physics Simulation
CfgFileManager.cpp
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of Hydrax.
4 Visit ---
5 
6 Copyright (C) 2008 Xavier Verguín González <xavierverguin@hotmail.com>
7  <xavyiy@gmail.com>
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
12 version.
13 
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License along with
19 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21 http://www.gnu.org/copyleft/lesser.txt.
22 --------------------------------------------------------------------------------
23 */
24 
25 #include <CfgFileManager.h>
26 #include <Hydrax.h>
27 
28 namespace Hydrax
29 {
31  : mHydrax(h)
32  {
33  }
34 
36  {
37  }
38 
39  const bool CfgFileManager::load(const Ogre::String& File) const
40  {
41  std::pair<bool, Ogre::ConfigFile> CfgFileResult;
42  _loadCfgFile(File, CfgFileResult);
43 
44  if (!CfgFileResult.first)
45  {
46  return false;
47  }
48 
49  Ogre::ConfigFile &CfgFile = CfgFileResult.second;
50 
51  if (!_checkVersion(CfgFile))
52  {
53  return false;
54  }
55 
56  // Load main options
57  mHydrax->setPosition(_getVector3Value(CfgFile,"Position"));
58  mHydrax->setPlanesError(_getFloatValue(CfgFile,"PlanesError"));
59  mHydrax->setShaderMode(static_cast<MaterialManager::ShaderMode>(_getIntValue(CfgFile, "ShaderMode")));
60  mHydrax->setFullReflectionDistance(_getFloatValue(CfgFile,"FullReflectionDistance"));
61  mHydrax->setGlobalTransparency(_getFloatValue(CfgFile,"GlobalTransparency"));
62  mHydrax->setNormalDistortion(_getFloatValue(CfgFile,"NormalDistortion"));
63  mHydrax->setWaterColor(_getVector3Value(CfgFile,"WaterColor"));
64 
65  // Load components settings
66  _loadComponentsSettings(CfgFile);
67 
68  // Load rtt settings
69  _loadRttSettings(CfgFile);
70 
71  // Load module and noise settings
72  if (mHydrax->getModule())
73  {
74  mHydrax->getModule()->loadCfg(CfgFile);
75 
76  if (mHydrax->getModule()->getNoise())
77  {
78  mHydrax->getModule()->getNoise()->loadCfg(CfgFile);
79  }
80  }
81 
82  return true;
83  }
84 
85  const bool CfgFileManager::save(const Ogre::String& File, const Ogre::String& Path) const
86  {
87  Ogre::String Data =
88  "#Hydrax cfg file.\n\n";
89 
90  Data += "#Hydrax version field\n";
91  Data += _getVersionCfgString();
92 
93  Data += "#Main options field\n";
94  Data += _getCfgString("Position", mHydrax->getPosition());
95  Data += _getCfgString("PlanesError", mHydrax->getPlanesError());
96  Data += "#Shader mode: 0=HLSL, 1=CG, 2=GLSL\n";
97  Data += _getCfgString("ShaderMode", static_cast<int>(mHydrax->getShaderMode()));
98  Data += _getCfgString("FullReflectionDistance", mHydrax->getFullReflectionDistance());
99  Data += _getCfgString("GlobalTransparency", mHydrax->getGlobalTransparency());
100  Data += _getCfgString("NormalDistortion", mHydrax->getNormalDistortion());
101  Data += _getCfgString("WaterColor", mHydrax->getWaterColor()); Data += "\n";
102 
103  Data += "#Components field\n";
104  Data += _getComponentsCfgString();
105 
106  Data += "#Rtt quality field(0x0 = Auto)\n";
107  Data += _getRttCfgString(); Data += "\n";
108 
109  if (mHydrax->getModule())
110  {
111  mHydrax->getModule()->saveCfg(Data);
112 
113  if (mHydrax->getModule()->getNoise())
114  {
115  mHydrax->getModule()->getNoise()->saveCfg(Data);
116  }
117  }
118 
119  return _saveToFile(Data, File, Path);
120  }
121 
122  const bool CfgFileManager::_saveToFile(const Ogre::String& Data, const Ogre::String& File, const Ogre::String& Path) const
123  {
124  FILE *DestinationFile = fopen((Path+"/"+File).c_str(), "w");
125 
126  if (!DestinationFile)
127  {
128  return false;
129  }
130 
131  fprintf(DestinationFile, "%s", Data.c_str());
132  fclose(DestinationFile);
133 
134  HydraxLOG(File + " saved in " + Path + " .");
135 
136  return true;
137  }
138 
139  const void CfgFileManager::_loadCfgFile(const Ogre::String& File, std::pair<bool,Ogre::ConfigFile> &Result) const
140  {
141  try
142  {
143  Result.second.load(Ogre::ResourceGroupManager::getSingleton().openResource(File, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME));
144  Result.first = true;
145 
146  } catch(...)
147  {
148  HydraxLOG("CfgFileManager::_getCfgFile(...): " + File + " not found in any resource group.");
149  Result.first = false;
150  }
151 
152  HydraxLOG(File + " loaded.");
153  }
154 
155  Ogre::String CfgFileManager::_getCfgString(const Ogre::String &Name, const int &Value)
156  {
157  return "<int>" + Name + "=" + Ogre::StringConverter::toString(Value) + "\n";
158  }
159 
160  Ogre::String CfgFileManager::_getCfgString(const Ogre::String &Name, const Ogre::Real &Value)
161  {
162  return "<float>" + Name + "=" + Ogre::StringConverter::toString(Value) + "\n";
163  }
164 
165  Ogre::String CfgFileManager::_getCfgString(const Ogre::String &Name, const bool &Value)
166  {
167  return "<bool>" + Name + "=" + Ogre::StringConverter::toString(Value) + "\n";
168  }
169 
170  Ogre::String CfgFileManager::_getCfgString(const Ogre::String &Name, const Ogre::Vector2 &Value)
171  {
172  return "<vector2>" + Name + "=" + Ogre::StringConverter::toString(Value.x) + "x" + Ogre::StringConverter::toString(Value.y) + "\n";
173  }
174 
175  Ogre::String CfgFileManager::_getCfgString(const Ogre::String &Name, const Ogre::Vector3 &Value)
176  {
177  return "<vector3>" + Name + "=" + Ogre::StringConverter::toString(Value.x) + "x" + Ogre::StringConverter::toString(Value.y) + "x" + Ogre::StringConverter::toString(Value.z) + "\n";
178  }
179 
180  Ogre::String CfgFileManager::_getCfgString(const Ogre::String& Name, const Size& Value)
181  {
182  return "<size>" + Name + "=" + Ogre::StringConverter::toString(Value.Width) + "x" + Ogre::StringConverter::toString(Value.Height) + "\n";
183  }
184 
185  const Ogre::String CfgFileManager::_getComponentsCfgString() const
186  {
187  Ogre::String Cmpnts = "Components=";
188 
189  std::pair<bool, Ogre::String> Cmp[8] = {
190  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_SUN), "Sun"),
191  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_FOAM), "Foam"),
192  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_DEPTH), "Depth"),
193  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_SMOOTH), "Smooth"),
194  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_CAUSTICS), "Caustics"),
195  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_UNDERWATER), "Underwater"),
196  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_UNDERWATER_REFLECTIONS), "UnderwaterReflections"),
197  std::pair<bool, Ogre::String>(mHydrax->isComponent(HYDRAX_COMPONENT_UNDERWATER_GODRAYS), "UnderwaterGodRays"),};
198 
199  for (int k = 0; k < 8; k++)
200  {
201  if (Cmp[k].first)
202  {
203  Cmpnts += Cmp[k].second;
204 
205  bool isLast = true;
206 
207  for (int u = k+1; u < 8; u++)
208  {
209  if (Cmp[u].first)
210  {
211  isLast = false;
212  }
213  }
214 
215  if (!isLast)
216  {
217  Cmpnts += "|";
218  }
219  else
220  {
221  Cmpnts += "\n\n";
222  }
223  }
224  }
225 
226  // Sun parameters
227  if (Cmp[0].first)
228  {
229  Cmpnts += "#Sun parameters\n";
230  Cmpnts += _getCfgString("SunPosition", mHydrax->getSunPosition());
231  Cmpnts += _getCfgString("SunStrength", mHydrax->getSunStrength());
232  Cmpnts += _getCfgString("SunArea", mHydrax->getSunArea());
233  Cmpnts += _getCfgString("SunColor", mHydrax->getSunColor()); Cmpnts += "\n";
234  }
235  // Foam parameters
236  if (Cmp[1].first)
237  {
238  Cmpnts += "#Foam parameters\n";
239  Cmpnts += _getCfgString("FoamMaxDistance", mHydrax->getFoamMaxDistance());
240  Cmpnts += _getCfgString("FoamScale", mHydrax->getFoamScale());
241  Cmpnts += _getCfgString("FoamStart", mHydrax->getFoamStart());
242  Cmpnts += _getCfgString("FoamTransparency", mHydrax->getFoamTransparency()); Cmpnts += "\n";
243  }
244  // Depth parameters
245  if (Cmp[2].first)
246  {
247  Cmpnts += "#Depth parameters\n";
248  Cmpnts += _getCfgString("DepthLimit", mHydrax->getDepthLimit()); Cmpnts += "\n";
249  }
250  // Smooth transitions parameters
251  if (Cmp[3].first)
252  {
253  Cmpnts += "#Smooth transitions parameters\n";
254  Cmpnts += _getCfgString("SmoothPower", mHydrax->getSmoothPower()); Cmpnts += "\n";
255  }
256  // Caustics parameters
257  if (Cmp[4].first)
258  {
259  Cmpnts += "#Caustics parameters\n";
260  Cmpnts += _getCfgString("CausticsScale", mHydrax->getCausticsScale());
261  Cmpnts += _getCfgString("CausticsPower", mHydrax->getCausticsPower());
262  Cmpnts += _getCfgString("CausticsEnd", mHydrax->getCausticsEnd()); Cmpnts += "\n";
263  }
264  // God rays parameters
265  if (Cmp[7].first)
266  {
267  Cmpnts += "#God rays parameters\n";
268  Cmpnts += _getCfgString("GodRaysExposure", mHydrax->getGodRaysExposure());
269  Cmpnts += _getCfgString("GodRaysIntensity", mHydrax->getGodRaysIntensity());
270  Cmpnts += _getCfgString("GodRaysSpeed", mHydrax->getGodRaysManager()->getSimulationSpeed());
271  Cmpnts += _getCfgString("GodRaysNumberOfRays", mHydrax->getGodRaysManager()->getNumberOfRays());
272  Cmpnts += _getCfgString("GodRaysRaysSize", mHydrax->getGodRaysManager()->getRaysSize());
273  Cmpnts += _getCfgString("GodRaysIntersections", mHydrax->getGodRaysManager()->areObjectsIntersectionsEnabled()); Cmpnts += "\n";
274  }
275 
276  return Cmpnts;
277  }
278 
279  bool CfgFileManager::_isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
280  {
281  for (unsigned int k = 0; k < List.size(); k++)
282  {
283  if (List[k] == Find)
284  {
285  return true;
286  }
287  }
288 
289  return false;
290  }
291 
292  const void CfgFileManager::_loadComponentsSettings(Ogre::ConfigFile& CfgFile) const
293  {
294  Ogre::StringVector Cmpnts = Ogre::StringUtil::split(CfgFile.getSetting("Components"), "|");
295 
296  HydraxComponent ComponentsToLoad[8] = {
299 
300  if (_isStringInList(Cmpnts, "Sun"))
301  {
302  ComponentsToLoad[0] = HYDRAX_COMPONENT_SUN;
303  }
304  if (_isStringInList(Cmpnts, "Foam"))
305  {
306  ComponentsToLoad[1] = HYDRAX_COMPONENT_FOAM;
307  }
308  if (_isStringInList(Cmpnts, "Depth"))
309  {
310  ComponentsToLoad[2] = HYDRAX_COMPONENT_DEPTH;
311  }
312  if (_isStringInList(Cmpnts, "Smooth"))
313  {
314  ComponentsToLoad[3] = HYDRAX_COMPONENT_SMOOTH;
315  }
316  if (_isStringInList(Cmpnts, "Caustics"))
317  {
318  ComponentsToLoad[4] = HYDRAX_COMPONENT_CAUSTICS;
319  }
320  if (_isStringInList(Cmpnts, "Underwater"))
321  {
322  ComponentsToLoad[5] = HYDRAX_COMPONENT_UNDERWATER;
323  }
324  if (_isStringInList(Cmpnts, "UnderwaterReflections"))
325  {
326  ComponentsToLoad[6] = HYDRAX_COMPONENT_UNDERWATER_REFLECTIONS;
327  }
328  if (_isStringInList(Cmpnts, "UnderwaterGodRays"))
329  {
330  ComponentsToLoad[7] = HYDRAX_COMPONENT_UNDERWATER_GODRAYS;
331  }
332 
333  mHydrax->setComponents(static_cast<HydraxComponent>(
334  ComponentsToLoad[0] | ComponentsToLoad[1] | ComponentsToLoad[2] | ComponentsToLoad[3] |
335  ComponentsToLoad[4] | ComponentsToLoad[5] | ComponentsToLoad[6] | ComponentsToLoad[7]));
336 
337  if (_isStringInList(Cmpnts, "Sun"))
338  {
339  mHydrax->setSunPosition(_getVector3Value(CfgFile,"SunPosition"));
340  mHydrax->setSunStrength(_getFloatValue(CfgFile,"SunStrength"));
341  mHydrax->setSunArea(_getFloatValue(CfgFile,"SunArea"));
342  mHydrax->setSunColor(_getVector3Value(CfgFile,"SunColor"));
343  }
344 
345  if (_isStringInList(Cmpnts, "Foam"))
346  {
347  mHydrax->setFoamMaxDistance(_getFloatValue(CfgFile,"FoamMaxDistance"));
348  mHydrax->setFoamScale(_getFloatValue(CfgFile,"FoamScale"));
349  mHydrax->setFoamStart(_getFloatValue(CfgFile,"FoamStart"));
350  mHydrax->setFoamTransparency(_getFloatValue(CfgFile,"FoamTransparency"));
351  }
352 
353  if (_isStringInList(Cmpnts, "Depth"))
354  {
355  mHydrax->setDepthLimit(_getFloatValue(CfgFile,"DepthLimit"));
356  mHydrax->setDistLimit(_getFloatValue(CfgFile,"DistLimit"));
357  }
358 
359  if (_isStringInList(Cmpnts, "Smooth"))
360  {
361  mHydrax->setSmoothPower(_getFloatValue(CfgFile,"SmoothPower"));
362  }
363 
364  if (_isStringInList(Cmpnts, "Caustics"))
365  {
366  mHydrax->setCausticsScale(_getFloatValue(CfgFile,"CausticsScale"));
367  mHydrax->setCausticsPower(_getFloatValue(CfgFile,"CausticsPower"));
368  mHydrax->setCausticsEnd(_getFloatValue(CfgFile,"CausticsEnd"));
369  }
370 
371  if (_isStringInList(Cmpnts, "UnderwaterGodRays"))
372  {
373  mHydrax->setGodRaysExposure(_getVector3Value(CfgFile,"GodRaysExposure"));
374  mHydrax->setGodRaysIntensity(_getFloatValue(CfgFile,"GodRaysIntensity"));
375  mHydrax->getGodRaysManager()->SetSimulationSpeed(_getFloatValue(CfgFile,"GodRaysSpeed"));
376  mHydrax->getGodRaysManager()->setNumberOfRays(_getIntValue(CfgFile,"GodRaysNumberOfRays"));
377  mHydrax->getGodRaysManager()->setRaysSize(_getFloatValue(CfgFile,"GodRaysRaysSize"));
378  mHydrax->getGodRaysManager()->setObjectIntersectionsEnabled(_getBoolValue(CfgFile,"GodRaysIntersections"));
379  }
380  }
381 
382  const Ogre::String CfgFileManager::_getRttCfgString() const
383  {
384  return
390  }
391 
392  const void CfgFileManager::_loadRttSettings(Ogre::ConfigFile& CfgFile) const
393  {
394  mHydrax->getRttManager()->setTextureSize(RttManager::RTT_REFLECTION,_getSizeValue(CfgFile,"Rtt_Quality_Reflection"));
395  mHydrax->getRttManager()->setTextureSize(RttManager::RTT_REFRACTION,_getSizeValue(CfgFile,"Rtt_Quality_Refraction"));
396  mHydrax->getRttManager()->setTextureSize(RttManager::RTT_DEPTH,_getSizeValue(CfgFile,"Rtt_Quality_Depth"));
398  mHydrax->getRttManager()->setTextureSize(RttManager::RTT_GPU_NORMAL_MAP,_getSizeValue(CfgFile,"Rtt_Quality_GPUNormalMap"));
399  }
400 
401  const Ogre::String CfgFileManager::_getVersionCfgString() const
402  {
403  return "HydraxVersion=" +
404  // Major
405  Ogre::StringConverter::toString(HYDRAX_VERSION_MAJOR)+"." +
406  // Minor
407  Ogre::StringConverter::toString(HYDRAX_VERSION_MINOR)+"." +
408  // Patch
409  Ogre::StringConverter::toString(HYDRAX_VERSION_PATCH)+"\n\n";
410  }
411 
412  const bool CfgFileManager::_checkVersion(Ogre::ConfigFile& CfgFile) const
413  {
414  // accept any
415 #if 0
416  if(CfgFile.getSetting("HydraxVersion") != (
417  // Major
418  Ogre::StringConverter::toString(HYDRAX_VERSION_MAJOR)+"."+
419  // Minor
420  Ogre::StringConverter::toString(HYDRAX_VERSION_MINOR)+"."+
421  // Patch
422  Ogre::StringConverter::toString(HYDRAX_VERSION_PATCH)))
423  {
424  HydraxLOG("Config file version doesn't correspond with Hydrax version.");
425 
426  return false;
427  }
428 #endif // 0
429  return true;
430  }
431 
432  int CfgFileManager::_getIntValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name)
433  {
434  Ogre::String Value = CfgFile.getSetting("<int>" + Name);
435 
436  if (Value == "")
437  {
438  return 0;
439  }
440  else
441  {
442  return Ogre::StringConverter::parseInt(Value);
443  }
444  }
445 
446  Ogre::Real CfgFileManager::_getFloatValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name)
447  {
448  Ogre::String Value = CfgFile.getSetting("<float>" + Name);
449 
450  if (Value == "")
451  {
452  return 0;
453  }
454  else
455  {
456  return Ogre::StringConverter::parseReal(Value);
457  }
458  }
459 
460  bool CfgFileManager::_getBoolValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name)
461  {
462  Ogre::String Value = CfgFile.getSetting("<bool>" + Name);
463 
464  if (Value == "")
465  {
466  return false;
467  }
468  else
469  {
470  return Ogre::StringConverter::parseBool(Value);
471  }
472  }
473 
474  Ogre::Vector2 CfgFileManager::_getVector2Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name)
475  {
476  Ogre::String Value = CfgFile.getSetting("<vector2>" + Name);
477 
478  if (Value == "")
479  {
480  return Ogre::Vector2(0,0);
481  }
482  else
483  {
484  return Ogre::Vector2(Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value, "x")[0]),
485  Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value, "x")[1]));
486  }
487  }
488 
489  Ogre::Vector3 CfgFileManager::_getVector3Value(Ogre::ConfigFile& CfgFile, const Ogre::String Name)
490  {
491  Ogre::String Value = CfgFile.getSetting("<vector3>" + Name);
492 
493  if (Value == "")
494  {
495  return Ogre::Vector3(0,0,0);
496  }
497  else
498  {
499  return Ogre::Vector3(Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value, "x")[0]),
500  Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value, "x")[1]),
501  Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value, "x")[2]));
502  }
503  }
504 
505  Size CfgFileManager::_getSizeValue(Ogre::ConfigFile& CfgFile, const Ogre::String Name)
506  {
507  Ogre::String Value = CfgFile.getSetting("<size>" + Name);
508 
509  if (Value == "")
510  {
511  return Size(0);
512  }
513  else
514  {
515  return Size(Ogre::StringConverter::parseInt(Ogre::StringUtil::split(Value, "x")[0]),
516  Ogre::StringConverter::parseInt(Ogre::StringUtil::split(Value, "x")[1]));
517  }
518  }
519 }
Hydrax::GodRaysManager::getRaysSize
const Ogre::Real & getRaysSize() const
Get god rays size.
Definition: GodRaysManager.h:141
Hydrax::GodRaysManager::getSimulationSpeed
const Ogre::Real & getSimulationSpeed() const
Get god rays simulation speed.
Definition: GodRaysManager.h:112
Hydrax::Hydrax::getGodRaysManager
GodRaysManager * getGodRaysManager()
Get Hydrax::GodRaysManager.
Definition: Hydrax.h:349
Hydrax::Hydrax::setSunColor
void setSunColor(const Ogre::Vector3 &SunColor)
Set sun color.
Definition: Hydrax.cpp:946
Hydrax::CfgFileManager::_loadCfgFile
const void _loadCfgFile(const Ogre::String &File, std::pair< bool, Ogre::ConfigFile > &Result) const
Load a cfg file in an Ogre::ConfigFile.
Definition: CfgFileManager.cpp:139
Hydrax::Hydrax::getSunStrength
const Ogre::Real & getSunStrength() const
Get water strength.
Definition: Hydrax.h:492
Hydrax::GodRaysManager::areObjectsIntersectionsEnabled
const bool & areObjectsIntersectionsEnabled() const
Are rays objects intersections enabled?
Definition: GodRaysManager.h:194
Hydrax::Hydrax::getWaterColor
const Ogre::Vector3 & getWaterColor() const
Get water color.
Definition: Hydrax.h:476
Hydrax::Module::Module::saveCfg
virtual void saveCfg(Ogre::String &Data)
Save config.
Definition: Module.cpp:99
Hydrax::Hydrax::setDistLimit
void setDistLimit(const Ogre::Real &DistLimit)
Set distance limit underwater (occlusion)
Definition: Hydrax.cpp:1070
Hydrax::HYDRAX_COMPONENT_FOAM
@ HYDRAX_COMPONENT_FOAM
Definition: Enums.h:60
Hydrax::HYDRAX_COMPONENT_UNDERWATER_REFLECTIONS
@ HYDRAX_COMPONENT_UNDERWATER_REFLECTIONS
Underwater reflections and god rays need underwater component.
Definition: Enums.h:67
Hydrax::CfgFileManager::_getRttCfgString
const Ogre::String _getRttCfgString() const
Get rtt quality config string.
Definition: CfgFileManager.cpp:382
Hydrax::Hydrax::getPosition
const Ogre::Vector3 & getPosition() const
Get water position.
Definition: Hydrax.h:413
Hydrax::Hydrax::getPlanesError
const Ogre::Real & getPlanesError() const
Get current clip planes error.
Definition: Hydrax.h:421
Hydrax::Hydrax::getFoamTransparency
const Ogre::Real & getFoamTransparency() const
Get foam transparency.
Definition: Hydrax.h:540
Hydrax
Definition: CfgFileManager.cpp:28
Hydrax::CfgFileManager::_checkVersion
const bool _checkVersion(Ogre::ConfigFile &CfgFile) const
Check hydrax version cfg file.
Definition: CfgFileManager.cpp:412
Hydrax::HYDRAX_COMPONENT_SUN
@ HYDRAX_COMPONENT_SUN
Definition: Enums.h:59
Hydrax::Hydrax::setFoamTransparency
void setFoamTransparency(const Ogre::Real &FoamTransparency)
Set foam transparency.
Definition: Hydrax.cpp:1030
Hydrax::Hydrax::getSunColor
const Ogre::Vector3 & getSunColor() const
Get sun color.
Definition: Hydrax.h:508
Hydrax::Hydrax::setSunPosition
void setSunPosition(const Ogre::Vector3 &SunPosition)
Set sun position.
Definition: Hydrax.cpp:883
Hydrax::Size
Struct wich contains an especific width and height value.
Definition: Help.h:40
Hydrax::CfgFileManager::load
const bool load(const Ogre::String &File) const
Load hydrax cfg file.
Definition: CfgFileManager.cpp:39
Hydrax::CfgFileManager::_loadRttSettings
const void _loadRttSettings(Ogre::ConfigFile &CfgFile) const
Load rtt settings.
Definition: CfgFileManager.cpp:392
Hydrax::RttManager::RTT_GPU_NORMAL_MAP
@ RTT_GPU_NORMAL_MAP
Definition: RttManager.h:57
Hydrax::CfgFileManager::save
const bool save(const Ogre::String &File, const Ogre::String &Path="") const
Save current hydrax config to a file.
Definition: CfgFileManager.cpp:85
Hydrax::Hydrax::getGlobalTransparency
const Ogre::Real & getGlobalTransparency() const
Get global transparency.
Definition: Hydrax.h:460
Hydrax.h
Hydrax::Hydrax::getFoamScale
const Ogre::Real & getFoamScale() const
Get foam scale.
Definition: Hydrax.h:524
Hydrax::CfgFileManager::_getSizeValue
static Size _getSizeValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get size value.
Definition: CfgFileManager.cpp:505
Hydrax::RttManager::RTT_REFLECTION
@ RTT_REFLECTION
Definition: RttManager.h:52
Hydrax::Hydrax::setGodRaysExposure
void setGodRaysExposure(const Ogre::Vector3 &GodRaysExposure)
Set god rays exposure.
Definition: Hydrax.h:245
Hydrax::Noise::Noise::loadCfg
virtual bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
Definition: Noise.cpp:87
Hydrax::GodRaysManager::setObjectIntersectionsEnabled
void setObjectIntersectionsEnabled(const bool &Enable)
Set objects intersections enabled.
Definition: GodRaysManager.cpp:350
Hydrax::Hydrax::getCausticsEnd
const Ogre::Real & getCausticsEnd() const
Get caustics end.
Definition: Hydrax.h:588
Hydrax::Noise::Noise::saveCfg
virtual void saveCfg(Ogre::String &Data)
Save config.
Definition: Noise.cpp:81
Hydrax::Hydrax::setCausticsScale
void setCausticsScale(const Ogre::Real &CausticsScale)
Set caustics scale.
Definition: Hydrax.cpp:1103
Hydrax::Hydrax::setSunStrength
void setSunStrength(const Ogre::Real &SunStrength)
Set sun strength.
Definition: Hydrax.cpp:904
Hydrax::Hydrax::setFoamScale
void setFoamScale(const Ogre::Real &FoamScale)
Set foam scale.
Definition: Hydrax.cpp:988
Hydrax::CfgFileManager::_getBoolValue
static bool _getBoolValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get bool value.
Definition: CfgFileManager.cpp:460
Hydrax::Module::Module::getNoise
Noise::Noise * getNoise()
Get the Hydrax::Noise module pointer.
Definition: Module.h:141
Hydrax::Hydrax::getShaderMode
const MaterialManager::ShaderMode & getShaderMode() const
Get current shader mode.
Definition: Hydrax.h:405
Hydrax::Hydrax::getRttManager
RttManager * getRttManager()
Get Hydrax::RttManager.
Definition: Hydrax.h:333
Hydrax::CfgFileManager::_getVector3Value
static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector3 value.
Definition: CfgFileManager.cpp:489
Hydrax::Hydrax::getDepthLimit
const Ogre::Real & getDepthLimit() const
Get depth limit.
Definition: Hydrax.h:548
Hydrax::HYDRAX_COMPONENT_DEPTH
@ HYDRAX_COMPONENT_DEPTH
Definition: Enums.h:61
Hydrax::Hydrax::setSmoothPower
void setSmoothPower(const Ogre::Real &SmoothPower)
Set smooth power.
Definition: Hydrax.cpp:1089
Hydrax::CfgFileManager::_getComponentsCfgString
const Ogre::String _getComponentsCfgString() const
Get components config string.
Definition: CfgFileManager.cpp:185
Hydrax::CfgFileManager::mHydrax
Hydrax * mHydrax
Hydrax parent pointer.
Definition: CfgFileManager.h:144
Hydrax::Hydrax::getNormalDistortion
const Ogre::Real & getNormalDistortion() const
Get normal distortion.
Definition: Hydrax.h:484
Hydrax::Hydrax::setNormalDistortion
void setNormalDistortion(const Ogre::Real &NormalDistortion)
Set normal distortion.
Definition: Hydrax.cpp:867
Hydrax::Hydrax::getModule
Module::Module * getModule()
Get our Hydrax::Module::Module.
Definition: Hydrax.h:381
Hydrax::CfgFileManager::CfgFileManager
CfgFileManager(Hydrax *h)
Definition: CfgFileManager.cpp:30
Hydrax::Hydrax::isComponent
bool isComponent(const HydraxComponent &Component)
Returns if the especified component is active.
Definition: Hydrax.cpp:611
Hydrax::RttManager::RTT_DEPTH
@ RTT_DEPTH
Definition: RttManager.h:54
Hydrax::Hydrax::getGodRaysIntensity
const Ogre::Real & getGodRaysIntensity() const
Get God rays intensity.
Definition: Hydrax.h:604
Hydrax::Hydrax::setGlobalTransparency
void setGlobalTransparency(const Ogre::Real &GlobalTransparencyDistance)
Definition: Hydrax.cpp:798
Hydrax::Hydrax::setCausticsEnd
void setCausticsEnd(const Ogre::Real &CausticsEnd)
Set caustics end.
Definition: Hydrax.cpp:1145
CfgFileManager.h
HydraxLOG
#define HydraxLOG(msg)
Definition: Application.h:59
Hydrax::Hydrax::getFoamStart
const Ogre::Real & getFoamStart() const
Get foam start.
Definition: Hydrax.h:532
Hydrax::CfgFileManager::_loadComponentsSettings
const void _loadComponentsSettings(Ogre::ConfigFile &CfgFile) const
Load components settings.
Definition: CfgFileManager.cpp:292
Hydrax::Hydrax::setSunArea
void setSunArea(const Ogre::Real &SunArea)
Set sun area.
Definition: Hydrax.cpp:925
Hydrax::Hydrax::setPosition
void setPosition(const Ogre::Vector3 &Position)
Set water position.
Definition: Hydrax.cpp:719
Hydrax::GodRaysManager::SetSimulationSpeed
void SetSimulationSpeed(const Ogre::Real &Speed)
Set god rays simulation speed.
Definition: GodRaysManager.h:104
Hydrax::Hydrax::getSunArea
const Ogre::Real & getSunArea() const
Get sun area.
Definition: Hydrax.h:500
Hydrax::RttManager::RTT_DEPTH_REFLECTION
@ RTT_DEPTH_REFLECTION
Definition: RttManager.h:55
Hydrax::CfgFileManager::_getCfgString
static Ogre::String _getCfgString(const Ogre::String &Name, const int &Value)
Definition: CfgFileManager.cpp:155
Hydrax::CfgFileManager::_saveToFile
const bool _saveToFile(const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
Save a string in file.
Definition: CfgFileManager.cpp:122
Hydrax::GodRaysManager::getNumberOfRays
const int & getNumberOfRays() const
Get number of god rays.
Definition: GodRaysManager.h:125
Hydrax::Module::Module::loadCfg
virtual bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
Definition: Module.cpp:105
Hydrax::Hydrax::getFoamMaxDistance
const Ogre::Real & getFoamMaxDistance() const
Get foam max distance.
Definition: Hydrax.h:516
Hydrax::CfgFileManager::_getVersionCfgString
const Ogre::String _getVersionCfgString() const
Get hydrax version cfg string.
Definition: CfgFileManager.cpp:401
Hydrax::GodRaysManager::setNumberOfRays
void setNumberOfRays(const int &NumberOfRays)
Set the number of god rays.
Definition: GodRaysManager.cpp:333
Hydrax::CfgFileManager::~CfgFileManager
~CfgFileManager()
Definition: CfgFileManager.cpp:35
Hydrax::Hydrax::getSunPosition
const Ogre::Vector3 & getSunPosition() const
Get sun position.
Definition: Hydrax.h:468
Hydrax::HYDRAX_COMPONENT_SMOOTH
@ HYDRAX_COMPONENT_SMOOTH
Smooth transitions and caustics components need depth component.
Definition: Enums.h:63
Hydrax::Size::Width
int Width
Width value.
Definition: Help.h:43
Hydrax::Hydrax::getCausticsPower
const Ogre::Real & getCausticsPower() const
Get caustics power.
Definition: Hydrax.h:580
Hydrax::Hydrax::getGodRaysExposure
const Ogre::Vector3 & getGodRaysExposure() const
Get God rays exposure factors.
Definition: Hydrax.h:596
Hydrax::Hydrax::setFullReflectionDistance
void setFullReflectionDistance(const Ogre::Real &FullReflectionDistance)
Set full reflection distance.
Definition: Hydrax.cpp:782
Hydrax::HydraxComponent
HydraxComponent
Hydrax flags to select components wich we want to use.
Definition: Enums.h:57
Hydrax::HYDRAX_COMPONENTS_NONE
@ HYDRAX_COMPONENTS_NONE
Definition: Enums.h:70
Hydrax::Hydrax::setFoamMaxDistance
void setFoamMaxDistance(const Ogre::Real &FoamMaxDistance)
Set foam max distance.
Definition: Hydrax.cpp:967
Hydrax::HYDRAX_COMPONENT_UNDERWATER
@ HYDRAX_COMPONENT_UNDERWATER
Definition: Enums.h:65
Hydrax::RttManager::setTextureSize
void setTextureSize(const RttType &Rtt, const Size &S)
Set Rtt texture size.
Definition: RttManager.cpp:223
Hydrax::HYDRAX_COMPONENT_CAUSTICS
@ HYDRAX_COMPONENT_CAUSTICS
Definition: Enums.h:64
Hydrax::HYDRAX_COMPONENT_UNDERWATER_GODRAYS
@ HYDRAX_COMPONENT_UNDERWATER_GODRAYS
Definition: Enums.h:68
HYDRAX_VERSION_MINOR
#define HYDRAX_VERSION_MINOR
Definition: Prerequisites.h:33
Hydrax::RttManager::RTT_REFRACTION
@ RTT_REFRACTION
Definition: RttManager.h:53
Hydrax::Hydrax::getFullReflectionDistance
const Ogre::Real & getFullReflectionDistance() const
Get full reflection distance.
Definition: Hydrax.h:452
Hydrax::CfgFileManager::_getIntValue
static int _getIntValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get int value.
Definition: CfgFileManager.cpp:432
HYDRAX_VERSION_MAJOR
#define HYDRAX_VERSION_MAJOR
Include external headers.
Definition: Prerequisites.h:32
Hydrax::Hydrax::getSmoothPower
const Ogre::Real & getSmoothPower() const
Get smooth power.
Definition: Hydrax.h:564
Hydrax::CfgFileManager::_getVector2Value
static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector2 value.
Definition: CfgFileManager.cpp:474
HYDRAX_VERSION_PATCH
#define HYDRAX_VERSION_PATCH
Definition: Prerequisites.h:34
Hydrax::Hydrax::setShaderMode
void setShaderMode(const MaterialManager::ShaderMode &ShaderMode)
Set shader mode.
Definition: Hydrax.cpp:279
Hydrax::Hydrax::setPlanesError
void setPlanesError(const Ogre::Real &PlanesError)
Set clip planes error.
Definition: Hydrax.cpp:758
Hydrax::Size::Height
int Height
Height value.
Definition: Help.h:45
Hydrax::Hydrax::setFoamStart
void setFoamStart(const Ogre::Real &FoamStart)
Set foam start.
Definition: Hydrax.cpp:1009
Hydrax::CfgFileManager::_getFloatValue
static Ogre::Real _getFloatValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get float value.
Definition: CfgFileManager.cpp:446
Hydrax::MaterialManager::ShaderMode
ShaderMode
Shader mode.
Definition: MaterialManager.h:88
Hydrax::CfgFileManager::_isStringInList
static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
Check is a std::vector<Ogre::String> contains a specified Ogre::String.
Definition: CfgFileManager.cpp:279
Hydrax::Hydrax::getCausticsScale
const Ogre::Real & getCausticsScale() const
Get caustics scale.
Definition: Hydrax.h:572
Hydrax::Hydrax::setComponents
void setComponents(const HydraxComponent &Components)
Set Hydrax components.
Definition: Hydrax.cpp:301
Hydrax::RttManager::getTextureSize
const Size & getTextureSize(const RttType &Rtt) const
Definition: RttManager.h:162
Hydrax::Hydrax::setGodRaysIntensity
void setGodRaysIntensity(const Ogre::Real &GodRaysIntensity)
Set god rays intensity.
Definition: Hydrax.h:253
Hydrax::Hydrax::setDepthLimit
void setDepthLimit(const Ogre::Real &DepthLimit)
Set depth limit.
Definition: Hydrax.cpp:1051
Hydrax::Hydrax::setWaterColor
void setWaterColor(const Ogre::Vector3 &WaterColor)
Definition: Hydrax.cpp:814
Hydrax::GodRaysManager::setRaysSize
void setRaysSize(const Ogre::Real &Size)
Set god rays size.
Definition: GodRaysManager.h:133
Hydrax::Hydrax::setCausticsPower
void setCausticsPower(const Ogre::Real &CausticsPower)
Set caustics power.
Definition: Hydrax.cpp:1117