[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/psyko.py libpaper/colors.py libpap...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx demo/psyko.py libpaper/colors.py libpap... |
Date: |
Sun, 02 Mar 2003 12:11:16 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 03/03/02 12:11:14
Modified files:
gfx/demo : psyko.py
gfx/libpaper : colors.py papermill.py
Added files:
gfx/util : papersampler.py
Log message:
start papersampler script
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/psyko.py.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/colors.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/papermill.py.diff?tr1=1.74&tr2=1.75&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/papersampler.py?rev=1.1
Patches:
Index: gzz/gfx/demo/psyko.py
diff -u gzz/gfx/demo/psyko.py:1.11 gzz/gfx/demo/psyko.py:1.12
--- gzz/gfx/demo/psyko.py:1.11 Fri Feb 21 15:02:30 2003
+++ gzz/gfx/demo/psyko.py Sun Mar 2 12:11:14 2003
@@ -78,8 +78,7 @@
log("shuffling seed: " + str(seed))
-zoom = [100, 500, 650, 800, 2000]
-paperzoom = [0.05, 0.2, 1, 3]
+zoom = [10, 50, 65, 80, 200]
def globalkey(k):
global currentScene
@@ -93,9 +92,6 @@
loadscenes()
if k == "z":
rotatelist(zoom)
- if k == "x":
- rotatelist(paperzoom)
- AbstractUpdateManager.setNoAnimation()
if k == "t":
retexture();
@@ -115,20 +111,8 @@
""")
def getpaper(seed):
- pap = Paper()
- GL.startContext()
-
- pap.setNPasses(4)
- setSolidPass(pap.getPass(0), (0.1,0.1,0.2))
-
- PaperMill().makePaperPass(seed+48, pap.getPass(1), 0)
- PaperMill().makePaperPass(seed+57, pap.getPass(2), .5)
- PaperMill().makePaperPass(seed+61, pap.getPass(3), .9375)
-
- GL.endContext()
-
- print "Pq: ",seed
- return GLRen.createPaperQuad(pap, -1, -1, 1, 1)
+ pap = ThePaperMill().getPaper(seed)
+ return GLRen.createPaperQuad(pap, -1, -1, 1, 1, 0)
def ignore(s):
@@ -197,12 +181,9 @@
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
- cs1 = vs.coords.affineCoordsys("1", 10, 600, 450, 290, 0, 0, 290)
- scale = zoom[0] / paperzoom[0]
- cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale)
-
- pscale = zoom[0]
-
+ cs1 = vs.affineCS(0, "1", 10, 600, 450, 290, 0, 0, 290)
+ scale = zoom[0]
+ cs2 = vs.affineCS(0, "tex", 1, 400, 400, scale, 0, 0, scale)
print "Seed: ",self.seed," pq ",self.pq
vs.map.put(self.pq, cs1, cs2)
@@ -286,13 +267,10 @@
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
- cs1 = vs.coords.affineCoordsys("1", 10, 300, 450, 290, 0, 0, 290)
- cs1b = vs.coords.affineCoordsys("2", 10, 900, 450, 290, 0, 0, 290)
- scale = zoom[0] / paperzoom[0]
- cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale)
-
- pscale = zoom[0]
-
+ cs1 = vs.affineCS(0, "1", 10, 300, 450, 290, 0, 0, 290)
+ cs1b = vs.affineCS(0, "2", 10, 900, 450, 290, 0, 0, 290)
+ scale = zoom[0]
+ cs2 = vs.affineCS(0, "tex", 1, 400, 400, scale, 0, 0, scale)
print "Seed: ",self.seed1," pq ",self.pq1
print "Seed: ",self.seed2," pq ",self.pq2
@@ -376,12 +354,9 @@
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
- cs1 = vs.coords.affineCoordsys("1", 10, 600, 450, 290, 0, 0, 290)
- scale = zoom[0] / paperzoom[0]
- cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale)
-
- pscale = zoom[0]
-
+ cs1 = vs.affineCS(0, "1", 10, 600, 450, 290, 0, 0, 290)
+ scale = zoom[0]
+ cs2 = vs.affineCS(0, "tex", 1, 400, 400, scale, 0, 0, scale)
print "Seed: ",self.seed," pq ",self.pq
vs.map.put(self.pq, cs1, cs2)
@@ -407,7 +382,7 @@
putnoc(vs, background(self.bgcolor))
if self.message != None:
- cs1 = vs.coords.affineCoordsys("msg", 10, 300, 450, 1, 0, 0, 1)
+ cs1 = vs.affineCS(0, "msg", 10, 300, 450, 100, 0, 0, 100)
putText(vs, cs1, self.message, color=(1,1,1))
return vs
@@ -438,14 +413,14 @@
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
- cs1 = vs.coords.affineCoordsys("txt", 10, 100, 450, 1, 0, 0, 1)
+ cs1 = vs.affineCS(0, "txt", 10, 100, 450, 100, 0, 0, 100)
putText(vs, cs1, "Press 'F1' to start", color=(0,1,0))
- putText(vs, cs1, "seed = " + str(self.seed), color=(0,1,0), y = 100)
+ putText(vs, cs1, "seed = " + str(self.seed), color=(0,1,0), y = 1)
if self.pq != None:
- cs1 = vs.coords.affineCoordsys("1", 10, 800, 450, 290, 0, 0, 290)
- scale = zoom[0] / paperzoom[0]
- cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0,
scale)
+ cs1 = vs.affineCS(0, "1", 10, 800, 450, 290, 0, 0, 290)
+ scale = zoom[0]
+ cs2 = vs.affineCS(0, "tex", 1, 400, 400, scale, 0, 0, scale)
vs.map.put(self.pq, cs1, cs2)
return vs
@@ -458,7 +433,7 @@
if k >= "0" and k <= "9":
if self.seed == None: self.seed = 0
self.seed = self.seed * 10 + int(k)
- if k == "BackSpace":
+ if k == "Backspace":
if self.seed == 0: self.seed = None
if self.seed != None:
self.seed = self.seed / 10
@@ -470,32 +445,6 @@
AbstractUpdateManager.setNoAnimation()
AbstractUpdateManager.chg()
-
-font = None
-def getText(text, x = 0, y = 0, z = 20, w = 1, h = 1):
- global font
- if font == None:
- font = GL.createFont("gfx/fonts/a010013l.pfb", 40)
-
- return GLRen.createHorizText(font, text, x, y, z, w,h)
-
-def putText(vs, cs1, text, color = None, x = 0, y = 0, z = 20, w = 1, h = 1):
- if color != None:
- putnoc(vs, getDListNocoords("Color " + js(color)))
- putnoc(vs, getDListNocoords("""
- PushAttrib ENABLE_BIT
- Enable TEXTURE_2D
- Enable ALPHA_TEST
- Enable BLEND
- BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA
- """))
-
- t = getText(text, x, y, z, w, h)
- vs.map.put(t, cs1)
-
- putnoc(vs, getDListNocoords("""
- PopAttrib
- """))
currentScene = MenuScene()
Index: gzz/gfx/libpaper/colors.py
diff -u gzz/gfx/libpaper/colors.py:1.19 gzz/gfx/libpaper/colors.py:1.20
--- gzz/gfx/libpaper/colors.py:1.19 Fri Feb 21 15:02:33 2003
+++ gzz/gfx/libpaper/colors.py Sun Mar 2 12:11:14 2003
@@ -37,11 +37,11 @@
class Colors:
def _js(self, arg):
return " ".join([str(a) for a in arg])
- def __init__(self, seed):
+ def __init__(self, seed,
+ colors = 8,
+ minlum = 80):
rnd = self.rnd = java.util.Random(seed)
- colors = 8
- minlum = 80
huerange = rnd.nextGaussian() * 90
# Note: This color sampling scheme only produces
@@ -69,9 +69,9 @@
# Take one half dark colors and one half light colors
lumrange = 100 - minlum
lums = ([minlum + rnd.nextDouble() * lumrange/2
- for i in range(0,colors/2)] +
+ for i in range(0,(colors+1)/2)] +
[minlum + (1 + rnd.nextDouble()) * lumrange/2
- for i in range(colors/2,colors)]
+ for i in range((colors+1)/2,colors)]
)
# Sample saturation:
@@ -88,6 +88,9 @@
col = [clampSat(YSTtoRGB(c)) for c in yst]
shuffle(col, rnd.nextDouble)
+
+ #col = [ [.5 + .5*c for c in cc] for cc in col]
+
if dbg:
print "ANGLE=", self._AB_angle(col), "AREA=",
self._AB_area(col)*100
Index: gzz/gfx/libpaper/papermill.py
diff -u gzz/gfx/libpaper/papermill.py:1.74 gzz/gfx/libpaper/papermill.py:1.75
--- gzz/gfx/libpaper/papermill.py:1.74 Fri Feb 21 15:02:33 2003
+++ gzz/gfx/libpaper/papermill.py Sun Mar 2 12:11:14 2003
@@ -113,7 +113,9 @@
self.paperopts = PaperOptions.instance()
self.newpaperopts = OpenGL11_PaperOptions()
- def getPaper(self, seed, passmask=[1,1,1,1,1,1,1]):
+ def getPaper(self, seed, passmask=[1,1,1,1,1,1,1],
+ numcolors = 8,
+ minlum = 80):
pap = PaperHanger()
pap.reg = Registry()
@@ -130,7 +132,7 @@
# XXX: TODO: these could be passed inside the paper object
# (and then the textures, too, would be protected from gc)
- colors = Colors(rng.nextInt())
+ colors = Colors(rng.nextInt(), colors = numcolors, minlum = minlum)
textures = Textures(rng.nextInt())
rootrep = TexGenXYRepeatUnit(rng, scale = 0.3 * scaleFactor)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx demo/psyko.py libpaper/colors.py libpap...,
Janne V. Kujala <=