/[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.15 by tjl, Mon Jun 23 14:53:19 2003 UTC revision 1.16 by jvk, Sun Jul 13 19:04:26 2003 UTC
# Line 757  public: Line 757  public:
757  VOB_DEFINED(EasyPaperQuad);  VOB_DEFINED(EasyPaperQuad);
758    
759    
760    
761    
762    class BasisPaperQuad {
763    public:
764        enum { NTrans = 2 };
765        
766        ::Vob::Paper::Paper *paper;
767        float x0_0, y0_0, x0_1, y0_1;
768        float x1_0, y1_0, x1_1, y1_1;
769        DisplayListID tex0, tex1, isect;
770        
771        template<class F> void params(F &f) {
772            f(paper, x0_0, y0_0, x0_1, y0_1, x1_0, y1_0, x1_1, y1_1, tex0, tex1, isect);
773        }
774    
775        template<class T> void render(const T &coords1, const T &coords2) const {
776                DBG(dbg) << "Paper\\n";
777                GLERR;
778    
779                const Transform &cs1inv = coords1.getInverse();
780                const Transform &cs2inv = coords2.getInverse();
781    
782                for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); ++it) {
783                    if (dbg) cout << "Pass\\n";
784    
785                    GLERR;
786    
787                    Pt p0[] = { Pt(x0_0,y0_0), Pt(x0_0,y0_1), Pt(x0_1,y0_1), Pt(x0_1,y0_0) };
788                    Pt p1[] = { Pt(x1_0,y1_0), Pt(x1_0,y1_1), Pt(x1_1,y1_1), Pt(x1_1,y1_0) };
789                    ZPt q;
790    
791                    // Draw the first texture
792                    (*it).setupcode();
793                    glEnable(GL_DEPTH_TEST);
794                    glDepthFunc(GL_LESS);
795                    glCallList(tex0);
796                    GLERR;
797                    glBegin(GL_QUADS);
798                    for (int i = 0; i < 4; i++) {
799                        ZPt v = coords1.transform(p0[i]);
800                        glMultiTexCoord2fARB(0, p0[i].x, p0[i].y);
801                        q = cs2inv.transform(v);
802                        glMultiTexCoord2fARB(1, q.x, q.y);
803                        coords1.vertex(p0[i]);
804                    }
805                    glEnd();
806                    GLERR;
807                    (*it).teardowncode();
808                    GLERR;
809    
810                    // Draw the intersection
811                    (*it).setupcode();
812                    glEnable(GL_DEPTH_TEST);
813                    glDepthFunc(GL_EQUAL);
814                    glCallList(isect);
815                    GLERR;
816                    glBegin(GL_QUADS);
817                    for (int i = 0; i < 4; i++) {
818                        ZPt v = coords2.transform(p1[i]);
819                        glMultiTexCoord2fARB(1, p1[i].x, p1[i].y);
820                        q = cs1inv.transform(v);
821                        glMultiTexCoord2fARB(0, q.x, q.y);
822                        coords2.vertex(p1[i]);
823                    }
824                    glEnd();
825                    GLERR;
826                    (*it).teardowncode();
827                    GLERR;
828    
829                    // Draw the second texture
830                    (*it).setupcode();
831                    glEnable(GL_DEPTH_TEST);
832                    glDepthFunc(GL_LESS);
833                    glCallList(tex1);
834                    GLERR;
835                    glBegin(GL_QUADS);
836                    for (int i = 0; i < 4; i++) {
837                        ZPt v = coords2.transform(p1[i]);
838                        glMultiTexCoord2fARB(1, p1[i].x, p1[i].y);
839                        q = cs1inv.transform(v);
840                        glMultiTexCoord2fARB(0, q.x, q.y);
841                        coords2.vertex(p1[i]);
842                    }
843                    glEnd();
844                    GLERR;
845                    (*it).teardowncode();
846                    GLERR;
847    
848    
849    
850    
851                }
852    
853                GLERR;
854        }
855    };
856    
857    VOB_DEFINED(BasisPaperQuad);
858    
859  }  }
860  }  }
861    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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