ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhd_sample.h
Revision: 3.6
Committed: Mon Jun 7 13:23:48 1999 UTC (24 years, 10 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Changes since 3.5: +20 -8 lines
Log Message:
miscellaneous changes

File Contents

# User Rev Content
1 gwlarson 3.1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2    
3     /* SCCSid "$SunId$ SGI" */
4    
5     /*
6     * Sample data structures for holodeck display drivers.
7     */
8     #include "color.h"
9     #include "tonemap.h"
10     #include "rhdriver.h"
11    
12     #ifndef int2
13     #define int2 short
14     #endif
15     #ifndef int4
16     #define int4 int
17     #endif
18 gwlarson 3.3
19     #ifndef INVALID
20     #define INVALID -1
21     #endif
22    
23 gwlarson 3.6
24 gwlarson 3.3 typedef struct samp {
25 gwlarson 3.1 float (*wp)[3]; /* world intersection point array */
26     int4 *wd; /* world direction array */
27 gwlarson 3.3 #ifndef HP_VERSION
28 gwlarson 3.1 TMbright *brt; /* encoded brightness array */
29 gwlarson 3.3 #endif
30 gwlarson 3.1 BYTE (*chr)[3]; /* encoded chrominance array */
31     BYTE (*rgb)[3]; /* tone-mapped color array */
32 gwlarson 3.6 int *info; /* Extra sample info */
33     int *info1; /* Extra sample info */
34 gwlarson 3.1 int max_samp; /* maximum number of samples */
35 gwlarson 3.3 int max_base_pt; /* maximum number of aux points */
36     int next_base_pt; /* next auxilliary point to add */
37     int replace_samp; /* next sample to free */
38     int num_samp; /* current number of samples */
39     int tone_map; /* pointer to next value(s)t tonemap*/
40 gwlarson 3.6 int free_samp; /* free sample-not available yet */
41 gwlarson 3.1 char *base; /* base of allocated memory */
42 gwlarson 3.3 } SAMP;
43 gwlarson 3.1
44 gwlarson 3.3 /* Sample field access macros */
45     #define S_W_PT(s) ((s)->wp)
46     #define S_W_DIR(s) ((s)->wd)
47     #define S_BRT(s) ((s)->brt)
48     #define S_CHR(s) ((s)->chr)
49     #define S_RGB(s) ((s)->rgb)
50 gwlarson 3.6 #define S_INFO(s) ((s)->info)
51     #define S_INFO1(s) ((s)->info1)
52 gwlarson 3.3 #define S_MAX_SAMP(s) ((s)->max_samp)
53     #define S_MAX_BASE_PT(s) ((s)->max_base_pt)
54     #define S_NEXT_BASE_PT(s) ((s)->next_base_pt)
55     #define S_REPLACE_SAMP(s) ((s)->replace_samp)
56     #define S_NUM_SAMP(s) ((s)->num_samp)
57     #define S_TONE_MAP(s) ((s)->tone_map)
58 gwlarson 3.6 #define S_FREE_SAMP(s) ((s)->free_samp)
59 gwlarson 3.3 #define S_BASE(s) ((s)->base)
60 gwlarson 3.1
61 gwlarson 3.3 #define S_MAX_POINTS(s) ((s)->max_base_pt)
62     #define S_NTH_W_PT(s,n) (S_W_PT(s)[(n)])
63     #define S_NTH_W_DIR(s,n) (S_W_DIR(s)[(n)])
64     #define S_NTH_RGB(s,n) (S_RGB(s)[(n)])
65     #define S_NTH_CHR(s,n) (S_CHR(s)[(n)])
66 gwlarson 3.6 #define S_NTH_INFO(s,n) (S_INFO(s)[(n)])
67     #define S_NTH_INFO1(s,n) (S_INFO1(s)[(n)])
68 gwlarson 3.3 #define S_NTH_BRT(s,n) (S_BRT(s)[(n)])
69 gwlarson 3.6
70 gwlarson 3.3 /* Sample Flag macros */
71     #define S_IS_FLAG(s) IS_FLAG(samp_flag,s)
72     #define S_SET_FLAG(s) SET_FLAG(samp_flag,s)
73     #define S_CLR_FLAG(s) CLR_FLAG(samp_flag,s)
74 gwlarson 3.1
75 gwlarson 3.4 #define S_NTH_NEXT(s,n) S_NTH_W_DIR(s,n)
76 gwlarson 3.6 #define sUnalloc_samp(s,n) (S_NTH_NEXT(s,n)=S_FREE_SAMP(s),S_FREE_SAMP(s)=n)
77 gwlarson 3.3 #define sClear_base_points(s) (S_NEXT_BASE_PT(s) = S_MAX_SAMP(s))
78     #define sClear(s) sInit(s)
79 gwlarson 3.6 /* MAXDIFF2 Max allowed cos angle squared of sample dir from current view */
80     /* In terms of cos: if angle is 30: MAXDIFF2 = cos(30)^2, if difference
81     is greater than this point not accepted on rebuild
82     */
83     #define MAXDIFF2 0.75
84     /* Max difference in direction for points at infinity: if over 45degrees
85     not accepted on rebuild cos(45)
86     */
87     #define MAXDIR 0.70710678
88 gwlarson 3.5 #define MAXQUALITY 10000 /* Maximum quality for rendering rep */
89 gwlarson 3.1
90 gwlarson 3.3 extern SAMP rsL;
91     extern double sDepthEps; /* epsilon to compare depths (z fraction) */
92     extern int4 encodedir(); /* Encodes FVECT direction */
93     extern void decodedir(); /* Decodes dir-> FVECT */
94     extern double fdir2diff(), dir2diff(); /* Compare dir and FVECT */
95     extern int4 *samp_flag; /* Per/sample flags s */
96    
97 gwlarson 3.1 /* These values are set by the driver, and used in the OGL call for glFrustum*/
98     extern double dev_zmin,dev_zmax;
99 gwlarson 3.3
100     extern SAMP *sAlloc();
101 gwlarson 3.1
102    
103    
104    
105    
106    
107