SO3Engine
|
#include <SO3UniversalClock.h>
Public Member Functions | |
SUniversalClock () | |
void | SetTimeScale (const float &scale) |
float | GetTimeScale () const |
void | Update (const float &time) |
void | SetJulianDay (const double &value) |
void | SetGregorianDateTime (const int &year, const int &month, const int &day, const int &hour, const int &minute, const double &second) |
void | GetGregorianDateTime (int &year, int &month, int &day, int &hour, int &minute, double &second) |
double | GetJulianDay () const |
double | GetJulianDayDifference () const |
double | GetJulianSecond () const |
double | GetJulianSecondDifference () const |
Static Public Attributes | |
static const double | SECONDS_PER_DAY = 86400.0 |
Number of seconds per day; exactly 60*60*24. | |
Detailed Description
The system's time model. This class is responsible of keeping track of current astronomical time and syncronising with ogre time.
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 45 of file SO3UniversalClock.h.
Constructor & Destructor Documentation
◆ SUniversalClock()
SO3::SUniversalClock::SUniversalClock | ( | ) |
Constructor.
Definition at line 37 of file SO3UniversalClock.cpp.
Member Function Documentation
◆ GetGregorianDateTime()
void SO3::SUniversalClock::GetGregorianDateTime | ( | int & | year, |
int & | month, | ||
int & | day, | ||
int & | hour, | ||
int & | minute, | ||
double & | second | ||
) |
Definition at line 49 of file SO3UniversalClock.cpp.
◆ GetJulianDay()
double SO3::SUniversalClock::GetJulianDay | ( | ) | const |
Get current julian day.
Definition at line 62 of file SO3UniversalClock.cpp.
◆ GetJulianDayDifference()
double SO3::SUniversalClock::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 69 of file SO3UniversalClock.cpp.
◆ GetJulianSecond()
double SO3::SUniversalClock::GetJulianSecond | ( | ) | const |
Get the current julian second (getJulianDay * SECONDS_PER_DAY) This is most likely very very large and unprecise.
Definition at line 75 of file SO3UniversalClock.cpp.
◆ GetJulianSecondDifference()
double SO3::SUniversalClock::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 82 of file SO3UniversalClock.cpp.
◆ GetTimeScale()
Ogre::Real SO3::SUniversalClock::GetTimeScale | ( | ) | const |
Gets the time scale.
- Returns
- The current time scale. Defaults to 1.
Definition at line 93 of file SO3UniversalClock.cpp.
◆ SetGregorianDateTime()
void SO3::SUniversalClock::SetGregorianDateTime | ( | const int & | year, |
const int & | month, | ||
const int & | day, | ||
const int & | hour, | ||
const int & | minute, | ||
const double & | second | ||
) |
Set the current time as a gregorian date. This is here as an easy to use function.
Definition at line 43 of file SO3UniversalClock.cpp.
◆ SetJulianDay()
void SO3::SUniversalClock::SetJulianDay | ( | const double & | 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 55 of file SO3UniversalClock.cpp.
◆ SetTimeScale()
void SO3::SUniversalClock::SetTimeScale | ( | const float & | scale | ) |
Sets the time scale.
- Parameters
-
scale The new time scale. If negative, time will move backwards; 2.0 means double speed...
Definition at line 88 of file SO3UniversalClock.cpp.
◆ Update()
void SO3::SUniversalClock::Update | ( | const float & | time | ) |
Updates the clock.
- Parameters
-
time The time to be added to the clock. It will beaffected by the time scale.
Definition at line 98 of file SO3UniversalClock.cpp.
Member Data Documentation
◆ SECONDS_PER_DAY
|
static |
Number of seconds per day; exactly 60*60*24.
Definition at line 48 of file SO3UniversalClock.h.
The documentation for this class was generated from the following files:
- include/SO3Utils/SO3UniversalClock.h
- src/SO3Utils/SO3UniversalClock.cpp
Generated by 1.9.8