[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo paperbasis.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/demo paperbasis.py |
Date: |
Mon, 16 Sep 2002 02:44:33 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/16 02:44:33
Modified files:
gfx/demo : paperbasis.py
Log message:
Added F4/F5 keys for changing tex0/tex1 texgens; passmask changing
disabled because the texture intersection code uses depth buffer so that
further passes will not work properly
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paperbasis.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/paperbasis.py
diff -c gzz/gfx/demo/paperbasis.py:1.6 gzz/gfx/demo/paperbasis.py:1.7
*** gzz/gfx/demo/paperbasis.py:1.6 Mon Sep 16 02:14:41 2002
--- gzz/gfx/demo/paperbasis.py Mon Sep 16 02:44:33 2002
***************
*** 11,23 ****
if k == "d":
global dbg
dbg = not dbg
if k >= "F5" and k <= "F8":
i = int(k[1]) - 5
global passmask
passmask[i] = not passmask[i]
print passmask
currentScene.initpaper()
!
tex0codes = {
"ALL" : "",
--- 11,24 ----
if k == "d":
global dbg
dbg = not dbg
+ """
if k >= "F5" and k <= "F8":
i = int(k[1]) - 5
global passmask
passmask[i] = not passmask[i]
print passmask
currentScene.initpaper()
! """
tex0codes = {
"ALL" : "",
***************
*** 123,130 ****
rng = java.util.Random()
- x0, y0 = 600, 300
- x1, y1 = 600, 600
class PaperScene:
def __init__(self):
--- 124,129 ----
***************
*** 136,148 ****
self.colseed = 0
self.initpaper()
def initpaper(self):
self.pq = getpaper(self.seed, self.vecseed0, self.vecseed1,
self.colseed)
AbstractUpdateManager.setNoAnimation()
def key(self, k):
global tex0comb,tex1comb,isectcomb
- global x0, y0, x1, y1
oldseed = self.seed
if k == "v":
self.seed = rng.nextInt(2000000000)
--- 135,163 ----
self.colseed = 0
self.initpaper()
+ self.x0, self.y0 = 600, 300
+ self.x1, self.y1 = 600, 450
+ self.texgen0 = TexGenXYRepeatUnit(vecs = [[.5,0], [0,.5]])
+ self.texgen1 = TexGenXYRepeatUnit(vecs = [[.25,.25], [.25,-.25]])
+
+ self.frame = getDList("""
+ Color 0 0 0
+ Disable TEXTURE_2D
+ Disable DEPTH_TEST
+ Begin LINE_LOOP
+ Vertex -1 -1
+ Vertex -1 1
+ Vertex 1 1
+ Vertex 1 -1
+ End
+ """)
+
def initpaper(self):
self.pq = getpaper(self.seed, self.vecseed0, self.vecseed1,
self.colseed)
AbstractUpdateManager.setNoAnimation()
def key(self, k):
global tex0comb,tex1comb,isectcomb
oldseed = self.seed
if k == "v":
self.seed = rng.nextInt(2000000000)
***************
*** 159,168 ****
elif k == "2":
self.colseed = rng.nextInt(2000000000)
self.initpaper()
! elif k == "Up": y0 -= 20
! elif k == "Down": y0 += 20
! elif k == "Left": x0 -= 20
! elif k == "Right": x0 += 20
elif k == "F1":
list = tex0codes.keys()
tex0comb = list[(list.index(tex0comb) + 1) % len(list)]
--- 174,187 ----
elif k == "2":
self.colseed = rng.nextInt(2000000000)
self.initpaper()
! elif k == "F4":
! self.texgen0 = TexGenXYRepeatUnit(rnd=rng)
! elif k == "F5":
! self.texgen1 = TexGenXYRepeatUnit(rnd=rng)
! elif k == "Up": self.y0 -= 20
! elif k == "Down": self.y0 += 20
! elif k == "Left": self.x0 -= 20
! elif k == "Right": self.x0 += 20
elif k == "F1":
list = tex0codes.keys()
tex0comb = list[(list.index(tex0comb) + 1) % len(list)]
***************
*** 187,195 ****
# [0,1] x [0,1] to vertex coords, cs1 is for the first texture unit
# and cs2 for the second
! cs1 = vs.coords.affineCoordsys(0, "1", 10, x0, y0, 200, 0, 0, 200)
! cs2 = vs.coords.affineCoordsys(0, "2", 10, x1, y1, 100, 100, 100, -100)
vs.map.put(self.pq, cs1, cs2)
currentScene = PaperScene()
--- 206,225 ----
# [0,1] x [0,1] to vertex coords, cs1 is for the first texture unit
# and cs2 for the second
! scale = 400
! cs1 = vs.coords.affineCoordsys(0, "1", 10, self.x0, self.y0,
! scale * self.texgen0.vecs[0][0],
! scale * self.texgen0.vecs[1][0],
! scale * self.texgen0.vecs[0][1],
! scale * self.texgen0.vecs[1][1])
! cs2 = vs.coords.affineCoordsys(0, "2", 10, self.x1, self.y1,
! scale * self.texgen1.vecs[0][0],
! scale * self.texgen1.vecs[1][0],
! scale * self.texgen1.vecs[0][1],
! scale * self.texgen1.vecs[1][1])
vs.map.put(self.pq, cs1, cs2)
+ vs.map.put(self.frame, cs1)
+ vs.map.put(self.frame, cs2)
currentScene = PaperScene()