[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff-cvs] libvob/vob demo/multifil/randgraph.py putil/use...
From: |
Janne V. Kujala |
Subject: |
[ff-cvs] libvob/vob demo/multifil/randgraph.py putil/use... |
Date: |
Wed, 27 Aug 2003 04:21:57 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Janne V. Kujala <address@hidden> 03/08/27 04:21:57
Modified files:
vob/demo/multifil: randgraph.py
vob/putil : usertestutil.py
vob/usertest : fillet1.py
Added files:
vob/usertest : fillet2.py
Log message:
use renderOnly and swapBuffers, try the nodes-only-first type exper
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/multifil/randgraph.py.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/putil/usertestutil.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/usertest/fillet2.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/usertest/fillet1.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: libvob/vob/demo/multifil/randgraph.py
diff -u libvob/vob/demo/multifil/randgraph.py:1.30
libvob/vob/demo/multifil/randgraph.py:1.31
--- libvob/vob/demo/multifil/randgraph.py:1.30 Mon Aug 25 01:22:50 2003
+++ libvob/vob/demo/multifil/randgraph.py Wed Aug 27 04:21:57 2003
@@ -128,38 +128,41 @@
a["conns"].append(node["cs"])
b["conns"].append(node["cs"])
- rng = Random(self.seed2)
- nodes0 = nodes
- while nodes0:
- x = rng.choice(nodes0)
-
- def p2(x, y):
- return filter(lambda z: z in y["conns"], x["conns"])
-
- nodes1 = filter(lambda y: y != x and y["cs"] not in x["conns"],
- nodes)
+ if self.seed2 != None:
+ rng = Random(self.seed2)
+ nodes0 = nodes
+ while nodes0:
+ x = rng.choice(nodes0)
+
+ def p2(x, y):
+ return filter(lambda z: z in y["conns"], x["conns"])
+
+ nodes1 = filter(lambda y: y != x and y["cs"] not in x["conns"],
+ nodes)
+
+ if 1:
+ if self.path2:
+ nodes2 = filter(lambda y: y["cs"] in x["conns"], nodes)
+ else:
+ nodes2 = nodes1
+ break
- if 1:
if self.path2:
- nodes2 = filter(lambda y: y["cs"] in x["conns"], nodes)
+ nodes2 = filter(lambda y: p2(x, y), nodes1)
else:
- nodes2 = nodes1
- break
-
- if self.path2:
- nodes2 = filter(lambda y: p2(x, y), nodes1)
- else:
- nodes2 = filter(lambda y: not p2(x, y), nodes1)
-
- if nodes2: break
+ nodes2 = filter(lambda y: not p2(x, y), nodes1)
+
+ if nodes2: break
- nodes0 = filter(lambda y: x != y, nodes0)
+ nodes0 = filter(lambda y: x != y, nodes0)
- if nodes2:
- y = rng.choice(nodes2)
+ if nodes2:
+ y = rng.choice(nodes2)
+ else:
+ print "Cannot find a pair of nodes of the requested type!!"
+ y = None
else:
- print "Cannot find a pair of nodes of the requested type!!"
- y = None
+ x, y = None, None
def pc(conns, cs):
@@ -170,6 +173,24 @@
else:
vs.put(getDListNocoords("Color .2 .2 1"))
vs.put(conns, cs + [node["cs"]] + node["conns"])
+
+ if 0:
+ for node in [x,y]:
+ vs.put(getDList("""
+ PushAttrib ENABLE_BIT CURRENT_BIT
+ Disable DEPTH_TEST
+ Disable VERTEX_PROGRAM_ARB
+ Color 1 .25 .25
+ LineWidth 3
+ Begin LINES
+ Vertex 0 %(k2)s
+ Vertex %(k)s %(k2)s
+ Vertex %(k2)s 0
+ Vertex %(k2)s %(k)s
+ End
+ PopAttrib
+ Color .2 .2 1
+ """ % { "k" : self.size, "k2" : self.size * .5}),
node["cs"])
light3d.drawFillets(self, vs, pc)
Index: libvob/vob/putil/usertestutil.py
diff -u libvob/vob/putil/usertestutil.py:1.2
libvob/vob/putil/usertestutil.py:1.3
--- libvob/vob/putil/usertestutil.py:1.2 Sat Aug 9 10:39:45 2003
+++ libvob/vob/putil/usertestutil.py Wed Aug 27 04:21:57 2003
@@ -34,7 +34,15 @@
global _currentvs
_currentvs = vs
+def renderOnly(vs):
+ t = w.timeRender(vs, 0, 1)
+ #print "render", 1000*t, "ms"
+ global _currentvs
+ _currentvs = vs
+dummyvs = w.createVobScene()
+def swapBuffers():
+ w.renderStill(dummyvs, 0)
_keyqueue = java.util.Collections.synchronizedList(
java.util.ArrayList())
Index: libvob/vob/usertest/fillet1.py
diff -u libvob/vob/usertest/fillet1.py:1.4 libvob/vob/usertest/fillet1.py:1.5
--- libvob/vob/usertest/fillet1.py:1.4 Mon Aug 25 01:22:50 2003
+++ libvob/vob/usertest/fillet1.py Wed Aug 27 04:21:57 2003
@@ -23,13 +23,14 @@
from vob.putil.usertestutil import *
from vob.putil.misc import *
-from java.lang import Thread
+from java.lang import Thread,System
import math
from random import shuffle
from vob.demo.multifil import randgraph
from vob.putil import demowindow
+from vob.putil.saveanim import saveframe
def run():
demowindow.w.setLocation(0,0,1600,1200)
@@ -45,10 +46,8 @@
r.nextDouble()
sc = randgraph.Scene()
- #sc.size = 30
- #sc.box = 700
- sc.size = 40
- sc.box = 1100
+ sc.size = 30
+ sc.box = 800 #1100
sc.blend3d = 1
sc.drawInside = 0
#sc.depthColor = 0
@@ -59,7 +58,7 @@
graphs = []
for i in range(0,6):
for path2 in (0,1):
- for N in (6,18,30):#(24,48,96):#(9,15,21):
+ for N in (6,24,42,60):#(24,48,96):#(9,15,21):
graphs.append( (r.nextInt(), r.nextInt(), path2, N) )
trials = []
@@ -70,6 +69,7 @@
shuffle(trials, r.nextDouble)
+ t0 = java.lang.System.currentTimeMillis()
while trials:
#sc.seed = r.nextInt()
@@ -78,33 +78,48 @@
#sc.N = 3 * r.nextInt(4) + 9
#sc.fillets = r.nextBoolean()
- sc.seed, sc.seed2, sc.path2, sc.N, sc.fillets = trials.pop()
+ render(vs0)
- if sc.fillets:
+ sc.seed, sc.seed2, sc.path2, sc.N, fillets = trials.pop()
+ if fillets:
sc.rot = (0,0,1,0)
else:
sc.rot = (0,0,0,1)
-
- vs1 = getvs()
- sc.scene(vs1)
+ sc.fillets = fillets
+ sc.thick = 1
+ vs2 = getvs()
+ sc.scene(vs2)
timeScrub()
- render(vs0)
- Thread.sleep(1000)
+ warn = ""
+ renderOnly(vs2)
+ t1 = java.lang.System.currentTimeMillis()
+ t = 1500 - (t1 - t0)
+ if t > 0:
+ Thread.sleep(t)
+ else:
+ warn += "B%d" % (-t,)
+ print "Warning: did not get any sleep"
- render(vs1)
+ swapBuffers()
(key, msec) = waitkey()
-
render(vs0)
-
- outfile.write("%s %s %s %s %s %s %s\n" % (
+ t0 = java.lang.System.currentTimeMillis()
+
+ if key == "Print":
+ globals()["frame"] = globals().get("frame", 0) + 1;
+ saveframe("frame%d.png" % (frame, ), demowindow.w)
+
+ outfile.write("%s %s %s %s %s %s %s %s\n" % (
key, msec, sc.fillets, sc.N, sc.path2,
- sc.seed, sc.seed2,
+ sc.seed, sc.seed2, warn,
))
outfile.flush()
timeScrub()
+
+ System.exit(0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ff-cvs] libvob/vob demo/multifil/randgraph.py putil/use...,
Janne V. Kujala <=