ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/holo.h
(Generate patch)

Comparing ray/src/hd/holo.h (file contents):
Revision 3.5 by gregl, Tue Nov 11 16:59:34 1997 UTC vs.
Revision 3.20 by greg, Sat Feb 22 02:07:24 2003 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1997 Silicon Graphics, Inc. */
2 <
3 < /* SCCSid "$SunId$ SGI" */
4 <
1 > /* RCSid: $Id$ */
2   /*
3   * Header file for holodeck programs
4   *
# Line 14 | Line 11
11   #ifndef HDMAX
12   #define HDMAX           128     /* maximum active holodeck sections */
13   #endif
14 < #ifndef int2
15 < #define int2    short
14 >
15 > #ifndef MAXDIRSE
16 > #define MAXDIRSE        32      /* maximum seeks per directory write */
17   #endif
20 #ifndef int4
21 #define int4    long
22 #endif
18  
19   #define DCINF   (unsigned)((1L<<16)-1)  /* special value for infinity */
20   #define DCLIN   (unsigned)(1L<<11)      /* linear depth limit */
21  
22   typedef struct {
23          BYTE    r[2][2];        /* ray direction index */
24 <        COLR    v;              /* value */
25 <        unsigned int2   d;      /* depth code */
26 < } RAYVAL;               /* ray value (from second wall) */
24 >        COLR    v;              /* color value */
25 >        unsigned int2   d;      /* depth code (from entry wall) */
26 > } RAYVAL;               /* ray value */
27  
28   /*
29   * Walls are ordered:           X0      X1      X2      WN
# Line 71 | Line 66 | typedef struct holo {
66          FVECT   xv[3];          /* side vectors (second) */
67          int2    grid[3];        /* grid resolution (third) */
68          int     fd;             /* file descriptor */
69 <        short   dirty;          /* beam index needs update to file */
69 >        struct {
70 >                int     s, n;           /* dirty section start, length */
71 >        } dirseg[MAXDIRSE+1];   /* dirty beam index segments */
72 >        short   dirty;          /* number of dirty segments */
73          double  tlin;           /* linear range for depth encoding */
74 <        FVECT   wn[3];          /* wall normals (derived) */
77 <        double  wg[3];          /* wall grid multipliers (derived) */
78 <        double  wo[6];          /* wall offsets (derived) */
74 >        FVECT   wg[3];          /* wall grid vectors (derived) */
75          int     wi[6];          /* wall super-indices (derived) */
76          char    *priv;          /* pointer to private client data */
77          BEAM    **bl;           /* beam pointers (memory cache) */
78          BEAMI   bi[1];          /* beam index (extends struct) */
79   } HOLO;                 /* holodeck section */
80  
81 < #define nbeams(hp)      (2*((hp)->wi[5]-1))
81 > typedef struct {
82 >        HOLO    *h;             /* pointer to holodeck */
83 >        int     b;              /* beam index */
84 > } HDBEAMI;              /* holodeck beam index */
85 >
86 > #define nbeams(hp)      (((hp)->wi[5]-1)<<1)
87   #define biglob(hp)      ((hp)->bi)
88   #define blglob(hp)      (*(hp)->bl)
89  
90   #define bnrays(hp,i)    ((hp)->bl[i]!=NULL ? (hp)->bl[i]->nrm : (hp)->bi[i].nrd)
91  
92 < #define hdflush(hp)     (hdfreebeam(hp,0) && hdsync(hp))
92 > #define hdflush(hp)     (hdfreebeam(hp,0), hdsync(hp,0))
93 > #define hdclobber(hp)   (hdkillbeam(hp,0), hdsync(hp,0))
94  
95   extern HOLO     *hdinit(), *hdalloc();
96   extern BEAM     *hdgetbeam();
97   extern RAYVAL   *hdnewrays();
98 < extern long     hdmemuse(), hdfiluse();
98 > extern unsigned hdmemuse();
99 > extern long     hdfiluse(), hdfilen(), hdallocfrag();
100   extern double   hdray(), hdinter();
101   extern unsigned hdcode();
102 + extern int      hdfilord();
103  
104 < extern int      hdcachesize;            /* target cache size (bytes) */
104 > #define FF_NEVER        0               /* never free fragments */
105 > #define FF_WRITE        01              /* free fragment on write */
106 > #define FF_ALLOC        02              /* free fragment on ray alloc */
107 > #define FF_READ         04              /* free fragment on read */
108 > #define FF_KILL         010             /* free fragment on beam kill */
109 >
110 > extern int      hdfragflags;            /* tells when to free fragments */
111 > extern unsigned hdcachesize;            /* target cache size (bytes) */
112   extern unsigned long    hdclock;        /* holodeck system clock */
113   extern HOLO     *hdlist[HDMAX+1];       /* holodeck pointers (NULL term.) */
114  
115   extern float    hd_depthmap[];          /* depth conversion map */
116  
117 + extern int      hdwg0[6];               /* wall grid 0 index */
118 + extern int      hdwg1[6];               /* wall grid 1 index */
119 +
120   #define hddepth(hp,dc)  ( (dc) >= DCINF ? FHUGE : \
121                                  (hp)->tlin * ( (dc) >= DCLIN ? \
122                                          hd_depthmap[(dc)-DCLIN] : \
# Line 110 | Line 124 | extern float   hd_depthmap[];          /* depth conversion map *
124  
125   #define HOLOFMT         "Holodeck"      /* file format identifier */
126   #define HOLOVERS        0               /* file format version number */
127 < #define HOLOMAGIC       (327+HOLOVERS)  /* file magic number */
127 > #define HOLOMAGIC       (323+sizeof(long)+8*HOLOVERS)   /* file magic number */
128  
129   /*
130   * A holodeck file consists of an information header terminated by a
131   * blank line, with "FORMAT=Holodeck" somewhere in it.
132   * The first integer after the information header is the
133   * above magic number, which includes the file format version number.
134 < * The first longword after the magic number is the position
135 < * of the SECOND holodeck section, or 0 if there is only one.
134 > * The first longword after the magic number is a pointer to the pointer
135 > * just before the SECOND holodeck section, or 0 if there is only one.
136   * This longword is immediately followed by the first holodeck
137   * section header and directory.
138   * Similarly, every holodeck section in the file is preceeded by

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines