return r * cos(theta), r * sin(theta) coords = [] for k_mul in range(3000): for t_mul in range(int(pi * 1000 + 1)): a, b = f(float(t_mul / 100), float(k_mul) / 100.0) x = round(max_x // 2 + a * 1.2) y = round(max_y // 2 + b) if (x % 2 != 0) or (y % 2 != 0): continue if x < 0 or x >= max_x // 2 or y < 0 or y >= max_y: continue coords.append((x, y)) unique_coords = util.unique(coords) unique_vals = util.vals_2bit(unique_coords) with open("../../../src/fx/fx.hgr.butterfly.data.a", "w") as f: for aval, bval in unique_vals: f.write(" !byte %s,%s\n" % (aval, bval)) ripple_vals = util.ripple(unique_vals) with open("../../../src/fx/fx.hgr.butterfly.ripple.data.a", "w") as f: for aval, bval in ripple_vals: f.write(" !byte %s,%s\n" % (aval, bval)) unique_vals.reverse() with open("../../../src/fx/fx.hgr.butterfly.in.data.a", "w") as f: for aval, bval in unique_vals: f.write(" !byte %s,%s\n" % (aval, bval))
def f(t, k): t = float(t) r = k / cos(0.4 * acos(sin(2.5 * (t + pi / 2)))) return r * cos(t), r * sin(t) coords = [] for k_mul in range(500): for t_mul in range(int(pi * 1000 + 1)): a, b = f(float(t_mul / 100), float(k_mul) / 10.0) x = round(max_x // 2 + a * 1.2) y = round(max_y // 2 + b) if y % 2 != 0: continue if x < 0 or x >= max_x or y < 0 or y >= max_y: continue coords.append((x, y)) unique_coords = util.unique(coords) unique_vals = util.vals_1bit(unique_coords) util.write("../../../src/fx/fx.hgr.slow.star.data.a", unique_vals) unique_vals.reverse() util.write("../../../src/fx/fx.hgr.slow.star.in.data.a", unique_vals) mult_coords = util.ripple(util.radial_multiply(unique_coords)) util.write("../../../src/fx/fx.hgr.full.of.stars.data.a", util.vals_1bit(mult_coords))
def f(x,r=36.3): try: return math.sqrt(r*r*(1.0-(x*x/(r*r*0.6)))) except: return -1 coords = [] for i in range(30000, 0, -1): a = float(i)/1000.0 b = f(a) for x in range(140, 0, -1): y = round(float(x)*b/a) if x < 1 or x > radius_x or y < 1 or y > radius_y: continue for m in range(1, y+1): if m % 2 != 0: continue coords.append((radius_x - x,radius_y - m)) unique_coords = util.unique(coords) unique_vals = util.vals_1bit(unique_coords) util.write("../../../src/fx/fx.hgr.radial.data.a", unique_vals) util.write("../../../src/fx/fx.hgr.radial2.data.a", util.halfripple(unique_vals)) util.write("../../../src/fx/fx.hgr.radial4.data.a", util.ripple(unique_vals)) util.write("../../../src/fx/fx.hgr.radial5.data.a", util.ripple(util.halfripple(unique_vals))) mult_coords = util.ripple(util.radial_multiply(util.ripple(util.radial_multiply(util.ripple(util.radial_multiply(unique_coords)))))) util.write("../../../src/fx/fx.hgr.pinwheels.data.a", util.vals_1bit(mult_coords))
unique_coords = util.unique(coords) util.write("../../../src/fx/fx.shr.iris.data.a", unique_coords, header="""!cpu 6502 !to "build/FX/SHR.IRIS.DATA",plain *=$9F00 """, footer=""" !byte 128 """) unique_coords.reverse() util.write("../../../src/fx/fx.shr.iris.in.data.a", unique_coords, header="""!cpu 6502 !to "build/FX/SHR.IRISIN.DATA",plain *=$9F00 """, footer=""" !byte 128 """) unique_coords.reverse() util.write("../../../src/fx/fx.shr.ripple.data.a", util.ripple(unique_coords), header="""!cpu 6502 !to "build/FX/SHR.RIPPLE.DATA",plain *=$9F00 """, footer=""" !byte 128 """)
for i in range(1000000): any = False a, b = f(float(i)/10.0) x = round(radius_x+a) y = round(radius_y+b) if y % 2 != 0: continue if x < 0 or x >= radius_x or y < 0 or y >= radius_y: continue coords.append((x,y)) unique_coords = util.unique(coords) unique_vals = util.vals_1bit(unique_coords) util.write("../../../src/fx/fx.hgr.iris.data.a", unique_vals) util.write("../../../src/fx/fx.hgr.ripple.data.a", util.ripple(unique_vals)) unique_vals.reverse() util.write("../../../src/fx/fx.hgr.iris.in.data.a", unique_vals) corner4_coords = [(139-x,95-y) for (x,y) in unique_coords] corner4_vals = util.vals_1bit(corner4_coords) util.write("../../../src/fx/fx.hgr.corner4.in.data.a", corner4_vals) corner4_vals.reverse() util.write("../../../src/fx/fx.hgr.corner4.out.data.a", corner4_vals) util.write("../../../src/fx/fx.hgr.swirl.data.a", util.ripple(util.ripple(corner4_vals))) mult_coords = util.ripple(util.quadrant_multiply(util.ripple(util.quadrant_multiply(util.ripple(util.quadrant_multiply(unique_coords)))))) util.write("../../../src/fx/fx.hgr.bubbles.data.a", util.vals_1bit(mult_coords)) mult_coords.reverse() util.write("../../../src/fx/fx.hgr.bubbles.in.data.a", util.vals_1bit(mult_coords)) mult_coords = util.halfripple(util.ripple(util.radial_multiply(util.radial_multiply(unique_coords)))) util.write("../../../src/fx/fx.hgr.radbubbles.data.a", util.vals_1bit(mult_coords))
# Unfortunately, since bytes are 7 pixels across, some of the 2-pixel-wide # blocks will cross a byte boundary. To simplify the 6502 code, these are # simply listed as separate coordinate pairs, each with a bitmask that # includes 1 pixel instead of 2. frames = 1500 # last "thumbN.png" file coords = [] for i in range(5, frames, 5): p = PIL.Image.open("bolt/thumb%s.png" % i) for x in range(0, 280, 2): for y in range(0, 192, 3): if p.getpixel((x, 191 - y))[0] != 255: coords.append((x, y)) unique_coords = util.unique(coords) unique_vals = util.vals_3bit(unique_coords) with open("../../../src/fx/fx.hgr.bolt.data.a", "w") as f: for aval, bval in unique_vals: f.write(" !byte %s,%s\n" % (aval, bval)) ripple_vals = util.halfripple(util.ripple(unique_vals)) with open("../../../src/fx/fx.hgr.bolt.ripple.data.a", "w") as f: for aval, bval in ripple_vals: f.write(" !byte %s,%s\n" % (aval, bval)) unique_vals.reverse() with open("../../../src/fx/fx.hgr.bolt.in.data.a", "w") as f: for aval, bval in unique_vals: f.write(" !byte %s,%s\n" % (aval, bval))