[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/papertest.py libpaper/texcomb_NV1X.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx demo/papertest.py libpaper/texcomb_NV1X.py |
Date: |
Thu, 03 Oct 2002 12:12:11 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/10/03 12:12:11
Modified files:
gfx/demo : papertest.py
gfx/libpaper : texcomb_NV1X.py
Log message:
Improve papertest UI
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/papertest.py.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texcomb_NV1X.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/papertest.py
diff -c gzz/gfx/demo/papertest.py:1.32 gzz/gfx/demo/papertest.py:1.33
*** gzz/gfx/demo/papertest.py:1.32 Mon Sep 30 07:21:49 2002
--- gzz/gfx/demo/papertest.py Thu Oct 3 12:12:11 2002
***************
*** 2,7 ****
--- 2,9 ----
from java.lang import Math
+ from types import ClassType
+
# A jython test program for papers
# Load using gldemo.py
***************
*** 32,43 ****
if k == "F12":
currentScene = DummyScene()
AbstractUpdateManager.setNoAnimation()
! if k == "F1":
! currentScene = PaperScene()
! AbstractUpdateManager.setNoAnimation()
! if k == "F2":
! currentScene = MultiPaperScene()
! AbstractUpdateManager.setNoAnimation()
if k == "t":
retexture();
if k == "b":
--- 34,41 ----
if k == "F12":
currentScene = DummyScene()
AbstractUpdateManager.setNoAnimation()
! if k in scenebindings.keys():
! setCurrentScene(k)
if k == "t":
retexture();
if k == "b":
***************
*** 214,222 ****
--- 212,239 ----
for i in range(0,self.w*self.h):
self.pq[i] = getpaper(self.seed + i)
+ def mouse(self, ev):
+ if ev.getID() == ev.MOUSE_CLICKED:
+ x,y = ev.getX(), ev.getY()
+
+ print x,y
+ index = 0
+ for box in self.boxes:
+ if (box[0] <= x <= box[2] and
+ box[1] <= y <= box[3]):
+ setCurrentScene("F1")
+ global currentScene
+ currentScene.seed = self.seed + index
+ currentScene.initpaper()
+ index += 1
+
+
def key(self, k):
+ if k >= "0" and k <= "9": self.seed = self.seed * 10 + int(k)
+ if k == "BackSpace" or k == "Backspace": self.seed = self.seed / 10
if k == "v":
self.seed = rng.nextInt(200000000)
+ if k == "v" or k == "Return":
self.initpaper()
AbstractUpdateManager.setNoAnimation()
AbstractUpdateManager.chg()
***************
*** 232,244 ****
cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale/cs1w, 0, 0, scale/cs1h)
vs.matcher.add(cs2, "tex")
cs1 = range(0,self.w*self.h)
for i in range(0,self.w*self.h):
if i >= len(self.pq): break
! cs1[i] = vs.coords.affineCoordsys(0, 100-i,
! (i%self.w+.5)*1200.0/self.w,
! (i/self.w+.5)*900.0/self.h,
! cs1w, 0, 0, cs1h)
vs.matcher.add(cs1[i], str(i))
vs.map.put(self.pq[i], cs1[i], cs2)
--- 249,268 ----
cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale/cs1w, 0, 0, scale/cs1h)
vs.matcher.add(cs2, "tex")
+ self.boxes = []
cs1 = range(0,self.w*self.h)
for i in range(0,self.w*self.h):
if i >= len(self.pq): break
!
! x = (i%self.w+.5)*1200.0/self.w
! y = (i/self.w+.5)*900.0/self.h
!
! self.boxes.append( (x - cs1w, y - cs1h,
! x + cs1w, y + cs1h ) )
!
! cs1[i] = vs.coords.affineCoordsys(0, 100-i, x, y, cs1w, 0, 0,
cs1h)
!
!
vs.matcher.add(cs1[i], str(i))
vs.map.put(self.pq[i], cs1[i], cs2)
***************
*** 321,326 ****
! currentScene = DummyScene()
--- 345,377 ----
! scenebindings = {
! "F1": PaperScene,
! "F2": MultiPaperScene,
! "F12": DummyScene,
! }
!
! def setCurrentScene(k):
! global scenes, currentScene
!
! if not "scenes" in globals().keys(): scenes = {}
!
! # Instantiate if necessary
! if ((not scenes.has_key(k)) or
! scenes[k] == currentScene):
! print "Instantiating new", k, "scene"
! scenes[k] = scenebindings[k]()
! else:
! print "Changing to", k, "scene"
!
! # Set current scene
! currentScene = scenes[k]
! AbstractUpdateManager.setNoAnimation()
! AbstractUpdateManager.chg()
!
!
! setCurrentScene("F12")
!
!
Index: gzz/gfx/libpaper/texcomb_NV1X.py
diff -c gzz/gfx/libpaper/texcomb_NV1X.py:1.14
gzz/gfx/libpaper/texcomb_NV1X.py:1.15
*** gzz/gfx/libpaper/texcomb_NV1X.py:1.14 Mon Sep 30 10:04:26 2002
--- gzz/gfx/libpaper/texcomb_NV1X.py Thu Oct 3 12:12:11 2002
***************
*** 2,7 ****
--- 2,9 ----
# are only two of them.
from gfx.libutil import nvcode
+
+ from gfx.libcolor.spaces import RGBtoLAB
class TransparentCombinerPass:
def setupCode(self, texinputs, colors, rnd, trans = 0):
***************
*** 9,14 ****
--- 11,18 ----
colorbase = rnd.nextInt()
c0, c1, c2, c3 = [ colors.getColorStr(colorbase+i)
for i in range(0,4) ]
+
+ #print [round( RGBtoLAB(map(float, rgb.split()))[0] ) for rgb in
[c0,c1,c2] ]
r0, r1, r2, r3 = [ colors.getNVDP3VecStr(colorbase+i)
for i in range(0,4) ]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx demo/papertest.py libpaper/texcomb_NV1X.py,
Janne V. Kujala <=