gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz doc/pegboard/201/PEG_201.rst gfx/libcoords/...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz doc/pegboard/201/PEG_201.rst gfx/libcoords/...
Date: Tue, 29 Oct 2002 09:09:33 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/29 09:09:32

Modified files:
        doc/pegboard/201: PEG_201.rst 
        gfx/libcoords  : Coords.cxx Coords.hxx 
        gzz/gfx/gl     : GL.java GLVobCoorder.java 
        gzz/vob        : Box.java OrthoCoorder.java VobCoorder.java 
        test/gzz/gfx/gl: glvobcoorder.test 
        test/tools     : gfx.py 
Added files:
        test/gzz/vob   : vobcoorder.test 

Log message:
        Test which fails for awt

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/201/PEG_201.rst.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.43&tr2=1.44&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.hxx.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/Box.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoCoorder.java.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/VobCoorder.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/glvobcoorder.test.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/vob/vobcoorder.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/tools/gfx.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gzz/doc/pegboard/201/PEG_201.rst
diff -u gzz/doc/pegboard/201/PEG_201.rst:1.3 
gzz/doc/pegboard/201/PEG_201.rst:1.4
--- gzz/doc/pegboard/201/PEG_201.rst:1.3        Mon Oct 28 04:42:48 2002
+++ gzz/doc/pegboard/201/PEG_201.rst    Tue Oct 29 09:09:32 2002
@@ -3,8 +3,8 @@
 =============================================================
 
 :Authors:  Tuomas Lukka
-:Date:     $Date: 2002/10/28 09:42:48 $
-:Revision: $Revision: 1.3 $
+:Date:     $Date: 2002/10/29 14:09:32 $
+:Revision: $Revision: 1.4 $
 :Status:   Incomplete
 
 This META-PEG deals with formatting PEGs.
@@ -14,8 +14,24 @@
 
     - Our own directives?
 
+        RESOLVED: Not yet.
+
     - Should we use urn-5 instead of serial numbers to avoid
       collisions? This could be a nice application.
+
+        RESOLVED: Not. Not human-readable enough. Collisions
+       are resolved by using the names described below instead
+       of serial numbers.
+
+    - What should we say about the issues section?
+
+       RESOLVED: The issues section should contain all the uncertain
+       points of the specification; there should not be questions
+       at any other point. Once an issue is resolved, the resolution
+       and its rationale should be here.
+
+       NOTE: PEGs should not be accepted as long as there are 
+       unresolved issues.
 
 Names
 -----
