home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / IRIT / POLY3DS.ZIP / PROGRAM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-05  |  2.7 KB  |  94 lines

  1. /*****************************************************************************
  2. * Definitions for the Poly3D program:                         *
  3. *****************************************************************************/
  4.  
  5. #ifndef POLY_3D_H
  6. #define POLY_3D_H
  7.  
  8. #ifdef NO_VOID_PTR
  9. #define VoidPtr        char *
  10. #else
  11. #define VoidPtr        void *
  12. #endif /* NO_VOID_PTR */
  13.  
  14. #define RealType double
  15.  
  16. #include "genmat.h"
  17. #include "parser.h"
  18.  
  19. #ifndef __MSDOS__
  20. #include "xgeneral.h"
  21. #endif /* __MSDOS__ */
  22.  
  23. #ifndef    NULL
  24. #define    NULL    0
  25. #endif
  26.  
  27. #ifndef    TRUE
  28. #define    TRUE    1
  29. #define    FALSE    0
  30. #endif
  31.  
  32. #ifndef LINE_LEN
  33. #define LINE_LEN    255
  34. #endif
  35.  
  36. #define FILE_NAME_LEN    80
  37.  
  38. /* Name    of generic matric transformation saved by this program:    */
  39. #define GENERIC_MAT_FILE  "generic#.mat"   /* Generic mat file name to save. */
  40. #define GENERIC_GIF_FILE  "generic#.gif"   /* Generic gif file name to save. */
  41. #define GENERIC_PS_FILE   "generic#.ps"        /* Generic PS file name to save. */
  42.  
  43. /* The current NormalLength is divided by scaler to form real normal length: */
  44. #define NORMAL_DEFAULT_LENGTH    10
  45. #define NORMAL_SCALER_LENGTH    100
  46.  
  47. #define ABS(y)        ((y) > 0 ? (y) : (-(y)))
  48. #define SQR(y)        ((y) * (y))
  49. #define SGN(x)        ((x) > 0 ? 1 : ((x) == 0 ? 0 : -1))
  50. #define MIN(x, y)    ((x) > (y) ? (y) : (x))
  51. #define MAX(x, y)    ((x) > (y) ? (x) : (y))
  52. #define BOUND(x, Min, Max) (MIN(MAX((x), (Min)), (Max)))
  53. #define GEN_COPY(Dest, Src, Size)       memcpy(Dest, Src, Size)
  54.  
  55. #define INFINITY    1e6
  56. #define EPSILON        1e-6
  57.  
  58. #define DEG2RAD(Deg)    ((Deg) * M_PI / 180.0)
  59. #define RAD2DEG(Rad)    ((Rad) * 180.0 / M_PI)
  60.  
  61. #define BSPACE    8
  62. #define TAB    9
  63. #define LF    10
  64. #define CR    13
  65. #define ESC    27
  66.  
  67. #define DEFAULT_COLOR        1      /* For objects with no color defined. */
  68.  
  69. #define VIEW_PERSPECTIVE    1                  /* View modes. */
  70. #define VIEW_ORTHOGRAPHIC    2
  71. #define DEFAULT_PERSPECTIVE_Z    -5.0           /* Default Z focal point. */
  72.  
  73. #define TRANS_SCREEN    1     /* Screen, Object coords. transformation mode. */
  74. #define TRANS_OBJECT    2
  75.  
  76. /* Some external variables defined for all the programs: */
  77.  
  78. extern int InterFlag, MoreFlag, TextFlag, DrawVNormalsFlag, DrawPNormalsFlag,
  79.        NumEdges, MouseExists, GraphDriver, ClosedObject;
  80.  
  81. extern MatrixType GlblViewMat, GlblPerspMat;/* Current view/persp. of object.*/
  82. extern MatrixType CrntViewMat;            /* This is the current view! */
  83. extern int GlblTransformMode;          /* Screen, Object coords. trans. mode. */
  84. extern int GlblViewMode;           /* Perspective, Orthographic etc. */
  85. extern int GlblDepthCue;               /* Activate depth cueing. */
  86. extern int GlblNormalLen;             /* Scaler for normals if drawn. */
  87.  
  88. /* And finally Poly3D module prototypes: */
  89.  
  90. char *MyMalloc(unsigned size);
  91. void MyExit(int ExitCode);
  92.  
  93. #endif POLY_3D_H
  94.