ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhd_odraw.h
Revision: 3.1
Committed: Fri Dec 18 11:55:19 1998 UTC (25 years, 4 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

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