Index: gzz/gfx/libcoords/Coords.cxx
diff -u gzz/gfx/libcoords/Coords.cxx:1.43 gzz/gfx/libcoords/Coords.cxx:1.44
--- gzz/gfx/libcoords/Coords.cxx:1.43   Tue Oct 29 05:27:03 2002
+++ gzz/gfx/libcoords/Coords.cxx        Tue Oct 29 09:09:32 2002
@@ -920,7 +920,9 @@
        for(int i=1; i<ninds; i+=lastIndSize) {
            DBG(dbg)  << "loop "<<i<<"\n";
            int parind = params.size();
-           int tp = inds1[i];
+
+           int tp = inds1[i] & ~CSFLAGS;
+
            int npars = nparams(tp);
            int nprev = nprevious(tp);
            int ind1;
@@ -946,7 +948,7 @@
                    continue;
                }
            } else {
-               int t2 = inds2[csind2];
+               int t2 = inds2[csind2] & ~CSFLAGS;
                int ind2 = inds2[csind2 + 1 + nprevious(t2)];
                if(t2 == tp) {
                    for(int j = 0; j<npars; j++) {
Index: gzz/gfx/libcoords/Coords.hxx
diff -u gzz/gfx/libcoords/Coords.hxx:1.19 gzz/gfx/libcoords/Coords.hxx:1.20
--- gzz/gfx/libcoords/Coords.hxx:1.19   Tue Oct 29 05:27:03 2002
+++ gzz/gfx/libcoords/Coords.hxx        Tue Oct 29 09:09:32 2002
@@ -11,6 +11,11 @@
     using std::cout;
     using namespace Vec23;
 
+    enum {
+       CSFLAG_ACTIVE = 0x80000000,
+       CSFLAGS = 0xf0000000
+    };
+
     /** A single coordinate system, possibly defined
      * hierarchically through others.
      * <p>
Index: gzz/gzz/gfx/gl/GL.java
diff -u gzz/gzz/gfx/gl/GL.java:1.17 gzz/gzz/gfx/gl/GL.java:1.18
--- gzz/gzz/gfx/gl/GL.java:1.17 Wed Oct 23 10:55:40 2002
+++ gzz/gzz/gfx/gl/GL.java      Tue Oct 29 09:09:32 2002
@@ -84,6 +84,13 @@
        void windowClosed();
     }
 
+    /** Constants to bit-or with coordsys types.
+     */
+    public static final int CSFLAG_ACTIVE = 0x80000000,
+                           CSFLAGS = 0xf0000000;
+
+    
+
     /** Constant for the int array to be passed to
      * C++, or'ed together with the ID, indicating
      * a zero-argument renderable.
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -u gzz/gzz/gfx/gl/GLVobCoorder.java:1.46 
gzz/gzz/gfx/gl/GLVobCoorder.java:1.47
--- gzz/gzz/gfx/gl/GLVobCoorder.java:1.46       Tue Oct 29 05:27:03 2002
+++ gzz/gzz/gfx/gl/GLVobCoorder.java    Tue Oct 29 09:09:32 2002
@@ -29,7 +29,7 @@
 import gzz.client.gl.*;
 
 public class GLVobCoorder extends AffineVobCoorder {
-public static final String rcsid = "$Id: GLVobCoorder.java,v 1.46 2002/10/29 
10:27:03 humppake Exp $";
+public static final String rcsid = "$Id: GLVobCoorder.java,v 1.47 2002/10/29 
14:09:32 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -39,7 +39,13 @@
     int[] inds = new int[5000];
     int ninds = 1; // zero is special (the root)
 
-    public int getCSIndexAt(float x, float y) { return -1; }
+    public void activate(int cs) {
+       inds[cs] |= GL.CSFLAG_ACTIVE;
+    }
+
+    public int getCSAt(int parent, float x, float y, float[] targetcoords) {
+       return -1;
+    }
 
     public int affineCoordsys(
            int into, float depth,
Index: gzz/gzz/vob/Box.java
diff -u gzz/gzz/vob/Box.java:1.4 gzz/gzz/vob/Box.java:1.5
--- gzz/gzz/vob/Box.java:1.4    Mon Oct 28 10:28:18 2002
+++ gzz/gzz/vob/Box.java        Tue Oct 29 09:09:32 2002
@@ -50,11 +50,14 @@
     /** The key used to put the unitcoordsys under whcoordsys.
      */
     static public final Object UNITCOORDSYSKEY = new Object();
+    static public final Object CULLEDCOORDSYSKEY = new Object();
 
+    int cullTo = -1;
 
     VobScene vs;
     float w, h;
     int whcoordsys;
+    int culledwhcoordsys;
     int unitcoordsys;
 
 
@@ -68,10 +71,16 @@
        this.vs = vs;
        this.whcoordsys = whcoordsys;
        this.unitcoordsys = -1;
+       this.culledwhcoordsys = -1;
        this.w = w;
        this.h = h;
     }
 
+    public void setCull(int cull) {
+       this.cullTo = cull;
+    }
+
+
     /** Create the unit square coordsys.
      */
     private void createUnitCoordsys() {
@@ -89,7 +98,14 @@
     /** Return the standardized coordinate system in which 
      * the rectangle (0,w)x(0,h) maps onto the final box.
      */
-    public int getWHCoordsys() { return whcoordsys;}
+    public int getWHCoordsys() { 
+       if(cullTo >= 0) {
+           // XXX Fill in when three-component cull is done
+//         if(culledwhcoordsys < 0) 
+//             culledwhcoordsys = vs.
+       }
+       return whcoordsys;
+    }
     /** Return the unit square coordinate system in which 
      * the rectangle (0,1)x(0,1) maps onto the final box.
      */
Index: gzz/gzz/vob/OrthoCoorder.java
diff -u gzz/gzz/vob/OrthoCoorder.java:1.36 gzz/gzz/vob/OrthoCoorder.java:1.37
--- gzz/gzz/vob/OrthoCoorder.java:1.36  Wed Oct 16 03:46:39 2002
+++ gzz/gzz/vob/OrthoCoorder.java       Tue Oct 29 09:09:32 2002
@@ -28,7 +28,7 @@
  */
 
 public class OrthoCoorder extends VobCoorder {
-public static final String rcsid = "$Id: OrthoCoorder.java,v 1.36 2002/10/16 
07:46:39 tjl Exp $";
+public static final String rcsid = "$Id: OrthoCoorder.java,v 1.37 2002/10/29 
14:09:32 tjl Exp $";
     public static boolean dbg = false;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -128,8 +128,11 @@
         sys.clear(width, height);
     }
 
+    public void activate(int cs) {
+    }
+
     // Stupid implementation...
-    protected int getCSAt(float x, float y, float[] internalcoords) {
+    public int getCSAt(int parent, float x, float y, float[] internalcoords) {
        sys.sorter.sort();
        int[] sorted = sys.sorter.sorted;
        int nsorted = sys.sorter.nsorted;
@@ -139,10 +142,6 @@
                return sorted[i];
        }
        return 0;
-    }
-
-    public int getCSIndexAt(float x, float y) {
-        return getCSAt(x, y, null);
     }
 
     public void renderVobs(DefaultVobMap map, OrthoCoorder interpTo, int[] 
interpList,
Index: gzz/gzz/vob/VobCoorder.java
diff -u gzz/gzz/vob/VobCoorder.java:1.18 gzz/gzz/vob/VobCoorder.java:1.19
--- gzz/gzz/vob/VobCoorder.java:1.18    Tue Oct 15 09:29:19 2002
+++ gzz/gzz/vob/VobCoorder.java Tue Oct 29 09:09:32 2002
@@ -67,13 +67,29 @@
 
 
 
-    abstract public int getCSIndexAt(float x, float y);
-
     abstract public boolean needInterp(VobCoorder interpTo, int[] interpList);
 
     abstract public Vob.RenderInfo getRenderInfo(int csind);
 
     abstract public void dump();
+
+    /** Cause the given coordinate system to be considered when 
+     * getCSAt() is called.
+     */
+    abstract public void activate(int CS);
+    /** Get the topmost activated coordinate system which has parent as a 
primary 
+     * ancestor.
+     * This is defined as follows:
+     * <pre>
+         1) Inverse transform into the coordinate system; in there, clip
+            against the unit square and project to the plane z=0
+
+         2) Transform the projected point back into screen coordinates, making
+            note of the z coordinate.
+           </pre>
+     * @return Coordinate system number, or -1 if none.
+     */
+    abstract public int getCSAt(int parent, float x, float y, float[] 
targetcoords);
 
     /** Transform a point to screen coordinates from the given cs.
      */
Index: gzz/test/gzz/gfx/gl/glvobcoorder.test
diff -u gzz/test/gzz/gfx/gl/glvobcoorder.test:1.15 
gzz/test/gzz/gfx/gl/glvobcoorder.test:1.16
--- gzz/test/gzz/gfx/gl/glvobcoorder.test:1.15  Tue Oct 29 05:29:57 2002
+++ gzz/test/gzz/gfx/gl/glvobcoorder.test       Tue Oct 29 09:09:32 2002
@@ -5,7 +5,6 @@
 
 from gzz.gfx.gl import GLVobCoorder, GL
 from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill
-from jarray import array, zeros
 from test.tools.gfx import *
 
 vs = getvs()
@@ -18,56 +17,20 @@
 vs2 = getvs()
 c2 = vs2.coords
 
-def checkTrans(vs, cs, srclist, dstlist, delta=0, alsoGL = 1):
-    src = array(srclist, 'f')
-    dst = zeros(len(src), 'f')
-    vs.coords.transformPoints3(cs, src, dst)
-    for i in range(0, len(src)):
-       failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, 
dst[i], dstlist[i]]))
-    if alsoGL:
-       for i in range(0, len(src), 3):
-           vs.map.clear()
-           vs.map.put(SolidBgVob(Color.red))
-           d = """
-               Disable TEXTURE_2D
-               Disable BLEND
-               PointSize 3
-               Color 1 1 1
-               Begin POINTS
-               Vertex %s %s %s
-               End
-           """ % (src[i], src[i+1], src[i+2])
-           # print "TEST: ",d
-           vs.map.put(GLCache.getCallListCoorded(d), cs)
-           render(vs)
-           checkNotAvgColor(
-               int(dstlist[i])-1, int(dstlist[i+1])-1,
-               3, 3, (255, 0, 0), delta=50)
-
-           
-
-def checkInterp(vs1, vs2, i, fract, cs, srclist, dstlist, delta=0):
-    src = array(srclist, 'f')
-    dst = zeros(len(src), 'f')
-    failUnless(vs1.coords.transformPoints3_interp(i, vs2.coords, 
-                   fract, 0, cs, src, dst))
-    for i in range(0, len(src)):
-       failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, 
dst[i], dstlist[i]]))
-
+    
 
 def testTransform():
 
     cs1 = c.ortho(0, 5, 10, 15, 0.5, 1)
