#include <spherical_quadtree.hpp>
Definition at line 63 of file spherical_quadtree.hpp.
Public Member Functions | |
virtual void | draw (gsgl::scenegraph::context *c) |
bool | is_a_leaf () const |
sph_qt_node (spherical_quadtree *parent_quadtree, sph_qt_node *parent) | |
virtual | ~sph_qt_node () |
Protected Attributes | |
sph_qt_node * | adjacent_nodes [4] |
Pointers to the nodes at the quad's sides. | |
gsgl::platform::buffer_pool::object_record | buffer_pool_rec |
sph_qt_node * | children [4] |
bool | dirty |
unsigned long | last_merge_frame |
The frame at which we last merged the node. | |
unsigned long | last_radius_frame |
The frame for which we last calculated the radius of the node. | |
unsigned long | last_split_frame |
The frame at which we last split the node. | |
int | level |
The level of detail of this node. | |
int | num_indices_in_quadrants [4] |
Counts how many indices are used by each subquadrant. | |
sph_qt_node * | parent_node |
spherical_quadtree * | parent_quadtree |
gsgl::index_t | pos_in_leaf_node_array |
gsgl::index_t | pos_in_merge_node_array |
gsgl::real_t | radius_in_screen_space |
The "thickness" of the node in screen space. | |
gsgl::real_t | radius_in_world_space |
The "thickness" of the node in world space. | |
gsgl::data::simple_array < gsgl::index_t > | triangle_fan_indices |
Temporary for storing indices used by the quadrant. | |
gsgl::index_t | vertex_indices [25] |
Stores the indices into the global buffers. | |
Private Member Functions | |
void | update_fan_indices () |
sph_qt_node | ( | spherical_quadtree * | parent_quadtree, | |
sph_qt_node * | parent | |||
) |
Definition at line 66 of file spherical_quadtree.cpp.
References sph_qt_node::adjacent_nodes, buffer_pool::allocate_object(), assert, sph_qt_node::buffer_pool_rec, spherical_quadtree::buffers, sph_qt_node::children, sph_qt_node::num_indices_in_quadrants, and sph_qt_node::vertex_indices.
~sph_qt_node | ( | ) | [virtual] |
Definition at line 95 of file spherical_quadtree.cpp.
References sph_qt_node::buffer_pool_rec, spherical_quadtree::buffers, sph_qt_node::children, buffer_pool::free_object(), spherical_quadtree::free_vertex_index(), sph_qt_node::parent_quadtree, and sph_qt_node::vertex_indices.
void draw | ( | gsgl::scenegraph::context * | c | ) | [virtual] |
Reimplemented in lithosphere_qt_node.
Definition at line 118 of file spherical_quadtree.cpp.
References sph_qt_node::buffer_pool_rec, context::cam, sph_qt_node::children, sph_qt_node::draw(), display::get_aspect_ratio(), camera::get_field_of_view(), spherical_quadtree::global_vertices, sph_qt_node::is_a_leaf(), gsgl::scenegraph::utils::is_on_screen(), sph_qt_node::num_indices_in_quadrants, buffer_pool::object_record::parent, sph_qt_node::parent_quadtree, spherical_quadtree::parent_sg_node, buffer_pool::object_record::pos_in_indices, buffer_pool::object_record::pos_in_vertices, sph_qt_node::radius_in_world_space, context::screen, sph_qt_node::update_fan_indices(), and sph_qt_node::vertex_indices.
Referenced by spherical_quadtree::draw(), sph_qt_node::draw(), and lithosphere_qt_node::draw().
bool is_a_leaf | ( | ) | const |
Definition at line 163 of file spherical_quadtree.cpp.
References sph_qt_node::children.
Referenced by sph_qt_node::draw(), spherical_quadtree::merge_node(), spherical_quadtree::neighbor_allows_merge(), spherical_quadtree::split_node(), and sph_qt_node::update_fan_indices().
void update_fan_indices | ( | ) | [private] |
Definition at line 169 of file spherical_quadtree.cpp.
References sph_qt_node::adjacent_nodes, sph_qt_node::buffer_pool_rec, sph_qt_node::children, sph_qt_node::dirty, spherical_quadtree::global_normals, spherical_quadtree::global_polar_coords, spherical_quadtree::global_vertices, sph_qt_node::is_a_leaf(), sph_qt_node::num_indices_in_quadrants, buffer_pool::object_record::parent, sph_qt_node::parent_quadtree, buffer_pool::object_record::pos_in_indices, buffer_pool::object_record::pos_in_vertices, sph_qt_node::triangle_fan_indices, and sph_qt_node::vertex_indices.
Referenced by sph_qt_node::draw().
sph_qt_node* adjacent_nodes[4] [protected] |
Pointers to the nodes at the quad's sides.
Definition at line 74 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::init_root_nodes(), spherical_quadtree::merge_node(), spherical_quadtree::merge_node_aux(), sph_qt_node::sph_qt_node(), spherical_quadtree::split_node(), spherical_quadtree::split_node_aux(), and sph_qt_node::update_fan_indices().
Definition at line 78 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::draw(), sph_qt_node::sph_qt_node(), sph_qt_node::update_fan_indices(), and sph_qt_node::~sph_qt_node().
sph_qt_node* children[4] [protected] |
Definition at line 73 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::cleanup(), sph_qt_node::draw(), sph_qt_node::is_a_leaf(), spherical_quadtree::merge_node(), spherical_quadtree::merge_node_aux(), spherical_quadtree::neighbor_allows_merge(), sph_qt_node::sph_qt_node(), spherical_quadtree::split_node_aux(), sph_qt_node::update_fan_indices(), and sph_qt_node::~sph_qt_node().
bool dirty [protected] |
Definition at line 70 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::merge_node(), spherical_quadtree::merge_node_aux(), spherical_quadtree::split_node_aux(), and sph_qt_node::update_fan_indices().
unsigned long last_merge_frame [protected] |
The frame at which we last merged the node.
Definition at line 85 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::merge_node(), and spherical_quadtree::update().
unsigned long last_radius_frame [protected] |
The frame for which we last calculated the radius of the node.
Definition at line 84 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::node_radius().
unsigned long last_split_frame [protected] |
The frame at which we last split the node.
Definition at line 86 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::merge_node(), spherical_quadtree::split_node(), and spherical_quadtree::update().
int level [protected] |
The level of detail of this node.
Definition at line 69 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::add_leaf_node(), spherical_quadtree::add_merge_node(), spherical_quadtree::merge_node(), spherical_quadtree::neighbor_allows_merge(), spherical_quadtree::remove_leaf_node(), spherical_quadtree::remove_merge_node(), and spherical_quadtree::split_node().
int num_indices_in_quadrants[4] [protected] |
Counts how many indices are used by each subquadrant.
Definition at line 80 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::draw(), sph_qt_node::sph_qt_node(), and sph_qt_node::update_fan_indices().
sph_qt_node* parent_node [protected] |
Definition at line 72 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::merge_node(), spherical_quadtree::merge_node_aux(), and spherical_quadtree::split_node().
spherical_quadtree* parent_quadtree [protected] |
Definition at line 67 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::draw(), lithosphere_qt_node::draw(), sph_qt_node::update_fan_indices(), and sph_qt_node::~sph_qt_node().
gsgl::index_t pos_in_leaf_node_array [protected] |
Definition at line 88 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::add_leaf_node(), and spherical_quadtree::remove_leaf_node().
gsgl::index_t pos_in_merge_node_array [protected] |
Definition at line 89 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::add_merge_node(), spherical_quadtree::merge_node(), and spherical_quadtree::remove_merge_node().
gsgl::real_t radius_in_screen_space [protected] |
The "thickness" of the node in screen space.
Definition at line 83 of file spherical_quadtree.hpp.
Referenced by spherical_quadtree::node_radius().
gsgl::real_t radius_in_world_space [protected] |
The "thickness" of the node in world space.
Definition at line 82 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::draw(), and spherical_quadtree::node_radius().
gsgl::data::simple_array<gsgl::index_t> triangle_fan_indices [protected] |
Temporary for storing indices used by the quadrant.
Definition at line 79 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::update_fan_indices().
gsgl::index_t vertex_indices[25] [protected] |
Stores the indices into the global buffers.
Definition at line 76 of file spherical_quadtree.hpp.
Referenced by sph_qt_node::draw(), spherical_quadtree::node_cos_angle(), spherical_quadtree::node_radius(), sph_qt_node::sph_qt_node(), spherical_quadtree::split_node_aux(), sph_qt_node::update_fan_indices(), and sph_qt_node::~sph_qt_node().