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: Sat, 14 Dec 2002 15:15:18 -0500

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

Modified files:
        gfx/demo       : vpbuoy.py 

Log message:
        Twids

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

Patches:
Index: gzz/gfx/demo/vpbuoy.py
diff -u gzz/gfx/demo/vpbuoy.py:1.2 gzz/gfx/demo/vpbuoy.py:1.3
--- gzz/gfx/demo/vpbuoy.py:1.2  Sat Dec 14 08:01:50 2002
+++ gzz/gfx/demo/vpbuoy.py      Sat Dec 14 15:15:17 2002
@@ -1,9 +1,35 @@
 from gfx.util.misc import *
 from gfx.util import vparb
 
+
 class Scene:
+    """A vertex program version of buoys for exploring
+    1) vertex programs, 2) buoy geometry.
+
+    Not for real use.
+    """
     def __init__(self):
+       rad = 400.0
        recrad = 1/400.0
+
+       if 0:
+           func = """
+               # Shift
+               TEMP shift;
+               MUL shift, cent, radius.y;
+           """
+       else:
+           func = """
+               # Shift
+               TEMP shift;
+               TEMP k, b;
+               MUL shift, amplen, cent;
+
+               # See where we fall; 5 line pieces
+
+               MUL shift, shift, radius.y;
+           """
+
        self.prog = GL.createProgram("""!!ARBvp1.0
            
            # x,y = coordinates
@@ -13,9 +39,18 @@
 
            PARAM center = { 512, 350, 0, 0 };
            PARAM p = { 112, 350, 0, 0 };
-           PARAM radius = { %(recrad)s, 0, 0, 0 };
+           PARAM radius = { %(recrad)s, %(rad)s, 0, 0 };
            PARAM zeroone = { 0, 1, 5, 0 };
 
+           PARAM lines[] = {
+                       { -100, -100, 1, 0 },
+                       { 0, 0, .1, 0 },
+                       { .2, .02, 9, 0 },
+                       { .3, .92, .1, 0 },
+                       { .75, 1, 1, 0 }
+                   };
+
+
            PARAM pm[4] = { state.matrix.program[0] };
            PARAM mvp[4] = { state.matrix.mvp };
 
@@ -37,19 +72,33 @@
            MUL absamo, absamo.x, absamo.y;
            MUL absamo, absamo, radius.x;
 
-           # Scale = 1-|A-O|
+           # cent = 1-|A-O|
+           TEMP cent;
+           SUB cent, zeroone.y, absamo.x;
+           MAX cent, cent, 0;
+           MIN cent, cent, anchor.z;
+
            TEMP scale;
-           SUB scale, zeroone.y, absamo.x;
-           MAX scale, scale, 0;
-           MIN scale, scale, anchor.z;
-           ADD scale, scale, zeroone.y;
+           ADD scale, cent, zeroone.y;
 
            TEMP amp;
            SUB amp, anchor, p;
 
+           TEMP ampnor;
+           TEMP amplen;
+           DP3 amplen, amp, amp;
+           RSQ ampnor, amplen.x;
+           MUL amplen, amplen.x, ampnor.x;
+           MUL amplen, amplen.x, radius.x;
+           MUL ampnor, ampnor, amp;
+
+           # Function to determine shift
+           %(func)s
+
+
            # buoy position
            TEMP buoy;
-           MAD buoy, amp, scale, p;
+           MAD buoy, ampnor, shift, anchor;
 
            MOV buoy.zw, zeroone.xyxy;
            ADD buoy.z, buoy.z, -scale;
@@ -89,9 +138,10 @@
        """)
 
        vert = []
-       if 0:
-           for x in floats(0,1,15):
-               for y in floats(0,1,15):
+       if 1:
+           n = 45
+           for x in floats(0,1,n):
+               for y in floats(0,1,n):
                    vert.append("""
                        Color %(x)s .0 %(y)s .6
                        Vertex %(x)s %(y)s 0 1
@@ -127,6 +177,7 @@
                Enable VERTEX_PROGRAM_ARB
                Enable VERTEX_PROGRAM_POINT_SIZE_ARB
                Enable POINT_SMOOTH
+               Enable LINE_SMOOTH
                Enable BLEND
        """ % self.prog.getProgId()));
 



reply via email to

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