How to find an Named DCS/DOF node from a vgObject

 

Vega Code Example

 

 

 

 

 

 
 

This example function illustrates how to fined a named Performer  Dynamic Coordinate System (DCS) pfDCS node that is part of the given vgObject.

 

Note that the pfFindNode function is case sensitive.

 

Also you should be aware that if the vgObject is an OpenFlight file and the node uses the default name; such as dof1 and has not had its position  altered, then the node might get removed during the flatten and clean process done by default after the file is loaded.

 

It is good practice to name all Dof/Lod/Switch nodes or any  node of importance, this practice will save you time when debugging

 

 
   
 

 

 
 
 
 

 

#include "vg.h"          // Required for the standard Vega classes
#include "vgperf.h"      // Required for the vgGetXXXPfNode functions
#include "pf.h"          // Required for the standard Performer classes
#include "vgutil.h"
#include "pfutil.h"      // Required for pfFindNode


pfDCS*
findNamedDCSNodeInVgObject( vgObject *obj, const char *dcsName ) {
// #################################################################
// # Public Function
// #
// # Attempts to find the named Performer pfD CS Node (DOF Bead)
// # within the passed vgObject
// #
// # return a pointer to the performer pfDCS node if founD
// #
// # return NULL otherwise
// #
// #################################################################

pfDCS  *dcsNode = NULL;
pfNode *node    = NULL;

    //
    // Sanity check we need an object
    //

   
 if( obj == NULL )
       
 return NULL;

    //
    // Retrieve the Objects root pfNode
    //
    node = vgGetObjPfNode( obj );
   
 if( node == NULL )
      
 return NULL;

    //
    // Find the Named DCS/DOF node in the performer tree
    // Note the name search is case sensitive
    //


   dcsNode = (
pfDCS *)pfFindNode( node, dcsName, pfGetDCSClassType());

return dcsNode;

}
// findNamedDCSNodeInVgObject

 

 
 

 

 

© Copyright 2004 Gordon Tomlinson  All Rights Reserved.

All logos, trademarks and copyrights in this site are property of their respective owner.