| |||||||||
|
|
| |||||||
|
| ||||||||
| |||||||||
#include "vg.h" // Required for the standard Vega classes
int getNumberPfGeoSetsInVegaObject( vgObject *obj ) { // ############################################ // # Public Function // # // # Returns the number of pfGeoSets with // # in a vgObject by traversing the pfNode // # tree of the vgObject // # // ############################################ int numGeoSets = 0;
// // Sanity check we need an object // if( obj == NULL ) return 0;
// // Retrieve the Objects root pfNode // pfNode *node = vgGetObjPfNode( obj ); if( node == NULL ) return 0;
// // Now we can traverse the Nodes tree and count // numGeoSets = getNumberPfGeoSetsInNode ( node, numGeoSets );
return numGeoSets;
} // findNamedDCSNodeInVgObject
int getNumberPfGeoSetsInNode( pfNode *node, int geoSetTotal ) { // ######################################################## // # // # Public Function // # // # A simple Recursive function that will traverse the given // # nodes tree and count all the pfGeoSet it encounters // # // ########################################################
// // Sanity check we need a Node // if( node == NULL ) return geoSetTotal;
// // Check to see if the Node is of the type pfGeode // which is the Performer node that parents pfGeoSets // if( pfIsOfType( node, pfGetGeodeClassType() )) {
// // Get the number of pfGeoSets attached to the pfGeode // int numGeosets = pfGetNumGSets ( node );
geoSetTotal += numGeosets;
}
else {
// // Cycle through the children for this node // int numChildren = pfGetNumChildren ( node );
for ( int idx = 0; idx < numChildren; idx++ ) {
// // Get the child node and recurse in to them // pfNode *childNode = pfGetChild ( node, idx );
geoSetTotal = getNumberPfGeoSetsInNode ( childNode, geoSetTotal );
} }
return geoSetTotal;
} // getNumberPfGeoSetsInNode
| ||
© Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner. |