29 |
from vob.putil.demokeys import * |
from vob.putil.demokeys import * |
30 |
|
|
31 |
from vob.fillet import light3d |
from vob.fillet import light3d |
32 |
|
from vob.putil.demowindow import w |
33 |
|
|
34 |
from random import Random |
from random import Random |
35 |
|
|
41 |
SlideLin("x", 200, 20, "x", "Left", "Right"), |
SlideLin("x", 200, 20, "x", "Left", "Right"), |
42 |
SlideLin("y", 300, 20, "y", "Up", "Down"), |
SlideLin("y", 300, 20, "y", "Up", "Down"), |
43 |
SlideLin("ang", 21, 3, "Rotation angle", "Prior", "Next"), |
SlideLin("ang", 21, 3, "Rotation angle", "Prior", "Next"), |
44 |
|
Action("Use display list", "D", self.compile, noAnimation=1), |
45 |
*light3d.commonkeys |
*light3d.commonkeys |
46 |
) |
) |
47 |
def scene(self, vs): |
self.list = None |
48 |
vs.put( background((.5,1,.2))) |
|
49 |
|
def compile(self, *args): |
50 |
|
if self.list: |
51 |
|
self.list = None |
52 |
|
return |
53 |
|
|
54 |
|
list = GL.createDisplayList(); |
55 |
|
print w |
56 |
|
vs = w.createVobScene() |
57 |
|
self.putGraph(vs, 0, 800); |
58 |
|
|
59 |
|
list.startCompile(w.window) |
60 |
|
w.renderStill(vs, 0) |
61 |
|
list.endCompile(w.window) |
62 |
|
|
63 |
|
self.list = GLRen.createCallListCoorded(list) |
64 |
|
|
65 |
|
def putGraph(self, vs, cs, box): |
66 |
rng = Random(self.seed) |
rng = Random(self.seed) |
67 |
N2 = 2*self.N/3 |
N2 = 2*self.N/3 |
68 |
|
|
|
box = 800 |
|
|
|
|
|
cs = vs.scaleCS(0, "cs", 1, 1, 1) |
|
|
size = vs.getSize() |
|
|
cs = vs.translateCS(cs, "Trans", |
|
|
0.5 * size.width, |
|
|
0.5 * size.height, |
|
|
0.5 * box); |
|
|
|
|
|
cs = vs.coords.rotateXYZ(cs, 0, 1, 0, self.ang); |
|
|
vs.matcher.add(cs, "Rot") |
|
|
|
|
|
|
|
69 |
nodes = [ { |
nodes = [ { |
70 |
"cs" : vs.orthoBoxCS(cs, "node%s" % i, |
"cs" : vs.orthoBoxCS(cs, "node%s" % i, |
71 |
(rng.random() - .5) * box, |
(rng.random() - .5) * box, |
93 |
vs.put(conns, cs + [node["cs"]] + node["conns"]) |
vs.put(conns, cs + [node["cs"]] + node["conns"]) |
94 |
|
|
95 |
light3d.drawFillets(self, vs, pc) |
light3d.drawFillets(self, vs, pc) |
96 |
|
|
97 |
|
def scene(self, vs): |
98 |
|
vs.put( background((.5,1,.2))) |
99 |
|
|
100 |
|
box = 800 |
101 |
|
|
102 |
|
cs = vs.scaleCS(0, "cs", 1, 1, 1) |
103 |
|
size = vs.getSize() |
104 |
|
cs = vs.translateCS(cs, "Trans", |
105 |
|
0.5 * size.width, |
106 |
|
0.5 * size.height, |
107 |
|
0.5 * box); |
108 |
|
|
109 |
|
cs = vs.coords.rotateXYZ(cs, 0, 1, 0, self.ang); |
110 |
|
vs.matcher.add(cs, "Rot") |
111 |
|
|
112 |
|
if self.list: |
113 |
|
vs.put(self.list, cs) |
114 |
|
else: |
115 |
|
self.putGraph(vs, cs, box) |