gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/librenderables renderables.py


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/librenderables renderables.py
Date: Fri, 27 Sep 2002 06:52:12 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/09/27 06:52:12

Modified files:
        gfx/librenderables: renderables.py 

Log message:
        Start implementing dicing in IrregularQuad

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.68&tr2=1.69&r1=text&r2=text

Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.68 
gzz/gfx/librenderables/renderables.py:1.69
*** gzz/gfx/librenderables/renderables.py:1.68  Fri Sep 27 06:25:11 2002
--- gzz/gfx/librenderables/renderables.py       Fri Sep 27 06:52:11 2002
***************
*** 576,587 ****
              setup = CallGLCode(string(setupcode.begin(), 
setupcode.end()).c_str());
        """,
      "ExtraClass" : """
-             ZPt lerp(float f, ZPt a, ZPt b) {
-                 return ZPt((1 - f) * a.x + f * b.x,
-                            (1 - f) * a.y + f * b.y,
-                            0);
-             }
- 
              template <class Coords>
              inline void vert(Coords& coords1, Coords& coords2, ZPt q) {
                  ZPt p = coords2.transform(q);
--- 576,581 ----
***************
*** 590,595 ****
--- 584,590 ----
              }
      """,
      "RenderCode" : """
+         DBG(dbg) << "Irregular quad\\n";
  
          setup();
          GLERR;
***************
*** 621,626 ****
--- 616,632 ----
          // scale of last two vertices of sides 
          float wtbl[] = { 1, 1, 1, 1, w, w, w, w };
  
+         ZPt ctr = coords2.transform(ZPt(0,0,0));
+         double radius = (coords2.transform(ZPt(1,1,0)) - ZPt(0,0,0)).length();
+         double nonl = coords1.nonlinearity(ctr, radius);
+ 
+         int diceb = (int)(2 * border * sqrt(2) * nonl) + 1;
+         int dicex = (int)(2 * border * (1 / bx - 1) * nonl) + 1;
+         int dicey = (int)(2 * border * (1 / by - 1) * nonl) + 1;
+ 
+         // Dicing number for each of the primitives 
+         int dice[] = { dicey, dicey, dicex, dicex, diceb, diceb, diceb, diceb 
};
+ 
          ZPt sides[][4] =  { // The sides of the rectangle:
                             { ZPt(-x0,-y2,0), ZPt(-x0,+y2,0), ZPt(-x1,+y2,0), 
ZPt(-x1,-y2,0) },
                             { ZPt(+x0,-y2,0), ZPt(+x0,+y2,0), ZPt(+x1,+y2,0), 
ZPt(+x1,-y2,0) },
***************
*** 638,643 ****
--- 644,652 ----
           */
          float texf = 0.5;
  
+         DBG(dbg) << "Dice: " << dice <<"\\n";
+ 
+ 
          for (int pass = 0; pass < (mode ? 4 : 1); pass++) {
  
          if (mode) {
***************
*** 651,677 ****
          glEnable(GL_TEXTURE_2D);
  
          for (unsigned i = 0; i < sizeof(sides)/sizeof(sides[0]); i++) {
!             ZVec tex0 = freq * (coords2.transform(lerp(texf, sides[i][3], 
sides[i][0])) - ZPt(0,0,0));
!             ZVec tex1 = freq * (coords2.transform(lerp(texf, sides[i][2], 
sides[i][1])) - ZPt(0,0,0));
  
!             glBegin(GL_QUADS);
!             glSecondaryColor3fEXT(0, 0, 0);
  
              glTexCoord2f(tex0.x, tex0.y);
              vert(coords1, coords2, sides[i][0]);
  
              glTexCoord2f(tex1.x, tex1.y);
              vert(coords1, coords2, sides[i][1]);
  
              glSecondaryColor3fEXT(1, 1, 1);
- 
-             float w = wtbl[i];
- 
              glTexCoord4f(tex1.x * w, tex1.y * w, 0, w);
!             vert(coords1, coords2, sides[i][2]);
!                 
!             glTexCoord4f(tex0.x * w, tex0.y * w, 0, w);
!             vert(coords1, coords2, sides[i][3]);
                  
              glEnd();
              GLERR;
--- 660,686 ----
          glEnable(GL_TEXTURE_2D);
  
          for (unsigned i = 0; i < sizeof(sides)/sizeof(sides[0]); i++) {
!             ZVec tex0 = freq * (coords2.transform(lerp(sides[i][3], 
sides[i][0], texf)) - ZPt(0,0,0));
!             ZVec tex1 = freq * (coords2.transform(lerp(sides[i][2], 
sides[i][1], texf)) - ZPt(0,0,0));
  
!             float w = wtbl[i];
  
+             glBegin(GL_QUAD_STRIP);
+             glSecondaryColor3fEXT(0, 0, 0);
              glTexCoord2f(tex0.x, tex0.y);
              vert(coords1, coords2, sides[i][0]);
  
+             glSecondaryColor3fEXT(1, 1, 1);
+             glTexCoord4f(tex0.x * w, tex0.y * w, 0, w);
+             vert(coords1, coords2, sides[i][3]);
+ 
+             glSecondaryColor3fEXT(0, 0, 0);
              glTexCoord2f(tex1.x, tex1.y);
              vert(coords1, coords2, sides[i][1]);
  
              glSecondaryColor3fEXT(1, 1, 1);
              glTexCoord4f(tex1.x * w, tex1.y * w, 0, w);
!             vert(coords1, coords2, sides[i][2]);                
                  
              glEnd();
              GLERR;




reply via email to

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