ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhd_odraw.h
Revision: 3.6
Committed: Mon Dec 28 19:32:29 1998 UTC (25 years, 3 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 3.5: +1 -0 lines
Log Message:
changed to dissolve when redrawing large numbers of samples

File Contents

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