summaryrefslogtreecommitdiffstats
path: root/generate_utils.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2022-10-02 17:24:18 -0700
committeryum <yum.food.vr@gmail.com>2022-10-02 17:24:18 -0700
commit21c17fcb5698ed238e5397a0c2b0530034804d34 (patch)
treede55ecc66fc09f8fb2c0ef8c498d1197dc71590a /generate_utils.py
parentac1e02241be1d7608e71163dd404f3bad4157a9d (diff)
Add 4th layer of indexing
* Double board size from 6x16 to 8x22 * Reduce parameter bits used (thanks to extra layer of indexing) * Rename template.anim to template.anim.txt to prevent Unity from constantly rewriting it * osc_ctrl.encodeMessage now pads the message so that all empty space is overwritten * Delete osc_ctrl.sendMessageCellContinuous. Now that we use a single 'Enable' bit, this idea is sidelined. * We can probably achieve the same effect by making TaSTT.shader a little more clever. For example, if we pass it the current cell number, it could render a time-based 'fade-in' effect which simulates smooth streaming.
Diffstat (limited to 'generate_utils.py')
-rw-r--r--generate_utils.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/generate_utils.py b/generate_utils.py
index 85d6298..a30b967 100644
--- a/generate_utils.py
+++ b/generate_utils.py
@@ -6,9 +6,12 @@ def replaceMacros(lines, macro_defs):
lines = lines.replace("%" + k + "%", v)
return lines
-BOARD_ROWS=6
-BOARD_COLS=16
-INDEX_BITS=3
+# Note, (BOARD_ROWS * BOARD_COLS % NUM_LAYERS) must equal 0. If not, writing to
+# the last cell will (with the current implementation) wrap around to the front
+# of the board.
+BOARD_ROWS=8
+BOARD_COLS=22
+INDEX_BITS=4
CHARS_PER_CELL=80
NUM_LAYERS=ceil((BOARD_ROWS * BOARD_COLS) / (2**INDEX_BITS))
@@ -44,17 +47,17 @@ def getSelectParam(which_layer, which_select):
def getEnableParam():
return "TaSTT_Enable"
-def getBoardIndex(which_layer, s0, s1, s2):
+def getBoardIndex(which_layer, s0, s1, s2, s3):
# Because we divide the board into a multiple of 8 cells, some cells may
# describe animations which don't exist, depending on the size of the board.
# We work around this by simply wrapping those animations back to the top
# of the board, and rely on the OSC controller to simply not reference
# those cells.
- return ((s0 * 4 + s1 * 2 + s2) * NUM_LAYERS + which_layer) % (BOARD_ROWS * BOARD_COLS)
+ return ((s0 * 8 + s1 * 4 + s2 * 2 + s3) * NUM_LAYERS + which_layer) % (BOARD_ROWS * BOARD_COLS)
# Mapping from layer to shader param.
-def getShaderParam(which_layer, s0, s1, s2):
- index = getBoardIndex(which_layer, s0, s1, s2)
+def getShaderParam(which_layer, s0, s1, s2, s3):
+ index = getBoardIndex(which_layer, s0, s1, s2, s3)
col = index % BOARD_COLS
row = floor(index / BOARD_COLS)