gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./Makefile ./TODO gfx/demo/opengl/bumpy.py ...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./Makefile ./TODO gfx/demo/opengl/bumpy.py ...
Date: Sun, 29 Dec 2002 15:33:14 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/12/29 15:33:13

Modified files:
        .              : Makefile TODO 
        gfx/demo/opengl: bumpy.py 
        gfx/demo/paper : combiners.py combinerutil.py multipaper.py 
                         singlepaper.py 
        gfx/jni        : GzzGL-jni.cxx 
        gfx/libcallgl  : callgl.cxx 
        gfx/librenderables: renderables.py 
        gzz/gfx/gl     : GL.java 

Log message:
        Changes towards alpha4: demo fixes etc

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Makefile.diff?tr1=1.229&tr2=1.230&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.470&tr2=1.471&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/opengl/bumpy.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paper/combiners.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paper/combinerutil.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paper/multipaper.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paper/singlepaper.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcallgl/callgl.cxx.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.167&tr2=1.168&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.33&tr2=1.34&r1=text&r2=text

Patches:
Index: gzz/Makefile
diff -u gzz/Makefile:1.229 gzz/Makefile:1.230
--- gzz/Makefile:1.229  Thu Dec 26 07:44:38 2002
+++ gzz/Makefile        Sun Dec 29 15:33:08 2002
@@ -477,6 +477,9 @@
 runpplocal: 
        $(GLLIB) $(JYTHON) gzz/modules/pp/localpp.py $(DBG) 
 
+runpptest: 
+       $(GLLIB) $(JYTHON) $(GLDEMO) gzz/modules/pp/demotest.py $(DBG) 
+
 gl: compilegl rmi test-gl
 
 compilegl: compile
Index: gzz/TODO
diff -u gzz/TODO:1.470 gzz/TODO:1.471
--- gzz/TODO:1.470      Mon Dec 23 05:34:51 2002
+++ gzz/TODO    Sun Dec 29 15:33:08 2002
@@ -38,6 +38,9 @@
          Specifically, need to be able to use gzipped S3TC files; 
          should be a LOT faster to load.
     tuukkah:
+       - get someone to try our main demos:
+           - paper
+           - xupdf
        - release engineering 
            - list main changes 
                - cvs diff... concentrating on major APIs
@@ -49,25 +52,13 @@
          are not available!!! Use some of our own? Provide URLs for
          canonical blocks?
            - less pages 
-    tjl:
-       + return ANKOS to Agora [ blocked by: waiting for trip to agora ]
-       - move lots of stuff to lava and basalt
-       - go through most important GL demos and redo the interfaces
-         and document
-           - paper
-               - register combiners: separate nv combiner source, show in 
-                 demos.
-                   - not in hash at first
-               - combine single- and multipaper -scenes
-           - xupdf
-               - fix for new buoys
-           - irregu 
        - a really comprehensive web page of screenshots, animations
          and instructions on how to get them working.
-           - clean up OpenGL demos and views and document, list
-             so easy to look at.
-               - fillets, irregu, paper, xupdf
            - naturally, make script that generates the page
+           - talk to Tjl
+    tjl:
+       + return ANKOS to Agora [ blocked by: waiting for trip to agora ]
+       - move lots of stuff to lava and basalt
 
 0.8alpha5: saving, loading etc. with mediaserver useful; tests
     jvk:
@@ -75,6 +66,10 @@
     benja:
        - [PP03] Fix load/save - why some module tries to load '_socket'?
                  maybe vegai can help with this?
+       - TOTAL UML documentation for all classes involved in
+         the save/load stuff, collaboration diagrams etc.
+         The path from structure to bytes and bytes to structure
+         needs to be ABSOLUTELY clear and transparent.
        - fix urn-5 application, which says "pseudo-random number (160 or more 
bytes)"
          and 'SHA-1 assumes uniqueness of 160 byte identifiers"
          should be bits!! Need to send version 1.1?
@@ -173,6 +168,8 @@
               handling pegboard is already split)
            - diagram names should be unique, currently this can't be
               easily tested, make something to it
+           - Fix UML sequence diagram: now you have to put
+             seqobjects *after* the sequence...
        - paper about umltool
        - split this todo into correct releases / sections :)
        - think about technical guidelines for possible field test prototype
