[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: |
Tue, 17 Sep 2002 10:51:19 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/17 10:51:18
Modified files:
gfx/demo : irregular2.py
gfx/librenderables: renderables.py
Log message:
IrregularQuad border now works; only some glitches where the octagon's
sides meet (where the direction of perturbations change)
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregular2.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregular2.py
diff -c gzz/gfx/demo/irregular2.py:1.9 gzz/gfx/demo/irregular2.py:1.10
*** gzz/gfx/demo/irregular2.py:1.9 Tue Sep 17 10:43:17 2002
--- gzz/gfx/demo/irregular2.py Tue Sep 17 10:51:18 2002
***************
*** 19,25 ****
self.x1, self.y1 = 600, 450
def initirregu(self):
! w = 1
self.white = getDListNocoords("Color 1 1 1")
self.black = getDListNocoords("Color 0 0 0")
--- 19,25 ----
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")
***************
*** 28,41 ****
# 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
--- 28,41 ----
# 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
***************
*** 55,68 ****
TexImage2D TEXTURE_2D 0 ALPHA 4 4 0 ALPHA 0 0 0 0 0 1 1 0 0 1
1 0 0 0 0 0
TexParameter TEXTURE_2D TEXTURE_BASE_LEVEL 0
TexParameter TEXTURE_2D TEXTURE_MAX_LEVEL 0
! #TexParameter TEXTURE_2D TEXTURE_WRAP_S CLAMP
! #TexParameter TEXTURE_2D TEXTURE_WRAP_T CLAMP
TexParameter TEXTURE_2D TEXTURE_MIN_FILTER NEAREST
TexParameter TEXTURE_2D TEXTURE_MAG_FILTER NEAREST
! TexGen S TEXTURE_GEN_MODE OBJECT_LINEAR
Enable TEXTURE_GEN_S
! TexGen T TEXTURE_GEN_MODE OBJECT_LINEAR
Enable TEXTURE_GEN_T
ActiveTexture TEXTURE0
--- 55,68 ----
TexImage2D TEXTURE_2D 0 ALPHA 4 4 0 ALPHA 0 0 0 0 0 1 1 0 0 1
1 0 0 0 0 0
TexParameter TEXTURE_2D TEXTURE_BASE_LEVEL 0
TexParameter TEXTURE_2D TEXTURE_MAX_LEVEL 0
! TexParameter TEXTURE_2D TEXTURE_WRAP_S CLAMP
! TexParameter TEXTURE_2D TEXTURE_WRAP_T CLAMP
TexParameter TEXTURE_2D TEXTURE_MIN_FILTER NEAREST
TexParameter TEXTURE_2D TEXTURE_MAG_FILTER NEAREST
! TexGen S TEXTURE_GEN_MODE EYE_LINEAR
Enable TEXTURE_GEN_S
! TexGen T TEXTURE_GEN_MODE EYE_LINEAR
Enable TEXTURE_GEN_T
ActiveTexture TEXTURE0
***************
*** 85,92 ****
""" % (boxtex.getTexId(), tex.getTexId(), self.combiners)
! self.iq = GZZGL.createIrregularQuad(.2, 0, code)
! self.iq2 = GZZGL.createIrregularQuad(.2, 1, code)
def key(self, k):
if 0: pass
--- 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
***************
*** 111,117 ****
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);
--- 111,117 ----
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);
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.40
gzz/gfx/librenderables/renderables.py:1.41
*** gzz/gfx/librenderables/renderables.py:1.40 Tue Sep 17 09:13:38 2002
--- gzz/gfx/librenderables/renderables.py Tue Sep 17 10:51:18 2002
***************
*** 656,667 ****
{
"Type" : "2",
"Name": "IrregularQuad",
! "Data": "float border; int mode; CallGLCode setup;",
"Params" : """
! float border, int mode, String setupcode
""",
"ParamCode" : """
this->border = border;
this->mode = mode;
setup = CallGLCode(string(setupcode.begin(),
setupcode.end()).c_str());
""",
--- 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());
""",
***************
*** 680,701 ****
AffineCoords cs1inv = coords1.getInverse();
AffineCoords cs2inv = coords2.getInverse();
- Vec xvec = coords1.transform(Vec(1,0));
- Vec yvec = coords1.transform(Vec(0,1));
-
// Normalize unit vectors inside coords2 to get border widths
! float bx = border *
cs1inv.transform(coords2.transform(cs2inv.transform(xvec).normalize())).length();
! float by = border *
cs1inv.transform(coords2.transform(cs2inv.transform(yvec).normalize())).length();
! Vec xpix = xvec.normalize()*2;
! Vec ypix = yvec.normalize()*2;
!
! const float x0 = 1;
! const float x1 = 1 - bx;
! const float x2 = 1 - 2 * bx;
! const float y0 = 1;
! const float y1 = 1 - by;
! const float y2 = 1 - 2 * by;
! const float w = .5;
// scale of last two vertices of sides
float wtbl[] = { 1, 1, 1, 1, w, w, w, w };
--- 681,700 ----
AffineCoords cs1inv = coords1.getInverse();
AffineCoords cs2inv = coords2.getInverse();
// Normalize unit vectors inside coords2 to get border widths
! float bx = border *
cs1inv.transform(coords2.transform(cs2inv.transform(coords1.x).normalize())).x;
! float by = border *
cs1inv.transform(coords2.transform(cs2inv.transform(coords1.y).normalize())).y;
! const float TWO = 2;
! Vec xpix = coords1.x.normalize()*TWO;
! Vec ypix = coords1.y.normalize()*TWO;
!
! float x0 = 1;
! float x1 = 1 - bx;
! float x2 = 1 - 2 * bx;
! float y0 = 1;
! float y1 = 1 - by;
! float y2 = 1 - 2 * by;
! float w = .5;
// scale of last two vertices of sides
float wtbl[] = { 1, 1, 1, 1, w, w, w, w };
***************
*** 729,738 ****
float texf = 0.5;
glActiveTexture(GL_TEXTURE1);
! float svec[4] = { cs2inv.x.x*.25, cs2inv.y.x*.25, 0,
cs2inv.center.x*.25+.5 };
! float tvec[4] = { cs2inv.x.y*.25, cs2inv.y.y*.25, 0,
cs2inv.center.y*.25+.5 };
! glTexGenfv(GL_S, GL_OBJECT_PLANE, svec);
! glTexGenfv(GL_T, GL_OBJECT_PLANE, tvec);
glActiveTexture(GL_TEXTURE0);
for (unsigned i = 0; i < sizeof(sides)/sizeof(sides[0]); i++) {
--- 728,746 ----
float texf = 0.5;
glActiveTexture(GL_TEXTURE1);
! glPushMatrix();
! AffineCoords cs2 = coords2;
! 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();
glActiveTexture(GL_TEXTURE0);
for (unsigned i = 0; i < sizeof(sides)/sizeof(sides[0]); i++) {
***************
*** 774,786 ****
glDisable(GL_REGISTER_COMBINERS_NV);
glDisable(GL_TEXTURE_2D);
! for (int t = 0; t < (mode ? 4 : 1); t++) {
! if (mode) {
! glPushMatrix();
! Vec trans = ((t & 1) ? xpix : -xpix) + ((t & 2) ? ypix :
-ypix);
! glTranslatef(trans.x, trans.y, 0);
! }
!
glBegin(GL_QUADS);
coords1.vertex(Pt(-x2,-y1));
coords1.vertex(Pt(+x2,-y1));
--- 782,802 ----
glDisable(GL_REGISTER_COMBINERS_NV);
glDisable(GL_TEXTURE_2D);
! // The inside octagon needs to be drawn for the border, too,
! // because of cs2-clipping
!
! // Draw the inside two pixels larger when drawing the border
! // Note: the two pixels are only visible when the ripple function
! // clamps against the inside octagon
! if (mode) {
! float dx = cs1inv.transform(xpix).x;
! float dy = cs1inv.transform(ypix).y;
! x1 += dx;
! x2 += dx;
! y1 += dy;
! y2 += dy;
! }
!
glBegin(GL_QUADS);
coords1.vertex(Pt(-x2,-y1));
coords1.vertex(Pt(+x2,-y1));
***************
*** 799,806 ****
glEnd();
GLERR;
- if (mode) glPopMatrix();
- }
glPopAttrib();
""",
--- 815,820 ----
- [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 <=
- [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/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