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.8 by gwlarson, Tue Oct 6 18:16:54 1998 UTC vs.
Revision 3.9 by gwlarson, Wed Nov 11 12:05:39 1998 UTC

# Line 57 | Line 57 | int *fptr;
57    register int i,t_id;
58    TRI *tri;
59  
60
60    if(!QT_FLAG_FILL_TRI(*fptr))
61       (*fptr)++;
63
62    if(QT_IS_EMPTY(qt) || QT_LEAF_IS_FLAG(qt))
63      return;
64 +
65    /* For each triangle in the set, set the which flag*/
66    os = qtqueryset(qt);
67  
# Line 101 | Line 100 | VIEW *view;
100      qtClearAllFlags();
101      smClear_flags(smMesh,T_ACTIVE_FLAG);
102      /* Clear all of the active sample flags*/
103 <    sClear_all_flags(smMesh->samples);
103 >    sClear_all_flags(SM_SAMP(smMesh));
104  
105  
106      /* calculate the world space coordinates of the view frustum */
# Line 127 | Line 126 | VIEW *view;
126      
127      if(EQUAL_VEC3(view->vp,SM_VIEW_CENTER(smMesh)))
128      {/* Near face triangles */
129 <      smLocator_apply_func(smMesh,nr[3],nr[2],nr[0],mark_active_tris,
129 >
130 >      smLocator_apply_func(smMesh,nr[0],nr[2],nr[3],mark_active_tris,
131                           mark_active_interior,NULL);
132 <      smLocator_apply_func(smMesh,nr[1],nr[0],nr[2],mark_active_tris,
132 >      smLocator_apply_func(smMesh,nr[2],nr[0],nr[1],mark_active_tris,
133                           mark_active_interior,NULL);
134        return;
135      }
136  
137      /* Test the view against the planes: and swap orientation if inside:*/
138      tri_plane_equation(nr[0],nr[2],nr[3], &peq,FALSE);
139 <    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) > 0.0)
139 >    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) < 0.0)
140      {/* Near face triangles */
141        smLocator_apply_func(smMesh,nr[3],nr[2],nr[0],mark_active_tris,
142                             mark_active_interior,NULL);
# Line 151 | Line 151 | VIEW *view;
151                           mark_active_interior,NULL);
152      }
153      tri_plane_equation(nr[0],far[3],far[0], &peq,FALSE);
154 <    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) > 0.0)
154 >    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) < 0.0)
155      { /* Right face triangles */
156        smLocator_apply_func(smMesh,far[0],far[3],nr[0],mark_active_tris,
157                             mark_active_interior,NULL);
# Line 167 | Line 167 | VIEW *view;
167      }
168  
169      tri_plane_equation(nr[1],far[2],nr[2], &peq,FALSE);
170 <    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) > 0.0)
170 >    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) < 0.0)
171      { /* Left face triangles */
172        smLocator_apply_func(smMesh,nr[2],far[2],nr[1],mark_active_tris,
173                             mark_active_interior,NULL);
# Line 183 | Line 183 | VIEW *view;
183  
184      }
185      tri_plane_equation(nr[0],far[0],nr[1], &peq,FALSE);
186 <    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) > 0.0)
186 >    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) < 0.0)
187      {/* Top face triangles */
188        smLocator_apply_func(smMesh,nr[1],far[0],nr[0],mark_active_tris,
189                             mark_active_interior,NULL);
# Line 198 | Line 198 | VIEW *view;
198                             mark_active_interior,NULL);
199      }
200      tri_plane_equation(nr[3],nr[2],far[3], &peq,FALSE);
201 <    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) > 0.0)
201 >    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) < 0.0)
202      {/* Bottom face triangles */
203        smLocator_apply_func(smMesh,far[3],nr[2],nr[3],mark_active_tris,
204                             mark_active_interior,NULL);
# Line 213 | Line 213 | VIEW *view;
213                             mark_active_interior,NULL);
214      }
215       tri_plane_equation(far[2],far[0],far[1], &peq,FALSE);
216 <    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) > 0.0)
216 >    if(PT_ON_PLANE(SM_VIEW_CENTER(smMesh),peq) < 0.0)
217      {/* Far face triangles */
218        smLocator_apply_func(smMesh,far[0],far[2],far[1],mark_active_tris,
219                             mark_active_interior,NULL);
# Line 378 | Line 378 | int lvl;
378        os = qtqueryset(qt);
379        for (n = os[0]; n; n--)
380        {
381 +        if(SM_IS_NTH_T_BASE(sm,os[n]))
382 +           continue;
383          tri = SM_NTH_TRI(sm,os[n]);
384          if(!T_IS_VALID(tri))
385            continue;
386 <
386 >        
387          s0 = T_NTH_V(tri,0);
388          s1 = T_NTH_V(tri,1);
389          s2 = T_NTH_V(tri,2);
# Line 419 | Line 421 | int lvl;
421      VSUM(c,SM_VIEW_CENTER(sm),c,le->av.dist);
422                                          /* draw triangle */
423      glColor3ub(le->av.rgb[0],le->av.rgb[1],le->av.rgb[2]);
422    /* NOTE: Triangle vertex order may change */
423    glVertex3d(c[0],c[1],c[2]);
424    glVertex3d(b[0],b[1],b[2]);
424      glVertex3d(a[0],a[1],a[2]);
425 +    glVertex3d(b[0],b[1],b[2]);
426 +    glVertex3d(c[0],c[1],c[2]);
427 +
428    }
429    return(&le->av);
430   }
# Line 495 | Line 497 | int clr;
497  
498    tri = SM_NTH_TRI(sm,i);
499    if (clr) SM_CLR_NTH_T_NEW(sm,i);
500 <
499 <  /* NOTE:Triangles are defined clockwise:historical relative to spherical
500 <     tris: could change
501 <     */
502 <  for(j=2; j>= 0; j--)
500 >  for(j=0; j <= 2; j++)
501    {
502   #ifdef DEBUG
503      if(SM_BG_SAMPLE(sm,T_NTH_V(tri,j)))
# Line 550 | Line 548 | int clr;
548      rgb[0]/=cnt; rgb[1]/=cnt; rgb[2]/=cnt;
549      d /= (double)cnt;
550    }
551 <  for(j=2; j>= 0; j--)
551 >  for(j=0; j <= 2; j++)
552    {
553      if(SM_BG_SAMPLE(sm,ids[j]))
554      {
# Line 588 | Line 586 | int clr;
586    /* NOTE:Triangles are defined clockwise:historical relative to spherical
587       tris: could change
588       */
589 <  for(j=2; j>= 0; j--)
589 >  for(j=0; j <= 2; j++)
590    {
591        id = T_NTH_V(tri,j);
592        glColor3ub(SM_NTH_RGB(sm,id)[0],SM_NTH_RGB(sm,id)[1],
# Line 628 | Line 626 | int clr;
626    glBegin(GL_TRIANGLES);
627    SM_FOR_ALL_ACTIVE_FG_TRIS(sm,i)
628    {
631      if(SM_BG_TRI(sm,i))
632         continue;
629        if(!SM_MIXED_TRI(sm,i))
630          smRender_tri(sm,i,vp,clr);
631     else
# Line 651 | Line 647 | int i;
647  
648    tri = SM_NTH_TRI(sm,i);
649  
650 <  /* Triangles are defined clockwise:historical relative to spherical
655 <     tris: could change
656 <     */
657 <  for(j=2; j >=0; j--)
650 >  for(j=0; j <= 2; j++)
651    {
652      VCOPY(ptr,SM_NTH_WV(sm,T_NTH_V(tri,j)));
653      glVertex3d(ptr[0],ptr[1],ptr[2]);
# Line 758 | Line 751 | int clr;
751  
752    /* Turn Depth Test off -- using Painter's algorithm */
753    glPushAttrib(GL_DEPTH_BUFFER_BIT);
754 <  glDisable(GL_DEPTH_TEST);
754 >  glDepthFunc(GL_ALWAYS);
755    d = (dev_zmin+dev_zmax)/2.0;
756    /* Now render back-to front */
757    /* First render bg triangles */
# Line 872 | Line 865 | smUpdate(view,qual)
865      glDrawBuffer(GL_BACK);
866   #endif
867    }
868 +
869    SM_TONE_MAP(smMesh) = SM_NUM_SAMP(smMesh);
870 +
871    if (last_update)
872    {
873      smClean_notify = FALSE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines