gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/libpaper Paper.cxx Paper.hxx


From: Asko Soukka
Subject: [Gzz-commits] gzz/gfx/libpaper Paper.cxx Paper.hxx
Date: Sat, 28 Sep 2002 11:03:00 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/09/28 11:03:00

Modified files:
        gfx/libpaper   : Paper.cxx Paper.hxx 

Log message:
        indenting

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/Paper.cxx.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/Paper.hxx.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: gzz/gfx/libpaper/Paper.cxx
diff -c gzz/gfx/libpaper/Paper.cxx:1.11 gzz/gfx/libpaper/Paper.cxx:1.12
*** gzz/gfx/libpaper/Paper.cxx:1.11     Sat Sep 28 06:22:22 2002
--- gzz/gfx/libpaper/Paper.cxx  Sat Sep 28 11:03:00 2002
***************
*** 225,292 ****
        glColor3f(.5 * L.x + .5, .5 * L.y + .5, .5 * L.z + .5);
        }
  
! 
    void PaperPass::setUp_texgen(LightParam *param) {
!       setupcode();
!       
!       /* Set up TexGen for each texture unit */
!       GLenum unit = GL_TEXTURE0_ARB;
!       for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != 
texgen.end(); ++it) {
!         glActiveTextureARB(unit++);
!         if (it->get()) (*it)->setUp(param);
!         else std::cerr << "Warning: ignoring null TexGen\n";
!       }
        
!       /* Do general parametric setup */
!       for (vector<shared_ptr<LightSetup> >::iterator it = setup.begin(); it 
!= setup.end(); ++it) {
!         if (it->get()) (*it)->setUp(param);
!         else std::cerr << "Warning: ignoring null LightSetup\n";
!       }
    }
    
    void PaperPass::loadVP() {
      std::ostringstream code;
!       
      code << "!!VP1.1 OPTION NV_position_invariant;\n"
                 << "MOV o[COL0], v[COL0];\n"
!                << "MOV o[COL1], v[COL1];\n";
!       
      int unit = 0;
      for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != 
texgen.end(); ++it) {
        if (it->get()) code << (*it)->getVPCode(unit);
        else std::cerr << "Warning: ignoring null TexGen\n";
        unit++;
      }
!       
      code << "END\n";
!       
      //std::cerr << "Creating VPCode with the source " << code.str() << "\n";
!       
      texgenvp = VPCode(code.str().c_str());
    }
    
    void PaperPass::setUp_VP(LightParam *param) {
!       if (texgenvp.getSource().length() == 0) loadVP();
!       
!       setupcode();
!       
!       /* Set up VP TexGen parameters for each texture unit */
!       int unit = 0;
!       for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != 
texgen.end(); ++it) {
!         if (it->get()) (*it)->setUp_VP(unit, param);
!         else std::cerr << "Warning: ignoring null TexGen\n";
!         unit++;
!       }
!       
!       /* Do general parametric setup */
!       for (vector<shared_ptr<LightSetup> >::iterator it = setup.begin(); it 
!= setup.end(); ++it) {
!         if (it->get()) (*it)->setUp(param);
!         else std::cerr << "Warning: ignoring null LightSetup\n";
!       }
!       
!       texgenvp(); // Bind vertex program
  #ifdef GL_VERTEX_PROGRAM_NV
!       glEnable(GL_VERTEX_PROGRAM_NV);
  #endif
    }
    
--- 225,292 ----
        glColor3f(.5 * L.x + .5, .5 * L.y + .5, .5 * L.z + .5);
        }
  
!   
    void PaperPass::setUp_texgen(LightParam *param) {
!     setupcode();
!     
!     /* Set up TexGen for each texture unit */
!     GLenum unit = GL_TEXTURE0_ARB;
!     for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != 
texgen.end(); ++it) {
!       glActiveTextureARB(unit++);
!       if (it->get()) (*it)->setUp(param);
!       else std::cerr << "Warning: ignoring null TexGen\n";
!     }
        
!     /* Do general parametric setup */
!     for (vector<shared_ptr<LightSetup> >::iterator it = setup.begin(); it != 
setup.end(); ++it) {
!       if (it->get()) (*it)->setUp(param);
!       else std::cerr << "Warning: ignoring null LightSetup\n";
!     }
    }
    
    void PaperPass::loadVP() {
      std::ostringstream code;
!     
      code << "!!VP1.1 OPTION NV_position_invariant;\n"
                 << "MOV o[COL0], v[COL0];\n"
!        << "MOV o[COL1], v[COL1];\n";
!     
      int unit = 0;
      for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != 
texgen.end(); ++it) {
        if (it->get()) code << (*it)->getVPCode(unit);
        else std::cerr << "Warning: ignoring null TexGen\n";
        unit++;
      }
