| 11 |
|
|
| 12 |
|
#include "otspecial.h" |
| 13 |
|
|
| 14 |
+ |
#include "rtotypes.h" |
| 15 |
+ |
|
| 16 |
|
#include "source.h" |
| 17 |
|
|
| 18 |
< |
#define ABS(x) ((x)>0 ? (x) : -(x)) |
| 18 |
> |
#if SHADCACHE /* preemptive shadow checking */ |
| 19 |
|
|
| 20 |
+ |
#ifndef MAX2SHADE |
| 21 |
+ |
#define MAX2SHADE 200 /* limit # of sources to precheck */ |
| 22 |
+ |
#endif |
| 23 |
|
|
| 24 |
< |
#if SHADCACHE /* preemptive shadow checking */ |
| 24 |
> |
#define ABS(x) ((x)>0 ? (x) : -(x)) |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
OBJECT * antimodlist = NULL; /* set of clipped materials */ |
| 61 |
|
void /* initialize occlusion cache */ |
| 62 |
|
initobscache(int sn) |
| 63 |
|
{ |
| 64 |
< |
register SRCREC *srcp = &source[sn]; |
| 65 |
< |
int cachelen; |
| 66 |
< |
FVECT rorg, rdir; |
| 67 |
< |
RREAL d; |
| 68 |
< |
int i, j, k; |
| 69 |
< |
int ax, ax1, ax2; |
| 64 |
> |
SRCREC *srcp = &source[sn]; |
| 65 |
> |
int cachelen; |
| 66 |
> |
FVECT rorg, rdir; |
| 67 |
> |
RREAL d; |
| 68 |
> |
int i, j, k; |
| 69 |
> |
int ax=0, ax1=1, ax2=2; |
| 70 |
|
|
| 71 |
|
if (srcp->sflags & (SSKIP|SPROX|SSPOT|SVIRTUAL)) |
| 72 |
|
return; /* don't cache these */ |
| 114 |
|
/* clear cache */ |
| 115 |
|
for (i = cachelen; i--; ) |
| 116 |
|
srcp->obscache->obs[i] = OVOID; |
| 117 |
+ |
#if (MAX2SHADE >= 0) |
| 118 |
+ |
if (sn >= MAX2SHADE) /* limit on prechecking */ |
| 119 |
+ |
return; |
| 120 |
+ |
#endif |
| 121 |
|
/* cast shadow rays */ |
| 122 |
|
if (srcp->sflags & SDISTANT) { |
| 123 |
|
for (k = 3; k--; ) |
| 185 |
|
|
| 186 |
|
|
| 187 |
|
static OBJECT * /* return occluder cache entry */ |
| 188 |
< |
srcobstructp(register RAY *r) |
| 188 |
> |
srcobstructp(RAY *r) |
| 189 |
|
{ |
| 190 |
< |
static unsigned long lastrno = ~0; |
| 190 |
> |
static RNUMBER lastrno = ~0; |
| 191 |
|
static OBJECT noobs; |
| 192 |
|
static OBJECT *lastobjp; |
| 193 |
|
SRCREC *srcp; |
| 207 |
|
initobscache(r->rsrc); |
| 208 |
|
/* compute cache index */ |
| 209 |
|
if (srcp->sflags & SDISTANT) { |
| 210 |
< |
int ax, ax1, ax2; |
| 210 |
> |
int ax=0, ax1=1, ax2=2; |
| 211 |
|
double t; |
| 212 |
|
ax = srcp->obscache->p.d.ax; |
| 213 |
|
if ((ax1 = ax+1) >= 3) ax1 -= 3; |
| 295 |
|
|
| 296 |
|
|
| 297 |
|
int /* record a source blocker */ |
| 298 |
< |
srcblocker(register RAY *r) |
| 298 |
> |
srcblocker(RAY *r) |
| 299 |
|
{ |
| 300 |
|
OBJREC *m; |
| 301 |
|
|
| 342 |
|
{ |
| 343 |
|
OBJECT *set2add, *oldset; |
| 344 |
|
|
| 345 |
+ |
if (m == NULL) { /* starting over */ |
| 346 |
+ |
if (antimodlist != NULL) |
| 347 |
+ |
free((void *)antimodlist); |
| 348 |
+ |
antimodlist = NULL; |
| 349 |
+ |
return; |
| 350 |
+ |
} |
| 351 |
|
m_clip(m, NULL); /* initialize modifier list */ |
| 352 |
|
if ((set2add = (OBJECT *)m->os) == NULL || !set2add[0]) |
| 353 |
|
return; |