|
Public Member Functions | |
AtlasOldActivationHeightfield (const U32 sizeLog2, const F32 sampleSpacing, const F32 heightScale) | |
virtual | ~AtlasOldActivationHeightfield () |
S8 | getLevel (Point2I pos) |
void | setLevel (Point2I pos, S8 level) |
void | activate (Point2I pos, S8 level) |
HeightType | getHeightAtLOD (Point2I pos, S8 level) |
Returns the height of the mesh as simplified to the specified level of detail. | |
void | generateChunkFile (Stream *s, S8 treeDepth, F32 baseMaxError) |
Generate LOD chunks from the heightfield. | |
bool | dumpHeightAtLOD (S8 level, const char *filename) |
bool | dumpActivationLevels (const char *filename) |
Static Public Attributes | |
static bool | smDoChecks |
If set, do a variety of checks during generation to ensure we have valid activation levels and so forth. | |
static bool | smGenerateDebugData |
If set, set a debug flag in the file header and insert sentinel values in the datastream to ensure we've made valid data. | |
Protected Member Functions | |
HeightType | heightQuery (S8 level, Point2I pos, Point2I a, Point2I r, Point2I l) |
Returns the height of the query point (x,z) within the triangle (a, r, l), as tesselated to the specified LOD. | |
void | generateEmptyTOC (Stream *s, S32 treeDepth) |
Append an empty table-of-contents for a fully-populated quadtree, and rewind the stream to the start of the contents. | |
void | generateNodeData (Stream *s, Point2I pos, S32 log_size, S32 level, HeightType min=0, HeightType max=0) |
Given a square of data, with northwest corner at pos and comprising ((1<<logSize)+1) verts along each axis, this function generates the mesh using verts which are active at the given level. | |
void | generateSkirt (AtlasOldMesher *cm, const Point2I a, const Point2I b, const S8 level) |
void | generateBlock (AtlasOldMesher *cm, const S8 activationLevel, S32 logSize, Point2I c) |
void | generateQuadrant (AtlasOldMesher *cm, AtlasOldGenState &s, Point2I l, Point2I t, Point2I r, S32 recursionLevel) |
void | propagateActivationLevel (Point2I c, S8 level, S8 targetLevel) |
Does a quadtree descent through the heightfield, in the square with center at (cx, cz) and size of (2 ^ (level + 1) + 1). | |
S8 | checkPropagation (Point2I c, S8 level) |
Debugging function -- verifies that activation level dependencies are correct throughout the tree. | |
void | update (F32 baseMaxError, Point2I a, Point2I r, Point2I l) |
Given the triangle, computes an error value and activation level for its base vertex, and recurses to child triangles. | |
Protected Attributes | |
S8 * | mActivationLevels |
AtlasOldActivationHeightfield::AtlasOldActivationHeightfield | ( | const U32 | sizeLog2, | |
const F32 | sampleSpacing, | |||
const F32 | heightScale | |||
) |
virtual AtlasOldActivationHeightfield::~AtlasOldActivationHeightfield | ( | ) | [virtual] |
HeightType AtlasOldActivationHeightfield::heightQuery | ( | S8 | level, | |
Point2I | pos, | |||
Point2I | a, | |||
Point2I | r, | |||
Point2I | l | |||
) | [protected] |
Returns the height of the query point (x,z) within the triangle (a, r, l), as tesselated to the specified LOD.
Return value is in heightfield discrete coords. To get meters, multiply by the heightfield's vertical scale.
Append an empty table-of-contents for a fully-populated quadtree, and rewind the stream to the start of the contents.
Use this to make room for TOC at the beginning of the file, while bulk vert/index data gets appended after the TOC. (Helper function, the data is later filled in by the data generation process.)
void AtlasOldActivationHeightfield::generateNodeData | ( | Stream * | s, | |
Point2I | pos, | |||
S32 | log_size, | |||
S32 | level, | |||
HeightType | min = 0 , |
|||
HeightType | max = 0 | |||
) | [protected] |
Given a square of data, with northwest corner at pos and comprising ((1<<logSize)+1) verts along each axis, this function generates the mesh using verts which are active at the given level.
If we're not at the base level (level > 0), then also recurses to quadtree child nodes and generates their data.
void AtlasOldActivationHeightfield::generateSkirt | ( | AtlasOldMesher * | cm, | |
const Point2I | a, | |||
const Point2I | b, | |||
const S8 | level | |||
) | [protected] |
void AtlasOldActivationHeightfield::generateBlock | ( | AtlasOldMesher * | cm, | |
const S8 | activationLevel, | |||
S32 | logSize, | |||
Point2I | c | |||
) | [protected] |
void AtlasOldActivationHeightfield::generateQuadrant | ( | AtlasOldMesher * | cm, | |
AtlasOldGenState & | s, | |||
Point2I | l, | |||
Point2I | t, | |||
Point2I | r, | |||
S32 | recursionLevel | |||
) | [protected] |
void AtlasOldActivationHeightfield::propagateActivationLevel | ( | Point2I | c, | |
S8 | level, | |||
S8 | targetLevel | |||
) | [protected] |
Does a quadtree descent through the heightfield, in the square with center at (cx, cz) and size of (2 ^ (level + 1) + 1).
Descends until level == target_level, and then propagates this square's child center verts to the corresponding edge vert, and the edge verts to the center. Essentially the quadtree meshing update dependency graph per Thatcher Ulrich's Gamasutra article. Must call this with successively increasing target_level to get correct propagation.
Debugging function -- verifies that activation level dependencies are correct throughout the tree.
void AtlasOldActivationHeightfield::update | ( | F32 | baseMaxError, | |
Point2I | a, | |||
Point2I | r, | |||
Point2I | l | |||
) | [protected] |
Given the triangle, computes an error value and activation level for its base vertex, and recurses to child triangles.
HeightType AtlasOldActivationHeightfield::getHeightAtLOD | ( | Point2I | pos, | |
S8 | level | |||
) |
Returns the height of the mesh as simplified to the specified level of detail.
void AtlasOldActivationHeightfield::generateChunkFile | ( | Stream * | s, | |
S8 | treeDepth, | |||
F32 | baseMaxError | |||
) |
Generate LOD chunks from the heightfield.
tree_depth | Determines the depth of the chunk quadtree. | |
base_max_error | Specifies the maximum allowed geometric vertex error, at the finest level of detail. |
bool AtlasOldActivationHeightfield::dumpActivationLevels | ( | const char * | filename | ) |
S8* AtlasOldActivationHeightfield::mActivationLevels [protected] |
If set, do a variety of checks during generation to ensure we have valid activation levels and so forth.
Also tells NVTriStrip to validate what we push through it.
If set, set a debug flag in the file header and insert sentinel values in the datastream to ensure we've made valid data.