gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob vob/demo/fpfil.py vob/paper/colors.py la...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob vob/demo/fpfil.py vob/paper/colors.py la...
Date: Tue, 06 May 2003 23:43:57 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/05/06 23:43:57

Modified files:
        vob/demo       : fpfil.py 
        vob/paper      : colors.py 
Added files:
        lava           : __init__.py 
        lava/paper     : __init__.py fpexp.py 

Log message:
        Forgot to add these earlier: experiments with fragment progs

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/lava/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/lava/paper/__init__.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/lava/paper/fpexp.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/fpfil.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/paper/colors.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: libvob/vob/demo/fpfil.py
diff -u libvob/vob/demo/fpfil.py:1.4 libvob/vob/demo/fpfil.py:1.5
--- libvob/vob/demo/fpfil.py:1.4        Wed Apr 30 04:37:54 2003
+++ libvob/vob/demo/fpfil.py    Tue May  6 23:43:57 2003
@@ -35,21 +35,45 @@
     {0, 0, 0, 1},
 };
 
+float2 inters(float2 what) {
+    float2 ctr = float2(.5,.5);
+    float2 vec = what-ctr;
+    float2 a = abs(vec);
+    // if(a.x + a.y < .001) return float4(0,0,0,1);
+    float mul;
+    if(a.x > a.y) { 
+       mul = .5 / a.x;
+    } else {
+       mul = .5 / a.y;
+    }
+    return ctr + vec * mul;
+}
+
 void main(
        float4 t: TEXCOORD0,
        float4 pos: POSITION,
        out float4  opos: POSITION,
        out float4 ocol : TEXCOORD0
 ) {
-    float4 ctr1 = mul(glstate.matrix.program[0], float4(.5,.5,0,1));
-    float4 ctr2 = mul(glstate.matrix.program[1], float4(.5,.5,0,1));
+    float4 ctr = float4(.5,.5,0,1);
+    float4 ctr1 = mul(glstate.matrix.program[0], ctr);
+    float4 ctr2 = mul(glstate.matrix.program[1], ctr);
+
+    float4 ctr1_in2 = mul(glstate.matrix.inverse.program[1], ctr1);
+    float4 ctr2_in1 = mul(glstate.matrix.inverse.program[0], ctr2);
+
+    // Solve eq: find intersections of unit squares
+    float2 inters1 = inters(ctr2_in1.xy);
+    float2 inters2 = inters(ctr1_in2.xy);
+    // float2 inters1 = ctr.xy;
+    // float2 inters2 = ctr.xy;
 
     float inter = frac(4*pos.x);
     float edgeind = fmod(floor(4*pos.x), 4) ;
 
 
-    float4 xa = float4(0,0,0,1);
-    float4 xb = float4(0,0,0,1);
+    float2 xa = float2(0,0);
+    float2 xb = float2(0,0);
 
     xa.x = (edgeind >= 2 && edgeind < 4);
     xa.y = (edgeind >= 1 && edgeind < 3);
@@ -64,15 +88,23 @@
 */
 
 
-    float4 x = lerp(xa, xb, inter);
+    float2 x = lerp(xa, xb, inter);
     // x = float4(pos.x, 0, 0, 1);
 
     float shri = 3.7*(pos.y - pos.y*pos.y);
 
-    x = lerp(x, float4(.5, .5, 0, 1), shri);
+    float4 sx1;
+    float4 sx2;
+    sx1.xy = lerp(x, inters1, shri);
+    sx2.xy = lerp(x, inters2, shri);
+
+    sx1.z = 0;
+    sx1.w = 1;
+    sx2.z = 0;
+    sx2.w = 1;
 
-    float4 x1 = mul(glstate.matrix.program[0], x);
-    float4 x2 = mul(glstate.matrix.program[1], x);
+    float4 x1 = mul(glstate.matrix.program[0], sx1);
+    float4 x2 = mul(glstate.matrix.program[1], sx2);
 
     float4 p = lerp(x1, x2, pos.y);
 
@@ -95,7 +127,7 @@
     ocol.xy = pos.xy; 
     ocol.z = shri;
 
-    ocol.w = min(pin1, pin2);
+    ocol.w = min(pin1, pin2).x;
 
 //    ocol.w = .5;
  //   oc.z = 1;
@@ -111,10 +143,13 @@
        uniform sampler2D t0: TEXUNIT0,
        uniform sampler2D t1: TEXUNIT1
 ) {
+    // Don't render inside the rectangles
+    // if(p.w < 1) discard;
+
     float3 dark = float3(186, 71, 18) / 255.0;
     float3 light = float3(249, 233, 50) / 255.0;
 
-    float4 dtex = tex2D(t0, p.xy * float2(4, 2));
+    float4 dtex = tex2D(t0, p.xy * float2(7, .1));
     float4 atex = tex2D(t1, p.xy * float2(2, 2));
 
     ocol.xyz = lerp(dark, light, dtex.x);
@@ -133,7 +168,7 @@
        self.key = KeyPresses(
             self, 
            SlideLin("x", 400, 50, "x coord", "Left", "Right"),
-           SlideLin("y", 400, 10, "x coord", "Up", "Down"),
+           SlideLin("y", 400, 50, "y coord", "Up", "Down"),
            SlideLin("a", 0, 15, "Rotation", "Prior", "Next"),
        )
     def scene(self, vs):
@@ -178,7 +213,7 @@
        """ % (
                vp[0].getProgId(),
                fp[0].getProgId(),
-               turb.getTexId(),
+               noise.getTexId(),
                lnoise.getTexId(),
                    )))
 
Index: libvob/vob/paper/colors.py
diff -u libvob/vob/paper/colors.py:1.1 libvob/vob/paper/colors.py:1.2
--- libvob/vob/paper/colors.py:1.1      Thu Apr 10 10:00:19 2003
+++ libvob/vob/paper/colors.py  Tue May  6 23:43:57 2003
@@ -105,6 +105,7 @@
             print "ANGLE=", self._AB_angle(col), "AREA=", 
self._AB_area(col)*100
 
        self.colors = [self._js(c) for c in col]
+       self.colorarrs = col
 
        self.randvecs = [self._randvec2() for i in range(0,15)]
 




reply via email to

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