[Top][All Lists]
[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: |
Sun, 15 Dec 2002 04:06:47 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/12/15 04:06:46
Modified files:
gfx/demo : vpbuoy.py
Log message:
More twids
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/vpbuoy.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/vpbuoy.py
diff -u gzz/gfx/demo/vpbuoy.py:1.3 gzz/gfx/demo/vpbuoy.py:1.4
--- gzz/gfx/demo/vpbuoy.py:1.3 Sat Dec 14 15:15:17 2002
+++ gzz/gfx/demo/vpbuoy.py Sun Dec 15 04:06:46 2002
@@ -20,10 +20,39 @@
"""
else:
func = """
+
+ PARAM lines[] = {
+ { -100, -100, 1, 0 },
+ { 0, 0, .1, 0 },
+ { .2, .02, 9, 0 },
+ { .3, .92, .1, 0 },
+ { .75, 1, 1, 0 }
+ };
+
+ TEMP var;
+ SUB var, amplen, absamo;
+ ADD var, var, 1;
+ MUL var, var, .5;
+
+ ADDRESS iadr;
+ TEMP ind;
+ SGE ind.x, var, lines[1].x;
+ SGE ind.y, var, lines[2].x;
+ SGE ind.z, var, lines[3].x;
+ SGE ind.w, var, lines[4].x;
+ DP4 ind, ind, ind;
+ ARL iadr.x, ind.x;
+
# Shift
TEMP shift;
- TEMP k, b;
- MUL shift, amplen, cent;
+ MOV shift, var;
+
+ SUB shift, var, lines[iadr.x].x;
+ MUL shift, shift, lines[iadr.x].z;
+ ADD shift, shift, lines[iadr.x].y;
+
+
+ SUB shift, shift, var;
# See where we fall; 5 line pieces
@@ -42,14 +71,6 @@
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 };
@@ -76,7 +97,6 @@
TEMP cent;
SUB cent, zeroone.y, absamo.x;
MAX cent, cent, 0;
- MIN cent, cent, anchor.z;
TEMP scale;
ADD scale, cent, zeroone.y;
@@ -95,6 +115,7 @@
# Function to determine shift
%(func)s
+ MUL shift, shift, anchor.z;
# buoy position
TEMP buoy;
@@ -103,14 +124,17 @@
MOV buoy.zw, zeroone.xyxy;
ADD buoy.z, buoy.z, -scale;
+ ADD buoy.xyz, buoy, vertex.texcoord[0];
+
DP4 result.position.x, mvp[0], buoy;
DP4 result.position.y, mvp[1], buoy;
DP4 result.position.z, mvp[2], buoy;
DP4 result.position.w, mvp[3], buoy;
- MOV result.color, vertex.color;
+ # MOV result.color, vertex.color;
+ SWZ result.color, cent, x, x, x, 1;
- TEMP ps0;
+ ALIAS ps0 = anchor;
MAD ps0, zeroone.z, anchor.z, zeroone.z;
MUL result.pointsize, scale, ps0;
@@ -137,6 +161,9 @@
END
""")
+ if GL.getGLFloat("PROGRAM_ERROR_POSITION_ARB")[0] >= 0:
+ self.prog = None
+
vert = []
if 1:
n = 45
@@ -157,6 +184,16 @@
""" % locals())
vert = " ".join(vert)
+ vert2 = []
+ for x in floats(0,1000,100):
+ vert2.append("""
+ TexCoord 0 0
+ Vertex %(x)s 0 0
+ TexCoord 0 100
+ Vertex %(x)s 0 1
+ """ % locals())
+ vert2 = " ".join(vert2)
+
self.pointlist = getDList("""
PointSize 10
Disable TEXTURE_2D
@@ -167,28 +204,49 @@
%(vert)s
End
""" % locals())
+
+ self.linep = getDList("""
+ Disable TEXTURE_2D
+ Color 0 0 0
+ Begin LINES
+ %(vert2)s
+ End
+ """ % locals())
+
+ self.showmapping = 0
def key(self, k):
- pass
+ if k == "m":
+ self.showmapping = 1-self.showmapping
+ AbstractUpdateManager.setNoAnimation()
def scene(self, vs):
vs.map.put(background((.2,.4,.1)))
+ if not self.prog: return
+
putnoc(vs, getDListNocoords("""
BindProgram VERTEX_PROGRAM_ARB %s
Enable VERTEX_PROGRAM_ARB
Enable VERTEX_PROGRAM_POINT_SIZE_ARB
Enable POINT_SMOOTH
- Enable LINE_SMOOTH
+ LineWidth 1
+ Disable LINE_SMOOTH
+ Disable ALPHA_TEST
Enable BLEND
""" % self.prog.getProgId()));
from java.lang import Math
- vs.put(GLRen.createSetMatrix("MATRIX0_ARB"), "M", 0,
- -150+Math.random() * 300, -150+Math.random() * 300,
- 700 + Math.random() * 400, 700 + Math.random() * 400,
- )
+ if self.showmapping:
+ vs.put(GLRen.createSetMatrix("MATRIX0_ARB"), "M", 0,
+ 0, 350, 1, 1)
+ vs.put(self.linep, "G", 0, 0, 0, 1, 1)
+ else:
+ vs.put(GLRen.createSetMatrix("MATRIX0_ARB"), "M", 0,
+ -150+Math.random() * 300, -150+Math.random() * 300,
+ 700 + Math.random() * 400, 700 + Math.random() * 400,
+ )
- vs.put(self.pointlist, "F", 0, 0, 0, 1, 1)
+ vs.put(self.pointlist, "F", 0, 0, 0, 1, 1)
putnoc(vs, getDListNocoords("""
BindProgram VERTEX_PROGRAM_ARB 0
- [Gzz-commits] gzz/gfx/demo vpbuoy.py, Tuomas J. Lukka, 2002/12/14
- [Gzz-commits] gzz/gfx/demo vpbuoy.py, Tuomas J. Lukka, 2002/12/14
- [Gzz-commits] gzz/gfx/demo vpbuoy.py,
Tuomas J. Lukka <=
- [Gzz-commits] gzz/gfx/demo vpbuoy.py, Tuomas J. Lukka, 2002/12/16
- [Gzz-commits] gzz/gfx/demo vpbuoy.py, Tuomas J. Lukka, 2002/12/16
- [Gzz-commits] gzz/gfx/demo vpbuoy.py, Tuomas J. Lukka, 2002/12/17
- [Gzz-commits] gzz/gfx/demo vpbuoy.py, Tuomas J. Lukka, 2002/12/18