15 |
|
#ifndef int4 |
16 |
|
#define int4 int |
17 |
|
#endif |
18 |
< |
/* child ordering */ |
19 |
< |
typedef struct rsamp { |
18 |
> |
|
19 |
> |
#ifndef INVALID |
20 |
> |
#define INVALID -1 |
21 |
> |
#endif |
22 |
> |
|
23 |
> |
typedef struct samp { |
24 |
|
float (*wp)[3]; /* world intersection point array */ |
25 |
|
int4 *wd; /* world direction array */ |
26 |
+ |
#ifndef HP_VERSION |
27 |
|
TMbright *brt; /* encoded brightness array */ |
28 |
+ |
#endif |
29 |
|
BYTE (*chr)[3]; /* encoded chrominance array */ |
30 |
|
BYTE (*rgb)[3]; /* tone-mapped color array */ |
31 |
|
int max_samp; /* maximum number of samples */ |
32 |
< |
int max_aux_pt; /* maximum number of aux points */ |
33 |
< |
int next_aux_pt; /* next auxilliary point to add */ |
34 |
< |
int replace_samp; /* next sample to free */ |
35 |
< |
int num_samp; /* reached end of list? */ |
36 |
< |
int tone_map; /* pointer to next value(s) to tonemap*/ |
37 |
< |
int free_samp; /* list of freed samples */ |
32 |
> |
int max_base_pt; /* maximum number of aux points */ |
33 |
> |
int next_base_pt; /* next auxilliary point to add */ |
34 |
> |
int replace_samp; /* next sample to free */ |
35 |
> |
int num_samp; /* current number of samples */ |
36 |
> |
int tone_map; /* pointer to next value(s)t tonemap*/ |
37 |
> |
int free_samp; /* Available sample */ |
38 |
|
char *base; /* base of allocated memory */ |
39 |
< |
} RSAMP; |
39 |
> |
} SAMP; |
40 |
|
|
41 |
< |
#define RS_W_PT(s) ((s)->wp) |
42 |
< |
#define RS_W_DIR(s) ((s)->wd) |
43 |
< |
#define RS_BRT(s) ((s)->brt) |
44 |
< |
#define RS_CHR(s) ((s)->chr) |
45 |
< |
#define RS_RGB(s) ((s)->rgb) |
46 |
< |
#define RS_MAX_SAMP(s) ((s)->max_samp) |
47 |
< |
#define RS_TONE_MAP(s) ((s)->tone_map) |
48 |
< |
#define RS_MAX_POINTS(s) ((s)->max_aux_pt) |
49 |
< |
#define RS_REPLACE_SAMP(s) ((s)->replace_samp) |
50 |
< |
#define RS_NEXT_AUX_PT(s) ((s)->next_aux_pt) |
51 |
< |
#define RS_MAX_AUX_PT(s) ((s)->max_aux_pt) |
52 |
< |
#define RS_BASE(s) ((s)->base) |
53 |
< |
#define RS_NUM_SAMP(s) ((s)->num_samp) |
54 |
< |
#define RS_FREE_SAMP(s) ((s)->free_samp) |
49 |
< |
#define RS_NTH_W_PT(s,n) (RS_W_PT(s)[(n)]) |
50 |
< |
#define RS_NTH_W_DIR(s,n) (RS_W_DIR(s)[(n)]) |
51 |
< |
#define RS_NTH_RGB(s,n) (RS_RGB(s)[(n)]) |
52 |
< |
#define RS_NTH_CHR(s,n) (RS_CHR(s)[(n)]) |
53 |
< |
#define RS_NTH_BRT(s,n) (RS_BRT(s)[(n)]) |
54 |
< |
#define RS_EOL(s) (RS_NUM_SAMP(s) >= RS_MAX_SAMP(s)) |
55 |
< |
extern RSAMP rsL; |
41 |
> |
/* Sample field access macros */ |
42 |
> |
#define S_W_PT(s) ((s)->wp) |
43 |
> |
#define S_W_DIR(s) ((s)->wd) |
44 |
> |
#define S_BRT(s) ((s)->brt) |
45 |
> |
#define S_CHR(s) ((s)->chr) |
46 |
> |
#define S_RGB(s) ((s)->rgb) |
47 |
> |
#define S_MAX_SAMP(s) ((s)->max_samp) |
48 |
> |
#define S_MAX_BASE_PT(s) ((s)->max_base_pt) |
49 |
> |
#define S_NEXT_BASE_PT(s) ((s)->next_base_pt) |
50 |
> |
#define S_REPLACE_SAMP(s) ((s)->replace_samp) |
51 |
> |
#define S_NUM_SAMP(s) ((s)->num_samp) |
52 |
> |
#define S_TONE_MAP(s) ((s)->tone_map) |
53 |
> |
#define S_FREE_SAMP(s) ((s)->free_samp) |
54 |
> |
#define S_BASE(s) ((s)->base) |
55 |
|
|
56 |
< |
extern double rsDepthEps; /* epsilon to compare depths (z fraction) */ |
56 |
> |
#define S_MAX_POINTS(s) ((s)->max_base_pt) |
57 |
> |
#define S_NTH_W_PT(s,n) (S_W_PT(s)[(n)]) |
58 |
> |
#define S_NTH_W_DIR(s,n) (S_W_DIR(s)[(n)]) |
59 |
> |
#define S_NTH_RGB(s,n) (S_RGB(s)[(n)]) |
60 |
> |
#define S_NTH_CHR(s,n) (S_CHR(s)[(n)]) |
61 |
> |
#ifndef HP_VERSION |
62 |
> |
#define S_NTH_BRT(s,n) (S_BRT(s)[(n)]) |
63 |
> |
#endif |
64 |
> |
/* Sample Flag macros */ |
65 |
> |
#define S_IS_FLAG(s) IS_FLAG(samp_flag,s) |
66 |
> |
#define S_SET_FLAG(s) SET_FLAG(samp_flag,s) |
67 |
> |
#define S_CLR_FLAG(s) CLR_FLAG(samp_flag,s) |
68 |
|
|
69 |
< |
extern int4 encodedir(); |
70 |
< |
extern double fdir2diff(), dir2diff(); |
71 |
< |
extern void decodedir(); |
72 |
< |
/* |
73 |
< |
* int |
74 |
< |
* smInit(n) : Initialize/clear data structures for n entries |
75 |
< |
* int n; |
76 |
< |
* |
67 |
< |
* Initialize sampL and other data structures for at least n samples. |
68 |
< |
* If n is 0, then free data structures. Return number actually allocated. |
69 |
< |
* |
70 |
< |
* |
71 |
< |
* int |
72 |
< |
* smNewSamp(c, p, v) : register new sample point and return index |
73 |
< |
* COLR c; : pixel color (RGBE) |
74 |
< |
* FVECT p; : world intersection point |
75 |
< |
* FVECT v; : ray direction vector |
76 |
< |
* |
77 |
< |
* Add new sample point to data structures, removing old values as necessary. |
78 |
< |
* New sample representation will be output in next call to smUpdate(). |
79 |
< |
* |
80 |
< |
* |
81 |
< |
* int |
82 |
< |
* smFindSamp(orig, dir): intersect ray with 3D rep. and find closest sample |
83 |
< |
* FVECT orig, dir; |
84 |
< |
* |
85 |
< |
* Find the closest sample to the given ray. Return -1 on failure. |
86 |
< |
* |
87 |
< |
* |
88 |
< |
* smClean() : display has been wiped clean |
89 |
< |
* |
90 |
< |
* Called after display has been effectively cleared, meaning that all |
91 |
< |
* geometry must be resent down the pipeline in the next call to smUpdate(). |
92 |
< |
* |
93 |
< |
* |
94 |
< |
* smUpdate(vp, qua) : update OpenGL output geometry for view vp |
95 |
< |
* VIEW *vp; : desired view |
96 |
< |
* int qua; : quality level (percentage on linear time scale) |
97 |
< |
* |
98 |
< |
* Draw new geometric representation using OpenGL calls. Assume that the |
99 |
< |
* view has already been set up and the correct frame buffer has been |
100 |
< |
* selected for drawing. The quality level is on a linear scale, where 100% |
101 |
< |
* is full (final) quality. It is not necessary to redraw geometry that has |
102 |
< |
* been output since the last call to smClean(). |
103 |
< |
*/ |
69 |
> |
#define S_NTH_NEXT(s,n) S_NTH_W_DIR(s,n) |
70 |
> |
#define sUnalloc_samp(s,n) (S_NTH_NEXT(s,n) = S_FREE_SAMP(s),S_FREE_SAMP(s)=n) |
71 |
> |
#define sClear_base_points(s) (S_NEXT_BASE_PT(s) = S_MAX_SAMP(s)) |
72 |
> |
#define sClear(s) sInit(s) |
73 |
> |
/* Max allowed angle of sample dir from current view */ |
74 |
> |
#define MAXANG 20 |
75 |
> |
#define MAXDIFF2 ( MAXANG*MAXANG * (PI*PI/180./180.)) |
76 |
> |
#define MAXQUALITY 10000 /* Maximum quality for rendering rep */ |
77 |
|
|
78 |
+ |
extern SAMP rsL; |
79 |
+ |
extern double sDepthEps; /* epsilon to compare depths (z fraction) */ |
80 |
+ |
extern int4 encodedir(); /* Encodes FVECT direction */ |
81 |
+ |
extern void decodedir(); /* Decodes dir-> FVECT */ |
82 |
+ |
extern double fdir2diff(), dir2diff(); /* Compare dir and FVECT */ |
83 |
+ |
extern int4 *samp_flag; /* Per/sample flags s */ |
84 |
+ |
|
85 |
|
/* These values are set by the driver, and used in the OGL call for glFrustum*/ |
86 |
|
extern double dev_zmin,dev_zmax; |
87 |
+ |
|
88 |
+ |
extern SAMP *sAlloc(); |
89 |
|
|
90 |
|
|
91 |
|
|