gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO gfx/demo/gldemo.py gfx/demo/xupdf.py...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gfx/demo/gldemo.py gfx/demo/xupdf.py...
Date: Tue, 24 Sep 2002 03:26:48 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/09/24 03:26:48

Modified files:
        .              : TODO 
        gfx/demo       : gldemo.py xupdf.py 
        gzz/gfx/gl     : GLSpans.java 

Log message:
        Add LOD into GLSpans. We're going to need this later

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.126&tr2=1.127&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/gldemo.py.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/xupdf.py.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLSpans.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -c gzz/TODO:1.126 gzz/TODO:1.127
*** gzz/TODO:1.126      Tue Sep 24 02:44:53 2002
--- gzz/TODO    Tue Sep 24 03:26:48 2002
***************
*** 37,52 ****
        - move mstmpimg/ to ..
      tjl:
        - distorted multi-page PDF view with xu links
            - clean up the xupdf.py file
            - texture performance, look at imagecache
                - need to create lower-resolution versions since
                  BASE_LEVEL doesn't quite suffice
!           - buoy edges, distorted
!           - entry / link making bindings
!           - saving
            - better distortion 
                - better function
!               - faster, using vertex arrays?
            - text
            - larger startup structure
        - script the demo, determine in detail all features
--- 37,57 ----
        - move mstmpimg/ to ..
      tjl:
        - distorted multi-page PDF view with xu links
+           - abstract distortion out into libfisheye, for buoy edges etc.
+               - use templates to make sure that we get performance
+               - vertex arrays?
+           - buoy edges, distorted
            - clean up the xupdf.py file
            - texture performance, look at imagecache
                - need to create lower-resolution versions since
                  BASE_LEVEL doesn't quite suffice
!                   - basic code is there, think about this further
!                     when we have a larger structure where this is a problem.
            - better distortion 
                - better function
!               - adjustable zoom / area by mouse
!           - entry / link making bindings
!           - saving
            - text
            - larger startup structure
        - script the demo, determine in detail all features
***************
*** 86,91 ****
--- 91,99 ----
      anybody:
        - a really comprehensive web page of screenshots
          and instructions on how to get them and run.
+       - make gldemo able to use fullscreen sync_to_vblank mode so that we 
could
+         get the benefits of page flipping. How does this interact with e.g. 
+         twinview? Need to turn it off?
      
  0.8alpha4: Cleanup release after crucial demos for continued funding 
      tuukkah:
Index: gzz/gfx/demo/gldemo.py
diff -c gzz/gfx/demo/gldemo.py:1.22 gzz/gfx/demo/gldemo.py:1.23
*** gzz/gfx/demo/gldemo.py:1.22 Mon Sep 23 05:09:29 2002
--- gzz/gfx/demo/gldemo.py      Tue Sep 24 03:26:48 2002
***************
*** 9,18 ****
  from java.lang import System,Runnable
  import java
  from gzz.client import *
! from gzz.gfx.gl import GL, GLRen, Paper
  import math
  import getopt
  import gzz.util
  import traceback
  
  System.setProperty("gzzclient", "gl")
--- 9,19 ----
  from java.lang import System,Runnable
  import java
  from gzz.client import *
! from gzz.gfx.gl import GL, GLRen, GLSpans, Paper
  import math
  import getopt
  import gzz.util
+ import gzz
  import traceback
  
  System.setProperty("gzzclient", "gl")
Index: gzz/gfx/demo/xupdf.py
diff -c gzz/gfx/demo/xupdf.py:1.20 gzz/gfx/demo/xupdf.py:1.21
*** gzz/gfx/demo/xupdf.py:1.20  Mon Sep 23 04:37:04 2002
--- gzz/gfx/demo/xupdf.py       Tue Sep 24 03:26:48 2002
***************
*** 4,16 ****
  # with Xanadu links between PDF and text.
  
  screensize = (1024, 768) # assuming XGA projector.
  screenctr = (0.9 * screensize[0]/2, screensize[1]/2)
  
  AbstractUpdateManager.defaultAnimationTime = 3000
  AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()
  
- from gzz.gfx.gl import GL,GLRen,GLSpans,Paper
- import gzz
  from test.tools import tools
  execfile("gfx/libutil/effects.py")
  execfile("gfx/libpaper/papermill.py")
--- 4,17 ----
  # with Xanadu links between PDF and text.
  
  screensize = (1024, 768) # assuming XGA projector.
+ 
+ # center = little above physical center
  screenctr = (0.9 * screensize[0]/2, screensize[1]/2)
  
+ # Slow animation for the demo.
  AbstractUpdateManager.defaultAnimationTime = 3000
  AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()
  
  from test.tools import tools
  execfile("gfx/libutil/effects.py")
  execfile("gfx/libpaper/papermill.py")
