/[gzz]/gzz/gfx/demo/fisheye.py
ViewVC logotype

Diff of /gzz/gfx/demo/fisheye.py

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

revision 1.9 by jvk, Thu Sep 12 16:31:43 2002 UTC revision 1.10 by benja, Thu Sep 12 16:37:00 2002 UTC
# Line 32  def addpdftex(pap): Line 32  def addpdftex(pap):
32      print "TEXID: ",texid      print "TEXID: ",texid
33    
34      ppass.setSetupcode("""      ppass.setSetupcode("""
35          PushAttrib ENABLE_BIT TEXTURE_BIT                  PushAttrib ENABLE_BIT TEXTURE_BIT
36          ActiveTexture TEXTURE1          ActiveTexture TEXTURE1
37          Disable TEXTURE_2D          Disable TEXTURE_2D
38          ActiveTexture TEXTURE0          ActiveTexture TEXTURE0
# Line 61  def addpdftex(pap): Line 61  def addpdftex(pap):
61                                0,.5,0,.2,                                0,.5,0,.2,
62                                0,0,1,0,                                0,0,1,0,
63                                0,0,0,1])                                0,0,0,1])
       
64    
65        
66    
67    
68  def getfisheyepaper(seed):  def getfisheyepaper(seed):
69      pap = ThePaperMill().getPaper(seed)      pap = ThePaperMill().getPaper(seed)
# Line 82  bs = .2 Line 82  bs = .2
82  ba = 0  ba = 0
83  bl = 0  bl = 0
84  bm = 2  bm = 2
85    px, py = 600, 450
86    
87  rng = java.util.Random()  rng = java.util.Random()
88    
# Line 107  class FisheyeScene: Line 108  class FisheyeScene:
108          self.fpq = getfisheyepaper(self.seed);          self.fpq = getfisheyepaper(self.seed);
109    
110      def key(self, k):      def key(self, k):
111          global bx, by, bs, ba, bl, bm          global bx, by, bs, ba, bl, bm, px, py
112          if k == "Up": by -= 100          if k == "Up": py += 100
113          elif k == "Down": by += 100          elif k == "Down": py -= 100
114          elif k == "Left": bx -= 100          elif k == "Left": px += 100
115          elif k == "Right": bx += 100          elif k == "Right": px -= 100
116            elif k == "Ctrl-Up": by -= 100
117            elif k == "Ctrl-Down": by += 100
118            elif k == "Ctrl-Left": bx -= 100
119            elif k == "Ctrl-Right": bx += 100
120          elif k == "+": bs += .05; print "bs ", bs          elif k == "+": bs += .05; print "bs ", bs
121          elif k == "-": bs -= .05; print "bs ", bs          elif k == "-": bs -= .05; print "bs ", bs
122          elif k == "a": ba += .2; print "ba ", ba          elif k == "a": ba += .2; print "ba ", ba
# Line 133  class FisheyeScene: Line 138  class FisheyeScene:
138      def scene(self, vs):      def scene(self, vs):
139          putnoc(vs, background(self.bgcolor))          putnoc(vs, background(self.bgcolor))
140    
141          cs1 = vs.coords.affineCoordsys(0, "1", 10, 600, 450, 400, 0, 0, 400)          cs1 = vs.coords.affineCoordsys(0, "1", 10, px, py, 400, 0, 0, 400)
142    
143          cs2 = vs.coords.affineCoordsys(0, "2", 10 - bm, bx, by,          cs2 = vs.coords.affineCoordsys(0, "2", 10 - bm, bx, by,
144                                         400 * bs * math.exp(+bl) * math.cos(ba),                                         400 * bs * math.exp(+bl) * math.cos(ba),

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

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