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

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

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

revision 1.2 by tjl, Fri Oct 18 14:09:06 2002 UTC revision 1.3 by tjl, Sat Oct 19 08:13:55 2002 UTC
# Line 1  Line 1 
1  import math  import math
2    
3  class CScene:  class CScene:
4        def __init__(self):
5            self.curve = 1
6      def key(self, key):      def key(self, key):
7          pass          if key == 'c':
8                self.curve = not self.curve
9                AbstractUpdateManager.setNoAnimation()
10      def scene(self, vs):      def scene(self, vs):
11          vs.map.put(background((0.6, 0.6, 0.65)))          vs.map.put(background((0.6, 0.6, 0.65)))
12          vs.map.put(getDListNocoords("Disable TEXTURE_2D"))          vs.map.put(getDListNocoords("Disable TEXTURE_2D"))
13          vs.put(coloredQuad((0,0,1)), "1", 0, 100, 100, 200, 400)          vs.put(coloredQuad((0,0,1)), "1", 0, 100, 100, 200, 400)
14          vs.put(coloredQuad((1,0,0)), "2", 0, 500, 100, 200, 400)          vs.put(coloredQuad((1,0,0)), "2", 0, 500, 100, 200, 400)
15    
16          v = [(x, 0.9*(math.sqrt(0.25-(x-.5)*(x-.5))))          if self.curve:
17                  for x in floats(0,1,50)]              v = [((0.5*(1+math.cos(a))), 0.9 * 0.5*math.sin(a)**(.6) )
18                        for a in floats(0,math.pi,150)]
19                # v = [(0.5*(1+cmath.pow(math.cos(a) , (.333333333))), 0.9 * 0.5*math.sin(a)**(.3) )
20                #       for a in floats(0,math.pi,150)]
21            else:
22                print "CYC"
23                v = [((a-math.sin(a))/(2*math.pi), 0.9 * 0.25*(1-math.cos(a)))
24                        for a in floats(0,2*math.pi,150)]
25                
26          str = """          str = """
27              Disable TEXTURE_2D              Disable TEXTURE_2D
28              Enable BLEND              Enable BLEND
# Line 78  class CScene: Line 90  class CScene:
90    
91          vs.map.put(getDListNocoords("Disable TEXTURE_2D"))          vs.map.put(getDListNocoords("Disable TEXTURE_2D"))
92    
93          w = 25          w = 20
94          h = 50          h = 30
95          cs2 = vs.coords.ortho(0, 0, 200-w, 215-h, 2*w, 2*h)          cs2 = vs.coords.ortho(0, 0, 200-w, 215-h, 2*w, 2*h)
96          vs.map.put(s2, cs2)          vs.map.put(s2, cs2)
97                            
# Line 90  class CScene: Line 102  class CScene:
102          cs = vs.coords.affineCoordsys(0, 0, 200,300, 400, 0, 100,  30)          cs = vs.coords.affineCoordsys(0, 0, 200,300, 400, 0, 100,  30)
103          vs.map.put(shape, cs)          vs.map.put(shape, cs)
104    
105            cs = vs.coords.affineCoordsys(0, 0, 200,500, 30, 0, 0,  30)
106            vs.map.put(shape, cs)
107    
108  currentScene = CScene()  currentScene = CScene()

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

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