| 1 |
greg |
2.1 |
/* Copyright (c) 1993 Regents of the University of California */ |
| 2 |
|
|
|
| 3 |
|
|
#ifndef lint |
| 4 |
|
|
static char SCCSid[] = "$SunId$ LBL"; |
| 5 |
|
|
#endif |
| 6 |
|
|
|
| 7 |
|
|
/* |
| 8 |
|
|
* Preload associated object structures to maximize memory sharing. |
| 9 |
|
|
*/ |
| 10 |
|
|
|
| 11 |
|
|
#include "standard.h" |
| 12 |
|
|
#include "object.h" |
| 13 |
|
|
#include "otypes.h" |
| 14 |
|
|
#include "face.h" |
| 15 |
|
|
#include "cone.h" |
| 16 |
greg |
2.2 |
#include "instance.h" |
| 17 |
greg |
2.1 |
|
| 18 |
|
|
|
| 19 |
|
|
int |
| 20 |
|
|
load_os(op) /* load associated data for object */ |
| 21 |
|
|
register OBJREC *op; |
| 22 |
|
|
{ |
| 23 |
|
|
switch (op->otype) { |
| 24 |
|
|
case OBJ_FACE: /* polygon */ |
| 25 |
|
|
getface(op); |
| 26 |
|
|
return(1); |
| 27 |
|
|
case OBJ_CONE: /* cone */ |
| 28 |
|
|
case OBJ_RING: /* disk */ |
| 29 |
|
|
case OBJ_CYLINDER: /* cylinder */ |
| 30 |
|
|
case OBJ_CUP: /* inverted cone */ |
| 31 |
|
|
case OBJ_TUBE: /* inverted cylinder */ |
| 32 |
|
|
getcone(op, 1); |
| 33 |
|
|
return(1); |
| 34 |
|
|
case OBJ_INSTANCE: /* octree instance */ |
| 35 |
|
|
getinstance(op, IO_ALL); |
| 36 |
|
|
return(1); |
| 37 |
|
|
} |
| 38 |
greg |
2.2 |
/* don't bother with non-surfaces -- too tricky */ |
| 39 |
|
|
return(0); |
| 40 |
greg |
2.1 |
} |
| 41 |
|
|
|
| 42 |
|
|
|
| 43 |
|
|
preload_objs() /* preload object data structures */ |
| 44 |
|
|
{ |
| 45 |
|
|
register OBJECT on; |
| 46 |
greg |
2.3 |
/* note that nobjects may change during loop */ |
| 47 |
greg |
2.1 |
for (on = 0; on < nobjects; on++) |
| 48 |
|
|
load_os(objptr(on)); |
| 49 |
greg |
2.3 |
} |
| 50 |
|
|
|
| 51 |
|
|
|
| 52 |
|
|
clean_slate() /* reset time and ray counters */ |
| 53 |
|
|
{ |
| 54 |
|
|
extern long tstart, time(); |
| 55 |
|
|
extern long raynum, nrays; |
| 56 |
|
|
register OBJECT on; |
| 57 |
|
|
|
| 58 |
|
|
tstart = time(0); |
| 59 |
|
|
raynum = nrays = 0; |
| 60 |
|
|
for (on = 0; on < nobjects; on++) |
| 61 |
|
|
objptr(on)->lastrno = -1; |
| 62 |
greg |
2.1 |
} |