00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #include "SO3Moon.h"
00036 #include "SO3Environment.h"
00037
00038 namespace SO3
00039 {
00040
00041 SMoon::SMoon(SEnvironment* parent, std::string moonName) : SSkyLight(parent, moonName)
00042 {
00043 moonPhase = 0.0f;
00044 moonTextureName = "SkyX_Moon.png";
00045 }
00046
00047 SMoon::SMoon() : SSkyLight(0, "")
00048 {
00049
00050 }
00051
00052 SMoon::~SMoon()
00053 {
00054 }
00055
00056 const Ogre::Real SMoon::GetPhase()
00057 {
00058 return moonPhase;
00059 }
00060
00061 const Ogre::Vector3 SMoon::ComputeDirectionImpl(double julianDay)
00062 {
00063
00064 SAstronomy::GetMoonPhase(julianDay, moonPhase);
00065
00066
00067 return GetMoonDirection(julianDay);
00068 }
00069
00070 const Ogre::Vector3 SMoon::GetMoonDirection(double jday)
00071 {
00072 Ogre::Degree azimuth, altitude;
00073 {
00074 ScopedHighPrecissionFloatSwitch precisionSwitch;
00075 SAstronomy::GetHorizontalMoonPosition(jday, parentEnvironment->GetLongitude(), parentEnvironment->GetLatitude(), azimuth, altitude);
00076 }
00077 Ogre::Vector3 res = MakeDirection(azimuth, altitude);
00078 return res;
00079 }
00080
00081 std::string SMoon::GetTextureName()
00082 {
00083 return moonTextureName;
00084 }
00085
00086 void SMoon::SetTextureName(std::string newTextureName)
00087 {
00088 moonTextureName = newTextureName;
00089 }
00090
00091 }