home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / MEDIT.LZH / ANIM.H < prev    next >
C/C++ Source or Header  |  1996-07-18  |  4KB  |  195 lines

  1. #ifndef _ANIM_
  2. #define _ANIM_
  3. #include "matrix.h"
  4. #include "motion.h"
  5. #include "seltype.h"
  6.  
  7. static const int markersize = 4;
  8.  
  9. static const int filenamedirlength = 256;
  10. static const int filenamebodylength = 32;
  11.  
  12. //const double scrollstep = 16;
  13. //const double limitdim = 100000;
  14. #define scrollstep (double)16
  15. #define limitdim (double)(100000.0)
  16.  
  17. #define scalespacingfactor (double)(1000.0)
  18. static const int buttons = 4;
  19.  
  20. enum OperationStatus { OpDefault, OpLight, OpSelZoom, OpPlay};
  21. enum DrawMode {DrawWire, DrawPlane, DrawPlaneObject};
  22.  
  23. class TWinFrame;
  24. class TWinDisplay;
  25. class TWinPers;
  26. class TWinStatus;
  27. class TScrollBar;
  28. class THSlider;
  29. class TBMPButton;
  30. class TButton;
  31. class TTimeBar;
  32. class Motion;
  33. class CameraMotion;
  34. class Mechanic;
  35. class Bezier;
  36. class PolyData;
  37.  
  38. struct LineSegment {
  39.     short x1, y1;
  40.     short x2, y2;
  41.     void *id;
  42. };
  43.  
  44. struct WireFrame {
  45.     LineSegment *line;
  46.     int lines;
  47. };
  48.  
  49. class TStatusBar;
  50. class TTextGadget;
  51.  
  52. #define FrontView View[0]
  53. #define SideView View[1]
  54. #define TopView View[2]
  55.  
  56. class AnimationData {
  57. public:
  58.     TWinFrame *Frame;
  59.     TWinDisplay *View[3];
  60.  
  61.     TWinPers *PersView;
  62.     TWinStatus *Status;
  63.     TScrollBar *scrollX, *scrollY, *scrollZ;
  64.  
  65.     TBMPButton *button[buttons];
  66.     TButton *button_ok, *button_cancel;
  67.     TTimeBar *frameCounter;
  68.  
  69.     TStatusBar *statusbar;
  70. //    TTextGadget *statusbar_mode;
  71.     TTextGadget *statusbar_time;
  72.  
  73.     SelectType ViewType[3];
  74.  
  75.     int editflag;
  76.  
  77.     double displayscale;
  78.     Vector displayoffset;
  79.  
  80.     int zoomflag;
  81.     double backup_displayscale;
  82.     Vector backup_displayoffset;
  83.  
  84.     int meshflag;
  85.     int meshspacing;
  86.  
  87.     int gridflag;
  88.     int gridspacing;
  89.     int rotspacing;
  90.     int scalespacing;
  91.  
  92.     int hiddenremove;
  93.  
  94.     DrawMode drawmode;
  95.  
  96.     char filedir[filenamedirlength];
  97.     char filename[filenamebodylength];
  98.     char lastopenmechadir[filenamedirlength];
  99.  
  100.     OperationStatus opstat;
  101.  
  102.     SelectType drawflag;
  103.  
  104.     WireFrame wireframe;
  105.  
  106.     Motion *motion;
  107.     Motion *select;
  108.     CameraMotion *camera;
  109.  
  110.     Vector light;
  111.  
  112.     int maxframe;
  113.     int selectframe;
  114.  
  115.     TPoint drag_point;
  116.     int drag_count;
  117.     Vector org_point, org_vector;
  118.  
  119.     Matrix viewmat;
  120.     Matrix drag_mat;
  121.     Matrix drag_scale, drag_rot, drag_move;
  122.     double drag_px[2], drag_py[2];
  123.     double drag_rx, drag_ry;
  124.     SelectType selectstatus;
  125.  
  126.     BOOL    HelpState;
  127.  
  128.     AnimationData();
  129.  
  130.     void SetScrollLimit(int flag = FALSE);
  131.     void ScaleUp(void);
  132.     void ScaleDown(void);
  133.     int ScaleUpLimitCheck(void);
  134.     int ScaleDownLimitCheck(void);
  135.  
  136.     void DeleteMotion(Motion *p);
  137.     void CopyMotion(Motion *p);
  138.     void AddMotion(Mechanic *m, Bezier *b);
  139.  
  140.     int GetMechaName(char *filename);
  141.     void AddMechanicFix(char *filename);
  142.     void AddMechanicMove(char *filename);
  143.     void ExchangeMechanic(char *filename);
  144.  
  145.     void Redraw(SelectType t = SelAll, int flag = FALSE);
  146.  
  147. //    void ShowMotion(Motion *mot, SelectType type, int flag);
  148. //    void ShowBezier(Motion *mot, SelectType type, int flag);
  149.     void ShowCube(Matrix& omat, Matrix& nmat);
  150.     void ShowLight(Vector& ovec, Vector& nvec);
  151.     void DrawBezier(Bezier *b);
  152.  
  153.     Matrix GetMatrix(Motion *mot, int frame);
  154.     Matrix GetMatrix(Motion *mot);
  155.     void GetCubeMatrix(Motion *m, Matrix& move, Matrix& rot, Matrix& scal);
  156.     Matrix GetCubeMatrix(Motion *mot);
  157.  
  158.     void CalcViewMatrix(void);
  159.     void CalcView(Motion *mot);
  160.  
  161.     void CalcViewAll(void);
  162.     void CalcPoints(Motion *mot);
  163.     void CalcPointsAll(void);
  164.  
  165.     void SetDrawMode(DrawMode mode);
  166.  
  167.     void ExpandFrame(int frame);
  168.     void SelectFrame(int frame);
  169.     void SelectMotion(Motion *m = NULL);
  170.  
  171.     void WriteFile(char *filename = NULL);
  172.     void ReadFile(char *filename);
  173.     void InitMotion(void);
  174.     void NewFile(void);
  175.  
  176.     void SetCaption(void);
  177.  
  178.     void OpModeDefault(void);
  179.     void OpModeLight(void);
  180.     void OpModeZoom(void);
  181.     void OpModePlay(void);
  182.  
  183.     void SelectAxis(SelectType t[3], Matrix& m);
  184.     TStatusBar *InitStatusBar(void);
  185.  
  186.     int GetLines(int frame, LineSegment *line);
  187.     int GetLinesNoBackFace(int frame, LineSegment **line, PolyData *polydata);
  188.     void BuildWireFrame(int frame);
  189.  
  190.     void WinHelp(UINT fuCommand,DWORD dwData);
  191. };
  192.  
  193. #endif
  194.  
  195.