[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gfx/demo/opengl/culltest.py gfx/libcoords/C...
From: |
Asko Soukka |
Subject: |
[Gzz-commits] gzz gfx/demo/opengl/culltest.py gfx/libcoords/C... |
Date: |
Tue, 29 Oct 2002 10:07:40 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Asko Soukka <address@hidden> 02/10/29 10:07:40
Modified files:
gfx/demo/opengl: culltest.py
gfx/libcoords : Coords.cxx
gzz/gfx/gl : GLVobCoorder.java
gzz/view : pagespanview.py
Log message:
CullinCoordSys: distinct test parent coordsys.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/opengl/culltest.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.47&tr2=1.48&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/pagespanview.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/opengl/culltest.py
diff -u gzz/gfx/demo/opengl/culltest.py:1.1 gzz/gfx/demo/opengl/culltest.py:1.2
--- gzz/gfx/demo/opengl/culltest.py:1.1 Tue Oct 29 05:27:03 2002
+++ gzz/gfx/demo/opengl/culltest.py Tue Oct 29 10:07:40 2002
@@ -33,7 +33,7 @@
self.scale * h/5 * 2)
vs.matcher.add(cs1, "cs1")
- cs1_d = vs.coords.distort(cs1, 0, 0, 1, 1, 1, 0.1)
+ cs1_d = vs.coords.distort(cs1, 0.5, 0.5, 0.5, 0.5, 1, 0.1)
vs.matcher.add(cs1_d, "cs1_d")
cs1_r = vs.coords.rotate(cs1_d, self.rot)
@@ -43,18 +43,20 @@
vs.matcher.add(cs_clip, "cs_clip")
cs_clip_r = vs.coords.rotate(cs_clip, self.clip_rot)
vs.matcher.add(cs_clip_r, "cs_clip_r")
- cs_cull = vs.coords.cull(cs1_r, cs_clip_r)
- vs.matcher.add(cs_cull, "cs_cull")
- cspq = vs.coords.affineCoordsys(cs_cull, 0, 0.5, 0.5,
+ cspq = vs.coords.affineCoordsys(cs1_r, 0, 0.5, 0.5,
0.5, 0, 0,
0.5)
vs.matcher.add(cspq, "cspq")
+ cs_cull = vs.coords.cull(cspq, cs1_r, cs_clip_r)
+ vs.matcher.add(cs_cull, "cs_cull")
+
+
c_vob = gzz.vob.RectBgVob()
c_vob.setBg(java.awt.Color.green)
vs.map.put(c_vob, cs_clip_r)
- vs.map.put(renderable, cspq)
+ vs.map.put(renderable, cs_cull)
def x(self, angle, radius):
return (Math.cos(angle) * radius)
Index: gzz/gfx/libcoords/Coords.cxx
diff -u gzz/gfx/libcoords/Coords.cxx:1.44 gzz/gfx/libcoords/Coords.cxx:1.45
--- gzz/gfx/libcoords/Coords.cxx:1.44 Tue Oct 29 09:09:32 2002
+++ gzz/gfx/libcoords/Coords.cxx Tue Oct 29 10:07:40 2002
@@ -637,7 +637,9 @@
* parents' unit squares do not intersect.
*/
class CullingCoordSys : public CoordSys {
+ CoordSys *testSuper;
CoordSys *clipSuper;
+ protected:
/** Checks if two parallel rectangle intersects.
* "Two rectangles, represented by lower left and upper right points
(p1, p2)
* and (p3, p4), intersects if and only if the conjunction
@@ -653,6 +655,25 @@
DBG(dbg_cull) << "called CullingCoordsys::parallellRectIntersect\n";
DBG(dbg_cull) << "(" << p1.x << "," << p1.y << "), (" << p2.x << ","
<< p2.y << ") <=> ("
<< p3.x << "," << p3.y << "), (" << p4.x << "," << p4.y
<< ")\n";
+
+
+ glLineWidth(1);
+ glColor3f(1, 1, 1);
+ glDisable(GL_TEXTURE_2D);
+ glBegin(GL_LINE_LOOP);
+ glVertex3f(p1.x, p1.y,0);
+ glVertex3f(p1.x, p2.y,0);
+ glVertex3f(p2.x, p2.y,0);
+ glVertex3f(p2.x, p1.y,0);
+ glEnd();
+ glColor3f(1, 0 , 1);
+ glBegin(GL_LINE_LOOP);
+ glVertex3f(p3.x, p3.y,0);
+ glVertex3f(p3.x, p4.y,0);
+ glVertex3f(p4.x, p4.y,0);
+ glVertex3f(p4.x, p3.y,0);
+ glEnd();
+
return (p2.x > p3.x) && (p4.x > p1.x) && (p2.y > p3.y) && (p4.y >
p1.y);
}
@@ -701,7 +722,7 @@
int check_dist;
/** Initializing. */
- check_dist = 30; // XXX
+ check_dist = 100; // XXX Adjusts the scanning frequency.
ZPt o = cs->transform(ZPt(0, 0, 0));
ZPt u = cs->transform(ZPt(1, 1, 0));
@@ -757,14 +778,15 @@
}
public:
CullingCoordSys() : clipSuper(0) { }
- CullingCoordSys(CoordSys *parent, CoordSys *clip)
- : CoordSys(parent), clipSuper(clip) { }
+ CullingCoordSys(CoordSys *parent, CoordSys *test, CoordSys *clip)
+ : CoordSys(parent), testSuper(test), clipSuper(clip) { }
virtual void setSuper(CoordSys **super) {
DBG(dbg_cull) << "called CullingCoordsys::setSuper\n";
CoordSys::setSuper(super);
- this->clipSuper = super[1];
+ this->testSuper = super[1];
+ this->clipSuper = super[2];
}
- enum { NParams = 0, NPrevious = 2, NParents = 2 };
+ enum { NParams = 0, NPrevious = 3, NParents = 3 };
virtual void setParams(float *params) { }
virtual CoordSys *createInverse() {
DBG(dbg_cull) << "called CullingCoordsys::createInverse\n";
@@ -802,9 +824,9 @@
*/
ZPt p1, p2, p3, p4;
- if (super->nonlinearity(ZPt(0.5, 0.5, 0), 1/sqrt(2)) != 0)
- findDistortedBoundingBox(super, p1, p2);
- else findBoundingBox(super, p1, p2);
+ if (testSuper->nonlinearity(ZPt(0.5, 0.5, 0), 1/sqrt(2)) != 0)
+ findDistortedBoundingBox(testSuper, p1, p2);
+ else findBoundingBox(testSuper, p1, p2);
if (clipSuper->nonlinearity(ZPt(0.5, 0.5, 0), 1/sqrt(2)) != 0)
findDistortedBoundingBox(clipSuper, p3, p4);
@@ -940,6 +962,7 @@
if(csind2 <= 0) {
+
if(show1) {
for(int j = 0; j<npars; j++) {
params.push_back(points1[ind1 + j]);
@@ -1038,11 +1061,12 @@
cs[i] = c;
c->setSuper(prev);
c->setParams(&(params[0]) + parind);
+
if (!cs[i]->shouldBeDrawn()) {
DBG(dbg) << "CS should not be drawn... freeing it with
delete.\n";
delete cs[i]; // Must be deleted, because created with "new"
in factories.
cs[i] = NULL;
- }
+ }
}
nextInd:;
}
@@ -1064,4 +1088,5 @@
}
+
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -u gzz/gzz/gfx/gl/GLVobCoorder.java:1.47
gzz/gzz/gfx/gl/GLVobCoorder.java:1.48
--- gzz/gzz/gfx/gl/GLVobCoorder.java:1.47 Tue Oct 29 09:09:32 2002
+++ gzz/gzz/gfx/gl/GLVobCoorder.java Tue Oct 29 10:07:40 2002
@@ -29,7 +29,7 @@
import gzz.client.gl.*;
public class GLVobCoorder extends AffineVobCoorder {
-public static final String rcsid = "$Id: GLVobCoorder.java,v 1.47 2002/10/29
14:09:32 tjl Exp $";
+public static final String rcsid = "$Id: GLVobCoorder.java,v 1.48 2002/10/29
15:07:40 humppake Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
@@ -242,14 +242,19 @@
}
public int cull(int parent, int clip) {
+ return cull(parent, parent, clip);
+ }
+
+ public int cull(int parent, int test, int clip) {
int paramInd = nfloats;
inds[ninds+0] = 10; // culling
inds[ninds+1] = parent;
- inds[ninds+2] = clip;
- inds[ninds+3] = paramInd;
+ inds[ninds+2] = test;
+ inds[ninds+3] = clip;
+ inds[ninds+4] = paramInd;
int was = ninds;
- ninds += 4;
+ ninds += 5;
return was;
}
Index: gzz/gzz/view/pagespanview.py
diff -u gzz/gzz/view/pagespanview.py:1.17 gzz/gzz/view/pagespanview.py:1.18
--- gzz/gzz/view/pagespanview.py:1.17 Tue Oct 29 05:29:57 2002
+++ gzz/gzz/view/pagespanview.py Tue Oct 29 10:07:40 2002
@@ -236,8 +236,9 @@
for i in range(0, len(papers)):
# create always all cs, gets interpolation better
cs1c = vs.coords.affineCoordsys(cs1into, 100,
- self.curx-self.scale, ycoord-self.scale,
- self.scale*2, 0, 0, self.scale*2)
+ self.curx, ycoord,
+ corners[2]*self.scale, 0, 0,
+ corners[3]*self.scale)
vs.matcher.add(cs1c, key+"_pc_"+str(i))
# If cliprect is defined, create coordsys transformation
from
@@ -249,25 +250,28 @@
cliprect[0], cliprect[1],
cliprect[2]-cliprect[0], 0, 0,
cliprect[3]-cliprect[1])
-
vs.matcher.add(clip, key+"_clip_"+str(i))
- cs_cull = vs.coords.cull(cs1c, clip);
+
+ cs1 = vs.coords.affineCoordsys(cs1c, 100, 0, 0,
+ 1.0/corners[2], 0, 0,
1.0/corners[3])
+ vs.matcher.add(cs1, key+"_p_"+str(i))
+
+ cs_cull = vs.coords.cull(cs1, cs1c, clip);
vs.matcher.add(cs_cull, key+"_cull_"+str(i))
- cs1 = vs.coords.affineCoordsys(cs_cull, 100, 0.5, 0.5,
0.5, 0, 0, 0.5)
- vs.matcher.add(cs1, key+"_p_"+str(i))
else:
- cs1 = cs1c
+ cs_cull = vs.coords.affineCoordsys(cs1c, 100, 0.5, 0.5,
0.5, 0, 0, 0.5)
+ vs.matcher.add(cs_cull, key+"_cull_"+str(i))
if onlypages == None or i in onlypages:
if fancy:
pq = GLRen.createPaperQuad(
papers[i][3], *corners)
- vs.map.put(pq, cs1, cs2)
+ vs.map.put(pq, cs_cull, cs2)
else:
- pq = GLRen.createPaperQuadq(
+ pq = GLRen.createPaperQuad(
papers[i][0], *corners)
- vs.map.put(pq, cs1, cs2)
+ vs.map.put(pq, cs_cull, cs2)
self.curx += self.scaledsheetsize[0]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gfx/demo/opengl/culltest.py gfx/libcoords/C...,
Asko Soukka <=