spherical_quadtree Class Reference

#include <spherical_quadtree.hpp>

Inheritance diagram for spherical_quadtree:

Inheritance graph
[legend]
Collaboration diagram for spherical_quadtree:

Collaboration graph
[legend]

List of all members.


Detailed Description

A class that maintains and draws LOD spheroids.

Splits are made depending on the bounding spheres of individual quadrants.

Definition at line 110 of file spherical_quadtree.hpp.


Public Member Functions

virtual void cleanup ()
virtual void draw (gsgl::scenegraph::context *c)
gsgl::scenegraph::nodeget_parent_sg_node ()
virtual void init (gsgl::scenegraph::context *c)
 spherical_quadtree (gsgl::scenegraph::node *parent_sg_node, const gsgl::real_t &polar_radius, const gsgl::real_t &equatorial_radius)
virtual void update (gsgl::scenegraph::context *c, const bool not_visible)
virtual ~spherical_quadtree ()

Protected Types

typedef gsgl::data::pair
< gsgl::data::simple_array
< sph_qt_node * >
*, gsgl::data::simple_stack
< gsgl::index_t > * > 
node_level_rec
 The array of leaf nodes, plus an stack of free positions.

Protected Member Functions

virtual sph_qt_nodecreate_node (sph_qt_node *parent)

Protected Attributes

gsgl::platform::buffer_poolbuffers
gsgl::real_t equatorial_radius
gsgl::math::vector eye_pos_in_object_space
gsgl::data::simple_stack
< gsgl::platform::vbuffer::index_t
freed_vertex_indices
 A stack of indices to free spots in the vertex buffer.
gsgl::data::simple_array< floatglobal_normals
 Contains the normals of each vertex in the quadtree.
gsgl::data::simple_array< floatglobal_polar_coords
 Contains the geographic (NOT geocentric) longitude and latitude of each vertex.
gsgl::data::simple_array< floatglobal_vertices
 Contains the cartesian vertices of the quadtree.
gsgl::data::simple_array
< gsgl::platform::vbuffer::index_t
index_refcounts
gsgl::math::transform last_frame_modelview_projection
int last_frame_viewport [4]
gsgl::index_t last_num_leaf_nodes
gsgl::index_t last_num_merge_nodes
gsgl::data::simple_array
< node_level_rec * > 
leaf_nodes
 An array of leaf nodes at each level.
gsgl::data::simple_array
< node_level_rec * > 
merge_nodes
 An array of nodes that can be merged.
gsgl::index_t num_leaf_nodes
gsgl::index_t num_merge_nodes
gsgl::scenegraph::nodeparent_sg_node
gsgl::real_t polar_radius
sph_qt_noderoot_nodes [6]

Private Member Functions

void add_leaf_node (sph_qt_node *qtn)
void add_merge_node (sph_qt_node *qtn)
const
gsgl::platform::vbuffer::index_t
attach_vertex_index (const gsgl::platform::vbuffer::index_t &index)
void fill_in_normals (gsgl::math::vector *)
 This fills in the normals in the vector. The nine corner normals should be initiated, that is, n[0, 2, 4, 10, 12, 14, 20, 22, 24].
void free_vertex_index (const gsgl::platform::vbuffer::index_t &index)
void generate_vertices (sph_qt_node *quad, gsgl::math::vector *normals, const bool *vertex_flags, gsgl::platform::vbuffer::index_t *quad_indices)
sph_qt_nodeget_adjacent (sph_qt_node *candidate, const gsgl::platform::vbuffer::index_t &index0, const gsgl::platform::vbuffer::index_t &index1, sph_qt_node ***peer_handle, gsgl::platform::vbuffer::index_t *side0=0, gsgl::platform::vbuffer::index_t *side1=0)
gsgl::platform::vbuffer::index_t get_new_vertex_index ()
void init_root_nodes ()
bool merge_node (sph_qt_node *qtn, const gsgl::math::transform &modelview, const gsgl::scenegraph::context *c)
void merge_node_aux (sph_qt_node *qtn)
bool neighbor_allows_merge (sph_qt_node *qtn, sph_qt_node *adj)
gsgl::real_t node_cos_angle (sph_qt_node *qtn, const gsgl::math::transform &modelview)
gsgl::real_t node_radius (sph_qt_node *qtn, const gsgl::scenegraph::context *c)
void remove_leaf_node (sph_qt_node *qtn)
void remove_merge_node (sph_qt_node *qtn)
bool split_node (sph_qt_node *qtn, const gsgl::math::transform &modelview, const gsgl::scenegraph::context *c, bool no_visual_check, int force_level)
void split_node_aux (sph_qt_node *qtn, int force_level)

