Re: How do I access DOF constraint info?
Angus Dorbie (dorbie++at++sgi.com)
Tue, 31 Mar 1998 10:01:23 -0800
Andy Shein wrote:
>
> Hi Tom
> Multigen has a great readme file with the loader, but in short
> you can create a multigen loader callback and in the CB_DOF case
> (You can ignore the comment parseing stuff )
>
> case CB_DOF:
> if( node->isOfType( node, pfDCS::getClassType() ) )
> {
> if( cbcom != NULL ) // see if comment is there
> {
> if( cbcom->length != 0 ) // parse comment
> {
> sscanf( cbcom->text, "%s %s %s", &arg1, &arg2, &arg3 );
> }
> }
>
> pfNotify( PFNFY_INFO, PFNFY_PRINT,
> "found DOF %s \n", node->getName() );
>
> // Remember DOF info
>
> strcpy( door[dof_count].name, node->getName() );
> door[dof_count].dof = (DOFcb *)cbs;
> door[dof_count].dcs = (pfDCS *)node;
> door[dof_count].axis = PF_Z; // assume its a door
>
> if( strcmp( arg1, "TABLE" ) == 0 ) // set rotation axis
> {
> door[dof_count].axis = AXIS_TABLE;
> }
> else
> {
> door[dof_count].axis = AXIS_DOOR;
> }
>
> if( strcmp( arg1, "SYNC" ) == 0 )
> {
> strcpy( door[dof_count].sync_name, arg2 );
> }
> else
> {
> strcpy( door[dof_count].sync_name, "NONE" );
> }
>
> dof_count++;
> door_count++;
>
> } // end if node is of type DCS
>
> the door struct looks like this
>
> typedef struct
> {
> char name[128]; // name of DCS
> DOFcb *dof; // multigen degree of freedom info
> pfDCS *dcs; // performer dynamic coordinate of door
>
> float angle; // current angle we are at
> int axis; // axis we rotate on
>
> char sync_name[128]; // other DCS we should sync with
> int sync_index; // index of sync DOOR
> pfPortalData *portal; // portal that we cover
>
> } DOOR;
>
> and there is a global array of DOORs
>
> extern DOOR door[100]; // array of door structs to remeber dof stuff
> extern int door_count;
>
> In your app then you can compare dcs pointers to the
> dcs pointer in the DOOR struct and then get at the cbDOF stuff.
>
I hope all this crap is freed on a pfDelete. :-)
Cheers,Angus.
--
"Only the mediocre are always at their best." -- Jean Giraudoux
For advanced 3D graphics Performer + OpenGL based examples and tutors:
http://www.dorbie.com/
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2
on Mon Aug 10 1998 - 17:57:07 PDT