~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/covira/surf3_draw.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <tina/all_tina.h>
  2 #include <tina/brain.h>
  3 #include <tina/brainfuncs.h>
  4 
  5 void splinesurf3_uslice_draw(Tv *tv, Splinesurf3 *ss, double s)
  6 {
  7     int v, nv;
  8     switch(ss->vtype)
  9     {
 10         case SPLINE_PERIODIC:
 11             nv = ss->nv;
 12             break;
 13         case SPLINE_NATURAL:
 14             nv = ss->nv-1;
 15             break;
 16         default:
 17             return;
 18     }
 19     for(v = 0; v < nv; v++)
 20     {
 21         Vec3 p1 = splinesurf3_eval(ss, s, v);
 22         Vec3 p2 = splinesurf3_eval(ss, s, v+1);
 23         tv_line3(tv, p1, p2);
 24     }
 25 }
 26 
 27 void splinesurf3_vslice_draw(Tv *tv, Splinesurf3 *ss, double t)
 28 {
 29     int u, nu;
 30     switch(ss->utype)
 31     {
 32         case SPLINE_PERIODIC:
 33             nu = ss->nu;
 34             break;
 35         case SPLINE_NATURAL:
 36             nu = ss->nu-1;
 37             break;
 38         default:
 39             return;
 40     }
 41     for(u = 0; u < nu; u++)
 42     {
 43         Vec3 p1 = splinesurf3_eval(ss, u, t);
 44         Vec3 p2 = splinesurf3_eval(ss, u+1, t);
 45         tv_line3(tv, p1, p2);
 46     }
 47 }
 48 
 49 void splinesurf3_uslices_draw(Tv *tv, Splinesurf3 *ss)
 50 {
 51     int u, nu;
 52     switch(ss->utype)
 53     {
 54         case SPLINE_PERIODIC:
 55             nu = ss->nu;
 56             break;
 57         case SPLINE_NATURAL:
 58             nu = ss->nu-1;
 59             break;
 60         default:
 61             return;
 62     }
 63     for(u = 0; u <= nu; u++)
 64         splinesurf3_uslice_draw(tv, ss, u);
 65 }
 66 
 67 void splinesurf3_vslices_draw(Tv *tv, Splinesurf3 *ss)
 68 {
 69     int v, nv;
 70     switch(ss->vtype)
 71     {
 72         case SPLINE_PERIODIC:
 73             nv = ss->nv;
 74             break;
 75         case SPLINE_NATURAL:
 76             nv = ss->nv-1;
 77             break;
 78         default:
 79             return;
 80     }
 81     for(v = 0; v <= nv; v++)
 82         splinesurf3_vslice_draw(tv, ss, v);
 83 }
 84 
 85 void splinesurf3_draw(Tv *tv, Splinesurf3 *ss)
 86 {
 87     splinesurf3_uslices_draw(tv, ss);
 88     splinesurf3_vslices_draw(tv, ss);
 89 }
 90 
 91 void splinesurf3_shade(Tv *tv, Splinesurf3 *ss)
 92 {
 93     int u, v, nu, nv;
 94     switch(ss->utype)
 95     {
 96         case SPLINE_PERIODIC:
 97             nu = ss->nu;
 98             break;
 99         case SPLINE_NATURAL:
100             nu = ss->nu-1;
101             break;
102         default:
103             return;
104     }
105     switch(ss->vtype)
106     {
107         case SPLINE_PERIODIC:
108             nv = ss->nv;
109             break;
110         case SPLINE_NATURAL:
111             nv = ss->nv-1;
112             break;
113         default:
114             return;
115     }
116     for(u = 0; u < nu; u++)
117         for(v = 0; v < nv; v++)
118             tv_zbuff_patch3(tv, splinesurf3_eval, NULL, ss, u, v, u+1, v+1, 3);
119 }
120 
121 void splinesurf3_controls_draw(Tv *tv, Splinesurf3 *ss)
122 {
123     int u, v;
124     for(u = 0; u < ss->nu; u++)
125         for(v = 0; v < ss->nv; v++)
126         {
127             Vec3 p = splinesurf3_control(ss, u, v);
128             tv_zbuff_line3(tv, p, splinesurf3_eval(ss, u, v));
129         }
130 }
131 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.