ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhd_odraw.h
Revision: 3.8
Committed: Tue Mar 4 05:49:21 2003 UTC (21 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 3.7: +1 -3 lines
Log Message:
Moved dircode.c and fixed prototype compiles in hd directory

File Contents

# User Rev Content
1 greg 3.8 /* RCSid $Id$ */
2 gwlarson 3.1 /*
3     * Header for OpenGL cone drawing routines with depth buffer checks.
4     */
5    
6     #include "color.h"
7     #include "tonemap.h"
8     #include "rhdriver.h"
9    
10     #ifndef int4
11     #define int4 int
12     #endif
13    
14     extern struct ODview {
15 gwlarson 3.4 int sfirst, snext; /* first sample and first in next view */
16 gwlarson 3.1 short hhi, vhi; /* screen image resolution */
17     short hlow, vlow; /* block resolution */
18 gwlarson 3.6 int n2redraw; /* approx. number of samples needing redraw */
19 gwlarson 3.1 struct ODblock {
20     short nsamp; /* number of samples in block */
21     short nused; /* number actually allocated */
22     int first; /* first sample in this block */
23     int free; /* index for block free list */
24 gwlarson 3.2 float pthresh; /* proximity threshold */
25 gwlarson 3.1 } *bmap; /* low resolution image map */
26     int4 *emap; /* low resolution edge presence map */
27 gwlarson 3.3 int4 *pmap; /* high resolution presence map */
28 gwlarson 3.1 GLfloat *dmap; /* high resolution depth map */
29     } *odView; /* our view list */
30    
31     extern int odNViews; /* number of views in our list */
32    
33     extern struct ODsamp {
34     union ODfunion {
35     float prox; /* viewpoint proximity */
36     int4 next; /* next in free list */
37    
38     } *f; /* free list next or proximity */
39     short (*ip)[2]; /* image position array */
40     TMbright *brt; /* encoded brightness array */
41     BYTE (*chr)[3]; /* encoded chrominance array */
42     BYTE (*rgb)[3]; /* tone-mapped color array */
43     int4 *redraw; /* redraw flags */
44     int nsamp; /* total number of samples */
45     char *base; /* base of allocated memory */
46     } odS; /* sample values */
47    
48     #ifndef FL4OP
49     #define FL4OP(f,i,op) ((f)[(i)>>5] op (1L<<((i)&0x1f)))
50     #define CHK4(f,i) FL4OP(f,i,&)
51     #define SET4(f,i) FL4OP(f,i,|=)
52     #define CLR4(f,i) FL4OP(f,i,&=~)
53     #define TGL4(f,i) FL4OP(f,i,^=)
54     #define FL4NELS(n) (((n)+0x1f)>>5)
55     #define CLR4ALL(f,n) bzero((char *)(f),FL4NELS(n)*sizeof(int4))
56     #endif
57    
58     #define OMAXDEPTH 32000 /* maximum depth value */
59    
60     #define nextfree(i) f[i].next /* free pointers */
61     #define closeness(i) f[i].prox /* viewpoint proximity */
62     #define ENDFREE (-1) /* free list terminator */
63    
64     #define odClean() odInit(odS.nsamp) /* clear samples */
65     #define odDone() odInit(0) /* free samples */
66    
67    
68     /*****************************************************************************
69     * Interface routines:
70    
71    
72     int
73     odInit(nsamps) : allocate and initialize memory
74     int nsamps; : number of samples to make available
75    
76     If nsamps is zero, then this becomes a deallocation routine. If nsamps
77     is the same as last time, then this merely clears all data. The dev_auxview()
78     function may be called to determine the current view(s). The odAlloc()
79     function returns the number of samples actually allocated.
80    
81    
82     void
83     odSample(c, d, p) : register new sample value
84     COLR c; : pixel color (RGBE)
85     FVECT d; : ray direction vector
86     FVECT p; : world intersection point
87    
88     If p is NULL, then the point is at infinity.
89    
90    
91     void
92     odDepthMap(vn, dm) : set depth map for the given view
93     int vn; : view number
94     GLfloat *dm; : depth map
95    
96     Assign the depth map associated with view number vn. The map has
97     been preallocated, and won't be freed until it is no longer needed
98     (after an odAlloc() call). All depth values are the projected
99     distance along the view direction from the view origin. If dm
100     is NULL, then there is no depth map associated with this view.
101    
102    
103     void
104     odRedraw(vn, x0, y0, x1, y1) : region needs to be redrawn
105     int vn; : view number
106     int x0, y0, x1, y1; : rectangle to redraw
107    
108     This call indicates that the given rectangular region in view vn
109     needs to be redrawn in the next call to odUpdate().
110    
111    
112     void
113 gwlarson 3.5 odRedrawAll() : everything needs to be redrawn
114    
115     Redraw everything in all views on the next call to odUpdate().
116     Unless odRemap() is called, no new tone mapping will be done.
117    
118    
119     void
120 gwlarson 3.1 odUpdate(vn) : update the current view
121     int vn; : view number
122    
123     Draw all new and undrawn sample values since last call for this view.
124    
125    
126     void
127 gwlarson 3.2 odRemap(newhist) : recompute tone mapping
128     int newhist; : flag whether to clear history
129 gwlarson 3.1
130     Recompute the tone mapping for all the samples in all the views
131 gwlarson 3.2 and redraw them on the next call(s) to odUpdate(). If newhist
132     is non-zero, then clear the previous sample history.
133 gwlarson 3.1
134     **********************************************************************/