@@ -225,9 +222,20 @@
           bounding boxes. Fast, but not very efficient.
        + implement Paper TexGenEmboss::setUp_explicit
     tjl:
-       - [PP03] new interpolation code (pp shortcuts)
+       - [PP03] diagram of PP's coordinate systems and keys!
        - [PP03] nadir
-       - [PP03] buoys 1-N (pp)
+       - [PP03] buoys 1-N: must shift some! (pp)
+       - xupdf: distorted multi-page PDF view with xu links
+           - faster (asynch) loading of pagespan images
+               - use lower resolution first, lazily load better
+           - discard high-rez images (500kB/image) ?
+               (imagecache)
+           - multiple instances of same cell visible as a buoy --> keys?
+               - special matcher? or pp/VobKeyer?
+               - really USE hierarchical keys
+           - structure editing
+           + adjustable zoom / distortion area by mouse
+           + joystick?
        - better graphics for xupdf and pp
            - fillets without the original object
                - normal direction as data
@@ -246,17 +254,6 @@
                      linestyle objects for npr scaling?
                + polygon puzzle view
        - proper UpdateManager -- gfxapi interface PEG
-       + xupdf: distorted multi-page PDF view with xu links
-           + adjustable zoom / distortion area by mouse
-           + discard high-rez images (500kB/image) ?
-               (imagecache)
-           + faster loading of pagespan images
-               - use lower resolution first, lazily load better
-                   - deetsay's imagecache code?
-           + multiple instances of same cell visible as a buoy --> keys?
-               - special matcher? or pp/VobKeyer?
-               - really USE hierarchical keys
-           + joystick?
        - use off-screen buffer for libpaper r2t
        + CoordSys::DistordCoords::canPerformGL() returns false.
           Define action (=complain in stderr?) when trying to use
@@ -287,6 +284,9 @@
          work like affineCoordsys and setAffineParams, so
          that we can set the params from outside easier.
     anybody:
+       + paper demo
+           + passmask back
+           + panning in multipaper
        - Mosaic: don't store texture in memory;
          storing in only the OpenGL texture object will
          save memory and time.
@@ -298,22 +298,12 @@
        - complete empty test bodies in test/gzz/vob/textvob.test
        - IndexManager xuindexer semantics: fix behaviour of 
SimpleVStreamCellTexter
          somehow
-       - TOTAL UML documentation for all classes involved in
-         the save/load stuff, collaboration diagrams etc.
-         The path from structure to bytes and bytes to structure
-         needs to be ABSOLUTELY clear and transparent.
        - first cut at merge
-       + Fix UML sequence diagram: now you have to put
-         seqobjects *after* the sequence...
-       + bidirectional jlinks
-       - xupdf: distorted multi-page PDF view with xu links
-           - adjustable zoom / distortion area by mouse
        - test/ using pagespanview.ContentView as a CellContentView;
          currently broken. ???
 
        - implement PEG 1021 for AWT
        + Go through test/ and convert tests to either .py or move to basalt/
-       + Some basic tests for gfx/
        - check OpenGL texture size at run time, adjust mosaic and bg
 
        + code to see from PDF file the number of pages
Index: gzz/gfx/demo/opengl/bumpy.py
diff -u gzz/gfx/demo/opengl/bumpy.py:1.1 gzz/gfx/demo/opengl/bumpy.py:1.2
--- gzz/gfx/demo/opengl/bumpy.py:1.1    Thu Dec 26 07:44:39 2002
+++ gzz/gfx/demo/opengl/bumpy.py        Sun Dec 29 15:33:10 2002
@@ -24,15 +24,25 @@
            float3 halfvec = normalize(lightvec + eyevec);
            float diffuse = dot(normal, lightvec);
            float specular = dot(normal, halfvec);
-           float4 lighting = lit(diffuse, specular, 22);
+           float4 lighting = lit(diffuse, specular, 12);
            return lighting.y * diffuseMaterial +
                   lighting.z * specularMaterial;
        }
        void main(
            float4 p : POSITION,
+           float3 nois : ATTR1,
+           float nois_w : ATTR2,
+           float nois_e : ATTR3,
+           float nois_n : ATTR4,
+           float nois_s : ATTR5,
+           uniform float2 stretch : C0,
            out float4 outpos : HPOS,
            out float4 outcol : COLOR0
        ) {
+           // float2 stretch = float2(1, 1);
+
+           p.xy *= stretch;
+
            float3 eyevec = normalize(float3(1.5,1.5,5)-3*p.xyz);
            float4 q = mul(glstate.matrix.program[0], 
                        float4(0,0,0,1));
@@ -48,7 +58,7 @@
            // p2.xy += 0 * sc;
            outpos = mul(glstate.matrix.mvp, p2);
            outcol.xy = p ;
-           float3 normalvec = norm(dnoi(p));
+           float3 normalvec = norm(float2(nois_w-nois_e, nois_n-nois_s) / 
stretch);
            outcol.xyz = light(lightvec,
                            float3(0, 0, 1),
                            normalvec,
@@ -60,6 +70,8 @@
                            float3(.1,0,.1),
                            float3(.5,0,.05));
            // outcol.xyz = float(normalvec.y>0)+.5;
+           // outcol.xyz = 5*(nois_e.xxx - nois_w.xxx)  + .5;
+           // outcol.yz = nois.x/2 + .5x;
            outcol.w = 1;
        }
        """
@@ -67,9 +79,24 @@
        self.prog = GL.createProgram(pstr)
        if GL.getGLFloat("PROGRAM_ERROR_POSITION_ARB")[0] >= 0:
            self.prog = None
+
+       meshsize = 100
     
-       self.mesh = GLRen.createSimpleDiced(0, 300)
+       self.mesh = GLRen.createSimpleDiced(0, meshsize)
 
+       self.bv = GL.createByteVector()
+       self.bv.shade(meshsize, 5*(meshsize+2), 1, 1, "noise", ["freq", "80", 
"scale", ".2"])
+       self.bvattribs = [
+           GLRen.createVertexAttribPointer(self.bv, 4 * offset, index, 1, 
"FLOAT", 0, 4)
+           for index, offset in 
+               [       (1, meshsize  + 1),
+                       (2, meshsize ),
+                       (3, meshsize  + 2),
+                       (4, 1),
+                       (5, 2*(meshsize ) + 1),
+               ]]
+
+       self.stretchpa = 
GLRen.createProgramLocalParameter("VERTEX_PROGRAM_ARB", 0)
 
     def key(self, k):
        pass
@@ -105,14 +132,29 @@
                LineWidth 1
                Disable ALPHA_TEST
                Enable BLEND
+               PushAttrib ENABLE_BIT
+               EnableVertexAttribArray 1
+               EnableVertexAttribArray 2
+               EnableVertexAttribArray 3
+               EnableVertexAttribArray 4
+               EnableVertexAttribArray 5
        """ % self.prog.getProgId()));
 
+       for a in self.bvattribs: vs.map.put(a)
+
        vs.put(GLRen.createSetMatrix("MODELVIEW"), "M", 0,
            50, 50, 600, 600)
 
+       stretchcs = vs.translateCS(0, "ST", 3*r.nextDouble(), 3*r.nextDouble())
+       vs.map.put(self.stretchpa, stretchcs)
+
        vs.map.put(self.mesh)
 
        putnoc(vs, getDListNocoords("""
+               PopAttrib
                BindProgram VERTEX_PROGRAM_ARB 0
                Disable VERTEX_PROGRAM_ARB
        """))
+
+
+
Index: gzz/gfx/demo/paper/combiners.py
diff -u gzz/gfx/demo/paper/combiners.py:1.3 gzz/gfx/demo/paper/combiners.py:1.4
--- gzz/gfx/demo/paper/combiners.py:1.3 Mon Dec 23 05:34:51 2002
+++ gzz/gfx/demo/paper/combiners.py     Sun Dec 29 15:33:12 2002
@@ -8,6 +8,9 @@
 
 class Scene:
     """Show some basis textures and what the NV10 register combiners can do 
with them.
+
+    The small squares show the randomly selected colors used in the real 
outputs.
+    The text shows the combiner code currently used for the intersection.
     """
     def __init__(self):
        self.bgcolor = (0.7, 0.8, 0.6)
@@ -19,6 +22,7 @@
        self.key = KeyPresses(self,
 ListIndex("ccind", "combinercodes", 0, "combiner code for intersection 
region", "<", ">", 
                    noAnimation = 1),
+*self.pt.keys
        )
        # else:
        #     self.pt.key(k)
@@ -26,22 +30,22 @@
     def scene(self, vs):
        putnoc(vs, background(self.bgcolor))
 
-       cs = vs.orthoCS(0, "S1", 0, 100, 100, 200, 200)
+       cs = vs.orthoCS(0, "S1", 0, 50, 50, 400, 400)
        self.pt.place(vs, cs, "RGB0", self.combinercodes[self.ccind], "RGB1")
 
         for i in range(0,3):
-            cs = vs.coords.affineCoordsys(0, 10, 600 + (i-1)*150, 80, 50, 0, 
0, 50)
+            cs = vs.coords.affineCoordsys(0, 10, 700 + (i-1)*80, 80, 50, 0, 0, 
50)
            vs.matcher.add(cs, "col" + str(i))
             col = self.pt.cols[i].split()
             cq = coloredQuad((col[0], col[1], col[2]))
             vs.map.put(cq, cs)
             vs.map.put(self.pt.frame, cs)
 
-       tcs = vs.orthoCS(0, "TXT", 0, 500, 300, 1, 1)
+       tcs = vs.orthoCS(0, "TXT", 0, 650, 300, 1, 1)
        vs.map.put(getDListNocoords("""
            Disable REGISTER_COMBINERS_NV
            Color 0 0 0 1
            Disable ALPHA_TEST
            Enable TEXTURE_2D
        """))
-       misc.putMultilineText (vs, tcs, 
texcodes[self.combinercodes[self.ccind]], 20)
+       misc.putMultilineText (vs, tcs, 
texcodes[self.combinercodes[self.ccind]], 15)
Index: gzz/gfx/demo/paper/combinerutil.py
diff -u gzz/gfx/demo/paper/combinerutil.py:1.3 
gzz/gfx/demo/paper/combinerutil.py:1.4
--- gzz/gfx/demo/paper/combinerutil.py:1.3      Mon Dec 23 05:34:51 2002
+++ gzz/gfx/demo/paper/combinerutil.py  Sun Dec 29 15:33:12 2002
@@ -196,13 +196,19 @@
        End
         """)
 
-       keys = [
+       self.keys = [
 Action("Select random new colors", "c", lambda *args: self.randColors()),
 Action("Select random dot-product vector 1", "1", lambda *args: 
self.randvec(0)),
 Action("Select random dot-product vector 2", "2",  lambda *args: 
self.randvec(1)),
-SlideLin("x0",  .12, .01, "Move area 1", "Left", "Right"),
-SlideLin("y0",  .02, .01, "Move area 1", "Left", "Right"),
+Action("Move", "Left",  lambda *args: self.move(-1,0)),
+Action("Move", "Right",  lambda *args: self.move(1,0)),
+Action("Move", "Up",  lambda *args: self.move(0,-1)),
+Action("Move", "Down",  lambda *args: self.move(0,1)),
        ]
+
+    def move(self, dx, dy):
+       self.x0 += dx * .01
+       self.y0 += dy * .01
     def initvecs(self):
         colors = Colors(self.vecseed0)
         r0 = colors.getNVDP3VecStr(0)
@@ -234,10 +240,6 @@
             self.texgen0 = TexGenXYRepeatUnit(rnd=rng)
         elif k == "F5":
             self.texgen1 = TexGenXYRepeatUnit(rnd=rng)
-        elif k == "Up": self.y0 -= self.deltac
-        elif k == "Down": self.y0 += self.deltac
-        elif k == "Left": self.x0 -= self.deltac
-        elif k == "Right": self.x0 += self.deltac
 
     def place(self, vs, into, t1, c, t2):
        print self.x0,self.y0,self.x1,self.y1
Index: gzz/gfx/demo/paper/multipaper.py
diff -u gzz/gfx/demo/paper/multipaper.py:1.2 
gzz/gfx/demo/paper/multipaper.py:1.3
--- gzz/gfx/demo/paper/multipaper.py:1.2        Fri Dec 20 11:00:21 2002
+++ gzz/gfx/demo/paper/multipaper.py    Sun Dec 29 15:33:12 2002
@@ -9,23 +9,52 @@
 
     def __init__(self):
        self.bgcolor = (0.7, 0.8, 0.6)
-        self.w = 4
-        self.h = 3
+        self.w = 3
+        self.h = 2
         self.seed = 0
         self.initpaper()
 
+       self.key = KeyPresses(self, 
+Toggle("showOptimized", 0, "Use optimized papers", "o"),
+Action("Choose random seed", "v", self.randomize, noAnimation=1),
+Action("Edit seed number", re.compile("[0-9]|Back[sS]pace"), 
+                               self.__class__.editSeed, noAnimation=1),
+Action("More/less papers shown", re.compile("[+-]"), 
self.__class__.npapersadj) ,
+           *keys
+           )
+
+    def npapersadj(self, k):
+        dw,dh = 0,0
+        if k == "+": dw,dh = [ (0,1), (1,0) ][self.w * 3 < self.h * 4]
+        elif k == "-": dw,dh = [ (-1,0), (0,-1) ][self.w * 3 < self.h * 4]
+       else: print "NPapersadj called wrongly"
+        self.w += dw
+        self.h += dh
+
+    def randomize(self, *args):
+       self.seed = rng.nextInt(2000000000)
+       self.initpaper()
+
+    def editSeed(self,k):
+        if k >= "0" and k <= "9": self.seed = self.seed * 10 + int(k)
+        if k == "BackSpace" or k == "Backspace": self.seed = self.seed / 10
+       self.initpaper()
+
     def initpaper(self):
         self.pq = range(0, self.w*self.h)
+        self.opq = range(0, self.w*self.h)
         paperopt = gzz.gfx.gl.PaperOptions.instance()
         tmp_paperopt = paperopt.use_opengl_1_1
         
         if not self.has_dual_papers:
             for i in range(0,self.w*self.h):
                 self.pq[i] = getpaper(self.seed + i)
+                self.opq[i] = getpaper(self.seed + i, optimized=1)
         else:
             for i in range(0, self.w*self.h):
                 paperopt.use_opengl_1_1 = i & 1
                 self.pq[i] = getpaper(self.seed + i / 2)
+                self.opq[i] = getpaper(self.seed + i / 2, optimized=1)
 
         paperopt.use_opengl_1_1 = tmp_paperopt
             
@@ -46,9 +75,7 @@
                 index += 1
             
 
-    def key(self, k):
-        if k >= "0" and k <= "9": self.seed = self.seed * 10 + int(k)
-        if k == "BackSpace" or k == "Backspace": self.seed = self.seed / 10
+    def OLDkey(self, k):
        if k == "v":
             self.seed = rng.nextInt(200000000)
         if k == "f":  # as fork
@@ -58,11 +85,6 @@
            self.initpaper()
            AbstractUpdateManager.setNoAnimation()
            AbstractUpdateManager.chg()
-        dw,dh = 0,0
-        if k == "+": dw,dh = [ (0,1), (1,0) ][self.w * 3 < self.h * 4]
-        if k == "-": dw,dh = [ (-1,0), (0,-1) ][self.w * 3 < self.h * 4]
-        self.w += dw
-        self.h += dh
 
     def scene(self, vs):
         size = vs.getSize()
@@ -72,14 +94,16 @@
         cs1w = .47*size.width/self.w
         cs1h = .47*size.height/self.h
 
-       scale = float(zoom)
+       print self.w, self.h
+
+       scale = float(self.zoom)
        cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale/cs1w, 0, 0, scale/cs1h)
         vs.matcher.add(cs2, "tex")
 
         self.boxes = []
         cs1 = range(0,self.w*self.h)
         for i in range(0,self.w*self.h):
-            if i >= len(self.pq): break
+            if i >= len(self.pq): self.initpaper()
 
             x = (i%self.w+.5)*size.width/self.w
             y = (i/self.w+.5)*size.height/self.h
@@ -92,7 +116,9 @@
             
             vs.matcher.add(cs1[i], str(i))
             
-            vs.map.put(self.pq[i], cs1[i], cs2)
+           if self.showOptimized: pap = self.pq[i]
+           else: pap = self.opq[i]
+            vs.map.put(pap, cs1[i], cs2)
             putText(vs, cs1[i],
                     str(self.seed + i / (self.has_dual_papers + 1)),
                     color=(0,0,0), x=-1,y=1,z=-1, h=.5, key=str(i))
Index: gzz/gfx/demo/paper/singlepaper.py
diff -u gzz/gfx/demo/paper/singlepaper.py:1.5 
gzz/gfx/demo/paper/singlepaper.py:1.6
--- gzz/gfx/demo/paper/singlepaper.py:1.5       Fri Dec 20 11:00:21 2002
+++ gzz/gfx/demo/paper/singlepaper.py   Sun Dec 29 15:33:12 2002
@@ -2,108 +2,3 @@
 from util import *
 from gfx.util.misc import *
 import re
-
-class Scene:
-    """Shows a single unique background texture at a time.
-
-    """
-    def __init__(self):
-       self.bgcolor = (0.7, 0.8, 0.6)
-
-        self.seed = 0
-       self.pq = None
-       
-       self.optimized = ["not", "opt", "both"]
-
-       print "Paper2scene, keys = ",keys
-       self.key = KeyPresses(self, 
-Action("Choose random seed", "v", self.randomize, noAnimation=1),
-Action("Edit seed number", re.compile("[0-9]|Back[sS]pace"), 
-                               self.__class__.editSeed, noAnimation=1),
-           *keys
-           )
-
-    def randomize(self, *args):
-       self.seed = rng.nextInt(2000000000)
-       self.initpaper()
-
-    def editSeed(self,k):
-        if k >= "0" and k <= "9": self.seed = self.seed * 10 + int(k)
-        if k == "BackSpace" or k == "Backspace": self.seed = self.seed / 10
-       self.initpaper()
-
-    def initpaper(self):
-        self.pq = getpaper(self.seed)
-        self.opq = getpaper(self.seed, optimized = 1)
-
-    def OLDkey(self, k):
-        oldseed = self.seed
-       if k == 'o':
-           rotatelist(self.optimized)
-
-        if oldseed != self.seed:
-           self.pq = None
-            AbstractUpdateManager.setNoAnimation()
-            AbstractUpdateManager.chg()
-
-           
-    def scene(self, vs):
-        size = vs.getSize()
-
-       if not self.pq: self.initpaper()
-       putnoc(vs, background(self.bgcolor))
-
-       cs1 = vs.coords.affineCoordsys(0, 10, 0, 0,
-                                       size.width, 0,
-                                       0, size.height)
-       scale = float(self.zoom)
-       print "Scene: ",self.zoom,scale
-       cs2 = vs.coords.affineCoordsys(0, 0, 0, 0,
-                                       scale / size.width, 0,
-                                       0, scale / size.height)
-
-       cs1left = vs.coords.ortho(cs1, 0, 0, 0, .5, 1)
-       cs1right = vs.coords.ortho(cs1, 0, .5, 0, .5, 1)
-
-       cs2left = vs.coords.ortho(0, 0, 0, 0,
-                                  scale / size.width * 2,
-                                  scale / size.height)
-       cs2right = vs.coords.ortho(0, 0, -1, 0,
-                                   scale / size.width * 2,
-                                   scale / size.height)
-
-       vs.matcher.add(cs1, "1")
-       vs.matcher.add(cs2, "2")
-
-       vs.matcher.add(cs1left, "1l")
-       vs.matcher.add(cs2left, "2l")
-
-       vs.matcher.add(cs1right, "1r")
-       vs.matcher.add(cs2right, "2r")
-
-       pscale = self.zoom
-
-
-       #print "Seed: ",self.seed," pq ",self.pq
-       if self.optimized[0] == "not":
-           print "NOT"
-           vs.map.put(self.pq, cs1, cs2)
-       elif self.optimized[0] == "opt":
-           print "OPT"
-           vs.map.put(self.opq, cs1, cs2)
-       elif self.optimized[0] == "both":
-           print "BOTH"
-           vs.map.put(self.pq, cs1left, cs2left)
-           vs.map.put(self.opq, cs1right, cs2right)
-       else:
-           print "ARGH ",self.optimized
-
-       cs3 = vs.coords.affineCoordsys(0, 0, 0, 0,
-                                       size.height/2, 0,
-                                       0, size.height/2)
-       vs.matcher.add(cs3, "txt")
-
-        putText(vs, cs3, str(self.seed), color=(0,0,0), x=0, y=.12, h=.2)
-
-        
-
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.73 gzz/gfx/jni/GzzGL-jni.cxx:1.74
--- gzz/gfx/jni/GzzGL-jni.cxx:1.73      Sat Dec 14 03:11:34 2002
+++ gzz/gfx/jni/GzzGL-jni.cxx   Sun Dec 29 15:33:12 2002
@@ -582,6 +582,19 @@
     releaseWindow();
 }
 
+Texture::TextureParam textureParams(JNIEnv *env, jobjectArray params) {
+
+      Texture::TextureParam p;
+
+      for(int i=0; i<env->GetArrayLength(params)-1; i+=2) {
+         std::string k = jstr2stdstr(env, 
(jstring)(env->GetObjectArrayElement(params, i)));
+         std::string v = jstr2stdstr(env, 
(jstring)(env->GetObjectArrayElement(params, i+1)));
+         p.setParam(k.c_str(), v.c_str());
+      }
+
+      return p;
+}
+
 JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1shade
   (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, 
        jstring internalFormat,
@@ -598,13 +611,7 @@
          return 0;
       }
 
-      Texture::TextureParam p;
-
-      for(int i=0; i<env->GetArrayLength(params)-1; i+=2) {
-         std::string k = jstr2stdstr(env, 
(jstring)(env->GetObjectArrayElement(params, i)));
-         std::string v = jstr2stdstr(env, 
(jstring)(env->GetObjectArrayElement(params, i+1)));
-         p.setParam(k.c_str(), v.c_str());
-      }
+      Texture::TextureParam p = textureParams(env, params);
 
       float *value = new float[w * h * (d==0?1:d) * comp];
 
@@ -903,6 +910,28 @@
     jintArray arr = env->NewIntArray(len);
     env->SetIntArrayRegion(arr, 0, len, (jint*) (&(*(bytevectors[id]))[0]));
     return arr;
+}
+
+
+JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1shade
+  (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, 
+           jstring name, jobjectArray params) {
+      setWindow();
+      DBG(dbg)<<"Shade into "<<id<<"\n";
+
+      std::string name_utf = jstr2stdstr(env, name);
+
+      Texture::Texture *s = Texture::Texture::getTexture(name_utf.c_str());
+
+      if(!s) {
+         return 0;
+      }
+
+      Texture::TextureParam p = textureParams(env, params);
+
+      bytevectors[id]->resize(w * h * (d==0 ? 1 : d) * comp * 4);
+      s->render( &p, w, h, (d==0?1:d), comp, (float*)&((*bytevectors[id])[0]));
+      return 1;
 }
 
 
Index: gzz/gfx/libcallgl/callgl.cxx
diff -u gzz/gfx/libcallgl/callgl.cxx:1.40 gzz/gfx/libcallgl/callgl.cxx:1.41
--- gzz/gfx/libcallgl/callgl.cxx:1.40   Mon Dec 16 07:52:23 2002
+++ gzz/gfx/libcallgl/callgl.cxx        Sun Dec 29 15:33:12 2002
@@ -131,6 +131,10 @@
          glEnable(getToken(v[1]));
        } else if (checkfunc(v, "Disable", 1)) {
          glDisable(getToken(v[1]));
+       } else if (checkfunc(v, "EnableVertexAttribArray", 1)) {
+         glEnableVertexAttribArrayARB(getToken(v[1]));
+       } else if (checkfunc(v, "DisableVertexAttribArray", 1)) {
+         glDisableVertexAttribArrayARB(getToken(v[1]));
        } else if (checkfunc(v, "Hint", 2)) {
          glHint(getToken(v[1]), getToken(v[2]));
        } else if (checkfunc(v, "ReadBuffer", 1)) {
@@ -302,6 +306,13 @@
          glPushAttrib(mask);
        } else if (checkfunc(v, "PopAttrib", 0)) {
          glPopAttrib();
+       } else if (checkfunc(v, "PushClientAttrib", 0, true)) {
+         GLbitfield mask = 0;
+         for (unsigned i = 1; i < v.size(); i++)
+           mask |= getToken(v[i]);
+         glPushClientAttrib(mask);
+       } else if (checkfunc(v, "PopClientAttrib", 0)) {
+         glPopClientAttrib();
        } else if (checkfunc(v, "Clear", 0, true)) {
          GLbitfield mask = 0;
          for (unsigned i = 1; i < v.size(); i++)
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.167 
gzz/gfx/librenderables/renderables.py:1.168
--- gzz/gfx/librenderables/renderables.py:1.167 Thu Dec 26 07:44:40 2002
+++ gzz/gfx/librenderables/renderables.py       Sun Dec 29 15:33:12 2002
@@ -1423,6 +1423,56 @@
         """,
 }    ,
 
+{
+    "Type" : "0",
+    "Name" : "VertexAttribPointer",
+    "Data": """
+           GLubyte *ptr;
+           int offs, index, size, normalized, stride;
+           GLenum type;
+           """,
+    "Params": """
+       ByteVector vec, 
+       int offset, 
+       int index, int size, GLToken type, int normalized, int stride
+       """,
+    "ParamCode": """
+       this->ptr = vec;
+       this->offs = offset;
+       this->index = index;
+       this->size = size;
+       this->normalized = normalized;
+       this->stride = stride;
+       this->type = type;
+    """,
+    "RenderCode": """
+       glVertexAttribPointerARB(index, size, type, normalized,
+           stride, ptr + offs);
+    """
+} ,
+
+{
+    "Type" : "1",
+    "Name" : "ProgramLocalParameter",
+    "Data" : """
+           GLenum target;
+           int index;
+           """,
+    "Params" : """
+           GLToken target,
+           int index
+    """,
+    "ParamCode" : """
+       this->target = target;
+       this->index = index;
+    """,
+    "RenderCode": """
+       ZPt p0 = coords1.transform(ZPt(0,0,0));
+       ZPt p1 = coords1.transform(ZPt(1,1,0));
+       glProgramLocalParameter4fARB(target, index, p0.x, p0.y, p1.x, p1.y);
+    """
+} ,
+
 # For testing out things: just render a mesh. 
 # Use vertex programs to do interesting stuff.
 {
@@ -1438,7 +1488,8 @@
            """,
     "ExtraClass" : """
        void vert(int x, int y) {
-           DBG(dbg) << "SimplDiced vert "<<x<<" "<<y<<"\n";
+           DBG(dbg) << "SimplDiced vert "<<x<<" "<<y<<"\\n";
+           glArrayElement(x + ndice * y);
            glVertex2f(x / (ndice-1.0), y / (ndice-1.0));
        }
     """,
@@ -1447,7 +1498,7 @@
        GLERR
        for(int i=0; i<ndice-1; i++) {
            glBegin(GL_TRIANGLE_STRIP);
-           DBG(dbg) << "SimpleDiced Begin strip "<<i<<"\n";
+           DBG(dbg) << "SimpleDiced Begin strip "<<i<<"\\n";
            for(int j=0; j<ndice; j++) {
                if(flags&1) {
                    if(j < ndice-i)
@@ -1459,7 +1510,7 @@
                    vert(i+1, j);
                }
            }
-           DBG(dbg) << "SimpleDiced End strip "<<i<<"\n";
+           DBG(dbg) << "SimpleDiced End strip "<<i<<"\\n";
            glEnd();
            GLERR
        }
Index: gzz/gzz/gfx/gl/GL.java
diff -u gzz/gzz/gfx/gl/GL.java:1.33 gzz/gzz/gfx/gl/GL.java:1.34
--- gzz/gzz/gfx/gl/GL.java:1.33 Sat Dec 14 03:35:18 2002
+++ gzz/gzz/gfx/gl/GL.java      Sun Dec 29 15:33:13 2002
@@ -750,6 +750,14 @@
            return impl_ByteVector_getInts(getId());
        }
 
+       /** Shade the given Texture into this bytevector, using 32-bit floats.
+        * Sets the bytevector length to w*h*(d &gt; 0?d : 1) * comps * 4
+        */
+       public int shade(int w, int h, int d, int comps, 
+               String shaderName, String[] params) {
+           return impl_ByteVector_shade(getId(), w, h, d, comps, shaderName, 
params);
+       }
+
     }
     /** Create a new bytevector of size 0.
      */
@@ -775,6 +783,10 @@
     static private native int impl_ByteVector_get(int id, int ind);
     static private native byte[] impl_ByteVector_get(int id);
     static private native int[] impl_ByteVector_getInts(int id);
+
+    static private native int impl_ByteVector_shade(int id, int w, int h, int 
d, 
+                   int comps, String shaderName, String[] params);
+
 
 //----------Misc
 



reply via email to

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