gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./Gzz.py gfx/librenderables/renderables.py ...


From: Asko Soukka
Subject: [Gzz-commits] gzz ./Gzz.py gfx/librenderables/renderables.py ...
Date: Mon, 25 Nov 2002 11:03:40 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/11/25 11:03:40

Modified files:
        .              : Gzz.py 
        gfx/librenderables: renderables.py 
        gzz/modules/pp/vob: TextCursorVob.java 
        gzz/view       : DimDecorator.java TextCellContentView.java 
        gzz/vob/vobs   : FilledRectVob.java LineVob.java RectBgVob.java 
                         SimpleConnection.java 

Log message:
        Fixing GL-client

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Gzz.py.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.152&tr2=1.153&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/vob/TextCursorVob.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/DimDecorator.java.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/FilledRectVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/LineVob.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/RectBgVob.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/SimpleConnection.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gzz/Gzz.py
diff -u gzz/Gzz.py:1.48 gzz/Gzz.py:1.49
--- gzz/Gzz.py:1.48     Sun Nov 24 15:09:18 2002
+++ gzz/Gzz.py  Mon Nov 25 11:03:38 2002
@@ -26,7 +26,7 @@
 
 # Flags that can be passed to Gzz.py
 # (prefix with '--' on the command line)
-flagset = ['multiline', 'double-size', 'triple-size']
+flagset = ['multiline', 'double-size', 'triple-size', 'lollipop']
 
 
 class Gzz(java.lang.Runnable):
@@ -42,7 +42,10 @@
                       gzz.view.RowColView(0), gzz.view.RowColView(1),
                       ]
         self.viewSpecificBinders = java.util.HashMap()
