| 6 |
|
*/ |
| 7 |
|
#ifndef _RAD_SOURCE_H_ |
| 8 |
|
#define _RAD_SOURCE_H_ |
| 9 |
+ |
|
| 10 |
+ |
#include <string.h> |
| 11 |
+ |
|
| 12 |
|
#ifdef __cplusplus |
| 13 |
|
extern "C" { |
| 14 |
|
#endif |
| 15 |
|
|
| 16 |
< |
#include <string.h> |
| 14 |
< |
|
| 16 |
> |
#ifndef AIMREQT |
| 17 |
|
#define AIMREQT 100 /* required aim success/failure */ |
| 18 |
+ |
#endif |
| 19 |
+ |
#ifndef SHADCACHE |
| 20 |
+ |
#define SHADCACHE 20 /* shadow cache resolution */ |
| 21 |
+ |
#endif |
| 22 |
|
|
| 23 |
|
#define SDISTANT 01 /* source distant flag */ |
| 24 |
|
#define SSKIP 02 /* source skip flag */ |
| 36 |
|
} SPOT; /* spotlight */ |
| 37 |
|
|
| 38 |
|
typedef struct { |
| 39 |
+ |
union { |
| 40 |
+ |
struct { |
| 41 |
+ |
FVECT u, v; /* unit vectors */ |
| 42 |
+ |
} f; /* flat source indexing */ |
| 43 |
+ |
struct { |
| 44 |
+ |
FVECT o; /* origin position */ |
| 45 |
+ |
RREAL e1, e2; /* 1/extent */ |
| 46 |
+ |
int ax; /* major direction */ |
| 47 |
+ |
} d; /* distant source indexing */ |
| 48 |
+ |
} p; /* indexing parameters */ |
| 49 |
+ |
OBJECT obs[1]; /* cache obstructors (extends struct) */ |
| 50 |
+ |
} OBSCACHE; /* obstructor cache */ |
| 51 |
+ |
|
| 52 |
+ |
typedef struct { |
| 53 |
|
int sflags; /* source flags */ |
| 54 |
|
FVECT sloc; /* direction or position of source */ |
| 55 |
|
FVECT ss[3]; /* source dimension vectors, U, V, and W */ |
| 56 |
|
float srad; /* maximum source radius */ |
| 57 |
|
float ss2; /* solid angle or projected area */ |
| 58 |
+ |
OBJREC *so; /* source destination object */ |
| 59 |
|
struct { |
| 60 |
|
float prox; /* proximity */ |
| 61 |
|
SPOT *s; /* spot */ |
| 69 |
|
} sa; /* source aiming information */ |
| 70 |
|
unsigned long |
| 71 |
|
ntests, nhits; /* shadow tests and hits */ |
| 72 |
< |
OBJREC *so; /* source destination object */ |
| 72 |
> |
#ifdef SHADCACHE |
| 73 |
> |
OBSCACHE *obscache; /* obstructor cache */ |
| 74 |
> |
#endif |
| 75 |
|
} SRCREC; /* light source */ |
| 76 |
|
|
| 77 |
|
#define MAXSPART 64 /* maximum partitions per source */ |
| 142 |
|
#define setsource(s,o) (*sfun[(o)->otype].of->setsrc)(s,o) |
| 143 |
|
|
| 144 |
|
/* defined in source.c */ |
| 145 |
+ |
extern OBJREC *findmaterial(OBJREC *o); |
| 146 |
|
extern void marksources(void); |
| 147 |
|
extern void freesources(void); |
| 148 |
|
extern int srcray(RAY *sr, RAY *r, SRCINDEX *si); |
| 149 |
|
extern void srcvalue(RAY *r); |
| 150 |
|
extern int sourcehit(RAY *r); |
| 151 |
< |
extern void direct(RAY *r, void (*f)(), char *p); |
| 151 |
> |
typedef void srcdirf_t(COLOR cv, void *np, FVECT ldir, double omega); |
| 152 |
> |
extern void direct(RAY *r, srcdirf_t *f, void *p); |
| 153 |
|
extern void srcscatter(RAY *r); |
| 154 |
|
extern int m_light(OBJREC *m, RAY *r); |
| 155 |
+ |
extern void srcblocker(RAY *r); |
| 156 |
+ |
extern int srcblocked(RAY *r); |
| 157 |
+ |
extern void freeobscache(SRCREC *s); |
| 158 |
|
/* defined in srcsamp.c */ |
| 159 |
|
extern double nextssamp(RAY *r, SRCINDEX *si); |
| 160 |
|
extern int skipparts(int ct[3], int sz[3], int pp[2], unsigned char *pt); |