--- ray/src/hd/holo.h 1997/10/31 10:23:29 3.1 +++ ray/src/hd/holo.h 1997/12/18 14:45:59 3.9 @@ -45,7 +45,7 @@ typedef struct { typedef struct { short w; /* wall number */ short i[2]; /* index on wall grid */ -} BCOORD[2]; /* beam grid coordinates */ +} GCOORD; /* grid coordinates (two for beam) */ typedef struct { unsigned int4 nrd; /* number of beam rays bundled on disk */ @@ -57,7 +57,7 @@ typedef struct { unsigned long tick; /* clock tick for LRU replacement */ } BEAM; /* followed by nrm RAYVAL's */ -#define hdbray(bp) (RAYVAL *)((bp)+1) +#define hdbray(bp) ((RAYVAL *)((bp)+1)) #define hdbsiz(nr) (sizeof(BEAM)+(nr)*sizeof(RAYVAL)) typedef struct { @@ -74,30 +74,37 @@ typedef struct holo { short dirty; /* beam index needs update to file */ double tlin; /* linear range for depth encoding */ FVECT wn[3]; /* wall normals (derived) */ + double wg[3]; /* wall grid multipliers (derived) */ double wo[6]; /* wall offsets (derived) */ - FVECT gv[3][2]; /* grid coordinate vectors (derived) */ int wi[6]; /* wall super-indices (derived) */ char *priv; /* pointer to private client data */ BEAM **bl; /* beam pointers (memory cache) */ BEAMI bi[1]; /* beam index (extends struct) */ } HOLO; /* holodeck section */ +typedef struct { + HOLO *h; /* pointer to holodeck */ + int b; /* beam index */ +} HDBEAMI; /* holodeck beam index */ + #define nbeams(hp) (2*((hp)->wi[5]-1)) #define biglob(hp) ((hp)->bi) #define blglob(hp) (*(hp)->bl) #define bnrays(hp,i) ((hp)->bl[i]!=NULL ? (hp)->bl[i]->nrm : (hp)->bi[i].nrd) -#define hdflush(hp) (hdfreebeam(hp,0) && hdsync(hp)) +#define hdflush(hp) (hdfreebeam(hp,0) && hdsync(hp,0)) +#define hdclobber(hp) (hdkillbeam(hp,0) && hdsync(hp,0)) -extern HOLO *hdinit(); +extern HOLO *hdinit(), *hdalloc(); extern BEAM *hdgetbeam(); extern RAYVAL *hdnewrays(); -extern long hdmemuse(), hdfiluse(); +extern unsigned hdmemuse(); +extern long hdfiluse(), hdfilen(); extern double hdray(), hdinter(); extern unsigned hdcode(); -extern int hdcachesize; /* target cache size (bytes) */ +extern unsigned hdcachesize; /* target cache size (bytes) */ extern unsigned long hdclock; /* holodeck system clock */ extern HOLO *hdlist[HDMAX+1]; /* holodeck pointers (NULL term.) */ @@ -117,8 +124,8 @@ extern float hd_depthmap[]; /* depth conversion map * * blank line, with "FORMAT=Holodeck" somewhere in it. * The first integer after the information header is the * above magic number, which includes the file format version number. - * The first longword after the magic number is the position - * of the SECOND holodeck section, or 0 if there is only one. + * The first longword after the magic number is a pointer to the pointer + * just before the SECOND holodeck section, or 0 if there is only one. * This longword is immediately followed by the first holodeck * section header and directory. * Similarly, every holodeck section in the file is preceeded by