home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / radiance / simplerd.lha / simplerad / FinalFTP / Light / ray.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-21  |  4.6 KB  |  94 lines

  1. /**********************************************************************/
  2. /*                                                                    */
  3. /* ray.h : Types for ray tracing                                      */
  4. /*                                                                    */
  5. /* Parts modified from Optik v(1.2e) (C) 1987 John Amanatides &       */
  6. /* Andrew Woo                                                         */
  7. /*                                                                    */
  8. /* Copyright (C) 1992, Bernard Kwok                                   */
  9. /* All rights reserved.                                               */
  10. /* Revision 1.0                                                       */
  11. /* May, 1992                                                          */
  12. /**********************************************************************/
  13. #ifndef RAY_HH
  14. #define RAY_HH
  15.  
  16. #if IRS
  17. #define MIN_DISTANCE (5e-5)
  18. #define double float
  19. #else
  20. #define MIN_DISTANCE (1e-5)
  21. #endif
  22.  
  23. #define maxlevel 5;                 /* maximum ray tree depth         */
  24. #define minweight .01;              /* minimum ray weight             */
  25. #define rayeps 1e-7;                /* roundoff error tolerance       */
  26.  
  27. /* types of anti-aliasing */
  28. #define ADAPTIVE    1            /* adaptive sampling             */
  29. #define SUPER        2            /* super sampling                */
  30.  
  31. typedef struct {        /* Ray data                                   */
  32.   long    rayID;        /* for stats/etc                              */
  33.   Vector origin;    /* origin of ray                              */
  34.   Vector dir;        /* direction of ray (unit vector)             */
  35.   double visible;    /* visibility                                 */
  36.   int generation;    /* how many times ray has bounced around      */
  37.   int shadow;        /* set to TRUE if it is a shadow (form factor) ray */
  38.   Transmit *transmissivity;/* allow for absorption by air, materials  */
  39. } Ray;
  40.  
  41. typedef struct {        /* Ray intersection data                     */
  42.   Objectt *obj;        /* object that is visible                    */
  43.   Polygon *poly;        /* polygon that is visible                   */
  44.   Mesh *mesh;           /* mesh that is visible                      */
  45.   double distance;    /* the distance to the intersection          */
  46.   Vector intersect;    /* intersection point                        */
  47.   Vector texture;    /* texture coordinate                        */
  48.   Vector normal;    /* the surface normal at the intersection    */
  49. } HitData;
  50.  
  51. typedef struct {     /* Ray statistics                                */
  52.   long currentRayID; /* Current ray id                                */
  53.   long numRays;      /* Total number of rays shot                     */
  54.   long intRay;       /* Number of ray intersections                   */
  55.   long intRayID;     /* Number of ray intersections with grid         */
  56.   long rayCone;      /* Number of ray intersections with cones        */
  57.   long intCone;      /* Number of ray intersections with cones        */
  58.   long rayCube;      /* Number of ray intersections with cubes        */
  59.   long intCube;      /* Number of ray intersections with cubes        */
  60.   long raySphere;    /* Number of ray intersections with spheres      */
  61.   long intSphere;    /* Number of ray intersections with spheres      */
  62.   long rayCylinder;  /* Number of ray intersections with cylinders    */
  63.   long intCylinder;  /* Number of ray intersections with cylinders    */
  64.   long rayMesh;      /* Number of ray intersections with meshes       */
  65.   long rayPoly;      /* Number of ray tests with polygons             */
  66.   long intPoly;      /* Number of ray intersections with polygons     */
  67.   long rayBox;       /* Number of rays shot at bounding volumes       */
  68.   long intBox;       /* Number of rays hit bounding volumes           */
  69. } RayStats_Type;
  70.  
  71. /**********************************************************************/
  72. /* Prototypes                                                         */
  73. /**********************************************************************/
  74. extern int RayBox();                /* bounding box */
  75. extern int BoxEnter();
  76. extern int BoxNormal();
  77. extern void RayCube();              /* cube */
  78. extern RaySphere();                 /* sphere */
  79. extern void RayCylinder();          /* cyl */
  80. extern void RayCone();              /* cone */
  81. extern void get_uv();               
  82. extern int Inside_Polygon();
  83. extern BoundingBoxType BoxPoly();
  84. extern int RayPoly_Edge();
  85. extern int RayPlane();              /* plane */
  86. extern int RayPolygon();            /* poly */
  87. #ifndef RAY_HITC
  88. extern void Store_HitInter();       /* hits */
  89. extern void Reset_Hit();
  90. extern Store_HitNorm();
  91. #endif /* RAY_HITC */
  92.  
  93. #endif /* RAY_H */
  94.