-        self.cellView = gzz.view.BoxCellView()
+        if 'lollipop' not in self.flags:
+            self.cellView = gzz.view.BoxCellView()
+        else:
+            self.cellView = gzz.view.LollipopCellView()
         if 'multiline' not in self.flags:
             self.cellContentView = gzz.view.TextCellContentView(self.style)
         else:
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.152 
gzz/gfx/librenderables/renderables.py:1.153
--- gzz/gfx/librenderables/renderables.py:1.152 Mon Nov 25 06:15:16 2002
+++ gzz/gfx/librenderables/renderables.py       Mon Nov 25 11:03:38 2002
@@ -456,46 +456,61 @@
 {
     "Type": "2",
     "Name": "LineConnector",
-    "Data": "float dz1, dz2;",
-    "Params": "float dz1, float dz2",
-    "ParamCode": "this->dz1 = dz1; this->dz2 = dz2;",
-    "RenderCode" : """
-           ZPt p1 = coords1.transform(ZPt(0,0,0));
-           ZPt p2 = coords2.transform(ZPt(0,0,0));
+    "Data": "float px1, py1, px2, py2, dz1, dz2, red, green, blue, alpha;",
+    "Params": """float px1, float py1, float px2, float py2, float dz1, float 
dz2,
+                 float red, float green, float blue, float alpha""",
+    "ParamCode": """ this->px1 = px1; this->py1 = py1;
+                     this->px2 = px2; this->py2 = py2;
+                     this->dz1 = dz1; this->dz2 = dz2;
+                     this->red = red; this->green = green;
+                     this->blue = blue; this->alpha = alpha;""",
+    "RenderCode": """
+            bool colored = true;
+            if (red < 0 || green < 0 || blue < 0 || alpha < 0) colored = false;
+            Pt box1 = coords1.getSqSize();
+            Pt box2 = coords2.getSqSize();
+           ZPt p1 = coords1.transform(ZPt(box1.x*px1,box1.y*py1,0));
+           ZPt p2 = coords2.transform(ZPt(box2.x*px2,box2.y*py2,0));
            p1.z += dz1;
            p2.z += dz2;
+            if (colored) glPushAttrib(GL_COLOR_BUFFER_BIT);
             glPushAttrib(GL_ENABLE_BIT);
             glDisable(GL_TEXTURE_2D);
+            if (colored) glColor4f(red, green, blue, alpha);
            glBegin(GL_LINE_STRIP);
            glVertex3f(p1.x, p1.y, p1.z);
            glVertex3f(p2.x, p2.y, p2.z);
            glEnd();
+            if (colored) glPopAttrib();
             glPopAttrib();
        """
 },
 
 {
-    "Type": "2",
-    "Name": "ColoredLineConnector",
-    "Data": "float dz1, dz2, red, green, blue, alpha;",
-    "Params": "float dz1, float dz2, float red, float green, float blue, float 
alpha",
-    "ParamCode": """ this->dz1 = dz1; this->dz2 = dz2;
-                     this->red = red; this->green;
+    "Type": "1",
+    "Name": "Line",
+    "Data": "float px1, py1, px2, py2, red, green, blue, alpha;",
+    "Params": """float px1, float py1, float px2, float py2,
+                 float red, float green, float blue, float alpha""",
+    "ParamCode": """ this->px1 = px1; this->py1 = py1;
+                     this->px2 = px2; this->py2 = py2;
+                     this->red = red; this->green = green;
                      this->blue = blue; this->alpha = alpha;""",
-    "RenderCode" : """
-           ZPt p1 = coords1.transform(ZPt(0,0,0));
-           ZPt p2 = coords2.transform(ZPt(0,0,0));
-           p1.z += dz1;
-           p2.z += dz2;
-            glPushAttrib(GL_CURRENT_BIT);
+    "RenderCode": """
+            bool colored = true;
+            if (red < 0 || green < 0 || blue < 0 || alpha < 0) colored = false;
+            Pt box = coords1.getSqSize();
+           ZPt p1 = coords1.transform(ZPt(box.x*px1,box.y*py1,0));
+           ZPt p2 = coords1.transform(ZPt(box.x*px2,box.y*py2,0));
+            if (colored) glPushAttrib(GL_COLOR_BUFFER_BIT);
             glPushAttrib(GL_ENABLE_BIT);
             glDisable(GL_TEXTURE_2D);
-            glColor4f(red, green, blue, alpha);
+            if (colored) glColor4f(red, green, blue, alpha);
            glBegin(GL_LINE_STRIP);
-           glVertex3f(p1.x, p1.y, p1.z);
-           glVertex3f(p2.x, p2.y, p2.z);
+           glVertex2f(p1.x, p1.y);
+           glVertex2f(p2.x, p2.y);
            glEnd();
-            glPopAttrib();
+            if (colored) glPopAttrib();
             glPopAttrib();
        """
 },
@@ -2263,6 +2278,9 @@
        return createCulledPaperQuad(paper, x0, y0, x1, y1, 1, dicefactor, 
flags);
     }
 
+    public static LineConnector createLineConnector(float dz1, float dz2) {
+       return createLineConnector(0f, 0f, 0f, 0f, dz1, dz2, -1f, -1f, -1f, 
-1f);
+    }
 
     public static gzz.vob.Vob createCallList(String s) {
        return createCallList(createDisplayList(s));
Index: gzz/gzz/modules/pp/vob/TextCursorVob.java
diff -u gzz/gzz/modules/pp/vob/TextCursorVob.java:1.5 
gzz/gzz/modules/pp/vob/TextCursorVob.java:1.6
--- gzz/gzz/modules/pp/vob/TextCursorVob.java:1.5       Mon Sep 23 04:24:26 2002
+++ gzz/gzz/modules/pp/vob/TextCursorVob.java   Mon Nov 25 11:03:38 2002
@@ -29,7 +29,7 @@
 
 /** A vertical line for now */
 public class TextCursorVob extends gzz.vob.Vob {
-public static final String rcsid = "$Id: TextCursorVob.java,v 1.5 2002/09/23 
08:24:26 tjl Exp $";
+public static final String rcsid = "$Id: TextCursorVob.java,v 1.6 2002/11/25 
16:03:38 humppake Exp $";
 
     static Point p1 = new Point();
     static Point p2 = new Point();
@@ -51,9 +51,14 @@
     public int addToListGL(gzz.client.GraphicsAPI.Window win,
                        int[] list, int curs, int coordsys1,
                                int coordsys2) { 
-       if(crosshair == null)
-           crosshair = GLRen.createCallListCoorded(
-                   "Begin LINE_STRIP\nVertex 0 1\nVertex 0 -1\nEnd\n");
+
+       if (crosshair == null) {
+           crosshair = GLRen.createLine(0, -1, 0, 1, -1, -1, -1, -1);
+           /*
+             crosshair = GLRen.createCallListCoorded(
+             "Begin LINE_STRIP\nVertex 0 1\nVertex 0 -1\nEnd\n");
+           */
+       }
        curs = crosshair.addToListGL(win, list, curs, coordsys1, coordsys2);
        return curs;
     }
Index: gzz/gzz/view/DimDecorator.java
diff -u gzz/gzz/view/DimDecorator.java:1.19 gzz/gzz/view/DimDecorator.java:1.20
--- gzz/gzz/view/DimDecorator.java:1.19 Mon Nov 25 06:15:16 2002
+++ gzz/gzz/view/DimDecorator.java      Mon Nov 25 11:03:38 2002
@@ -34,7 +34,7 @@
  *  vob scene.
  */
 public class DimDecorator implements FallbackSceneDecorator {
-String rcsid = "$Id: DimDecorator.java,v 1.19 2002/11/25 11:15:16 humppake Exp 
$";
+String rcsid = "$Id: DimDecorator.java,v 1.20 2002/11/25 16:03:38 humppake Exp 
$";
     public static boolean dbg = true;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -81,8 +81,8 @@
        
        for(int i=0; i<3; i++) {
             int cs = sc.orthoCS(targ[i], dimKeys[i], 0, 5, 5, h-10, h-10);
-           /* XXX Because we cannot give depth for UnisSQ it, and negative
-              depth for TextVob crashes AWT we should create background cs. */
+           /* XXX Because we cannot give depth for UnisSqCS, and AWT crashes 
+              with depth for TextVobCS, we should create background CS last. */
            targ_unitSq[i] = sc.unitSqCS(targ[i], dimRectKeys[0]);
 
            sc.map.put(conn, targ[i], orig);
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.27 
gzz/gzz/view/TextCellContentView.java:1.28
--- gzz/gzz/view/TextCellContentView.java:1.27  Sun Nov 24 15:09:18 2002
+++ gzz/gzz/view/TextCellContentView.java       Mon Nov 25 11:03:39 2002
@@ -39,7 +39,7 @@
  */
 
 public class TextCellContentView extends CellContentView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.27 
2002/11/24 20:09:18 benja Exp $";
+public static final String rcsid = "$Id: TextCellContentView.java,v 1.28 
2002/11/25 16:03:39 humppake Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -123,12 +123,13 @@
                             int offs, ViewContext context, float scale) {
            // XXX should optimize for common case: no substring()
         TextVob vob = new TextVob(style, c.t().substring(start, end));
-        int cs_scaled = vs.orthoCS(cs, WH_KEY, 0, 0, 0, h, h);
+       float scaled_h = vob.getHeight(scale) + vob.getDepth(scale);
+        int cs_scaled = vs.orthoCS(cs, WH_KEY, 0, 0, 0, scaled_h, scaled_h);
         vs.map.put(vob, cs_scaled);
 
         if(offs >= 0 && offs >= start && offs <= end) {
            float x = style.getWidth(c.t().substring(start, offs), 1);
-           int cs_cursor = vs.orthoCS(cs, CURS_KEY, -1, x+1, 0, 0,h);
+           int cs_cursor = vs.orthoCS(cs, CURS_KEY, -1, x+1, 0, 0,scaled_h);
             // v.map.put(new TextCursorVob(vob, offs), cs);
            vs.map.put(cursorVob, cs_cursor);
        }
Index: gzz/gzz/vob/vobs/FilledRectVob.java
diff -u gzz/gzz/vob/vobs/FilledRectVob.java:1.1 
gzz/gzz/vob/vobs/FilledRectVob.java:1.2
--- gzz/gzz/vob/vobs/FilledRectVob.java:1.1     Sat Nov  2 15:33:06 2002
+++ gzz/gzz/vob/vobs/FilledRectVob.java Mon Nov 25 11:03:40 2002
@@ -39,7 +39,7 @@
  */
 
 public class FilledRectVob extends Vob {
-public static final String rcsid = "$Id: FilledRectVob.java,v 1.1 2002/11/02 
20:33:06 tjl Exp $";
+public static final String rcsid = "$Id: FilledRectVob.java,v 1.2 2002/11/25 
16:03:40 humppake Exp $";
     public static boolean dbg = false;
     static final void pa(String s) { System.out.println(s); }
 
@@ -77,7 +77,7 @@
        if(glList == null) {
 
            glList = GLRen.createCallListCoorded(
-                "PushAttrib ENABLE_BIT\n"+
+                "PushAttrib COLOR_BUFFER_BIT ENABLE_BIT\n"+
                 "Disable TEXTURE_2D\n"+
                "Color "+ColorUtil.colorGLString(bg)+" 1\n" +
                "Begin QUAD_STRIP\n"+
Index: gzz/gzz/vob/vobs/LineVob.java
diff -u gzz/gzz/vob/vobs/LineVob.java:1.3 gzz/gzz/vob/vobs/LineVob.java:1.4
--- gzz/gzz/vob/vobs/LineVob.java:1.3   Thu Nov  7 04:33:31 2002
+++ gzz/gzz/vob/vobs/LineVob.java       Mon Nov 25 11:03:40 2002
@@ -23,8 +23,8 @@
 package gzz.vob.vobs;
 import gzz.vob.*;
 import java.awt.*;
-import gzz.gfx.gl.GLCache;
 import gzz.util.*;
+import gzz.gfx.gl.*;
 
 /** A plain line drawn in given color.
  * This vob draws a line between the given points in the coordinate system
@@ -35,7 +35,7 @@
  */
 
 public class LineVob extends Vob {
-public static final String rcsid = "$Id: LineVob.java,v 1.3 2002/11/07 
09:33:31 tjl Exp $";
+public static final String rcsid = "$Id: LineVob.java,v 1.4 2002/11/25 
16:03:40 humppake Exp $";
 
     int x0, y0, x1, y1;
     Color color;
@@ -73,10 +73,20 @@
                        int[] list, int curs, int coordsys1,
                                int coordsys2) { 
        if(dlist == null)
-           dlist = GLCache.getCallListCoorded(
-               "PushAttrib CURRENT_BIT\nColor 
"+ColorUtil.colorGLString(color)+"\n"+
-               "Begin LINE_STRIP\nVertex "+x0+" "+y0+
-                   "\nVertex "+x1+" "+y1+"\nEnd\nPopAttrib\n");
+           if(color != null)
+               dlist = GLRen.createLine(x0, y0, x1, y1,
+                                       color.getRed()/255f,
+                                       color.getGreen()/255f,
+                                       color.getBlue()/255f, 1);
+           else
+               dlist = GLRen.createLine(x0, y0, x1, y1, -1, -1, -1, -1);
+
+       /*
+         dlist = GLCache.getCallListCoorded(
+         "PushAttrib CURRENT_BIT\nColor "+ColorUtil.colorGLString(color)+"\n"+
+         "Begin LINE_STRIP\nVertex "+x0+" "+y0+
+         "\nVertex "+x1+" "+y1+"\nEnd\nPopAttrib\n");
+       */
        curs = dlist.addToListGL(win, list, curs, coordsys1, coordsys2);
        return curs;
     }
Index: gzz/gzz/vob/vobs/RectBgVob.java
diff -u gzz/gzz/vob/vobs/RectBgVob.java:1.2 gzz/gzz/vob/vobs/RectBgVob.java:1.3
--- gzz/gzz/vob/vobs/RectBgVob.java:1.2 Sat Nov  2 13:30:18 2002
+++ gzz/gzz/vob/vobs/RectBgVob.java     Mon Nov 25 11:03:40 2002
@@ -40,7 +40,7 @@
  */
 
 public class RectBgVob extends Vob {
-public static final String rcsid = "$Id: RectBgVob.java,v 1.2 2002/11/02 
18:30:18 tjl Exp $";
+public static final String rcsid = "$Id: RectBgVob.java,v 1.3 2002/11/25 
16:03:40 humppake Exp $";
     public static boolean dbg = false;
     static final void pa(String s) { System.out.println(s); }
 
@@ -126,7 +126,7 @@
            }
 
            glList = GLRen.createCallListCoorded(
-                "PushAttrib ENABLE_BIT\n"+
+               "PushAttrib COLOR_BUFFER_BIT ENABLE_BIT\n"+
                 "Disable TEXTURE_2D\n"+
 
                bgcall +
Index: gzz/gzz/vob/vobs/SimpleConnection.java
diff -u gzz/gzz/vob/vobs/SimpleConnection.java:1.2 
gzz/gzz/vob/vobs/SimpleConnection.java:1.3
--- gzz/gzz/vob/vobs/SimpleConnection.java:1.2  Mon Nov 25 06:15:16 2002
+++ gzz/gzz/vob/vobs/SimpleConnection.java      Mon Nov 25 11:03:40 2002
@@ -31,7 +31,7 @@
  */
 
 public class SimpleConnection extends Vob {
-public static final String rcsid = "$Id: SimpleConnection.java,v 1.2 
2002/11/25 11:15:16 humppake Exp $";
+public static final String rcsid = "$Id: SimpleConnection.java,v 1.3 
2002/11/25 16:03:40 humppake Exp $";
 
     float x0, y0, x1, y1;
     Color color;
@@ -76,15 +76,14 @@
     public int addToListGL(GraphicsAPI.Window win,
                        int[] list, int curs, int coordsys1,
                                int coordsys2) {
-       if(line == null) {
-           if(color != null)
-               line = GLRen.createColoredLineConnector(1, 1,
-                                                       color.getRed()/255f,
-                                                       color.getGreen()/255f,
-                                                       color.getBlue()/255f,
-                                                       1);
-           else line = GLRen.createLineConnector(1, 1);
-        }
+       if(color != null)
+           line = GLRen.createLineConnector(x0, y0, x1, y1, 1, 1,
+                                            color.getRed()/255f,
+                                            color.getGreen()/255f,
+                                            color.getBlue()/255f,
+                                            1);
+       else line = GLRen.createLineConnector(x0, y0, x1, y1, 1, 1,
+                                             -1, -1, -1, -1);
         curs = line.addToListGL(win, list, curs, coordsys1, coordsys2);
        return curs;
     }




reply via email to

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