#include <UniversalClock.h>
Public Member Functions | |
UniversalClock () | |
void | setTimeScale (const Ogre::Real scale) |
Ogre::Real | getTimeScale () const |
void | setUpdateRate (const Ogre::Real rate) |
Ogre::Real | getUpdateRate () const |
bool | update (const Ogre::Real time) |
void | setJulianDay (LongReal value) |
void | setGregorianDateTime (int year, int month, int day, int hour, int minute, double second) |
LongReal | getJulianDay () const |
LongReal | getJulianDayDifference () const |
LongReal | getJulianSecond () const |
LongReal | getJulianSecondDifference () const |
Static Public Attributes | |
static const LongReal | SECONDS_PER_DAY = 86400.0 |
It maintains a snapshot point: At mCurrentTime == 0 julian day was mJulianDayBase. At any time the julian day can be calculated from mCurrentTime and mJulianDayBase. This increases precission; mCurrentTime is tracked in seconds while mJulianDayBase uses days. It would be silly to track the current time in days.
Definition at line 37 of file UniversalClock.h.
caelum::UniversalClock::UniversalClock | ( | ) |
Constructor.
Definition at line 29 of file UniversalClock.cpp.
References caelum::Astronomy::J2000, setJulianDay(), setTimeScale(), and setUpdateRate().
void caelum::UniversalClock::setTimeScale | ( | const Ogre::Real | scale | ) |
Sets the time scale.
scale | The new time scale. If negative, time will move backwards; 2.0 means double speed... |
Definition at line 75 of file UniversalClock.cpp.
Referenced by UniversalClock().
Ogre::Real caelum::UniversalClock::getTimeScale | ( | ) | const |
Gets the time scale.
Definition at line 79 of file UniversalClock.cpp.
void caelum::UniversalClock::setUpdateRate | ( | const Ogre::Real | rate | ) |
Sets the update rate.
rate | A positive number representing the number of seconds to be elapsed (in real time) since the last update. Negative numbers will be clamped to 0 (update every frame). |
Definition at line 83 of file UniversalClock.cpp.
Referenced by UniversalClock().
Ogre::Real caelum::UniversalClock::getUpdateRate | ( | ) | const |
Gets the update rate.
Definition at line 93 of file UniversalClock.cpp.
bool caelum::UniversalClock::update | ( | const Ogre::Real | time | ) |
Updates the clock.
time | The time to be added to the clock. Note this will be affected by the time scale. |
Definition at line 97 of file UniversalClock.cpp.
Referenced by caelum::CaelumSystem::updateSubcomponents().
void caelum::UniversalClock::setJulianDay | ( | caelum::LongReal | value | ) |
Set the current time as a julian day. Set the current time as a julian day, which you build using one of the static getJulianDayFromXXX functions. Defaults to J2000 (noon january 1st)
Definition at line 37 of file UniversalClock.cpp.
Referenced by UniversalClock().
caelum::LongReal caelum::UniversalClock::getJulianDay | ( | ) | const |
Get current julian day.
Definition at line 52 of file UniversalClock.cpp.
References caelum::Astronomy::enterHighPrecissionFloatingPointMode(), and caelum::Astronomy::restoreFloatingPointMode().
Referenced by caelum::CaelumSystem::updateSubcomponents().
caelum::LongReal caelum::UniversalClock::getJulianDayDifference | ( | ) | const |
Get the difference in julian day between this and the last update. This is most likely very small and unprecise.
Definition at line 60 of file UniversalClock.cpp.
caelum::LongReal caelum::UniversalClock::getJulianSecond | ( | ) | const |
Get the current julian second (getJulianDay * SECONDS_PER_DAY) This is most likely very very large and unprecise.
Definition at line 64 of file UniversalClock.cpp.
References caelum::Astronomy::enterHighPrecissionFloatingPointMode(), and caelum::Astronomy::restoreFloatingPointMode().
caelum::LongReal caelum::UniversalClock::getJulianSecondDifference | ( | ) | const |
Get the difference in seconds between this and the last update. This is what you want for per-frame updates.
Definition at line 71 of file UniversalClock.cpp.
Referenced by caelum::CaelumSystem::updateSubcomponents().