[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/fisheye.py librenderables/renderab...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx demo/fisheye.py librenderables/renderab... |
Date: |
Thu, 12 Sep 2002 10:52:28 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/12 10:52:27
Modified files:
gfx/demo : fisheye.py
gfx/librenderables: renderables.py
Log message:
Fisheye changes: make the bulge sharper, add magnification as cs2
origin z distance, add an option of displaying an image over the paper ("p")
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fisheye.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/fisheye.py
diff -c gzz/gfx/demo/fisheye.py:1.3 gzz/gfx/demo/fisheye.py:1.4
*** gzz/gfx/demo/fisheye.py:1.3 Wed Sep 11 09:44:54 2002
--- gzz/gfx/demo/fisheye.py Thu Sep 12 10:52:27 2002
***************
*** 2,18 ****
execfile("gfx/libpaper/papermill.py")
def getfisheyepaper(seed):
pap = ThePaperMill().getPaper(seed)
- #print "Pq: ",seed
- return GZZGL.createFisheyePaperQuad(pap, -1, -1, 1, 1)
bx = 600
by = 450
! bs = .15
ba = 0
bl = 0
rng = java.util.Random()
--- 2,77 ----
execfile("gfx/libpaper/papermill.py")
+
+ pdfimg =
"mstmpimg/0000000008000000E9377484930004EE0856BC11F38551006325788A14C474081350DF47A8280C-144-1"
+ pdftex = None
+ showpdf = 0
+
+ def globalkey(k):
+ global benchmark
+ global currentScene
+ if k == "d":
+ global dbg
+ dbg = not dbg
+
+
+ def addpdftex(pap):
+ passno = pap.getNPasses()
+ pap.setNPasses(passno + 1)
+ ppass = pap.getPass(passno)
+
+ global pdftex
+ if pdftex == None:
+ pdftex = getTex(pdfimg)
+ texid = pdftex.getTexId()
+
+ ppass.setSetupcode("""
+ PushAttrib ENABLE_BIT TEXTURE_BIT
+ ActiveTexture TEXTURE0
+ Enable BLEND
+ BlendFunc ZERO SRC_COLOR
+ Disable DEPTH_TEST
+ Color 1 1 1
+ Enable TEXTURE_2D
+ Disable ALPHA_TEST
+
+ BindTexture TEXTURE_2D %(texid)s
+ TexParameter TEXTURE_2D TEXTURE_WRAP_S REPEAT
+ TexParameter TEXTURE_2D TEXTURE_WRAP_T REPEAT
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ """ % locals())
+
+ ppass.setTeardowncode("""
+ PopAttrib
+ """)
+
+ ppass.setNTexGens(1)
+ ppass.putNormalTexGen(0, [.2,0,0,.25,
+ 0,.2,0,.2,
+ 0,0,1,0,
+ 0,0,0,1])
+
+
+
+
def getfisheyepaper(seed):
pap = ThePaperMill().getPaper(seed)
+ global showpdf
+ if showpdf:
+ addpdftex(pap)
+
+ pfq = GZZGL.createFisheyePaperQuad(pap, -1, -1, 1, 1)
+
+ return pfq
bx = 600
by = 450
! bs = .2
ba = 0
bl = 0
+ bm = 2
rng = java.util.Random()
***************
*** 22,53 ****
self.seed = 0
self.initpaper()
def initpaper(self):
self.fpq = getfisheyepaper(self.seed);
def key(self, k):
! global bx, by, bs, ba, bl
if k == "Up": by -= 100
elif k == "Down": by += 100
elif k == "Left": bx -= 100
elif k == "Right": bx += 100
! elif k == "+": bs += .05
! elif k == "-": bs -= .05
! elif k == "a": ba += .2
! elif k == "A": ba -= .2
! elif k == "l": bl += .1
! elif k == "L": bl -= .1
elif k == "v":
self.seed = rng.nextInt(2000000000)
self.initpaper()
AbstractUpdateManager.setNoAnimation()
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
cs1 = vs.coords.affineCoordsys(0, "1", 10, 600, 450, 400, 0, 0, 400)
! cs2 = vs.coords.affineCoordsys(0, "2", 10, bx, by,
400 * bs * math.exp(+bl) *
math.cos(ba),
400 * bs * math.exp(+bl) *
math.sin(ba),
400 * bs * math.exp(-bl)
*-math.sin(ba),
--- 81,121 ----
self.seed = 0
self.initpaper()
+ self.renderPaper = 1
+
def initpaper(self):
self.fpq = getfisheyepaper(self.seed);
def key(self, k):
! global bx, by, bs, ba, bl, bm
if k == "Up": by -= 100
elif k == "Down": by += 100
elif k == "Left": bx -= 100
elif k == "Right": bx += 100
! elif k == "+": bs += .05; print "bs ", bs
! elif k == "-": bs -= .05; print "bs ", bs
! elif k == "a": ba += .2; print "ba ", ba
! elif k == "A": ba -= .2; print "ba ", ba
! elif k == "l": bl += .1; print "bl ", bl
! elif k == "L": bl -= .1; print "bl ", bl
! elif k == "m": bm += .5; print "bm ", bm
! elif k == "M": bm -= .5; print "bm ", bm
elif k == "v":
self.seed = rng.nextInt(2000000000)
self.initpaper()
AbstractUpdateManager.setNoAnimation()
+ elif k == "p":
+ global showpdf
+ showpdf = not showpdf
+ self.initpaper()
+ AbstractUpdateManager.setNoAnimation()
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
cs1 = vs.coords.affineCoordsys(0, "1", 10, 600, 450, 400, 0, 0, 400)
! cs2 = vs.coords.affineCoordsys(0, "2", 10 - bm, bx, by,
400 * bs * math.exp(+bl) *
math.cos(ba),
400 * bs * math.exp(+bl) *
math.sin(ba),
400 * bs * math.exp(-bl)
*-math.sin(ba),
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.21
gzz/gfx/librenderables/renderables.py:1.22
*** gzz/gfx/librenderables/renderables.py:1.21 Wed Sep 11 09:18:16 2002
--- gzz/gfx/librenderables/renderables.py Thu Sep 12 10:52:27 2002
***************
*** 488,498 ****
ZPt pos = coords1.transform(Pt(x,y));
float a = b0.dot(pos - borig);
float b = b1.dot(pos - borig);
// Modulate distance from coords2 origin
! float m = 1 + 2.0 / (1 + a * a + b * b);
! coords2.vertex(Pt(m*a, m*b));
}
}
glEnd();
--- 488,500 ----
ZPt pos = coords1.transform(Pt(x,y));
float a = b0.dot(pos - borig);
float b = b1.dot(pos - borig);
+ float c = pos.z - borig.z;
// Modulate distance from coords2 origin
! float t = (1 + a * a + b * b);
! float m = 1 + c / (t * t);
! coords2.vertex(ZPt(m*a, m*b, c));
}
}
glEnd();