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

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

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

revision 1.40 by jvk, Sun Dec 1 23:55:03 2002 UTC revision 1.41 by jvk, Tue Dec 3 11:41:03 2002 UTC
# Line 1  Line 1 
1  from gfx.libutil.nvcode import combinercode, parseCombiner  from gfx.libutil.nvcode import combinercode, parseCombiner
2  from gfx.libpaper.texcache import getCachedTexture  from gfx.libpaper.texcache import getCachedTexture
3  from math import sin,cos  from math import sin,cos,pi
4  from gfx.libutil import saveanim  from gfx.libutil import saveanim
5    
6    
# Line 280  class IrreguScene: Line 280  class IrreguScene:
280          self.shape = 0          self.shape = 0
281          self.texslicing = 0          self.texslicing = 0
282          self.flags = 127          self.flags = 127
283            self.texscale = 1
284    
285          self.initcode()          self.initcode()
286    
# Line 337  class IrreguScene: Line 338  class IrreguScene:
338                                    "color" : "0 0 0 0" }                                    "color" : "0 0 0 0" }
339    
340          shape = self.shape          shape = self.shape
341          texscale = 1          texscale = self.texscale
342          linewidth = 2          linewidth = 2
343          refsize = 128          refsize = 128
344          scale_pow = .5          scale_pow = .5
# Line 476  class IrreguScene: Line 477  class IrreguScene:
477              0, 0,              0, 0,
478              slice + Y_COLOR + (self.flags >> 4 & 1) * INSIDE, code, 1.0)              slice + Y_COLOR + (self.flags >> 4 & 1) * INSIDE, code, 1.0)
479    
480          if GL.hasExtension("GL_NV_register_combiners") and 1:          if GL.hasExtension("GL_NV_register_combiners") and 0:
481              self.outer = GLRen.createIrregularEdge(shape,              self.outer = GLRen.createIrregularEdge(shape,
482                  texscale, linewidth, refsize, scale_pow,                  texscale, linewidth, refsize, scale_pow,
483                  border0, border1, texslicing,                  border0, border1, texslicing,
# Line 953  class StillMotionScene: Line 954  class StillMotionScene:
954                                         self.scale * 1)                                         self.scale * 1)
955          vs.matcher.add(cs1, "1")          vs.matcher.add(cs1, "1")
956    
957          for i in range(0,5):          n = 9
958            for i in range(0,n):
959                            
960              cs2 = vs.coords.affineCoordsys(              cs2 = vs.coords.affineCoordsys(
961                  0, 0, self.x1 + .02 * i, self.y1,                  0, 0, self.x1 + .02 * i, self.y1,
# Line 962  class StillMotionScene: Line 964  class StillMotionScene:
964    
965              vs.matcher.add(cs2, "2." + str(i))              vs.matcher.add(cs2, "2." + str(i))
966    
967              alpha = (.2, .4, .6, .8, 1)[i]              alpha = .3 + .7 * i / (n - 1.0)
968              if self.flag:              if self.flag:
969                  self.putedge2(vs, cs1, cs2, alpha)                  self.putedge2(vs, cs1, cs2, alpha)
970              else:              else:
# Line 973  def r(sc, filename): Line 975  def r(sc, filename):
975      vs = w.createVobScene()      vs = w.createVobScene()
976      sc.scene(vs)      sc.scene(vs)
977      w.renderStill(vs, 0)      w.renderStill(vs, 0)
978      saveanim.saveframe(filename, w)      #saveanim.saveframe(filename, w)
979    
980  def makeScreenshots():  def makeScreenshots():
981    
# Line 987  def makeScreenshots(): Line 989  def makeScreenshots():
989      # other parameters are hardcoded      # other parameters are hardcoded
990      # with if's in StillMotionScene class      # with if's in StillMotionScene class
991    
992      if 1:      if 0:
993          w.setLocation(0,0,1024,768)          w.setLocation(0,0,1024,768)
994          ## pre-computed angles          ## pre-computed angles
995          #ps = StillMotionScene(type = "0b", flag = 1)          #ps = StillMotionScene(type = "0b", flag = 1)
# Line 995  def makeScreenshots(): Line 997  def makeScreenshots():
997    
998          #ps = StillMotionScene(type = 0)          #ps = StillMotionScene(type = 0)
999          #r(ps, "shots/motion.png")          #r(ps, "shots/motion.png")
1000          ps = StillMotionScene(type = 1)          ps = StillMotionScene(type = 1, flag = 1)
1001          r(ps, "shots/motion.png")          r(ps, "shots/motion.png")
1002    
1003          #ps = StillMotionScene(type = 0, flag = 1)          #ps = StillMotionScene(type = 0, flag = 1)
# Line 1032  def makeScreenshots(): Line 1034  def makeScreenshots():
1034          ps = ShapeScene(type = 2, outer = 0, border = 2)          ps = ShapeScene(type = 2, outer = 0, border = 2)
1035          r(ps, "shots/shape2Dorig.png")          r(ps, "shots/shape2Dorig.png")
1036    
1037    
1038        if 1:
1039            frame = 0
1040            ps = IrreguScene()
1041            w.setLocation(0,0,1024,768)
1042    
1043            global ripple_scale
1044            ripple_scale = .5
1045    
1046            ps.texscale = 1.2
1047            ps.xs = 1.3
1048            ps.ys = 1.3
1049            ps.shape = 8
1050            ps.texslicing = 1
1051            ps.initcode()
1052    
1053    
1054            N = 600
1055            for i in range(0,N):
1056    
1057                a = i / float(N) * 2 * pi
1058    
1059                #ps.x0 = cos(a)
1060                #ps.y0 = sin(a)
1061                ps.x1 = -cos(a)
1062                ps.y1 = -sin(a)
1063    
1064                if i == N:
1065                    ps.shape = 9
1066                    ripple_scale = .3
1067                    ps.texslicing = 0
1068                    ps.initcode()
1069    
1070                    #global paperquad
1071                    #seed = 201
1072                    #pap = ThePaperMill().getPaper(seed)
1073                    #paperquad = GLRen.createPaperQuad(pap, -4, -4, 4, 4, 0)
1074    
1075                
1076                r(ps, "tmpfilm/irregu%03i.jpg" % frame); frame += 1;
1077    
1078            #saveanim.encodefilm("tmpfilm/irregu\\*.jpg", "irregufilm.avi")
1079    
1080    
1081    
1082  currentScene = IrreguScene()  currentScene = IrreguScene()
1083    
1084  #currentScene = StillMotionScene(type = 1, flag = 1)  #currentScene = StillMotionScene(type = 1, flag = 1)

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

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