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

Comparing ray/src/hd/sm.h (file contents):
Revision 3.4 by gwlarson, Tue Oct 6 18:16:54 1998 UTC vs.
Revision 3.8 by gwlarson, Sun Jan 10 10:27:47 1999 UTC

# Line 10 | Line 10
10   #define _SM_H_
11  
12   #include "rhd_sample.h"
13 + #define NEWSETS
14  
15  
16   #ifndef TRUE
# Line 17 | Line 18
18   #define FALSE 0
19   #endif
20  
20 #define S_REPLACE_EPS 0.06
21 #define S_REPLACE_SCALE 10.0
21  
22 + #define ON_V 1
23 + #define ON_P 2
24 + #define ON_E 3
25 + #define IN_T 4
26 +
27 + #define S_REPLACE_EPS 0.04      /* if (distance on sphere between sample
28 +                                     and a base point) < S_REPLACE_EPS,
29 +                                     replace base:
30 +                                     */
31 + #define S_REPLACE_SCALE (5.*5.)   /* if (distance to new point squared) is
32 +                                     > (triangle edge length squared*
33 +                                     S_REPLACE_SCALE):for all edges/triangle
34 +                                     vertices: new point is puncture
35 +                                     point: dont add
36 +                                   */
37 + #define S_REPLACE_TRI 2e-8              /* .052 radians to the sixth power */
38 +
39   #define SQRT3_2 0.8660254
40  
41   #define SM_DEFAULT 0
42 < #define SM_EXTRA_POINTS 8
42 > #define SM_EXTRA_POINTS 162
43 > #define SM_BASE_TRIS 320
44   #define SM_EXTRA_VERTS  SM_EXTRA_POINTS
45  
46 < #define SM_INC_PERCENT 0.60
46 > #define SM_INC_PERCENT 0.60            /* If number of new triangles added
47 >                                          since last full redraw is >
48 >                                          (SM_INC_PERCENT * total triangles)
49 >                                          do full redraw instead of incremental
50 >                                          */
51 >
52   #define SM_VIEW_FRAC   0.1
53  
54  
# Line 64 | Line 86 | typedef struct _TRI {
86   #define T_WHICH_V(t,i)     \
87           (T_NTH_V(t,0)==(i)?0:T_NTH_V(t,1)==(i)?1:T_NTH_V(t,2)==(i)?2:-1)
88   #define T_NEXT_FREE(t) ((t)->nbrs[0])
89 + #define T_NEXT_AVAILABLE(t) ((t)->nbrs[0])
90   #define T_VALID_FLAG(t) ((t)->nbrs[1])
91   #define T_IS_VALID(t)  (T_VALID_FLAG(t)!=-1)
92 < #define T_FLAGS 3
92 > #define T_FLAGS 4
93  
94   typedef struct _SM {
95      FVECT view_center;    /* Canonical view center defining unit sphere */
# Line 76 | Line 99 | typedef struct _SM {
99      int num_tri;          /* Current number of triangles */
100      int sample_tris;      /* Current number of non-base triangles*/
101      int free_tris;        /* pointer to free_list */
102 +    int available_tris;   /* pointer to available_list */
103      int max_verts;        /* Maximum number of vertices in the mesh */
104      TRI *tris;            /* Pointer to list of triangle structs */
105      VERT *verts;          /* List of vertices */
# Line 87 | Line 111 | typedef struct _SM {
111   #define T_ACTIVE_FLAG   0
112   #define T_NEW_FLAG      1
113   #define T_BASE_FLAG     2
114 + #define T_BG_FLAG       3
115  
116   #define SM_VIEW_CENTER(m)             ((m)->view_center)
117   #define SM_SAMP(m)                    ((m)->samples)
# Line 95 | Line 120 | typedef struct _SM {
120   #define SM_NUM_TRI(m)                 ((m)->num_tri)
121   #define SM_SAMPLE_TRIS(m)                 ((m)->sample_tris)
122   #define SM_FREE_TRIS(m)               ((m)->free_tris)
123 + #define SM_AVAILABLE_TRIS(m)          ((m)->available_tris)
124   #define SM_MAX_VERTS(m)               ((m)->max_verts)
125   #define SM_TRIS(m)                    ((m)->tris)
126   #define SM_VERTS(m)                   ((m)->verts)
# Line 109 | Line 135 | typedef struct _SM {
135   #define SM_IS_NTH_T_ACTIVE(sm,n)     SM_IS_NTH_T_FLAG(sm,n,T_ACTIVE_FLAG)
136   #define SM_IS_NTH_T_BASE(sm,n)       SM_IS_NTH_T_FLAG(sm,n,T_BASE_FLAG)
137   #define SM_IS_NTH_T_NEW(sm,n)        SM_IS_NTH_T_FLAG(sm,n,T_NEW_FLAG)
138 + #define SM_IS_NTH_T_BG(sm,n)        SM_IS_NTH_T_FLAG(sm,n,T_BG_FLAG)
139  
140   #define SM_SET_NTH_T_ACTIVE(sm,n)    SM_SET_NTH_T_FLAG(sm,n,T_ACTIVE_FLAG)
141   #define SM_SET_NTH_T_BASE(sm,n)      SM_SET_NTH_T_FLAG(sm,n,T_BASE_FLAG)
142   #define SM_SET_NTH_T_NEW(sm,n)       SM_SET_NTH_T_FLAG(sm,n,T_NEW_FLAG)
143 + #define SM_SET_NTH_T_BG(sm,n)        SM_SET_NTH_T_FLAG(sm,n,T_BG_FLAG)
144  
145   #define SM_CLR_NTH_T_ACTIVE(sm,n)   SM_CLR_NTH_T_FLAG(sm,n,T_ACTIVE_FLAG)
146   #define SM_CLR_NTH_T_BASE(sm,n)     SM_CLR_NTH_T_FLAG(sm,n,T_BASE_FLAG)
147   #define SM_CLR_NTH_T_NEW(sm,n)      SM_CLR_NTH_T_FLAG(sm,n,T_NEW_FLAG)
148 + #define SM_CLR_NTH_T_BG(sm,n)       SM_CLR_NTH_T_FLAG(sm,n,T_BG_FLAG)
149  
150   #define SM_NTH_TRI(m,n)               (&(SM_TRIS(m)[(n)]))
151   #define SM_NTH_VERT(m,n)              (SM_VERTS(m)[(n)])
152 +
153 + #define SM_T_ID_VALID(s,t_id) T_IS_VALID(SM_NTH_TRI(s,t_id))
154  
155 +
156   #define SM_MAX_SAMP(m)                S_MAX_SAMP(SM_SAMP(m))
157   #define SM_MAX_POINTS(m)              S_MAX_POINTS(SM_SAMP(m))
158   #define SM_SAMP_BASE(m)               S_BASE(SM_SAMP(m))
159   #define SM_NTH_WV(m,i)                S_NTH_W_PT(SM_SAMP(m),i)
160   #define SM_NTH_W_DIR(m,i)             S_NTH_W_DIR(SM_SAMP(m),i)
161 < #define SM_DIR_ID(m,i)                (SM_NTH_W_DIR(m,i)==-1)
161 > #define SM_DIR_ID(m,i)            (!SM_BASE_ID(m,i) && SM_NTH_W_DIR(m,i)==-1)
162   #define SM_NTH_RGB(m,i)               S_NTH_RGB(SM_SAMP(m),i)
163   #define SM_RGB(m)                    S_RGB(SM_SAMP(m))
164 + #define SM_WP(m)                    S_W_PT(SM_SAMP(m))
165   #define SM_BRT(m)                     S_BRT(SM_SAMP(m))
166   #define SM_NTH_BRT(m,i)               S_NTH_BRT(SM_SAMP(m),i)
167   #define SM_CHR(m)                     S_CHR(SM_SAMP(m))
# Line 138 | Line 171 | typedef struct _SM {
171  
172   #define SM_ALLOWED_VIEW_CHANGE(m) (SM_NUM_SAMP(m)/smDist_sum*SM_VIEW_FRAC)
173  
141 #define SM_FOR_ALL_FLAGGED_TRIS(m,i,w,b) for(i=smNext_tri_flag_set(m,0,w,b); \
142 i < SM_NUM_TRI(m); i=smNext_tri_flag_set(m,i+1,w,b))
143
144 #define SM_FOR_ALL_ACTIVE_TRIS(m,i) SM_FOR_ALL_FLAGGED_TRIS(m,i,T_ACTIVE_FLAG,0)
145 #define SM_FOR_ALL_NEW_TRIS(m,i) SM_FOR_ALL_FLAGGED_TRIS(m,i,T_NEW_FLAG,0)
146 #define SM_FOR_ALL_BASE_TRIS(m,i) SM_FOR_ALL_FLAGGED_TRIS(m,i,T_BASE_FLAG,0)
147 #define SM_FOR_ALL_VALID_TRIS(m,i) for(i=smNext_valid_tri(m,0); \
148 i < SM_NUM_TRI(m); i=smNext_valid_tri(m,i+1))
149
150 #define SM_FOR_ALL_ACTIVE_FG_TRIS(m,i) SM_FOR_ALL_FLAGGED_TRIS(m,i,T_ACTIVE_FLAG,1)
151
152 #define SM_FOR_ALL_ACTIVE_BG_TRIS(m,i) SM_FOR_ALL_FLAGGED_TRIS(m,i,T_ACTIVE_FLAG,2)
153
154
174   #define SM_FOR_ALL_ADJACENT_TRIS(sm,id,t) for(t=smTri_next_ccw_nbr(sm,t,id); \
175   t!=SM_NTH_TRI(sm,SM_NTH_VERT(sm,id)); t=smTri_next_ccw_nbr(sm,t,id))
176  
# Line 187 | Line 206 | t!=SM_NTH_TRI(sm,SM_NTH_VERT(sm,id)); t=smTri_next_ccw
206  
207   #define smClear_vert(sm,id)    (SM_NTH_VERT(sm,id) = INVALID)
208  
190 #define SQRT3_INV 0.5773502692
191
192 typedef struct _T_DEPTH {
193  int tri;
194  double depth;
195 }T_DEPTH;
196
209   typedef struct _RT_ARGS_{
210    FVECT orig,dir;
211    int t_id;
# Line 217 | Line 229 | extern VIEW Current_View;
229   extern int Pick_tri,Picking,Pick_samp;
230   extern FVECT Pick_point[500],Pick_origin,Pick_dir;
231   extern FVECT Pick_v0[500],Pick_v1[500],Pick_v2[500];
232 + extern int Pick_q[500];
233   extern FVECT P0,P1,P2;
234   extern int Pick_cnt;
235   extern FVECT FrustumNear[4],FrustumFar[4];
# Line 266 | Line 279 | extern FVECT FrustumNear[4],FrustumFar[4];
279   * been output since the last call to smClean().  (The last view drawn will
280   * be vp==&odev.v each time.)
281   */
269
282   #endif
283  
284  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines