11 |
if k == "d": |
if k == "d": |
12 |
global dbg |
global dbg |
13 |
dbg = not dbg |
dbg = not dbg |
14 |
|
""" |
15 |
if k >= "F5" and k <= "F8": |
if k >= "F5" and k <= "F8": |
16 |
i = int(k[1]) - 5 |
i = int(k[1]) - 5 |
17 |
global passmask |
global passmask |
18 |
passmask[i] = not passmask[i] |
passmask[i] = not passmask[i] |
19 |
print passmask |
print passmask |
20 |
currentScene.initpaper() |
currentScene.initpaper() |
21 |
|
""" |
22 |
|
|
23 |
tex0codes = { |
tex0codes = { |
24 |
"ALL" : "", |
"ALL" : "", |
124 |
|
|
125 |
rng = java.util.Random() |
rng = java.util.Random() |
126 |
|
|
|
x0, y0 = 600, 300 |
|
|
x1, y1 = 600, 600 |
|
127 |
|
|
128 |
class PaperScene: |
class PaperScene: |
129 |
def __init__(self): |
def __init__(self): |
135 |
self.colseed = 0 |
self.colseed = 0 |
136 |
self.initpaper() |
self.initpaper() |
137 |
|
|
138 |
|
self.x0, self.y0 = 600, 300 |
139 |
|
self.x1, self.y1 = 600, 450 |
140 |
|
self.texgen0 = TexGenXYRepeatUnit(vecs = [[.5,0], [0,.5]]) |
141 |
|
self.texgen1 = TexGenXYRepeatUnit(vecs = [[.25,.25], [.25,-.25]]) |
142 |
|
|
143 |
|
self.frame = getDList(""" |
144 |
|
Color 0 0 0 |
145 |
|
Disable TEXTURE_2D |
146 |
|
Disable DEPTH_TEST |
147 |
|
Begin LINE_LOOP |
148 |
|
Vertex -1 -1 |
149 |
|
Vertex -1 1 |
150 |
|
Vertex 1 1 |
151 |
|
Vertex 1 -1 |
152 |
|
End |
153 |
|
""") |
154 |
|
|
155 |
def initpaper(self): |
def initpaper(self): |
156 |
self.pq = getpaper(self.seed, self.vecseed0, self.vecseed1, self.colseed) |
self.pq = getpaper(self.seed, self.vecseed0, self.vecseed1, self.colseed) |
157 |
AbstractUpdateManager.setNoAnimation() |
AbstractUpdateManager.setNoAnimation() |
158 |
|
|
159 |
def key(self, k): |
def key(self, k): |
160 |
global tex0comb,tex1comb,isectcomb |
global tex0comb,tex1comb,isectcomb |
|
global x0, y0, x1, y1 |
|
161 |
oldseed = self.seed |
oldseed = self.seed |
162 |
if k == "v": |
if k == "v": |
163 |
self.seed = rng.nextInt(2000000000) |
self.seed = rng.nextInt(2000000000) |
174 |
elif k == "2": |
elif k == "2": |
175 |
self.colseed = rng.nextInt(2000000000) |
self.colseed = rng.nextInt(2000000000) |
176 |
self.initpaper() |
self.initpaper() |
177 |
elif k == "Up": y0 -= 20 |
elif k == "F4": |
178 |
elif k == "Down": y0 += 20 |
self.texgen0 = TexGenXYRepeatUnit(rnd=rng) |
179 |
elif k == "Left": x0 -= 20 |
elif k == "F5": |
180 |
elif k == "Right": x0 += 20 |
self.texgen1 = TexGenXYRepeatUnit(rnd=rng) |
181 |
|
elif k == "Up": self.y0 -= 20 |
182 |
|
elif k == "Down": self.y0 += 20 |
183 |
|
elif k == "Left": self.x0 -= 20 |
184 |
|
elif k == "Right": self.x0 += 20 |
185 |
elif k == "F1": |
elif k == "F1": |
186 |
list = tex0codes.keys() |
list = tex0codes.keys() |
187 |
tex0comb = list[(list.index(tex0comb) + 1) % len(list)] |
tex0comb = list[(list.index(tex0comb) + 1) % len(list)] |
206 |
# [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 |
207 |
# and cs2 for the second |
# and cs2 for the second |
208 |
|
|
209 |
cs1 = vs.coords.affineCoordsys(0, "1", 10, x0, y0, 200, 0, 0, 200) |
scale = 400 |
210 |
cs2 = vs.coords.affineCoordsys(0, "2", 10, x1, y1, 100, 100, 100, -100) |
cs1 = vs.coords.affineCoordsys(0, "1", 10, self.x0, self.y0, |
211 |
|
scale * self.texgen0.vecs[0][0], |
212 |
|
scale * self.texgen0.vecs[1][0], |
213 |
|
scale * self.texgen0.vecs[0][1], |
214 |
|
scale * self.texgen0.vecs[1][1]) |
215 |
|
cs2 = vs.coords.affineCoordsys(0, "2", 10, self.x1, self.y1, |
216 |
|
scale * self.texgen1.vecs[0][0], |
217 |
|
scale * self.texgen1.vecs[1][0], |
218 |
|
scale * self.texgen1.vecs[0][1], |
219 |
|
scale * self.texgen1.vecs[1][1]) |
220 |
|
|
221 |
vs.map.put(self.pq, cs1, cs2) |
vs.map.put(self.pq, cs1, cs2) |
222 |
|
vs.map.put(self.frame, cs1) |
223 |
|
vs.map.put(self.frame, cs2) |
224 |
|
|
225 |
currentScene = PaperScene() |
currentScene = PaperScene() |