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

  1. #ifndef _DESIGN_
  2. #define _DESIGN_
  3. #include "matrix.h"
  4. #include "seltype.h"
  5.  
  6. const int markersize = 4;
  7.  
  8. const int filenamedirlength = 128;
  9. const int filenamebodylength = 32;
  10.  
  11. #define scrollstep (double)16
  12. #define limitdim (double)(10000.0)
  13.  
  14. const double scalespacingfactor = 1000.0;
  15.  
  16. enum DragType {DragCompound, DragRotOnly, DragScaleOnly} ;
  17. enum ZoomMode {ZoomNone, ZoomSelect, ZoomNow};
  18. enum RendColor {ColorWhite = 0, ColorBlue = 1, ColorRed = 2, ColorGreen = 3, ColorMagenta = 4};
  19.  
  20. const int buttons = 10;
  21. class TWinFrame;
  22. class TWinDisplay;
  23. class TWinPers;
  24. class TWinStatus;
  25. class TScrollBar;
  26. class TBitmapButton;
  27. class Parts;
  28. class CameraParts;
  29. class CombinedParts;
  30. class Object;
  31. class TStatusBar;
  32. class TTextGadget;
  33. class TControlGadget;
  34. class TButton;
  35. class PolyData;
  36. struct LineSegment {
  37.     short x1, y1;
  38.     short x2, y2;
  39.     void *id;
  40. };
  41. struct WireFrame {
  42.     LineSegment *line;
  43.     int lines;
  44. };
  45.  
  46. class DesignData {
  47. public:
  48.     TWinFrame *Frame;
  49.     TWinDisplay *TopView, *SideView, *FrontView;
  50.     TWinPers *PersView;
  51.     TWinStatus *Status;
  52.     TScrollBar *scrollX, *scrollY, *scrollZ;
  53.     TBitmapButton *button[buttons];
  54.  
  55.     TStatusBar *statusbar;
  56.     TTextGadget *statusbar_polygons;
  57.     TButton *button_ok, *button_cancel, *button_zoom;
  58.  
  59.     Vector backup_position, backup_rotation, backup_scale;
  60.  
  61.     int editflag;
  62.  
  63.     ZoomMode zoommode;
  64.     double backup_displayscale;
  65.     Vector backup_displayoffset;
  66.  
  67.     double displayscale;
  68.     Vector displayoffset;
  69.  
  70.     int meshflag;
  71.     int meshspacing;
  72.  
  73.     int hiddenremove;
  74.     int gridflag;
  75.     int gridspacing;
  76.     int rotspacing;
  77.     int scalespacing;
  78.  
  79.     int polygons;
  80.  
  81.     char filedir[filenamedirlength];
  82.     char filename[filenamebodylength];
  83.  
  84.     int cataloglastmenu, cataloglastparts;
  85.  
  86.     DragType dragtype;
  87.  
  88.     WireFrame wireframe;
  89.  
  90.     Parts *parts;
  91.     Parts *select;
  92.     CameraParts *camera;
  93.     CombinedParts *combined;
  94.  
  95.     TPoint drag_point;
  96.     TPoint tmp_point;
  97.     Matrix drag_mat;//, drag_mat_orig;
  98.     Matrix drag_scale, drag_rot, drag_move;
  99.     double drag_px[2], drag_py[2];
  100.     double drag_rx, drag_ry;
  101.     SelectType selectstatus;
  102.  
  103.     RendColor color;
  104.  
  105.     DesignData();
  106.     void SetScrollLimit(int flag=FALSE);
  107.     void ScaleUp(void);
  108.     void ScaleDown(void);
  109.  
  110.     int ScaleUpLimitCheck(void);
  111.     int ScaleDownLimitCheck(void);
  112.  
  113.     void PartsDelete(Parts *p);
  114.     void PartsCopy(Parts *p, SelectType t = SelNone);
  115.     void PartsAdd(Object* obj,
  116.             Vector& m = Vector(0.0, 0.0, 0.0),
  117.             Vector& r = Vector(0.0, 0.0, 0.0),
  118.             Vector& s = Vector(1.0, 1.0, 1.0));
  119.     void PartsAdd(char *filename,
  120.             Vector& m = Vector(0.0, 0.0, 0.0),
  121.             Vector& r = Vector(0.0, 0.0, 0.0),
  122.             Vector& s = Vector(1.0, 1.0, 1.0));
  123.     void ShowObject(Parts *obj, SelectType type, int flag);
  124.     void Redraw(SelectType t = SelAll, int flag = FALSE);
  125. //    void ShowCube(Matrix& m, int flag);
  126.     void ShowCube(Matrix& omat, Matrix& nmat);
  127.     Matrix GetMatrix(Parts *p);
  128.     Matrix GetCubeMatrix(Parts *p);
  129.     void GetCubeMatrix(Parts *p, Matrix& move, Matrix& rot, Matrix& scal);
  130.     void CalcPoints(Parts *p);
  131.     void CalcView(Parts *p);
  132.     void CalcViewAll(void);
  133.     int FileWrite(char *filename = NULL);
  134.     void FileRead(char *filename);
  135.     void FileNew(void);
  136.     void MenuValidate(char *filename);
  137.     void SetCaption(void);
  138.     TStatusBar *InitStatusBar(void);
  139.     void SetPolygons(int p);
  140.  
  141.     void TotalScaling(double rate);
  142.  
  143.     void SelectAxis(SelectType t[3], Matrix& m);
  144.  
  145.     void SelectParts(Parts *p);
  146.     void CancelParts(void);
  147.     void SelectZoom(void);
  148.  
  149.     int GetLinesNoBackFace(LineSegment **line, PolyData *polydata);
  150.     void BuildWireFrame(void);
  151. };
  152.  
  153. #endif