#include <spherical_quadtree.hpp>
Splits are made depending on the bounding spheres of individual quadrants.
Definition at line 110 of file spherical_quadtree.hpp.
typedef gsgl::data::pair<gsgl::data::simple_array<sph_qt_node *> *, gsgl::data::simple_stack<gsgl::index_t> *> node_level_rec [protected] |
The array of leaf nodes, plus an stack of free positions.
Definition at line 137 of file spherical_quadtree.hpp.
spherical_quadtree | ( | gsgl::scenegraph::node * | parent_sg_node, | |
const gsgl::real_t & | polar_radius, | |||
const gsgl::real_t & | equatorial_radius | |||
) |
~spherical_quadtree | ( | ) | [virtual] |
Definition at line 305 of file spherical_quadtree.cpp.
References spherical_quadtree::buffers, spherical_quadtree::leaf_nodes, and spherical_quadtree::root_nodes.
void add_leaf_node | ( | sph_qt_node * | qtn | ) | [private] |
Definition at line 390 of file spherical_quadtree.cpp.
References assert, pair::first, spherical_quadtree::leaf_nodes, sph_qt_node::level, spherical_quadtree::num_leaf_nodes, sph_qt_node::pos_in_leaf_node_array, and pair::second.
Referenced by spherical_quadtree::init_root_nodes(), spherical_quadtree::merge_node(), and spherical_quadtree::split_node_aux().
void add_merge_node | ( | sph_qt_node * | qtn | ) | [private] |
Definition at line 435 of file spherical_quadtree.cpp.
References assert, pair::first, sph_qt_node::level, spherical_quadtree::merge_nodes, spherical_quadtree::num_merge_nodes, sph_qt_node::pos_in_merge_node_array, and pair::second.
Referenced by spherical_quadtree::merge_node(), and spherical_quadtree::split_node().
const gsgl::platform::vbuffer::index_t& attach_vertex_index | ( | const gsgl::platform::vbuffer::index_t & | index | ) | [private] |
void cleanup | ( | ) | [virtual] |
Reimplemented in lithosphere_quadtree.
Definition at line 1400 of file spherical_quadtree.cpp.
References spherical_quadtree::buffers, sph_qt_node::children, spherical_quadtree::root_nodes, and buffer_pool::unload().
sph_qt_node * create_node | ( | sph_qt_node * | parent | ) | [protected, virtual] |
Reimplemented in lithosphere_quadtree.
Definition at line 1766 of file spherical_quadtree.cpp.
References spherical_quadtree::sph_qt_node.
Referenced by spherical_quadtree::init_root_nodes(), and spherical_quadtree::split_node_aux().
void draw | ( | gsgl::scenegraph::context * | c | ) | [virtual] |
Reimplemented in lithosphere_quadtree.
Definition at line 347 of file spherical_quadtree.cpp.
References CHECK_GL_ERRORS, sph_qt_node::draw(), context::frame, spherical_quadtree::last_frame_modelview_projection, spherical_quadtree::last_frame_viewport, spherical_quadtree::root_nodes, gsgl::scenegraph::utils::save_screen_info(), and spherical_quadtree::update().
Referenced by lithosphere_quadtree::draw().
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] |
Referenced by sph_qt_node::~sph_qt_node().
void generate_vertices | ( | sph_qt_node * | quad, | |
gsgl::math::vector * | normals, | |||
const bool * | vertex_flags, | |||
gsgl::platform::vbuffer::index_t * | quad_indices | |||
) | [private] |
Referenced by spherical_quadtree::init_root_nodes(), and spherical_quadtree::split_node_aux().
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] |
Referenced by spherical_quadtree::split_node_aux().
vbuffer::index_t get_new_vertex_index | ( | ) | [private] |
Definition at line 1447 of file spherical_quadtree.cpp.
References spherical_quadtree::freed_vertex_indices, spherical_quadtree::global_vertices, and simple_array::size().
Referenced by spherical_quadtree::split_node_aux().
gsgl::scenegraph::node* get_parent_sg_node | ( | ) | [inline] |
Definition at line 149 of file spherical_quadtree.hpp.
void init | ( | gsgl::scenegraph::context * | c | ) | [virtual] |
Reimplemented in lithosphere_quadtree.
Definition at line 328 of file spherical_quadtree.cpp.
References spherical_quadtree::buffers, gsgl::platform::vbuffer::DYNAMIC, and spherical_quadtree::init_root_nodes().
Referenced by lithosphere_quadtree::init().
void init_root_nodes | ( | ) | [private] |
Definition at line 1575 of file spherical_quadtree.cpp.
References spherical_quadtree::add_leaf_node(), sph_qt_node::adjacent_nodes, spherical_quadtree::create_node(), spherical_quadtree::fill_in_normals(), spherical_quadtree::generate_vertices(), and spherical_quadtree::root_nodes.
Referenced by spherical_quadtree::init().
bool merge_node | ( | sph_qt_node * | qtn, | |
const gsgl::math::transform & | modelview, | |||
const gsgl::scenegraph::context * | c | |||
) | [private] |
Definition at line 687 of file spherical_quadtree.cpp.
References spherical_quadtree::add_leaf_node(), spherical_quadtree::add_merge_node(), sph_qt_node::adjacent_nodes, sph_qt_node::children, sph_qt_node::dirty, context::frame, sph_qt_node::is_a_leaf(), sph_qt_node::last_merge_frame, sph_qt_node::last_split_frame, sph_qt_node::level, gsgl::log(), spherical_quadtree::merge_node_aux(), spherical_quadtree::node_cos_angle(), spherical_quadtree::node_radius(), sph_qt_node::parent_node, sph_qt_node::pos_in_merge_node_array, spherical_quadtree::remove_leaf_node(), and spherical_quadtree::remove_merge_node().
Referenced by spherical_quadtree::update().
void merge_node_aux | ( | sph_qt_node * | qtn | ) | [private] |
Definition at line 648 of file spherical_quadtree.cpp.
References sph_qt_node::adjacent_nodes, sph_qt_node::children, sph_qt_node::dirty, gsgl::log(), and sph_qt_node::parent_node.
Referenced by spherical_quadtree::merge_node().
bool neighbor_allows_merge | ( | sph_qt_node * | qtn, | |
sph_qt_node * | adj | |||
) | [private] |
Definition at line 633 of file spherical_quadtree.cpp.
References sph_qt_node::children, sph_qt_node::is_a_leaf(), and sph_qt_node::level.
gsgl::real_t node_cos_angle | ( | sph_qt_node * | qtn, | |
const gsgl::math::transform & | modelview | |||
) | [private] |
Definition at line 479 of file spherical_quadtree.cpp.
References spherical_quadtree::global_normals, spherical_quadtree::global_vertices, vector::normalize(), and sph_qt_node::vertex_indices.
Referenced by spherical_quadtree::merge_node().
gsgl::real_t node_radius | ( | sph_qt_node * | qtn, | |
const gsgl::scenegraph::context * | c | |||
) | [private] |
Definition at line 506 of file spherical_quadtree.cpp.
References context::cam, gsgl::math::DEG2RAD, context::frame, camera::get_field_of_view(), display::get_height(), node::get_modelview(), spherical_quadtree::global_vertices, sph_qt_node::last_radius_frame, spherical_quadtree::parent_sg_node, sph_qt_node::radius_in_screen_space, sph_qt_node::radius_in_world_space, context::screen, and sph_qt_node::vertex_indices.
Referenced by spherical_quadtree::merge_node(), and spherical_quadtree::split_node().
void remove_leaf_node | ( | sph_qt_node * | qtn | ) | [private] |
Definition at line 414 of file spherical_quadtree.cpp.
References assert, pair::first, spherical_quadtree::leaf_nodes, sph_qt_node::level, spherical_quadtree::num_leaf_nodes, sph_qt_node::pos_in_leaf_node_array, and pair::second.
Referenced by spherical_quadtree::merge_node(), and spherical_quadtree::split_node().
void remove_merge_node | ( | sph_qt_node * | qtn | ) | [private] |
Definition at line 459 of file spherical_quadtree.cpp.
References pair::first, sph_qt_node::level, spherical_quadtree::merge_nodes, spherical_quadtree::num_merge_nodes, sph_qt_node::pos_in_merge_node_array, and pair::second.
Referenced by spherical_quadtree::merge_node(), and spherical_quadtree::split_node().
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] |
Definition at line 1262 of file spherical_quadtree.cpp.
References spherical_quadtree::add_merge_node(), sph_qt_node::adjacent_nodes, assert, context::frame, sph_qt_node::is_a_leaf(), sph_qt_node::last_split_frame, sph_qt_node::level, gsgl::log(), spherical_quadtree::node_radius(), sph_qt_node::parent_node, spherical_quadtree::remove_leaf_node(), spherical_quadtree::remove_merge_node(), and spherical_quadtree::split_node_aux().
Referenced by spherical_quadtree::update().
void split_node_aux | ( | sph_qt_node * | qtn, | |
int | force_level | |||
) | [private] |
Definition at line 788 of file spherical_quadtree.cpp.
References spherical_quadtree::add_leaf_node(), sph_qt_node::adjacent_nodes, sph_qt_node::children, spherical_quadtree::create_node(), sph_qt_node::dirty, spherical_quadtree::fill_in_normals(), spherical_quadtree::generate_vertices(), spherical_quadtree::get_adjacent(), spherical_quadtree::get_new_vertex_index(), spherical_quadtree::global_normals, gsgl::log(), and sph_qt_node::vertex_indices.
Referenced by spherical_quadtree::split_node().
void update | ( | gsgl::scenegraph::context * | c, | |
const bool | not_visible | |||
) | [virtual] |
Definition at line 1316 of file spherical_quadtree.cpp.
References spherical_quadtree::eye_pos_in_object_space, pair::first, context::frame, node::get_modelview(), vector::get_x(), vector::get_y(), vector::get_z(), transform::inverse(), sph_qt_node::last_merge_frame, spherical_quadtree::last_num_leaf_nodes, spherical_quadtree::last_num_merge_nodes, sph_qt_node::last_split_frame, spherical_quadtree::leaf_nodes, spherical_quadtree::merge_node(), spherical_quadtree::merge_nodes, spherical_quadtree::num_leaf_nodes, spherical_quadtree::num_merge_nodes, spherical_quadtree::parent_sg_node, and spherical_quadtree::split_node().
Referenced by spherical_quadtree::draw(), and large_lithosphere::update().
gsgl::platform::buffer_pool* buffers [protected] |
Definition at line 128 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::cleanup(), spherical_quadtree::init(), sph_qt_node::sph_qt_node(), sph_qt_node::~sph_qt_node(), and spherical_quadtree::~spherical_quadtree().
gsgl::real_t equatorial_radius [protected] |
Definition at line 116 of file spherical_quadtree.hpp.
gsgl::math::vector eye_pos_in_object_space [protected] |
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().
gsgl::data::simple_array<float> global_normals [protected] |
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().
gsgl::data::simple_array<float> global_polar_coords [protected] |
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().
gsgl::data::simple_array<float> global_vertices [protected] |
Contains the cartesian vertices of the quadtree.
Definition at line 118 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::draw(), spherical_quadtree::get_new_vertex_index(), spherical_quadtree::node_cos_angle(), spherical_quadtree::node_radius(), and sph_qt_node::update_fan_indices().
Definition at line 125 of file spherical_quadtree.hpp.
gsgl::math::transform last_frame_modelview_projection [protected] |
int last_frame_viewport[4] [protected] |
gsgl::index_t last_num_leaf_nodes [protected] |
gsgl::index_t last_num_merge_nodes [protected] |
gsgl::data::simple_array<node_level_rec *> leaf_nodes [protected] |
An array of leaf nodes at each level.
Definition at line 139 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::add_leaf_node(), spherical_quadtree::remove_leaf_node(), spherical_quadtree::update(), and spherical_quadtree::~spherical_quadtree().
gsgl::data::simple_array<node_level_rec *> merge_nodes [protected] |
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().
gsgl::index_t num_leaf_nodes [protected] |
Definition at line 140 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::add_leaf_node(), spherical_quadtree::remove_leaf_node(), and spherical_quadtree::update().
gsgl::index_t num_merge_nodes [protected] |
Definition at line 143 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::add_merge_node(), spherical_quadtree::remove_merge_node(), and spherical_quadtree::update().
gsgl::scenegraph::node* parent_sg_node [protected] |
Definition at line 115 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::draw(), lithosphere_quadtree::init(), spherical_quadtree::node_radius(), and spherical_quadtree::update().
gsgl::real_t polar_radius [protected] |
Definition at line 116 of file spherical_quadtree.hpp.
sph_qt_node* root_nodes[6] [protected] |
Definition at line 130 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::cleanup(), spherical_quadtree::draw(), lithosphere_quadtree::init(), spherical_quadtree::init_root_nodes(), spherical_quadtree::spherical_quadtree(), and spherical_quadtree::~spherical_quadtree().