gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob org/nongnu/libvob/gl/SpecialPapers.java ...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob org/nongnu/libvob/gl/SpecialPapers.java ...
Date: Wed, 25 Jun 2003 14:02:21 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/06/25 14:02:21

Modified files:
        org/nongnu/libvob/gl: SpecialPapers.java 
        test/vob/gl    : specialpaper.test 

Log message:
        Special paper and quad for showing selection by lightening it up

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/SpecialPapers.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/gl/specialpaper.test.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: libvob/org/nongnu/libvob/gl/SpecialPapers.java
diff -u libvob/org/nongnu/libvob/gl/SpecialPapers.java:1.4 
libvob/org/nongnu/libvob/gl/SpecialPapers.java:1.5
--- libvob/org/nongnu/libvob/gl/SpecialPapers.java:1.4  Wed Jun 11 13:41:56 2003
+++ libvob/org/nongnu/libvob/gl/SpecialPapers.java      Wed Jun 25 14:02:20 2003
@@ -87,4 +87,35 @@
        });
        return p;
     }
+
+    static public GLRen.FixedPaperQuad selectionFixedPaperQuad() {
+       return selectionFixedPaperQuad(null);
+    }
+    static public GLRen.FixedPaperQuad selectionFixedPaperQuad(Color color) {
+       return GLRen.createFixedPaperQuad(selectionPaper(color), 0, 0, 1, 1, 0, 
1, 1, 10, null, 1);
+    }
+
+    static public Paper selectionPaper() {
+       return selectionPaper(null);
+    }
+    /** Create a paper that is able to show a "selection".
+     */
+    static public Paper selectionPaper(Color color) {
+       if(color == null) color = new Color(.6f, .5f, .7f);
+       Paper selectPaper = new Paper();
+       selectPaper.setNPasses(1);
+       Paper.Pass pas = selectPaper.getPass(0);
+       pas.setSetupcode(
+           "PushAttrib CURRENT_BIT ENABLE_BIT COLOR_BUFFER_BIT\n"+
+           "Disable TEXTURE_2D\n"+
+           "Disable DEPTH_TEST\n"+
+           "Disable STENCIL_TEST\n"+
+           "Color "+ColorUtil.colorGLString(color)+"\n"+
+           "Enable BLEND\n"+
+           "BlendFunc ONE  ONE_MINUS_SRC_COLOR\n"
+       );
+       pas.setTeardowncode(" PopAttrib\n");
+       return selectPaper;
+    }
+
 }
Index: libvob/test/vob/gl/specialpaper.test
diff -u libvob/test/vob/gl/specialpaper.test:1.4 
libvob/test/vob/gl/specialpaper.test:1.5
--- libvob/test/vob/gl/specialpaper.test:1.4    Wed Jun 11 13:41:56 2003
+++ libvob/test/vob/gl/specialpaper.test        Wed Jun 25 14:02:20 2003
@@ -77,4 +77,40 @@
     checkAvgColor(50, 250, 4, 4, (255,0,0))
     checkAvgColor(250, 50, 4, 4, (0,255,0))
     checkAvgColor(250, 250, 4, 4, (255,255,255))
-    
+
+def testSelection():
+    vs = getvs()
+    vs.put(vob.vobs.SolidBackdropVob(Color.black))
+
+    paper = vob.gl.SpecialPapers.solidPaper(Color.blue)
+    pq1 = vob.gl.GLRen.createFixedPaperQuad(paper, 0, 0, 1, 1, 0, 10, 10, 10)
+
+    paper = vob.gl.SpecialPapers.solidPaper(Color.red)
+    pq2 = vob.gl.GLRen.createFixedPaperQuad(paper, 0, 0, 1, 1, 0, 10, 10, 10)
+
+    checkState1(vs)
+    vs.put(pq1, vs.coords.ortho(0, 0, 100,100, 100, 100))
+    vs.put(pq2, vs.coords.ortho(0, 0, 200,100, 100, 100))
+    checkState2(vs)
+    render(vs)
+    checkState3(vs)
+
+    checkAvgColor(140, 140, 20, 20, (0,0,255))
+    checkAvgColor(240, 140, 20, 20, (255,0,0))
+
+    # now, the selection
+    sel = vob.gl.SpecialPapers.selectionFixedPaperQuad()
+
+    checkState1(vs)
+    vs.put(sel, vs.coords.ortho(0, -1, 130, 130, 240, 40))
+    checkState2(vs)
+    render(vs)
+    checkState3(vs)
+
+    checkAvgColor(140, 140, 20, 20, (153,128,255))
+    checkAvgColor(240, 140, 20, 20, (255,128,170))
+
+
+
+
+




reply via email to

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