[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/vob demo/multifil/multifil.py demo/multi...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] libvob/vob demo/multifil/multifil.py demo/multi... |
Date: |
Fri, 27 Jun 2003 08:06:06 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Janne V. Kujala <address@hidden> 03/06/27 08:06:06
Modified files:
vob/demo/multifil: multifil.py randgraph.py stretching.py
vob/fillet : light3d.py
Log message:
cleanup
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/multifil.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/randgraph.py.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/stretching.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/fillet/light3d.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: libvob/vob/demo/multifil/multifil.py
diff -u libvob/vob/demo/multifil/multifil.py:1.18
libvob/vob/demo/multifil/multifil.py:1.19
--- libvob/vob/demo/multifil/multifil.py:1.18 Fri Jun 27 07:53:15 2003
+++ libvob/vob/demo/multifil/multifil.py Fri Jun 27 08:06:06 2003
@@ -42,17 +42,6 @@
)
def scene(self, vs):
vs.put( background((.5,1,.2)))
- vs.put(getDListNocoords("""
- PushAttrib POLYGON_BIT
- Enable DEPTH_TEST
- DepthFunc LEQUAL
- LineWidth 1
- PolygonOffset -100 -100
- ShadeModel SMOOTH
- """))
-
- if self.lines:
- vs.put(getDListNocoords("PolygonMode FRONT_AND_BACK LINE"))
#angle = vs.orthoCS(0, "Ang", 0, self.angle, 0, 0, 0);
@@ -64,33 +53,6 @@
vs.matcher.add(thick, "Thi")
vs.matcher.add(angle, "Ang")
- border = 2
- conns = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(border, self.dice,
- 1 +
- 4 * self.depthColor +
- 16 * self.ellipses +
- 64 * self.stretched +
- 128 * self.sectors),
- 2)
- conns_l = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(border, self.dice,
- 2 +
- 4 * self.depthColor +
- 16 * self.ellipses +
- 64 * self.stretched +
- 128 * self.sectors),
- 2)
- conns_c = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(1000, self.dice,
- 2 +
- 4 * self.depthColor +
- 16 * self.ellipses +
- 32 +
- 64 * self.stretched +
- 128 * self.sectors),
- 2)
-
a = vs.orthoBoxCS(0, "A", 0, 100, 100, 1, 1, self.size, self.size);
b = vs.orthoBoxCS(0, "B", 200, self.x, self.y, 1, 1, self.size,
self.size);
c = vs.orthoBoxCS(0, "C", 400, 200, 500, 1, 1, self.size, self.size);
@@ -116,18 +78,4 @@
- vs.put(getDListNocoords("""
- Color 1 1 1
- """))
- if self.drawInside: pc(conns)
- vs.put(getDListNocoords("""
- Color 0 0 0
- """))
- if self.drawEdge: pc(conns_l)
-
- if self.curvature : pc(conns_c)
-
- vs.put(getDListNocoords("""
- PopAttrib
- """))
-
+ light3d.drawFillets(self, vs, pc)
Index: libvob/vob/demo/multifil/randgraph.py
diff -u libvob/vob/demo/multifil/randgraph.py:1.20
libvob/vob/demo/multifil/randgraph.py:1.21
--- libvob/vob/demo/multifil/randgraph.py:1.20 Fri Jun 27 07:53:15 2003
+++ libvob/vob/demo/multifil/randgraph.py Fri Jun 27 08:06:06 2003
@@ -27,16 +27,10 @@
from vob.putil import cg
from vob.putil.misc import *
from vob.putil.demokeys import *
-from vob.paper.texcache import getCachedTexture
-from vob.fillet import light3d;
+from vob.fillet import light3d
from random import Random
-
-noise = getCachedTexture(
- [1024, 512, 0, 4, "RGBA", "RGBA", "noise",
- [ "freq", "100", "bias", ".5", "scale", ".8" ]]
- )
class Scene:
"Random graph"
@@ -49,40 +43,6 @@
)
def scene(self, vs):
vs.put( background((.5,1,.2)))
- vs.put(getDListNocoords("""
- PushAttrib POLYGON_BIT ENABLE_BIT
- Enable DEPTH_TEST
- DepthFunc LEQUAL
- LineWidth %s
- PolygonOffset -100 -100
- ShadeModel SMOOTH
- """ % self.linewidth))
-
- if self.lines:
- vs.put(getDListNocoords("PolygonMode FRONT_AND_BACK LINE"))
-
- border = 2
- conns = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(border, self.dice,
- 1 +
- 4 * self.depthColor +
- 8 * (1-self.fillets) +
- 16 * self.ellipses +
- 64 * self.stretched +
- 128 * self.sectors), 2)
-
- conns_l = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(border, self.dice,
- 2 +
- 4 * self.depthColor +
- 8 * (1-self.fillets) +
- 16 * self.ellipses +
- 64 * self.stretched +
- 128 * self.sectors), 2)
-
- conns3d = GLRen.createIterConnections(
- GLRen.createFillet3D(border, self.dice, 0), 2);
-
rng = Random(self.seed)
N2 = 2*self.N/3
@@ -134,60 +94,4 @@
if node["conns"]:
vs.put(conns, [thick, angle, node["cs"]] + node["conns"])
- if self.fillet3d:
- vs.put(getDListNocoords("""
- Color 1 1 1
- BindProgram VERTEX_PROGRAM_ARB %s
- Enable VERTEX_PROGRAM_ARB
- MatrixMode PROJECTION
- PushMatrix
- MatrixMode MODELVIEW
- PushMatrix
- """ % light3d.vp[0].getProgId()))
-
- if self.texture:
- vs.put(getDListNocoords("""
- BindTexture TEXTURE_2D %s
- TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
- TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
- TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 20
- TexEnv TEXTURE_ENV TEXTURE_ENV_MODE MODULATE
- Enable TEXTURE_2D
- """ % noise.getTexId()))
-
- if self.perspective:
- vs.put(getDListNocoords("""
- MatrixMode PROJECTION
- LoadIdentity
- Frustum -400 400 -400 400 500 2500
- Scale 1 1 -1
- MatrixMode MODELVIEW
- LoadIdentity
- Scale 1 1 -1
- uLookAt 400 400 -1000 400 400 400 0 -1 0
- """))
-
- pc(conns3d)
-
- vs.put(getDListNocoords("""
- MatrixMode PROJECTION
- PopMatrix
- MatrixMode MODELVIEW
- PopMatrix
- """))
- else:
- vs.put(getDListNocoords("""
- Color 1 1 1
- """))
- if self.drawInside: pc(conns)
- vs.put(getDListNocoords("""
- Color 0 0 0
- """))
- if self.drawEdge: pc(conns_l)
-
- vs.put(getDListNocoords("""
- BindProgram VERTEX_PROGRAM_ARB 0
- BindTexture TEXTURE_2D 0
- PopAttrib
- """))
-
+ light3d.drawFillets(self, vs, pc)
Index: libvob/vob/demo/multifil/stretching.py
diff -u libvob/vob/demo/multifil/stretching.py:1.2
libvob/vob/demo/multifil/stretching.py:1.3
--- libvob/vob/demo/multifil/stretching.py:1.2 Fri Jun 27 07:53:15 2003
+++ libvob/vob/demo/multifil/stretching.py Fri Jun 27 08:06:06 2003
@@ -44,17 +44,6 @@
)
def scene(self, vs):
vs.put( background((.5,1,.2)))
- vs.put(getDListNocoords("""
- PushAttrib POLYGON_BIT
- Enable DEPTH_TEST
- DepthFunc LEQUAL
- LineWidth 1
- PolygonOffset -100 -100
- ShadeModel SMOOTH
- """))
-
- if self.lines:
- vs.put(getDListNocoords("PolygonMode FRONT_AND_BACK LINE"))
#angle = vs.orthoCS(0, "Ang", 0, self.angle, 0, 0, 0);
@@ -67,33 +56,6 @@
vs.matcher.add(thick, "Thi")
vs.matcher.add(angle, "Ang")
- border = 2
- conns = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(border, self.dice,
- 1 +
- 4 * self.depthColor +
- 16 * self.ellipses +
- 64 * self.stretched +
- 128 * self.sectors),
- 2)
- conns_l = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(border, self.dice,
- 2 +
- 4 * self.depthColor +
- 16 * self.ellipses +
- 64 * self.stretched +
- 128 * self.sectors),
- 2)
- conns_c = GLRen.createSortedConnections(
- GLRen.createFilletSpan2(1000, self.dice,
- 2 +
- 4 * self.depthColor +
- 16 * self.ellipses +
- 32 +
- 64 * self.stretched +
- 128 * self.sectors),
- 2)
-
N = 10
a = [vs.orthoBoxCS(0, "A%s" % i, 0, 100, 100+100*i,
@@ -110,18 +72,5 @@
vs.put(conns, [thick, angle, b[i], a[i]]);
- vs.put(getDListNocoords("""
- Color 1 1 1
- """))
- if self.drawInside: pc(conns)
- vs.put(getDListNocoords("""
- Color 0 0 0
- """))
- if self.drawEdge: pc(conns_l)
-
- if self.curvature : pc(conns_c)
-
- vs.put(getDListNocoords("""
- PopAttrib
- """))
+ light3d.drawFillets(self, vs, pc)
Index: libvob/vob/fillet/light3d.py
diff -u libvob/vob/fillet/light3d.py:1.8 libvob/vob/fillet/light3d.py:1.9
--- libvob/vob/fillet/light3d.py:1.8 Fri Jun 27 07:53:15 2003
+++ libvob/vob/fillet/light3d.py Fri Jun 27 08:06:06 2003
@@ -1,8 +1,15 @@
# (c) Janne V. Kujala and Tuomas J. Lukka
from org.nongnu.libvob.gl import GL, GLRen
from vob.putil import cg
+from vob.putil.misc import *
from vob.putil.demokeys import *
+from vob.paper.texcache import getCachedTexture
+noise = getCachedTexture(
+ [1024, 512, 0, 4, "RGBA", "RGBA", "noise",
+ [ "freq", "100", "bias", ".5", "scale", ".8" ]]
+ )
+
vp = [
GL.createProgram(cg.compile("""
void main(
@@ -109,3 +116,112 @@
Toggle("perspective", 0, "perspective", "F"),
Toggle("texture", 0, "texture", "x"),
]
+
+
+def drawFillets(self, vs, pc):
+ vs.put(getDListNocoords("""
+ PushAttrib POLYGON_BIT ENABLE_BIT
+ Enable DEPTH_TEST
+ DepthFunc LEQUAL
+ LineWidth %s
+ PolygonOffset -100 -100
+ ShadeModel SMOOTH
+ """ % self.linewidth))
+
+ if self.lines:
+ vs.put(getDListNocoords("PolygonMode FRONT_AND_BACK LINE"))
+
+ border = 2
+ conns = GLRen.createSortedConnections(
+ GLRen.createFilletSpan2(border, self.dice,
+ 1 +
+ 4 * self.depthColor +
+ 16 * self.ellipses +
+ 64 * self.stretched +
+ 128 * self.sectors),
+ 2)
+ conns_l = GLRen.createSortedConnections(
+ GLRen.createFilletSpan2(border, self.dice,
+ 2 +
+ 4 * self.depthColor +
+ 16 * self.ellipses +
+ 64 * self.stretched +
+ 128 * self.sectors),
+ 2)
+ conns_c = GLRen.createSortedConnections(
+ GLRen.createFilletSpan2(1000, self.dice,
+ 2 +
+ 4 * self.depthColor +
+ 16 * self.ellipses +
+ 32 +
+ 64 * self.stretched +
+ 128 * self.sectors),
+ 2)
+
+ conns3d = GLRen.createIterConnections(
+ GLRen.createFillet3D(border, self.dice, 1),
+ 2)
+
+
+
+
+
+ if self.fillet3d:
+ vs.put(getDListNocoords("""
+ Color 1 1 1
+ BindProgram VERTEX_PROGRAM_ARB %s
+ Enable VERTEX_PROGRAM_ARB
+ MatrixMode PROJECTION
+ PushMatrix
+ MatrixMode MODELVIEW
+ PushMatrix
+ """ % vp[0].getProgId()))
+
+ if self.texture:
+ vs.put(getDListNocoords("""
+ BindTexture TEXTURE_2D %s
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 20
+ TexEnv TEXTURE_ENV TEXTURE_ENV_MODE MODULATE
+ Enable TEXTURE_2D
+ """ % noise.getTexId()))
+
+ if self.perspective:
+ vs.put(getDListNocoords("""
+ MatrixMode PROJECTION
+ LoadIdentity
+ Frustum -400 400 -400 400 500 2500
+ Scale 1 1 -1
+ MatrixMode MODELVIEW
+ LoadIdentity
+ Scale 1 1 -1
+ uLookAt 400 400 -1000 400 400 400 0 -1 0
+ """))
+
+ pc(conns3d)
+
+ vs.put(getDListNocoords("""
+ MatrixMode PROJECTION
+ PopMatrix
+ MatrixMode MODELVIEW
+ PopMatrix
+ """))
+ else:
+ vs.put(getDListNocoords("""
+ Color 1 1 1
+ """))
+ if self.drawInside: pc(conns)
+ vs.put(getDListNocoords("""
+ Color 0 0 0
+ """))
+ if self.drawEdge: pc(conns_l)
+
+ if self.curvature : pc(conns_c)
+
+
+ vs.put(getDListNocoords("""
+ BindProgram VERTEX_PROGRAM_ARB 0
+ BindTexture TEXTURE_2D 0
+ PopAttrib
+ """))
- [Gzz-commits] libvob/vob demo/multifil/multifil.py demo/multi...,
Janne V. Kujala <=