/[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.14 by humppake, Mon Sep 30 06:44:22 2002 UTC revision 1.15 by jvk, Wed Oct 2 10:33:45 2002 UTC
# Line 45  namespace Paper { Line 45  namespace Paper {
45      }      }
46    
47      string TexGen::getVPCode(int unit) {      string TexGen::getVPCode(int unit) {
48    #if 0
49          // XXX: this code  crashes when compiled with g++-3.1 -O3 -ffast-math
50        std::ostringstream code;        std::ostringstream code;
51    
52        GLuint base = unit * 4 + tex_addr_base;        GLuint base = unit * 4 + tex_addr_base;
# Line 54  namespace Paper { Line 56  namespace Paper {
56             << "DP4 o[TEX" << unit << "].w, c[" << base + 3 << "], v[TEX0];\n";             << "DP4 o[TEX" << unit << "].w, c[" << base + 3 << "], v[TEX0];\n";
57    
58        return code.str();        return code.str();
59    #else
60          GLuint base = unit * 4 + tex_addr_base;
61          char str[1000];
62          sprintf(str,
63                  "DP4 o[TEX%d].x, c[%u], v[TEX0];\n"
64                  "DP4 o[TEX%d].y, c[%u], v[TEX0];\n"
65                  "DP4 o[TEX%d].z, c[%u], v[TEX0];\n"
66                  "DP4 o[TEX%d].w, c[%u], v[TEX0];\n",
67                  unit, base, unit, base + 1, unit, base + 2, unit, base + 3);
68          return str;
69    #endif
70      }      }
71    
72      void TexGen::setUp_explicit(LightParam * param) {      void TexGen::setUp_explicit(LightParam * param) {
# Line 257  namespace Paper { Line 270  namespace Paper {
270    }    }
271        
272    void PaperPass::loadVP() {    void PaperPass::loadVP() {
273      std::ostringstream code;      string code =
274              "!!VP1.1 OPTION NV_position_invariant;\n"
275      code << "!!VP1.1 OPTION NV_position_invariant;\n"        "MOV o[COL0], v[COL0];\n"
276           << "MOV o[COL0], v[COL0];\n"        "MOV o[COL1], v[COL1];\n";
          << "MOV o[COL1], v[COL1];\n";  
277            
278      int unit = 0;      int unit = 0;
279      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) {
280        if (it->get()) code << (*it)->getVPCode(unit);        if (it->get()) code += (*it)->getVPCode(unit);
281        else std::cerr << "Warning: ignoring null TexGen\n";        else std::cerr << "Warning: ignoring null TexGen\n";
282        unit++;        unit++;
283      }      }
284            
285      code << "END\n";      code += "END\n";
286            
287      //std::cerr << "Creating VPCode with the source " << code.str() << "\n";      //std::cerr << "Creating VPCode with the source " << code.str() << "\n";
288            
289      texgenvp = VPCode(code.str().c_str());      texgenvp = VPCode(code.c_str());
290    }    }
291        
292    void PaperPass::setUp_VP(LightParam *param) {    void PaperPass::setUp_VP(LightParam *param) {

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

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