ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhd_qtree.h
Revision: 3.3
Committed: Fri Nov 21 13:35:58 1997 UTC (26 years, 5 months ago) by gregl
Content type: text/plain
Branch: MAIN
Changes since 3.2: +21 -14 lines
Log Message:
changed definition of global leaf pile to make tone mapping work better

File Contents

# User Rev Content
1 gregl 3.1 /* Copyright (c) 1997 Silicon Graphics, Inc. */
2    
3     /* SCCSid "$SunId$ SGI" */
4    
5     /*
6     * Quadtree data structures for holodeck display drivers.
7     */
8    
9     #include "tonemap.h"
10     #include "rhdriver.h"
11     /* quantity of leaves to free at a time */
12     #ifndef LFREEPCT
13     #define LFREEPCT 15
14     #endif
15     /* child ordering */
16     #define DL 0 /* down left */
17     #define DR 1 /* down right */
18     #define UL 2 /* up left */
19     #define UR 3 /* up right */
20    
21 gregl 3.3 #define BRF(i) (0x1<<(i)) /* branch flag bit */
22     #define LFF(i) (0x10<<(i)) /* leaf flag bit */
23     #define CHF(i) (0x100<<(i)) /* change flag bit */
24     #define CHBRF(i) (0x101<<(i)) /* changed branch bit */
25     #define CHLFF(i) (0x110<<(i)) /* changed leaf bit */
26     #define BR_ANY 0xf /* flags for any branches */
27     #define LF_ANY 0xf0 /* flags for any leaves */
28     #define CH_ANY 0xf00 /* flags for any change */
29 gregl 3.1
30     typedef struct rtree {
31 gregl 3.3 short flgs; /* content flags (defined above) */
32 gregl 3.1 union {
33     struct rtree *b; /* if branch */
34 gregl 3.3 int li; /* if leaf */
35 gregl 3.1 } k[4]; /* children */
36     } RTREE;
37    
38 gregl 3.3 extern struct rleaves {
39     float (*wp)[3]; /* world intersection point array */
40     TMbright *brt; /* encoded brightness array */
41     BYTE (*chr)[3]; /* encoded chrominance array */
42     BYTE (*rgb)[3]; /* tone-mapped color array */
43     int nl; /* count of leaves in our pile */
44     int bl, tl; /* bottom and top (next) leaf index */
45     int tml; /* next leaf needing tone-mapping */
46     char *base; /* base of allocated memory */
47     } qtL; /* our pile of leaves */
48    
49 gregl 3.1 extern RTREE qtrunk; /* trunk of quadtree */
50     extern double qtDepthEps; /* epsilon to compare depths (z fraction) */
51     extern int qtMinNodesiz; /* minimum node dimension (pixels) */
52 gregl 3.2
53 gregl 3.1
54     /************************************************************************
55     * These driver support routines implement the dev_value() call, but
56     * require the following callbacks:
57    
58     dev_paintr(rgb, x0, y0, x1, y1) : paint a rectangle
59     BYTE rgb[3]; : rectangle color
60     int x0, y0, x1, y1; : rectangle boundaries
61    
62     Draws an open rectangle between [x0,x1) and [y0,y1) with the color rgb.
63     This function is called many times by qtUpdate(), qtRedraw() and qtReplant().
64    
65     ************************************************************************/