Member Typedef Documentation

The array of leaf nodes, plus an stack of free positions.

Definition at line 137 of file spherical_quadtree.hpp.


Constructor & Destructor Documentation

spherical_quadtree ( gsgl::scenegraph::node parent_sg_node,
const gsgl::real_t polar_radius,
const gsgl::real_t equatorial_radius 
)

Definition at line 295 of file spherical_quadtree.cpp.

References spherical_quadtree::root_nodes.

~spherical_quadtree (  )  [virtual]


Member Function Documentation

void add_leaf_node ( sph_qt_node qtn  )  [private]

void add_merge_node ( sph_qt_node qtn  )  [private]

const gsgl::platform::vbuffer::index_t& attach_vertex_index ( const gsgl::platform::vbuffer::index_t index  )  [private]

void cleanup (  )  [virtual]

sph_qt_node * create_node ( sph_qt_node parent  )  [protected, virtual]

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

void fill_in_normals ( gsgl::math::vector n  )  [private]

This fills in the normals in the vector. The nine corner normals should be initiated, that is, n[0, 2, 4, 10, 12, 14, 20, 22, 24].

Definition at line 1478 of file spherical_quadtree.cpp.

References vector::normalize().

Referenced by spherical_quadtree::init_root_nodes(), and spherical_quadtree::split_node_aux().

void free_vertex_index ( const gsgl::platform::vbuffer::index_t index  )  [private]

void generate_vertices ( sph_qt_node quad,
gsgl::math::vector normals,
const bool *  vertex_flags,
gsgl::platform::vbuffer::index_t quad_indices 
) [private]

sph_qt_node* get_adjacent ( sph_qt_node candidate,
const gsgl::platform::vbuffer::index_t index0,
const gsgl::platform::vbuffer::index_t index1,
sph_qt_node ***  peer_handle,
gsgl::platform::vbuffer::index_t side0 = 0,
gsgl::platform::vbuffer::index_t side1 = 0 
) [private]

vbuffer::index_t get_new_vertex_index (  )  [private]

gsgl::scenegraph::node* get_parent_sg_node (  )  [inline]

Definition at line 149 of file spherical_quadtree.hpp.

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

void init_root_nodes (  )  [private]

bool merge_node ( sph_qt_node qtn,
const gsgl::math::transform modelview,
const gsgl::scenegraph::context c 
) [private]

void merge_node_aux ( sph_qt_node qtn  )  [private]

bool neighbor_allows_merge ( sph_qt_node qtn,
sph_qt_node adj 
) [private]

gsgl::real_t node_cos_angle ( sph_qt_node qtn,
const gsgl::math::transform modelview 
) [private]

gsgl::real_t node_radius ( sph_qt_node qtn,
const gsgl::scenegraph::context c 
) [private]

void remove_leaf_node ( sph_qt_node qtn  )  [private]

void remove_merge_node ( sph_qt_node qtn  )  [private]

bool split_node ( sph_qt_node qtn,
const gsgl::math::transform modelview,
const gsgl::scenegraph::context c,
bool  no_visual_check,
int  force_level 
) [private]

void split_node_aux ( sph_qt_node qtn,
int  force_level 
) [private]

void update ( gsgl::scenegraph::context c,
const bool  not_visible 
) [virtual]


Member Data Documentation

Definition at line 116 of file spherical_quadtree.hpp.

Definition at line 136 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::update().

A stack of indices to free spots in the vertex buffer.

Definition at line 126 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::get_new_vertex_index().

Contains the normals of each vertex in the quadtree.

Definition at line 119 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::node_cos_angle(), spherical_quadtree::split_node_aux(), and sph_qt_node::update_fan_indices().

Contains the geographic (NOT geocentric) longitude and latitude of each vertex.

Longitude is specified as the actual longitude / 2PI, and latitude as 0.5 + the actual latitude / PI.

Definition at line 123 of file spherical_quadtree.hpp.

Referenced by sph_qt_node::update_fan_indices().

Definition at line 125 of file spherical_quadtree.hpp.

Definition at line 134 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::draw().

int last_frame_viewport[4] [protected]

Definition at line 133 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::draw().

Definition at line 140 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::update().

Definition at line 143 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::update().

An array of nodes that can be merged.

Definition at line 142 of file spherical_quadtree.hpp.

Referenced by spherical_quadtree::add_merge_node(), spherical_quadtree::remove_merge_node(), and spherical_quadtree::update().

Definition at line 116 of file spherical_quadtree.hpp.

sph_qt_node* root_nodes[6] [protected]


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

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