--- ray/src/hd/holo.h 1997/12/11 11:47:57 3.6 +++ ray/src/hd/holo.h 1998/01/06 15:08:50 3.13 @@ -18,7 +18,7 @@ #define int2 short #endif #ifndef int4 -#define int4 long +#define int4 int #endif #define DCINF (unsigned)((1L<<16)-1) /* special value for infinity */ @@ -73,37 +73,45 @@ typedef struct holo { int fd; /* file descriptor */ 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 wg[3]; /* wall grid vectors (derived) */ + double wo[6]; /* wall grid offsets (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 hdclobber(hp) (hdkillbeam(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(), *hdalloc(); extern BEAM *hdgetbeam(); extern RAYVAL *hdnewrays(); -extern long hdmemuse(), hdfiluse(); +extern unsigned hdmemuse(); +extern long hdfiluse(), hdfilen(), hdallocfrag(); 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.) */ extern float hd_depthmap[]; /* depth conversion map */ +extern int hdwg0[6]; /* wall grid 0 index */ +extern int hdwg1[6]; /* wall grid 1 index */ + #define hddepth(hp,dc) ( (dc) >= DCINF ? FHUGE : \ (hp)->tlin * ( (dc) >= DCLIN ? \ hd_depthmap[(dc)-DCLIN] : \ @@ -111,7 +119,7 @@ extern float hd_depthmap[]; /* depth conversion map * #define HOLOFMT "Holodeck" /* file format identifier */ #define HOLOVERS 0 /* file format version number */ -#define HOLOMAGIC (327+HOLOVERS) /* file magic number */ +#define HOLOMAGIC (323+sizeof(long)+8*HOLOVERS) /* file magic number */ /* * A holodeck file consists of an information header terminated by a