gsgl::scenegraph::utils Namespace Reference


Classes

class  checkered_box
class  coord_system
 A utility class for drawing coordinate systems of nodes. More...
class  simple_sphere

Functions

gsgl::real_t dot_in_eye_space (node *frame, const math::vector &pos=math::vector::ZERO)
void draw_billboard (node *frame, const math::vector &pos, const gsgl::real_t radius)
 Draws a billboard at the specified point in the specified frame.
gsgl::real_t greatest_extent (const node *n)
bool is_on_screen (node *frame, const gsgl::real_t field_of_view, const gsgl::real_t aspect_ratio, const math::vector &pos=math::vector::ZERO, const gsgl::real_t radius=0)
gsgl::real_t pixel_size (const gsgl::real_t distance, const gsgl::real_t radius, const gsgl::real_t field_of_view, const int pixels_in_field_of_view)
vector pos_in_eye_space (node *frame, const math::vector &pos=math::vector::ZERO)
vector pos_in_screen_space (const gsgl::math::vector &point, const int viewport[4], const gsgl::math::transform &modelview_projection)
void save_screen_info (int viewport[4], gsgl::math::transform &modelview_projection)
 Save projection information for later doing calculations in screen space.


Function Documentation

SCENEGRAPH_API gsgl::real_t dot_in_eye_space ( node *  frame,
const math::vector &  pos = math::vector::ZERO 
)

Returns:
The cosine of the angle between the given point and the eye direction.

Definition at line 310 of file utils.cpp.

References vector::dot(), node::get_modelview(), vector::NEG_Z_AXIS, and vector::normalize().

SCENEGRAPH_API void draw_billboard ( node *  frame,
const math::vector &  pos,
const gsgl::real_t  radius 
)

Draws a billboard at the specified point in the specified frame.

Make sure to bind the appropriate texture before calling.

Definition at line 396 of file utils.cpp.

References CHECK_GL_ERRORS, vector::cross(), node::get_modelview(), vector::normalize(), matrix::ptr(), transform::rotation_part(), transform::transpose(), and vector::Y_AXIS.

Referenced by star::draw().

SCENEGRAPH_API gsgl::real_t greatest_extent ( const node *  n  ) 

Returns:
The greatest extent of the node and all the child nodes.

Definition at line 371 of file utils.cpp.

References node::get_children(), node::get_scale(), node::max_extent(), and gsgl::max_val().

Referenced by vehicle::minimum_view_distance().

SCENEGRAPH_API bool is_on_screen ( node *  frame,
const gsgl::real_t  field_of_view,
const gsgl::real_t  aspect_ratio,
const math::vector &  pos = math::vector::ZERO,
const gsgl::real_t  radius = 0 
)

Returns:
True if a sphere around the given frame would be on screen. This is not a true frustum test, as it doesn't check distance.

Definition at line 319 of file utils.cpp.

References gsgl::math::DEG2RAD, vector::dot(), node::get_draw_flags(), node::get_modelview(), vector::mag(), vector::NEG_Z_AXIS, node::NODE_NO_FRUSTUM_CHECK, and vector::normalize().

Referenced by sph_qt_node::draw(), node::draw_scene(), and large_lithosphere::update().

SCENEGRAPH_API gsgl::real_t pixel_size ( const gsgl::real_t  distance,
const gsgl::real_t  radius,
const gsgl::real_t  field_of_view,
const int  pixels_in_field_of_view 
)

Returns:
The size of the given object in screen pixels.

Definition at line 342 of file utils.cpp.

References gsgl::math::DEG2RAD.

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

SCENEGRAPH_API math::vector pos_in_eye_space ( node *  frame,
const math::vector &  pos = math::vector::ZERO 
)

SCENEGRAPH_API gsgl::math::vector pos_in_screen_space ( const gsgl::math::vector point,
const int  viewport[4],
const gsgl::math::transform modelview_projection 
)

Returns:
The position of the given point in screen space.

Definition at line 362 of file utils.cpp.

References vector::get_x(), vector::get_y(), and vector::get_z().

SCENEGRAPH_API void save_screen_info ( int  viewport[4],
transform &  modelview_projection 
)

Save projection information for later doing calculations in screen space.

Definition at line 351 of file utils.cpp.

References CHECK_GL_ERRORS, and matrix::ptr().

Referenced by spherical_quadtree::draw().


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