A quad in a terrain quadtree. More...
#include <TerrainQuad.h>
Public Member Functions | |
TerrainQuad (TerrainNode *owner, const TerrainQuad *parent, int tx, int ty, double ox, double oy, double l, float zmin, float zmax) | |
Creates a new TerrainQuad. | |
virtual | ~TerrainQuad () |
Deletes this TerrainQuad. | |
TerrainNode * | getOwner () |
Returns the TerrainNode to which the terrain quadtree belongs. | |
bool | isLeaf () const |
Returns true if this quad is not subdivided. | |
int | getSize () const |
Returns the number of quads in the tree below this quad. | |
int | getDepth () const |
Returns the depth of the tree below this quad. | |
void | update () |
Subdivides or unsubdivides this quad based on the current viewer distance to this quad, relatively to its size. | |
Public Attributes | |
const TerrainQuad * | parent |
The parent quad of this quad. | |
const int | level |
The level of this quad in the quadtree (0 for the root). | |
const int | tx |
The logical x coordinate of this quad (between 0 and 2^level). | |
const int | ty |
The logical y coordinate of this quad (between 0 and 2^level). | |
const double | ox |
The physical x coordinate of the lower left corner of this quad (in local space). | |
const double | oy |
The physical y coordinate of the lower left corner of this quad (in local space). | |
const double | l |
The physical size of this quad (in local space). | |
float | zmin |
The minimum terrain elevation inside this quad. | |
float | zmax |
The maximum terrain elevation inside this quad. | |
ptr< TerrainQuad > | children [4] |
The four subquads of this quad. | |
SceneManager::visibility | visible |
The visibility of the bounding box of this quad from the current viewer position. | |
bool | occluded |
True if the bounding box of this quad is occluded by the bounding boxes of the quads in front of it. | |
bool | drawable |
True if the quad is invisible, or if all its associated tiles are produced and available in cache (this may not be the case if the asynchronous mode is used in a TileSampler). | |
Private Member Functions | |
void | subdivide () |
Creates the four subquads of this quad. | |
Private Attributes | |
TerrainNode * | owner |
The TerrainNode to which this terrain quadtree belongs. |
A quad in a terrain quadtree.
The quadtree is subdivided based only on the current viewer position. All quads are subdivided if they meet the subdivision criterion, even if they are outside the view frustum. The quad visibility is stored in visible. It can be used in TileSampler to decide whether or not data must be produced for invisible tiles (we recall that the terrain quadtree itself does not store any terrain data).
proland::TerrainQuad::TerrainQuad | ( | TerrainNode * | owner, | |
const TerrainQuad * | parent, | |||
int | tx, | |||
int | ty, | |||
double | ox, | |||
double | oy, | |||
double | l, | |||
float | zmin, | |||
float | zmax | |||
) |
Creates a new TerrainQuad.
owner | the TerrainNode to which the terrain quadtree belongs. | |
parent | the parent quad of this quad. | |
tx | the logical x coordinate of this quad. | |
ty | the logical y coordinate of this quad. | |
ox | the physical x coordinate of the lower left corner of this quad. | |
oy | the physical y coordinate of the lower left corner of this quad. | |
l | the physical size of this quad. | |
zmin | the minimum terrain elevation inside this quad. | |
zmax | the maximum terrain elevation inside this quad. |
virtual proland::TerrainQuad::~TerrainQuad | ( | ) | [virtual] |
Deletes this TerrainQuad.
int proland::TerrainQuad::getDepth | ( | ) | const |
Returns the depth of the tree below this quad.
TerrainNode* proland::TerrainQuad::getOwner | ( | ) |
Returns the TerrainNode to which the terrain quadtree belongs.
int proland::TerrainQuad::getSize | ( | ) | const |
Returns the number of quads in the tree below this quad.
bool proland::TerrainQuad::isLeaf | ( | ) | const |
Returns true if this quad is not subdivided.
void proland::TerrainQuad::subdivide | ( | ) | [private] |
Creates the four subquads of this quad.
void proland::TerrainQuad::update | ( | ) |
Subdivides or unsubdivides this quad based on the current viewer distance to this quad, relatively to its size.
This method uses the current viewer position provided by the TerrainNode to which this quadtree belongs.
The four subquads of this quad.
If this quad is not subdivided, the four values are NULL. The subquads are stored in the following order: bottomleft, bottomright, topleft, topright.
True if the quad is invisible, or if all its associated tiles are produced and available in cache (this may not be the case if the asynchronous mode is used in a TileSampler).
const double proland::TerrainQuad::l |
The physical size of this quad (in local space).
const int proland::TerrainQuad::level |
The level of this quad in the quadtree (0 for the root).
True if the bounding box of this quad is occluded by the bounding boxes of the quads in front of it.
TerrainNode* proland::TerrainQuad::owner [private] |
The TerrainNode to which this terrain quadtree belongs.
const double proland::TerrainQuad::ox |
The physical x coordinate of the lower left corner of this quad (in local space).
const double proland::TerrainQuad::oy |
The physical y coordinate of the lower left corner of this quad (in local space).
The parent quad of this quad.
const int proland::TerrainQuad::tx |
The logical x coordinate of this quad (between 0 and 2^level).
const int proland::TerrainQuad::ty |
The logical y coordinate of this quad (between 0 and 2^level).
SceneManager::visibility proland::TerrainQuad::visible |
The maximum terrain elevation inside this quad.
This field must be updated manually by users (the TileSamplerZ class can do this for you).
The minimum terrain elevation inside this quad.
This field must be updated manually by users (the TileSamplerZ class can do this for you).