[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/irregular2.py demo/xupdf.py libcoo...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz/gfx demo/irregular2.py demo/xupdf.py libcoo... |
Date: |
Fri, 27 Sep 2002 14:22:59 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/09/27 14:22:59
Modified files:
gfx/demo : irregular2.py xupdf.py
gfx/libcoords : Coords.cxx
gfx/librenderables: Renderables.hxx renderables.py
gfx/libutil : effects.py
Log message:
AAAAAAAAAARG. What a bug: the last coordinate system was quietly
ignored. This was very difficult to find -- thank god for the debug framework
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregular2.py.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/xupdf.py.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.hxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.72&tr2=1.73&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/effects.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/irregular2.py
diff -c gzz/gfx/demo/irregular2.py:1.20 gzz/gfx/demo/irregular2.py:1.21
*** gzz/gfx/demo/irregular2.py:1.20 Fri Sep 27 11:37:21 2002
--- gzz/gfx/demo/irregular2.py Fri Sep 27 14:22:59 2002
***************
*** 81,87 ****
#putnoc(vs, getDListNocoords("Translate -1000 -1000 0\nScale 4 4
4\n"))
#cs2 = vs.coords.affineCoordsys(0, 10, self.x1, self.y1, self.xs, 0,
0, self.ys)
! cs2 = vs.coords.affineCoordsys(0, 0, self.x1, self.y1, cos(self.a1),
-sin(self.a1), sin(self.a1), cos(self.a1))
vs.matcher.add(cs2, "2")
cs1 = vs.coords.affineCoordsys(0, 10, 600, 450,
self.scale * 150,
--- 81,88 ----
#putnoc(vs, getDListNocoords("Translate -1000 -1000 0\nScale 4 4
4\n"))
#cs2 = vs.coords.affineCoordsys(0, 10, self.x1, self.y1, self.xs, 0,
0, self.ys)
! cs2 = vs.coords.affineCoordsys(0, 0, self.x1, self.y1,
! self.xs * cos(self.a1), -self.xs * sin(self.a1),
self.ys*sin(self.a1), self.ys*cos(self.a1))
vs.matcher.add(cs2, "2")
cs1 = vs.coords.affineCoordsys(0, 10, 600, 450,
self.scale * 150,
Index: gzz/gfx/demo/xupdf.py
diff -c gzz/gfx/demo/xupdf.py:1.25 gzz/gfx/demo/xupdf.py:1.26
*** gzz/gfx/demo/xupdf.py:1.25 Fri Sep 27 11:37:21 2002
--- gzz/gfx/demo/xupdf.py Fri Sep 27 14:22:59 2002
***************
*** 121,130 ****
class CellPDFView:
def __init__(self, cell):
self.cell = cell
self.content = space.cellTexter.getEnfilade(cell, None)
self.pap = getPDFPapers(self.content)
! self.irregu = IrreguFrame(0.2, 10, 10, # XXX
1)
# Height = always 1.
# Start = always (0,0)
--- 121,132 ----
class CellPDFView:
def __init__(self, cell):
+ self.white = getDListNocoords("Color 1 1 1")
+ self.black = getDListNocoords("Color 0 0 0")
self.cell = cell
self.content = space.cellTexter.getEnfilade(cell, None)
self.pap = getPDFPapers(self.content)
! self.irregu = IrreguFrame(0.2, 2, 1.5, # XXX
1)
# Height = always 1.
# Start = always (0,0)
***************
*** 137,150 ****
papers = self.pap
ph = papers[0][2]
scale = h/ph
! curx = 0
ycoord = 0
# print "x,y for place: ",curx, ycoord
# print papers
grid = 13
corners = (0, 0, papers[0][1], papers[0][2])
! cs2 = vs.coords.affineCoordsys(0, 0,
! 0, 0, 1, 0, 0, 1)
vs.matcher.add(cs2, key+"_p2_")
class PutPapers(java.lang.Runnable):
--- 139,151 ----
papers = self.pap
ph = papers[0][2]
scale = h/ph
! self.curx = 0
ycoord = 0
# print "x,y for place: ",curx, ycoord
# print papers
grid = 13
corners = (0, 0, papers[0][1], papers[0][2])
! cs2 = vs.coords.affineCoordsys(0, 0, 0, 0, 1, 0, 0, 1)
vs.matcher.add(cs2, key+"_p2_")
class PutPapers(java.lang.Runnable):
***************
*** 152,158 ****
for i in range(0, len(papers)):
# create always all cs, gets interpolation better
cs1 = vs.coords.affineCoordsys(cs1into, 100,
! curx, ycoord, scale, 0, 0, scale)
vs.matcher.add(cs1, key+"_p_"+str(i))
if onlypages == None or i in onlypages:
if globalusefancypaper:
--- 153,159 ----
for i in range(0, len(papers)):
# create always all cs, gets interpolation better
cs1 = vs.coords.affineCoordsys(cs1into, 100,
! self.curx, ycoord, scale, 0, 0, scale)
vs.matcher.add(cs1, key+"_p_"+str(i))
if onlypages == None or i in onlypages:
if globalusefancypaper:
***************
*** 163,181 ****
pq = GLRen.createPaperQuad(
papers[i][0], *corners)
vs.map.put(pq, cs1, cs2)
! curx += 1.02 * papers[i][1] * scale
pp = PutPapers()
if cliprect:
! irr = vs.coords.affineCoordsys(0, 0,
! (cliprect[0]+cliprect[2])/2,
! (cliprect[1]+cliprect[3])/2,
! (cliprect[2]-cliprect[0])/2,
! 0, 0,
! (cliprect[3]-cliprect[1])/2)
! vs.map.put(self.irregu.frame, cs1into, irr)
! vs.map.put(self.irregu.content, cs1into, irr)
! print "Irr: ",cliprect
else:
pp.run()
--- 164,187 ----
pq = GLRen.createPaperQuad(
papers[i][0], *corners)
vs.map.put(pq, cs1, cs2)
! self.curx += 1.02 * papers[i][1] * scale
pp = PutPapers()
if cliprect:
! irr = vs.coords.affineCoordsys(0, 0, 0.2, 0.1, 0.90, 0, 0, 0.50)
! # (cliprect[0]+cliprect[2])/2,
! # (cliprect[1]+cliprect[3])/2,
! # (cliprect[2]-cliprect[0])/2,
! # 0, 0,
! # (cliprect[3]-cliprect[1])/2)
! vs.matcher.add(irr, key+"_irr")
! c0 = vs.coords.affineCoordsys(0, 10, 500, 500, 300, 0, 0, 300)
! vs.matcher.add(c0, key+"_c0")
! vs.map.put(self.white)
! vs.map.put(self.irregu.frame, c0, irr)
! vs.map.put(self.black)
! vs.map.put(self.irregu.content, c0, irr)
! print "Irr: ",c0,self.irregu.frame, self.irregu.content
else:
pp.run()
***************
*** 400,405 ****
--- 406,412 ----
class XuPDFScene_PDFZoom:
def __init__(self):
self.mag = [(screensize[1]/2,screensize[1]/2),(screensize[1]*2,20)]
+ self.clip = 1
def key(self, key):
print "Key: ",key
global currentScene
***************
*** 407,412 ****
--- 414,421 ----
currentScene = XuPDFScene_PDFContext()
if key == 'm':
rotatelist(self.mag)
+ if key == 'c':
+ self.clip = not self.clip
def mouse(self, ev):
global globalx, globaly
if ev.getID() == ev.MOUSE_CLICKED:
***************
*** 430,437 ****
cs1_trans = vs.coords.translateXY(cs1_zoom, -globalx, -globaly)
vs.matcher.add(cs1_trans, globalcursor.getId()+"__trans")
globalview.placepapers(vs, cs1_trans,
! cliprect = (-10+globalx, -1+globaly, 10+globalx, 10+globaly))
# placepapers(vs, cs1_trans, globalpap, globalcursor.getId())
--- 439,450 ----
cs1_trans = vs.coords.translateXY(cs1_zoom, -globalx, -globaly)
vs.matcher.add(cs1_trans, globalcursor.getId()+"__trans")
+ if self.clip:
+ clip = (-10+globalx, -1+globaly, 10+globalx, 10+globaly)
+ else:
+ clip = None
globalview.placepapers(vs, cs1_trans,
! cliprect = clip)
# placepapers(vs, cs1_trans, globalpap, globalcursor.getId())
Index: gzz/gfx/libcoords/Coords.cxx
diff -c gzz/gfx/libcoords/Coords.cxx:1.13 gzz/gfx/libcoords/Coords.cxx:1.14
*** gzz/gfx/libcoords/Coords.cxx:1.13 Fri Sep 27 04:15:20 2002
--- gzz/gfx/libcoords/Coords.cxx Fri Sep 27 14:22:59 2002
***************
*** 222,228 ****
DBG(dbg) << "Resized2\n";
cs[0] = new RootCoords();
DBG(dbg) << "setroot\n";
! for(int i=3; i+3<ninds; i+=3) {
DBG(dbg) << "loop "<<i<<"\n";
int parind = params.size();
int tp = inds1[i];
--- 222,228 ----
DBG(dbg) << "Resized2\n";
cs[0] = new RootCoords();
DBG(dbg) << "setroot\n";
! for(int i=3; i+3<=ninds; i+=3) {
DBG(dbg) << "loop "<<i<<"\n";
int parind = params.size();
int tp = inds1[i];
Index: gzz/gfx/librenderables/Renderables.hxx
diff -c gzz/gfx/librenderables/Renderables.hxx:1.13
gzz/gfx/librenderables/Renderables.hxx:1.14
*** gzz/gfx/librenderables/Renderables.hxx:1.13 Wed Sep 25 10:45:43 2002
--- gzz/gfx/librenderables/Renderables.hxx Fri Sep 27 14:22:59 2002
***************
*** 171,186 ****
i += 1;
}
else if(codes[i] & RENDERABLE1) {
- if(dbg) std::cout << "rend1 "<<r1s[code]<<"\n";
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
if(cs1)
r1s[code]->render(*cs1);
i += 2;
}
else if(codes[i] & RENDERABLE2) {
- if(dbg) std::cout << "rend2 "<<r2s[code]<<"\n";
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
Coords::CoordSys *cs2 = coordset.get(codes[i+2]);
if(cs1 && cs2)
r2s[code]->render(*cs1, *cs2);
i += 3;
--- 171,187 ----
i += 1;
}
else if(codes[i] & RENDERABLE1) {
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
+ if(dbg) std::cout << "rend1 "<<r1s[code]<<":
"<<codes[i+1]<<" "<<cs1<<"\n";
if(cs1)
r1s[code]->render(*cs1);
i += 2;
}
else if(codes[i] & RENDERABLE2) {
Coords::CoordSys *cs1 = coordset.get(codes[i+1]);
Coords::CoordSys *cs2 = coordset.get(codes[i+2]);
+ if(dbg) std::cout << "rend2 "<<r2s[code]<<": "
+ <<codes[i+1]<<" "<<cs1<<" "<<codes[i+2]<<"
"<<cs2<<"\n";
if(cs1 && cs2)
r2s[code]->render(*cs1, *cs2);
i += 3;
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.72
gzz/gfx/librenderables/renderables.py:1.73
*** gzz/gfx/librenderables/renderables.py:1.72 Fri Sep 27 11:56:42 2002
--- gzz/gfx/librenderables/renderables.py Fri Sep 27 14:22:59 2002
***************
*** 581,586 ****
--- 581,587 ----
ZPt p = coords2.transform(q);
glMultiTexCoord2f(1, .25 / paperw * p.x + .5, .25 / paperh *
p.y + .5);
coords1.vertex(p);
+ DBG(dbg) << "Vert: " << q<<p<<coords1.transform(p) <<"\\n";
}
""",
"RenderCode" : """
***************
*** 712,863 ****
glPopAttrib();
""",
- "BLAH" : """
- DBG(dbg) << "Irregular quad\\n";
-
- setup();
- GLERR;
-
- CoordSys &cs1inv = *coords1.getInverse();
- CoordSys &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 };
-
- Pt sides[][4] = { // The sides of the rectangle:
- { Pt(-x0, -y2), Pt(-x0, +y2), Pt(-x1, +y2),
Pt(-x1, -y2) },
- { Pt(+x0, -y2), Pt(+x0, +y2), Pt(+x1, +y2),
Pt(+x1, -y2) },
- { Pt(-x2, -y0), Pt(+x2, -y0), Pt(+x2, -y1),
Pt(-x2, -y1) },
- { Pt(-x2, +y0), Pt(+x2, +y0), Pt(+x2, +y1),
Pt(-x2, +y1) },
- // Corners:
- { Pt(+x2, +y0), Pt(+x0, +y2), Pt(+x1, +y2),
Pt(+x2, +y1) },
- { Pt(+x2, -y0), Pt(+x0, -y2), Pt(+x1, -y2),
Pt(+x2, -y1) },
- { Pt(-x2, +y0), Pt(-x0, +y2), Pt(-x1, +y2),
Pt(-x2, +y1) },
- { Pt(-x2, -y0), Pt(-x0, -y2), Pt(-x1, -y2),
Pt(-x2, -y1) }
- };
-
- float m = 1 / sqrt(2);
- Vec trans[][3] = { { -xpix, -ypix, ypix },
- { 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.
- * Smaller number lowers the frequency of the corner pieces
- */
- float texf = 0.5;
-
- glActiveTextureARB(GL_TEXTURE1_ARB);
- 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 / 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();
- glActiveTextureARB(GL_TEXTURE0_ARB);
-
- for (unsigned i = 0; i < sizeof(sides)/sizeof(sides[0]); i++) {
- ZPt tex0 = cs2inv.transform(coords1.transform(lerp(texf,
sides[i][3], sides[i][0])));
- ZPt tex1 = cs2inv.transform(coords1.transform(lerp(texf,
sides[i][2], sides[i][1])));
-
- for (int t = 0; t < (mode ? 3 : 1); t++) {
- if (mode) {
- glPushMatrix();
- glTranslatef(trans[i][t].x, trans[i][t].y, 0);
- }
-
- glBegin(GL_QUADS);
- glSecondaryColor3fEXT(0, 0, 0);
-
- glTexCoord2f(tex0.x, tex0.y);
- coords1.vertex(sides[i][0]);
-
- glTexCoord2f(tex1.x, tex1.y);
- coords1.vertex(sides[i][1]);
-
- glSecondaryColor3fEXT(1, 1, 1);
-
- float w = wtbl[i];
-
- glTexCoord4f(tex1.x * w, tex1.y * w, 0, w);
- coords1.vertex(sides[i][2]);
-
- glTexCoord4f(tex0.x * w, tex0.y * w, 0, w);
- coords1.vertex(sides[i][3]);
-
- glEnd();
- GLERR;
-
- if (mode) glPopMatrix();
- }
- }
-
- 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));
- coords1.vertex(Pt(+x2,+y1));
- coords1.vertex(Pt(-x2,+y1));
-
- coords1.vertex(Pt(-x1,-y2));
- coords1.vertex(Pt(-x1,+y2));
- coords1.vertex(Pt(-x2,+y1));
- coords1.vertex(Pt(-x2,-y1));
-
- coords1.vertex(Pt(+x1,-y2));
- coords1.vertex(Pt(+x1,+y2));
- coords1.vertex(Pt(+x2,+y1));
- coords1.vertex(Pt(+x2,-y1));
- glEnd();
- GLERR;
-
-
- glPopAttrib();
- """,
} ,
{
--- 713,718 ----
Index: gzz/gfx/libutil/effects.py
diff -c gzz/gfx/libutil/effects.py:1.7 gzz/gfx/libutil/effects.py:1.8
*** gzz/gfx/libutil/effects.py:1.7 Fri Sep 27 05:48:17 2002
--- gzz/gfx/libutil/effects.py Fri Sep 27 14:22:59 2002
***************
*** 124,129 ****
--- 124,130 ----
PushAttrib ENABLE_BIT TEXTURE_BIT CURRENT_BIT
Enable ALPHA_TEST
AlphaFunc GREATER 0.0
+ Disable BLEND
ActiveTexture TEXTURE1
BindTexture TEXTURE_2D %s
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx demo/irregular2.py demo/xupdf.py libcoo...,
Tuomas J. Lukka <=