/[libvob]/libvob/vob/demo/fisheye.py
ViewVC logotype

Diff of /libvob/vob/demo/fisheye.py

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

revision 1.1 by tjl, Thu Apr 10 14:00:19 2003 UTC revision 1.2 by tjl, Wed May 7 11:57:30 2003 UTC
# Line 1  Line 1 
1  # (c) Tuomas J. Lukka  # (c) Tuomas J. Lukka
2    
3  from org.nongnu.libvob.putil.misc import *  import vob
4    from vob.putil.misc import *
5    from vob.putil.demokeys import *
6    
7  from org.nongnu import libvob as vob  vob.AbstractUpdateManager.defaultAnimationTime = 1500
8    vob.AbstractUpdateManager.fractCalc = vob.AbstractUpdateManager.LinearCalculator(0)
 from org.nongnu.libvob.putil.demokeys import *  
9    
10  class Scene:  class Scene:
11      def __init__(self):      def __init__(self):
12          self.fisheye = vob.view.FisheyeState(1, .01, 100, 1, 100)          self.fisheye = vob.view.FisheyeState(1, .1, 100, 1, 10000)
13          self.color = GLCache.getCallList("""          self.color = GLCache.getCallList("""
14               Color 0 0 0               Color 0 0 0
15          """)          """)
# Line 18  class Scene: Line 19  class Scene:
19              GLCache.getCallList("""              GLCache.getCallList("""
20               PolygonMode FRONT_AND_BACK FILL               PolygonMode FRONT_AND_BACK FILL
21              """)]              """)]
         # self.dice = GLRen.createDiceTester(35, 1, 20)  
22    
23          pap = vob.gl.PaperMill.getInstance().getPaper(42)  
24          self.paper = GLRen.createFixedPaperQuad(pap, 0, 0, 1, 1, 2,  
25              50, 20)          self.pap = vob.gl.PaperMill.getInstance().getPaper(42)
26    
27          self.key = KeyPresses( self,          self.key = KeyPresses( self,
28              ListIndex("curmode", "mode", 0, "Toggle polymode", "l", "L"),              ListIndex("curmode", "mode", 0, "Toggle polymode", "l", "L"),
29              Toggle("usepaper", 1, "use paper", "p"),              Toggle("usepaper", 1, "use paper", "p"),
30                SlideLog("dicelen", 5,  "Dice length", 'd', 'D'),
31                SlideLog("dicelen2", 5,  "Dice length", 'f', 'F'),
32                SlideLin("x", 0, 100, "x coord", "Left", "Right"),
33                SlideLin("y", 0, 100, "y coord", "Up", "Down"),
34          )          )
35    
36            self.repl = 0
37      def key(self, k):      def key(self, k):
38          pass          pass
39      def scene(self, vs):      def scene(self, vs):
40            if self.repl:
41                self.repl = 0
42                return self.vs
43          self.vs = vs          self.vs = vs
44          putnoc(vs, background((.3,.7,.6)))          putnoc(vs, background((.0,.7,.6)))
45    
46          size = vs.getSize()          size = vs.getSize()
47    
48          cs = vs.translateCS(0, "A", size.width / 2, size.height / 2)          cs = vs.translateCS(0, "A", size.width / 2, size.height / 2)
49    
50          cs = self.fisheye.getCoordsys(vs, cs, "B")          cs2 = self.fisheye.getCoordsys(vs, cs, "B")
51            vs.matcher.add(cs, cs2, "X")
52            cs = cs2
53    
54            vs.map.put(self.mode[self.curmode])
55                    
56          if self.usepaper:          if self.usepaper:
57              print self.paper              s = 1000
58              s = 10              cs = vs.orthoCS(cs, "C", 0, self.x + -s/2, self.y + -s/1.5, s, s)
59              cs = vs.orthoCS(cs, "C", 0, -s/2, -s/2, s, s)              paper = GLRen.createFixedPaperQuad(self.pap, 0, 0, 10, 10, 2,
60              vs.map.put(self.paper, cs)                  self.dicelen, self.dicelen2, 20)
61                vs.map.put(paper, cs)
62          else:          else:
63              cs = vs.orthoCS(cs,"C", 0, 2, -2, 10, 10)              cs = vs.orthoCS(cs,"D", 0, 2, -2, 10, 10)
64    
65              vs.map.put(self.color)              vs.map.put(self.color)
66              vs.map.put(self.mode[self.curmode])  
67              vs.map.put(self.dice, cs)              dice = GLRen.createDiceTester(self.dicelen, self.dicelen2, 1, 20)
68                vs.map.put(dice, cs)
69            vs.map.put(self.mode[1])
70      def mouse(self, ev):      def mouse(self, ev):
71          if self.fisheye.event(ev):          if self.fisheye.event(ev):
72              self.fisheye.setCoordsysParams()              self.fisheye.setCoordsysParams()
73              replaceNewScene(self.vs)              self.repl = 1
74                vob.AbstractUpdateManager.setNoAnimation()
75              vob.AbstractUpdateManager.chg()              vob.AbstractUpdateManager.chg()
76              return 1              return 1
77    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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