| 
                 
 
 
 
  | |||||||||
| 
             
  | 
             
  | 
             
  | |||||||
| 
             
  | 
            
  | ||||||||
| 
             
  | |||||||||
| 
                 
 #include "vg.h"           // Required for the standard Vega classes
 
 
 
 
 vgObject* createNewVegaObjectFromPfNode( pfNode *node, const char *name ){ // ############################################################## // # Public function // # // # The function shows how to create a new vgObject using a // # Performer Node as as the template to create the object // # // # Returns a pointer to the New vgObject if successful // # otherwise returns NULL // # // # // ############################################################## vgDataSet *dset = NULL; vgObject *obj = NULL; vgPosition *pos = NULL; int created = VG_FAILURE; 
 
 // // Sanity check we need a node // if( node == NULL ) { return NULL; } 
 // // We first create a new empty Data Set // dset = vgNewDS(); if( dset == NULL ) { return NULL; } 
 
 // // Set the name for the data set // vgName( dset, name ); 
 
 // We want to discard any constraints of any DOF/DCS nodes // vgProp( dset, VGDS_CREATECONSTRAINTS, VG_OFF); 
 
 // // Now actually try to created the DataSet from the pfNode // created = vgMakeDS( dset, node, VGDS_GEOMETRY ); 
 if( created != VG_SUCCESS ) { 
 // // We need to clean up // vgDelete ( dset ); 
 return NULL; } 
 
 // // Now we create a new and empty vgObject // obj = vgNewObj(); 
 if( dset == NULL ) { 
 // // We need to clean up // vgDelete ( dset ); 
 return NULL; } 
 // // Name the new object // vgName( obj, name ); 
 // // Make the object dynamic other wise we cannot move it // vgProp( obj, VGOBJ_CS, VGOBJ_DYNAMIC ); 
 // // We want to make parts for named nodes etc // vgProp( obj, VGOBJ_PARTS, VG_ON ); 
 
 // // We want to discard any constraints of any DOF/DCS nodes // vgProp( obj, VGOBJ_CONSTRAIN, VG_OFF ); 
 // // Set the scaling factor for the new object if required // // vgProp( obj, VGOBJ_SCALE, 1.0f ); 
 
 
 // // By default we should always clean and flatten the object // this will help remove any redundant nodes and static // transformations and help improve performance // // Note that there is known bug in vega such that using // Clean will cause culling problems at the edge of the // channel if the object has scaling in this case set // VGOBJ_NOOPT instead of VGOBJ_CLEAN // vgProp( obj, VGOBJ_OPTIM, VGOBJ_CLEAN ); 
 vgProp( obj, VGOBJ_OPTIM, VGOBJ_FLATTEN ); 
 
 // // Set any object initial offset position here // pos = vgNewPos(); if( pos != NULL ){ 
 vgPosVec( pos, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 
 vgPos( obj, pos ); 
 // // Free the position marker // vgDelPos( pos); 
 } 
 
 // // Set the dataset for for the new object // vgObjDS( obj, dset ); 
 
 // // Now we call make object which will create the object 3d data // using the tree created by the vgLoadDS // // Make the object using COPY mode so that we can use multiple // copis of the 3d datbase if required // vgMakeObj( obj, VGOBJ_COPY); 
 
 // // Finally set the new vgObject isector and representation masks // vgObjClass( obj, 0xFFFFFFFF ); 
 vgObjRepresent( obj, 0xFF000000 ); 
 
 return obj; 
 } // createNewVegaObject 
 
 
  | ||
| 
  
 
 © Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner.  | ||