Building the vertex tree

Routines for constructing the VDSlib vertex tree.

vdsBeginVertexTree
Initializes the builder
vdsBeginGeometry
Initialize the geometry structures
vdsEndGeometry
When all geometry has been added, prepares VDSlib for node clustering
vdsNewObject
Start a new object, with separate vertex and triangle lists
vdsAddNode
Add a vertex of the original model as a leaf node of the VDS vertex tree
vdsAddTri
Add a triangle of the original model
vdsClusterNodes
Cluster a set of nodes under a single new node
vdsEndVertexTree
Finalize the VDS vertex tree
These routines provide a flexible interface for specifying the geometry of the original model, and for constructing the VDSlib vertex tree upon the vertices of that underlying high-resolution model.

Building a vertex tree begins with a call to vdsBeginVertexTree() and ends with a call to vdsEndVertexTree(). The building process consists of two stages: specifying geometry and clustering nodes. All geometry must be specified before node clustering begins.

Use vdsBeginGeometry() to signal the beginning of the first stage. Geometry (in VDSlib parlance) consists of a list of nodes, or vertices in the original model, and a list of triangles, whose three corners are specified as indices into the list of nodes. Nodes are added with the vdsAddNode() call and triangles are added with vdsAddTri(). The nodes referenced by a triangle must be added before that triangle can be added. When all geometry has been specified, call vdsEndGeometry() to move on to the next stage.

The vertex clustering stage simply consists of calls to vdsClusterNodes(). This function takes several nodes (up to VDS_MAXDEGREE) and clusters them together, assigning the nodes as children of a new parent node with coordinates specified by the user (it is an error to call vdsClusterNodes() on a node which has already been assigned a parent). This parent node may then be clustered with other nodes with further calls to vdsClusterNodes(), and so on, until all nodes have been clustered into a single tree. This is the vertex tree, the fundamental data structure of VDSlib. Note that the vertices of the original (highest-resolution) model, specified by the user in the first stage, form the leaf nodes of the vertex tree. Each internal node thus represents some subset of the original vertices, approximating those vertices with a single point.

Once the vertex tree has been built with successive calls to vdsClusterNodes(), the user calls vdsEndVertexTree() to finalize it. The finished vertex tree is now ready for run-time maintainance and rendering.

See Also:
build.c

alphabetic index hierarchy of classes