-    checkTrans(vs, cs1, [0, 0, 0, 1, 1, 1], [10, 15, 5, 10.5, 16, 6])
-
     cs2 = c.scale(0, 2, 3, 4)
-    checkTrans(vs, cs2, [0, 0, 0, 1, 1, 1], [0, 0, 0, 2, 3, 4])
+    cs = c.concat(cs1, cs2)
+    checkTrans(vs, cs, [0, 0, 0, 1, 1, 1, 2, 2, 2], [10, 15, 5, 11, 18, 9, 12, 
21, 13])
+
 
     cs3 = c.distort(0, 0, 0, 0.1, 0.1, 20, 5)
     checkTrans(vs, cs3, [0, 0, 0, 0.001, 0.001, 1], [0, 0, 0, 0.02, 0.02, 1], 
delta=0.00001, alsoGL = 0)
 
-    cs = c.concat(cs1, cs2)
-    checkTrans(vs, cs, [0, 0, 0, 1, 1, 1, 2, 2, 2], [10, 15, 5, 11, 18, 9, 12, 
21, 13])
+
 
     t = c.translate(0, 100, 100)
     r = c.rotate(t, 0)
@@ -78,6 +41,7 @@
 
     cs4 = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)
     cs4clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)
+
     cs4cull = c.cull(cs4, cs4clip)
     checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 
