#include <soarxdrawable.h>
Public Member Functions | |
| SoarXDrawable (int baseBits, float horizontalResolution) | |
| Sets up some default rendering parameters used during the rendering and progressive refinement. | |
| SoarXDrawable (const SoarXDrawable &rhs, const osg::CopyOp ©Op=osg::CopyOp::SHALLOW_COPY) | |
| Makes a copy of the right hand side drawable. | |
| virtual osg::Object * | cloneType () const |
| Calls the default constructor on this class and returns a new instance. | |
| virtual osg::Object * | clone (const osg::CopyOp ©op) const |
| Makes a new instance of this class by calling its copy constructor. | |
| virtual void | drawImplementation (osg::RenderInfo &renderInfo) const |
| Draws the current view of the terrain dataset. | |
| virtual bool | supports (osg::PrimitiveFunctor &) const |
| virtual osg::BoundingBox | computeBound () const |
| Computes the dimensions of the currently loaded terrain. | |
| bool | Build (const PagedTerrainTile &tile) |
| Builds the internal data structures for use in rendering and managing terrain data for a tile. | |
| void | Clear () |
| Clears any memory used by the internal rendering structures. | |
| float | GetHeight (float x, float y) |
| Gets the elevation at the current (x,y) coordinates. | |
| void | SetEyePoint (const osg::Vec3 &pos) |
| Sets the eye point of the camera. | |
| float | SetDetailMultiplier (float value) |
| Calculates and caches values used to determine error approximation in the rendering/refinement process. | |
| float | GetDetailMultiplier () const |
| Gets the current detail multiplier. | |
| float | SetThreshold (float value) |
| Sets the threshold value used during error projection and refinement in the rendering process. | |
| float | GetThreshold () const |
| Gets the current error threshold. | |
| float | GetBaseVerticalResolution () const |
| Gets the base vertical resolution. | |
| float | GetBaseHorizontalResolution () const |
| Gets the base horizontal resolution. | |
| float | GetDetailHorizontalResolution () const |
| Gets the detail map's horizontal resolution. | |
| void | SetDetailNoise (int detailBits, float detailVerticalResolution, float *detailData) |
| Sets the noise data used to procedurally generate additional detail vertices when rendering the terrain. | |
| float | GetDetailVerticalResolution () const |
| Gets the detail map's vertical resolution. | |
| int | GetDetailSize () const |
| Gets the size of the detail map. | |
| bool | RestoreDataFromCache (const PagedTerrainTile &tile) |
| void | WriteDataToCache (const PagedTerrainTile &tile) |
Protected Member Functions | |
| virtual | ~SoarXDrawable () |
| Simply destroys the terrain drawable. | |
| RawData * | GetRawData (Index index) |
| Gets the raw data at the given index. | |
| void | CalculateVertexErrors () |
| Precalculates vertex bounding spheres based on an object space error metric. | |
| void | CalculateVertexErrorsHelper (Index i, Index j) |
| Recursive method used by the above method to build the error values. | |
| float | CalculateError (Index i, Index j) |
| Calculates the object space error value of a vertex using the two indices provided. | |
| Vertex | GetVertex (Index index) |
| Gets a vertex based on the provided index. | |
| void | CalculateRadii (float f) |
| void | RepairBoundingSphereHierarchy () |
| Ensures that the bounding spheres for each vertex satisfy the requirement that a vertex's bounding sphere contains all of its descendant vertices' bounding spheres. | |
| void | CheckChildren1 (Index index, unsigned int shift) |
| void | CheckChildren2 (Index index, unsigned int shift) |
| void | Repair (Index i, Index c) |
| void | Render (osg::State &state) |
| Refines and renders the terrain. | |
| void | Append (Vertex &v) |
| Adds a vertex and associated index to the vertex and index array. | |
| void | Refine (Vertex &v1, Vertex &v2, bool in, bool out, unsigned int planes) |
| Starts the procedural view-dependent refinement process. | |
| void | RightRefine (Vertex v1, Vertex &v2, bool out, unsigned int planes) |
| Recursivly refines the right of the two child triangles of the root refinement procedure. | |
| void | LeftRefine (Vertex &v1, Vertex &v2, bool in, unsigned int planes) |
| Recursivly refines the left of the two child triangles of the root refinement procedure. | |
| void | TurnCorner () |
| Inserts a degenerate triangle in the terrain vertex stream in order to generate a maximum length triangle strip during the refinement process. | |
| bool | Active (Vertex &v, unsigned int &planes) |
| Decides is a vertex to be in the resulting rendered terrain mesh. | |
| void | GetVertex (Vertex &v) |
| Retrieves a vertex from the procedural terrain mesh. | |
Friends | |
| struct | SoarXCullCallback |
Classes | |
| struct | Index |
| This structure represents a location on the terrain's 2D grid. More... | |
| struct | RawData |
| This structure is the raw data on disk. More... | |
| struct | Vertex |
| This is the structure for a single processed vertex in the terrain. More... | |
| dtTerrain::SoarXDrawable::SoarXDrawable | ( | int | baseBits, | |
| float | horizontalResolution | |||
| ) |
Sets up some default rendering parameters used during the rendering and progressive refinement.
| baseBits | The size of the terrain chunk. (size=(2^baseBits)) | |
| horizontalResolution | The distance between each height value. |
| dtTerrain::SoarXDrawable::SoarXDrawable | ( | const SoarXDrawable & | rhs, | |
| const osg::CopyOp & | copyOp = osg::CopyOp::SHALLOW_COPY | |||
| ) |
Makes a copy of the right hand side drawable.
| rhs | The SoarXDrawable to copy. | |
| copyOp | Specifies whether a deep copy or a shallow copy should occur. |
| dtTerrain::SoarXDrawable::~SoarXDrawable | ( | ) | [protected, virtual] |
Simply destroys the terrain drawable.
| osg::Object * dtTerrain::SoarXDrawable::cloneType | ( | ) | const [virtual] |
Calls the default constructor on this class and returns a new instance.
| osg::Object * dtTerrain::SoarXDrawable::clone | ( | const osg::CopyOp & | copyop | ) | const [virtual] |
Makes a new instance of this class by calling its copy constructor.
| void dtTerrain::SoarXDrawable::drawImplementation | ( | osg::RenderInfo & | renderInfo | ) | const [virtual] |
Draws the current view of the terrain dataset.
| state | The current OpenGL state. |
| virtual bool dtTerrain::SoarXDrawable::supports | ( | osg::PrimitiveFunctor & | ) | const [inline, virtual] |
| osg::BoundingBox dtTerrain::SoarXDrawable::computeBound | ( | ) | const [virtual] |
Computes the dimensions of the currently loaded terrain.
| bool dtTerrain::SoarXDrawable::Build | ( | const PagedTerrainTile & | tile | ) |
Builds the internal data structures for use in rendering and managing terrain data for a tile.
| The | source terrain tile. |
| void dtTerrain::SoarXDrawable::Clear | ( | ) |
Clears any memory used by the internal rendering structures.
| float dtTerrain::SoarXDrawable::GetHeight | ( | float | x, | |
| float | y | |||
| ) |
Gets the elevation at the current (x,y) coordinates.
| void dtTerrain::SoarXDrawable::SetEyePoint | ( | const osg::Vec3 & | pos | ) | [inline] |
Sets the eye point of the camera.
This is used during the refinement process to calculate vertex projection errors.
| pos | The camera position. |
| float dtTerrain::SoarXDrawable::SetDetailMultiplier | ( | float | value | ) | [inline] |
Calculates and caches values used to determine error approximation in the rendering/refinement process.
| value |
| float dtTerrain::SoarXDrawable::GetDetailMultiplier | ( | ) | const [inline] |
Gets the current detail multiplier.
| float dtTerrain::SoarXDrawable::SetThreshold | ( | float | value | ) | [inline] |
Sets the threshold value used during error projection and refinement in the rendering process.
| value | The new threshold value. |
| float dtTerrain::SoarXDrawable::GetThreshold | ( | ) | const [inline] |
Gets the current error threshold.
| float dtTerrain::SoarXDrawable::GetBaseVerticalResolution | ( | ) | const [inline] |
Gets the base vertical resolution.
This number determines the overall scaling for height values in the terrain.
| float dtTerrain::SoarXDrawable::GetBaseHorizontalResolution | ( | ) | const [inline] |
Gets the base horizontal resolution.
This number determines the overall scaling for the terrain's X and Y dimensions.
| float dtTerrain::SoarXDrawable::GetDetailHorizontalResolution | ( | ) | const [inline] |
Gets the detail map's horizontal resolution.
| void dtTerrain::SoarXDrawable::SetDetailNoise | ( | int | detailBits, | |
| float | detailVerticalResolution, | |||
| float * | detailData | |||
| ) |
Sets the noise data used to procedurally generate additional detail vertices when rendering the terrain.
| detailBits | The size of the detail data. The amount of data should be (2^detailBits * 2^detailBits). | |
| detailVerticalResolution | A scale value used when calculating the final detail vertex position. | |
| detailData | The detail noise values. |
| float dtTerrain::SoarXDrawable::GetDetailVerticalResolution | ( | ) | const [inline] |
Gets the detail map's vertical resolution.
| int dtTerrain::SoarXDrawable::GetDetailSize | ( | ) | const [inline] |
Gets the size of the detail map.
| bool dtTerrain::SoarXDrawable::RestoreDataFromCache | ( | const PagedTerrainTile & | tile | ) |
| void dtTerrain::SoarXDrawable::WriteDataToCache | ( | const PagedTerrainTile & | tile | ) |
Gets the raw data at the given index.
| void dtTerrain::SoarXDrawable::CalculateVertexErrors | ( | ) | [protected] |
Precalculates vertex bounding spheres based on an object space error metric.
Recursive method used by the above method to build the error values.
Calculates the object space error value of a vertex using the two indices provided.
| SoarXDrawable::Vertex dtTerrain::SoarXDrawable::GetVertex | ( | Index | index | ) | [protected] |
Gets a vertex based on the provided index.
| void dtTerrain::SoarXDrawable::CalculateRadii | ( | float | f | ) | [protected] |
| void dtTerrain::SoarXDrawable::RepairBoundingSphereHierarchy | ( | ) | [protected] |
Ensures that the bounding spheres for each vertex satisfy the requirement that a vertex's bounding sphere contains all of its descendant vertices' bounding spheres.
This ensures a proper sphere tree for all the vertices.
| void dtTerrain::SoarXDrawable::CheckChildren1 | ( | Index | index, | |
| unsigned int | shift | |||
| ) | [protected] |
| void dtTerrain::SoarXDrawable::CheckChildren2 | ( | Index | index, | |
| unsigned int | shift | |||
| ) | [protected] |
| void dtTerrain::SoarXDrawable::Render | ( | osg::State & | state | ) | [protected] |
Refines and renders the terrain.
(111111) bitmask instructing the start of the refinement process to check all 6 planes.
| void dtTerrain::SoarXDrawable::Append | ( | Vertex & | v | ) | [protected] |
Adds a vertex and associated index to the vertex and index array.
| void dtTerrain::SoarXDrawable::Refine | ( | Vertex & | v1, | |
| Vertex & | v2, | |||
| bool | in, | |||
| bool | out, | |||
| unsigned int | planes | |||
| ) | [protected] |
Starts the procedural view-dependent refinement process.
The SoarX refinement proceess is based on the longest edge bisection of isosceles right triangles. It subdivides each triangle about its hypotenuse, creating two smaller triangles.
| void dtTerrain::SoarXDrawable::RightRefine | ( | Vertex | v1, | |
| Vertex & | v2, | |||
| bool | out, | |||
| unsigned int | planes | |||
| ) | [protected] |
Recursivly refines the right of the two child triangles of the root refinement procedure.
| void dtTerrain::SoarXDrawable::LeftRefine | ( | Vertex & | v1, | |
| Vertex & | v2, | |||
| bool | in, | |||
| unsigned int | planes | |||
| ) | [protected] |
Recursivly refines the left of the two child triangles of the root refinement procedure.
| void dtTerrain::SoarXDrawable::TurnCorner | ( | ) | [protected] |
Inserts a degenerate triangle in the terrain vertex stream in order to generate a maximum length triangle strip during the refinement process.
| bool dtTerrain::SoarXDrawable::Active | ( | Vertex & | v, | |
| unsigned int & | planes | |||
| ) | [protected] |
Decides is a vertex to be in the resulting rendered terrain mesh.
This is performed by calculating its position and its 2D/3D projected error. Hierarchial view-frustum culling is also performed here.
| v | The vertex to check. | |
| planes | A bitmask designating which planes to cull to. | |
| level | Current level of recursion. |
| void dtTerrain::SoarXDrawable::GetVertex | ( | Vertex & | v | ) | [protected] |
Retrieves a vertex from the procedural terrain mesh.
friend struct SoarXCullCallback [friend] |