gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob/include/vob/vobs Paper.hxx


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob/include/vob/vobs Paper.hxx
Date: Tue, 01 Apr 2003 15:14:19 -0500

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/04/01 15:14:18

Modified files:
        include/vob/vobs: Paper.hxx 

Log message:
        Screen-space dicing paper quad working -- needs some tuning still, 
maybe error metric from curvature?

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Paper.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: libvob/include/vob/vobs/Paper.hxx
diff -u libvob/include/vob/vobs/Paper.hxx:1.4 
libvob/include/vob/vobs/Paper.hxx:1.5
--- libvob/include/vob/vobs/Paper.hxx:1.4       Tue Apr  1 14:48:06 2003
+++ libvob/include/vob/vobs/Paper.hxx   Tue Apr  1 15:14:18 2003
@@ -68,6 +68,16 @@
        glUnlockArraysEXT();
        glPopClientAttrib();
     }
+
+    void startV3Operation() {
+       glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
+       glInterleavedArrays(GL_V3F, 5*sizeof(float), &(points[0].final));
+       glLockArraysEXT(0, points.size());
+    }
+    void endV3Operation() {
+       glUnlockArraysEXT();
+       glPopClientAttrib();
+    }
 };
 
 /** A set of triangles.
@@ -149,7 +159,7 @@
  */
 class FixedPaperQuad {
 public:
-    enum { NTrans = 2 };
+    enum { NTrans = 1 };
     ::Vob::Paper::Paper *paper;
     float x0,y0,x1,y1;
     int flags;
@@ -164,11 +174,91 @@
 
     template<class T> void render(const T &coords) const {
        GLERR
+
+       using namespace PaperPriv;
+       Triangler triangler;
+       Verts verts(coords);
+       verts.append(Pt(x0,y0));
+       verts.append(Pt(x1,y0));
+       verts.append(Pt(x0,y1));
+       verts.append(Pt(x1,y1));
+       using namespace boost;
+       using namespace boost::lambda;
+       DBG(dbg_paperquad) << "Set_and_initial\n";
+
+       {
+           ::Vob::Dicer::InitialDicedTriangle<__gnu_cxx::slist<int> > tri;
+           tri.set_and_initial_dice(verts,
+                    0, 1, 3, bind(split, ref(verts), diceLength, _1, _2), 
diceDepth);
+           DBG(dbg_paperquad) << "dice\n";
+           tri.dice(verts, triangler,
+                         bind(split, ref(verts), diceLength, _1, _2), 
diceDepth);
+       }
+
+
+       {
+           ::Vob::Dicer::InitialDicedTriangle<__gnu_cxx::slist<int> > tri;
+           tri.set_and_initial_dice(verts,
+                    0, 3, 2, bind(split, ref(verts), diceLength, _1, _2), 
diceDepth);
+           DBG(dbg_paperquad) << "dice\n";
+           tri.dice(verts, triangler,
+                         bind(split, ref(verts), diceLength, _1, _2), 
diceDepth);
+       }
+
+
+       Paper::LightParam lightParam;
+       lightParam.orig = ZPt(0,0,0);
+       lightParam.e0 = ZPt(0,0,0);
+       lightParam.e1 = ZPt(0,0,0);
+       lightParam.e2 = ZPt(0,0,0);
+       lightParam.Light = ZVec(-1,-1,1);
+       lightParam.Light_w = 0.0;
+
+       if(flags & PAPERQUAD_USE_VERTEX_PROGRAM) {
+           verts.startT2V3Operation();
+
+           for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
+               GLERR
+               (*it).setUp_VP(&lightParam);
+               triangler.draw();
+               (*it).tearDown_VP();
+           }
+
+           verts.endT2V3Operation();
+       } else {
+           // Only vertex position comes from here
+           verts.startV3Operation();
+           for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
+               GLERR
+               (*it).setUp_explicit(&lightParam);
+
+               glBegin(GL_TRIANGLES);
+
+               for(unsigned i=0; i<triangler.tris.size(); i++) {
+                    for(int v = 0; v < 3; v++) {
+                        int ind = triangler.tris[i].v[v];
+                        float tmp[4] = {
+                            verts.points[ind].orig.x,
+                            verts.points[ind].orig.y,
+                            0, 1};
+                        (*it).texcoords_explicit( tmp );
+                        glArrayElement(ind);
+                    }
+               }
+
+               glEnd();
+           }
+           verts.endV3Operation();
+
+       }
+
+       GLERR
        
        
     }
 
 };
+VOB_DEFINED(FixedPaperQuad);
 
 /**
 # PaperQuad is a bit complicated: there are three coordinate




reply via email to

[Prev in Thread] Current Thread [Next in Thread]