gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO Documentation/VISION gfx/libcoords/C...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO Documentation/VISION gfx/libcoords/C...
Date: Sun, 03 Nov 2002 13:28:16 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/11/03 13:28:16

Modified files:
        .              : TODO 
        Documentation  : VISION 
        gfx/libcoords  : Coords.cxx 
        gfx/librenderables: renderables.py 
        gfx/libutil    : effects.py 
        gzz/gfx/gl     : GLVobCoorder.java 
        gzz/modules/pp : PPView2.java PlaneView.java demotest.py 
        gzz/modules/pp/vob: BgVob.java 
        gzz/view       : CoordinatePlaneView.java 
                         TextCellContentView.java 
        test/gzz/gfx/gl: glvobcoorder.test 

Log message:
        More pp work: border, drawing the text items

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.355&tr2=1.356&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Documentation/VISION.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.47&tr2=1.48&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.125&tr2=1.126&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/effects.py.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPView2.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PlaneView.java.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/vob/BgVob.java.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CoordinatePlaneView.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/glvobcoorder.test.diff?tr1=1.19&tr2=1.20&r1=text&r2=text

Patches:
Index: gzz/Documentation/VISION
diff -u gzz/Documentation/VISION:1.8 gzz/Documentation/VISION:1.9
--- gzz/Documentation/VISION:1.8        Tue Oct 29 14:55:36 2002
+++ gzz/Documentation/VISION    Sun Nov  3 13:28:16 2002
@@ -22,6 +22,21 @@
 
 Computers should be easy to use but powerful.
 
+Demos
+    - To get funding, show off what we do etc, we need to make
+      showy demos every once in a while.
+
+      One REALLY important point is that with us, these are never
+      only demos or mockups; there's always real functionality there.
+      When preparing the demo, keep in mind at all times that the
+      code being made should be as useful as possible. For example, in 
+      fall 2002, we have converted to the hierarchical coordinate systems,
+      created the irregularframe code etc. all in response to demo needs.
+      The code created for the demos has shown itself to be really useful.
+
+      We don't build cardboard movie sets, we build real houses and then 
+      shoot the movie there. Afterwards, people can live there.
+
 ---- Main areas (all strongly interrelated):
 
 User interfaces
Index: gzz/TODO
diff -u gzz/TODO:1.355 gzz/TODO:1.356
--- gzz/TODO:1.355      Sun Nov  3 07:03:07 2002
+++ gzz/TODO    Sun Nov  3 13:28:16 2002
@@ -55,6 +55,11 @@
        - when a gl window is closed, call Binder.windowClosed()
     mudyc:
        - PP [deadline 5.11]
+           - CullingCellInBox filter: 
+             CellInBox which is created with another CellInBox and
+             simply forwards the calls, except that it culls the boxes
+             against a given coordinate system.
+             Ask humppake about culling.
             -something small for monday evening?
        - make a trivial texcomb_GL11.py (using OpenGL 1.1 
          functionality) in gfx/libpaper
@@ -96,15 +101,15 @@
        + new PEG for bubbleview, with some sketches
     tjl:        
        - PP [deadline 5.11]
-           - help mudyc with String[] to renderable passing
            - refactor
                - implement using the new gzz.view classes
+                   - panning
+                   - buoys
+                   - hopping to buoy - keying, animation
            - make it work again
                - bindings
                - mouse click coordinates
-           - scale irregu border right (bound to bg)
            - images
-           - CullingCellInBox
            - nadir
            - fix directory geometry
            - HOME button
@@ -116,13 +121,6 @@
            - soft shadows
        + polygon puzzle view
        - shader for fBm for irregu
-       - PP [deadline 5.11]
-           - proper enter
-           - background texture - ?
-           - speedups 
-           - saving
-           - soft shadows
-           + merge !!!
         - overall document about the goals and visions for the project
        - Main zz view:
             - Clipping in awt
@@ -251,6 +249,14 @@
        + better algorithm for CullingCoordSys. Uses now parallel
           bounding boxes. Fast, but not very efficient.
     tjl:
