home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2003 March / VPR0303A.ISO / AIBO / MoNet / common / include / MTNFile.h < prev    next >
C/C++ Source or Header  |  2002-12-19  |  2KB  |  94 lines

  1. //
  2. // Copyright 2002 Sony Corporation 
  3. //
  4. // Permission to use, copy, modify, and redistribute this software for
  5. // non-commercial use is hereby granted.
  6. //
  7. // This software is provided "as is" without warranty of any kind,
  8. // either expressed or implied, including but not limited to the
  9. // implied warranties of fitness for a particular purpose.
  10. //
  11.  
  12. #ifndef MTNFile_h_DEFINED
  13. #define MTNFile_h_DEFINED
  14.  
  15. #include <Types.h>
  16.  
  17. struct MTNString {
  18.     byte  length;
  19.     char  name[1];
  20. };
  21.  
  22. struct MTNKeyFrame {
  23.     slongword  roll;            //             4 bytes
  24.     slongword  pitch;           //             4 bytes
  25.     slongword  yaw;             //             4 bytes
  26.     slongword  data[1];         // numJoints * 4 bytes
  27. };
  28.  
  29. struct MTNSection0 {            // 24 bytes (total)
  30.     longword  sectionNum;       //  4 bytes
  31.     longword  sectionSize;      //  4 bytes
  32.     longword  numSections;      //  4 bytes
  33.     word      majorVersion;     //  2 bytes
  34.     word      minorVersion;     //  2 bytes
  35.     word      numKeyFrames;     //  2 bytes
  36.     word      frameRate;        //  2 bytes
  37.     longword  option;           //  4 bytes
  38. };
  39.  
  40. struct MTNSection1 {
  41.     longword  sectionNum;       //  4 bytes
  42.     longword  sectionSize;      //  4 bytes
  43.     MTNString     motion;
  44.     // MTNString  author;
  45.     // MTNString  robotDesign;
  46. };
  47.  
  48. struct MTNSection2 {
  49.     longword       sectionNum;
  50.     longword       sectionSize;
  51.     word           numJoints;
  52.     MTNString  locator[1];
  53. };
  54.  
  55. struct MTNSection3 {
  56.     longword  sectionNum;
  57.     longword  sectionSize;
  58.     longword  dataType;
  59.     byte      keyFrame[1];
  60. };
  61.  
  62. struct MTNFile {
  63.     char         magic[4];
  64.     MTNSection0  section0;
  65.     MTNSection1  section1;
  66.  
  67.     word         GetNumJoints();
  68.     word         GetNumKeyFrames();
  69.     word         GetFrameRate();
  70.     char*        GetName();
  71.     char*        GetAuthor();
  72.     char*        GetRobotDesign();
  73.     char*        GetLocator(int index);
  74.     MTNString*   GetLocator2(int index);
  75.     longword     GetDataType();
  76.     int          GetEachKeyFrameSize();
  77.     int          GetTotalKeyFrameSize();
  78.     MTNKeyFrame* GetKeyFrame(int index);
  79.     int          GetNumInterpolate(int index);
  80.     int          GetNumInterpolate8ms(int index);
  81.     slongword    GetJointValue(int index, int jointIndex);
  82.   
  83.     MTNSection2* GetSection2();
  84.     MTNSection3* GetSection3();
  85.  
  86.     void Print();
  87.     void PrintKeyFrame(int index);
  88.  
  89. private:
  90.     char* string_access(MTNString* mstr);
  91. };
  92.  
  93. #endif // MTNFile_h_DEFINED
  94.