Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
CfgFileManager.cpp
Go to the documentation of this file.
1/*
2--------------------------------------------------------------------------------
3This source file is part of Hydrax.
4Visit ---
5
6Copyright (C) 2008 Xavier Vergu�n Gonz�lez <xavierverguin@hotmail.com>
7 <xavyiy@gmail.com>
8
9This program is free software; you can redistribute it and/or modify it under
10the terms of the GNU Lesser General Public License as published by the Free Software
11Foundation; either version 2 of the License, or (at your option) any later
12version.
13
14This program is distributed in the hope that it will be useful, but WITHOUT
15ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17
18You should have received a copy of the GNU Lesser General Public License along with
19this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21http://www.gnu.org/copyleft/lesser.txt.
22--------------------------------------------------------------------------------
23*/
24
25#include <CfgFileManager.h>
26#include <Hydrax.h>
27
28namespace Hydrax
29{
31 : mHydrax(h)
32 {
33 }
34
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
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
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
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
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"));
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}
#define HydraxLOG(msg)
Definition Application.h:60
const Ogre::String _getVersionCfgString() const
Get hydrax version cfg string.
static Ogre::String _getCfgString(const Ogre::String &Name, const int &Value)
const bool load(const Ogre::String &File) const
Load hydrax cfg file.
static Size _getSizeValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get size value.
const void _loadRttSettings(Ogre::ConfigFile &CfgFile) const
Load rtt settings.
static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector3 value.
const bool _checkVersion(Ogre::ConfigFile &CfgFile) const
Check hydrax version cfg file.
static Ogre::Real _getFloatValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get float value.
static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
Check is a std::vector<Ogre::String> contains a specified Ogre::String.
const Ogre::String _getRttCfgString() const
Get rtt quality config string.
const bool save(const Ogre::String &File, const Ogre::String &Path="") const
Save current hydrax config to a file.
const Ogre::String _getComponentsCfgString() const
Get components config string.
static bool _getBoolValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get bool value.
const void _loadComponentsSettings(Ogre::ConfigFile &CfgFile) const
Load components settings.
static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector2 value.
const void _loadCfgFile(const Ogre::String &File, std::pair< bool, Ogre::ConfigFile > &Result) const
Load a cfg file in an Ogre::ConfigFile.
Hydrax * mHydrax
Hydrax parent pointer.
const bool _saveToFile(const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
Save a string in file.
static int _getIntValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get int value.
const bool & areObjectsIntersectionsEnabled() const
Are rays objects intersections enabled?
void setObjectIntersectionsEnabled(const bool &Enable)
Set objects intersections enabled.
void SetSimulationSpeed(const Ogre::Real &Speed)
Set god rays simulation speed.
const Ogre::Real & getSimulationSpeed() const
Get god rays simulation speed.
const int & getNumberOfRays() const
Get number of god rays.
void setRaysSize(const Ogre::Real &Size)
Set god rays size.
const Ogre::Real & getRaysSize() const
Get god rays size.
void setNumberOfRays(const int &NumberOfRays)
Set the number of god rays.
const Ogre::Real & getGlobalTransparency() const
Get global transparency.
Definition Hydrax.h:460
void setFoamTransparency(const Ogre::Real &FoamTransparency)
Set foam transparency.
Definition Hydrax.cpp:1031
RttManager * getRttManager()
Get Hydrax::RttManager.
Definition Hydrax.h:333
const Ogre::Real & getSunArea() const
Get sun area.
Definition Hydrax.h:500
const Ogre::Real & getFoamStart() const
Get foam start.
Definition Hydrax.h:532
void setShaderMode(const MaterialManager::ShaderMode &ShaderMode)
Set shader mode.
Definition Hydrax.cpp:279
void setGlobalTransparency(const Ogre::Real &GlobalTransparencyDistance)
Definition Hydrax.cpp:799
GodRaysManager * getGodRaysManager()
Get Hydrax::GodRaysManager.
Definition Hydrax.h:349
void setDistLimit(const Ogre::Real &DistLimit)
Set distance limit underwater (occlusion)
Definition Hydrax.cpp:1071
void setPosition(const Ogre::Vector3 &Position)
Set water position.
Definition Hydrax.cpp:720
void setSunArea(const Ogre::Real &SunArea)
Set sun area.
Definition Hydrax.cpp:926
const Ogre::Real & getSmoothPower() const
Get smooth power.
Definition Hydrax.h:564
void setPlanesError(const Ogre::Real &PlanesError)
Set clip planes error.
Definition Hydrax.cpp:759
void setGodRaysExposure(const Ogre::Vector3 &GodRaysExposure)
Set god rays exposure.
Definition Hydrax.h:245
const Ogre::Real & getNormalDistortion() const
Get normal distortion.
Definition Hydrax.h:484
void setFoamStart(const Ogre::Real &FoamStart)
Set foam start.
Definition Hydrax.cpp:1010
const Ogre::Vector3 & getSunPosition() const
Get sun position.
Definition Hydrax.h:468
const Ogre::Real & getFullReflectionDistance() const
Get full reflection distance.
Definition Hydrax.h:452
const Ogre::Real & getCausticsPower() const
Get caustics power.
Definition Hydrax.h:580
bool isComponent(const HydraxComponent &Component)
Returns if the especified component is active.
Definition Hydrax.cpp:612
const Ogre::Real & getSunStrength() const
Get water strength.
Definition Hydrax.h:492
const Ogre::Vector3 & getPosition() const
Get water position.
Definition Hydrax.h:413
void setComponents(const HydraxComponent &Components)
Set Hydrax components.
Definition Hydrax.cpp:302
void setCausticsPower(const Ogre::Real &CausticsPower)
Set caustics power.
Definition Hydrax.cpp:1118
void setFoamMaxDistance(const Ogre::Real &FoamMaxDistance)
Set foam max distance.
Definition Hydrax.cpp:968
const Ogre::Real & getFoamScale() const
Get foam scale.
Definition Hydrax.h:524
void setDepthLimit(const Ogre::Real &DepthLimit)
Set depth limit.
Definition Hydrax.cpp:1052
void setSunPosition(const Ogre::Vector3 &SunPosition)
Set sun position.
Definition Hydrax.cpp:884
const Ogre::Vector3 & getWaterColor() const
Get water color.
Definition Hydrax.h:476
void setFoamScale(const Ogre::Real &FoamScale)
Set foam scale.
Definition Hydrax.cpp:989
const Ogre::Real & getFoamTransparency() const
Get foam transparency.
Definition Hydrax.h:540
const MaterialManager::ShaderMode & getShaderMode() const
Get current shader mode.
Definition Hydrax.h:405
const Ogre::Real & getPlanesError() const
Get current clip planes error.
Definition Hydrax.h:421
void setCausticsScale(const Ogre::Real &CausticsScale)
Set caustics scale.
Definition Hydrax.cpp:1104
const Ogre::Vector3 & getGodRaysExposure() const
Get God rays exposure factors.
Definition Hydrax.h:596
void setSmoothPower(const Ogre::Real &SmoothPower)
Set smooth power.
Definition Hydrax.cpp:1090
const Ogre::Vector3 & getSunColor() const
Get sun color.
Definition Hydrax.h:508
void setSunStrength(const Ogre::Real &SunStrength)
Set sun strength.
Definition Hydrax.cpp:905
const Ogre::Real & getCausticsScale() const
Get caustics scale.
Definition Hydrax.h:572
void setNormalDistortion(const Ogre::Real &NormalDistortion)
Set normal distortion.
Definition Hydrax.cpp:868
const Ogre::Real & getGodRaysIntensity() const
Get God rays intensity.
Definition Hydrax.h:604
const Ogre::Real & getFoamMaxDistance() const
Get foam max distance.
Definition Hydrax.h:516
const Ogre::Real & getDepthLimit() const
Get depth limit.
Definition Hydrax.h:548
const Ogre::Real & getCausticsEnd() const
Get caustics end.
Definition Hydrax.h:588
void setSunColor(const Ogre::Vector3 &SunColor)
Set sun color.
Definition Hydrax.cpp:947
Module::Module * getModule()
Get our Hydrax::Module::Module.
Definition Hydrax.h:381
void setFullReflectionDistance(const Ogre::Real &FullReflectionDistance)
Set full reflection distance.
Definition Hydrax.cpp:783
void setWaterColor(const Ogre::Vector3 &WaterColor)
Definition Hydrax.cpp:815
void setCausticsEnd(const Ogre::Real &CausticsEnd)
Set caustics end.
Definition Hydrax.cpp:1146
void setGodRaysIntensity(const Ogre::Real &GodRaysIntensity)
Set god rays intensity.
Definition Hydrax.h:253
Noise::Noise * getNoise()
Get the Hydrax::Noise module pointer.
Definition Module.h:141
virtual void saveCfg(Ogre::String &Data)
Save config.
Definition Module.cpp:99
virtual bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
Definition Module.cpp:105
virtual bool loadCfg(Ogre::ConfigFile &CfgFile)
Load config.
Definition Noise.cpp:87
virtual void saveCfg(Ogre::String &Data)
Save config.
Definition Noise.cpp:81
const Size & getTextureSize(const RttType &Rtt) const
Definition RttManager.h:162
void setTextureSize(const RttType &Rtt, const Size &S)
Set Rtt texture size.
#define HYDRAX_VERSION_PATCH
#define HYDRAX_VERSION_MAJOR
Include external headers.
#define HYDRAX_VERSION_MINOR
HydraxComponent
Hydrax flags to select components wich we want to use.
Definition Enums.h:58
@ HYDRAX_COMPONENTS_NONE
Definition Enums.h:70
@ HYDRAX_COMPONENT_DEPTH
Definition Enums.h:61
@ HYDRAX_COMPONENT_SMOOTH
Smooth transitions and caustics components need depth component.
Definition Enums.h:63
@ HYDRAX_COMPONENT_UNDERWATER
Definition Enums.h:65
@ HYDRAX_COMPONENT_SUN
Definition Enums.h:59
@ HYDRAX_COMPONENT_UNDERWATER_GODRAYS
Definition Enums.h:68
@ HYDRAX_COMPONENT_UNDERWATER_REFLECTIONS
Underwater reflections and god rays need underwater component.
Definition Enums.h:67
@ HYDRAX_COMPONENT_FOAM
Definition Enums.h:60
@ HYDRAX_COMPONENT_CAUSTICS
Definition Enums.h:64
Struct wich contains an especific width and height value.
Definition Help.h:41
int Height
Height value.
Definition Help.h:45
int Width
Width value.
Definition Help.h:43