gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/demo vpbuoy.py


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx/demo vpbuoy.py
Date: Wed, 18 Dec 2002 05:01:16 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/12/18 05:01:16

Modified files:
        gfx/demo       : vpbuoy.py 

Log message:
        More vp twids. Hope to get this stuff fixed properly soon

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/vpbuoy.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/vpbuoy.py
diff -u gzz/gfx/demo/vpbuoy.py:1.9 gzz/gfx/demo/vpbuoy.py:1.10
--- gzz/gfx/demo/vpbuoy.py:1.9  Tue Dec 17 09:11:18 2002
+++ gzz/gfx/demo/vpbuoy.py      Wed Dec 18 05:01:15 2002
@@ -58,13 +58,14 @@
 
            outs main(
                    float4 orig : POSITION, 
-                   float4 texcoord : TEXCOORD0,
+                   float4 texcoord : TEXCOORD0, // if on circle, texcoord.x = 
angle
                    float4 color : COLOR,
                    uniform float4 p : C0,
-                   uniform float4 origin : C1
+                   uniform float4 origin : C1,
+                   uniform float rad : C2,
+                   uniform float oncircle : C3
                    ) {
                outs o;
-               cfloat rad = 400;
                float2 anchor = anchorPlace(orig);
 
                float2 ap = anchor.xy - p.xy;
@@ -75,7 +76,7 @@
                float2 apnor = ap / aplen;
                float2 opnor = normalize(origin.xy - p.xy);
 
-               float outside = smoothstep(.9, 1, aolen /rad);
+               float outside = smoothstep(.8, 1.2, aolen /rad);
                // float outside = 1;
 
                // component of a..origin perpendicular to
@@ -83,22 +84,28 @@
 
                float2 yperp = ao - dot(ao,opnor) * opnor;
 
+               float2 ccenter = origin.xy + outside * yperp;
+
                // float vrad = rad * (1 - .25 * (2 - aplen/rad));
-               float vrad = rad + .1 * outside * aolen; // rad;
+               float vrad = lerp(rad, 20 + distance(anchor, ccenter), outside);
 
 
 
                float2 projected = project2circle(anchor.xy, 
-                       p.xy + outside * yperp, origin.xy + outside * yperp, 
vrad);
+                       p.xy + outside * yperp, 
+                       ccenter,
+                       vrad);
 
 
 
 
                float4 buoy;
-               buoy.xy = (orig.z > 0 ? 
+               buoy.xy = (oncircle > 0 ? 
+                   ccenter + vrad * float2(sin(texcoord.x), cos(texcoord.x))
+                   : (orig.z > 0 ? 
                        projected
                        // lerp(anchor + opnor * 20 , projected, 1-outside)
-                           : anchor);
+                           : anchor));
                buoy.z = 1-orig.z;
                buoy.w = 1;
 
@@ -354,6 +361,11 @@
                    Vertex %(x)s %(y)s 0 1
                    Vertex %(x)s %(y)s 1 1
                """ % locals())
+           vert.append("""
+               Color 1 1 1 1
+               Vertex 0 0 0 1
+               Vertex 0 0 1 1
+           """)
        vert = " ".join(vert)
 
        vert2 = []
@@ -366,6 +378,13 @@
            """ % locals())
        vert2 = " ".join(vert2)
 
+       vert3 = " ".join([
+           """TexCoord %s 0
+              Vertex 0 0 1 1
+           """ % x
+           for x in floats(0, 2*3.15, 50)
+           ])
+
        self.pointlist = getDList("""
            PointSize 10
            Disable TEXTURE_2D
@@ -375,6 +394,12 @@
            Begin LINES
            %(vert)s
            End
+
+           ProgramLocalParameter VERTEX_PROGRAM_ARB 3 1 0 0 0
+           Begin LINE_STRIP
+           %(vert3)s
+           End
+           ProgramLocalParameter VERTEX_PROGRAM_ARB 3 0 0 0 0
        """ % locals())
 
        self.linep = getDList("""
@@ -441,8 +466,9 @@
            vs.map.put(GLRen.createSetMatrix("MATRIX0_ARB"), cs)
 
            putnoc(vs, getDListNocoords("""
-               ProgramLocalParameter VERTEX_PROGRAM_ARB 0 100 350 0 0
-               ProgramLocalParameter VERTEX_PROGRAM_ARB 1 500 350 0 0
+               ProgramLocalParameter VERTEX_PROGRAM_ARB 0 200 350 0 0
+               ProgramLocalParameter VERTEX_PROGRAM_ARB 1 400 350 0 0
+               ProgramLocalParameter VERTEX_PROGRAM_ARB 2 150 0 0 0
            """))
            vs.map.put(self.pointlist, 0)
            if 0:



reply via email to

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