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 |
|
|
#define BRF(i) (1<<(i)) /* branch flag bit */ |
22 |
|
|
#define CHF(i) (0x10<<(i)) /* change flag bit */ |
23 |
|
|
#define CHBRF(i) (0x11<<(i)) /* changed branch flags */ |
24 |
|
|
#define CH_ANY 0xf0 /* flags for any change */ |
25 |
|
|
|
26 |
|
|
typedef struct { |
27 |
|
|
float wp[3]; /* world intersection point */ |
28 |
|
|
TMbright brt; /* encoded brightness (LogY) */ |
29 |
|
|
BYTE chr[3]; /* encoded chrominance (RGB) */ |
30 |
|
|
} RLEAF; /* recorded ray (leaf) value */ |
31 |
|
|
|
32 |
|
|
typedef struct rtree { |
33 |
|
|
short flgs; /* branch flags */ |
34 |
|
|
union { |
35 |
|
|
struct rtree *b; /* if branch */ |
36 |
|
|
RLEAF *l; /* if leaf */ |
37 |
|
|
} k[4]; /* children */ |
38 |
|
|
} RTREE; |
39 |
|
|
|
40 |
|
|
extern RTREE qtrunk; /* trunk of quadtree */ |
41 |
|
|
extern double qtDepthEps; /* epsilon to compare depths (z fraction) */ |
42 |
|
|
extern int qtMinNodesiz; /* minimum node dimension (pixels) */ |
43 |
|
|
|
44 |
gregl |
3.2 |
extern RLEAF *qtFindLeaf(); |
45 |
|
|
|
46 |
gregl |
3.1 |
|
47 |
|
|
/************************************************************************ |
48 |
|
|
* These driver support routines implement the dev_value() call, but |
49 |
|
|
* require the following callbacks: |
50 |
|
|
|
51 |
|
|
dev_paintr(rgb, x0, y0, x1, y1) : paint a rectangle |
52 |
|
|
BYTE rgb[3]; : rectangle color |
53 |
|
|
int x0, y0, x1, y1; : rectangle boundaries |
54 |
|
|
|
55 |
|
|
Draws an open rectangle between [x0,x1) and [y0,y1) with the color rgb. |
56 |
|
|
This function is called many times by qtUpdate(), qtRedraw() and qtReplant(). |
57 |
|
|
|
58 |
|
|
************************************************************************/ |