| 1 |
< |
/* Copyright (c) 1997 Silicon Graphics, Inc. */ |
| 1 |
> |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
| 2 |
|
|
| 3 |
|
/* SCCSid "$SunId$ SGI" */ |
| 4 |
|
|
| 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 */ |
| 11 |
> |
|
| 12 |
|
#define DL 0 /* down left */ |
| 13 |
|
#define DR 1 /* down right */ |
| 14 |
|
#define UL 2 /* up left */ |
| 15 |
|
#define UR 3 /* up right */ |
| 16 |
|
|
| 17 |
< |
#define BRF(i) (1<<(i)) /* branch flag bit */ |
| 18 |
< |
#define CHF(i) (0x10<<(i)) /* change flag bit */ |
| 19 |
< |
#define CHBRF(i) (0x11<<(i)) /* changed branch flags */ |
| 20 |
< |
#define CH_ANY 0xf0 /* flags for any change */ |
| 17 |
> |
#define BRF(i) (0x1<<(i)) /* branch flag bit */ |
| 18 |
> |
#define LFF(i) (0x10<<(i)) /* leaf flag bit */ |
| 19 |
> |
#define CHF(i) (0x100<<(i)) /* change flag bit */ |
| 20 |
> |
#define CHBRF(i) (0x101<<(i)) /* changed branch bit */ |
| 21 |
> |
#define CHLFF(i) (0x110<<(i)) /* changed leaf bit */ |
| 22 |
> |
#define BR_ANY 0xf /* flags for any branches */ |
| 23 |
> |
#define LF_ANY 0xf0 /* flags for any leaves */ |
| 24 |
> |
#define CH_ANY 0xf00 /* 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 |
– |
|
| 26 |
|
typedef struct rtree { |
| 27 |
< |
short flgs; /* branch flags */ |
| 27 |
> |
short flgs; /* content flags (defined above) */ |
| 28 |
|
union { |
| 29 |
|
struct rtree *b; /* if branch */ |
| 30 |
< |
RLEAF *l; /* if leaf */ |
| 30 |
> |
int li; /* if leaf */ |
| 31 |
|
} k[4]; /* children */ |
| 32 |
|
} RTREE; |
| 33 |
|
|
| 34 |
+ |
extern struct rleaves { |
| 35 |
+ |
float (*wp)[3]; /* world intersection point array */ |
| 36 |
+ |
int4 *wd; /* world direction array */ |
| 37 |
+ |
TMbright *brt; /* encoded brightness array */ |
| 38 |
+ |
BYTE (*chr)[3]; /* encoded chrominance array */ |
| 39 |
+ |
BYTE (*rgb)[3]; /* tone-mapped color array */ |
| 40 |
+ |
int nl; /* count of leaves in our pile */ |
| 41 |
+ |
int bl, tl; /* bottom and top (next) leaf index */ |
| 42 |
+ |
int tml; /* next leaf needing tone-mapping */ |
| 43 |
+ |
char *base; /* base of allocated memory */ |
| 44 |
+ |
} qtL; /* our pile of leaves */ |
| 45 |
+ |
|
| 46 |
+ |
#define is_stump(t) (!((t)->flgs & (BR_ANY|LF_ANY))) |
| 47 |
+ |
|
| 48 |
|
extern RTREE qtrunk; /* trunk of quadtree */ |
| 49 |
|
extern double qtDepthEps; /* epsilon to compare depths (z fraction) */ |
| 50 |
|
extern int qtMinNodesiz; /* minimum node dimension (pixels) */ |
| 51 |
|
|
| 52 |
< |
extern RLEAF *qtFindLeaf(); |
| 52 |
> |
extern int rayqleft; /* number of rays to queue before flush */ |
| 53 |
|
|
| 54 |
< |
|
| 55 |
< |
/************************************************************************ |
| 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 |
< |
************************************************************************/ |
| 54 |
> |
extern int4 encodedir(); |
| 55 |
> |
extern double fdir2diff(), dir2diff(); |