Re: How do I access DOF constraint info?

New Message Reply Date view Thread view Subject view Author view

Andy Shein (ashein++at++orac.boston.sgi.com)
Mon, 30 Mar 1998 15:25:53 -0800


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.

   Hope that helps
                Andy

-- 
Andrew Shein   SE Stout               email: ashein++at++boston.sgi.com
Silicon Graphics Inc.                 phone: (978) 562 - 4800
1 Cabot Road                            fax: (978) 562 - 4755
Hudson, MA 01749                      vmail: 59688
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:07 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.