!     
      code << "END\n";
!     
      //std::cerr << "Creating VPCode with the source " << code.str() << "\n";
!     
      texgenvp = VPCode(code.str().c_str());
    }
    
    void PaperPass::setUp_VP(LightParam *param) {
!     if (texgenvp.getSource().length() == 0) loadVP();
!     
!     setupcode();
!     
!     /* Set up VP TexGen parameters for each texture unit */
!     int unit = 0;
!     for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != 
texgen.end(); ++it) {
!       if (it->get()) (*it)->setUp_VP(unit, param);
!       else std::cerr << "Warning: ignoring null TexGen\n";
!       unit++;
!     }
!     
!     /* Do general parametric setup */
!     for (vector<shared_ptr<LightSetup> >::iterator it = setup.begin(); it != 
setup.end(); ++it) {
!       if (it->get()) (*it)->setUp(param);
!       else std::cerr << "Warning: ignoring null LightSetup\n";
!     }
!     
!     texgenvp(); // Bind vertex program
  #ifdef GL_VERTEX_PROGRAM_NV
!     glEnable(GL_VERTEX_PROGRAM_NV);
  #endif
    }
    
Index: gzz/gfx/libpaper/Paper.hxx
diff -c gzz/gfx/libpaper/Paper.hxx:1.10 gzz/gfx/libpaper/Paper.hxx:1.11
*** gzz/gfx/libpaper/Paper.hxx:1.10     Sat Sep 28 10:27:32 2002
--- gzz/gfx/libpaper/Paper.hxx  Sat Sep 28 11:03:00 2002
***************
*** 143,247 ****
        virtual void setUp(LightParam *param) ;
      };
  
!     /** A single rendering pass.
       * The data members are public to allow modification,
       * but when using a ready-made PaperPass, _choose one_
!        * (and only one) of the following ways to use it:
!        *
!        *   1) using texgen
!        *      - call setUp_texgen() with LightParam to use
!        *      - call glVertex*() directly from the context
!        *      - teardown_texgen()
!        *
!        *   2) using a vertex program
!        *      - call setUp_VP with LightParam to use
!        *      - call glTexCoord*() and glVertex*() directly from 
!        *        the context, use vertex arrays _or_ call vector_VP()
!        *        with vertex and texture coordinates in arrays 
!        *        of 4 floats.
!        *      - call teardown_VP()
!        *
!        *   3) using explicit coordinates
!        *     - call setUp_explicit with LightParam to use
!        *     - ???? without? with texcoords? with texcoord and vertex?
!        *     - call teardown_explicit()
!      */
!     class PaperPass {
!       private:
!       /** Generates and loads the texgen vertex program.
!        * This is automatically called on first setUp_VP 
!          * unless it's  already loaded.
!          */
!       void loadVP();
! 
!     public:
!       /** The code to call before beginning to render the pass. */
!       CallGLCode setupcode;
!       /** The code to call after rendering the pass. */
!       CallGLCode teardowncode;
! 
!       /** The TexGen objects for the different texture units. */
!       vector<shared_ptr<TexGen> > texgen;
!       /** The non-texgen light setup routines. */
!       vector<shared_ptr<LightSetup> > setup;
          
!         /*** Texgen version of the renderinf interface. */
!       /** Calls setupcode, texgen and setup for the texture.
!          *
!          * @param param light parameters (LightParam object)
!        */
!       void setUp_texgen(LightParam *param);
! 
!       /** Calls teardowncode. 
!          */
!       void tearDown_texgen () { teardowncode(); }
! 
!       /*** Vertex program version of the rendering interface */
!       /** Calls setupcode, texgen and setup for the texture.
!          *      
!          * @param param light parameters (LightParam object)
!        */
!       void setUp_VP(LightParam *param);
! 
!       /** Calls teardowncode. 
!          */
!       void tearDown_VP();
! 
!       /** Vertex program version of the paperpass vertex
!          * Calling vertex_VP() is optional. It's possible to call
!          * glTexCoord*() and glVertex*() directly from the context
!          * and choose the best function variant or use vertex arrays
!          * (vertex_VP() forces to pass coordinates in arrays of 4 floats).
!          *
!        * @param pos vertex position (array of 4 floats)
!        * @param ppos position within paper (array of 4 floats)
!        */
!       void vertex_VP(float *pos, float *ppos) {
!               glTexCoord4fv(ppos);
!               glVertex4fv(pos);
!       }
          
!       /*** Explicit version of the rendering interface */
!       /** Calls setupcode, texgen and setup for the texture.
!          *      
!          * @param param light parameters (LightParam object)
!        */
!       void setUp_explicit(LightParam *param) {}
! 
!       /** Calls teardowncode. 
!          */
!       void tearDown_explicit() {}
! 
!       /** Explicit version of the paperpass vertex
!        */
!       void vertex_explicit() {}
!       void vertex_explicit(float *ppos) {}
!       void vertex_explicit(float *pos, float *ppos) {}
          
!     protected:
!         /* Vertex program code */
!       VPCode texgenvp;
!     };
    
    /** A paper is simply a vector of passes.
     */
