/[gzz]/gzz/gfx/libpaper/Paper.cxx
ViewVC logotype

Diff of /gzz/gfx/libpaper/Paper.cxx

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

revision 1.8 by jvk, Tue Sep 10 19:19:29 2002 UTC revision 1.9 by jvk, Wed Sep 11 10:41:45 2002 UTC
# Line 2  Line 2 
2    
3  #include <sstream>  #include <sstream>
4    
5  /* define positions of tracked matrices inside the NV vertex program registers */  /* the matrix that maps v[TEX0] into o[TEXi] is stored
6  #define m_p_addr   0 // product of projection and modelview matrices   * starting at c[tex_addr_base + 4*i] */
7  #define paper_addr 4 // object-to-paper-coordinate mapping matrix  #define tex_addr_base 60
   
 /* the matrix that maps v[TEX0] into o[TEXi] is stored starting at c[tex_addr_base + 4*i] */  
 #define tex_addr_base 60 // texture matrix  
8    
9  namespace Paper {  namespace Paper {
10      TexGen::TexGen(const float *tex_mat) {      TexGen::TexGen(const float *tex_mat) {
# Line 47  namespace Paper { Line 44  namespace Paper {
44        std::ostringstream code;        std::ostringstream code;
45    
46        GLuint base = unit * 4 + tex_addr_base;        GLuint base = unit * 4 + tex_addr_base;
47        code << "DP4 o[TEX" << unit << "].x, c[" << base + 0 << "], v[TEX0]\n"        code << "DP4 o[TEX" << unit << "].x, c[" << base + 0 << "], v[TEX0];\n"
48             << "DP4 o[TEX" << unit << "].y, c[" << base + 1 << "], v[TEX0]\n"             << "DP4 o[TEX" << unit << "].y, c[" << base + 1 << "], v[TEX0];\n"
49             << "DP4 o[TEX" << unit << "].z, c[" << base + 2 << "], v[TEX0]\n"             << "DP4 o[TEX" << unit << "].z, c[" << base + 2 << "], v[TEX0];\n"
50             << "DP4 o[TEX" << unit << "].w, c[" << base + 3 << "], v[TEX0]\n";             << "DP4 o[TEX" << unit << "].w, c[" << base + 3 << "], v[TEX0];\n";
51    
52        return code.str();        return code.str();
53      }      }
# Line 249  namespace Paper { Line 246  namespace Paper {
246    void PaperPass::loadVP() {    void PaperPass::loadVP() {
247      std::ostringstream code;      std::ostringstream code;
248    
249      code << "!!VP1.0\n"      code << "!!VP1.1 OPTION NV_position_invariant;\n"
250           << "DP4 o[HPOS].x, v[OPOS], c[" << m_p_addr + 0 << "]\n"           << "MOV o[COL0], v[COL0];\n"
251           << "DP4 o[HPOS].y, v[OPOS], c[" << m_p_addr + 1 << "]\n"           << "MOV o[COL1], v[COL1];\n";
          << "DP4 o[HPOS].z, v[OPOS], c[" << m_p_addr + 2 << "]\n"  
          << "DP4 o[HPOS].w, v[OPOS], c[" << m_p_addr + 3 << "]\n"  
          << "MOV o[COL0], v[COL0]\n"  
          << "MOV o[COL1], v[COL1]\n";  
252    
253      int unit = 0;      int unit = 0;
254      for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != texgen.end(); ++it) {      for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != texgen.end(); ++it) {
# Line 264  namespace Paper { Line 257  namespace Paper {
257        unit++;        unit++;
258      }      }
259    
260      std::cerr << "Creating VPCode with the source " << code.str() << "\n";      code << "END\n";
261    
262        //std::cerr << "Creating VPCode with the source " << code.str() << "\n";
263    
264      texgenvp = VPCode(code.str().c_str());      texgenvp = VPCode(code.str().c_str());
265    }    }
# Line 273  namespace Paper { Line 268  namespace Paper {
268          if (texgenvp.getSource().length() == 0)          if (texgenvp.getSource().length() == 0)
269            loadVP();            loadVP();
270    
271  #ifdef GL_VERTEX_PROGRAM_NV          setupcode();
         /* Track the product of modelview and projection matrices */  
         glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, m_p_addr, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);  
 #endif  
272    
273          /* Set up VP TexGen parameters for each texture unit */          /* Set up VP TexGen parameters for each texture unit */
274          int unit = 0;          int unit = 0;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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