1 |
greg |
3.19 |
/* RCSid $Id: rhd_qtree.h,v 3.18 2005/01/07 20:33:02 greg Exp $ */ |
2 |
gregl |
3.1 |
/* |
3 |
|
|
* Quadtree data structures for holodeck display drivers. |
4 |
|
|
*/ |
5 |
schorsch |
3.16 |
#ifndef _RAD_RHD_QTREE_H_ |
6 |
|
|
#define _RAD_RHD_QTREE_H_ |
7 |
gregl |
3.1 |
|
8 |
gwlarson |
3.11 |
#include "color.h" |
9 |
gregl |
3.1 |
#include "tonemap.h" |
10 |
|
|
#include "rhdriver.h" |
11 |
gregl |
3.7 |
|
12 |
schorsch |
3.16 |
#ifdef __cplusplus |
13 |
|
|
extern "C" { |
14 |
|
|
#endif |
15 |
|
|
|
16 |
gregl |
3.1 |
#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 |
greg |
3.15 |
int32 *wd; /* world direction array */ |
41 |
gregl |
3.3 |
TMbright *brt; /* encoded brightness array */ |
42 |
greg |
3.19 |
uby8 (*chr)[3]; /* encoded chrominance array */ |
43 |
|
|
uby8 (*rgb)[3]; /* tone-mapped color array */ |
44 |
gregl |
3.3 |
int nl; /* count of leaves in our pile */ |
45 |
|
|
int bl, tl; /* bottom and top (next) leaf index */ |
46 |
|
|
int tml; /* next leaf needing tone-mapping */ |
47 |
|
|
char *base; /* base of allocated memory */ |
48 |
|
|
} qtL; /* our pile of leaves */ |
49 |
|
|
|
50 |
gregl |
3.5 |
#define is_stump(t) (!((t)->flgs & (BR_ANY|LF_ANY))) |
51 |
|
|
|
52 |
gregl |
3.1 |
extern RTREE qtrunk; /* trunk of quadtree */ |
53 |
|
|
extern double qtDepthEps; /* epsilon to compare depths (z fraction) */ |
54 |
|
|
extern int qtMinNodesiz; /* minimum node dimension (pixels) */ |
55 |
gregl |
3.8 |
|
56 |
gregl |
3.9 |
extern int rayqleft; /* number of rays to queue before flush */ |
57 |
|
|
|
58 |
greg |
3.18 |
extern TMstruct *tmGlobal; /* global tone-mapping structure */ |
59 |
|
|
|
60 |
schorsch |
3.17 |
/* |
61 |
greg |
3.15 |
extern int32 encodedir(); |
62 |
gregl |
3.8 |
extern double fdir2diff(), dir2diff(); |
63 |
schorsch |
3.17 |
*/ |
64 |
|
|
|
65 |
|
|
/* rhd_qtree.c */ |
66 |
|
|
extern int qtAllocLeaves(register int n); |
67 |
|
|
extern void qtFreeLeaves(void); |
68 |
|
|
extern int qtCompost(int pct); |
69 |
|
|
extern void qtReplant(void); |
70 |
|
|
extern int qtFindLeaf(int x, int y); |
71 |
|
|
extern int qtMapLeaves(int redo); |
72 |
|
|
/* rhd_qtree2c.c rhd_qtree2r.c */ |
73 |
|
|
extern void qtRedraw(int x0, int y0, int x1, int y1); |
74 |
|
|
extern void qtUpdate(void); |
75 |
schorsch |
3.16 |
|
76 |
|
|
#ifdef __cplusplus |
77 |
|
|
} |
78 |
|
|
#endif |
79 |
|
|
#endif /* _RAD_RHD_QTREE_H_ */ |
80 |
|
|
|