/[libvob]/libvob/include/vob/vobs/Paper.hxx
ViewVC logotype

Diff of /libvob/include/vob/vobs/Paper.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by tjl, Tue Apr 1 15:06:52 2003 UTC revision 1.4 by tjl, Tue Apr 1 19:48:06 2003 UTC
# Line 58  struct Verts { Line 58  struct Verts {
58      }      }
59    
60    
     float dicelen;  
     float split(int i, int j) const {  
         float ret = (points[i].final - points[j].final).xylength() / (float)dicelen - 1;  
         DBG(dbg_paperquad) << "Split "<<i<<" "<<j<<" "<<  
                 points[i].final<<" "<<points[j].final<<" "<<ret<<"\n";  
         return ret;  
     }  
61    
62      void startT2V3Operation() {      void startT2V3Operation() {
63          glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);          glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
# Line 98  struct Triangler { Line 91  struct Triangler {
91      }      }
92  };  };
93    
94    inline float split(Verts &v, float dicelen, int i, int j) {
95        float ret = (v.points[i].final - v.points[j].final).xylength()
96                        / dicelen - 1;
97        DBG(dbg_paperquad) << "Split "<<i<<" "<<j<<" "<<
98                v.points[i].final<<" "<<v.points[j].final<<" "<<ret<<"\n";
99        return ret;
100  }  }
101    
102    }
103    
104    
105  class DiceTester {  class DiceTester {
106  public:  public:
107      enum { NTrans = 1 };      enum { NTrans = 1 };
# Line 111  public: Line 113  public:
113      template<class F> void params(F &f) {      template<class F> void params(F &f) {
114          f(dicelen, flags, maxdepth);          f(dicelen, flags, maxdepth);
115      }      }
     static float split(PaperPriv::Verts &v, int i, int j) {  
         return v.split(i,j); }  
116    
117      template<class T> void render(const T &coords) const {      template<class T> void render(const T &coords) const {
118          using namespace PaperPriv;          using namespace PaperPriv;
# Line 122  public: Line 122  public:
122          verts.append(Pt(0,0));          verts.append(Pt(0,0));
123          verts.append(Pt(1,0));          verts.append(Pt(1,0));
124          verts.append(Pt(1,1));          verts.append(Pt(1,1));
         verts.dicelen = dicelen;  
125          using namespace boost;          using namespace boost;
126          using namespace boost::lambda;          using namespace boost::lambda;
127          DBG(dbg_paperquad) << "Set_and_initial\n";          DBG(dbg_paperquad) << "Set_and_initial\n";
128          tri.set_and_initial_dice(verts,          tri.set_and_initial_dice(verts,
129                       0, 1, 2, bind(split, ref(verts), _1, _2), maxdepth);                       0, 1, 2, bind(split, ref(verts), dicelen, _1, _2), maxdepth);
130          DBG(dbg_paperquad) << "dice\n";          DBG(dbg_paperquad) << "dice\n";
131          tri.dice(verts, triangler,          tri.dice(verts, triangler,
132                        bind(split, ref(verts), _1, _2), maxdepth);                        bind(split, ref(verts), dicelen, _1, _2), maxdepth);
133    
134          verts.startT2V3Operation();          verts.startT2V3Operation();
135              triangler.draw();              triangler.draw();
136          verts.endT2V3Operation();          verts.endT2V3Operation();
137    
         /*  
         glBegin(GL_TRIANGLES);  
                           
         int ind = 0;  
         for(vector<Triangler::Tri>::iterator i=triangler.tris.begin();  
                         i != triangler.tris.end(); i++) {  
             DBG(dbg_paperquad) << "tri \n";  
             if(flags & 1) {  
                 glColor3f(.5 + .5 * sin(.1 * ind),  
                           .5 + .5 * cos(.08751 * ind),  
                           .5 + .5 * sin(.07751 * ind));  
             }  
             ind ++;  
             for(int j=0; j<3; j++)  
                 VecGL::glVertex( verts.finalPoints[(*i).v[j]] );  
         }  
         glEnd();  
         */  
138      }      }
139    
140  };  };

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26