gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende...
Date: Thu, 26 Sep 2002 13:37:11 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/09/26 13:37:11

Modified files:
        gfx/demo       : irregular2.py 
        gfx/librenderables: renderables.py 

Log message:
        Fix IrregularQuad ripple_period

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregular2.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.64&tr2=1.65&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/irregular2.py
diff -c gzz/gfx/demo/irregular2.py:1.18 gzz/gfx/demo/irregular2.py:1.19
*** gzz/gfx/demo/irregular2.py:1.18     Thu Sep 26 09:18:56 2002
--- gzz/gfx/demo/irregular2.py  Thu Sep 26 13:37:11 2002
***************
*** 1,5 ****
--- 1,6 ----
  from __future__ import nested_scopes
  from gzz.gfx.gl import GL, GLRen
+ from math import sin,cos,pi
  
  execfile("gfx/libutil/effects.py")
  
***************
*** 18,23 ****
--- 19,25 ----
          #self.xs, self.ys = 200, 100
          self.x1, self.y1 = 0, 0
          self.xs, self.ys = 1, 1
+         self.a1 = 0
          self.scale = 1
  
      def initirregu(self):
***************
*** 40,49 ****
  
      def key(self, k):
          if 0: pass
!         elif k == "Up": self.y1 -= .1
!         elif k == "Down": self.y1 += .1
!         elif k == "Left": self.x1 -= .1
!         elif k == "Right": self.x1 += .1
          elif k == "x": self.xs += .1
          elif k == "X": self.xs -= .1
          elif k == "y": self.ys += .1
--- 42,55 ----
  
      def key(self, k):
          if 0: pass
!         elif k == "Up":
!             self.x1 += .2 * cos(self.a1)
!             self.y1 += .2 * sin(self.a1)
!         elif k == "Down":
!             self.x1 -= .2 * cos(self.a1)
!             self.y1 -= .2 * sin(self.a1)
!         elif k == "Left": self.a1 -= .1
!         elif k == "Right": self.a1 += .1
          elif k == "x": self.xs += .1
          elif k == "X": self.xs -= .1
          elif k == "y": self.ys += .1
***************
*** 75,81 ****
          #putnoc(vs, getDListNocoords("Translate -1000 -1000 0\nScale 4 4 
4\n"))
  
          #cs2 = vs.coords.affineCoordsys(0, 10, self.x1, self.y1, self.xs, 0, 
0, self.ys)
!         cs2 = vs.coords.affineCoordsys(0, 0, self.x1, self.y1, self.xs, 
-.3*self.ys, +.3*self.xs, self.ys)
        vs.matcher.add(cs2, "2")
          cs1 = vs.coords.affineCoordsys(0, 10, 600, 450,
                                         self.scale * 150,
--- 81,87 ----
          #putnoc(vs, getDListNocoords("Translate -1000 -1000 0\nScale 4 4 
4\n"))
  
          #cs2 = vs.coords.affineCoordsys(0, 10, self.x1, self.y1, self.xs, 0, 
0, self.ys)
!         cs2 = vs.coords.affineCoordsys(0, 0, self.x1, self.y1, cos(self.a1), 
-sin(self.a1), sin(self.a1), cos(self.a1))
        vs.matcher.add(cs2, "2")
          cs1 = vs.coords.affineCoordsys(0, 10, 600, 450,
                                         self.scale * 150,
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.64 
gzz/gfx/librenderables/renderables.py:1.65
*** gzz/gfx/librenderables/renderables.py:1.64  Thu Sep 26 09:15:21 2002
--- gzz/gfx/librenderables/renderables.py       Thu Sep 26 13:37:11 2002
***************
*** 506,522 ****
  {
      "Type" : "2",
      "Name": "IrregularQuad",
!     "Data": "float border; float cs2w, cs2h, cs2p; int mode; CallGLCode 
setup;",
      "Params" : """
!           float border, float cs2w, float cs2h, float cs2ripple_period, int 
mode, String setupcode
        """,
      "ParamCode" : """
-             // Note: the parameters coords2.x, coords2.y, cs2w, cs2h,
-             //       and cs2ripple_period have one redundant variable
-             this->cs2p = cs2ripple_period;
              this->border = border;
!             this->cs2w = cs2w / cs2p;
!             this->cs2h = cs2h / cs2p;
              this->mode = mode;
              setup = CallGLCode(string(setupcode.begin(), 
setupcode.end()).c_str());
        """,
--- 506,520 ----
  {
      "Type" : "2",
      "Name": "IrregularQuad",
!     "Data": "float border; float paperw, paperh, freq; int mode; CallGLCode 
setup;",
      "Params" : """
!           float border, float paperw, float paperh, float ripple_period, int 
mode, String setupcode
        """,
      "ParamCode" : """
              this->border = border;
!             this->paperw = paperw;
!             this->paperh = paperh;
!             this->freq = 1.0 / ripple_period;
              this->mode = mode;
              setup = CallGLCode(string(setupcode.begin(), 
setupcode.end()).c_str());
        """,
***************
*** 530,536 ****
              template <class Coords>
              inline void vert(Coords& coords1, Coords& coords2, ZPt q) {
                  ZPt p = coords2.transform(q);
!                 glMultiTexCoord2f(1, .25 / cs2w * p.x + .5, .25 / cs2h * p.y 
+ .5);
                  coords1.vertex(p);
              }
      """,
--- 528,534 ----
              template <class Coords>
              inline void vert(Coords& coords1, Coords& coords2, ZPt q) {
                  ZPt p = coords2.transform(q);
!                 glMultiTexCoord2f(1, .25 / paperw * p.x + .5, .25 / paperh * 
p.y + .5);
                  coords1.vertex(p);
              }
      """,
***************
*** 596,604 ****
          glEnable(GL_TEXTURE_2D);
  
          for (unsigned i = 0; i < sizeof(sides)/sizeof(sides[0]); i++) {
!             ZPt tex0 = coords2.transform(lerp(texf, sides[i][3], 
sides[i][0]));
!             ZPt tex1 = coords2.transform(lerp(texf, sides[i][2], 
sides[i][1]));
! 
  
              glBegin(GL_QUADS);
              glSecondaryColor3fEXT(0, 0, 0);
--- 594,601 ----
          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);




reply via email to

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