| 1 | greg | 1.1 | /* Copyright (c) 1986 Regents of the University of California */ | 
| 2 |  |  |  | 
| 3 |  |  | /* SCCSid "$SunId$ LBL" */ | 
| 4 |  |  |  | 
| 5 |  |  | /* | 
| 6 |  |  | *  ray.h - header file for routines using rays. | 
| 7 |  |  | * | 
| 8 |  |  | *     8/7/85 | 
| 9 |  |  | */ | 
| 10 |  |  |  | 
| 11 |  |  | #include  "standard.h" | 
| 12 |  |  |  | 
| 13 |  |  | #include  "object.h" | 
| 14 |  |  |  | 
| 15 |  |  | #include  "color.h" | 
| 16 |  |  |  | 
| 17 |  |  | /* ray type flags */ | 
| 18 |  |  | #define  PRIMARY        01              /* original ray */ | 
| 19 |  |  | #define  SHADOW         02              /* ray to light source */ | 
| 20 |  |  | #define  REFLECTED      04              /* reflected ray */ | 
| 21 |  |  | #define  REFRACTED      010             /* refracted (bent) ray */ | 
| 22 |  |  | #define  TRANS          020             /* transmitted/transferred ray */ | 
| 23 |  |  | #define  AMBIENT        040             /* ray scattered for interreflection */ | 
| 24 |  |  |  | 
| 25 |  |  | /* reflected ray types */ | 
| 26 |  |  | #define  RAYREFL        (SHADOW|REFLECTED|AMBIENT) | 
| 27 |  |  |  | 
| 28 |  |  | typedef struct ray { | 
| 29 |  |  | long  rno;              /* unique ray number */ | 
| 30 |  |  | int  rlvl;              /* number of reflections for this ray */ | 
| 31 |  |  | float  rweight;         /* cumulative weight of this ray */ | 
| 32 |  |  | short  rtype;           /* ray type */ | 
| 33 |  |  | short  crtype;          /* cumulative ray type */ | 
| 34 |  |  | struct ray  *parent;    /* ray this originated from */ | 
| 35 |  |  | FVECT  rorg;            /* origin of ray */ | 
| 36 |  |  | FVECT  rdir;            /* normalized direction of ray */ | 
| 37 |  |  | int  rsrc;              /* source we're aiming for */ | 
| 38 |  |  | OBJECT  *clipset;       /* set of objects currently clipped */ | 
| 39 |  |  | OBJECT  *newcset;       /* next clipset, used for transmission */ | 
| 40 |  |  | OBJREC  *ro;            /* intersected object */ | 
| 41 |  |  | double  rot;            /* distance to object */ | 
| 42 |  |  | FVECT  rop;             /* intersection point */ | 
| 43 |  |  | FVECT  ron;             /* intersection surface normal */ | 
| 44 |  |  | double  rod;            /* -DOT(rdir, ron) */ | 
| 45 | greg | 1.2 | double  rofx[4][4];     /* transform from object space */ | 
| 46 |  |  | double  rofs;           /* scaling factor from object */ | 
| 47 |  |  | double  robx[4][4];     /* transform back to object space */ | 
| 48 |  |  | double  robs;           /* back scaling factor */ | 
| 49 | greg | 1.1 | FVECT  pert;            /* surface normal perturbation */ | 
| 50 |  |  | COLOR  pcol;            /* pattern color */ | 
| 51 |  |  | COLOR  rcol;            /* returned ray value */ | 
| 52 | greg | 1.3 | double  rt;             /* returned effective ray length */ | 
| 53 | greg | 1.1 | }  RAY; | 
| 54 |  |  |  | 
| 55 |  |  | extern double  raynormal(); |