planet_earth Class Reference

#include <earth.hpp>

Inheritance diagram for planet_earth:

Inheritance graph
[legend]
Collaboration diagram for planet_earth:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 47 of file earth.hpp.


Scene Graph Functionality.

void add_child (node *child)
 Add a child node. Also sets the child's parent to this.
bool connect (node *branch)
 If this is called on the root of a scene graph, it will insert the branch node in the appropriate place in the graph, or return false.
void detach ()
 Removes the node from the scene graph (does not delete it!).
gsgl::flags_tget_draw_flags ()
const gsgl::flags_tget_draw_flags () const
gsgl::flags_tget_draw_results ()
const gsgl::flags_tget_draw_results () const
enum  node_draw_flags { NODE_NO_DRAW_FLAGS = 0, NODE_NO_FRUSTUM_CHECK = 1 << 0, NODE_DUMMY_OBJECT = 1 << 2, NODE_DRAW_UNLIT = 1 << 3 }
 Flags that control node drawing. More...
enum  node_draw_results { NODE_NO_DRAW_RESULTS = 0, NODE_OFF_SCREEN = 1 << 0, NODE_DREW_POINT = 1 << 1, NODE_DISTANCE_CULLED = 1 << 2 }
 Flags that indicate what happened when the node was drawn. More...
static void draw_scene (gsgl::scenegraph::context *c, pre_draw_rec &rec)
 Draws a scene. Safe to call while update is also being called in the tree.
static void pre_draw_scene (gsgl::scenegraph::context *c, pre_draw_rec &rec)
 Collect information about the scene to draw. Unsafe to call while update is being called in the tree.

Public Member Functions

 BROKER_DECLARE_CREATOR (periapsis::space::large_rocky_body)
 BROKER_DECLARE_CREATOR (periapsis::space::planet_earth)
virtual void cleanup (gsgl::scenegraph::context *c)
 Called when the simulation is done.
virtual gsgl::real_t default_view_distance () const
virtual void draw (gsgl::scenegraph::context *c)
 This will draw the simple sphere, so override if you want to do something else...
void draw_name (gsgl::scenegraph::context *c, gsgl::real_t near_plane, gsgl::real_t far_plane)
void draw_point (float width)
math::vector & get_angular_velocity ()
const atmosphereget_atmosphere () const
gsgl::real_t get_equatorial_radius () const
math::vector & get_linear_velocity ()
const lithosphereget_lithosphere () const
gsgl::real_t get_mass () const
gsgl::real_t get_polar_radius () const
virtual gsgl::real_t get_priority (gsgl::scenegraph::context *)
 Called to determine the draw priority of the node.
const rotating_bodyget_rotating_frame () const
const gsgl::real_t get_simple_color_x_offset () const
const gsgl::real_t get_simple_color_y_offset () const
const gsgl::platform::textureget_simple_colormap () const
const gsgl::real_t get_simple_height_max () const
const gsgl::real_t get_simple_height_x_offset () const
const gsgl::real_t get_simple_height_y_offset () const
const gsgl::platform::textureget_simple_heightmap () const
const
gsgl::scenegraph::utils::simple_sphere
get_simple_sphere () const
virtual const gsgl::stringget_type_name () const
virtual void init (gsgl::scenegraph::context *c)
 Called when the simulation is created. The node's modelview matrix is invalid at this point.
