|
| ||||||||
|
|
| |||||||
|
| ||||||||
| |||||||||
#include "vg.h" // Required for the standard Vega classes
void setNavigatorOverallSpeed( const int navIdx, const float speed ){ // ################################################## // # Public Function // # // # // # This function shows how to set a constant speed // # on for the Navigator on all it velocitcy control // # markers // # // # // ################################################## char data[256]; unsigned ctrlptIdx = -1; int eventType = -1; double value = -1; unsigned nbytes = 0;
// // Sanity check we need the indexed navigator // vgSplineNavigator *navigator = vgGetNavigator( navIdx );
if( navigator == NULL ) return;
// // Retrieve the current rendering state // int render = vgProp( navigator, VGSPLINENAV_RENDER );
// // Retrieve the current navigator state // int navstate = vgProp( navigator, VGCOMMON_ENABLED );
// // First switch the navigator and rendering off // off because we may need a rebuild and the // rendering is not multibuffered and can crash // vgProp( navigator, VGSPLINENAV_RENDER, VG_OFF ); vgProp( navigator, VGCOMMON_ENABLED, VG_OFF );
// // Force an update of the navigators state // vgUpdate( navigator );
// // Retrieve how many markers the navigator has // int numMarkers = vgGetProp( navigator,VGNAV_NUM_MARKERS);
// // Unfortunately we have to search through every marker // that the Navigator has to find the Velocity marker // for the control point as Vega does not provide a // a straight forward interface to do this // for( int j = 0; j < numMarkers; j++ ){
vgNavigatorGetMarker( (vgNavigator*)navigator, j, &ctrlptIdx, &eventType, &value, (void**)data, &nbytes );
// // If the marker is the type Velocity // if( eventType == VGSPLINENAV_VELOCITY ) {
// // Now we can set the Velocity marker to the new speed // vgNavigatorMarker( (vgNavigator*)navigator, j, ctrlptIdx, VGSPLINENAV_VELOCITY, speed, NULL, 0 );
} }
// // We also need to set the default overal speed // vgProp( navigator,VGSPLINENAV_VELOCITY, speed );
// // We need to call make after changes to markers // vgMakeSplineNavigator(navigator);
// // Set the path render state back to its original state // if( render == VG_ON ) vgProp( navigator, VGSPLINENAV_RENDER, VG_ON );
// // Set the path render state back to its original state // if( navstate == VG_ON ) vgProp( navigator, VGCOMMON_ENABLED, VG_ON );
} // setNavigatorOverallSpeed
| ||
© Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner. |