109 |
|
|
110 |
|
|
111 |
def getpaper(seed): |
def getpaper(seed): |
112 |
pap = Paper() |
pap = ThePaperMill().getPaper(seed) |
113 |
GL.startContext() |
return GLRen.createPaperQuad(pap, -1, -1, 1, 1, 0) |
|
|
|
|
passes = [ { "trans" : 0, "emboss" : 0 }, |
|
|
{ "trans" : .5, "emboss" : 0 }, |
|
|
{ "trans" : .9375, "emboss" : 0 }, |
|
|
#{ "trans" : 0, "emboss" : 1 }, |
|
|
] |
|
|
|
|
|
|
|
|
rng = java.util.Random(seed) |
|
|
seeds = [rng.nextInt(2000000000) for foo in passes] |
|
|
|
|
|
pap.setNPasses(len(passes)) |
|
|
#setSolidPass(pap.getPass(0), (0.1,0.1,0.2)) |
|
|
|
|
|
for i in range(0, len(passes)): |
|
|
PaperMill().makePaperPass(seeds[i], pap.getPass(i), passes[i]["trans"], |
|
|
emboss = passes[i]["emboss"]) |
|
|
|
|
|
GL.endContext() |
|
|
|
|
|
#print "Pq: ",seed |
|
|
return GLRen.createPaperQuad(pap, -1, -1, 1, 1) |
|
114 |
|
|
115 |
execfile("gfx/libpaper/papermill.py") |
execfile("gfx/libpaper/papermill.py") |
116 |
|
|
183 |
def scene(self, vs): |
def scene(self, vs): |
184 |
putnoc(vs, background(self.bgcolor)) |
putnoc(vs, background(self.bgcolor)) |
185 |
|
|
186 |
cs1 = vs.coords.affineCoordsys("1", 10, 800, 600, 800, 0, 0, 600) |
cs1 = vs.coords.affineCoordsys(0, 10, 800, 600, 800, 0, 0, 600) |
187 |
|
vs.matcher.add(cs1, "1") |
188 |
scale = zoom[0] / paperzoom[0] |
scale = zoom[0] / paperzoom[0] |
189 |
cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale) |
cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, 800/scale, 0, 0, 600/scale) |
190 |
|
vs.matcher.add(cs2, "tex") |
191 |
|
|
192 |
pscale = zoom[0] |
pscale = zoom[0] |
193 |
|
|
195 |
vs.map.put(self.pq, cs1, cs2) |
vs.map.put(self.pq, cs1, cs2) |
196 |
|
|
197 |
if 0: |
if 0: |
198 |
cs1 = vs.coords.affineCoordsys("msg", 10, 570, 450, 1, 0, 0, 1) |
cs1 = vs.coords.affineCoordsys(0, 10, 570, 450, 1, 0, 0, 1) |
199 |
|
vs.matcher.add(cs1, "msg") |
200 |
putText(vs, cs1, words[self.seed], color=(0,0,0),w=4,h=4) |
putText(vs, cs1, words[self.seed], color=(0,0,0),w=4,h=4) |
201 |
|
|
202 |
return vs |
return vs |
297 |
def scene(self, vs): |
def scene(self, vs): |
298 |
putnoc(vs, background(self.bgcolor)) |
putnoc(vs, background(self.bgcolor)) |
299 |
|
|
300 |
cs1 = vs.coords.affineCoordsys("1", 10, 800, 600, 800, 0, 0, 600) |
cs1 = vs.coords.affineCoordsys(0, 10, 800, 600, 800, 0, 0, 600) |
301 |
|
vs.matcher.add(cs1, "1") |
302 |
scale = zoom[0] / paperzoom[0] |
scale = zoom[0] / paperzoom[0] |
303 |
cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale) |
cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale/800, 0, 0, scale/600) |
304 |
|
vs.matcher.add(cs2, "tex") |
305 |
pscale = zoom[0] |
pscale = zoom[0] |
306 |
|
|
307 |
print "Seed: ",self.seed," pq ",self.pq |
print "Seed: ",self.seed," pq ",self.pq |
319 |
else: |
else: |
320 |
msg2 = "Ei ollut nähty" |
msg2 = "Ei ollut nähty" |
321 |
|
|
322 |
cs1 = vs.coords.affineCoordsys("msg", 10, 350, 350, 1, 0, 0, 1) |
cs1 = vs.coords.affineCoordsys(0, 10, 350, 350, 1, 0, 0, 1) |
323 |
|
vs.matcher.add(cs1, "msg") |
324 |
putText(vs, cs1, msg, color=(0,0,0),w=1,h=1,x=100) |
putText(vs, cs1, msg, color=(0,0,0),w=1,h=1,x=100) |
325 |
putText(vs, cs1, msg2, color=(0,0,0),w=1,h=1, y=400) |
putText(vs, cs1, msg2, color=(0,0,0),w=1,h=1, y=400) |
326 |
#self.prepareNextTrial() |
#self.prepareNextTrial() |
346 |
putnoc(vs, background(self.bgcolor)) |
putnoc(vs, background(self.bgcolor)) |
347 |
|
|
348 |
if self.message != None: |
if self.message != None: |
349 |
cs1 = vs.coords.affineCoordsys("msg", 10, 300, 450, 1, 0, 0, 1) |
cs1 = vs.coords.affineCoordsys(0, 10, 300, 450, 1, 0, 0, 1) |
350 |
|
vs.matcher.add(cs1, "msg") |
351 |
putText(vs, cs1, self.message, color=(1,1,1)) |
putText(vs, cs1, self.message, color=(1,1,1)) |
352 |
|
|
353 |
return vs |
return vs |
378 |
def scene(self, vs): |
def scene(self, vs): |
379 |
putnoc(vs, background(self.bgcolor)) |
putnoc(vs, background(self.bgcolor)) |
380 |
|
|
381 |
cs1 = vs.coords.affineCoordsys("txt", 10, 100, 450, 1, 0, 0, 1) |
cs1 = vs.coords.affineCoordsys(0, 10, 100, 450, 1, 0, 0, 1) |
382 |
|
vs.matcher.add(cs1, "txt") |
383 |
putText(vs, cs1, "Press 'F1' to start", color=(0,1,0)) |
putText(vs, cs1, "Press 'F1' to start", color=(0,1,0)) |
384 |
putText(vs, cs1, "seed = " + str(self.seed), color=(0,1,0), y = 100) |
putText(vs, cs1, "seed = " + str(self.seed), color=(0,1,0), y = 100) |
385 |
|
|
386 |
if self.pq != None: |
if self.pq != None: |
387 |
cs1 = vs.coords.affineCoordsys("1", 10, 800, 450, 390, 0, 0, 390) |
cs1 = vs.coords.affineCoordsys(0, 10, 800, 450, 390, 0, 0, 390) |
388 |
|
vs.matcher.add(cs1, "1") |
389 |
scale = zoom[0] / paperzoom[0] |
scale = zoom[0] / paperzoom[0] |
390 |
cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale) |
cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale/390, 0, 0, scale/390) |
391 |
|
vs.matcher.add(cs2, "tex") |
392 |
vs.map.put(self.pq, cs1, cs2) |
vs.map.put(self.pq, cs1, cs2) |
393 |
|
|
394 |
return vs |
return vs |