1, 200, 200, 2])
 
Index: gzz/test/tools/gfx.py
diff -u gzz/test/tools/gfx.py:1.5 gzz/test/tools/gfx.py:1.6
--- gzz/test/tools/gfx.py:1.5   Sun Oct 20 05:33:17 2002
+++ gzz/test/tools/gfx.py       Tue Oct 29 09:09:32 2002
@@ -1,3 +1,5 @@
+from jarray import array, zeros
+
 import gzz
 print "Init test.gfx"
 print dir(gzz)
@@ -44,5 +46,30 @@
     raise msg
 
 
-
+def checkTrans(vs, cs, srclist, dstlist, delta=0, alsoGL = 1):
+    """Check that a transformation works a certain way.
+    """
+    src = array(srclist, 'f')
+    dst = zeros(len(src), 'f')
+    vs.coords.transformPoints3(cs, src, dst)
+    for i in range(0, len(src)):
+       failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, 
dst[i], dstlist[i]]))
+    if alsoGL:
+       for i in range(0, len(src), 3):
+           vs.map.clear()
+           vs.map.put(SolidBgVob(Color.red))
+           d = TestSpotVob(src[i], src[i+1], src[i+2])
+           vs.map.put(d, cs)
+           render(vs)
+           checkNotAvgColor(
+               int(dstlist[i])-1, int(dstlist[i+1])-1,
+               3, 3, (255, 0, 0), delta=50)
+
+def checkInterp(vs1, vs2, i, fract, cs, srclist, dstlist, delta=0):
+    src = array(srclist, 'f')
+    dst = zeros(len(src), 'f')
+    failUnless(vs1.coords.transformPoints3_interp(i, vs2.coords, 
+                   fract, 0, cs, src, dst))
+    for i in range(0, len(src)):
+       failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, 
dst[i], dstlist[i]]))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]