31 : mSkyX(s), mController(c), mCamera(d)
41 std::pair<bool, Ogre::ConfigFile> CfgFileResult;
44 if (!CfgFileResult.first)
49 Ogre::ConfigFile &CfgFile = CfgFileResult.second;
130 "#SkyX cfg file.\n\n";
132 Data +=
"#SkyX version field\n";
140 FILE *DestinationFile = fopen((Path+
"/"+File).c_str(),
"w");
142 if (!DestinationFile)
147 fprintf(DestinationFile,
"%s", Data.c_str());
148 fclose(DestinationFile);
150 SkyXLOG(File +
" saved in " + Path +
" .");
159 Result.second.load(Ogre::ResourceGroupManager::getSingleton().openResource(File, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME));
164 SkyXLOG(
"CfgFileManager::_getCfgFile(...): " + File +
" not found in any resource group.");
165 Result.first =
false;
173 return "<int>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
178 return "<float>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
183 return "<bool>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
188 return "<vector2>" + Name +
"=" + Ogre::StringConverter::toString(Value.x) +
"x" + Ogre::StringConverter::toString(Value.y) +
"\n";
193 return "<vector3>" + Name +
"=" + Ogre::StringConverter::toString(Value.x) +
"x" + Ogre::StringConverter::toString(Value.y) +
"x" + Ogre::StringConverter::toString(Value.z) +
"\n";
198 return "<vector4>" + Name +
"=" + Ogre::StringConverter::toString(Value.x) +
"x" + Ogre::StringConverter::toString(Value.y) +
"x" + Ogre::StringConverter::toString(Value.z) +
"x" + Ogre::StringConverter::toString(Value.w) +
"\n";
203 return "<degree>" + Name +
"=" + Ogre::StringConverter::toString(Value) +
"\n";
208 for (
unsigned int k = 0; k < List.size(); k++)
221 return "SkyXVersion=" +
234 if(CfgFile.getSetting(
"HydraxVersion") != (
242 HydraxLOG(
"Config file version doesn't correspond with Hydrax version.");
252 Ogre::String Value = CfgFile.getSetting(
"<int>" + Name);
260 return Ogre::StringConverter::parseInt(Value);
266 Ogre::String Value = CfgFile.getSetting(
"<float>" + Name);
274 return Ogre::StringConverter::parseReal(Value);
280 Ogre::String Value = CfgFile.getSetting(
"<bool>" + Name);
288 return Ogre::StringConverter::parseBool(Value);
294 Ogre::String Value = CfgFile.getSetting(
"<vector2>" + Name);
298 return Ogre::Vector2(0,0);
302 return Ogre::Vector2(Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[0]),
303 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[1]));
309 Ogre::String Value = CfgFile.getSetting(
"<vector3>" + Name);
313 return Ogre::Vector3(0,0,0);
317 return Ogre::Vector3(Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[0]),
318 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[1]),
319 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[2]));
325 Ogre::String Value = CfgFile.getSetting(
"<vector4>" + Name);
329 return Ogre::Vector4(0, 0, 0, 0);
333 return Ogre::Vector4(
334 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[0]),
335 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[1]),
336 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[2]),
337 Ogre::StringConverter::parseReal(Ogre::StringUtil::split(Value,
"x")[3])
344 Ogre::String Value = CfgFile.getSetting(
"<degree>" + Name);
348 return Ogre::Degree(0);
352 return Ogre::Degree(Ogre::StringConverter::parseReal(Value));
void setOptions(const Options &_Options)
Set options.
void setMoonPhase(const Ogre::Real &mp)
Set moon phase.
void setTime(const Ogre::Vector3 &t)
Set time.
const bool _checkVersion(Ogre::ConfigFile &CfgFile) const
Check hydrax version cfg file.
BasicController * mController
~CfgFileManager()
Destructor.
const bool load(const Ogre::String &File) const
Load hydrax cfg file.
static bool _isStringInList(const Ogre::StringVector &List, const Ogre::String &Find)
const void _loadCfgFile(const Ogre::String &File, std::pair< bool, Ogre::ConfigFile > &Result) const
Load a cfg file in an Ogre::ConfigFile.
static int _getIntValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get int value.
SkyX * mSkyX
Hydrax parent pointer.
static Ogre::Degree _getDegreeValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
const bool save(const Ogre::String &File, const Ogre::String &Path="") const
Save current hydrax config to a file.
CfgFileManager(SkyX *s, BasicController *c, Ogre::Camera *d)
Constructor.
static bool _getBoolValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get bool value.
static Ogre::Real _getFloatValue(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get float value.
static Ogre::Vector4 _getVector4Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
const bool _saveToFile(const Ogre::String &Data, const Ogre::String &File, const Ogre::String &Path) const
Save a string in file.
static Ogre::Vector3 _getVector3Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector3 value.
const Ogre::String _getVersionCfgString() const
Get hydrax version cfg string.
static Ogre::String _getCfgString(const Ogre::String &Name, const int &Value)
static Ogre::Vector2 _getVector2Value(Ogre::ConfigFile &CfgFile, const Ogre::String Name)
Get vector2 value.
CloudLayer * add(const CloudLayer::Options &o)
Add a cloud layer.
const std::vector< CloudLayer * > & getCloudLayers() const
Get cloud layers.
const float getSkydomeRadius(Ogre::Camera *c) const
Get skydome radius.
void setTimeMultiplier(const Ogre::Real &TimeMultiplier)
Set time multiplier.
AtmosphereManager * getAtmosphereManager()
Get atmosphere manager.
VCloudsManager * getVCloudsManager()
Get volumetric clouds manager.
CloudsManager * getCloudsManager()
Get clouds manager.
MeshManager * getMeshManager()
Get mesh manager.
const bool & isEnabled() const
Get whether the lightning system is enabled or not.
void setLightningColor(const Ogre::Vector3 &c)
Set lightning color.
void setLightningTimeMultiplier(const Ogre::Real &m)
Set lightning time multiplier.
void setEnabled(const bool &enable)
Enable or disable the lightning system.
void setAverageLightningApparitionTime(const Ogre::Real &alat)
Set average lightning apparition time.
void setAmbientColor(const Ogre::Vector3 &AmbientColor)
Set ambient color.
void setWindDirection(const Ogre::Radian &WindDirection)
Set wind direction.
void setLightResponse(const Ogre::Vector4 &LightResponse)
Set light response.
LightningManager * getLightningManager()
Get lightning manager.
void setAmbientFactors(const Ogre::Vector4 &AmbientFactors)
Set ambient factors.
void setWheater(const float &Humidity, const float &AverageCloudsSize, const bool &DelayedResponse)
Set wheater parameters Use this funtion to update the cloud field parameters, you'll get a smart and ...
void setAutoupdate(const bool &Autoupdate)
Autoupdate volumetric clouds wind depending of the SkyX time multiplier.
void create(const Ogre::Real &radius=-1)
Create all resources.
VClouds::VClouds * getVClouds()
Get VClouds.
void setWindSpeed(const Ogre::Real &WindSpeed)
Set wind speed.
const bool & isCreated() const
Is moon manager created?
void setHeight(const Ogre::Vector2 &Height)
Set height parameters.
#define HYDRAX_VERSION_PATCH
#define HYDRAX_VERSION_MAJOR
Include external headers.
#define HYDRAX_VERSION_MINOR
#define SkyXLOG(msg)
Include external headers.
#define SKYX_VERSION_PATCH
#define SKYX_VERSION_MINOR
#define SKYX_VERSION_MAJOR
SkyX defines.