summaryrefslogtreecommitdiffstats
path: root/Scripts/generate_shader.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-02-02 18:00:18 -0800
committeryum <yum.food.vr@gmail.com>2023-02-13 14:36:25 -0800
commit1cb5bdfe8cba6fe4647448cd3cf0c63ecbd7dfc2 (patch)
treee338264fbf6f75911246ca61c934110e00f144c8 /Scripts/generate_shader.py
parent7c6894614dcc3ebc5d4c8839b64f4da761b5ccf0 (diff)
Finish emotes
Emotes require 2 bytes per char. They're encoded into the region [0xE000, infinity). The texture is 4k, and uses 1k vertical pixels per emote segment, for a maximum of 32 segments. * Reduce volume of noise indicator by 90%. Quiet is probably better. Might want to add a volume slider idk. * Bugfix: emotes without a transparency channel now work * Address a couple Unity performance complaints about the shader
Diffstat (limited to 'Scripts/generate_shader.py')
-rw-r--r--Scripts/generate_shader.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Scripts/generate_shader.py b/Scripts/generate_shader.py
index cf113ec..15dc9b9 100644
--- a/Scripts/generate_shader.py
+++ b/Scripts/generate_shader.py
@@ -48,11 +48,11 @@ def generateCgConstants(nbytes: int, nrows: int, ncols: int, prefix: str = "") -
# This is the basic idea of what we're generating:
# // Get the value of the parameter for the cell we're in.
-# int GetLetterParameter(float2 uv)
+# uint GetLetterParameter(float2 uv)
# {
# float CHAR_COL = floor(uv.x * Cols);
# float CHAR_ROW = floor(uv.y * Rows);
-# int res = 0;
+# uint res = 0;
#
# [forcecase] switch(CHAR_ROW) {
# case n:
@@ -64,8 +64,8 @@ def generateCgConstants(nbytes: int, nrows: int, ncols: int, prefix: str = "") -
# case 1:
# ...
#
-# res |= ((int) round(_Letter_Row00_Col00_Byte0)) << (0 * 8);
-# res |= ((int) round(_Letter_Row00_Col00_Byte1)) << (1 * 8);
+# res |= ((uint) round(_Letter_Row00_Col00_Byte0)) << (0 * 8);
+# res |= ((uint) round(_Letter_Row00_Col00_Byte1)) << (1 * 8);
# continue;
# }
# }
@@ -84,7 +84,7 @@ def generateLetterAccessor(nbytes: int, nrows: int, ncols: int, prefix: str = ""
lines.append(prefix + " case {}:".format(col))
for byte in range(0, nbytes):
param_name = generate_utils.getShaderParamByRowColByte(row, col, byte)
- lines.append(prefix + " res |= ((int) round({})) << ({} * 8);".format(param_name, byte))
+ lines.append(prefix + " res |= ((uint) round({})) << ({} * 8);".format(param_name, byte))
lines.append(prefix + " return res;")
lines.append(prefix + " default:")
lines.append(prefix + " return 0;")