ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhd_odraw.h
Revision: 3.7
Committed: Sat Feb 22 02:07:24 2003 UTC (21 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 3.6: +1 -4 lines
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

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