--- 143,247 ----
        virtual void setUp(LightParam *param) ;
      };
  
!   /** A single rendering pass.
       * The data members are public to allow modification,
       * but when using a ready-made PaperPass, _choose one_
!      * (and only one) of the following ways to use it:
!      *
!      *   1) using texgen
!      *      - call setUp_texgen() with LightParam to use
!      *      - call glVertex*() directly from the context
!      *      - teardown_texgen()
!      *
!      *   2) using a vertex program
!      *      - call setUp_VP with LightParam to use
!      *      - call glTexCoord*() and glVertex*() directly from 
!      *        the context, use vertex arrays _or_ call vector_VP()
!      *        with vertex and texture coordinates in arrays 
!      *        of 4 floats.
!      *      - call teardown_VP()
!      *
!      *   3) using explicit coordinates
!      *     - call setUp_explicit with LightParam to use
!      *     - ???? without? with texcoords? with texcoord and vertex?
!      *     - call teardown_explicit()
!      */
!   class PaperPass {
!   private:
!     /** Generates and loads the texgen vertex program.
!      * This is automatically called on first setUp_VP 
!      * unless it's  already loaded.
!      */
!     void loadVP();
! 
!   public:
!     /** The code to call before beginning to render the pass. */
!     CallGLCode setupcode;
!     /** The code to call after rendering the pass. */
!     CallGLCode teardowncode;
! 
!     /** The TexGen objects for the different texture units. */
!     vector<shared_ptr<TexGen> > texgen;
!     /** The non-texgen light setup routines. */
!     vector<shared_ptr<LightSetup> > setup;
          
!     /*** Texgen version of the renderinf interface. */
!     /** Calls setupcode, texgen and setup for the texture.
!      *
!      * @param param light parameters (LightParam object)
!      */
!     void setUp_texgen(LightParam *param);
! 
!     /** Calls teardowncode. 
!      */
!     void tearDown_texgen () { teardowncode(); }
! 
!     /*** Vertex program version of the rendering interface */
!     /** Calls setupcode, texgen and setup for the texture.
!      *          
!      * @param param light parameters (LightParam object)
!      */
!     void setUp_VP(LightParam *param);
! 
!     /** Calls teardowncode. 
!      */
!     void tearDown_VP();
! 
!     /** Vertex program version of the paperpass vertex
!      * Calling vertex_VP() is optional. It's possible to call
!      * glTexCoord*() and glVertex*() directly from the context
!      * and choose the best function variant or use vertex arrays
!      * (vertex_VP() forces to pass coordinates in arrays of 4 floats).
!      *
!      * @param pos vertex position (array of 4 floats)
!      * @param ppos position within paper (array of 4 floats)
!      */
!     void vertex_VP(float *pos, float *ppos) {
!       glTexCoord4fv(ppos);
!       glVertex4fv(pos);
!     }
          
!     /*** Explicit version of the rendering interface */
!     /** Calls setupcode, texgen and setup for the texture.
!      *          
!      * @param param light parameters (LightParam object)
!      */
!     void setUp_explicit(LightParam *param) {}
! 
!     /** Calls teardowncode. 
!      */
!     void tearDown_explicit() {}
! 
!     /** Explicit version of the paperpass vertex
!      */
!     void vertex_explicit() {}
!     void vertex_explicit(float *ppos) {}
!     void vertex_explicit(float *pos, float *ppos) {}
          
!   protected:
!     /* Vertex program code */
!     VPCode texgenvp;
!   };
    
    /** A paper is simply a vector of passes.
     */




reply via email to

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