+       + PP 
+           - help mudyc with String[] to renderable passing
+           - proper enter
+           - background texture - non-periodic?
+           - speedups 
+           - saving
+           - soft shadows
+           + merge !!!
        - shape transformation & dicing framework
        - make GLVobCoorder's all coordsys types
          work like affineCoordsys and setAffineParams, so
Index: gzz/gfx/libcoords/Coords.cxx
diff -u gzz/gfx/libcoords/Coords.cxx:1.47 gzz/gfx/libcoords/Coords.cxx:1.48
--- gzz/gfx/libcoords/Coords.cxx:1.47   Fri Nov  1 03:05:13 2002
+++ gzz/gfx/libcoords/Coords.cxx        Sun Nov  3 13:28:16 2002
@@ -778,6 +778,49 @@
 
     };
 
+    class InverseCoordSys : public CoordSys {
+       CoordSys *inv;
+    public:
+       InverseCoordSys() : inv(0) { 
+           DBG(dbg) << "Create inverse\n";
+       }
+       InverseCoordSys(CoordSys *a) : CoordSys(a), inv(0) {
+           DBG(dbg) << "Create inverse with "<<a<<"\n";
+           inv = super->getInverse();
+       }
+       enum { NParams = 0, NPrevious = 1, NParents = 1 } ;
+       virtual void setParams(float *params) { 
+           inv = super->getInverse();
+           DBG(dbg) << "inverse setparams : " << inv << "\n";
+       }
+       virtual CoordSys *createInverse() {
+           DBG(dbg) << "inverse createInverse\n";
+           return new InverseCoordSys( inv );
+       }
+       virtual void vertex(const ZPt &p) const {
+           DBG(dbg) << "inverse vertex "<<inv<<" \n";
+           inv->vertex(p);
+       }
+       virtual ZPt transform(const ZPt &p) const {
+           DBG(dbg) << "inverse transform "<<inv<<" \n";
+           return inv->transform(p);
+       }
+       virtual float nonlinearity(const ZPt &p, float radius) { 
+           return inv->nonlinearity(p, radius);
+       }
+       virtual bool canPerformGL() { 
+           return inv->canPerformGL();
+       }
+       virtual bool performGL() { 
+           return inv->performGL();
+       }
+       virtual bool shouldBeDrawn() {
+           return inv->shouldBeDrawn();
+       }
+
+    };
+
+
     /** Culling coordsys can decide not to be drawn when its
      * parents' unit squares do not intersect.
      */
@@ -1045,6 +1088,7 @@
        new DerTransFactory<UnitSqCoords>(), // 12
        new TransFactory<OrthoCoords>(), // 13
        new WHTransFactory<OrthoBoxCoords>(), // 14
+       new NoTransFactory<InverseCoordSys>(), // 15
        0
     };
 
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.125 
gzz/gfx/librenderables/renderables.py:1.126
--- gzz/gfx/librenderables/renderables.py:1.125 Sat Nov  2 19:09:54 2002
+++ gzz/gfx/librenderables/renderables.py       Sun Nov  3 13:28:16 2002
@@ -375,7 +375,8 @@
 # PaperQuad is a bit complicated: there are three coordinate
 # systems here: the window cs, the object cs and the paper cs.
 # cs1 is object => window,
