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

Comparing ray/src/hd/sm_ogl.c (file contents):
Revision 3.6 by gwlarson, Mon Sep 14 10:33:47 1998 UTC vs.
Revision 3.7 by gwlarson, Wed Sep 16 18:16:29 1998 UTC

# Line 45 | Line 45 | static int     qt_hsiz = 0;            /* quadtree cache size */
45  
46  
47   int
48 < mark_active_tris(qtptr,arg)
48 > mark_active_tris(qtptr,fptr,arg1,arg2)
49   QUADTREE *qtptr;
50 < int *arg;
50 > int *fptr,arg1,*arg2;
51   {
52    QUADTREE qt = *qtptr;
53    OBJECT *os,*optr;
# Line 55 | Line 55 | int *arg;
55  
56    if (!QT_IS_LEAF(qt))
57      return(TRUE);
58 +  
59 +  if(!QT_FLAG_FILL_TRI(*fptr))
60 +     (*fptr)++;
61    /* For each triangle in the set, set the which flag*/
62    os = qtqueryset(qt);
63  
# Line 71 | Line 74 | int *arg;
74    return(TRUE);
75   }
76  
77 + int
78 + mark_active_interior(qtptr,q0,q1,q2,t0,t1,t2,n,arg1,arg2,arg3)
79 + QUADTREE *qtptr;
80 + FVECT q0,q1,q2;
81 + FVECT t0,t1,t2;
82 + int n;
83 + int *arg1,arg2,*arg3;
84 + {
85 +  QUADTREE qt = *qtptr;
86 +  OBJECT *os,*optr;
87 +  register int i,t_id;
88 +
89 +  if (!QT_IS_LEAF(qt))
90 +    return(TRUE);
91 +  /* For each triangle in the set, set the which flag*/
92 +  os = qtqueryset(qt);
93 +
94 +  for (i = QT_SET_CNT(os), optr = QT_SET_PTR(os); i > 0; i--)
95 +  {
96 +    t_id = QT_SET_NEXT_ELEM(optr);
97 +    /* Set the render flag */
98 +    if(SM_IS_NTH_T_BASE(smMesh,t_id))
99 +        continue;
100 +    SM_SET_NTH_T_ACTIVE(smMesh,t_id);
101 +    /* NOTE:Also set the LRU clock bit: MAY WANT TO CHANGE: */      
102 +    SM_SET_NTH_T_LRU(smMesh,t_id);
103 +  }
104 +  return(TRUE);
105 + }
106 +
107   mark_tris_in_frustum(view)
108   VIEW *view;
109   {
# Line 97 | Line 130 | VIEW *view;
130         Also set the triangles LRU clock counter
131         */
132      /* Near face triangles */
133 <    smLocator_apply_func(smMesh,nr[0],nr[2],nr[3],mark_active_tris,NULL);
134 <    smLocator_apply_func(smMesh,nr[2],nr[0],nr[1],mark_active_tris,NULL);
133 >    smLocator_apply_func(smMesh,nr[0],nr[2],nr[3],mark_active_tris,
134 >                         mark_active_interior,NULL,NULL);
135 >    smLocator_apply_func(smMesh,nr[2],nr[0],nr[1],mark_active_tris,
136 >                         mark_active_interior,NULL,NULL);
137      /* Right face triangles */
138 <    smLocator_apply_func(smMesh,nr[0],far[3],far[0],mark_active_tris,NULL);
139 <    smLocator_apply_func(smMesh,far[3],nr[0],nr[3],mark_active_tris,NULL);
138 >    smLocator_apply_func(smMesh,nr[0],far[3],far[0],mark_active_tris,
139 >                         mark_active_interior,NULL,NULL);
140 >    smLocator_apply_func(smMesh,far[3],nr[0],nr[3],mark_active_tris,
141 >                         mark_active_interior,NULL,NULL);
142      /* Left face triangles */
143 <    smLocator_apply_func(smMesh,nr[1],far[2],nr[2],mark_active_tris,NULL);
144 <    smLocator_apply_func(smMesh,far[2],nr[1],far[1],mark_active_tris,NULL);
143 >    smLocator_apply_func(smMesh,nr[1],far[2],nr[2],mark_active_tris,
144 >                         mark_active_interior,NULL,NULL);
145 >    smLocator_apply_func(smMesh,far[2],nr[1],far[1],mark_active_tris,
146 >                         mark_active_interior,NULL,NULL);
147      /* Top face triangles */
148 <    smLocator_apply_func(smMesh,nr[0],far[0],nr[1],mark_active_tris,NULL);
149 <    smLocator_apply_func(smMesh,nr[1],far[0],far[1],mark_active_tris,NULL);
148 >    smLocator_apply_func(smMesh,nr[0],far[0],nr[1],mark_active_tris,
149 >                         mark_active_interior,NULL,NULL);
150 >    smLocator_apply_func(smMesh,nr[1],far[0],far[1],mark_active_tris,
151 >                         mark_active_interior,NULL,NULL);
152      /* Bottom face triangles */
153 <    smLocator_apply_func(smMesh,nr[3],nr[2],far[3],mark_active_tris,NULL);
154 <    smLocator_apply_func(smMesh,nr[2],far[2],far[3],mark_active_tris,NULL);
153 >    smLocator_apply_func(smMesh,nr[3],nr[2],far[3],mark_active_tris,
154 >                         mark_active_interior,NULL,NULL);
155 >    smLocator_apply_func(smMesh,nr[2],far[2],far[3],mark_active_tris,
156 >                         mark_active_interior,NULL,NULL);
157      /* Far face triangles */
158 <    smLocator_apply_func(smMesh,far[0],far[2],far[1],mark_active_tris,NULL);
159 <    smLocator_apply_func(smMesh,far[2],far[0],far[3],mark_active_tris,NULL);
160 <
158 >    smLocator_apply_func(smMesh,far[0],far[2],far[1],mark_active_tris,
159 >                         mark_active_interior,NULL,NULL);
160 >    
161 >    smLocator_apply_func(smMesh,far[2],far[0],far[3],mark_active_tris,
162 >                         mark_active_interior,NULL,NULL);
163   #ifdef TEST_DRIVER
164      VCOPY(FrustumFar[0],far[0]);
165      VCOPY(FrustumFar[1],far[1]);
# Line 233 | Line 278 | int lvl;
278    FVECT a,b,c;
279    register QT_LUENT *le;
280    QTRAVG *rc[4];
281 +  TRI *tri;
282    
283    if (QT_IS_EMPTY(qt))                          /* empty leaf node */
284      return(NULL);
# Line 274 | Line 320 | int lvl;
320        os = qtqueryset(qt);
321        for (n = os[0]; n; n--)
322        {
323 <        qtTri_from_id(os[n],a,b,c,NULL,NULL,NULL,&s0,&s1,&s2);
323 >        tri = SM_NTH_TRI(sm,os[n]);
324 >        s0 = T_NTH_V(tri,0);
325 >        s1 = T_NTH_V(tri,1);
326 >        s2 = T_NTH_V(tri,2);
327 >        VCOPY(a,SM_NTH_WV(sm,s0));
328 >        VCOPY(b,SM_NTH_WV(sm,s1));
329 >        VCOPY(c,SM_NTH_WV(sm,s2));            
330          distsum += SM_BG_SAMPLE(sm,s0) ? dev_zmax
331                                  : sqrt(dist2(a,SM_VIEW_CENTER(sm)));
332          distsum += SM_BG_SAMPLE(sm,s1) ? dev_zmax

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines