gzz-commits
[Top][All Lists]
Advanced

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

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


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz gfx/librenderables/renderables.py gzz/modul...
Date: Sat, 02 Nov 2002 15:32:48 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/11/02 15:32:48

Modified files:
        gfx/librenderables: renderables.py 
        gzz/modules/pp : PPView2.java demotest.py 

Log message:
        PPView2 showing something... changed IrregularQuad to take 0..1 unit 
square, like it should; this needs adjustment.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.123&tr2=1.124&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPView2.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.123 
gzz/gfx/librenderables/renderables.py:1.124
--- gzz/gfx/librenderables/renderables.py:1.123 Sat Nov  2 06:31:52 2002
+++ gzz/gfx/librenderables/renderables.py       Sat Nov  2 15:32:48 2002
@@ -951,9 +951,15 @@
         float x0 = 1;
         float x1 = 1 - bx;
         float x2 = 1 - 2 * bx;
+        float mx0 = 0;
+        float mx1 = 0 + bx;
+        float mx2 = 0 + 2 * bx;
         float y0 = 1;
         float y1 = 1 - by;
         float y2 = 1 - 2 * by;
+        float my0 = 0;
+        float my1 = 0 + by;
+        float my2 = 0 + 2 * by;
         float w = .5; 
 
         // scale of last two vertices of sides 
@@ -981,15 +987,15 @@
         int dice[] = { dicey, dicey, dicex, dicex, diceb, diceb, diceb, diceb 
};
 
         ZPt sides[][4] =  { // The sides of the rectangle:
-                           { ZPt(-x0,-y2,0), ZPt(-x0,+y2,0), ZPt(-x1,+y2,0), 
ZPt(-x1,-y2,0) },
-                           { ZPt(+x0,-y2,0), ZPt(+x0,+y2,0), ZPt(+x1,+y2,0), 
ZPt(+x1,-y2,0) },
-                           { ZPt(-x2,-y0,0), ZPt(+x2,-y0,0), ZPt(+x2,-y1,0), 
ZPt(-x2,-y1,0) },
-                           { ZPt(-x2,+y0,0), ZPt(+x2,+y0,0), ZPt(+x2,+y1,0), 
ZPt(-x2,+y1,0) },
+                           { ZPt(mx0,my2,0), ZPt(mx0,+y2,0), ZPt(mx1,+y2,0), 
ZPt(mx1,my2,0) },
+                           { ZPt(+x0,my2,0), ZPt(+x0,+y2,0), ZPt(+x1,+y2,0), 
ZPt(+x1,my2,0) },
+                           { ZPt(mx2,my0,0), ZPt(+x2,my0,0), ZPt(+x2,my1,0), 
ZPt(mx2,my1,0) },
+                           { ZPt(mx2,+y0,0), ZPt(+x2,+y0,0), ZPt(+x2,+y1,0), 
ZPt(mx2,+y1,0) },
                            // Corners:
                            { ZPt(+x2,+y0,0), ZPt(+x0,+y2,0), ZPt(+x1,+y2,0), 
ZPt(+x2,+y1,0) },
-                           { ZPt(+x2,-y0,0), ZPt(+x0,-y2,0), ZPt(+x1,-y2,0), 
ZPt(+x2,-y1,0) },
-                           { ZPt(-x2,+y0,0), ZPt(-x0,+y2,0), ZPt(-x1,+y2,0), 
ZPt(-x2,+y1,0) },
-                           { ZPt(-x2,-y0,0), ZPt(-x0,-y2,0), ZPt(-x1,-y2,0), 
ZPt(-x2,-y1,0) }
+                           { ZPt(+x2,my0,0), ZPt(+x0,my2,0), ZPt(+x1,my2,0), 
ZPt(+x2,my1,0) },
+                           { ZPt(mx2,+y0,0), ZPt(mx0,+y2,0), ZPt(mx1,+y2,0), 
ZPt(mx2,+y1,0) },
+                           { ZPt(mx2,my0,0), ZPt(mx0,my2,0), ZPt(mx1,my2,0), 
ZPt(mx2,my1,0) }
                            };
 
         /* The distance (as a fraction of border) from the square where the 1D 
texture slice is taken.
@@ -1042,9 +1048,9 @@
         glDisable(GL_TEXTURE_2D);
 
         ZPt poly[] = { ZPt(+x1,+y2,0), ZPt(+x2,+y1,0),
-                       ZPt(-x2,+y1,0), ZPt(-x1,+y2,0),
-                       ZPt(-x1,-y2,0), ZPt(-x2,-y1,0),
-                       ZPt(+x2,-y1,0), ZPt(+x1,-y2,0), ZPt(+x1,+y2,0) };
+                       ZPt(mx2,+y1,0), ZPt(mx1,+y2,0),
+                       ZPt(mx1,my2,0), ZPt(mx2,my1,0),
+                       ZPt(+x2,my1,0), ZPt(+x1,my2,0), ZPt(+x1,+y2,0) };
         int dice[] = { diceb, dicex, diceb, dicey, diceb, dicex, diceb, dicey 
};
 
         #if 1
Index: gzz/gzz/modules/pp/PPView2.java
diff -u gzz/gzz/modules/pp/PPView2.java:1.1 gzz/gzz/modules/pp/PPView2.java:1.2
--- gzz/gzz/modules/pp/PPView2.java:1.1 Sat Nov  2 13:30:18 2002
+++ gzz/gzz/modules/pp/PPView2.java     Sat Nov  2 15:32:48 2002
@@ -6,6 +6,7 @@
 import gzz.vob.*;
 import gzz.view.*;
 import gzz.*;
+import java.awt.Dimension;
 
 public class PPView2 implements View {
 
@@ -16,16 +17,42 @@
 
     class SinglePlane {
        ViewContext context;
-       void render(VobScene into, int frameCS, int c2fCS) {
-           GLVobCoorder glc = (GLVobCoorder)into.coords;
-
-           int conc = glc.concat(c2fCS, frameCS);
-
-           Cell cursor = context.getAccursed();
-           Cell plane = cursor.h(d.contains);
-           BgVob bg = BgVob.create(plane);
+       void render(final VobScene vs, final int frameCS, final int c2fCS) {
+           final GLVobCoorder glc = (GLVobCoorder)vs.coords;
 
+           final int conc = glc.concat(c2fCS, frameCS);
 
+           final Cell cursor = context.getAccursed();
+           final Cell plane = cursor.h(d.contains);
+           final BgVob bg = BgVob.create(plane);
+
+           final IrregularFrame f = IrregularFrame.create(-100,-100,1600,1600,
+                                       50.3f, 1000f);
+
+           final int frameUnit = vs.unitSqCS(frameCS, "USQ");
+
+           class Putter implements Runnable {
+               Vob v;
+               Putter(Vob v) { this.v = v; }
+               public void run() {
+                   vs.map.put(v, 0, frameUnit);
+               }
+           }
+           float[] sqs = new float[2];
+           glc.getSqSize(frameCS, sqs);
+
+           final int c2fUnit = vs.scaleCS(c2fCS, "SCA", 1.0f/sqs[0], 
1.0f/sqs[1]);
+
+           Stencil.drawStenciled(vs, 
+                       new Putter(f.getContent()),
+                       new Putter(f.getBlank()),
+                       new Putter(f.getFrame()),
+                       new Runnable() {
+                       public void run() {
+                           vs.map.put(bg, frameUnit, c2fUnit);
+                       }
+                       },
+                       false);
        }
     }
 
@@ -35,7 +62,18 @@
        this.coordinatePlaneView = new CoordinatePlaneView(d.clone, d.pan);
     }
 
-    public void render(VobScene into, int intoCS, ViewContext context) {
+    public void render(VobScene vs, int intoCS, ViewContext context) {
+       AbstractViewContext vc = new AbstractViewContext();
+       vc.setAccursed(context.getAccursed());
+
+       Dimension size = vs.getSize();
+       
+       SinglePlane pl = new SinglePlane();
+       pl.context = vc;
+
+       int frameCS = vs.orthoBoxCS(0, "frame", 0, 100, 100, 1, 1, 400, 400);
+       int c2fCS = 0;
+       pl.render(vs, frameCS, c2fCS);
 
     }
 }
Index: gzz/gzz/modules/pp/demotest.py
diff -u gzz/gzz/modules/pp/demotest.py:1.10 gzz/gzz/modules/pp/demotest.py:1.11
--- gzz/gzz/modules/pp/demotest.py:1.10 Sat Oct 19 10:27:44 2002
+++ gzz/gzz/modules/pp/demotest.py      Sat Nov  2 15:32:48 2002
@@ -4,6 +4,7 @@
 from gzz.impl import *
 from gzz.media.impl import *
 from gzz.modules.pp import *
+from gzz.view import *
 import math
 from java.lang import Math
 from java.awt.event import MouseEvent
@@ -20,7 +21,6 @@
 space = ModularSpace(cellTexter, cellManager, dimManager, identityManager, 
slicer, obsTrigger)
 
 ppactions = gzz.modules.pp.PPActionsImpl(space)
-Win.initDims(space)
 
 id = ppactions.newPaper()
 
@@ -114,4 +114,13 @@
                   -self.scale*self.offset[1]+.5, 
                self.scale, 0, 0, self.scale)
 
-currentScene = PlaneViewScene()
+class PPView2Scene:
+    def scene(self, vs):
+       vs.map.put(background((0.4,0.5,0.8)))
+       avc = gzz.view.AbstractViewContext()
+       avc.setAccursed(space.getCell(n1))
+       ppv = PPView2(space)
+       ppv.render(vs, 0, avc)
+
+# currentScene = PlaneViewScene()
+currentScene = PPView2Scene()




reply via email to

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