***************
*** 73,78 ****
--- 74,81 ----
  
  globalcurlinks = {}
  
+ globalLOD = 1
+ 
  def takeLink(toenf, tocell):
      """Move along a xu connection to given cell (with given enf).
  
***************
*** 131,137 ****
      scrollblockPaper = getScrollblockPaper(contentspan.getScrollBlock())
      ret = []
      for i in range(0, content.length()):
!       rect = GLSpans.getRect(contentspan.subSpan(i,i+1))
        ret.append(
            (scrollblockPaper, pdfpaper(rect))
        )
--- 134,141 ----
      scrollblockPaper = getScrollblockPaper(contentspan.getScrollBlock())
      ret = []
      for i in range(0, content.length()):
!       rect = GLSpans.getRect(contentspan.subSpan(i,i+1), globalLOD)
!       print "Rect: ",globalLOD, rect
        ret.append(
            (scrollblockPaper, pdfpaper(rect))
        )
***************
*** 140,148 ****
      
  
  def globalkey(key):
!     global globalusefancypaper, globalseedoffs
      if '1' <= key <= '9':
        moveToCell(cells[int(key)-1])
      elif key == 'p':
        globalusefancypaper = not globalusefancypaper
      elif key == ',':
--- 144,156 ----
      
  
  def globalkey(key):
!     global globalusefancypaper, globalseedoffs, globalLOD
      if '1' <= key <= '9':
        moveToCell(cells[int(key)-1])
+     elif key == 'l':
+       globalLOD = 1 - globalLOD
+       print "Lod: ",globalLOD
+       AbstractUpdateManager.chg()
      elif key == 'p':
        globalusefancypaper = not globalusefancypaper
      elif key == ',':
***************
*** 225,232 ****
      scale = h/ph
      curx = x - paperx * scale
      ycoord = y - papery * scale
!     print "x,y for place: ",curx, ycoord
!     print papers
      grid = 13
      if cliprect == None:
        fishargs = (0, 0, papers[0][1][1], papers[0][1][2], grid, grid, 1)
--- 233,240 ----
      scale = h/ph
      curx = x - paperx * scale
      ycoord = y - papery * scale
!     # print "x,y for place: ",curx, ycoord
!     # print papers
      grid = 13
      if cliprect == None:
        fishargs = (0, 0, papers[0][1][1], papers[0][1][2], grid, grid, 1)
***************
*** 280,286 ****
        d = self.linkspan.getSize()
        height = 400
        pt = paperpoint(pap, height, self.linkspan.offset(), p.x+0.5*d.width, 
p.y+0.5*d.height)
!       print "PT: ",pt
        
        cs2 = vs.coords.affineCoordsys(0, self.cell.getId()+"__bulg", 
            0.05, 0, 0, bs, 0, 0, bs)
--- 288,294 ----
        d = self.linkspan.getSize()
        height = 400
        pt = paperpoint(pap, height, self.linkspan.offset(), p.x+0.5*d.width, 
p.y+0.5*d.height)
!       # print "PT: ",pt
        
        cs2 = vs.coords.affineCoordsys(0, self.cell.getId()+"__bulg", 
            0.05, 0, 0, bs, 0, 0, bs)
Index: gzz/gzz/gfx/gl/GLSpans.java
diff -c gzz/gzz/gfx/gl/GLSpans.java:1.6 gzz/gzz/gfx/gl/GLSpans.java:1.7
*** gzz/gzz/gfx/gl/GLSpans.java:1.6     Mon Sep 23 10:38:31 2002
--- gzz/gzz/gfx/gl/GLSpans.java Tue Sep 24 03:26:48 2002
***************
*** 20,25 ****
--- 20,31 ----
       */
      public static String colorFormat;
  
+     /** Unfortunately we need to store the textures at two different levels
+      * since adjusting TEXTURE_BASE_LEVEL does not have enough effect.
+      *
+      */
+     public static int LODscale = 2;
+ 
      /** Determine which texture formats are supported.
       */
      private static void init() {
***************
*** 38,43 ****
--- 44,50 ----
  
      /** A rectangle in a texture.
       * XXX Make data members final
+      * XXX Maybe promote this class to gzz.gfx.gl.GL
       */
      static public class Rect {
        public int texId;
***************
*** 52,58 ****
            return c0 + (c1-c0)*c;
        }
      };
!     static HashMap pages = new HashMap();
  
      static class LoadedTexRect {
        LoadedTexRect(String file) {
--- 59,67 ----
            return c0 + (c1-c0)*c;
        }
      };
!     /** Span to rect, by LOD.
!      */
!     static HashMap[] pages = new HashMap[] { new HashMap(), new HashMap() } ;
  
      static class LoadedTexRect {
        LoadedTexRect(String file) {
***************
*** 63,82 ****
            int overw = 1; while(overw < w) overw *= 2;
            int overh = 1; while(overh < h) overh *= 2;
            tex = GL.createTexture();
            tex.loadNull2D(0, colorFormat, overw, overh, 0, "RGB", "FLOAT");
            tex.loadSubImage(0, img, 0, 0);
!           // tex.shade(overw, overh, 0, 1, "LUMINANCE4", "LUMINANCE", 
"noise", new String[] {});
            rect = new Rect();
            rect.texId = tex.getTexId();
            rect.x0 = 0;
            rect.y0 = 0;
            rect.x1 = w / (float)overw;
            rect.y1 = h / (float)overh;
            img = null;
            System.gc(); // GC the image, it's big.
        }
        GL.Texture tex; // Need to save this so it won't get GC'ed.
        Rect rect;
        /** Width and height in pixels of the loaded image.
         */
        int w, h;
--- 72,102 ----
            int overw = 1; while(overw < w) overw *= 2;
            int overh = 1; while(overh < h) overh *= 2;
            tex = GL.createTexture();
+           texLR = GL.createTexture();
            tex.loadNull2D(0, colorFormat, overw, overh, 0, "RGB", "FLOAT");
            tex.loadSubImage(0, img, 0, 0);
!           tex.downsampleInto(texLR, "TEXTURE_2D", LODscale, colorFormat, 
"RGB");
            rect = new Rect();
            rect.texId = tex.getTexId();
            rect.x0 = 0;
            rect.y0 = 0;
            rect.x1 = w / (float)overw;
            rect.y1 = h / (float)overh;
+           rectLR = new Rect();
+           rectLR.texId = texLR.getTexId();
+           rectLR.x0 = rect.x0;
+           rectLR.y0 = rect.y0;
+           rectLR.x1 = rect.x1;
+           rectLR.y1 = rect.y1;
            img = null;
            System.gc(); // GC the image, it's big.
        }
        GL.Texture tex; // Need to save this so it won't get GC'ed.
+       GL.Texture texLR;
        Rect rect;
+       /** Low-resolution rectangle.
+        */
+       Rect rectLR;
        /** Width and height in pixels of the loaded image.
         */
        int w, h;
***************
*** 86,92 ****
       * given pagespan.
       */
      static public Rect getRect(PageSpan span) {
!       Rect r = (Rect)pages.get(span);
        if(r == null) {
            // ScrollBlockManager.PageSpanBase span = 
            //  (ScrollBlockManager.PageSpanBase)span0;
--- 106,122 ----
       * given pagespan.
       */
      static public Rect getRect(PageSpan span) {
!       return getRect(span, 0);
!     }
!     /** Return a Rect containing the first page of the
!      * given pagespan.
!      * @param lod The level of detail. Currently, only 0 (sharpest) and 1 
(smallest)
!      *                are known.
!      */
!     static public Rect getRect(PageSpan span, int lod) {
!       if(lod < 0) lod = 0;
!       if(lod > 1) lod = 1;
!       Rect r = (Rect)pages[lod].get(span);
        if(r == null) {
            // ScrollBlockManager.PageSpanBase span = 
            //  (ScrollBlockManager.PageSpanBase)span0;
***************
*** 100,114 ****
  
            LoadedTexRect rect = getImage(file);
            r = new Rect();
!           r.texId = rect.rect.texId;
!           r.x0 = (float)rect.rect.getTexCoord(0, resmult * p.x / rect.w);
!           r.x1 = (float)rect.rect.getTexCoord(0, resmult * (p.x+d.width) / 
rect.w);
!           r.y0 = (float)rect.rect.getTexCoord(1, resmult * p.y / rect.h);
!           r.y1 = (float)rect.rect.getTexCoord(1, resmult * (p.y+d.height) / 
rect.h);
            r.w = d.width;
            r.h = d.height;
  
!           pages.put(span, r);
        }
        return r;
      }
--- 130,145 ----
  
            LoadedTexRect rect = getImage(file);
            r = new Rect();
!           Rect ltr = (lod == 0 ? rect.rect : rect.rectLR);
!           r.texId = ltr.texId;
!           r.x0 = (float)ltr.getTexCoord(0, resmult * p.x / rect.w);
!           r.x1 = (float)ltr.getTexCoord(0, resmult * (p.x+d.width) / rect.w);
!           r.y0 = (float)ltr.getTexCoord(1, resmult * p.y / rect.h);
!           r.y1 = (float)ltr.getTexCoord(1, resmult * (p.y+d.height) / rect.h);
            r.w = d.width;
            r.h = d.height;
  
!           pages[lod].put(span, r);
        }
        return r;
      }




reply via email to

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