22 |
if k == "d": |
if k == "d": |
23 |
global dbg |
global dbg |
24 |
dbg = not dbg |
dbg = not dbg |
|
""" |
|
|
if k >= "F5" and k <= "F8": |
|
|
i = int(k[1]) - 5 |
|
|
global passmask |
|
|
passmask[i] = not passmask[i] |
|
|
print passmask |
|
|
currentScene.initpaper() |
|
|
""" |
|
25 |
|
|
26 |
tex0codes = { |
tex0codes = { |
27 |
"RGB" : nvcode.parseCombiner(""" |
"RGB" : nvcode.parseCombiner(""" |
137 |
""") |
""") |
138 |
} |
} |
139 |
|
|
140 |
tex0comb = "RGB" |
def getpaper(vecs, cols, tex0comb, isectcomb, tex1comb): |
|
tex1comb = "RGB" |
|
|
isectcomb = "BAND0" |
|
|
|
|
|
def getpaper(vecs, cols): |
|
141 |
pap = Paper() |
pap = Paper() |
142 |
pap.setNPasses(1) |
pap.setNPasses(1) |
143 |
ppass = pap.getPass(0) |
ppass = pap.getPass(0) |
193 |
|
|
194 |
rng = java.util.Random() |
rng = java.util.Random() |
195 |
|
|
196 |
class PaperRegcombScene: |
class PaperTemplate: |
|
pass |
|
|
|
|
|
class PaperScene: |
|
197 |
def __init__(self): |
def __init__(self): |
|
self.bgcolor = (0.7, 0.8, 0.6) |
|
|
|
|
198 |
self.vecseed0 = 0 |
self.vecseed0 = 0 |
199 |
self.vecseed1 = 0 |
self.vecseed1 = 1 |
200 |
self.colseed = 0 |
self.colseed = 2 |
201 |
|
|
202 |
self.initvecs() |
self.initvecs() |
203 |
self.initcols() |
self.initcols() |
|
self.initpaper() |
|
204 |
|
|
205 |
self.x0, self.y0 = 600, 450 |
self.x0, self.y0 = 600, 450 |
206 |
self.x1, self.y1 = 600, 600 |
self.x1, self.y1 = 600, 600 |
218 |
Vertex 1 -1 |
Vertex 1 -1 |
219 |
End |
End |
220 |
""") |
""") |
|
|
|
221 |
def initvecs(self): |
def initvecs(self): |
222 |
colors = Colors(self.vecseed0) |
colors = Colors(self.vecseed0) |
223 |
r0 = colors.getNVDP3VecStr(0) |
r0 = colors.getNVDP3VecStr(0) |
232 |
self.cols = [ colors.getColorStr(colorbase+i) |
self.cols = [ colors.getColorStr(colorbase+i) |
233 |
for i in range(0,4) ] |
for i in range(0,4) ] |
234 |
|
|
|
def initpaper(self): |
|
|
self.pq = getpaper(self.vecs, self.cols) |
|
|
AbstractUpdateManager.setNoAnimation() |
|
|
|
|
235 |
def key(self, k): |
def key(self, k): |
|
global tex0comb,tex1comb,isectcomb |
|
236 |
if k == "v": |
if k == "v": |
237 |
self.vecseed0 = rng.nextInt(2000000000) |
self.vecseed0 = rng.nextInt(2000000000) |
238 |
self.vecseed1 = rng.nextInt(2000000000) |
self.vecseed1 = rng.nextInt(2000000000) |
239 |
self.colseed = rng.nextInt(2000000000) |
self.colseed = rng.nextInt(2000000000) |
240 |
self.initvecs() |
self.initvecs() |
241 |
self.initcols() |
self.initcols() |
|
self.initpaper() |
|
242 |
elif k == "1": |
elif k == "1": |
243 |
self.vecseed0 = rng.nextInt(2000000000) |
self.vecseed0 = rng.nextInt(2000000000) |
244 |
self.initvecs() |
self.initvecs() |
|
self.initpaper() |
|
245 |
elif k == "3": |
elif k == "3": |
246 |
self.vecseed1 = rng.nextInt(2000000000) |
self.vecseed1 = rng.nextInt(2000000000) |
247 |
self.initvecs() |
self.initvecs() |
|
self.initpaper() |
|
248 |
elif k == "2": |
elif k == "2": |
249 |
self.colseed = rng.nextInt(2000000000) |
self.colseed = rng.nextInt(2000000000) |
250 |
self.initcols() |
self.initcols() |
|
self.initpaper() |
|
251 |
elif k == "F4": |
elif k == "F4": |
252 |
self.texgen0 = TexGenXYRepeatUnit(rnd=rng) |
self.texgen0 = TexGenXYRepeatUnit(rnd=rng) |
253 |
elif k == "F5": |
elif k == "F5": |
256 |
elif k == "Down": self.y0 += 20 |
elif k == "Down": self.y0 += 20 |
257 |
elif k == "Left": self.x0 -= 20 |
elif k == "Left": self.x0 -= 20 |
258 |
elif k == "Right": self.x0 += 20 |
elif k == "Right": self.x0 += 20 |
259 |
elif k == "F1": |
|
260 |
list = tex0codes.keys() |
def place(self, vs, into, t1, c, t2): |
261 |
tex0comb = list[(list.index(tex0comb) + 1) % len(list)] |
pq = getpaper(self.vecs, self.cols, t1, c, t2) |
262 |
print "Using", tex0comb, isectcomb, tex1comb, "combiners" |
|
|
print tex0codes[tex0comb] |
|
|
self.initpaper() |
|
|
elif k == "F3": |
|
|
list = tex1codes.keys() |
|
|
tex1comb = list[(list.index(tex1comb) + 1) % len(list)] |
|
|
print "Using", tex0comb, isectcomb, tex1comb, "combiners" |
|
|
print tex1codes[tex1comb] |
|
|
self.initpaper() |
|
|
elif k == "c": |
|
|
list = isectcodes.keys() |
|
|
list.sort() |
|
|
isectcomb = list[(list.index(isectcomb) + 1) % len(list)] |
|
|
print "Using", tex0comb, isectcomb, tex1comb, "combiners" |
|
|
print isectcodes[isectcomb] |
|
|
self.initpaper() |
|
|
elif k == "C": |
|
|
list = isectcodes.keys() |
|
|
list.sort() |
|
|
isectcomb = list[(list.index(isectcomb) - 1) % len(list)] |
|
|
print "Using", tex0comb, isectcomb, tex1comb, "combiners" |
|
|
self.initpaper() |
|
|
|
|
|
def scene(self, vs): |
|
|
if not self.pq: self.initpaper() |
|
|
putnoc(vs, background(self.bgcolor)) |
|
|
|
|
|
def scene(self, vs): |
|
|
if not self.pq: self.initpaper() |
|
|
putnoc(vs, background(self.bgcolor)) |
|
263 |
|
|
264 |
# cs1 and cs2 specify the mapping from the texture coords |
# cs1 and cs2 specify the mapping from the texture coords |
265 |
# [0,1] x [0,1] to vertex coords, cs1 is for the first texture unit |
# [0,1] x [0,1] to vertex coords, cs1 is for the first texture unit |
266 |
# and cs2 for the second |
# and cs2 for the second |
267 |
|
|
268 |
scale = 400 |
scale = 400 |
269 |
cs1 = vs.coords.affineCoordsys(0, 10, self.x0, self.y0, |
cs1 = vs.coords.affineCoordsys(into, 10, self.x0, self.y0, |
270 |
scale * self.texgen0.vecs[0][0], |
scale * self.texgen0.vecs[0][0], |
271 |
scale * self.texgen0.vecs[1][0], |
scale * self.texgen0.vecs[1][0], |
272 |
scale * self.texgen0.vecs[0][1], |
scale * self.texgen0.vecs[0][1], |
273 |
scale * self.texgen0.vecs[1][1]) |
scale * self.texgen0.vecs[1][1]) |
274 |
vs.matcher.add(cs1, "1") |
vs.matcher.add(cs1, "1") |
275 |
cs2 = vs.coords.affineCoordsys(0, 10, self.x1, self.y1, |
cs2 = vs.coords.affineCoordsys(into, 10, self.x1, self.y1, |
276 |
scale * self.texgen1.vecs[0][0], |
scale * self.texgen1.vecs[0][0], |
277 |
scale * self.texgen1.vecs[1][0], |
scale * self.texgen1.vecs[1][0], |
278 |
scale * self.texgen1.vecs[0][1], |
scale * self.texgen1.vecs[0][1], |
279 |
scale * self.texgen1.vecs[1][1]) |
scale * self.texgen1.vecs[1][1]) |
280 |
vs.matcher.add(cs2, "2") |
vs.matcher.add(cs2, "2") |
281 |
|
|
282 |
vs.map.put(self.pq, cs1, cs2) |
vs.map.put(pq, cs1, cs2) |
283 |
vs.map.put(self.frame, cs1) |
vs.map.put(self.frame, cs1) |
284 |
vs.map.put(self.frame, cs2) |
vs.map.put(self.frame, cs2) |
285 |
|
|
286 |
|
class PaperScene: |
287 |
|
def __init__(self): |
288 |
|
self.bgcolor = (0.7, 0.8, 0.6) |
289 |
|
self.pt = PaperTemplate() |
290 |
|
self.tex0comb = "RGB" |
291 |
|
self.isectcomb = "BAND0" |
292 |
|
self.tex1comb = "RGB" |
293 |
|
def key(self, k): |
294 |
|
if k == "F1": |
295 |
|
list = tex0codes.keys() |
296 |
|
self.tex0comb = list[(list.index(self.tex0comb) + 1) % len(list)] |
297 |
|
print "Using", self.tex0comb, self.isectcomb, self.tex1comb, "combiners" |
298 |
|
print tex0codes[self.tex0comb] |
299 |
|
AbstractUpdateManager.setNoAnimation() |
300 |
|
elif k == "F3": |
301 |
|
list = tex1codes.keys() |
302 |
|
self.tex1comb = list[(list.index(self.tex1comb) + 1) % len(list)] |
303 |
|
print "Using", self.tex0comb, self.isectcomb, self.tex1comb, "combiners" |
304 |
|
print tex1codes[self.tex1comb] |
305 |
|
AbstractUpdateManager.setNoAnimation() |
306 |
|
elif k == "c": |
307 |
|
list = isectcodes.keys() |
308 |
|
list.sort() |
309 |
|
self.isectcomb = list[(list.index(self.isectcomb) + 1) % len(list)] |
310 |
|
print "Using", self.tex0comb, self.isectcomb, self.tex1comb, "combiners" |
311 |
|
print isectcodes[self.isectcomb] |
312 |
|
AbstractUpdateManager.setNoAnimation() |
313 |
|
elif k == "C": |
314 |
|
list = isectcodes.keys() |
315 |
|
list.sort() |
316 |
|
self.isectcomb = list[(list.index(self.isectcomb) - 1) % len(list)] |
317 |
|
AbstractUpdateManager.setNoAnimation() |
318 |
|
else: |
319 |
|
self.pt.key(k) |
320 |
|
|
321 |
|
def scene(self, vs): |
322 |
|
putnoc(vs, background(self.bgcolor)) |
323 |
|
|
324 |
|
self.pt.place(vs, 0, self.tex0comb, self.isectcomb, self.tex1comb) |
325 |
|
|
326 |
for i in range(0,3): |
for i in range(0,3): |
327 |
cs = vs.coords.affineCoordsys(0, 10, 600 + (i-1)*150, 80, 50, 0, 0, 50) |
cs = vs.coords.affineCoordsys(0, 10, 600 + (i-1)*150, 80, 50, 0, 0, 50) |
328 |
vs.matcher.add(cs, "col" + str(i)) |
vs.matcher.add(cs, "col" + str(i)) |
329 |
col = self.cols[i].split() |
col = self.pt.cols[i].split() |
330 |
cq = coloredQuad((col[0], col[1], col[2])) |
cq = coloredQuad((col[0], col[1], col[2])) |
331 |
vs.map.put(cq, cs) |
vs.map.put(cq, cs) |
332 |
vs.map.put(self.frame, cs) |
vs.map.put(self.pt.frame, cs) |
333 |
|
|
334 |
currentScene = PaperScene() |
currentScene = PaperScene() |