gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob include/vob/vobs/Trivial.hxx src/jni/Mod...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/vobs/Trivial.hxx src/jni/Mod...
Date: Tue, 29 Apr 2003 07:22:42 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/04/29 07:22:41

Modified files:
        include/vob/vobs: Trivial.hxx 
        src/jni        : Modules 
        vob/demo       : fpfont.py 
Added files:
        include/vob/vobs: GLState.hxx 
        vob/demo       : fpfil.py 

Log message:
        start on vertex / fragment program fillets

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/GLState.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Modules.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/fpfil.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/fpfont.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.16 
libvob/include/vob/vobs/Trivial.hxx:1.17
--- libvob/include/vob/vobs/Trivial.hxx:1.16    Fri Apr 25 13:16:45 2003
+++ libvob/include/vob/vobs/Trivial.hxx Tue Apr 29 07:22:41 2003
@@ -166,33 +166,48 @@
 };
 VOB_DEFINED(CallListBoxCoorded);
 
-/** For debugging differences between GL and real transformations.
+/** For debugging differences between GL and real transformations,
+ * and for just drawing a diced quad (inefficiently!).
+ * The coordinates in the innermost coordinate system are the box
+ * coordinates, as are the texture coordinates.
  */
 struct Quad {
     enum { NTrans = 1 };
     int flags;
+    int dicex, dicey;
     template<class F> void params(F &f) {
-       f(flags);
+       f(dicex, dicey, flags);
     }
     template<class T> void render(const T &t) const {
        Pt boxwh = t.getSqSize();
        if(flags & 1) {
            glPushMatrix();
            t.performGL();
-           glBegin(GL_QUAD_STRIP);
-               glVertex(ZPt(0,0,0));
-               glVertex(ZPt(boxwh.x,0,0));
-               glVertex(ZPt(0,boxwh.y,0));
-               glVertex(ZPt(boxwh.x,boxwh.y,0));
-           glEnd();
+           
+           for(int i=0; i<dicex; i++) {
+               float x0 = boxwh.x * i / (dicex+0.);
+               float x1 = boxwh.x * (i+1) / (dicex+0.);
+               glBegin(GL_QUAD_STRIP);
+               for(int j=0; j<(dicey+1); j++) {
+                   float y = boxwh.y * j / (dicey+0.);
+                   glVertex(ZPt(x0,y,0));
+                   glVertex(ZPt(x1,y,0));
+               }
+               glEnd();
+           }
            glPopMatrix();
        } else {
-           glBegin(GL_QUAD_STRIP);
-               glVertex(t.transform(ZPt(0,0,0)));
-               glVertex(t.transform(ZPt(boxwh.x,0,0)));
-               glVertex(t.transform(ZPt(0,boxwh.y,0)));
-               glVertex(t.transform(ZPt(boxwh.x,boxwh.y,0)));
-           glEnd();
+           for(int i=0; i<dicex; i++) {
+               float x0 = boxwh.x * i / (dicex+0.);
+               float x1 = boxwh.x * (i+1) / (dicex+0.);
+               glBegin(GL_QUAD_STRIP);
+               for(int j=0; j<(dicey+1); j++) {
+                   float y = boxwh.y * j / (dicey+0.);
+                   glVertex(t.transform(ZPt(x0,y,0)));
+                   glVertex(t.transform(ZPt(x1,y,0)));
+               }
+               glEnd();
+           }
        }
     }
 };
Index: libvob/src/jni/Modules
diff -u libvob/src/jni/Modules:1.2 libvob/src/jni/Modules:1.3
--- libvob/src/jni/Modules:1.2  Wed Apr  9 11:05:24 2003
+++ libvob/src/jni/Modules      Tue Apr 29 07:22:41 2003
@@ -11,6 +11,7 @@
        Text                            \
        Paper                           \
        Irregu                          \
-       Program
+       Program                         \
+       GLState
 
 
Index: libvob/vob/demo/fpfont.py
diff -u libvob/vob/demo/fpfont.py:1.7 libvob/vob/demo/fpfont.py:1.8
--- libvob/vob/demo/fpfont.py:1.7       Wed Apr 23 10:30:00 2003
+++ libvob/vob/demo/fpfont.py   Tue Apr 29 07:22:41 2003
@@ -118,6 +118,72 @@
        uniform float2 meas: register(c0),
        uniform sampler2D t0: TEXUNIT0,
        out half4 color: COLOR) {
+    float2 tx = ddx(t);
+    float2 ty = ddy(t);
+
+    float le = sqrt(length(tx) * length(ty));
+
+    t -= .5*(tx + ty);
+
+    float c = 1;
+
+    float2 dx = tx, dy = ty;
+    half4 c0 = tex2D(t0, t + c*(dx+dy));
+    half4 c1 = tex2D(t0, t + c*(dx));
+    half4 c2 = tex2D(t0, t + c*(dy));
+    half4 c3 = tex2D(t0, t );
+
+    half4 dists = 256 * 16 * half4(
+       c0.x,
+       c1.x,
+       c2.x,
+       c3.x);
+
+    float tdx = (dists.x + dists.y - dists.z - dists.w);
+    float tdy = (dists.x + dists.z - dists.y - dists.w);
+
+    float ax = abs(tdx);
+    float ay = abs(tdy);
+
+    float maxx = max(ax, ay);
+    float minx = min(ax, ay);
+
+    float angle = (maxx < .001 ? 0 : minx / maxx);
+
+    float grayval = .25 * dot(clamp((dists + le) / le, 0,1), 
+                       half(1).xxxx).x;
+
+    color.x = (angle * angle);
+    color.y = .25 * dot((dists>float(0.).xxxx), half(1).xxxx).x;
+    color.z = grayval;
+
+    float tres = (1 - angle*angle);
+
+    float tt = .25;
+
+    color.xyz = smoothstep(
+           tt * tres, tt + (1-tt) * (1-tres),
+       grayval
+           );
+//    color.x = grayval;
+//    color.x = !isfinite(angle);
+//    color.y = !isfinite(tdx);
+//    color.z = !isfinite(tdy);
+
+    color.w = (grayval < 1);
+    color.w = 1;
+
+}
+
+
+""", "fp30")),
+
+GL.createProgram(cg.compile("""
+void main(
+       float2 t : TEXCOORD0,
+       uniform float2 meas: register(c0),
+       uniform sampler2D t0: TEXUNIT0,
+       out half4 color: COLOR) {
 //    if(tex2D(t0, t).x > 0) discard;
     half4 ders;
     ders.xy = ddx(t);




reply via email to

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