66 Caelum::CaelumPlugin* ptr = Caelum::CaelumPlugin::getSingletonPtr();
71 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(
"Caelum");
72 Caelum::CaelumPlugin::getSingleton().shutdown();
86 new Caelum::CaelumPlugin();
87 Caelum::CaelumPlugin::getSingleton().initialise();
89 catch (Ogre::Exception &e)
91 if (e.getDescription() !=
"!msSingleton failed. There can be only one singleton")
92 ReportFatalError(
"Error initializing Caelum plugin:\nDetails: " + e.getDescription());
103 bool sky_result =
true;
108 if (sky_result ==
false)
128 Ogre::RenderSystemCapabilities::ShaderProfiles profiles =
vm->
GetHAL()->
mRoot->getRenderSystem()->getCapabilities()->getSupportedShaderProfiles();
131 if (profiles.find(
"ps_2_0") == profiles.end() ||
132 profiles.find(
"vs_2_0") == profiles.end())
133 return ReportFatalError(
"Error initializing Caelum: 2.0 shaders not supported");
136 if (profiles.find(
"ps_3_0") == profiles.end() &&
137 profiles.find(
"fp40") == profiles.end())
138 return ReportFatalError(
"Error initializing Caelum: 3.0 fragment shaders not supported");
141 if (profiles.find(
"vs_3_0") == profiles.end() &&
142 profiles.find(
"vp40") == profiles.end())
143 return ReportFatalError(
"Error initializing Caelum: 3.0 vertex shaders not supported");
149 Ogre::RenderSystemCapabilities::ShaderProfiles profiles =
vm->
GetHAL()->
mRoot->getRenderSystem()->getCapabilities()->getSupportedShaderProfiles();
152 if (profiles.find(
"arbfp1") == profiles.end())
153 return ReportFatalError(
"Error initializing Caelum: fragment programs not supported");
156 if (profiles.find(
"arbvp1") == profiles.end())
157 return ReportFatalError(
"Error initializing Caelum: vertex programs not supported");
163 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"data/caelum",
"FileSystem",
"Caelum",
false);
164 Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(
"Caelum");
170 catch (Ogre::Exception &e)
172#if OGRE_PLATFORM != OGRE_PLATFORM_APPLE
173 ReportFatalError(
"Error initializing Caelum:\nDetails: " + e.getDescription());
192 for (
size_t i = 0; i <
vm->
GetHAL()->mViewports.size(); i++)
209 mCaelumSystem->getCaelumGroundNode()->setScale(scale, scale, scale);
210 mCaelumSystem->getCaelumCameraNode()->setScale(scale, scale, scale);
212 catch (Ogre::Exception &e)
214 ReportFatalError(
"Error setting Caelum parameters:\nDetails: " + e.getDescription());
257 for (
size_t i = 0; i <
vm->
GetHAL()->mCameras.size(); i++)
278 time_t now = time(0);
281 tm* gmtm = gmtime(&now);
286 double julian = Caelum::Astronomy::getJulianDayFromGregorianDateTime(gmtm->tm_year + 1900, gmtm->tm_mon + 1, gmtm->tm_mday, gmtm->tm_hour, gmtm->tm_min, gmtm->tm_sec);
308 Caelum::LongReal julian =
mCaelumSystem->getJulianDay(), sec;
309 int year, month, day;
310 Caelum::Astronomy::getGregorianDateTimeFromJulianDay(julian, year, month, day, hour, minute, sec);
316 Caelum::LongReal julian =
mCaelumSystem->getJulianDay(), second;
318 Caelum::Astronomy::getGregorianDateTimeFromJulianDay(julian, year, month, day, hour, minute, second);
319 second = (int)second;
unsigned long GetElapsedTime()
void EnableSkybox(bool value)
bool ReportFatalError(const std::string &message, const std::string &prompt)
Ogre::SceneManager * GetSceneManager()
std::vector< Ogre::Viewport * > mViewports
Real GetConfigFloat(Ogre::ConfigFile *file, const std::string &key, Real default_value)
bool GetConfigBool(Ogre::ConfigFile *file, const std::string &key, bool default_value)
std::vector< Ogre::Camera * > mCameras
void Report(const std::string &message, const std::string &prompt)
bool ReportError(const std::string &message, const std::string &prompt)
Ogre::ConfigFile * configfile
bool ReportError(const std::string &message)
void GetTime(int &hour, int &minute, int &second)
Caelum::CaelumSystem * mCaelumSystem
void SetDateTime(double julian_date_time)
bool InitSky(EngineContext *engine)
void CreateSky(EngineContext *engine)
void GetDate(int &year, int &month, int &day)
bool ReportFatalError(const std::string &message)
void EnableSky(bool value)
void Report(const std::string &message)
void SetLocation(Real latitude, Real longitude)
EngineContext * GetActiveEngine()
EngineContext * GetEngine(int number)
Ogre::Quaternion Quaternion
#define SBS_PROFILE_MAIN(name)