[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gfx/demo/fillets.py gfx/demo/gldemo.py doc/...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz gfx/demo/fillets.py gfx/demo/gldemo.py doc/... |
Date: |
Thu, 05 Dec 2002 12:33:53 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/12/05 12:33:52
Modified files:
gfx/demo : fillets.py gldemo.py
Added files:
doc/pegboard/gfxdemos_framework--tjl: peg.rst
gfx/demo : __init__.py
gfx/demo/fillet: __init__.py ambiguity.py oldcode.py util.py
zbuffer.py
gfx/util : __init__.py misc.py
Log message:
Demo restructuring work, peg
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/gfxdemos_framework--tjl/peg.rst?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillets.py.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/gldemo.py.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillet/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillet/ambiguity.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillet/oldcode.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillet/util.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillet/zbuffer.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/misc.py?rev=1.1
Patches:
Index: gzz/gfx/demo/fillets.py
diff -u gzz/gfx/demo/fillets.py:1.11 gzz/gfx/demo/fillets.py:1.12
--- gzz/gfx/demo/fillets.py:1.11 Sun Nov 17 06:04:52 2002
+++ gzz/gfx/demo/fillets.py Thu Dec 5 12:33:52 2002
@@ -1,585 +1,19 @@
-# (c) Tuomas J. Lukka
+#(c): Tuomas J. Lukka
-# Demo fillets
-
-from gzz.impl import *
-from gzz.view import *
-from gzz.gfx.gl import *
-from gzz.media.impl import *
-import gzz
-
-from gfx.libutil import saveanim
-reload(saveanim)
-
-red = (1, 0.2, 0.2)
-green = (0.2, 1, 0.2)
-whitish = (1,1,0.9)
-
-
-def rectangle(rgb):
- return getDList("""
- LineWidth 4
- Color %s %s %s
- Disable TEXTURE_2D
- Begin LINE_LOOP
- Vertex -1 -1
- Vertex -1 1
- Vertex 1 1
- Vertex 1 -1
- End
- """%(rgb))
-
-
-cellTexs = None
-cellTexMasks = None
-connTexMasks = None
-
-cellTexRects = None
-cellTexRectMasks = None
-connSmooths = None
-connSmoothMasks = None
-connSmoothHorizs = None
-connSmoothHorizMasks = None
-
-def texturedquad(texrect, ccoord, eps):
- tex = texrect.getTexId()
- tx0 = texrect.getTexCoord(0, 0+eps)
- tx1 = texrect.getTexCoord(0, 1-eps)
- ty0 = texrect.getTexCoord(1, 0+eps)
- ty1 = texrect.getTexCoord(1, 1-eps)
- return getDList("""
- BindTexture TEXTURE_2D %(tex)s
- Begin QUAD_STRIP
- TexCoord %(tx0)s %(ty0)s
- Vertex -%(ccoord)s -%(ccoord)s
- TexCoord %(tx0)s %(ty1)s
- Vertex -%(ccoord)s %(ccoord)s
- TexCoord %(tx1)s %(ty0)s
- Vertex %(ccoord)s -%(ccoord)s
- TexCoord %(tx1)s %(ty1)s
- Vertex %(ccoord)s %(ccoord)s
- End
- """ % locals())
-
-def initConnTexs():
- global cellTexMasks, connTexMasks
- global cellTexs , cellTexRects, connTexs, connSmooths, connSmoothHorizs
- global cellTexRectMasks, connSmoothMasks, connSmoothHorizMasks
- if cellTexs == None:
- cellTexs, cellTexMasks = [
- [getTex("basalt/gfx/pdlimg/"+mask+"tcell"+str(no)+".png")
- for no in range(0,8)]
- for mask in ("", "mask_")]
-
- eps = 0.02
-
- ceps = 0.04
- ccoord = 1.2 * (1/(1-2*eps)) * (1-2*ceps)
-
- cellTexRects, cellTexRectMasks = [ [texturedquad(
- tex, ccoord, ceps
- ) for tex in texs]
- for texs in (cellTexs, cellTexMasks)]
-
- connTexs, connTexMasks = [
- [getTex("basalt/gfx/pdlimg/"+mask+"tconn"+str(no)+".png")
- for no in range(0,8)]
- for mask in ("", "mask_")]
- w = 0.25
- h = 0.21
- tc = 0.29
-
- connSmooths, connSmoothMasks = [ [GLRen.createSmoothConnector(
- tex, tc, tex, tc,
- -1+w, -1, 1-w, -1,
- -1+w, -1+h, 1-w, -1+h,
- 1-w, 1, -1+w, 1,
- 1-w, 1-h, -1+w, 1-h,
- eps)
- for tex in texs]
- for texs in (connTexs, connTexMasks)]
-
- connSmoothHorizs, connSmoothHorizMasks = [
- [GLRen.createSmoothConnector(
- tex, tc, tex, tc,
- 1, 1-w, 1, -1+w,
- 1-h, 1-w, 1-h, -1+w,
- -1, -1+w, -1, 1-w,
- -1+h, -1+w, -1+h, 1-w,
- eps
- )
- for tex in texs]
- for texs in (connTexs, connTexMasks)]
-
-class AlphaBlendScene2:
- def __init__(self):
- self.ind = 5
- self.rotate = 0
- self.conn = 1
- self.color = 0
- self.movel = 0
- self.polymode = 0
- initConnTexs()
- def key(self, k):
- if k == "t":
- self.ind += 1
- self.ind %= len(cellTexs)
- print "IND NOW: ",self.ind
- elif k == "p":
- self.rotate = 1 - self.rotate
- elif k == "k":
- self.conn = 1 - self.conn
- elif k == "v":
- self.color = 1 - self.color
- elif k == "s":
- self.movel = 1 - self.movel
- elif k == "m":
- self.polymode = 1 - self.polymode
- def scene(self, vs):
- d = w.getSize()
-
- putnoc(vs, getDList("""
- Enable ALPHA_TEST
- AlphaFunc GEQUAL 0.2
- Enable DEPTH_TEST
- Disable BLEND
- Enable TEXTURE_2D
- PushAttrib POLYGON_BIT ENABLE_BIT
- """))
-
- if self.polymode:
- putnoc(vs, getDList("""
- PolygonMode FRONT_AND_BACK LINE
- Disable TEXTURE_2D
- LineWidth 2
- """))
-
- putnoc(vs, background((0.3, 0.2, 0.6)))
-
- s = 400
- sca = 0.4
- coor = vs.matcher.add(vs.coords.affineCoordsys(0, 0, s, s, sca, 0, 0,
sca), "coor")
-
-
- print "ROTATE ",self.rotate
- if self.rotate:
- angle = 90 * self.rotate
- else:
- angle = 0
-
- rot = vs.matcher.add(vs.coords.rotateXYZ(coor, angle, -1, 1, 1), "rot")
-
-
- self.putCells(vs, rot)
-
-
- sca = vs.matcher.add(vs.coords.scale(rot, 1, 1, 0.01), "sca")
-
- vs.map.put(getDList("""
- Enable BLEND
- PushAttrib ENABLE_BIT
- Disable TEXTURE_2D
- BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA
- Color 1 1 1 0.7
- PushMatrix
- Scale 1000 1000 2
- Begin QUAD_STRIP
- Vertex 0.5 1 1000
- Vertex 0.5 -1 1000
- Vertex -1 1 1000
- Vertex -1 -1 1000
- End
- PopMatrix
- PopAttrib
- """), sca)
-
- self.putCells(vs, sca)
-
- putnoc(vs, getDList("""
- PopAttrib
- """))
- return vs
-
- def putCells(self, vs, into):
- wid, h = (600, 600)
- l = 300
- cc=[(vs.matcher.addSub(into,
- vs.coords.ortho(into, d, 0, -2*l, wid/2,
h/2),"foo"+str(d)),
- vs.matcher.addSub(into,
- vs.coords.ortho(into, d, -0.75*wid*self.movel, 2*l, wid/2,
h/2), "bar"+str(d)))
- for d in (600, 800)]
-
- putnoc(vs, getDList("""
- Color 1 1 1
- """))
-
- if self.color:
- putnoc(vs, getDList("""
- Color 1 1 1
- """))
- vs.map.put(cellTexRects[self.ind], cc[1][0])
- vs.map.put(cellTexRects[self.ind], cc[1][1])
-
- if self.conn:
- if self.color:
- putnoc(vs, getDList("""
- Color 1 0.6 0.6
- """))
- putnoc(vs, getDList("""
- PushAttrib DEPTH_BUFFER_BIT
- DepthFunc ALWAYS
- """))
- vs.map.put(connSmooths[self.ind], cc[0][1], cc[0][0])
- putnoc(vs, getDList("""
- PopAttrib
- """))
-
-
-
-
-class AlphaCells:
- def __init__(self):
- initConnTexs()
- self.vert = (connSmoothMasks, connSmooths)
- self.horiz = (connSmoothHorizMasks, connSmoothHorizs)
- self.cells = (cellTexRectMasks, cellTexRects)
-
-
-class ZZScene(AlphaCells):
- def __init__(self):
- obsTrigger = SimpleObsTrigger();
- cellTexter = SimpleVStreamTexter(FakeSpanMaker(),
- Enfilade1DImpl.Enfilade1DImplMaker())
- cellManager = PlainCellManager()
- dimManager = SimpleDim.SimpleDimManager()
- identityManager = DummyIdentityManager()
- space = self.space = gzz.impl.ModularSpace(
- cellTexter, cellManager, dimManager, identityManager, None,
obsTrigger)
- self.cursor = self.space.getHomeCell()
- d1 = self.d1 = space.getDim(space.N())
- d2 = self.d2 = space.getDim(space.N())
-
- self.home = self.space.getHomeCell()
-
- self.initStruct()
-
- self.bgcolor = (0.7, 0.8, 0.6)
-
- AlphaCells.__init__(self)
- def showstruct(self, vs, passno):
- pv = PlainVanishing()
- vc = self.getVanishingClient(vs, passno)
- class SimpleVC(ViewContext):
- def __init__(self, main):
- self.main = main
- def getAccursed(self):
- return self.main.cursor
- def getCursorColors(self, c):
- return None
- def getDims(self):
- return [self.main.d1, self.main.d2]
- def getCursorOffset(self):
- return 0
- def getWindow(self):
- return None
-
- pv.render(vc, SimpleVC(self), 400, 400)
- def getVanishingClient(self, vs, passno):
- ind = self.ind
- return gzz.gfx.gl.GLVanishingClient(vs, 0,
- self.cells[passno][ind],
- self.vert[1][ind],
- self.horiz[1][ind],
- 50, 50)
- def move(self, dim, dir):
- c = self.cursor.s(dim, dir)
- if c != None:
- self.cursor = c
- def key(self, k):
- if k == "Right":
- self.move(self.d1, 1)
- if k == "Left":
- self.move(self.d1, -1)
- if k == "Up":
- self.move(self.d2, -1)
- if k == "Down":
- self.move(self.d2, 1)
- if k == "t":
- self.ind += 1
- self.ind %= len(cellTexs)
- print "IND NOW: ",self.ind
- def scene(self, vs):
- d = w.getSize()
- putnoc(vs, background(self.bgcolor))
-
- putnoc(vs, getDList("""
- Enable ALPHA_TEST
- AlphaFunc GEQUAL 0.2
- Enable DEPTH_TEST
- Disable BLEND
- Enable TEXTURE_2D
- PushAttrib POLYGON_BIT ENABLE_BIT
- """))
-
- for passno in (0,1):
-
- if passno == 0:
- putnoc(vs, getDList("""
- Color %s %s %s
- """ % self.bgcolor))
- else:
- putnoc(vs, getDList("""
- Color 1 1 1
- """))
-
- self.showstruct(vs, passno)
-
- putnoc(vs, getDList("""
- PopAttrib
- """))
- return vs
-
-class NormalZZScene(ZZScene):
- def initStruct(self):
- home = self.home
- d1,d2 = (self.d1, self.d2)
- home.connect(d2, home.N(self.d1).N(self.d2).N(self.d1))
- self.ind = 5
-
-
-class ExpScene(AlphaCells):
- def __init__(self):
- self.cw = 8
- self.ch = 8
- self.jx = 3
- self.jy = 5
- self.dx = 1
- self.zoom = 1
- self.cs = [
- [None for y in range(0, self.ch)] for
- x in range(0, self.cw)]
- self.ind = 1
-
- AlphaCells.__init__(self)
-
- self.bgcolor = (0.8, 0.5, 0.8)
- def putcs(self, vs):
- for x in range(0,self.cw):
- for y in range(0, self.ch):
- self.cs[x][y]=vs.coords.ortho(str(x)+"_"+str(y), 10,
- x + 0.2 , y + 0.2, 0.6, 0.6)
- def key(self, k):
- if k == "s":
- self.dx = 1-self.dx
- if k == "z":
- self.zoom = 1-self.zoom
- if k == "t":
- self.ind += 1
- self.ind %= len(cellTexs)
- print "IND NOW: ",self.ind
- pass
-
- def scene(self, vs):
- d = w.getSize()
- putnoc(vs, background(self.bgcolor))
- self.putcs(vs)
-
- putnoc(vs, getDList("""
- Enable ALPHA_TEST
- AlphaFunc GEQUAL 0.2
- Enable DEPTH_TEST
- DepthFunc LEQUAL
- Disable BLEND
- Enable TEXTURE_2D
- """))
-
- if self.zoom:
- zw = 320
- transaffine(vs, "aff", d.width/2-zw*(self.jx+0.5),
- d.height/2-zw*(self.jy+0.5),
- zw, 0, 0, zw)
- else:
- zw = d.height / self.ch
- transaffine(vs, "aff", 0, 0, zw, 0, 0, zw)
-
- for passno in (0,1):
-
- if passno == 0:
- putnoc(vs, getDList("""
- Color %s %s %s
- """ % self.bgcolor))
- else:
- putnoc(vs, getDList("""
- Color 1 1 1
- """))
-
- for x in range(0,self.cw):
- for y in range(0, self.ch):
- vs.map.put(
- self.cells[passno][self.ind],
- self.cs[x][y]
- )
-
- for x in range(0,self.cw-1):
- for y in range(0, self.ch):
- if self.dx and y == self.jy:
- if x == self.jx:
- continue
- if x == self.jx-1:
- vs.map.put(
- self.horiz[passno][self.ind],
- self.cs[x][y],
- self.cs[x+2][y]
- )
- continue
- vs.map.put(
- self.horiz[passno][self.ind],
- self.cs[x][y],
- self.cs[x+1][y]
- )
-
- for x in range(0,self.cw):
- for y in range(0, self.ch-1):
- if (not self.dx) and x == self.jx:
- if y == self.jy:
- continue
- if y == self.jy-1:
- vs.map.put(
- self.vert[passno][self.ind],
- self.cs[x][y+2],
- self.cs[x][y]
- )
- continue
- vs.map.put(
- self.vert[passno][self.ind],
- self.cs[x][y+1],
- self.cs[x][y],
- )
-
- poptrans(vs, "aff")
-
- return vs
-
-def quad(rgb):
- return getDList("""
- LineWidth 4
- Color %s %s %s
- Disable TEXTURE_2D
- Begin QUADS
- Vertex -1 -1
- Vertex -1 1
- Vertex 1 1
- Vertex 1 -1
- End
- """%(rgb))
-class AmbiScene(AlphaCells):
- def __init__(self):
- AlphaCells.__init__(self)
- self.ind = 5
- self.bgcolor = (0.9, 0.6, 0.6)
- self.shift = 0
- self.fillet = 0
- def key(self, k):
- if k == "s":
- self.shift = 1-self.shift
- if k == "f":
- self.fillet = 1-self.fillet
- AbstractUpdateManager.setNoAnimation()
- def putcells(self, vs, dx):
- d = vs.getSize()
- w = 140
- h = 140
- if self.shift:
- def yshift(y):
- if y == 2: return 150
- return 0
- else: yshift = lambda y : 0
- dy = 1.5
- ctrs = [
- ( d.width / 4.0 * (dx*0.7 + 2) + yshift(y),
- d.height / 4.0 * (y) )
- for y in (2-dy,2,2+dy)]
- cs = []
- for ctr in ctrs:
- coordsys = vs.coords.ortho(0, 20, ctr[0], ctr[1], w/2, h/2)
- vs.matcher.add(coordsys, str(dx)+str(ctr[1]))
- cs.append((coordsys, ctr))
- for c in cs:
- vs.map.put(self.cells[0][self.ind], c[0])
- vs.map.put(self.cells[1][self.ind], c[0])
- return cs
-
- def putLine(self, vs, key, ctr1, ctr2):
- if self.fillet:
- vs.map.put(self.vert[1][self.ind], ctr2[0], ctr1[0])
- else:
- ctr1 = ctr1[1]
- ctr2 = ctr2[1]
- vs.put(getDList("""
- Disable TEXTURE_2D
- Color 0 0 0
- Begin LINE_STRIP
- Vertex 0 0
- Vertex 1 1
- End
- Color 1 1 1
- Enable TEXTURE_2D
- """), key, 30, ctr1[0], ctr1[1], ctr2[0]-ctr1[0], ctr2[1]-ctr1[1])
-
-
- def scene(self, vs):
- d = w.getSize()
- putnoc(vs, background(self.bgcolor))
-
- putnoc(vs, getDList("""
- Enable ALPHA_TEST
- LineWidth 10
- AlphaFunc GEQUAL 0.2
- Enable DEPTH_TEST
- DepthFunc LEQUAL
- Disable BLEND
- Enable TEXTURE_2D
- Color 1 1 1
- """))
-
- cs1 = self.putcells(vs, -1)
- cs2 = self.putcells(vs, 1)
-
- self.putLine(vs, "l1", cs1[0], cs1[2])
-
- self.putLine(vs, "l2", cs2[0], cs2[1])
- self.putLine(vs, "l3", cs2[1], cs2[2])
-
- return vs
+from gfx.demo.fillet import ambiguity, zbuffer
scenes = [
- AmbiScene(),
- AlphaBlendScene2(),
- NormalZZScene(),
- ExpScene(),
- ]
+ ambiguity.Scene(),
+ zbuffer.Scene(),
+]
def globalkey(k):
- print "Globalkey",k
if len(k) == 1 and ord('1') <= ord(k) < ord('1') + len(scenes):
AbstractUpdateManager.setNoAnimation()
global currentScene
currentScene = scenes[ord(k)-ord('1')]
return 1
- if k == "0":
- sc = AlphaBlendScene2()
- vs1 = w.createVobScene()
- vs2 = w.createVobScene()
- sc.scene(vs1)
- sc.key("p")
- sc.scene(vs2)
- s = { "x" : 20, "y" : 20, "w" : 600, "h" : 600 }
- saveanim.savesequence(w, "tmpfilm/frame0.", vs1, vs2, 30, **s)
- saveanim.savesequence(w, "tmpfilm/frame1.", vs2, vs1, 20, **s)
-
- saveanim.encodefilm("tmpfilm/frame\\*", "filletfilm.avi")
-
return 0
-
+
currentScene = scenes[0]
Index: gzz/gfx/demo/gldemo.py
diff -u gzz/gfx/demo/gldemo.py:1.51 gzz/gfx/demo/gldemo.py:1.52
--- gzz/gfx/demo/gldemo.py:1.51 Tue Nov 26 15:18:14 2002
+++ gzz/gfx/demo/gldemo.py Thu Dec 5 12:33:52 2002
@@ -1,3 +1,5 @@
+# (c) Tuomas J. Lukka
+#
# A gl demo framework that can reload the given file at will.
#
# The target size for demos is 1024x768, since that is
@@ -6,7 +8,10 @@
# Our demo animations will also be in that size.
#
# The current screen size can be queried from the vobscene
-# and the user is free to resize the window; demos shouldn't.
+# and the user is free to resize the window; demos shouldn't
+# automatically resize the window.
+#
+# The demos should make an effort to adapt to any window size.
import sys
# Unfortunate debianisms XXX
@@ -26,6 +31,8 @@
import gzz
import traceback
+from gfx.util.misc import *
+
System.setProperty("gzzclient", "gl")
print "ARGV:",sys.argv
@@ -38,192 +45,6 @@
if o in gzz.util.dbg.all:
gzz.util.dbg.option(o,a)
-def background(rgb):
- return gzz.vob.vobs.SolidBgVob(java.awt.Color(float(rgb[0]),
float(rgb[1]), float(rgb[2])))
-
-def texbindcode(texid):
- if texid:
- return "BindTexture TEXTURE_2D %s"%texid
- return ""
-
-def coloredQuad(rgb, texid=None, texcoord1 = 1):
- texcode = texbindcode(texid)
- r,g,b = rgb
- return getDList("""
- PushAttrib TEXTURE_BIT
- """+texcode+"""
- Color %(r)s %(g)s %(b)s
- Begin QUADS
- TexCoord 0 0
- Vertex 0 0
- TexCoord 0 %(texcoord1)s
- Vertex 0 1
- TexCoord %(texcoord1)s %(texcoord1)s
- Vertex 1 1
- TexCoord %(texcoord1)s 0
- Vertex 1 0
- End
- PopAttrib
- """%locals())
-
-def quad(texid=None):
- texcode = texbindcode(texid)
- return getDList("""
- PushAttrib TEXTURE_BIT
- """+texcode+"""
- Begin QUADS
- TexCoord 0 0
- Vertex 0 0
- TexCoord 0 1
- Vertex 0 1
- TexCoord 1 1
- Vertex 1 1
- TexCoord 1 0
- Vertex 1 0
- End
- PopAttrib
- """)
-
-def partialquad(x0, y0, x1, y1, texid = None):
- texcode = texbindcode(texid)
- return getDList("""
- PushAttrib TEXTURE_BIT
- """+texcode+"""
- Begin QUADS
- TexCoord %(x0)s %(y0)s
- Vertex -1 -1
- TexCoord %(x0)s %(y1)s
- Vertex -1 1
- TexCoord %(x1)s %(y1)s
- Vertex 1 1
- TexCoord %(x1)s %(y0)s
- Vertex 1 -1
- End
- PopAttrib
- """ % locals())
-
-textstyle = None
-
-def getText(text):
- global textstyle
- if not textstyle:
- textstyle = GLTextStyle.create("sans", 0, 1)
- return TextVob(textstyle, text, 1)
-
-def putText(vs, cs1, text, color = None, x = 0, y = 0, z = 0, h = 1, key =
None):
- if color != None:
- putnoc(vs, getDListNocoords("Color " + js(color)))
- putnoc(vs, getDListNocoords("""
- PushAttrib ENABLE_BIT
- Disable ALPHA_TEST
- Disable DEPTH_TEST
- Enable TEXTURE_2D
- Enable BLEND
- BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA
- """))
-
- t = getText(text)
-
- cs = vs.coords.ortho(cs1, z, x, y-h, h, h)
- vs.matcher.addSub(cs1, cs, key or str(text))
-
- vs.map.put(t, cs)
-
- putnoc(vs, getDListNocoords("""
- PopAttrib
- """))
-
-
-def js(list):
- return " ".join([str(el) for el in list])
-
-def rotatelist(list):
- list.append(list.pop(0))
-
-def getDList(s):
- return GLCache.getCallListCoorded(s)
-
-def getDListNocoords(s):
- return GLCache.getCallList(s)
-
-imgs = { }
-texs = { }
-def getTex(s):
- global w
- if not imgs.has_key(s):
- print "Load image ",s
- imgs[s] = GL.createImage(s)
- texs[s] = GL.createTexRect(imgs[s])
- return texs[s]
-
-if not locals().has_key("textures"):
- textures = {}
-
-def retexture():
- global textures
- textures = {}
-
-# XXX naming
-def getTexture(*args):
- key = str(args)
- if not textures.has_key(key):
- textures[key] = GL.createTexture()
- print "Generating texture: ", args
- res = textures[key].shade(*args)
- print "SHADER: ", res
- return textures[key]
-
-
-
-def floats(start, end, n):
- return [float(x) * (end-start) / n + start
- for x in range(0,n+1)]
-def putAffine(vs, vob, key, d, x, y, xx, xy, yx, yy):
- cs = vs.coords.affineCoordsys(key,
- 0, x, y, xx, xy, yx, yy)
- vs.map.put(vob, cs)
-
-transmap = { }
-
-transpush = None
-
-def transaffine(vs, key, x, y, xx, xy, yx, yy):
- cs = vs.coords.affineCoordsys(key,
- 0, x, y, xx, xy, yx, yy)
- global transpush
- if transpush == None:
- transpush = GLRen.createGLTransformPush1()
- vs.map.put(transpush, cs)
- transmap[key] = cs
-
-rotatepush = None
-
-def rotate(vs, key, angle, x, y, z):
- cs = vs.coords.affineCoordsys(key,
- 0, angle, x, y, 0, 0, z)
- global rotatepush
- if rotatepush == None:
- rotatepush = GLRen.createGLTransformRotatePush()
- vs.map.put(rotatepush, cs)
- transmap[key] = cs
-
-expscalepush = None
-def expscale(vs, key, scale):
- cs = vs.coords.affineCoordsys(key,
- scale, 0, 0, 0, 0, 0, 0)
- global expscalepush
- if expscalepush == None:
- expscalepush = GLRen.createGLExpScalePush()
- vs.map.put(expscalepush, cs)
- transmap[key] = cs
-
-
-def poptrans(vs, key):
- vs.map.put(getDList("PopMatrix\n"), transmap[key])
-
-def putnoc(vs, noc):
- vs.put(noc, "NOCKEY", 10, 0, 0, 1, 1)
-
currentScene = None
@@ -307,10 +128,10 @@
# b = Bindings()
# w.registerBinder(b)
# def
+
class Show(AbstractShower):
def generate(self):
# print "GENERATE"
- vs = w.createVobScene()
if not currentScene:
print "No scene\n"
return vs
@@ -319,6 +140,7 @@
vs = replacingScene
replacingScene = None
else:
+ vs = w.createVobScene()
currentScene.scene(vs)
return vs
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gfx/demo/fillets.py gfx/demo/gldemo.py doc/...,
Tuomas J. Lukka <=