diff options
| author | yum <yum.food.vr@gmail.com> | 2022-10-02 17:24:18 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2022-10-02 17:24:18 -0700 |
| commit | 21c17fcb5698ed238e5397a0c2b0530034804d34 (patch) | |
| tree | de55ecc66fc09f8fb2c0ef8c498d1197dc71590a | |
| parent | ac1e02241be1d7608e71163dd404f3bad4157a9d (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.
| -rw-r--r-- | TaSTT.shader | 344 | ||||
| -rw-r--r-- | generate_animations.sh | 6 | ||||
| -rw-r--r-- | generate_fx.py | 116 | ||||
| -rw-r--r-- | generate_params.py | 3 | ||||
| -rw-r--r-- | generate_utils.py | 17 | ||||
| -rw-r--r-- | osc_ctrl.py | 93 | ||||
| -rw-r--r-- | template.anim.txt (renamed from template.anim) | 0 |
7 files changed, 454 insertions, 125 deletions
diff --git a/TaSTT.shader b/TaSTT.shader index 510db14..4a66361 100644 --- a/TaSTT.shader +++ b/TaSTT.shader @@ -20,6 +20,12 @@ _Letter_Row00_Col13("_Letter_Row00_Col13", float) = 0
_Letter_Row00_Col14("_Letter_Row00_Col14", float) = 0
_Letter_Row00_Col15("_Letter_Row00_Col15", float) = 0
+ _Letter_Row00_Col16("_Letter_Row00_Col16", float) = 0
+ _Letter_Row00_Col17("_Letter_Row00_Col17", float) = 0
+ _Letter_Row00_Col18("_Letter_Row00_Col18", float) = 0
+ _Letter_Row00_Col19("_Letter_Row00_Col19", float) = 0
+ _Letter_Row00_Col20("_Letter_Row00_Col20", float) = 0
+ _Letter_Row00_Col21("_Letter_Row00_Col21", float) = 0
_Letter_Row01_Col00("_Letter_Row01_Col00", float) = 0
_Letter_Row01_Col01("_Letter_Row01_Col01", float) = 0
_Letter_Row01_Col02("_Letter_Row01_Col02", float) = 0
@@ -36,6 +42,12 @@ _Letter_Row01_Col13("_Letter_Row01_Col13", float) = 0
_Letter_Row01_Col14("_Letter_Row01_Col14", float) = 0
_Letter_Row01_Col15("_Letter_Row01_Col15", float) = 0
+ _Letter_Row01_Col16("_Letter_Row01_Col16", float) = 0
+ _Letter_Row01_Col17("_Letter_Row01_Col17", float) = 0
+ _Letter_Row01_Col18("_Letter_Row01_Col18", float) = 0
+ _Letter_Row01_Col19("_Letter_Row01_Col19", float) = 0
+ _Letter_Row01_Col20("_Letter_Row01_Col20", float) = 0
+ _Letter_Row01_Col21("_Letter_Row01_Col21", float) = 0
_Letter_Row02_Col00("_Letter_Row02_Col00", float) = 0
_Letter_Row02_Col01("_Letter_Row02_Col01", float) = 0
_Letter_Row02_Col02("_Letter_Row02_Col02", float) = 0
@@ -52,6 +64,12 @@ _Letter_Row02_Col13("_Letter_Row02_Col13", float) = 0
_Letter_Row02_Col14("_Letter_Row02_Col14", float) = 0
_Letter_Row02_Col15("_Letter_Row02_Col15", float) = 0
+ _Letter_Row02_Col16("_Letter_Row02_Col16", float) = 0
+ _Letter_Row02_Col17("_Letter_Row02_Col17", float) = 0
+ _Letter_Row02_Col18("_Letter_Row02_Col18", float) = 0
+ _Letter_Row02_Col19("_Letter_Row02_Col19", float) = 0
+ _Letter_Row02_Col20("_Letter_Row02_Col20", float) = 0
+ _Letter_Row02_Col21("_Letter_Row02_Col21", float) = 0
_Letter_Row03_Col00("_Letter_Row03_Col00", float) = 0
_Letter_Row03_Col01("_Letter_Row03_Col01", float) = 0
_Letter_Row03_Col02("_Letter_Row03_Col02", float) = 0
@@ -68,6 +86,12 @@ _Letter_Row03_Col13("_Letter_Row03_Col13", float) = 0
_Letter_Row03_Col14("_Letter_Row03_Col14", float) = 0
_Letter_Row03_Col15("_Letter_Row03_Col15", float) = 0
+ _Letter_Row03_Col16("_Letter_Row03_Col16", float) = 0
+ _Letter_Row03_Col17("_Letter_Row03_Col17", float) = 0
+ _Letter_Row03_Col18("_Letter_Row03_Col18", float) = 0
+ _Letter_Row03_Col19("_Letter_Row03_Col19", float) = 0
+ _Letter_Row03_Col20("_Letter_Row03_Col20", float) = 0
+ _Letter_Row03_Col21("_Letter_Row03_Col21", float) = 0
_Letter_Row04_Col00("_Letter_Row04_Col00", float) = 0
_Letter_Row04_Col01("_Letter_Row04_Col01", float) = 0
_Letter_Row04_Col02("_Letter_Row04_Col02", float) = 0
@@ -84,6 +108,12 @@ _Letter_Row04_Col13("_Letter_Row04_Col13", float) = 0
_Letter_Row04_Col14("_Letter_Row04_Col14", float) = 0
_Letter_Row04_Col15("_Letter_Row04_Col15", float) = 0
+ _Letter_Row04_Col16("_Letter_Row04_Col16", float) = 0
+ _Letter_Row04_Col17("_Letter_Row04_Col17", float) = 0
+ _Letter_Row04_Col18("_Letter_Row04_Col18", float) = 0
+ _Letter_Row04_Col19("_Letter_Row04_Col19", float) = 0
+ _Letter_Row04_Col20("_Letter_Row04_Col20", float) = 0
+ _Letter_Row04_Col21("_Letter_Row04_Col21", float) = 0
_Letter_Row05_Col00("_Letter_Row05_Col00", float) = 0
_Letter_Row05_Col01("_Letter_Row05_Col01", float) = 0
_Letter_Row05_Col02("_Letter_Row05_Col02", float) = 0
@@ -100,6 +130,56 @@ _Letter_Row05_Col13("_Letter_Row05_Col13", float) = 0
_Letter_Row05_Col14("_Letter_Row05_Col14", float) = 0
_Letter_Row05_Col15("_Letter_Row05_Col15", float) = 0
+ _Letter_Row05_Col16("_Letter_Row05_Col16", float) = 0
+ _Letter_Row05_Col17("_Letter_Row05_Col17", float) = 0
+ _Letter_Row05_Col18("_Letter_Row05_Col18", float) = 0
+ _Letter_Row05_Col19("_Letter_Row05_Col19", float) = 0
+ _Letter_Row05_Col20("_Letter_Row05_Col20", float) = 0
+ _Letter_Row05_Col21("_Letter_Row05_Col21", float) = 0
+ _Letter_Row06_Col00("_Letter_Row06_Col00", float) = 0
+ _Letter_Row06_Col01("_Letter_Row06_Col01", float) = 0
+ _Letter_Row06_Col02("_Letter_Row06_Col02", float) = 0
+ _Letter_Row06_Col03("_Letter_Row06_Col03", float) = 0
+ _Letter_Row06_Col04("_Letter_Row06_Col04", float) = 0
+ _Letter_Row06_Col05("_Letter_Row06_Col05", float) = 0
+ _Letter_Row06_Col06("_Letter_Row06_Col06", float) = 0
+ _Letter_Row06_Col07("_Letter_Row06_Col07", float) = 0
+ _Letter_Row06_Col08("_Letter_Row06_Col08", float) = 0
+ _Letter_Row06_Col09("_Letter_Row06_Col09", float) = 0
+ _Letter_Row06_Col10("_Letter_Row06_Col10", float) = 0
+ _Letter_Row06_Col11("_Letter_Row06_Col11", float) = 0
+ _Letter_Row06_Col12("_Letter_Row06_Col12", float) = 0
+ _Letter_Row06_Col13("_Letter_Row06_Col13", float) = 0
+ _Letter_Row06_Col14("_Letter_Row06_Col14", float) = 0
+ _Letter_Row06_Col15("_Letter_Row06_Col15", float) = 0
+ _Letter_Row06_Col16("_Letter_Row06_Col16", float) = 0
+ _Letter_Row06_Col17("_Letter_Row06_Col17", float) = 0
+ _Letter_Row06_Col18("_Letter_Row06_Col18", float) = 0
+ _Letter_Row06_Col19("_Letter_Row06_Col19", float) = 0
+ _Letter_Row06_Col20("_Letter_Row06_Col20", float) = 0
+ _Letter_Row06_Col21("_Letter_Row06_Col21", float) = 0
+ _Letter_Row07_Col00("_Letter_Row07_Col00", float) = 0
+ _Letter_Row07_Col01("_Letter_Row07_Col01", float) = 0
+ _Letter_Row07_Col02("_Letter_Row07_Col02", float) = 0
+ _Letter_Row07_Col03("_Letter_Row07_Col03", float) = 0
+ _Letter_Row07_Col04("_Letter_Row07_Col04", float) = 0
+ _Letter_Row07_Col05("_Letter_Row07_Col05", float) = 0
+ _Letter_Row07_Col06("_Letter_Row07_Col06", float) = 0
+ _Letter_Row07_Col07("_Letter_Row07_Col07", float) = 0
+ _Letter_Row07_Col08("_Letter_Row07_Col08", float) = 0
+ _Letter_Row07_Col09("_Letter_Row07_Col09", float) = 0
+ _Letter_Row07_Col10("_Letter_Row07_Col10", float) = 0
+ _Letter_Row07_Col11("_Letter_Row07_Col11", float) = 0
+ _Letter_Row07_Col12("_Letter_Row07_Col12", float) = 0
+ _Letter_Row07_Col13("_Letter_Row07_Col13", float) = 0
+ _Letter_Row07_Col14("_Letter_Row07_Col14", float) = 0
+ _Letter_Row07_Col15("_Letter_Row07_Col15", float) = 0
+ _Letter_Row07_Col16("_Letter_Row07_Col16", float) = 0
+ _Letter_Row07_Col17("_Letter_Row07_Col17", float) = 0
+ _Letter_Row07_Col18("_Letter_Row07_Col18", float) = 0
+ _Letter_Row07_Col19("_Letter_Row07_Col19", float) = 0
+ _Letter_Row07_Col20("_Letter_Row07_Col20", float) = 0
+ _Letter_Row07_Col21("_Letter_Row07_Col21", float) = 0
// This does nothing, it's just used by the 'Do Nothing' animation.
_Dummy("_Dummy", float) = 0
}
@@ -151,6 +231,12 @@ float _Letter_Row00_Col13;
float _Letter_Row00_Col14;
float _Letter_Row00_Col15;
+ float _Letter_Row00_Col16;
+ float _Letter_Row00_Col17;
+ float _Letter_Row00_Col18;
+ float _Letter_Row00_Col19;
+ float _Letter_Row00_Col20;
+ float _Letter_Row00_Col21;
float _Letter_Row01_Col00;
float _Letter_Row01_Col01;
float _Letter_Row01_Col02;
@@ -167,6 +253,12 @@ float _Letter_Row01_Col13;
float _Letter_Row01_Col14;
float _Letter_Row01_Col15;
+ float _Letter_Row01_Col16;
+ float _Letter_Row01_Col17;
+ float _Letter_Row01_Col18;
+ float _Letter_Row01_Col19;
+ float _Letter_Row01_Col20;
+ float _Letter_Row01_Col21;
float _Letter_Row02_Col00;
float _Letter_Row02_Col01;
float _Letter_Row02_Col02;
@@ -183,6 +275,12 @@ float _Letter_Row02_Col13;
float _Letter_Row02_Col14;
float _Letter_Row02_Col15;
+ float _Letter_Row02_Col16;
+ float _Letter_Row02_Col17;
+ float _Letter_Row02_Col18;
+ float _Letter_Row02_Col19;
+ float _Letter_Row02_Col20;
+ float _Letter_Row02_Col21;
float _Letter_Row03_Col00;
float _Letter_Row03_Col01;
float _Letter_Row03_Col02;
@@ -199,6 +297,12 @@ float _Letter_Row03_Col13;
float _Letter_Row03_Col14;
float _Letter_Row03_Col15;
+ float _Letter_Row03_Col16;
+ float _Letter_Row03_Col17;
+ float _Letter_Row03_Col18;
+ float _Letter_Row03_Col19;
+ float _Letter_Row03_Col20;
+ float _Letter_Row03_Col21;
float _Letter_Row04_Col00;
float _Letter_Row04_Col01;
float _Letter_Row04_Col02;
@@ -215,6 +319,12 @@ float _Letter_Row04_Col13;
float _Letter_Row04_Col14;
float _Letter_Row04_Col15;
+ float _Letter_Row04_Col16;
+ float _Letter_Row04_Col17;
+ float _Letter_Row04_Col18;
+ float _Letter_Row04_Col19;
+ float _Letter_Row04_Col20;
+ float _Letter_Row04_Col21;
float _Letter_Row05_Col00;
float _Letter_Row05_Col01;
float _Letter_Row05_Col02;
@@ -231,6 +341,56 @@ float _Letter_Row05_Col13;
float _Letter_Row05_Col14;
float _Letter_Row05_Col15;
+ float _Letter_Row05_Col16;
+ float _Letter_Row05_Col17;
+ float _Letter_Row05_Col18;
+ float _Letter_Row05_Col19;
+ float _Letter_Row05_Col20;
+ float _Letter_Row05_Col21;
+ float _Letter_Row06_Col00;
+ float _Letter_Row06_Col01;
+ float _Letter_Row06_Col02;
+ float _Letter_Row06_Col03;
+ float _Letter_Row06_Col04;
+ float _Letter_Row06_Col05;
+ float _Letter_Row06_Col06;
+ float _Letter_Row06_Col07;
+ float _Letter_Row06_Col08;
+ float _Letter_Row06_Col09;
+ float _Letter_Row06_Col10;
+ float _Letter_Row06_Col11;
+ float _Letter_Row06_Col12;
+ float _Letter_Row06_Col13;
+ float _Letter_Row06_Col14;
+ float _Letter_Row06_Col15;
+ float _Letter_Row06_Col16;
+ float _Letter_Row06_Col17;
+ float _Letter_Row06_Col18;
+ float _Letter_Row06_Col19;
+ float _Letter_Row06_Col20;
+ float _Letter_Row06_Col21;
+ float _Letter_Row07_Col00;
+ float _Letter_Row07_Col01;
+ float _Letter_Row07_Col02;
+ float _Letter_Row07_Col03;
+ float _Letter_Row07_Col04;
+ float _Letter_Row07_Col05;
+ float _Letter_Row07_Col06;
+ float _Letter_Row07_Col07;
+ float _Letter_Row07_Col08;
+ float _Letter_Row07_Col09;
+ float _Letter_Row07_Col10;
+ float _Letter_Row07_Col11;
+ float _Letter_Row07_Col12;
+ float _Letter_Row07_Col13;
+ float _Letter_Row07_Col14;
+ float _Letter_Row07_Col15;
+ float _Letter_Row07_Col16;
+ float _Letter_Row07_Col17;
+ float _Letter_Row07_Col18;
+ float _Letter_Row07_Col19;
+ float _Letter_Row07_Col20;
+ float _Letter_Row07_Col21;
v2f vert (appdata v)
{
@@ -250,8 +410,8 @@ //
// I want to divide the mesh into an m x n grid.
// I want to know what grid cell I'm in. This is simply u * m, v * n.
- int CHAR_ROWS = 6;
- int CHAR_COLS = 16;
+ int CHAR_ROWS = 8;
+ int CHAR_COLS = 22;
// OK, I know what cell I'm in. Now I need to know how far across it I
// am. Produce a float in the range [0, CHAR_COLS).
@@ -278,13 +438,13 @@ // Get the value of the parameter for the cell we're in.
float GetLetterParameter(v2f i)
{
- float CHAR_ROWS = 6.0;
- float CHAR_COLS = 16.0;
+ float CHAR_ROWS = 8.0;
+ float CHAR_COLS = 22.0;
float CHAR_COL = floor(i.uv.x * CHAR_COLS);
float CHAR_ROW = floor(i.uv.y * CHAR_ROWS);
// ok now this is epic
- if (CHAR_ROW == 5) {
+ if (CHAR_ROW == 7) {
if (CHAR_COL == 0) {
return _Letter_Row00_Col00;
} else if (CHAR_COL == 1) {
@@ -317,8 +477,20 @@ return _Letter_Row00_Col14;
} else if (CHAR_COL == 15) {
return _Letter_Row00_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row00_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row00_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row00_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row00_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row00_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row00_Col21;
}
- } else if (CHAR_ROW == 4) {
+ } else if (CHAR_ROW == 6) {
if (CHAR_COL == 0) {
return _Letter_Row01_Col00;
} else if (CHAR_COL == 1) {
@@ -351,8 +523,20 @@ return _Letter_Row01_Col14;
} else if (CHAR_COL == 15) {
return _Letter_Row01_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row01_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row01_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row01_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row01_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row01_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row01_Col21;
}
- } else if (CHAR_ROW == 3) {
+ } else if (CHAR_ROW == 5) {
if (CHAR_COL == 0) {
return _Letter_Row02_Col00;
} else if (CHAR_COL == 1) {
@@ -385,8 +569,20 @@ return _Letter_Row02_Col14;
} else if (CHAR_COL == 15) {
return _Letter_Row02_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row02_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row02_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row02_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row02_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row02_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row02_Col21;
}
- } else if (CHAR_ROW == 2) {
+ } else if (CHAR_ROW == 4) {
if (CHAR_COL == 0) {
return _Letter_Row03_Col00;
} else if (CHAR_COL == 1) {
@@ -419,8 +615,20 @@ return _Letter_Row03_Col14;
} else if (CHAR_COL == 15) {
return _Letter_Row03_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row03_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row03_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row03_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row03_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row03_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row03_Col21;
}
- } else if (CHAR_ROW == 1) {
+ } else if (CHAR_ROW == 3) {
if (CHAR_COL == 0) {
return _Letter_Row04_Col00;
} else if (CHAR_COL == 1) {
@@ -453,8 +661,20 @@ return _Letter_Row04_Col14;
} else if (CHAR_COL == 15) {
return _Letter_Row04_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row04_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row04_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row04_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row04_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row04_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row04_Col21;
}
- } else if (CHAR_ROW == 0) {
+ } else if (CHAR_ROW == 2) {
if (CHAR_COL == 0) {
return _Letter_Row05_Col00;
} else if (CHAR_COL == 1) {
@@ -487,6 +707,110 @@ return _Letter_Row05_Col14;
} else if (CHAR_COL == 15) {
return _Letter_Row05_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row05_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row05_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row05_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row05_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row05_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row05_Col21;
+ }
+ } else if (CHAR_ROW == 1) {
+ if (CHAR_COL == 0) {
+ return _Letter_Row06_Col00;
+ } else if (CHAR_COL == 1) {
+ return _Letter_Row06_Col01;
+ } else if (CHAR_COL == 2) {
+ return _Letter_Row06_Col02;
+ } else if (CHAR_COL == 3) {
+ return _Letter_Row06_Col03;
+ } else if (CHAR_COL == 4) {
+ return _Letter_Row06_Col04;
+ } else if (CHAR_COL == 5) {
+ return _Letter_Row06_Col05;
+ } else if (CHAR_COL == 6) {
+ return _Letter_Row06_Col06;
+ } else if (CHAR_COL == 7) {
+ return _Letter_Row06_Col07;
+ } else if (CHAR_COL == 8) {
+ return _Letter_Row06_Col08;
+ } else if (CHAR_COL == 9) {
+ return _Letter_Row06_Col09;
+ } else if (CHAR_COL == 10) {
+ return _Letter_Row06_Col10;
+ } else if (CHAR_COL == 11) {
+ return _Letter_Row06_Col11;
+ } else if (CHAR_COL == 12) {
+ return _Letter_Row06_Col12;
+ } else if (CHAR_COL == 13) {
+ return _Letter_Row06_Col13;
+ } else if (CHAR_COL == 14) {
+ return _Letter_Row06_Col14;
+ } else if (CHAR_COL == 15) {
+ return _Letter_Row06_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row06_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row06_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row06_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row06_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row06_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row06_Col21;
+ }
+ } else if (CHAR_ROW == 0) {
+ if (CHAR_COL == 0) {
+ return _Letter_Row07_Col00;
+ } else if (CHAR_COL == 1) {
+ return _Letter_Row07_Col01;
+ } else if (CHAR_COL == 2) {
+ return _Letter_Row07_Col02;
+ } else if (CHAR_COL == 3) {
+ return _Letter_Row07_Col03;
+ } else if (CHAR_COL == 4) {
+ return _Letter_Row07_Col04;
+ } else if (CHAR_COL == 5) {
+ return _Letter_Row07_Col05;
+ } else if (CHAR_COL == 6) {
+ return _Letter_Row07_Col06;
+ } else if (CHAR_COL == 7) {
+ return _Letter_Row07_Col07;
+ } else if (CHAR_COL == 8) {
+ return _Letter_Row07_Col08;
+ } else if (CHAR_COL == 9) {
+ return _Letter_Row07_Col09;
+ } else if (CHAR_COL == 10) {
+ return _Letter_Row07_Col10;
+ } else if (CHAR_COL == 11) {
+ return _Letter_Row07_Col11;
+ } else if (CHAR_COL == 12) {
+ return _Letter_Row07_Col12;
+ } else if (CHAR_COL == 13) {
+ return _Letter_Row07_Col13;
+ } else if (CHAR_COL == 14) {
+ return _Letter_Row07_Col14;
+ } else if (CHAR_COL == 15) {
+ return _Letter_Row07_Col15;
+ } else if (CHAR_COL == 16) {
+ return _Letter_Row07_Col16;
+ } else if (CHAR_COL == 17) {
+ return _Letter_Row07_Col17;
+ } else if (CHAR_COL == 18) {
+ return _Letter_Row07_Col18;
+ } else if (CHAR_COL == 19) {
+ return _Letter_Row07_Col19;
+ } else if (CHAR_COL == 20) {
+ return _Letter_Row07_Col20;
+ } else if (CHAR_COL == 21) {
+ return _Letter_Row07_Col21;
}
}
diff --git a/generate_animations.sh b/generate_animations.sh index ce367f6..4e5ea84 100644 --- a/generate_animations.sh +++ b/generate_animations.sh @@ -11,16 +11,16 @@ set -o pipefail [ -d generated/animations ] && rm -rf generated || true mkdir -p generated/animations -for row in `seq 0 5`; do +for row in `seq 0 7`; do ROW_PADDED=$(printf '%02d' $row) - for col in `seq 0 16`; do + for col in `seq 0 21`; do COL_PADDED=$(printf '%02d' $col) LETTER_SHADER_PARAM=_Letter_Row${ROW_PADDED}_Col${COL_PADDED} for letter in `seq 0 79`; do LETTER_PADDED=$(printf '%02d' $letter) ANIM_NAME=${LETTER_SHADER_PARAM}_Letter${LETTER_PADDED} FILENAME=generated/animations/${ANIM_NAME}.anim - cat template.anim | \ + cat template.anim.txt | \ sed \ -e "s/%LETTER_VALUE%/$letter/g" \ -e "s/%LETTER_SHADER_PARAM%/$LETTER_SHADER_PARAM/g" \ diff --git a/generate_fx.py b/generate_fx.py index 0075de6..551524a 100644 --- a/generate_fx.py +++ b/generate_fx.py @@ -149,6 +149,9 @@ def genAnimator(state): params["ANIMATOR_PARAMETER_NAME"] = getSelectParam(i, 2) print(replaceMacros(ANIMATOR_PARAMETER_BOOL, params)) + params["ANIMATOR_PARAMETER_NAME"] = getSelectParam(i, 3) + print(replaceMacros(ANIMATOR_PARAMETER_BOOL, params)) + print(replaceMacros(ANIMATOR_LAYER_HEADER, params)) @@ -487,14 +490,17 @@ def getS1StateName(which_layer, s0, s1): def getS2StateName(which_layer, s0, s1, s2): return "TaSTT_L%02d_S%02d_S%02d_S%02d" % (which_layer, s0, s1, s2) -def getLetterStateName(which_layer, s0, s1, s2, letter): - return "TaSTT_L%02d_S%02d_S%02d_S%02d_L%03d" % (which_layer, s0, s1, s2, letter) +def getS3StateName(which_layer, s0, s1, s2, s3): + return "TaSTT_L%02d_S%02d_S%02d_S%02d_S%02d" % (which_layer, s0, s1, s2, s3) + +def getLetterStateName(which_layer, s0, s1, s2, s3, letter): + return "TaSTT_L%02d_S%02d_S%02d_S%02d_S%02d_L%03d" % (which_layer, s0, s1, s2, s3, letter) def getResizeStateName(e0, e1): return "TaSTT_Resize_E%d_E%d" % (e0, e1) -def getReturnHomeTransitionName(which_layer, s0, s1, s2, letter): - return "TASTT_RETURN_HOME_TRANSITION_L%02d_S%02d_S%02d_S%02d_L%03d" % (which_layer, s0, s1, s2, letter) +def getReturnHomeTransitionName(which_layer, s0, s1, s2, s3, letter): + return "TASTT_RETURN_HOME_TRANSITION_L%02d_S%02d_S%02d_S%02d_S%02d_L%03d" % (which_layer, s0, s1, s2, s3, letter) def getReturnHomeTransitionNameResizeLayer(e0, e1): return "TASTT_RETURN_HOME_TRANSITION_E%d_E%d" % (e0, e1) @@ -586,52 +592,80 @@ def genTasttLayer(state, which_layer): for s2 in range(0,2): params["TASTT_STATE_U2"] = params[getS2StateName(which_layer, s0, s1, s2) + "_U2"] params["TASTT_STATE_NAME"] = getS2StateName(which_layer, s0, s1, s2) - print(replaceMacros(TASTT_NARY_STATE_HEADER, params)) - for letter in range(0, CHARS_PER_CELL): - params[getLetterStateName(which_layer, s0, s1, s2, letter) + "_TRANSITION_U2"] = get_u2("1101", state) - params["TASTT_STATE_TRANSITION_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, letter) + "_TRANSITION_U2"] - print(replaceMacros(TASTT_NARY_STATE_HEADER_TRANSITION, params)) - print(replaceMacros(TASTT_NARY_STATE_FOOTER, params)) + params[getS3StateName(which_layer, s0, s1, s2, 0) + "_TRANSITION_U2"] = get_u2("1101", state) + params["TASTT_STATE_TRANSITION_0_U2"] = params[getS3StateName(which_layer, s0, s1, s2, 0) + "_TRANSITION_U2"] + params[getS3StateName(which_layer, s0, s1, s2, 1) + "_TRANSITION_U2"] = get_u2("1101", state) + params["TASTT_STATE_TRANSITION_1_U2"] = params[getS3StateName(which_layer, s0, s1, s2, 1) + "_TRANSITION_U2"] + print(replaceMacros(TASTT_BINARY_STATE, params)) + + # S3 state transition. + for s0 in range(0,2): + for s1 in range(0,2): + for s2 in range(0,2): + for s3 in range(0,2): + params["TASTT_STATE_TRANSITION_U2"] = params[getS3StateName(which_layer, s0, s1, s2, s3) + "_TRANSITION_U2"] + params["BOOL_PARAM"] = getSelectParam(which_layer, 3) + params["THRESHOLD"] = str(s3) + params["MODE"] = str(2 - s3) # See comment above TASTT_BOOL_STATE_UNARY_TRANSITION. + params[getS3StateName(which_layer, s0, s1, s2, s3) + "_U2"] = get_u2("1102", state) + params["DST_STATE_U2"] = params[getS3StateName(which_layer, s0, s1, s2, s3) + "_U2"] + print(replaceMacros(TASTT_BOOL_STATE_UNARY_TRANSITION, params)) + + # S3 state. + for s0 in range(0,2): + for s1 in range(0,2): + for s2 in range(0,2): + for s3 in range(0,2): + params["TASTT_STATE_U2"] = params[getS3StateName(which_layer, s0, s1, s2, s3) + "_U2"] + params["TASTT_STATE_NAME"] = getS3StateName(which_layer, s0, s1, s2, s3) + print(replaceMacros(TASTT_NARY_STATE_HEADER, params)) + for letter in range(0, CHARS_PER_CELL): + params[getLetterStateName(which_layer, s0, s1, s2, s3, letter) + "_TRANSITION_U2"] = get_u2("1101", state) + params["TASTT_STATE_TRANSITION_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, s3, letter) + "_TRANSITION_U2"] + print(replaceMacros(TASTT_NARY_STATE_HEADER_TRANSITION, params)) + print(replaceMacros(TASTT_NARY_STATE_FOOTER, params)) # Letter state transition. for s0 in range(0,2): for s1 in range(0,2): for s2 in range(0,2): - for letter in range(0, CHARS_PER_CELL): - params["TASTT_STATE_TRANSITION_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, letter) + "_TRANSITION_U2"] - params["INT_PARAM"] = getLayerParam(which_layer) - params["TRANSITION_THRESHOLD"] = str(letter) - params[getLetterStateName(which_layer, s0, s1, s2, letter) + "_U2"] = get_u2("1102", state) - params["DST_STATE_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, letter) + "_U2"] - print(replaceMacros(TASTT_INT_STATE_TRANSITION, params)) + for s3 in range(0,2): + for letter in range(0, CHARS_PER_CELL): + params["TASTT_STATE_TRANSITION_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, s3, letter) + "_TRANSITION_U2"] + params["INT_PARAM"] = getLayerParam(which_layer) + params["TRANSITION_THRESHOLD"] = str(letter) + params[getLetterStateName(which_layer, s0, s1, s2, s3, letter) + "_U2"] = get_u2("1102", state) + params["DST_STATE_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, s3, letter) + "_U2"] + print(replaceMacros(TASTT_INT_STATE_TRANSITION, params)) # Letter state. for s0 in range(0,2): for s1 in range(0,2): for s2 in range(0,2): - for letter in range(0, CHARS_PER_CELL): - params["TASTT_STATE_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, letter) + "_U2"] - params["TASTT_STATE_NAME"] = getLetterStateName(which_layer, s0, s1, s2, letter) - transition_name = getReturnHomeTransitionName(which_layer, s0, s1, s2, letter) + "_U2" - params[transition_name] = get_u2("1101", state) - params["TASTT_STATE_TRANSITION_U2"] = params[transition_name] - anim_meta_filename = getAnimationPath(getShaderParam(which_layer, s0, s1, s2), letter) + ".meta" - params["TASTT_ANIM_GUID"] = getAnimationGuid(anim_meta_filename) - print(replaceMacros(TASTT_ANIM_STATE, params)) + for s3 in range(0,2): + for letter in range(0, CHARS_PER_CELL): + params["TASTT_STATE_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, s3, letter) + "_U2"] + params["TASTT_STATE_NAME"] = getLetterStateName(which_layer, s0, s1, s2, s3, letter) + transition_name = getReturnHomeTransitionName(which_layer, s0, s1, s2, s3, letter) + "_U2" + params[transition_name] = get_u2("1101", state) + params["TASTT_STATE_TRANSITION_U2"] = params[transition_name] + anim_meta_filename = getAnimationPath(getShaderParam(which_layer, s0, s1, s2, s3), letter) + ".meta" + params["TASTT_ANIM_GUID"] = getAnimationGuid(anim_meta_filename) + print(replaceMacros(TASTT_ANIM_STATE, params)) # Return-home transitions. for s0 in range(0,2): for s1 in range(0,2): for s2 in range(0,2): - for letter in range(0, CHARS_PER_CELL): - transition_name = getReturnHomeTransitionName(which_layer, s0, s1, s2, letter) + "_U2" - params["TASTT_STATE_TRANSITION_U2"] = params[transition_name] - params["BOOL_PARAM"] = getDummyParam() - params["THRESHOLD"] = str(0) - params["MODE"] = str(2) # See comment above TASTT_BOOL_STATE_UNARY_TRANSITION. - params["DST_STATE_U2"] = params["TASTT_DEFAULT_STATE_U2"] - print(replaceMacros(TASTT_BOOL_STATE_UNARY_TRANSITION, params)) - + for s3 in range(0,2): + for letter in range(0, CHARS_PER_CELL): + transition_name = getReturnHomeTransitionName(which_layer, s0, s1, s2, s3, letter) + "_U2" + params["TASTT_STATE_TRANSITION_U2"] = params[transition_name] + params["BOOL_PARAM"] = getDummyParam() + params["THRESHOLD"] = str(0) + params["MODE"] = str(2) # See comment above TASTT_BOOL_STATE_UNARY_TRANSITION. + params["DST_STATE_U2"] = params["TASTT_DEFAULT_STATE_U2"] + print(replaceMacros(TASTT_BOOL_STATE_UNARY_TRANSITION, params)) # TaSTT layer. params["TASTT_LAYER_U2"] = params[getLayerParam(which_layer) + "_LAYER_U2"] @@ -663,10 +697,18 @@ def genTasttLayer(state, which_layer): for s0 in range(0,2): for s1 in range(0,2): for s2 in range(0,2): - for letter in range(0, CHARS_PER_CELL): - params["TASTT_STATE_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, letter) + "_U2"] + for s3 in range(0,2): + params["TASTT_STATE_U2"] = params[getS3StateName(which_layer, s0, s1, s2, s3) + "_U2"] print(replaceMacros(TASTT_LAYER_HEADER_CHILD_STATE, params)) + for s0 in range(0,2): + for s1 in range(0,2): + for s2 in range(0,2): + for s3 in range(0,2): + for letter in range(0, CHARS_PER_CELL): + params["TASTT_STATE_U2"] = params[getLetterStateName(which_layer, s0, s1, s2, s3, letter) + "_U2"] + print(replaceMacros(TASTT_LAYER_HEADER_CHILD_STATE, params)) + params["TASTT_DEFAULT_STATE_U2"] = params["TASTT_DEFAULT_STATE_U2"] print(replaceMacros(TASTT_LAYER_FOOTER, params)) diff --git a/generate_params.py b/generate_params.py index 0da8cdf..2bede87 100644 --- a/generate_params.py +++ b/generate_params.py @@ -66,3 +66,6 @@ for i in range(0, generate_utils.NUM_LAYERS): params["PARAM_NAME"] = generate_utils.getSelectParam(i, 2) print(generate_utils.replaceMacros(BOOL_PARAM, params)) + + params["PARAM_NAME"] = generate_utils.getSelectParam(i, 3) + print(generate_utils.replaceMacros(BOOL_PARAM, params)) 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) diff --git a/osc_ctrl.py b/osc_ctrl.py index 221333e..6f4ac65 100644 --- a/osc_ctrl.py +++ b/osc_ctrl.py @@ -19,7 +19,7 @@ from generate_utils import BOARD_COLS #CELL_TX_TIME_S=3.0 #CELL_TX_TIME_S=1.0 -CELL_TX_TIME_S=0.3 +CELL_TX_TIME_S=0.1 def usage(): print("python3 -m pip install python-osc") @@ -55,17 +55,24 @@ def generateEncoding(state): state.encoding['_'] = 70 state.encoding["'"] = 71 state.encoding['"'] = 72 +generateEncoding(state) +# Encodes a list of lines into the character set used by the board. +# Pads lines with spaces and adds lines so that the total number of +# lines sent is a multiple of the number of rows in the board. def encodeMessage(lines): result = [] + # Pad the number of lines up to a multiple of BOARD_ROWS. + print("Pad {} lines".format(BOARD_ROWS - (len(lines) % BOARD_ROWS))) + lines += [" "] * ((BOARD_ROWS - len(lines)) % BOARD_ROWS) for line in lines: + print("encode line {}".format(line)) for char in line: result.append(state.encoding[char]) result += [state.encoding[' ']] * (BOARD_COLS - len(line)) - #print("Encoded message: {}".format(result)) return result -def updateCell(cell_idx, letter_encoded, s0, s1, s2): +def updateCell(cell_idx, letter_encoded, s0, s1, s2, s3): addr="/avatar/parameters/" + getLayerParam(cell_idx) client.send_message(addr, letter_encoded) @@ -78,6 +85,9 @@ def updateCell(cell_idx, letter_encoded, s0, s1, s2): addr="/avatar/parameters/" + getSelectParam(cell_idx, 2) client.send_message(addr, s2) + addr="/avatar/parameters/" + getSelectParam(cell_idx, 3) + client.send_message(addr, s3) + def enable(): addr="/avatar/parameters/" + getEnableParam() client.send_message(addr, True) @@ -87,7 +97,7 @@ def disable(): client.send_message(addr, False) # Send a cell all at once. -# `which_cell` is an integer in the range [0,8). +# `which_cell` is an integer in the range [0,2**INDEX_BITS). def sendMessageCellDiscrete(msg_cell, which_cell): # Disable each layer. disable() @@ -95,16 +105,17 @@ def sendMessageCellDiscrete(msg_cell, which_cell): time.sleep(CELL_TX_TIME_S / 3.0) # Really long messages just wrap back around. - which_cell = (which_cell % 8) + which_cell = (which_cell % (2 ** generate_utils.INDEX_BITS)) - s0 = ((floor(which_cell / 4) % 2) == 1) - s1 = ((floor(which_cell / 2) % 2) == 1) - s2 = ((floor(which_cell / 1) % 2) == 1) + s0 = ((floor(which_cell / 8) % 2) == 1) + s1 = ((floor(which_cell / 4) % 2) == 1) + s2 = ((floor(which_cell / 2) % 2) == 1) + s3 = ((floor(which_cell / 1) % 2) == 1) - print("Cell s0/s1/s2: {}/{}/{}".format(s0,s1,s2)) + print("Cell s0/s1/s2/s3: {}/{}/{}/{}".format(s0,s1,s2,s3)) # Seek each layer to the current cell. for i in range(0, len(msg_cell)): - updateCell(i, msg_cell[i], s0, s1, s2) + updateCell(i, msg_cell[i], s0, s1, s2, s3) # Wait for convergence. time.sleep(CELL_TX_TIME_S / 3.0) @@ -117,58 +128,6 @@ def sendMessageCellDiscrete(msg_cell, which_cell): # Wait for convergence. time.sleep(CELL_TX_TIME_S / 3.0) -# Send a cell smoothly spread out over the course of CELL_TX_TIME_S. -# `which_cell` is an integer in the range [0,8). -# TODO(yum_food) because we can only reliably update entire cells at once, -# this method does not work :( -def sendMessageCellContinuous(msg_cell, which_cell): - s0 = ((floor(which_cell / 4) % 2) == 1) - s1 = ((floor(which_cell / 2) % 2) == 1) - s2 = ((floor(which_cell / 1) % 2) == 1) - - time_quanta = 20 - dt = CELL_TX_TIME_S / (time_quanta * 1.0) - - # key: time quantum \elem [0, 100) - # value: idx to handle - update_times = {} - enable_times = {} - disable_times = {} - - for i in range(0, len(msg_cell)): - update_time = int(((i / NUM_LAYERS) + 0.000) * time_quanta) % time_quanta - enable_time = int(((i / NUM_LAYERS) + 0.333) * time_quanta) % time_quanta - disable_time = int(((i / NUM_LAYERS) + 0.666) * time_quanta) % time_quanta - - update_times[update_time] = i - enable_times[enable_time] = i - disable_times[disable_time] = i - - begin = time.time_ns() - - for t in range(0, time_quanta): - if t in update_times: - #print("update cell: {}".format(which_cell)) - which_cell = update_times[t] - updateCell(which_cell, msg_cell[which_cell], s0, s1, s2) - if t in enable_times: - #print("enable cell: {}".format(which_cell)) - which_cell = enable_times[t] - addr="/avatar/parameters/" + getEnableParam(which_cell) - client.send_message(addr, True) - if t in disable_times: - #print("disable cell: {}".format(which_cell)) - which_cell = disable_times[t] - addr="/avatar/parameters/" + getEnableParam(which_cell) - client.send_message(addr, False) - - time.sleep(dt) - - end = time.time_ns() - delta_t_s = (end - begin) / (1000.0 * 1000.0 * 1000.0) - if delta_t_s < CELL_TX_TIME_S: - time.sleep(CELL_TX_TIME_S - delta_t_s) - # The board is broken down into contiguous collections of characters called # cells. Each cell contains `NUM_LAYERS` characters. We can update one cell # every ~1.0 seconds. Going faster causes the board to display garbage to @@ -271,11 +230,9 @@ def closeBoard(): if __name__ == "__main__": generateEncoding(state) + + clear() for line in fileinput.input(): - clear() sendMessage(line) - time.sleep(1) - #with open("lorum_ipsum.txt", "r") as f: - # for line in f: - # sendMessage(line) - + time.sleep(1 + len(line) / 40.0) + clear() diff --git a/template.anim b/template.anim.txt index 8f06fe1..8f06fe1 100644 --- a/template.anim +++ b/template.anim.txt |
