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
00028
00029
00030
00031
00032
00033
00034 #include "space/solar_system.hpp"
00035 #include "space/astronomy.hpp"
00036 #include "data/string.hpp"
00037 #include "math/units.hpp"
00038
00039 #include "platform/color.hpp"
00040
00041 using namespace gsgl;
00042 using namespace gsgl::data;
00043 using namespace gsgl::math;
00044 using namespace gsgl::scenegraph;
00045
00046 namespace periapsis
00047 {
00048
00049 namespace space
00050 {
00051
00052 BROKER_DEFINE_CREATOR(periapsis::space::solar_system);
00053
00054 static config_variable<gsgl::platform::color> SS_COORD_COLOR(L"space/solar_system/solar_system_coord_color", gsgl::platform::color(0.8f, 0.8f, 0.0f, 0.5f));
00055
00056
00057 solar_system::solar_system(const config_record & conf)
00058 : node(conf), cs(0)
00059 {
00060 get_draw_flags() |= node::NODE_NO_FRUSTUM_CHECK;
00061
00062 string oname = conf[L"transform"];
00063 if (!oname.is_empty())
00064 {
00065 if (oname == L"ecliptic_wrt_galactic")
00066 {
00067 get_orientation() = ECLIPTIC_WRT_GALACTIC;
00068 }
00069 else
00070 {
00071 throw runtime_exception(L"Unknown transform name %ls in %ls.", oname.w_string(), conf.get_file().get_full_path().w_string());
00072 }
00073 }
00074
00075 cs = new utils::coord_system(this, 10000 * units::METERS_PER_AU, 15, SS_COORD_COLOR);
00076 }
00077
00078
00079 solar_system::~solar_system()
00080 {
00081 delete cs;
00082 }
00083
00084
00085 gsgl::real_t solar_system::get_priority(context *)
00086 {
00087 return NODE_DRAW_FIRST / 100.0f;
00088 }
00089
00090
00091 void solar_system::init(context *c)
00092 {
00093 cs->init(c);
00094 }
00095
00096
00097 void solar_system::draw(context *c)
00098 {
00099 if ((c->render_flags & context::RENDER_COORD_SYSTEMS) && get_name() == L"Sol System")
00100 {
00101 cs->draw(c);
00102 }
00103 }
00104
00105 }
00106
00107 }