virtual gsgl::real_t max_extent () const
 Should return the maximum extent of the object (in the node's coordinates, i.e. not scaled to meters).
virtual gsgl::real_t minimum_view_distance () const
 planet_earth (const gsgl::data::config_record &obj_config)
virtual void update (gsgl::scenegraph::context *c)
 Called from the root of the world-tree up to update the node's state. The node's modelview matrix is that of the previously-drawn frame.
virtual ~planet_earth ()
Accessors.
data::simple_array< node * > & get_children ()
math::transform & get_modelview ()
string & get_name ()
const string & get_name () const
math::transform & get_orientation ()
node *& get_parent ()
const node * get_parent () const
string & get_parent_name ()
gsgl::real_tget_scale ()
math::vector & get_translation ()
Node Life Cycle.
virtual bool handle_event (gsgl::scenegraph::context *c, sg_event &e)
 Called with events.
virtual data::config_record * save () const
 Called to save the node to a config_record structure.

Static Public Attributes

static
gsgl::data::config_variable
< gsgl::real_t
MIN_PIXEL_WIDTH
Drawing Information Functions.
static const gsgl::real_t NODE_DRAW_FIRST = FLT_MAX
static const gsgl::real_t NODE_DRAW_IGNORE = 0.000f
static const gsgl::real_t NODE_DRAW_SOLID = 0.001f
static const gsgl::real_t NODE_DRAW_TRANSLUCENT = 0.002f

Protected Member Functions

atmosphere *& get_atmosphere ()
lithosphere *& get_lithosphere ()
rotating_body *& get_rotating_frame ()
gsgl::scenegraph::utils::simple_sphere *& get_simple_sphere ()

Private Attributes

large_rocky_bodymoon

Static Private Attributes

static const gsgl::real_t BARYSYSTEM_OFFSET = 4700000.0f

Member Enumeration Documentation

enum node_draw_flags [inherited]

Flags that control node drawing.

Enumerator:
NODE_NO_DRAW_FLAGS 
NODE_NO_FRUSTUM_CHECK  Don't perform a frustum check when drawing this node.
NODE_DUMMY_OBJECT  This node should never be drawn.
NODE_DRAW_UNLIT  This node should not be lit.

Definition at line 141 of file node.hpp.

enum node_draw_results [inherited]

Flags that indicate what happened when the node was drawn.

Enumerator:
NODE_NO_DRAW_RESULTS 
NODE_OFF_SCREEN  The node was not drawn because it was out-of-frame.
NODE_DREW_POINT  The node was drawn as a point.
NODE_DISTANCE_CULLED  The node was not drawn due to distance.

Definition at line 157 of file node.hpp.


Constructor & Destructor Documentation

planet_earth ( const gsgl::data::config_record obj_config  ) 

Definition at line 53 of file earth.cpp.

~planet_earth (  )  [virtual]

Definition at line 59 of file earth.cpp.

References planet_earth::moon.


Member Function Documentation

void add_child ( node child  )  [inherited]

Add a child node. Also sets the child's parent to this.

Definition at line 267 of file node.cpp.

References assert, node::children, and node::parent.

Referenced by node::connect(), application::load_objects(), application::load_scenery(), model::model(), node::node(), vehicle::vehicle(), and vehicle_module::vehicle_module().

BROKER_DECLARE_CREATOR ( periapsis::space::large_rocky_body   )  [inherited]

BROKER_DECLARE_CREATOR ( periapsis::space::planet_earth   ) 

void cleanup ( gsgl::scenegraph::context c  )  [virtual, inherited]

Called when the simulation is done.

Reimplemented from node.

Definition at line 179 of file large_rocky_body.cpp.

References node::cleanup().

bool connect ( node branch  )  [inherited]

If this is called on the root of a scene graph, it will insert the branch node in the appropriate place in the graph, or return false.

Definition at line 289 of file node.cpp.

References node::add_child(), node::children, node::name, and node::parent_name.

Referenced by simulation::simulation().

gsgl::real_t default_view_distance (  )  const [virtual, inherited]

Reimplemented from node.

Definition at line 105 of file celestial_body.cpp.

References celestial_body::max_extent().

void detach (  )  [inherited]

Removes the node from the scene graph (does not delete it!).

Definition at line 276 of file node.cpp.

References node::children, and node::parent.

void draw ( gsgl::scenegraph::context c  )  [virtual, inherited]

void draw_name ( gsgl::scenegraph::context c,
gsgl::real_t  near_plane,
gsgl::real_t  far_plane 
) [inherited]

void draw_point ( float  width  )  [inherited]

Definition at line 219 of file celestial_body.cpp.

References CHECK_GL_ERRORS.

Referenced by large_rocky_body::draw(), and celestial_body::draw().

void draw_scene ( gsgl::scenegraph::context c,
pre_draw_rec rec 
) [static, inherited]

math::vector& get_angular_velocity (  )  [inline, inherited]

atmosphere* & get_atmosphere (  )  [inline, protected, inherited]

Definition at line 117 of file celestial_body.hpp.

const atmosphere* get_atmosphere (  )  const [inline, inherited]

Definition at line 86 of file celestial_body.hpp.

Referenced by gas_body::gas_body(), and large_rocky_body::large_rocky_body().

data::simple_array< node * > & get_children (  )  [inherited]

gsgl::flags_t& get_draw_flags (  )  [inline, inherited]

Returns:
The node's draw flags (a bitset using node_draw_flags).

Definition at line 153 of file node.hpp.

const gsgl::flags_t& get_draw_flags (  )  const [inline, inherited]

gsgl::flags_t& get_draw_results (  )  [inline, inherited]

Returns:
The node's draw results (a bitset using node_draw_results).

Definition at line 169 of file node.hpp.

const gsgl::flags_t& get_draw_results (  )  const [inline, inherited]

Returns:
The node's draw results (a bitset using node_draw_results).

Definition at line 166 of file node.hpp.

Referenced by large_rocky_body::draw(), celestial_body::draw(), and large_lithosphere::update().

gsgl::real_t get_equatorial_radius (  )  const [inline, inherited]

Definition at line 83 of file celestial_body.hpp.

Referenced by star::draw(), large_rocky_body::draw(), and celestial_body::draw().

math::vector& get_linear_velocity (  )  [inline, inherited]

lithosphere* & get_lithosphere (  )  [inline, protected, inherited]

Definition at line 118 of file celestial_body.hpp.

const lithosphere* get_lithosphere (  )  const [inline, inherited]

gsgl::real_t get_mass (  )  const [inline, inherited]

Definition at line 81 of file celestial_body.hpp.

math::transform & get_modelview (  )  [inherited]

string & get_name (  )  [inherited]

Definition at line 205 of file node.cpp.

References node::name.

const string & get_name (  )  const [inherited]

math::transform & get_orientation (  )  [inherited]

node *& get_parent (  )  [inherited]

Definition at line 168 of file node.cpp.

References node::parent.

const node * get_parent (  )  const [inherited]

string & get_parent_name (  )  [inherited]

Definition at line 210 of file node.cpp.

References node::parent_name.

gsgl::real_t get_polar_radius (  )  const [inline, inherited]

Definition at line 82 of file celestial_body.hpp.

Referenced by large_rocky_body::draw(), and celestial_body::draw().

gsgl::real_t get_priority ( gsgl::scenegraph::context  )  [virtual, inherited]

Called to determine the draw priority of the node.

A value of NODE_DRAW_IGNORE means don't draw (invisible nodes or nodes that are drawn by their parents -- the modelview matrix is still built). A value of NODE_DRAW_SOLID means the object is solid and should be drawn after the painter's algorithm. A value of NODE_DRAW_TRANSLUCENT means the object is translucent and should be drawn after solid objects. A value > NODE_DRAW_TRANSLUCENT is interpreted as the distance to the object. Objects that return > 2.0 are drawn with a painter's algorithm.

Reimplemented from celestial_body.

Definition at line 76 of file large_rocky_body.cpp.

References vector::mag2(), and gsgl::scenegraph::utils::pos_in_eye_space().

rotating_body* & get_rotating_frame (  )  [inline, protected, inherited]

Definition at line 116 of file celestial_body.hpp.

const rotating_body* get_rotating_frame (  )  const [inline, inherited]

gsgl::real_t & get_scale (  )  [inherited]

Definition at line 215 of file node.cpp.

References node::scale.

Referenced by stellar_db::draw(), gsgl::scenegraph::utils::greatest_extent(), and stellar_db::init().

const gsgl::real_t get_simple_color_x_offset (  )  const [inline, inherited]

Definition at line 90 of file celestial_body.hpp.

Referenced by lithosphere_quadtree::init().

const gsgl::real_t get_simple_color_y_offset (  )  const [inline, inherited]

Definition at line 91 of file celestial_body.hpp.

Referenced by lithosphere_quadtree::init().

const gsgl::platform::texture* get_simple_colormap (  )  const [inline, inherited]

Definition at line 89 of file celestial_body.hpp.

Referenced by lithosphere_quadtree::init().

const gsgl::real_t get_simple_height_max (  )  const [inline, inherited]

Definition at line 96 of file celestial_body.hpp.

const gsgl::real_t get_simple_height_x_offset (  )  const [inline, inherited]

Definition at line 94 of file celestial_body.hpp.

Referenced by lithosphere_quadtree::init().

const gsgl::real_t get_simple_height_y_offset (  )  const [inline, inherited]

Definition at line 95 of file celestial_body.hpp.

Referenced by lithosphere_quadtree::init().

const gsgl::platform::texture* get_simple_heightmap (  )  const [inline, inherited]

Definition at line 93 of file celestial_body.hpp.

Referenced by lithosphere_quadtree::init().

gsgl::scenegraph::utils::simple_sphere* & get_simple_sphere (  )  [inline, protected, inherited]

Definition at line 119 of file celestial_body.hpp.

const gsgl::scenegraph::utils::simple_sphere* get_simple_sphere (  )  const [inline, inherited]

Definition at line 98 of file celestial_body.hpp.

Referenced by celestial_body::draw(), and star::init().

math::vector & get_translation (  )  [inherited]

const gsgl::string & get_type_name (  )  const [virtual, inherited]

Definition at line 54 of file broker.cpp.

References countable::is_empty(), and brokered_object::type_name.

Referenced by node::draw_scene(), and simulation::update_node().

bool handle_event ( gsgl::scenegraph::context c,
sg_event e 
) [virtual, inherited]

Called with events.

Reimplemented in freeview.

Definition at line 323 of file node.cpp.

Referenced by simulation::handle_event().

void init ( gsgl::scenegraph::context c  )  [virtual, inherited]

Called when the simulation is created. The node's modelview matrix is invalid at this point.

Reimplemented from celestial_body.

Definition at line 82 of file large_rocky_body.cpp.

References celestial_body::init().

gsgl::real_t max_extent (  )  const [virtual, inherited]

Should return the maximum extent of the object (in the node's coordinates, i.e. not scaled to meters).

Reimplemented from node.

Definition at line 99 of file celestial_body.cpp.

References celestial_body::equatorial_radius, gsgl::max_val(), and celestial_body::polar_radius.

Referenced by celestial_body::default_view_distance(), and celestial_body::minimum_view_distance().

gsgl::real_t minimum_view_distance (  )  const [virtual, inherited]

Reimplemented from node.

Definition at line 111 of file celestial_body.cpp.

References celestial_body::max_extent().

void pre_draw_scene ( gsgl::scenegraph::context c,
pre_draw_rec rec 
) [static, inherited]

Collect information about the scene to draw. Unsafe to call while update is being called in the tree.

Definition at line 380 of file node.cpp.

References node::build_draw_list(), context::cam, transform::IDENTITY, node::pre_draw_rec::light_queue, node::pre_draw_rec::paint_queue, node::pre_draw_rec::solids, and node::pre_draw_rec::translucents.

Referenced by simulation::pre_draw().

data::config_record * save (  )  const [virtual, inherited]

Called to save the node to a config_record structure.

Definition at line 328 of file node.cpp.

void update ( gsgl::scenegraph::context c  )  [virtual]

Called from the root of the world-tree up to update the node's state. The node's modelview matrix is that of the previously-drawn frame.

Reimplemented from large_rocky_body.

Definition at line 65 of file earth.cpp.

References planet_earth::BARYSYSTEM_OFFSET, node::get_children(), node::get_parent(), node::get_translation(), planet_earth::moon, vector::normalize(), and large_rocky_body::update().


Member Data Documentation

const gsgl::real_t BARYSYSTEM_OFFSET = 4700000.0f [static, private]

Definition at line 50 of file earth.hpp.

Referenced by planet_earth::update().

config_variable< gsgl::real_t > MIN_PIXEL_WIDTH [static, inherited]

large_rocky_body* moon [private]

Definition at line 52 of file earth.hpp.

Referenced by planet_earth::update(), and planet_earth::~planet_earth().

const gsgl::real_t NODE_DRAW_FIRST = FLT_MAX [static, inherited]

const gsgl::real_t NODE_DRAW_IGNORE = 0.000f [static, inherited]

const gsgl::real_t NODE_DRAW_SOLID = 0.001f [static, inherited]

Definition at line 216 of file node.hpp.

Referenced by node::build_draw_list(), and submesh_node::get_priority().

const gsgl::real_t NODE_DRAW_TRANSLUCENT = 0.002f [static, inherited]


The documentation for this class was generated from the following files:

Generated on Sat Mar 1 13:50:08 2008 for Periapsis Project by  doxygen 1.5.5