| 9 |
|
|
| 10 |
|
#include "ray.h" |
| 11 |
|
#include "otypes.h" |
| 12 |
+ |
#include "otspecial.h" |
| 13 |
|
#include "rtotypes.h" |
| 14 |
|
#include "source.h" |
| 15 |
|
#include "random.h" |
| 41 |
|
static int maxcntr = 0; /* size of contribution arrays */ |
| 42 |
|
|
| 43 |
|
static int cntcmp(const void *p1, const void *p2); |
| 43 |
– |
|
| 44 |
– |
|
| 45 |
– |
OBJREC * /* find an object's actual material */ |
| 46 |
– |
findmaterial(OBJREC *o) |
| 47 |
– |
{ |
| 48 |
– |
while (!ismaterial(o->otype)) { |
| 49 |
– |
if (o->otype == MOD_ALIAS && o->oargs.nsargs) { |
| 50 |
– |
OBJECT aobj; |
| 51 |
– |
OBJREC *ao; |
| 52 |
– |
aobj = lastmod(objndx(o), o->oargs.sarg[0]); |
| 53 |
– |
if (aobj < 0) |
| 54 |
– |
objerror(o, USER, "bad reference"); |
| 55 |
– |
/* recursive check on alias branch */ |
| 56 |
– |
if ((ao = findmaterial(objptr(aobj))) != NULL) |
| 57 |
– |
return(ao); |
| 58 |
– |
} |
| 59 |
– |
if (o->omod == OVOID) |
| 60 |
– |
return(NULL); |
| 61 |
– |
o = objptr(o->omod); |
| 62 |
– |
} |
| 63 |
– |
return(o); /* mixtures will return NULL */ |
| 64 |
– |
} |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
void |