mirror of
https://github.com/a2-4am/4cade.git
synced 2025-08-13 13:25:11 +00:00
add soft iris effects
This commit is contained in:
@@ -1 +1 @@
|
||||
RIPPLE
|
||||
RIPPLE
|
83
res/notes/transitions/softiris.py
Executable file
83
res/notes/transitions/softiris.py
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from math import sqrt, sin, cos, acos, pi
|
||||
|
||||
# Graph is plotted across the entire HGR screen, but only coordinates
|
||||
# - in the left half of the screen, AND
|
||||
# - on even rows, AND
|
||||
# - on even columns
|
||||
# are included. It is assumed that the graph is symmetrical across
|
||||
# the left and half sides of the screen (along an axis at X=140).
|
||||
#
|
||||
# X coordinates are converted to byte+bitmask (but see notes below).
|
||||
# Y coordinates are incremented by 1 so that 0 can terminate the loop.
|
||||
#
|
||||
# 6502 code will be responsible for plotting each of these coordinates
|
||||
# in a 2x2 block. The bitmask usually includes 2 adjacent pixels;
|
||||
# the code will also plot the same 2 adjacent pixels in the adjacent row,
|
||||
# AND mirror both of those plots in the right half of the screen.
|
||||
#
|
||||
# Unfortunately, since bytes are 7 bits across, some blocks will cross a
|
||||
# byte boundary. To simplify the 6502 code, those are simply listed as
|
||||
# separate coordinate pairs, each with a bitmask that includes 1 pixel
|
||||
# instead of 2.
|
||||
|
||||
max_x = 280
|
||||
max_y = 192
|
||||
|
||||
def f(t, k, a):
|
||||
r = k/cos(0.4*acos(sin(2.5*(t+pi/2))))
|
||||
return r*cos(t+a),r*sin(t+a)
|
||||
|
||||
coords = []
|
||||
for k_mul in range(1000):
|
||||
a = float(k_mul*pi/1000)
|
||||
for t_mul in range(int(pi*1000+1)):
|
||||
a, b = f(float(t_mul/100), float(k_mul)/10.0, a)
|
||||
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))
|
||||
|
||||
d = {}
|
||||
unique_coords = []
|
||||
for c in coords:
|
||||
if not d.get(c):
|
||||
unique_coords.append(c)
|
||||
d[c] = 1
|
||||
|
||||
unique_vals = []
|
||||
even_byte_bitmask = (0, 0, 1, 1, 2, 2, 3)
|
||||
odd_byte_bitmask = (5, 5, 6, 6, 7, 7, 4)
|
||||
for x, y in unique_coords:
|
||||
y = y + 1
|
||||
aval = "$" + hex(y)[2:].rjust(2, "0").upper()
|
||||
byte = x//7
|
||||
if byte % 2 == 0:
|
||||
# high 3 bits are 0-3, low 5 bits are 0-39
|
||||
bval = "%" + bin(even_byte_bitmask[x % 7])[2:].rjust(3, "0") + bin(byte)[2:].rjust(5, "0")
|
||||
unique_vals.append((aval, bval))
|
||||
if x % 7 == 6:
|
||||
# this 2x2 block will be split across bytes, so add an extra coordinate pair with the adjacent byte and high 3 bits = 4
|
||||
bval = "%100" + bin(byte+1)[2:].rjust(5, "0") + ";"
|
||||
unique_vals.append((aval, bval))
|
||||
else:
|
||||
# high 3 bits are 5-7 or 4, low 5 bits are 0-39
|
||||
bval = "%" + bin(odd_byte_bitmask[x % 7])[2:].rjust(3, "0") + bin(byte)[2:].rjust(5, "0")
|
||||
unique_vals.append((aval, bval))
|
||||
if x % 7 == 6:
|
||||
# this 2x2 block will be split across bytes, so add an extra coordinate pair with the adjacent byte and high 3 bits = 3
|
||||
bval = "%011" + bin(byte+1)[2:].rjust(5, "0") + ";"
|
||||
unique_vals.append((aval, bval))
|
||||
|
||||
with open("../../../src/fx/fx.hgr.soft.iris.data.a", "w") as f:
|
||||
for aval, bval in unique_vals:
|
||||
f.write(" !byte %s,%s\n" % (aval, bval))
|
||||
|
||||
unique_vals.reverse()
|
||||
with open("../../../src/fx/fx.hgr.soft.iris.in.data.a", "w") as f:
|
||||
for aval, bval in unique_vals:
|
||||
f.write(" !byte %s,%s\n" % (aval, bval))
|
14
src/fx/fx.hgr.soft.iris.a
Normal file
14
src/fx/fx.hgr.soft.iris.a
Normal file
@@ -0,0 +1,14 @@
|
||||
;license:MIT
|
||||
;(c) 2019 by 4am
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX/SOFT.IRIS",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.hgr.precomputed.2bit.a"
|
||||
|
||||
+FX_PRECOMPUTED_2BIT Coordinates
|
||||
|
||||
Coordinates
|
||||
!source "src/fx/fx.hgr.soft.iris.data.a"
|
||||
!byte $00
|
7680
src/fx/fx.hgr.soft.iris.data.a
Normal file
7680
src/fx/fx.hgr.soft.iris.data.a
Normal file
File diff suppressed because it is too large
Load Diff
14
src/fx/fx.hgr.soft.iris.in.a
Normal file
14
src/fx/fx.hgr.soft.iris.in.a
Normal file
@@ -0,0 +1,14 @@
|
||||
;license:MIT
|
||||
;(c) 2019 by 4am
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX/SOFT.IRIS.IN",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.hgr.precomputed.2bit.a"
|
||||
|
||||
+FX_PRECOMPUTED_2BIT Coordinates
|
||||
|
||||
Coordinates
|
||||
!source "src/fx/fx.hgr.soft.iris.in.data.a"
|
||||
!byte $00
|
7680
src/fx/fx.hgr.soft.iris.in.data.a
Normal file
7680
src/fx/fx.hgr.soft.iris.in.data.a
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user