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

  1. /*****************************************************************************
  2. * Definitions for the Poly3D-H program:                                      *
  3. *****************************************************************************/
  4.  
  5. #ifndef POLY_3D_H_H
  6. #define POLY_3D_H_H
  7.  
  8. #ifdef NO_VOID_PTR
  9. #define VoidPtr        char *
  10. #else
  11. #define VoidPtr        void *
  12. #endif /* NO_VOID_PTR */
  13.  
  14. #include "genmat.h"
  15. #include "parser.h"
  16.  
  17. #ifndef __MSDOS__
  18. #include "xgeneral.h"
  19. #endif /* __MSDOS__ */
  20.  
  21. #ifndef LINE_LEN
  22. #define LINE_LEN    255
  23. #endif  LINE_LEN
  24.  
  25. #define FILE_NAME_LEN    80
  26.  
  27. #ifndef NULL
  28. #define NULL    0
  29. #endif
  30.  
  31. #ifndef TRUE
  32. #define TRUE    -1
  33. #define FALSE    0
  34. #endif
  35.  
  36. #define EPSILON    1e-4  /* Make it smaller if you changed to double precision. */
  37.  
  38. #define TEXT_FILE_OUTPUT 1  /* Kind of output - text file or graphic-screen. */
  39. #define GRAPHICS_OUTPUT  2
  40.  
  41. #define  EDGE_HASH_TABLE_SIZE    500 /* Number of entries in edge hash table. */
  42. #define  EDGE_HASH_TABLE_SIZE1    499             /* One below the above. */
  43. #define  EDGE_HASH_TABLE_SIZE2    250               /* Half of above. */
  44. #define  POLY_HASH_TABLE_SIZE    500 /* Number of entries in poly hash table. */
  45. #define  POLY_HASH_TABLE_SIZE1    499             /* One below the above. */
  46. #define  POLY_HASH_TABLE_SIZE2    250               /* Half of above. */
  47.  
  48. #define  DEFAULT_COLOR        1           /* In case no color is given. */
  49.  
  50. #define  VIEW_PERSPECTIVE    1                  /* View modes. */
  51. #define  VIEW_ORTHOGRAPHIC    2
  52. #define  DEFAULT_PERSPECTIVE_Z    -5.0           /* Default Z focal point. */
  53.  
  54. #define  HIDDEN_COLOR    CYAN            /* Color to draw hidden line result. */
  55.  
  56. /* General macro definitions for evry day usage...  */
  57.  
  58. #define ABS(y)        ((y) > 0 ? (y) : (-(y)))
  59. #define SQR(y)        ((y) * (y))
  60. #define SGN(x)        ((x) > 0 ? 1 : ((x) == 0 ? 0 : -1))
  61. #define MIN(x, y)    ((x) > (y) ? (y) : (x))
  62. #define MAX(x, y)    ((x) > (y) ? (x) : (y))
  63. #define BOUND(x, Min, Max) (MIN(MAX((x), (Min)), (Max)))
  64. #define APX_EQ(x, y)    (ABS(x - y) < EPSILON)
  65.  
  66. #define GEN_COPY(Dest, Src, Size)       memcpy(Dest, Src, Size)
  67.  
  68. #define DEG2RAD(Deg)    ((Deg) * M_PI / 180.0)
  69. #define RAD2DEG(Rad)    ((Rad) * 180.0 / M_PI)
  70.  
  71. /* The following are global setable variables (via config file poly3d-h.cfg) */
  72. extern int MoreFlag, NumEdges, ViewFlag, BackFacingFlag, InternalFlag;
  73.  
  74. extern int NumOfPolygons;          /* Total number of polygons to handle. */
  75.  
  76. /* Global transformation matrix: */
  77. extern MatrixType GlblViewMat;           /* Current view/persp. of object. */
  78.  
  79. /* Data structures used by the hidden line modules: */
  80. extern int EdgeCount;
  81. extern struct EdgeStruct *EdgeHashTable[];
  82. extern struct PolygonStruct *PolyHashTable[];
  83.  
  84. /* And finally the prototypes of the Poly3D-H.c module: */
  85. char *MyMalloc(unsigned size);
  86. void MyExit(int ExitCode);
  87.  
  88. /* Prototypes of the PrepData.c module: */
  89. void PrepareViewData(FileDescription **FD, int NumOfObjects, char **Objects);
  90. int CrossProd(float Pt1[3], float Pt2[3], float Pt3[3]);
  91.  
  92. /* Prototypes of the Out-Edge.c module: */
  93. void OutVisibleEdges(void);
  94.  
  95. #endif POLY_3D_H_H
  96.