66 Caelum::CaelumPlugin* ptr = Caelum::CaelumPlugin::getSingletonPtr();
71 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(
"Caelum");
72 Caelum::CaelumPlugin::getSingleton().shutdown();
82 bool sky_result =
true;
84 if (use_caelum ==
true)
89 new Caelum::CaelumPlugin();
90 Caelum::CaelumPlugin::getSingleton().initialise();
92 catch (Ogre::Exception &e)
94 if (e.getDescription() !=
"!msSingleton failed. There can be only one singleton")
95 ReportFatalError(
"Error initializing Caelum plugin:\nDetails: " + e.getDescription());
102 if (sky_result ==
false || use_caelum ==
false)
122 Ogre::RenderSystemCapabilities::ShaderProfiles profiles =
vm->
GetHAL()->
mRoot->getRenderSystem()->getCapabilities()->getSupportedShaderProfiles();
125 if (profiles.find(
"ps_2_0") == profiles.end() ||
126 profiles.find(
"vs_2_0") == profiles.end())
127 return ReportFatalError(
"Error initializing Caelum: 2.0 shaders not supported");
130 if (profiles.find(
"ps_3_0") == profiles.end() &&
131 profiles.find(
"fp40") == profiles.end())
132 return ReportFatalError(
"Error initializing Caelum: 3.0 fragment shaders not supported");
135 if (profiles.find(
"vs_3_0") == profiles.end() &&
136 profiles.find(
"vp40") == profiles.end())
137 return ReportFatalError(
"Error initializing Caelum: 3.0 vertex shaders not supported");
143 Ogre::RenderSystemCapabilities::ShaderProfiles profiles =
vm->
GetHAL()->
mRoot->getRenderSystem()->getCapabilities()->getSupportedShaderProfiles();
146 if (profiles.find(
"arbfp1") == profiles.end())
147 return ReportFatalError(
"Error initializing Caelum: fragment programs not supported");
150 if (profiles.find(
"arbvp1") == profiles.end())
151 return ReportFatalError(
"Error initializing Caelum: vertex programs not supported");
157 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"data/caelum",
"FileSystem",
"Caelum",
false);
158 Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(
"Caelum");
164 catch (Ogre::Exception &e)
166#if OGRE_PLATFORM != OGRE_PLATFORM_APPLE
167 ReportFatalError(
"Error initializing Caelum:\nDetails: " + e.getDescription());
186 for (
size_t i = 0; i <
vm->
GetHAL()->mViewports.size(); i++)
203 mCaelumSystem->getCaelumGroundNode()->setScale(scale, scale, scale);
204 mCaelumSystem->getCaelumCameraNode()->setScale(scale, scale, scale);
206 catch (Ogre::Exception &e)
208 ReportFatalError(
"Error setting Caelum parameters:\nDetails: " + e.getDescription());
251 for (
size_t i = 0; i <
vm->
GetHAL()->mCameras.size(); i++)
272 time_t now = time(0);
275 tm* gmtm = gmtime(&now);
280 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);
302 Caelum::LongReal julian =
mCaelumSystem->getJulianDay(), sec;
303 int year, month, day;
304 Caelum::Astronomy::getGregorianDateTimeFromJulianDay(julian, year, month, day, hour, minute, sec);
310 Caelum::LongReal julian =
mCaelumSystem->getJulianDay(), second;
312 Caelum::Astronomy::getGregorianDateTimeFromJulianDay(julian, year, month, day, hour, minute, second);
313 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)