[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende... |
Date: |
Wed, 18 Sep 2002 01:58:09 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/18 01:58:08
Modified files:
gfx/demo : irregular2.py
gfx/librenderables: renderables.py
Log message:
Change corner perturbation directions in IrregularQuad and add paper
height parameter; add more keys to irregu2
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregular2.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregular2.py
diff -c gzz/gfx/demo/irregular2.py:1.10 gzz/gfx/demo/irregular2.py:1.11
*** gzz/gfx/demo/irregular2.py:1.10 Tue Sep 17 10:51:18 2002
--- gzz/gfx/demo/irregular2.py Wed Sep 18 01:58:08 2002
***************
*** 15,46 ****
self.mode = 255
self.combiners = "Enable"
self.initirregu()
self.x1, self.y1 = 600, 450
def initirregu(self):
- w = 2
self.white = getDListNocoords("Color 1 1 1")
self.black = getDListNocoords("Color 0 0 0")
! # Setup texgen for TEXTURE1 so that [-w,w]x[-1,1] in cs2 is mapped
! # into [.25,75]^2 (center box of a 4x4 texture)
! iw = .25 / w
self.mask = getDList("""
- #ActiveTexture TEXTURE1
- #TexGen S TEXTURE_GEN_MODE EYE_LINEAR
- #TexGen S EYE_PLANE %(iw)s 0 0 .5
- #Enable TEXTURE_GEN_S
- #TexGen T TEXTURE_GEN_MODE EYE_LINEAR
- #TexGen T EYE_PLANE 0 .25 0 .5
- #Enable TEXTURE_GEN_T
- #ActiveTexture TEXTURE0
Begin LINE_LOOP
! Vertex -%(w)s -1
! Vertex -%(w)s +1
! Vertex +%(w)s +1
! Vertex +%(w)s -1
End
""" % locals())
--- 15,42 ----
self.mode = 255
self.combiners = "Enable"
+
+ self.border = 0.2
+ self.w, self.h = 2, 1.5
self.initirregu()
+
self.x1, self.y1 = 600, 450
+ self.xs, self.ys = 200, 100
+ self.scale = 1
def initirregu(self):
self.white = getDListNocoords("Color 1 1 1")
self.black = getDListNocoords("Color 0 0 0")
! w = self.w
! h = self.h
self.mask = getDList("""
Begin LINE_LOOP
! Vertex -%(w)s -%(h)s
! Vertex -%(w)s +%(h)s
! Vertex +%(w)s +%(h)s
! Vertex +%(w)s -%(h)s
End
""" % locals())
***************
*** 85,92 ****
""" % (boxtex.getTexId(), tex.getTexId(), self.combiners)
! self.iq = GZZGL.createIrregularQuad(.2, w, 0, code)
! self.iq2 = GZZGL.createIrregularQuad(.2, w, 1, code)
def key(self, k):
if 0: pass
--- 81,88 ----
""" % (boxtex.getTexId(), tex.getTexId(), self.combiners)
! self.iq = GZZGL.createIrregularQuad(self.border, self.w, self.h, 0,
code)
! self.iq2 = GZZGL.createIrregularQuad(self.border, self.w, self.h, 1,
code)
def key(self, k):
if 0: pass
***************
*** 94,117 ****
elif k == "Down": self.y1 += 50
elif k == "Left": self.x1 -= 50
elif k == "Right": self.x1 += 50
elif k == "c":
if self.combiners == "Enable":
self.combiners = "Disable"
else:
self.combiners = "Enable"
self.initirregu()
elif "1" <= k <= "9":
self.mode ^= 1 << (int(k)-1)
! print "mode=", self.mode
pass
def scene(self, vs):
putnoc(vs, background((0.1,0.4,0.5)))
! cs1 = vs.coords.affineCoordsys(0, "1", 10, self.x1, self.y1, 200, 0,
0, 100)
! cs2 = vs.coords.affineCoordsys(0, "2", 10, 600, 450, 150, 32.3,
-14.2, 150)
#vs.map.put(self.mask, cs2)
if self.mode & 1:
putnoc(vs, self.black);
--- 90,133 ----
elif k == "Down": self.y1 += 50
elif k == "Left": self.x1 -= 50
elif k == "Right": self.x1 += 50
+ elif k == "x": self.xs += 50
+ elif k == "X": self.xs -= 50
+ elif k == "y": self.ys += 50
+ elif k == "Y": self.ys -= 50
+ elif k == "+": self.scale += .1
+ elif k == "-": self.scale -= .1
elif k == "c":
if self.combiners == "Enable":
self.combiners = "Disable"
else:
self.combiners = "Enable"
self.initirregu()
+ elif k == "w": self.w += .1; self.initirregu()
+ elif k == "W": self.w -= .1; self.initirregu()
+ elif k == "h": self.h += .1; self.initirregu()
+ elif k == "H": self.h -= .1; self.initirregu()
+ elif k == "b": self.border += .01; self.initirregu()
+ elif k == "B": self.border -= .01; self.initirregu()
elif "1" <= k <= "9":
self.mode ^= 1 << (int(k)-1)
! print "mode=", [ (".","X")[(self.mode >> i) & 1] for i in
range(0, 9) ]
pass
def scene(self, vs):
putnoc(vs, background((0.1,0.4,0.5)))
+ #putnoc(vs, getDListNocoords("Translate -1000 -1000 0\nScale 4 4
4\n"))
! cs1 = vs.coords.affineCoordsys(0, "1", 10, self.x1, self.y1, self.xs,
0, 0, self.ys)
! cs2 = vs.coords.affineCoordsys(0, "2", 10, 600, 450,
! self.scale * 150,
! self.scale * 32.3,
! self.scale * -14.2,
! self.scale * 150)
#vs.map.put(self.mask, cs2)
+
+ if self.mode & 4:
+ vs.map.put(self.mask, cs2)
if self.mode & 1:
putnoc(vs, self.black);
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.41
gzz/gfx/librenderables/renderables.py:1.42
*** gzz/gfx/librenderables/renderables.py:1.41 Tue Sep 17 10:51:18 2002
--- gzz/gfx/librenderables/renderables.py Wed Sep 18 01:58:08 2002
***************
*** 656,668 ****
{
"Type" : "2",
"Name": "IrregularQuad",
! "Data": "float border; float cs2w; int mode; CallGLCode setup;",
"Params" : """
! float border, float cs2w, int mode, String setupcode
""",
"ParamCode" : """
this->border = border;
this->cs2w = cs2w;
this->mode = mode;
setup = CallGLCode(string(setupcode.begin(),
setupcode.end()).c_str());
""",
--- 656,669 ----
{
"Type" : "2",
"Name": "IrregularQuad",
! "Data": "float border; float cs2w, cs2h; int mode; CallGLCode setup;",
"Params" : """
! float border, float cs2w, float cs2h, int mode, String setupcode
""",
"ParamCode" : """
this->border = border;
this->cs2w = cs2w;
+ this->cs2h = cs2h;
this->mode = mode;
setup = CallGLCode(string(setupcode.begin(),
setupcode.end()).c_str());
""",
***************
*** 716,725 ****
{ xpix, -ypix, ypix },
{ -ypix, -xpix, xpix },
{ ypix, -xpix, xpix },
! { m * ( xpix + ypix), m * ( xpix - ypix), m *
(-xpix + ypix) },
! { m * ( xpix - ypix), m * ( xpix + ypix), m *
(-xpix - ypix) },
! { m * (-xpix + ypix), m * (-xpix - ypix), m * (
xpix + ypix) },
! { m * (-xpix - ypix), m * (-xpix + ypix), m * (
xpix - ypix) } };
/* The distance (as a fraction of border) from the square where the
1D texture slice is taken.
--- 717,726 ----
{ xpix, -ypix, ypix },
{ -ypix, -xpix, xpix },
{ ypix, -xpix, xpix },
! { xpix, ypix, m * ( xpix + ypix), /*m * ( xpix -
ypix), m * (-xpix + ypix)*/ },
! { xpix, -ypix, m * ( xpix - ypix), /*m * ( xpix +
ypix), m * (-xpix - ypix)*/ },
! { -xpix, ypix, m * (-xpix + ypix), /*m * (-xpix -
ypix), m * ( xpix + ypix)*/ },
! { -xpix, -ypix, m * (-xpix - ypix), /*m * (-xpix +
ypix), m * ( xpix - ypix)*/ } };
/* The distance (as a fraction of border) from the square where the
1D texture slice is taken.
***************
*** 733,743 ****
if (mode) {
// Make the bounding box 2 pixels larger when drawing the boundary
cs2.x = cs2.x + TWO / cs2w * cs2.x.normalize();
! cs2.y = cs2.y + TWO * cs2.y.normalize();
}
cs2.performGL();
float svec[4] = { .25 / cs2w, 0, 0, .5 };
! float tvec[4] = { 0, .25, 0, .5 };
glTexGenfv(GL_S, GL_EYE_PLANE, svec);
glTexGenfv(GL_T, GL_EYE_PLANE, tvec);
glPopMatrix();
--- 734,744 ----
if (mode) {
// Make the bounding box 2 pixels larger when drawing the boundary
cs2.x = cs2.x + TWO / cs2w * cs2.x.normalize();
! cs2.y = cs2.y + TWO / cs2h * cs2.y.normalize();
}
cs2.performGL();
float svec[4] = { .25 / cs2w, 0, 0, .5 };
! float tvec[4] = { 0, .25 / cs2h, 0, .5 };
glTexGenfv(GL_S, GL_EYE_PLANE, svec);
glTexGenfv(GL_T, GL_EYE_PLANE, tvec);
glPopMatrix();
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/16
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/16
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/Rende..., Janne V. Kujala, 2002/09/17
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/17
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/17
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende...,
Janne V. Kujala <=
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/18
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/26
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/26
- [Gzz-commits] gzz/gfx demo/irregular2.py librenderables/rende..., Janne V. Kujala, 2002/09/28