ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhd_sample.h
(Generate patch)

Comparing ray/src/hd/rhd_sample.h (file contents):
Revision 3.2 by gwlarson, Fri Sep 11 11:52:25 1998 UTC vs.
Revision 3.6 by gwlarson, Mon Jun 7 13:23:48 1999 UTC

# Line 15 | Line 15
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 >
24 > typedef struct samp {
25          float           (*wp)[3];       /* world intersection point array */
26          int4            *wd;            /* world direction array */
27 + #ifndef HP_VERSION
28          TMbright        *brt;           /* encoded brightness array */
29 + #endif
30          BYTE            (*chr)[3];      /* encoded chrominance array */
31          BYTE            (*rgb)[3];      /* tone-mapped color array */
32 +        int             *info;          /* Extra sample info */
33 +        int             *info1;          /* Extra sample info */
34          int             max_samp;       /* maximum number of samples */
35 <        int             max_aux_pt;     /* maximum number of aux points */
36 <        int             next_aux_pt;      /* next auxilliary point to add */
37 <        int             replace_samp;      /* next sample to free  */
38 <        int             num_samp;        /* reached end of list? */
39 <        int             tone_map;        /* pointer to next value(s) to tonemap*/
40 <        int             free_samp;       /* list of freed samples */
35 >        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 >        int             free_samp;      /* free sample-not available yet */
41          char            *base;          /* base of allocated memory */
42 < } RSAMP;
42 > } SAMP;
43  
44 < #define RS_W_PT(s)               ((s)->wp)
45 < #define RS_W_DIR(s)              ((s)->wd)
46 < #define RS_BRT(s)                ((s)->brt)
47 < #define RS_CHR(s)                ((s)->chr)
48 < #define RS_RGB(s)                ((s)->rgb)
49 < #define RS_MAX_SAMP(s)           ((s)->max_samp)
50 < #define RS_TONE_MAP(s)           ((s)->tone_map)
51 < #define RS_MAX_POINTS(s)         ((s)->max_aux_pt)
52 < #define RS_REPLACE_SAMP(s)       ((s)->replace_samp)
53 < #define RS_NEXT_AUX_PT(s)        ((s)->next_aux_pt)
54 < #define RS_MAX_AUX_PT(s)         ((s)->max_aux_pt)
55 < #define RS_BASE(s)               ((s)->base)
56 < #define RS_NUM_SAMP(s)           ((s)->num_samp)
57 < #define RS_FREE_SAMP(s)          ((s)->free_samp)
58 < #define RS_NTH_W_PT(s,n)         (RS_W_PT(s)[(n)])
59 < #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;                      
44 > /* 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 > #define S_INFO(s)               ((s)->info)
51 > #define S_INFO1(s)               ((s)->info1)
52 > #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 > #define S_FREE_SAMP(s)          ((s)->free_samp)
59 > #define S_BASE(s)               ((s)->base)
60  
61 < extern double   rsDepthEps;     /* epsilon to compare depths (z fraction) */
61 > #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 > #define S_NTH_INFO(s,n)         (S_INFO(s)[(n)])
67 > #define S_NTH_INFO1(s,n)         (S_INFO1(s)[(n)])
68 > #define S_NTH_BRT(s,n)          (S_BRT(s)[(n)])
69  
70 < extern int4     encodedir();
71 < extern double   fdir2diff(), dir2diff();
72 < extern void     decodedir();
73 < /*
63 < * int
64 < * smInit(n)            : Initialize/clear data structures for n entries
65 < * int  n;
66 < *
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().  (The last view drawn will
103 < * be vp==&odev.v each time.)
104 < */
70 > /* 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  
75 + #define S_NTH_NEXT(s,n)         S_NTH_W_DIR(s,n)
76 + #define sUnalloc_samp(s,n) (S_NTH_NEXT(s,n)=S_FREE_SAMP(s),S_FREE_SAMP(s)=n)
77 + #define sClear_base_points(s)  (S_NEXT_BASE_PT(s) = S_MAX_SAMP(s))
78 + #define sClear(s)      sInit(s)
79 + /* 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 + #define MAXQUALITY      10000   /* Maximum quality for rendering rep */
89 +
90 + 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   /* These values are set by the driver, and used in the OGL call for glFrustum*/
98   extern double dev_zmin,dev_zmax;
99 +
100 + extern SAMP *sAlloc();
101  
102  
103  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines