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

  1. /**********************************************************************/
  2. /* ff.h                                                               */
  3. /*                                                                    */
  4. /* Form factor data structures                                        */
  5. /*                                                                    */
  6. /* Copyright (C) 1992, Bernard Kwok                                   */
  7. /* All rights reserved.                                               */
  8. /* Revision 1.0                                                       */
  9. /* May, 1992                                                          */
  10. /**********************************************************************/
  11. /* Requires geo.h, struct.h */
  12.  
  13. #ifndef FF_H
  14. #define FF_H
  15.  
  16. #define NUMERICAL_FF 0       /* Use numerical ff approximation        */
  17. #define ANALYTIC_FF 1        /* Use analytic ff approximation         */
  18. #define ELLIPSE_FF 2         /* Use ellipse ff approx                 */
  19. #define DISC_FF 3            /* Use disc ff approx                    */
  20.  
  21. #define UNITEST -1           /* For testing only (not used)           */
  22. #define UNIFORM 0            /* Uniform sampling flag                 */
  23. #define JITTERED 1           /* Jitter sampling flag                  */
  24.  
  25. #define MAX_SAMPLES 64       /* Maximum number of samples per poly    */
  26. #define DEFAULT_SAMPLES 16   /* Default grid of samples for PR        */
  27. #define DEFAULT_LSAMPLES 1   /* Default grid of samples for linkage 
  28.                  forming */
  29. #define DEFAULT_ASAMPLES 4   /* Default # of positions to sample from 
  30.                 on receiver for analytic ff */
  31.  
  32. #define DEFAULT_F_max 0.05   /* maximum allowed ff per 2 patches      */
  33. #define DEFAULT_F_min 0.005  /* minimum allowed ff                    */
  34. #define DEFAULT_B_max 0.01   /* maximum allowed B                     */
  35. #define DEFAULT_B_min 0.001  /* minimum allowed B                     */
  36. #define MAX_F_DIFF_POLY 0.02 /* maximum allowed difference between ff
  37.                 of 2 patches before you have to 
  38.                 subdivide */
  39. #define MAX_PATCH_LEVELS 0    /* Number of levels to subdivide a 
  40.                  polygon into elements */
  41.  
  42. typedef struct {             /* Sample point for ray casting form-factor */
  43.   Polygon *p;                /* Polygon sample take from              */
  44.   Vector pos;                /* Sample position                       */
  45.   Vector norm;               /* Normal at position                    */
  46.   double area;               /* Area sample extends to                */
  47.   Vector corners[MAX_PATCH_VTX]; /* Corners of sample area            */
  48. } Sampletype;
  49.  
  50. typedef struct {
  51.   double B_min, B_max;       /* Min and max radiosity shot per interaction */
  52.   double F_min, F_max;       /* Min and max formfactor per interaction */
  53.   int sampling_type;         /* JITTERED or UNIFORM sampling          */
  54.   int num_samples;           /* Number of samples per source polygon  */
  55.   int fftype;                /* Form factor approximation type        */
  56.   double F_diff_poly;        /* Maximum allowed difference between 2 polys */
  57.   double F_diff_edge;        /* Maximum allowed difference between 2 edge
  58.                 vertices */
  59.   int max_levels;            /* Maximum number of levels to subdivide */
  60.   int sample_shape;          /* Sample shape circle or ellipse ff approx */
  61.   int varying_numsamps;      /* Vary # of source samples per rec. vtx */
  62.   int use_analytic;          /* Use analytic form-factors for special
  63.                 cases */
  64.   int src_rec_cull;          /* Cull to find objects between source and
  65.                 receiver patches */
  66.   int quadtri_ray;           /* Use ray-quad/triangle intersection 
  67.                 routine    versus ray-general polygon 
  68.                 intersection routine */
  69.   int shaft_cull;            /* Use shaft culling for ray visibility tests */
  70.   double min_element_area;   /* Minimum element area = fraction of area
  71.                 of the world. */
  72. } FF_OptionType;
  73.  
  74. typedef struct {             /* form-factor info                      */
  75.   double val;                /* ff value                              */
  76.   Polygon *patch_i,*patch_j; /* id of patches formfactor is between   */
  77. } FF_type;
  78.  
  79. /**********************************************************************/
  80. extern void UVToXYZ();
  81. extern int Init_Samples();
  82. extern int ff_Generate_Patch_Samples();
  83. extern double ff_da_analytic();
  84. extern double ff_da_disc();
  85. extern double ff_patches();
  86. extern int shoot_ray();
  87. extern void ff_print_samples();
  88. void ff_print_FF_Options();
  89.  
  90. #endif /* FF_H */
  91.