[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./Makefile ./TODO doc/pegboard/diceable--tj...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz ./Makefile ./TODO doc/pegboard/diceable--tj... |
Date: |
Thu, 19 Dec 2002 04:12:40 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/12/19 04:12:39
Modified files:
. : Makefile TODO
doc/pegboard/diceable--tjl: peg.rst
doc/pegboard/vobscene_interp--tjl: peg.rst
gfx/demo : vpbuoy.py
gfx/demo/fillet: __init__.py oldcode.py
gfx/libcoords : Coords.cxx
gfx/libmosaic : Mosaic.hxx
gfx/libos : Os-GLX.cxx
gfx/libutil : Vec23.hxx
gfx/util : cg.py demo.py
gzz/view : xubuoy.py
gzz/vob/buoy : CircleFloater4.java
test/gzz/gfx/gl: glvobcoorder.test
Log message:
Fillet demo ui
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Makefile.diff?tr1=1.225&tr2=1.226&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.461&tr2=1.462&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/diceable--tjl/peg.rst.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/vobscene_interp--tjl/peg.rst.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/vpbuoy.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillet/__init__.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillet/oldcode.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.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libmosaic/Mosaic.hxx.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os-GLX.cxx.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/Vec23.hxx.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/cg.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/util/demo.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/xubuoy.py.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/buoy/CircleFloater4.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/glvobcoorder.test.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
Patches:
Index: gzz/Makefile
diff -u gzz/Makefile:1.225 gzz/Makefile:1.226
--- gzz/Makefile:1.225 Wed Dec 18 10:56:09 2002
+++ gzz/Makefile Thu Dec 19 04:12:38 2002
@@ -445,7 +445,7 @@
runblob:
$(GLLIB) $(JYTHON) $(GLDEMO) gfx/demo/blob/Obj.py
runfillets:
- $(GLLIB) $(JYTHON) $(GLDEMO) gfx/demo/fillets.py
+ $(GLLIB) $(JYTHON) $(GLDEMO) gfx.demo.fillet
runglinfo:
$(GLLIB) $(JYTHON) $(GLDEMO) gfx/demo/opengl/glinfo.py
runstencil:
Index: gzz/TODO
diff -u gzz/TODO:1.461 gzz/TODO:1.462
--- gzz/TODO:1.461 Wed Dec 18 05:02:27 2002
+++ gzz/TODO Thu Dec 19 04:12:38 2002
@@ -51,12 +51,13 @@
- less pages
tjl:
+ return ANKOS to Agora [ blocked by: waiting for trip to agora ]
- - buoys shouldn't vanish: fix up buoy geometry
+ - for mudyc, PP: vobscene_interp
- go through most important GL demos and redo the interfaces
and document
+ - xupdf
+ - fix for new buoys
- irregu
- paper
- - xupdf
- gl demo help
- scenes!
- a really comprehensive web page of screenshots, animations
@@ -259,6 +260,9 @@
work like affineCoordsys and setAffineParams, so
that we can set the params from outside easier.
anybody:
+ - Mosaic: don't store texture in memory;
+ storing in only the OpenGL texture object will
+ save memory and time.
- Coords.hxx: methods to transform many points at a time
to avoid virtual function call overhead
+ Check graphics in client starting unit tests
Index: gzz/doc/pegboard/diceable--tjl/peg.rst
diff -u gzz/doc/pegboard/diceable--tjl/peg.rst:1.2
gzz/doc/pegboard/diceable--tjl/peg.rst:1.3
--- gzz/doc/pegboard/diceable--tjl/peg.rst:1.2 Wed Dec 18 12:16:40 2002
+++ gzz/doc/pegboard/diceable--tjl/peg.rst Thu Dec 19 04:12:38 2002
@@ -3,8 +3,8 @@
=============================================================
:Author: Tuomas J. Lukka
-:Last-Modified: $Date: 2002/12/18 17:16:40 $
-:Revision: $Revision: 1.2 $
+:Last-Modified: $Date: 2002/12/19 09:12:38 $
+:Revision: $Revision: 1.3 $
:Status: Incomplete
Re: recent discussion on gzz-dev, we need a general API
@@ -59,14 +59,16 @@
- Should structured meshes be allowed?
RESOLVED: maybe later. The idea is to cache the Diceable objects
- so they can structure themselves as desired.
+ so they can structure themselves as desired, without much performance
+ overhead.
- Should we support the OpenGL primitives ``TRIANGLE_STRIP``, etc.?
- RESOLVED: At a Java interface level. Not in the renderable interface,
- since those primitives don't really help at all when dicing.
+ RESOLVED: At first, no. Later, at a Java interface level.
+ Even later, in the renderable interface,
+ since those primitives don't really help when dicing.
It could be a little help when rendering undiced but we'll have to
- see. Can always be added later.
+ see.
Introduction
============
Index: gzz/doc/pegboard/vobscene_interp--tjl/peg.rst
diff -u gzz/doc/pegboard/vobscene_interp--tjl/peg.rst:1.1
gzz/doc/pegboard/vobscene_interp--tjl/peg.rst:1.2
--- gzz/doc/pegboard/vobscene_interp--tjl/peg.rst:1.1 Mon Dec 16 02:07:06 2002
+++ gzz/doc/pegboard/vobscene_interp--tjl/peg.rst Thu Dec 19 04:12:39 2002
@@ -3,9 +3,9 @@
=============================================================
:Author: Tuomas J. Lukka
-:Last-Modified: $Date: 2002/12/16 07:07:06 $
-:Revision: $Revision: 1.1 $
-:Status: Incomplete
+:Last-Modified: $Date: 2002/12/19 09:12:39 $
+:Revision: $Revision: 1.2 $
+:Status: Current
:Affects-PEGs: vob_considerations--benja, vobcoorder_parents--tjl,
vobscene_hierarchies_clicks--tjl
:Type: Architecture
:Scope: Limited
@@ -77,7 +77,11 @@
Changes
=======
-
If two completely unrelated coordinate systems are to be interpolated,
linear (or other) interpolation of the **transformed points** shall be
used as a fallback.
+
+We shall not define the exact circumstances when this shall happen;
+we shall define one circumstance where this shall not happen: if
+the types of the coordinate systems, their parents and their keys are identical
+in the two vobscenes, then parameterwise interpolation shall be used.
Index: gzz/gfx/demo/fillet/__init__.py
diff -u gzz/gfx/demo/fillet/__init__.py:1.1 gzz/gfx/demo/fillet/__init__.py:1.2
--- gzz/gfx/demo/fillet/__init__.py:1.1 Thu Dec 5 12:33:52 2002
+++ gzz/gfx/demo/fillet/__init__.py Thu Dec 19 04:12:39 2002
@@ -7,3 +7,4 @@
These demonstrations show why fillets are desirable and
how they can be rendered.
"""
+
Index: gzz/gfx/demo/fillet/oldcode.py
diff -u gzz/gfx/demo/fillet/oldcode.py:1.1 gzz/gfx/demo/fillet/oldcode.py:1.2
--- gzz/gfx/demo/fillet/oldcode.py:1.1 Thu Dec 5 12:33:52 2002
+++ gzz/gfx/demo/fillet/oldcode.py Thu Dec 19 04:12:39 2002
@@ -1,277 +1,278 @@
+if 0:
-# Demo fillets
+ # Demo fillets
-from gzz.impl import *
-from gzz.view import *
-from gzz.gfx.gl import *
-from gzz.media.impl import *
-import gzz
-
-from gfx.libutil import saveanim
-reload(saveanim)
-
-red = (1, 0.2, 0.2)
-green = (0.2, 1, 0.2)
-whitish = (1,1,0.9)
-
-
-def rectangle(rgb):
- return getDList("""
- LineWidth 4
- Color %s %s %s
- Disable TEXTURE_2D
- Begin LINE_LOOP
- Vertex -1 -1
- Vertex -1 1
- Vertex 1 1
- Vertex 1 -1
- End
- """%(rgb))
-
-
-class ZZScene(AlphaCells):
- def __init__(self):
- obsTrigger = SimpleObsTrigger();
- cellTexter = SimpleVStreamTexter(FakeSpanMaker(),
- Enfilade1DImpl.Enfilade1DImplMaker())
- cellManager = PlainCellManager()
- dimManager = SimpleDim.SimpleDimManager()
- identityManager = DummyIdentityManager()
- space = self.space = gzz.impl.ModularSpace(
- cellTexter, cellManager, dimManager, identityManager, None,
obsTrigger)
- self.cursor = self.space.getHomeCell()
- d1 = self.d1 = space.getDim(space.N())
- d2 = self.d2 = space.getDim(space.N())
-
- self.home = self.space.getHomeCell()
-
- self.initStruct()
-
- self.bgcolor = (0.7, 0.8, 0.6)
-
- AlphaCells.__init__(self)
- def showstruct(self, vs, passno):
- pv = PlainVanishing()
- vc = self.getVanishingClient(vs, passno)
- class SimpleVC(ViewContext):
- def __init__(self, main):
- self.main = main
- def getAccursed(self):
- return self.main.cursor
- def getCursorColors(self, c):
- return None
- def getDims(self):
- return [self.main.d1, self.main.d2]
- def getCursorOffset(self):
- return 0
- def getWindow(self):
- return None
-
- pv.render(vc, SimpleVC(self), 400, 400)
- def getVanishingClient(self, vs, passno):
- ind = self.ind
- return gzz.gfx.gl.GLVanishingClient(vs, 0,
- self.cells[passno][ind],
- self.vert[1][ind],
- self.horiz[1][ind],
- 50, 50)
- def move(self, dim, dir):
- c = self.cursor.s(dim, dir)
- if c != None:
- self.cursor = c
- def key(self, k):
- if k == "Right":
- self.move(self.d1, 1)
- if k == "Left":
- self.move(self.d1, -1)
- if k == "Up":
- self.move(self.d2, -1)
- if k == "Down":
- self.move(self.d2, 1)
- if k == "t":
- self.ind += 1
- self.ind %= len(cellTexs)
- print "IND NOW: ",self.ind
- def scene(self, vs):
- d = w.getSize()
- putnoc(vs, background(self.bgcolor))
-
- putnoc(vs, getDList("""
- Enable ALPHA_TEST
- AlphaFunc GEQUAL 0.2
- Enable DEPTH_TEST
- Disable BLEND
- Enable TEXTURE_2D
- PushAttrib POLYGON_BIT ENABLE_BIT
- """))
-
- for passno in (0,1):
-
- if passno == 0:
- putnoc(vs, getDList("""
- Color %s %s %s
- """ % self.bgcolor))
- else:
- putnoc(vs, getDList("""
- Color 1 1 1
- """))
+ from gzz.impl import *
+ from gzz.view import *
+ from gzz.gfx.gl import *
+ from gzz.media.impl import *
+ import gzz
+
+ from gfx.libutil import saveanim
+ reload(saveanim)
+
+ red = (1, 0.2, 0.2)
+ green = (0.2, 1, 0.2)
+ whitish = (1,1,0.9)
+
+
+ def rectangle(rgb):
+ return getDList("""
+ LineWidth 4
+ Color %s %s %s
+ Disable TEXTURE_2D
+ Begin LINE_LOOP
+ Vertex -1 -1
+ Vertex -1 1
+ Vertex 1 1
+ Vertex 1 -1
+ End
+ """%(rgb))
+
+
+ class ZZScene(AlphaCells):
+ def __init__(self):
+ obsTrigger = SimpleObsTrigger();
+ cellTexter = SimpleVStreamTexter(FakeSpanMaker(),
+ Enfilade1DImpl.Enfilade1DImplMaker())
+ cellManager = PlainCellManager()
+ dimManager = SimpleDim.SimpleDimManager()
+ identityManager = DummyIdentityManager()
+ space = self.space = gzz.impl.ModularSpace(
+ cellTexter, cellManager, dimManager, identityManager, None,
obsTrigger)
+ self.cursor = self.space.getHomeCell()
+ d1 = self.d1 = space.getDim(space.N())
+ d2 = self.d2 = space.getDim(space.N())
+
+ self.home = self.space.getHomeCell()
+
+ self.initStruct()
+
+ self.bgcolor = (0.7, 0.8, 0.6)
+
+ AlphaCells.__init__(self)
+ def showstruct(self, vs, passno):
+ pv = PlainVanishing()
+ vc = self.getVanishingClient(vs, passno)
+ class SimpleVC(ViewContext):
+ def __init__(self, main):
+ self.main = main
+ def getAccursed(self):
+ return self.main.cursor
+ def getCursorColors(self, c):
+ return None
+ def getDims(self):
+ return [self.main.d1, self.main.d2]
+ def getCursorOffset(self):
+ return 0
+ def getWindow(self):
+ return None
+
+ pv.render(vc, SimpleVC(self), 400, 400)
+ def getVanishingClient(self, vs, passno):
+ ind = self.ind
+ return gzz.gfx.gl.GLVanishingClient(vs, 0,
+ self.cells[passno][ind],
+ self.vert[1][ind],
+ self.horiz[1][ind],
+ 50, 50)
+ def move(self, dim, dir):
+ c = self.cursor.s(dim, dir)
+ if c != None:
+ self.cursor = c
+ def key(self, k):
+ if k == "Right":
+ self.move(self.d1, 1)
+ if k == "Left":
+ self.move(self.d1, -1)
+ if k == "Up":
+ self.move(self.d2, -1)
+ if k == "Down":
+ self.move(self.d2, 1)
+ if k == "t":
+ self.ind += 1
+ self.ind %= len(cellTexs)
+ print "IND NOW: ",self.ind
+ def scene(self, vs):
+ d = w.getSize()
+ putnoc(vs, background(self.bgcolor))
+
+ putnoc(vs, getDList("""
+ Enable ALPHA_TEST
+ AlphaFunc GEQUAL 0.2
+ Enable DEPTH_TEST
+ Disable BLEND
+ Enable TEXTURE_2D
+ PushAttrib POLYGON_BIT ENABLE_BIT
+ """))
- self.showstruct(vs, passno)
+ for passno in (0,1):
- putnoc(vs, getDList("""
- PopAttrib
- """))
- return vs
+ if passno == 0:
+ putnoc(vs, getDList("""
+ Color %s %s %s
+ """ % self.bgcolor))
+ else:
+ putnoc(vs, getDList("""
+ Color 1 1 1
+ """))
-class NormalZZScene(ZZScene):
- def initStruct(self):
- home = self.home
- d1,d2 = (self.d1, self.d2)
- home.connect(d2, home.N(self.d1).N(self.d2).N(self.d1))
- self.ind = 5
-
-
-class ExpScene(AlphaCells):
- def __init__(self):
- self.cw = 8
- self.ch = 8
- self.jx = 3
- self.jy = 5
- self.dx = 1
- self.zoom = 1
- self.cs = [
- [None for y in range(0, self.ch)] for
- x in range(0, self.cw)]
- self.ind = 1
-
- AlphaCells.__init__(self)
-
- self.bgcolor = (0.8, 0.5, 0.8)
- def putcs(self, vs):
- for x in range(0,self.cw):
- for y in range(0, self.ch):
- self.cs[x][y]=vs.coords.ortho(str(x)+"_"+str(y), 10,
- x + 0.2 , y + 0.2, 0.6, 0.6)
- def key(self, k):
- if k == "s":
- self.dx = 1-self.dx
- if k == "z":
- self.zoom = 1-self.zoom
- if k == "t":
- self.ind += 1
- self.ind %= len(cellTexs)
- print "IND NOW: ",self.ind
- pass
-
- def scene(self, vs):
- d = w.getSize()
- putnoc(vs, background(self.bgcolor))
- self.putcs(vs)
-
- putnoc(vs, getDList("""
- Enable ALPHA_TEST
- AlphaFunc GEQUAL 0.2
- Enable DEPTH_TEST
- DepthFunc LEQUAL
- Disable BLEND
- Enable TEXTURE_2D
- """))
-
- if self.zoom:
- zw = 320
- transaffine(vs, "aff", d.width/2-zw*(self.jx+0.5),
- d.height/2-zw*(self.jy+0.5),
- zw, 0, 0, zw)
- else:
- zw = d.height / self.ch
- transaffine(vs, "aff", 0, 0, zw, 0, 0, zw)
-
- for passno in (0,1):
-
- if passno == 0:
- putnoc(vs, getDList("""
- Color %s %s %s
- """ % self.bgcolor))
- else:
- putnoc(vs, getDList("""
- Color 1 1 1
+ self.showstruct(vs, passno)
+
+ putnoc(vs, getDList("""
+ PopAttrib
"""))
+ return vs
+
+ class NormalZZScene(ZZScene):
+ def initStruct(self):
+ home = self.home
+ d1,d2 = (self.d1, self.d2)
+ home.connect(d2, home.N(self.d1).N(self.d2).N(self.d1))
+ self.ind = 5
+
+
+ class ExpScene(AlphaCells):
+ def __init__(self):
+ self.cw = 8
+ self.ch = 8
+ self.jx = 3
+ self.jy = 5
+ self.dx = 1
+ self.zoom = 1
+ self.cs = [
+ [None for y in range(0, self.ch)] for
+ x in range(0, self.cw)]
+ self.ind = 1
+ AlphaCells.__init__(self)
+
+ self.bgcolor = (0.8, 0.5, 0.8)
+ def putcs(self, vs):
for x in range(0,self.cw):
for y in range(0, self.ch):
- vs.map.put(
- self.cells[passno][self.ind],
- self.cs[x][y]
- )
+ self.cs[x][y]=vs.coords.ortho(str(x)+"_"+str(y), 10,
+ x + 0.2 , y + 0.2, 0.6, 0.6)
+ def key(self, k):
+ if k == "s":
+ self.dx = 1-self.dx
+ if k == "z":
+ self.zoom = 1-self.zoom
+ if k == "t":
+ self.ind += 1
+ self.ind %= len(cellTexs)
+ print "IND NOW: ",self.ind
+ pass
+
+ def scene(self, vs):
+ d = w.getSize()
+ putnoc(vs, background(self.bgcolor))
+ self.putcs(vs)
+
+ putnoc(vs, getDList("""
+ Enable ALPHA_TEST
+ AlphaFunc GEQUAL 0.2
+ Enable DEPTH_TEST
+ DepthFunc LEQUAL
+ Disable BLEND
+ Enable TEXTURE_2D
+ """))
- for x in range(0,self.cw-1):
- for y in range(0, self.ch):
- if self.dx and y == self.jy:
- if x == self.jx:
- continue
- if x == self.jx-1:
- vs.map.put(
- self.horiz[passno][self.ind],
- self.cs[x][y],
- self.cs[x+2][y]
- )
- continue
- vs.map.put(
- self.horiz[passno][self.ind],
- self.cs[x][y],
- self.cs[x+1][y]
- )
+ if self.zoom:
+ zw = 320
+ transaffine(vs, "aff", d.width/2-zw*(self.jx+0.5),
+ d.height/2-zw*(self.jy+0.5),
+ zw, 0, 0, zw)
+ else:
+ zw = d.height / self.ch
+ transaffine(vs, "aff", 0, 0, zw, 0, 0, zw)
- for x in range(0,self.cw):
- for y in range(0, self.ch-1):
- if (not self.dx) and x == self.jx:
- if y == self.jy:
- continue
- if y == self.jy-1:
- vs.map.put(
- self.vert[passno][self.ind],
- self.cs[x][y+2],
- self.cs[x][y]
- )
- continue
- vs.map.put(
- self.vert[passno][self.ind],
- self.cs[x][y+1],
- self.cs[x][y],
- )
-
- poptrans(vs, "aff")
-
- return vs
-
-def quad(rgb):
- return getDList("""
- LineWidth 4
- Color %s %s %s
- Disable TEXTURE_2D
- Begin QUADS
- Vertex -1 -1
- Vertex -1 1
- Vertex 1 1
- Vertex 1 -1
- End
- """%(rgb))
-
-def globalkey(k):
- if k == "0":
- sc = AlphaBlendScene2()
- vs1 = w.createVobScene()
- vs2 = w.createVobScene()
- sc.scene(vs1)
- sc.key("p")
- sc.scene(vs2)
- s = { "x" : 20, "y" : 20, "w" : 600, "h" : 600 }
- saveanim.savesequence(w, "tmpfilm/frame0.", vs1, vs2, 30, **s)
- saveanim.savesequence(w, "tmpfilm/frame1.", vs2, vs1, 20, **s)
+ for passno in (0,1):
+
+ if passno == 0:
+ putnoc(vs, getDList("""
+ Color %s %s %s
+ """ % self.bgcolor))
+ else:
+ putnoc(vs, getDList("""
+ Color 1 1 1
+ """))
+
+ for x in range(0,self.cw):
+ for y in range(0, self.ch):
+ vs.map.put(
+ self.cells[passno][self.ind],
+ self.cs[x][y]
+ )
+
+ for x in range(0,self.cw-1):
+ for y in range(0, self.ch):
+ if self.dx and y == self.jy:
+ if x == self.jx:
+ continue
+ if x == self.jx-1:
+ vs.map.put(
+ self.horiz[passno][self.ind],
+ self.cs[x][y],
+ self.cs[x+2][y]
+ )
+ continue
+ vs.map.put(
+ self.horiz[passno][self.ind],
+ self.cs[x][y],
+ self.cs[x+1][y]
+ )
+
+ for x in range(0,self.cw):
+ for y in range(0, self.ch-1):
+ if (not self.dx) and x == self.jx:
+ if y == self.jy:
+ continue
+ if y == self.jy-1:
+ vs.map.put(
+ self.vert[passno][self.ind],
+ self.cs[x][y+2],
+ self.cs[x][y]
+ )
+ continue
+ vs.map.put(
+ self.vert[passno][self.ind],
+ self.cs[x][y+1],
+ self.cs[x][y],
+ )
+
+ poptrans(vs, "aff")
+
+ return vs
+
+ def quad(rgb):
+ return getDList("""
+ LineWidth 4
+ Color %s %s %s
+ Disable TEXTURE_2D
+ Begin QUADS
+ Vertex -1 -1
+ Vertex -1 1
+ Vertex 1 1
+ Vertex 1 -1
+ End
+ """%(rgb))
+
+ def globalkey(k):
+ if k == "0":
+ sc = AlphaBlendScene2()
+ vs1 = w.createVobScene()
+ vs2 = w.createVobScene()
+ sc.scene(vs1)
+ sc.key("p")
+ sc.scene(vs2)
+ s = { "x" : 20, "y" : 20, "w" : 600, "h" : 600 }
+ saveanim.savesequence(w, "tmpfilm/frame0.", vs1, vs2, 30, **s)
+ saveanim.savesequence(w, "tmpfilm/frame1.", vs2, vs1, 20, **s)
- saveanim.encodefilm("tmpfilm/frame\\*", "filletfilm.avi")
+ saveanim.encodefilm("tmpfilm/frame\\*", "filletfilm.avi")
- return 0
+ return 0
-currentScene = scenes[0]
+ currentScene = scenes[0]
Index: gzz/gfx/demo/vpbuoy.py
diff -u gzz/gfx/demo/vpbuoy.py:1.10 gzz/gfx/demo/vpbuoy.py:1.11
--- gzz/gfx/demo/vpbuoy.py:1.10 Wed Dec 18 05:01:15 2002
+++ gzz/gfx/demo/vpbuoy.py Thu Dec 19 04:12:39 2002
@@ -1,6 +1,7 @@
from gfx.util.misc import *
from gfx.util import vparb, cg
from java.lang import Math
+import math
class Scene:
@@ -56,17 +57,8 @@
}
- outs main(
- float4 orig : POSITION,
- float4 texcoord : TEXCOORD0, // if on circle, texcoord.x =
angle
- float4 color : COLOR,
- uniform float4 p : C0,
- uniform float4 origin : C1,
- uniform float rad : C2,
- uniform float oncircle : C3
- ) {
- outs o;
- float2 anchor = anchorPlace(orig);
+ void projectionCircle(float2 anchor, float2 p, float2 origin, float
rad, out float2 ncenter, out float nrad, out float2 np,
+ out float nscale) {
float2 ap = anchor.xy - p.xy;
float2 ao = anchor.xy - origin.xy;
@@ -74,105 +66,105 @@
float aplen = length(ap);
float aolen = length(ao);
float2 apnor = ap / aplen;
- float2 opnor = normalize(origin.xy - p.xy);
+ float2 opnor = (origin.xy - p.xy) / rad;
- float outside = smoothstep(.8, 1.2, aolen /rad);
+ float aolenrel = aolen / rad;
+ float outside = smoothstep(0.7, 1.3, aolenrel);
// float outside = 1;
// component of a..origin perpendicular to
// origin--p
- float2 yperp = ao - dot(ao,opnor) * opnor;
+ float xc = dot(ap, opnor);
+ float2 xperp = xc * opnor;
- float2 ccenter = origin.xy + outside * yperp;
+ float2 yperp = ap - xperp;
- // float vrad = rad * (1 - .25 * (2 - aplen/rad));
- float vrad = lerp(rad, 20 + distance(anchor, ccenter), outside);
+ float ang = (xc-.4 * rad) / length(yperp);
+ float angmove = min(1, 1 - smoothstep(-.1, .1, ang) + outside);
+ // (ang > 0 ? 0 : 1); // 1-smoothstep(-.8, -.5, ang
);
+ // float pmove = 1-smoothstep(-.5,-.4,ang);
+ float pmove = smoothstep(1.3,1.5,aolenrel);
- float2 projected = project2circle(anchor.xy,
- p.xy + outside * yperp,
- ccenter,
- vrad);
-
-
+ ncenter = lerp(
+ origin.xy ,
+ anchor.xy - 20 * opnor,
+ angmove
+ );
+ // float vrad = rad * (1 - .25 * (2 - aplen/rad));
+ nrad = lerp(rad,
+ 20 + distance(anchor, ncenter)
+ , outside);
- float4 buoy;
- buoy.xy = (oncircle > 0 ?
- ccenter + vrad * float2(sin(texcoord.x), cos(texcoord.x))
- : (orig.z > 0 ?
- projected
- // lerp(anchor + opnor * 20 , projected, 1-outside)
- : anchor));
- buoy.z = 1-orig.z;
- buoy.w = 1;
+ np = lerp(p.xy ,
+ anchor.xy - 40*opnor, pmove);
- o.pos = mul(glstate.matrix.mvp, buoy);
- o.pointsize = float4(3. + 60. * orig.z * max(1-aolen/rad, 0),
0, 0, 0);
- o.color = color;
- return o;
+ nscale = 60. * max(1-aolenrel, 0);
}
- outs foo(
+ outs main(
float4 orig : POSITION,
- float4 texcoord : TEXCOORD0,
+ float4 texcoord : TEXCOORD0, // if on circle, texcoord.x =
angle
+ float2 texcoord1 : TEXCOORD1, // if on circle, texcoord.x =
angle
float4 color : COLOR,
uniform float4 p : C0,
- uniform float4 origin : C1
+ uniform float4 origin : C1,
+ uniform float rad : C2,
+ uniform float oncircle : C3
) {
- // float4 p = { 100, 350, 0, 0 };
- // float4 origin = { 500, 350, 0, 0};
- float rad = 400;
-
outs o;
+ float2 anchor = anchorPlace(orig);
+ float nrad;
+ float2 ncenter;
+ float2 np;
+ float nscale;
- float4x4 pmat = glstate.matrix.program[0];
+ projectionCircle(anchor, p.xy, origin.xy, rad, ncenter, nrad,
np, nscale);
- float2 anchor;
- anchor.x = dot(pmat[0], orig);
- anchor.y = dot(pmat[1], orig);
- float w = dot(pmat[3], orig);
- anchor /= w;
+ float2 projected = project2circle(anchor.xy,
+ np,
+ ncenter,
+ nrad);
- float a2o = distance(anchor.xy, origin.xy) / rad;
- float2 ap ;
- ap.xy = anchor.xy - p.xy;
- float a2p = length(ap) / rad;
- // first coordinate
- float c1 = (a2o < 1 ? a2p / 2 : 0);
- // Two separate locations
- float s1 = .9 * (1-c1);
- float s2 = max(0, -1 + 10*c1);
- float ctrhat = max(0, 1-a2o);
+ float4 buoy;
- float shift = .4 * ctrhat / a2p;
+ float2 sc;
- // the "default" position
- float2 defbuoy = anchor + ap * shift;
+ buoy.xy = (oncircle > 0 ?
+ ncenter + nrad * texcoord1
+ : (orig.z > 0 ?
+ projected
+ // lerp(anchor + opnor * 20 , projected, 1-outside)
+ : anchor));
- float d2o = distance(defbuoy.xy, origin.xy) / rad;
- // float dir = 2.*(
- float dir = dot(defbuoy.xy - origin.xy, ap.xy) > 0 ? 1 : -1;
- // Push away
- shift = 0.6 * dir * ctrhat ;
- float4 buoy;
- buoy.xy = anchor + orig.z * (ap * shift + .1 * (origin.xy -
p.xy));
+
+ float2 proj = project2circle(anchor.xy, p.xy, origin.xy, rad);
+ float2 shif = anchor.xy + 20/rad * (origin.xy - p.xy);
+ float shifrad = distance(shif, origin.xy);
+ float arad = distance(anchor, origin.xy);
+ buoy.xy = (orig.z > 0 ?
+ (shifrad > rad ?
+ shif :
+ (arad > rad ?
+ anchor :
+ proj))
+ : anchor.xy);
buoy.z = 1-orig.z;
buoy.w = 1;
o.pos = mul(glstate.matrix.mvp, buoy);
- o.color = float4(1-orig.z, dir, dir, color.w);
- o.pointsize = float4(4. + 4. * orig.z, 0, 0, 0);
-
+ o.pointsize.x = 3 + orig.z * nscale;
+ o.color = color;
return o;
}
"""
@@ -380,8 +372,9 @@
vert3 = " ".join([
"""TexCoord %s 0
+ MultiTexCoord TEXTURE1 %s %s
Vertex 0 0 1 1
- """ % x
+ """ % (x, math.sin(x), math.cos(x))
for x in floats(0, 2*3.15, 50)
])
Index: gzz/gfx/libcoords/Coords.cxx
diff -u gzz/gfx/libcoords/Coords.cxx:1.56 gzz/gfx/libcoords/Coords.cxx:1.57
--- gzz/gfx/libcoords/Coords.cxx:1.56 Fri Dec 13 09:49:38 2002
+++ gzz/gfx/libcoords/Coords.cxx Thu Dec 19 04:12:39 2002
@@ -472,19 +472,43 @@
}
};
+
+ /** Project a point through another point to a circle.
+ * @param pt the point to project
+ * @param p the projection center
+ * @param ctr The center of the circle
+ * @param rad The radius of the circle
+ * @return The projected point, or if not possible, the original pt.
+ */
+ Vec project2circle(Vec pt, Vec p, Vec ctr, float rad) {
+ Vec ao = pt - ctr;
+ Vec ap = pt - p;
+
+ // Coefficients of the 2nd degree equation
+ float a = dot(ap, ap);
+ float b = 2*dot(ap, ao);
+ float c = dot(ao, ao) - rad * rad;
+
+ // determinant of the equation
+ float det = b*b - 4*a*c;
+
+ float ans = (det > 0 ? (-b + sqrt(det)) / (2*a) : 0);
+
+ return pt + ans * ap;
+
+ }
+
+
/** Buoy coordinates.
* <p>
* The depth is between -1 (center) and 0 (edge)
* <p>
* Parameter layout:
- * x_circle, y_circle, radius, x_projpoint, y_projpoint, pointdir
+ * x_circle, y_circle, radius, x_projpoint, y_projpoint, shiftamount
* <p>
- * Pointdir = 0 -> place at center, pointdir = 1, place
- * normally, -1, place with projpoint = center+(center-projpoint)
* Linear interp between 0..1, 0..-1
*/
class BuoyOnCircleCoords {
- bool valid;
public:
typedef AffineXYCoords BaseTransform;
enum { NParams = 6, NDetermining = 1 };
@@ -493,66 +517,53 @@
CoordSys *anchor = *anchorp;
- float pointdir = params[5];
- ZVec ctr(params[0], params[1], 0);
- ZVec proj(params[3], params[4], 0);
+ Pt ctr(params[0], params[1]);
+ Pt proj(params[3], params[4]);
float radius = params[2];
+ float shiftamount = params[5];
- if(pointdir < 0) {
- proj = ctr + (ctr - proj);
- pointdir = -pointdir;
- }
// Get the anchor of the buoy
- ZPt anchorPt = anchor->transform(ZPt(0,0,0));
- // Now that we have the anchor, project
- // from it to the circle.
- ZVec amc = proj - ctr; amc.z = 0;
- ZVec v = anchorPt - proj; v.z = 0;
- // coeffs of 2nd degree eq
- float a = v.dot(v);
- float b = 2*v.dot(amc);
- float c = amc.dot(amc) - radius*radius;
-
- float rdist = (anchorPt-ctr).length() / radius;
-
- float det = b*b - 4*a*c;
-
- DBG(dbg_buoy) << "eq: "<<anchorPt<<" "<<amc<<" "<<v<<" "<<a<<"
"<<b<<" "<<c<<"\n";
-
- ZPt pt;
- if(det <= 0) {
- pt = ZVec(0,0,0);
- DBG(dbg_buoy) << "No solution - zero\n";
- } else {
- float ans = (-b + sqrt(det)) / (2*a);
- pt = proj + ans * v;
- DBG(dbg_buoy) << "solution: "<<pt<<"\n";
- }
+ ZPt anchorZPt(anchor->transform(ZPt(0,0,0)));
+ Pt anchorPt(anchorZPt);
+ // shifted point: default buoy location
+ Pt shifted = anchorPt + (ctr - proj) * shiftamount;
- ZPt tr = ctr + pointdir * (pt-ctr);
+ float shiftrad = (shifted - ctr).length();
+ float anchorrad = (anchorPt - ctr).length();
+
+ Pt buoy;
+ if(shiftrad >= radius) {
+ // if shifted point is outside circle, our work is done
+ buoy = shifted;
+ } else {
+ if(anchorrad >= radius)
+ // otherwise, kludge it by placing it on the anchor.
+ // There's a small jump here; we should do it differently.
+ buoy = anchorPt; // XXX ???
+ else
+ // If both anchor and shifted point are inside circle,
+ // project.
+ buoy = project2circle(anchorPt, proj, ctr, radius);
+ }
- valid = 1;
- float scale = 1-rdist;
+ float scale = 1-anchorrad / radius ;
- if(scale <.0001) {
- valid = 0;
- scale = 1;
+ if(scale <shiftamount) {
+ scale = shiftamount;
}
- DBG(dbg_buoy) << "final: "<<tr<<" "<<valid<<" "<<scale<<"
"<<rdist<<"\n";
+ DBG(dbg_buoy) << "final: "<<buoy << " "<<" "<<scale<<" "<<"\n";
- newparams[0] = tr.x;
- newparams[1] = tr.y;
- newparams[2] = tr.z - scale;
+ newparams[0] = buoy.x;
+ newparams[1] = buoy.y;
+ newparams[2] = anchorZPt.z - scale;
newparams[3] = scale;
newparams[4] = 0;
newparams[5] = 0;
newparams[6] = scale;
}
- virtual bool shouldBeDrawn() {
- return valid;
- }
+ bool shouldBeDrawn() { return true; }
};
/** Rotation around 3D vector.
Index: gzz/gfx/libmosaic/Mosaic.hxx
diff -u gzz/gfx/libmosaic/Mosaic.hxx:1.10 gzz/gfx/libmosaic/Mosaic.hxx:1.11
--- gzz/gfx/libmosaic/Mosaic.hxx:1.10 Fri Dec 13 07:14:54 2002
+++ gzz/gfx/libmosaic/Mosaic.hxx Thu Dec 19 04:12:39 2002
@@ -474,8 +474,10 @@
/** Prepare for rendering by reloading all textures.
*/
void prepare() {
+ /*
for(unsigned i=0; i<textures.size(); i++)
textures[i]->tex->reload();
+ */
}
/** Allocate a new tile of the given width and height.
* @param border The minimum amount of null pixels around
Index: gzz/gfx/libos/Os-GLX.cxx
diff -u gzz/gfx/libos/Os-GLX.cxx:1.19 gzz/gfx/libos/Os-GLX.cxx:1.20
--- gzz/gfx/libos/Os-GLX.cxx:1.19 Fri Dec 13 07:16:06 2002
+++ gzz/gfx/libos/Os-GLX.cxx Thu Dec 19 04:12:39 2002
@@ -721,9 +721,9 @@
int w = gdk_pixbuf_get_width(pb);
int h = gdk_pixbuf_get_height(pb);
if(nc == 4) {
-
+ data.resize(w*h);
GLuint *c = (GLuint *)gdk_pixbuf_get_pixels(pb);
- copy(c, c + w * h, back_inserter(data));
+ copy(c, c + w * h, data.begin());
/*
for(int i=0; i<w*h; i++)
cout << data[i] << " ";
Index: gzz/gfx/libutil/Vec23.hxx
diff -u gzz/gfx/libutil/Vec23.hxx:1.12 gzz/gfx/libutil/Vec23.hxx:1.13
--- gzz/gfx/libutil/Vec23.hxx:1.12 Tue Oct 22 12:28:23 2002
+++ gzz/gfx/libutil/Vec23.hxx Thu Dec 19 04:12:39 2002
@@ -209,5 +209,7 @@
typedef HPoint2<float> HPt;
typedef HLine2<float> HL;
+ template<class T> T dot(Vector<T> a, Vector<T> b) { return a.dot(b); }
+
}
#endif
Index: gzz/gfx/util/cg.py
diff -u gzz/gfx/util/cg.py:1.1 gzz/gfx/util/cg.py:1.2
--- gzz/gfx/util/cg.py:1.1 Sun Dec 15 15:10:52 2002
+++ gzz/gfx/util/cg.py Thu Dec 19 04:12:39 2002
@@ -18,7 +18,7 @@
f.write(prog)
f.close()
- os.system("%s -profile arbvp1 <%s -o %s " % (_cgc, source, dest))
+ os.system("%s -longprogs -profile arbvp1 <%s -o %s " % (_cgc, source,
dest))
code = open(dest).read()
print "Got code: ",code
Index: gzz/gfx/util/demo.py
diff -u gzz/gfx/util/demo.py:1.4 gzz/gfx/util/demo.py:1.5
--- gzz/gfx/util/demo.py:1.4 Sat Dec 14 03:11:35 2002
+++ gzz/gfx/util/demo.py Thu Dec 19 04:12:39 2002
@@ -14,6 +14,7 @@
# The demos should make an effort to adapt to any window size.
import sys
+import os
# Unfortunate debianisms XXX
sys.path.insert(0, "/usr/share/jython/Lib")
sys.path.insert(0, "/usr/lib/python2.1")
@@ -50,19 +51,85 @@
currentScene = None
+def loadSubmodules(theModule):
+ """Given a package, load all its submodules.
+ Return all touched modules.
+ """
+ list = [theModule]
+ f = getattr(theModule,"__file__", None)
+ if not f: return list
+ if f[-11:] != "__init__.py": return list
+ f = f[:-11]
+ files = os.listdir(f)
+ print files
+ for n in files:
+ if n[-3:] == ".py":
+ print "Loading",n
+ name = n[:-3]
+ a = getattr(theModule, name)
+ list.extend(loadSubmodules(a))
+ return list
+
def loadScenes():
print "RELOAD"
if 1:
reloadmod.reloadModules()
try:
- exec open(scenefile) in globals(), globals()
+ if "." not in scenefile:
+ exec open(scenefile) in globals(), globals()
+ else:
+ print "No file found, trying module."
+ exec """
+import %(scenefile)s
+theModule = %(scenefile)s
+ """%globals() in globals(), globals()
+ print theModule
+ # Now, due to lazy loading, we can't find out
+ # the names of the submodules directly.
+ # Have to use this trickery.
+ mods = loadSubmodules(theModule)
+ global globalScenes
+ globalScenes = []
+ for mod in mods:
+ if getattr(mod, "Scene", None):
+ globalScenes.append(mod.Scene())
+ print globalScenes
+
+ global globalHelp, globalSceneMap, globalSceneHelp
+ globalHelp = theModule.__doc__
+ globalSceneMap = {
+ "F1": GlobalScene()
+ }
+ globalSceneHelp = "\nGlobal keys:\n?: help (press in each F* scene
separately)\nq: quit\nr: reload\nF1: Overall help\n"
+ for i in range(0,len(globalScenes)):
+ key = "F%s"%(i+2)
+ globalSceneMap[key] = globalScenes[i]
+ globalSceneHelp += "%s: %s\n"%(key,
+ globalScenes[i].__doc__.splitlines()[0])
+
+ print globalScenes, globalSceneHelp, globalSceneMap
+
+ global currentScene
+ currentScene = globalSceneMap["F1"]
+ GlobalScene.__doc__ = globalHelp
+
+ print "Global help:",globalHelp,"CUR",currentScene.__doc__
+
except:
typ, val, tra = sys.exc_info()
l = traceback.format_list(traceback.extract_tb(tra))
print "ERROR WHILE LOADING! %s\n%s\n"%(str(typ),str(val)), l
+class GlobalScene:
+ def key(self, k):
+ pass
+ def scene(self, vs):
+ vs.map.put(gfx.util.misc.background((.3, .7, .6)))
+ global showHelp
+ showHelp = 1
+
def globalkey(k):
pass
@@ -74,7 +141,7 @@
class Bindings(AbstractBinder):
def keystroke(self, s):
- global showHelp
+ global showHelp, currentScene
# print "KEY: '%s'"%s
if usingNormalBindings:
if s == "q" or s == "Q":
@@ -84,6 +151,10 @@
elif s == "?":
showHelp = 1-showHelp
AbstractUpdateManager.setNoAnimation()
+ elif globalSceneMap.has_key(s):
+ currentScene = globalSceneMap[s]
+ AbstractUpdateManager.setNoAnimation()
+ showHelp = 0
elif not globalkey(s):
currentScene.key(s)
else:
@@ -103,10 +174,14 @@
# def
def addHelp(vs):
- help = currentScene.__class__.__doc__ + currentScene.key.__doc__
+ def d(obj):
+ o = getattr(obj, "__doc__", "")
+ if not o: return ""
+ return o
+ help = d(currentScene.__class__) + d(currentScene.key) + globalSceneHelp
print "Doc: ",help
lines = help.split("\n")
- ys = min(vs.size.height / len(lines), 25)
+ ys = min(vs.size.height / len(lines), 40)
cury = 0
style = vs.gfxapi.getTextStyle("sans", 0, 25)
vobs = []
@@ -127,10 +202,14 @@
vs.put(v[0], "4"+v[1], -45, 0 - s, v[2] - s, ys, ys)
vs.map.put(getDListNocoords("""
Color 0 0 0 1
- Disable BLEND
+ Enable BLEND
"""))
for v in vobs:
vs.put(v[0], v[1], -45, 0, v[2], ys, ys)
+ vs.map.put(getDListNocoords("""
+ Color 0 0 0 1
+ Disable BLEND
+ """))
Index: gzz/gzz/view/xubuoy.py
diff -u gzz/gzz/view/xubuoy.py:1.40 gzz/gzz/view/xubuoy.py:1.41
--- gzz/gzz/view/xubuoy.py:1.40 Fri Dec 13 09:49:38 2002
+++ gzz/gzz/view/xubuoy.py Thu Dec 19 04:12:39 2002
@@ -294,6 +294,18 @@
class XuPDFScene_PDFContext:
+ """A scene showing a prototype user interface.
+
+ This interface uses several of our technologies: libpaper,
+ buoys, and tearouts. Additionally the more common
+ fisheye view is used.
+
+ Mouse: Just click where you want to go.
+
+ Keys:
+ 'M': change the magnification settings (TODO: with mouse)
+ Several others, not yet documented.
+ """
def __init__(self, linkspace, win=None):
self.linkspace = linkspace
self.usefancypaper = 1
Index: gzz/gzz/vob/buoy/CircleFloater4.java
diff -u gzz/gzz/vob/buoy/CircleFloater4.java:1.1
gzz/gzz/vob/buoy/CircleFloater4.java:1.2
--- gzz/gzz/vob/buoy/CircleFloater4.java:1.1 Wed Oct 9 10:38:42 2002
+++ gzz/gzz/vob/buoy/CircleFloater4.java Thu Dec 19 04:12:39 2002
@@ -30,7 +30,7 @@
buoyOnCircle(parent, anchorCS,
centerx, centery,
radius,
- projx, projy, 1);
+ projx, projy, .1f);
into.matcher.add(cs, key);
return cs;
}
Index: gzz/test/gzz/gfx/gl/glvobcoorder.test
diff -u gzz/test/gzz/gfx/gl/glvobcoorder.test:1.27
gzz/test/gzz/gfx/gl/glvobcoorder.test:1.28
--- gzz/test/gzz/gfx/gl/glvobcoorder.test:1.27 Wed Nov 27 12:28:22 2002
+++ gzz/test/gzz/gfx/gl/glvobcoorder.test Thu Dec 19 04:12:39 2002
@@ -138,7 +138,7 @@
def testInterpolateBuoy():
cs_anchor = c1.translate(0, 10, 0)
- cs_b1 = c1.buoyOnCircle(0, cs_anchor, 0, 0, 20, -20, 0, 1)
+ cs_b1 = c1.buoyOnCircle(0, cs_anchor, 0, 0, 20, -20, 0, 0)
checkTrans(vs1, cs_b1,
[0, 0, 0],
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz ./Makefile ./TODO doc/pegboard/diceable--tj...,
Tuomas J. Lukka <=