-# and cs2 is paper => object.
+# and cs2 is paper => object, unless PAPERQUAD_CS2_TO_SCREEN is set, when it is
+#                              paper => window
 # Corners give the corners of the quad to render, in object
 # coordinates.
 {
@@ -397,14 +398,26 @@
             this->flags = flags;
        """,
     "RenderCode" : """
+           const int flags = this->flags;
+           // object -> paper/window
            Coords &coords2inv = *coords2.getInverse();
 
            GLERR
 
 
-           ZPt paperorigin = coords2.transform(ZPt(0, 0, 0));
-           ZVec paperx = coords2.transform(ZPt(1, 0, 0)) - paperorigin;
-           ZVec papery = coords2.transform(ZPt(0, 1, 0)) - paperorigin;
+           ZPt paperorigin, paperx, papery;
+           if(flags & PAPERQUAD_CS2_TO_SCREEN) {
+               Coords &coords1inv = *coords1.getInverse();
+               paperorigin = coords1inv.transform(coords2.transform(ZPt(0, 0, 
0)));
+               paperx = coords1inv.transform(coords2.transform(ZPt(1, 0, 0))) 
+                               - paperorigin;
+               papery = coords1inv.transform(coords2.transform(ZPt(0, 1, 0))) 
+                               - paperorigin;
+           } else {
+               paperorigin = coords2.transform(ZPt(0, 0, 0));
+               paperx = coords2.transform(ZPt(1, 0, 0)) - paperorigin;
+               papery = coords2.transform(ZPt(0, 1, 0)) - paperorigin;
+           }
 
        
            Paper::LightParam lightParam;
@@ -460,7 +473,12 @@
                    vertices[ix][iy][2] = v.x;
                    vertices[ix][iy][3] = v.y;
                    vertices[ix][iy][4] = v.z;
-                   ZPt t = coords2inv.transform(p);
+                   ZPt t;
+                   if(flags & PAPERQUAD_CS2_TO_SCREEN) {
+                       t = coords2inv.transform(v);
+                   } else {
+                       t = coords2inv.transform(p);
+                   }
                    vertices[ix][iy][0] = t.x;
                    vertices[ix][iy][1] = t.y;
                    DBG(dbg_paperquad) << "   vert: " << 
@@ -843,11 +861,11 @@
 {
     "Type" : "2",
     "Name": "IrregularQuad",
-    "Data": """float x0, y0, x1, y1; float border; float freq; int mode; 
CallGLCode setup;
+    "Data": """float x0, y0, x1, y1; float border; float freq; int flags; 
CallGLCode setup;
                float dicefactor;""",
     "Params" : """
            float x0, float y0, float x1, float y1,
-           float border, float ripple_period, int mode, String setupcode,
+           float border, float ripple_period, int flags, String setupcode,
            float dicefactor
        """,
     "ParamCode" : """
@@ -857,7 +875,7 @@
            this->y1 = y1;
             this->border = border;
             this->freq = 1.0 / ripple_period;
-            this->mode = mode;
+            this->flags = flags;
             setup = CallGLCode(string(setupcode.begin(), 
setupcode.end()).c_str());
            this->dicefactor = dicefactor;
        """,
@@ -1005,9 +1023,9 @@
 
         DBG(dbg_irregularquad) << "Dice: " << dicex << " " << dicey << " " << 
diceb << "\\n";
 
-        for (int pass = 0; pass < (mode ? 4 : 1); pass++) {
+        for (int pass = 0; pass < ((flags & IRREGU_SHIFTS) ? 4 : 1); pass++) {
 
-        if (mode) {
+        if (flags & IRREGU_SHIFTS) {
             glPushMatrix();
             glTranslatef((pass & 1) ? -2 : 2,
                          (pass & 2) ? -2 : 2,
@@ -1087,7 +1105,7 @@
         glEnd();
         #endif
 
-        if (mode) glPopMatrix();
+        if (flags & IRREGU_SHIFTS) glPopMatrix();
 
         }
 
@@ -1634,6 +1652,10 @@
 namespace Renderables {
 
    const int PAPERQUAD_USE_VERTEX_PROGRAM = 0x0001;
+   const int PAPERQUAD_CS2_TO_SCREEN = 0x0002;
+
+   const int IRREGU_SHIFTS = 0x0001;
+   const int IRREGU_CS2_TO_SCREEN = 0x0002;
 
 """
 
@@ -1735,6 +1757,10 @@
     private static boolean have_VP_1_1;
 
     public static final int PAPERQUAD_USE_VERTEX_PROGRAM = 0x0001;
+    public static final int PAPERQUAD_CS2_TO_SCREEN = 0x0002;
+
+    public static final int IRREGU_SHIFTS = 0x0001;
+    public static final int IRREGU_CS2_TO_SCREEN = 0x0002;
 
     public static void init() {
         if (GL.hasExtension("GL_NV_vertex_program1_1")) {
Index: gzz/gfx/libutil/effects.py
diff -u gzz/gfx/libutil/effects.py:1.21 gzz/gfx/libutil/effects.py:1.22
--- gzz/gfx/libutil/effects.py:1.21     Sat Nov  2 13:30:18 2002
+++ gzz/gfx/libutil/effects.py  Sun Nov  3 13:28:16 2002
@@ -1,5 +1,8 @@
+from __future__ import nested_scopes
 from gzz.gfx.gl import GL, GLRen, GLSpans, Paper, GLCache,IrregularFrame
 from gzz.vob.buoy import Buoy3Floater, Buoy4Floater
+import gzz
+import java 
 import math
 
 
@@ -18,17 +21,22 @@
 
     combiners = "Enable"
 
-    def __init__(self, x0, y0, x1, y1, border, ripple):
+    def __init__(self, x0, y0, x1, y1, border, ripple,
+                   contentColor=java.awt.Color.white,
+                   frameColor=java.awt.Color.black):
         print "Texture id:", self.tex.getTexId()
 
-        code = """
+       def code(color):
+           return """
                 PushAttrib ENABLE_BIT TEXTURE_BIT CURRENT_BIT
                 Enable ALPHA_TEST
                 AlphaFunc GREATER 0.0
                Disable BLEND
 
+               Color %(color)s
+
                 ActiveTexture TEXTURE1
-                BindTexture TEXTURE_2D %s
+                BindTexture TEXTURE_2D %(boxtex)s
                 Enable TEXTURE_2D
                 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
@@ -45,9 +53,9 @@
 
                 ActiveTexture TEXTURE0
 
-                BindTexture TEXTURE_2D %s
+                BindTexture TEXTURE_2D %(tex)s
                 Enable TEXTURE_2D
-                %s REGISTER_COMBINERS_NV
+                %(comb)s REGISTER_COMBINERS_NV
                 CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1
                 CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV TEXTURE1 
UNSIGNED_IDENTITY_NV ALPHA
                 CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV TEXTURE0 
SIGNED_NEGATE_NV ALPHA
@@ -60,13 +68,18 @@
                 FinalCombinerInputNV VARIABLE_C_NV ZERO UNSIGNED_IDENTITY_NV 
RGB
                 FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV 
UNSIGNED_IDENTITY_NV RGB
                 FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV 
UNSIGNED_IDENTITY_NV ALPHA
-        """ % (self.boxtex.getTexId(), 
-               self.tex.getTexId(), 
-               self.combiners)
+        """ % {"boxtex" : self.boxtex.getTexId(), 
+               "tex" : self.tex.getTexId(), 
+               "comb" : self.combiners,
+               "color" : gzz.util.ColorUtil.colorGLString(color)}
 
 
-       self._content = GLRen.createIrregularQuad(x0, y0, x1, y1, border, 
ripple, 0, code, self.dicefactor)
-       self._frame = GLRen.createIrregularQuad(x0, y0, x1, y1, border, ripple, 
1, code, self.dicefactor)
+       self._content = GLRen.createIrregularQuad(
+               x0, y0, x1, y1, border, ripple, 0, 
+               code(contentColor), self.dicefactor)
+       self._frame = GLRen.createIrregularQuad(
+               x0, y0, x1, y1, border, ripple, 1, 
+               code(frameColor), self.dicefactor)
 
     def getContent(self): return self._content
     def getFrame(self): return self._frame
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -u gzz/gzz/gfx/gl/GLVobCoorder.java:1.52 
gzz/gzz/gfx/gl/GLVobCoorder.java:1.53
--- gzz/gzz/gfx/gl/GLVobCoorder.java:1.52       Fri Nov  1 20:23:45 2002
+++ gzz/gzz/gfx/gl/GLVobCoorder.java    Sun Nov  3 13:28:16 2002
@@ -31,7 +31,7 @@
 import gzz.client.gl.*;
 
 public class GLVobCoorder extends AffineVobCoorder {
-public static final String rcsid = "$Id: GLVobCoorder.java,v 1.52 2002/11/02 
01:23:45 benja Exp $";
+public static final String rcsid = "$Id: GLVobCoorder.java,v 1.53 2002/11/03 
18:28:16 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -331,6 +331,16 @@
 
        int was = ninds;
        ninds += 4; 
+       return was;
+    }
+
+    public int invert(int parent) {
+       inds[ninds+0] = 15; // invert
+       inds[ninds+1] = parent;
+       inds[ninds+2] = 42;
+
+       int was = ninds;
+       ninds += 3; 
        return was;
     }
 
Index: gzz/gzz/modules/pp/PPView2.java
diff -u gzz/gzz/modules/pp/PPView2.java:1.3 gzz/gzz/modules/pp/PPView2.java:1.4
--- gzz/gzz/modules/pp/PPView2.java:1.3 Sun Nov  3 07:03:07 2002
+++ gzz/gzz/modules/pp/PPView2.java     Sun Nov  3 13:28:16 2002
@@ -7,6 +7,7 @@
 import gzz.view.*;
 import gzz.*;
 import java.awt.Dimension;
+import gzz.client.GraphicsAPI;
 
 public class PPView2 implements View {
 
@@ -20,67 +21,115 @@
      */
     public float bgscale = 200;
 
+    /** Border size of the irregularframe.
+     */
+    public float irreguBorder = 50;
+
+    /** Ripple length of irregularframe.
+     */
+    public float irreguRipple = 500;
+
+    /** For debugging: whether to use stencil or not.
+     */
+    public boolean useStencil = true;
+
     Space space;
     PPDims d;
 
+    Vob black = GLCache.getCallList("Color 0 0 0\n");
+
     CoordinatePlaneView coordinatePlaneView;
 
+    GraphicsAPI.Window window;
+
     /** A single PP plane, with given view context.
      * This class takes care of drawing the stencil, 
      * the background and the vobs inside the plane.
      */
     class SinglePlane {
        ViewContext context;
-       void render(final VobScene vs, final int frameCS, final int c2fCS) {
+       /** Render the plane.
+        * @param frameCS The Box-coordinate system of the frame.
+        *           The scale is assumed to be single pixels (although
+        *           for example buoys will set this differently).
+        *           The height and width define the viewport.
+        * @param panZoom The coordinate system from virtual paper coordinates
+        *              to panned-and-zoomed coordinates. 
+        *              The origin of the panned-and-zoomed coordinates
+        *              will be set to the center of the frameCS, and
+        *              the scale is 1 to 1 pixel.
+        */
+       void render(final VobScene vs, final int frameCS, final int panZoom) {
            final GLVobCoorder glc = (GLVobCoorder)vs.coords;
+           float[] sqs = new float[2];
+           glc.getSqSize(frameCS, sqs);
+
+           // CS from center of frameCS to screen
+           int framecenterCS = vs.translateCS(frameCS, "FCTR", sqs[0]/2, 
sqs[1]/2);
+
+           // CS from virtualpaper to screen
+           final int paper2screen = glc.concat(framecenterCS, panZoom);
+           final int bg2screen = vs.scaleCS(paper2screen, "BGSCA", 
+                                       bgscale, bgscale);
+           
+
 
-           final int conc = glc.concat(c2fCS, frameCS);
 
            final Cell cursor = context.getAccursed();
            final Cell plane = cursor.h(d.contains);
-           final BgVob bg = BgVob.create(plane);
 
-           final IrregularFrame f = IrregularFrame.create(-100,-100,1600,1600,
-                                       50.3f, 500f);
+           // BgVob takes two coordsys:
+           // frame2screen and paper2screen
+           final BgVob bg = BgVob.create(plane, window);
+
+           final IrregularFrame f = 
IrregularFrame.create(-16000,-16000,16000,16000,
+                                       irreguBorder, irreguRipple);
 
            final int frameUnit = vs.unitSqCS(frameCS, "USQ");
 
+           // Irregu needs frame 2 paper
+           final int screen2paper = glc.invert(paper2screen);
+           final int frameUnit2paper = glc.concat(screen2paper, frameUnit);
+
            class Putter implements Runnable {
                Vob v;
                Putter(Vob v) { this.v = v; }
                public void run() {
-                   vs.map.put(v, 0, frameUnit);
+                   vs.map.put(v, paper2screen, frameUnit2paper);
                }
            }
-           float[] sqs = new float[2];
-           glc.getSqSize(frameCS, sqs);
-
 
-           final int c2fUnit = vs.scaleCS(c2fCS, "SCA", 
-                       bgscale/sqs[0], bgscale/sqs[1]);
+           Runnable placeContent = new Runnable() {
+                       public void run() {
+                           vs.map.put(bg, frameUnit, bg2screen);
+                           vs.map.put(black);
+                           coordinatePlaneView.render(vs, paper2screen, 
context);
+                       }};
 
-           Stencil.drawStenciled(vs, 
+           if(useStencil)
+               Stencil.drawStenciled(vs, 
                        new Putter(f.getContent()),
                        new Putter(f.getBlank()),
                        new Putter(f.getFrame()),
-                       new Runnable() {
-                       public void run() {
-                           vs.map.put(bg, frameUnit, c2fUnit);
-                       }
-                       },
-                       false);
+                       placeContent,
+                       true);
+           else
+               placeContent.run();
        }
     }
 
-    public PPView2(Space space) {
+    public PPView2(Space space, GraphicsAPI.Window w) {
        this.space = space;
        this.d = new PPDims(space);
-       this.coordinatePlaneView = new CoordinatePlaneView(d.clone, d.pan);
+       this.window = w;
+       this.coordinatePlaneView = new CoordinatePlaneView(d.contains, d.pan);
     }
 
     public void render(VobScene vs, int intoCS, ViewContext context) {
        AbstractViewContext vc = new AbstractViewContext();
        vc.setAccursed(context.getAccursed());
+       TextStyle style = vs.gfxapi.getTextStyle("Sans", 0, 20);
+       vc.setCellView(new TextCellContentView(style));
 
        Dimension size = vs.getSize();
        
Index: gzz/gzz/modules/pp/PlaneView.java
diff -u gzz/gzz/modules/pp/PlaneView.java:1.56 
gzz/gzz/modules/pp/PlaneView.java:1.57
--- gzz/gzz/modules/pp/PlaneView.java:1.56      Fri Nov  1 20:23:45 2002
+++ gzz/gzz/modules/pp/PlaneView.java   Sun Nov  3 13:28:16 2002
@@ -41,7 +41,7 @@
  */
 
 public class PlaneView {
-public static final String rcsid = "$Id: PlaneView.java,v 1.56 2002/11/02 
01:23:45 benja Exp $";
+public static final String rcsid = "$Id: PlaneView.java,v 1.57 2002/11/03 
18:28:16 tjl Exp $";
     public static boolean dbg = true;
     private static void pa(String s) { System.err.println(s); }
 
@@ -78,7 +78,7 @@
        Cell plane = cursor.h(d.contains);
        Cell note = plane.s(d.contains);
 
-       BgVob bg = BgVob.create(plane);
+       BgVob bg = BgVob.create(plane, null);
        int bginto = vs.coords.ortho(viewport2screen, 500, 0, 0, 1, 1);
        int bgpap = vs.coords.ortho(paper2viewport, 0, 0, 0, 100, 100);
        vs.matcher.addSub(viewport2screen, bginto, "BGTRANS");
Index: gzz/gzz/modules/pp/demotest.py
diff -u gzz/gzz/modules/pp/demotest.py:1.12 gzz/gzz/modules/pp/demotest.py:1.13
--- gzz/gzz/modules/pp/demotest.py:1.12 Sun Nov  3 07:03:07 2002
+++ gzz/gzz/modules/pp/demotest.py      Sun Nov  3 13:28:16 2002
@@ -116,9 +116,11 @@
 
 class PPView2Scene:
     def __init__(self):
-       self.ppv = PPView2(space)
+       self.ppv = PPView2(space, w)
        self.ppv.bgscale = 500
     def key(self, key):
+       if key == "s":
+           self.ppv.useStencil = not self.ppv.useStencil
        pass
     def scene(self, vs):
        vs.map.put(background((0.4,0.5,0.8)))
@@ -146,12 +148,8 @@
                 self.poffset[0] - (ev.getX() - self.press[0]),
                 self.poffset[1] - (ev.getY() - self.press[1]),
                 )
-    def sap(self):
-       self.currentvs.coords.setAffineParams(self.cs2,
-               0, -self.scale*self.offset[0]+.5, 
-                  -self.scale*self.offset[1]+.5, 
-               self.scale, 0, 0, self.scale)
 
+gzz.view.CoordinatePlaneView.dbg = 1
 
 # currentScene = PlaneViewScene()
 currentScene = PPView2Scene()
Index: gzz/gzz/modules/pp/vob/BgVob.java
diff -u gzz/gzz/modules/pp/vob/BgVob.java:1.29 
gzz/gzz/modules/pp/vob/BgVob.java:1.30
--- gzz/gzz/modules/pp/vob/BgVob.java:1.29      Sat Oct 19 10:43:38 2002
+++ gzz/gzz/modules/pp/vob/BgVob.java   Sun Nov  3 13:28:16 2002
@@ -36,7 +36,7 @@
  * used to pan pretty easily.
  */
 public class BgVob extends gzz.vob.Vob {
-public static final String rcsid = "$Id: BgVob.java,v 1.29 2002/10/19 14:43:38 
tjl Exp $";
+public static final String rcsid = "$Id: BgVob.java,v 1.30 2002/11/03 18:28:16 
tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -44,15 +44,17 @@
     Color bgcolor;
 
     Cell papercode;
+
+    GLRen.PaperQuad pq;
     
-    public static BgVob create(Cell cell) {
-       return new BgVob(cell);
+    public static BgVob create(Cell cell, GraphicsAPI.Window w) {
+       return new BgVob(cell, w);
     }
     
-    public BgVob(Cell cell) {
+    public BgVob(Cell cell, GraphicsAPI.Window w) {
 
        papercode = cell;
-       
+       pq = getPaperQuad(papercode, w);
     }
     static Rectangle rect = new Rectangle();
     static Rectangle rect2 = new Rectangle();
@@ -78,13 +80,13 @@
     static GL.DisplayList list;
     static Vob triangle;
 
-    GLRen.PaperQuad getPaperQuad(Cell c) {
+    GLRen.PaperQuad getPaperQuad(Cell c, GraphicsAPI.Window win) {
        GLRen.PaperQuad ret = (GLRen.PaperQuad)papers.get(c);
        if(ret == null) {
            Paper  pap;
            GLRen.PaperQuad pq;
-           pap = PaperMill.getInstance().getPaper(c.hashCode());
-           ret = GLRen.createPaperQuad(pap, 0, 0, 1, 1, 0);
+           pap = PaperMill.getInstance().getOptimizedPaper(c.hashCode(), win);
+           ret = GLRen.createPaperQuad(pap, 0, 0, 1, 1, 0, 
GLRen.PAPERQUAD_CS2_TO_SCREEN);
            papers.put(c, ret);
 
            list = GL.createDisplayList(
@@ -102,7 +104,6 @@
                    int[] list, int curs, int coordsys1,
                    int coordsys2) {
 
-       GLRen.PaperQuad pq = getPaperQuad(papercode);
        curs = pq.addToListGL(win, list, curs, coordsys1, coordsys2);
        // curs = triangle.addToListGL(win, list, curs, coordsys1, -1);
        return curs;
Index: gzz/gzz/view/CoordinatePlaneView.java
diff -u gzz/gzz/view/CoordinatePlaneView.java:1.3 
gzz/gzz/view/CoordinatePlaneView.java:1.4
--- gzz/gzz/view/CoordinatePlaneView.java:1.3   Fri Nov  1 20:23:45 2002
+++ gzz/gzz/view/CoordinatePlaneView.java       Sun Nov  3 13:28:16 2002
@@ -14,7 +14,7 @@
  */
 
 public class CoordinatePlaneView implements View {
-public static final String rcsid = "$Id: CoordinatePlaneView.java,v 1.3 
2002/11/02 01:23:45 benja Exp $";
+public static final String rcsid = "$Id: CoordinatePlaneView.java,v 1.4 
2002/11/03 18:28:16 tjl Exp $";
     public static boolean dbg = true;
     private static void pa(String s) { System.err.println(s); }
 
@@ -45,6 +45,8 @@
                int[] place = gzz.client.Params.getInts(firstCoord, d_coords, 
2, null);
                cv.getSize(item, bs);
 
+               if(dbg) pa("CPV PLACE: "+place[0]+" "+place[1]+" "+
+                               bs[0]+" "+bs[1]);
                int box = vs.orthoBoxCS(into, item, 0, place[0], place[1], 1, 
1, bs[0], bs[1]);
 
                cv.place(item, vs, box, context);
@@ -52,6 +54,7 @@
                    cursorBox = box;
            }
            item = item.s(d_rank);
+           if(dbg) pa("CPV STEP: "+item+" "+head);
            if(head.equals(item)) break;
        }
     }
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.21 
gzz/gzz/view/TextCellContentView.java:1.22
--- gzz/gzz/view/TextCellContentView.java:1.21  Fri Nov  1 20:23:45 2002
+++ gzz/gzz/view/TextCellContentView.java       Sun Nov  3 13:28:16 2002
@@ -39,7 +39,7 @@
  */
 
 public class TextCellContentView extends CellContentView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.21 
2002/11/02 01:23:45 benja Exp $";
+public static final String rcsid = "$Id: TextCellContentView.java,v 1.22 
2002/11/03 18:28:16 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); }
@@ -53,6 +53,12 @@
         this.style = style;
     }
 
+    public void getSize(Cell c, float[] out) {
+       String s = c.t();
+       out[0] = style.getWidth(s, 1);
+       out[1] = style.getHeight(1);
+    }
+
     float[] boxwh = new float[2];
     public void place(Cell c, VobScene vs, int box,
                       ViewContext context) {
@@ -102,11 +108,10 @@
     protected void placeVob(Cell c, VobScene v, int cs, float w, float h, int 
start, int end,
                             int offs, ViewContext context, float scale) {
         TextVob vob = new TextVob(style, c.t().substring(start, end));
-        int cs_wh = v.coords.ortho(0, 0, 0, 0, w, h);
-        ((DefaultVobMatcher)v.matcher).addSub(cs, cs_wh, WH_KEY);
-        v.map.put(vob, cs, cs_wh);
+        int cs_scaled = v.orthoCS(cs, WH_KEY, 0, 0, 0, h, h);
+        v.map.put(vob, cs_scaled);
 
         if(offs >= 0)
-            v.map.put(new TextCursorVob(vob, offs), cs, cs_wh);
+            v.map.put(new TextCursorVob(vob, offs), cs);
     }
 }
Index: gzz/test/gzz/gfx/gl/glvobcoorder.test
diff -u gzz/test/gzz/gfx/gl/glvobcoorder.test:1.19 
gzz/test/gzz/gfx/gl/glvobcoorder.test:1.20
--- gzz/test/gzz/gfx/gl/glvobcoorder.test:1.19  Sat Nov  2 05:25:04 2002
+++ gzz/test/gzz/gfx/gl/glvobcoorder.test       Sun Nov  3 13:28:16 2002
@@ -68,12 +68,23 @@
 
     dst = zeros(len(src), 'f')
     src2 = zeros(len(src), 'f')
+    dst2 = zeros(len(src), 'f')
+    src3 = zeros(len(src), 'f')
 
     c.transformPoints3(cs, src, dst)
     c.inverseTransformPoints3(cs, dst, src2)
 
+    cs_inv = c.invert(cs)
+
+    c.transformPoints3(cs_inv, dst, src3)
+    c.inverseTransformPoints3(cs_inv, src2, dst2)
+
+    msg = str((src, dst, src2, dst2, src3))
     for i in range(0,len(src)):
-       failIf( abs(src[i] - src2[i])/(abs(src[i])+1) > 0.01, msg=str((src, 
dst, src2, i, src[i], src2[i])) )
+       failIf( abs(src[i] - src2[i])/(abs(src[i])+1) > 0.01, msg=msg)
+
+       failIf( abs(src[i] - src3[i])/(abs(src[i])+1) > 0.01, msg=msg)
+       failIf( abs(dst[i] - dst2[i])/(abs(dst[i])+1) > 0.01, msg=msg)
 
 def testInverses():
     for i in range(0,5):
@@ -106,6 +117,7 @@
        cs_affine_clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)
        cs_cull = c.cull(cs_affine, cs_affine_clip)
        checkInverse(c, cs_cull)
+
 
 def testInterpolateTranslation():
 




reply via email to

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