diff options
| author | yum <yum.food.vr@gmail.com> | 2024-12-01 00:11:04 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-12-01 00:11:04 -0800 |
| commit | 3089bd2ea6a3952e3ea0f31d8fc5eca1864cefab (patch) | |
| tree | 8dc16932eb96cc4e592b865731b10c37a8fb31e8 /Third_Party/gen_atlas | |
| parent | 8232f195185d7550c331a78ed57b1a44746d294b (diff) | |
Add small programmable text display gimmick
Use Third_Party/gen_atlas to create a 512x512 texture and put it in the
texture slot (the resolution is hardcoded to 512 in shader). Use sliders to
control the grid size. If desired, use global offset to make it possible
to linearly animate between e.g. 0-9 and have it display as ASCII
'0'-'9'.
Diffstat (limited to 'Third_Party/gen_atlas')
| -rw-r--r-- | Third_Party/gen_atlas | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Third_Party/gen_atlas b/Third_Party/gen_atlas index dfb0e61..b880ac8 100644 --- a/Third_Party/gen_atlas +++ b/Third_Party/gen_atlas @@ -10,7 +10,7 @@ from PIL import Image CHAR_RANGES = [ (32, 126), # Printable ASCII # Add more ranges here as needed, e.g.: - # (160, 255), # Extended Latin + (160, 255), # Extended Latin ] def calculate_grid_size(char_ranges): @@ -32,21 +32,18 @@ def generate_atlas(font_path, resolution, draw_grid=False): cmd = [ "msdf-atlas-gen/build/bin/Debug/msdf-atlas-gen.exe", "-font", font_path, - "-type", "mtsdf", + "-type", "msdf", "-format", "png", "-imageout", "atlas.png", - "-json", "atlas.json", - "-size", "32", + "-size", "28", "-pxrange", "2", "-dimensions", str(resolution), str(resolution), "-chars", chars_str, "-uniformgrid", "-uniformcols", str(grid_size), "-uniformcell", str(cell_size), str(cell_size), - "-uniformorigin", "on", - "-coloringstrategy", "inktrap", +# "-uniformorigin", "on", "-errorcorrection", "auto", - "-miterlimit", "1.0", "-scanline" ] @@ -89,7 +86,7 @@ def draw_grid_lines(image, resolution): def rearrange_atlas(resolution, cell_width, cell_height, draw_grid=False): """Rearrange the atlas to include gaps for non-printable characters""" original = Image.open("atlas.png") - new_atlas = Image.new('RGBA', (resolution, resolution), (0, 0, 0, 255)) + new_atlas = Image.new('RGB', (resolution, resolution), (0, 0, 0)) grid_size = calculate_grid_size(CHAR_RANGES) cell_size = resolution // grid_size |
