remove codegen (again)

This commit is contained in:
matthew 2025-08-14 13:10:17 +10:00
parent 63c942294c
commit 48493f91bb
6 changed files with 43 additions and 840 deletions

File diff suppressed because one or more lines are too long

View File

@ -95,10 +95,3 @@ if ! [ -f build/libcglm.a ]; then
rm $obj rm $obj
fi fi
if ! [ -f build/atlas.png ]; then
msdf-atlas-gen -font assets/fonts/NuberNextCondensed-DemiBold.otf -dimensions 256 256 -type softmask -imageout build/atlas.png -json build/atlas.json
fi
cp build/atlas.png assets/textures/atlas.png
mkdir -p assets/data
cp build/atlas.json assets/data/atlas.json

View File

@ -13,7 +13,7 @@
"sourcePaths": ["src/gears", "src/codegen", "src/shared", "external/xxhash", "external/inteli"], "sourcePaths": ["src/gears", "src/codegen", "src/shared", "external/xxhash", "external/inteli"],
"libs-linux": ["xcb", "X11", "X11-xcb", "vulkan", "stdc++", "xcb-xfixes", "freetype"], "libs-linux": ["xcb", "X11", "X11-xcb", "vulkan", "stdc++", "xcb-xfixes", "freetype"],
"libs-windows": [], "libs-windows": [],
"preGenerateCommands-linux": ["./build.sh", "build/Packer"], "preGenerateCommands-linux": ["./build.sh"],
"preGenerateCommands-windows": [], "preGenerateCommands-windows": [],
"dflags": ["-Xcc=-mno-sse", "-P-I/usr/include/freetype2"], "dflags": ["-Xcc=-mno-sse", "-P-I/usr/include/freetype2"],
"dflags-dmd": ["-P=-DSTBI_NO_SIMD"] "dflags-dmd": ["-P=-DSTBI_NO_SIMD"]

View File

@ -1,825 +0,0 @@
import util;
static immutable FontAtlas FONT_ATLAS = {
type: AtlasType.SoftMask,
size: 58.531250,
width: 256,
height: 256,
y_origin: YOrigin.Bottom,
em_size: 1.000000,
line_height: 1.408000,
ascender: 1.105000,
descender: -0.303000,
underline_y: -0.100000,
underline_thickness: 0.050000,
glyphs: [
{
ch: ' ',
advance: 0.207000,
},
{
ch: ',',
advance: 0.216000,
plane_left: 0.033160,
plane_bottom: -0.179391,
plane_right: 0.169840,
plane_top: 0.145222,
atlas_left: 247.500000,
atlas_bottom: 19.500000,
atlas_right: 255.500000,
atlas_top: 0.500000,
},
{
ch: '-',
advance: 0.373000,
plane_left: 0.049821,
plane_bottom: 0.230646,
plane_right: 0.323179,
plane_top: 0.350240,
atlas_left: 40.500000,
atlas_bottom: 51.500000,
atlas_right: 56.500000,
atlas_top: 44.500000,
},
{
ch: '.',
advance: 0.216000,
plane_left: 0.048203,
plane_bottom: -0.008542,
plane_right: 0.167797,
plane_top: 0.145222,
atlas_left: 247.500000,
atlas_bottom: 28.500000,
atlas_right: 254.500000,
atlas_top: 19.500000,
},
{
ch: '0',
advance: 0.467000,
plane_left: 0.019939,
plane_bottom: -0.025627,
plane_right: 0.447061,
plane_top: 0.709023,
atlas_left: 149.500000,
atlas_bottom: 43.500000,
atlas_right: 174.500000,
atlas_top: 0.500000,
},
{
ch: '1',
advance: 0.282000,
plane_left: 0.003406,
plane_bottom: -0.008542,
plane_right: 0.242594,
plane_top: 0.691938,
atlas_left: 98.500000,
atlas_bottom: 220.500000,
atlas_right: 112.500000,
atlas_top: 179.500000,
},
{
ch: '2',
advance: 0.439000,
plane_left: 0.014481,
plane_bottom: -0.008542,
plane_right: 0.424519,
plane_top: 0.709023,
atlas_left: 0.500000,
atlas_bottom: 137.500000,
atlas_right: 24.500000,
atlas_top: 95.500000,
},
{
ch: '3',
advance: 0.456000,
plane_left: 0.009939,
plane_bottom: -0.025627,
plane_right: 0.437061,
plane_top: 0.709023,
atlas_left: 174.500000,
atlas_bottom: 43.500000,
atlas_right: 199.500000,
atlas_top: 0.500000,
},
{
ch: '4',
advance: 0.466000,
plane_left: 0.011396,
plane_bottom: -0.008542,
plane_right: 0.455604,
plane_top: 0.691938,
atlas_left: 112.500000,
atlas_bottom: 220.500000,
atlas_right: 138.500000,
atlas_top: 179.500000,
},
{
ch: '5',
advance: 0.454000,
plane_left: 0.015439,
plane_bottom: -0.025627,
plane_right: 0.442561,
plane_top: 0.691938,
atlas_left: 24.500000,
atlas_bottom: 137.500000,
atlas_right: 49.500000,
atlas_top: 95.500000,
},
{
ch: '6',
advance: 0.456000,
plane_left: 0.017939,
plane_bottom: -0.025627,
plane_right: 0.445061,
plane_top: 0.709023,
atlas_left: 199.500000,
atlas_bottom: 43.500000,
atlas_right: 224.500000,
atlas_top: 0.500000,
},
{
ch: '7',
advance: 0.386000,
plane_left: 0.004066,
plane_bottom: -0.008542,
plane_right: 0.379934,
plane_top: 0.691938,
atlas_left: 138.500000,
atlas_bottom: 220.500000,
atlas_right: 160.500000,
atlas_top: 179.500000,
},
{
ch: '8',
advance: 0.464000,
plane_left: 0.018439,
plane_bottom: -0.025627,
plane_right: 0.445561,
plane_top: 0.709023,
atlas_left: 23.500000,
atlas_bottom: 95.500000,
atlas_right: 48.500000,
atlas_top: 52.500000,
},
{
ch: '9',
advance: 0.456000,
plane_left: 0.010939,
plane_bottom: -0.025627,
plane_right: 0.438061,
plane_top: 0.709023,
atlas_left: 48.500000,
atlas_bottom: 95.500000,
atlas_right: 73.500000,
atlas_top: 52.500000,
},
{
ch: ':',
advance: 0.216000,
plane_left: 0.048203,
plane_bottom: -0.008542,
plane_right: 0.167797,
plane_top: 0.521089,
atlas_left: 137.500000,
atlas_bottom: 252.500000,
atlas_right: 144.500000,
atlas_top: 221.500000,
},
{
ch: ';',
advance: 0.216000,
plane_left: 0.033160,
plane_bottom: -0.179391,
plane_right: 0.169840,
plane_top: 0.521089,
atlas_left: 243.500000,
atlas_bottom: 136.500000,
atlas_right: 251.500000,
atlas_top: 95.500000,
},
{
ch: 'A',
advance: 0.535000,
plane_left: 0.011227,
plane_bottom: -0.008542,
plane_right: 0.523773,
plane_top: 0.709023,
atlas_left: 76.500000,
atlas_bottom: 179.500000,
atlas_right: 106.500000,
atlas_top: 137.500000,
},
{
ch: 'B',
advance: 0.495000,
plane_left: 0.047439,
plane_bottom: -0.008542,
plane_right: 0.474561,
plane_top: 0.709023,
atlas_left: 215.500000,
atlas_bottom: 179.500000,
atlas_right: 240.500000,
atlas_top: 137.500000,
},
{
ch: 'C',
advance: 0.508000,
plane_left: 0.030354,
plane_bottom: -0.025627,
plane_right: 0.491646,
plane_top: 0.726108,
atlas_left: 40.500000,
atlas_bottom: 44.500000,
atlas_right: 67.500000,
atlas_top: 0.500000,
},
{
ch: 'D',
advance: 0.535000,
plane_left: 0.046854,
plane_bottom: -0.008542,
plane_right: 0.508146,
plane_top: 0.709023,
atlas_left: 26.500000,
atlas_bottom: 221.500000,
atlas_right: 53.500000,
atlas_top: 179.500000,
},
{
ch: 'E',
advance: 0.454000,
plane_left: 0.047024,
plane_bottom: -0.008542,
plane_right: 0.439976,
plane_top: 0.709023,
atlas_left: 75.500000,
atlas_bottom: 221.500000,
atlas_right: 98.500000,
atlas_top: 179.500000,
},
{
ch: 'F',
advance: 0.431000,
plane_left: 0.044066,
plane_bottom: -0.008542,
plane_right: 0.419934,
plane_top: 0.709023,
atlas_left: 53.500000,
atlas_bottom: 221.500000,
atlas_right: 75.500000,
atlas_top: 179.500000,
},
{
ch: 'G',
advance: 0.535000,
plane_left: 0.025312,
plane_bottom: -0.025627,
plane_right: 0.503688,
plane_top: 0.726108,
atlas_left: 67.500000,
atlas_bottom: 44.500000,
atlas_right: 95.500000,
atlas_top: 0.500000,
},
{
ch: 'H',
advance: 0.541000,
plane_left: 0.048896,
plane_bottom: -0.008542,
plane_right: 0.493104,
plane_top: 0.709023,
atlas_left: 0.500000,
atlas_bottom: 221.500000,
atlas_right: 26.500000,
atlas_top: 179.500000,
},
{
ch: 'I',
advance: 0.211000,
plane_left: 0.045703,
plane_bottom: -0.008542,
plane_right: 0.165297,
plane_top: 0.709023,
atlas_left: 236.500000,
atlas_bottom: 137.500000,
atlas_right: 243.500000,
atlas_top: 95.500000,
},
{
ch: 'J',
advance: 0.438000,
plane_left: 0.007024,
plane_bottom: -0.025627,
plane_right: 0.399976,
plane_top: 0.709023,
atlas_left: 73.500000,
atlas_bottom: 95.500000,
atlas_right: 96.500000,
atlas_top: 52.500000,
},
{
ch: 'K',
advance: 0.507000,
plane_left: 0.051396,
plane_bottom: -0.008542,
plane_right: 0.495604,
plane_top: 0.709023,
atlas_left: 189.500000,
atlas_bottom: 179.500000,
atlas_right: 215.500000,
atlas_top: 137.500000,
},
{
ch: 'L',
advance: 0.430000,
plane_left: 0.047566,
plane_bottom: -0.008542,
plane_right: 0.423434,
plane_top: 0.709023,
atlas_left: 167.500000,
atlas_bottom: 179.500000,
atlas_right: 189.500000,
atlas_top: 137.500000,
},
{
ch: 'M',
advance: 0.682000,
plane_left: 0.050557,
plane_bottom: -0.008542,
plane_right: 0.631443,
plane_top: 0.709023,
atlas_left: 133.500000,
atlas_bottom: 179.500000,
atlas_right: 167.500000,
atlas_top: 137.500000,
},
{
ch: 'N',
advance: 0.560000,
plane_left: 0.048854,
plane_bottom: -0.008542,
plane_right: 0.510146,
plane_top: 0.709023,
atlas_left: 106.500000,
atlas_bottom: 179.500000,
atlas_right: 133.500000,
atlas_top: 137.500000,
},
{
ch: 'O',
advance: 0.535000,
plane_left: 0.028312,
plane_bottom: -0.025627,
plane_right: 0.506688,
plane_top: 0.726108,
atlas_left: 95.500000,
atlas_bottom: 44.500000,
atlas_right: 123.500000,
atlas_top: 0.500000,
},
{
ch: 'P',
advance: 0.475000,
plane_left: 0.047481,
plane_bottom: -0.008542,
plane_right: 0.457519,
plane_top: 0.709023,
atlas_left: 52.500000,
atlas_bottom: 179.500000,
atlas_right: 76.500000,
atlas_top: 137.500000,
},
{
ch: 'Q',
advance: 0.535000,
plane_left: 0.028312,
plane_bottom: -0.145222,
plane_right: 0.506688,
plane_top: 0.726108,
atlas_left: 12.500000,
atlas_bottom: 51.500000,
atlas_right: 40.500000,
atlas_top: 0.500000,
},
{
ch: 'R',
advance: 0.500000,
plane_left: 0.046396,
plane_bottom: -0.008542,
plane_right: 0.490604,
plane_top: 0.709023,
atlas_left: 26.500000,
atlas_bottom: 179.500000,
atlas_right: 52.500000,
atlas_top: 137.500000,
},
{
ch: 'S',
advance: 0.475000,
plane_left: 0.012396,
plane_bottom: -0.025627,
plane_right: 0.456604,
plane_top: 0.726108,
atlas_left: 123.500000,
atlas_bottom: 44.500000,
atlas_right: 149.500000,
atlas_top: 0.500000,
},
{
ch: 'T',
advance: 0.466000,
plane_left: 0.010896,
plane_bottom: -0.008542,
plane_right: 0.455104,
plane_top: 0.709023,
atlas_left: 0.500000,
atlas_bottom: 179.500000,
atlas_right: 26.500000,
atlas_top: 137.500000,
},
{
ch: 'U',
advance: 0.528000,
plane_left: 0.043396,
plane_bottom: -0.025627,
plane_right: 0.487604,
plane_top: 0.709023,
atlas_left: 121.500000,
atlas_bottom: 95.500000,
atlas_right: 147.500000,
atlas_top: 52.500000,
},
{
ch: 'V',
advance: 0.522000,
plane_left: 0.004727,
plane_bottom: -0.008542,
plane_right: 0.517273,
plane_top: 0.709023,
atlas_left: 184.500000,
atlas_bottom: 137.500000,
atlas_right: 214.500000,
atlas_top: 95.500000,
},
{
ch: 'W',
advance: 0.768000,
plane_left: 0.008132,
plane_bottom: -0.008542,
plane_right: 0.759868,
plane_top: 0.709023,
atlas_left: 140.500000,
atlas_bottom: 137.500000,
atlas_right: 184.500000,
atlas_top: 95.500000,
},
{
ch: 'X',
advance: 0.513000,
plane_left: 0.008769,
plane_bottom: -0.008542,
plane_right: 0.504231,
plane_top: 0.709023,
atlas_left: 111.500000,
atlas_bottom: 137.500000,
atlas_right: 140.500000,
atlas_top: 95.500000,
},
{
ch: 'Y',
advance: 0.524000,
plane_left: 0.005727,
plane_bottom: -0.008542,
plane_right: 0.518273,
plane_top: 0.709023,
atlas_left: 81.500000,
atlas_bottom: 137.500000,
atlas_right: 111.500000,
atlas_top: 95.500000,
},
{
ch: 'Z',
advance: 0.452000,
plane_left: 0.011439,
plane_bottom: -0.008542,
plane_right: 0.438561,
plane_top: 0.709023,
atlas_left: 56.500000,
atlas_bottom: 137.500000,
atlas_right: 81.500000,
atlas_top: 95.500000,
},
{
ch: 'a',
advance: 0.427000,
plane_left: 0.009024,
plane_bottom: -0.025627,
plane_right: 0.401976,
plane_top: 0.521089,
atlas_left: 114.500000,
atlas_bottom: 253.500000,
atlas_right: 137.500000,
atlas_top: 221.500000,
},
{
ch: 'b',
advance: 0.457000,
plane_left: 0.043024,
plane_bottom: -0.025627,
plane_right: 0.435976,
plane_top: 0.709023,
atlas_left: 147.500000,
atlas_bottom: 95.500000,
atlas_right: 170.500000,
atlas_top: 52.500000,
},
{
ch: 'c',
advance: 0.423000,
plane_left: 0.018024,
plane_bottom: -0.025627,
plane_right: 0.410976,
plane_top: 0.521089,
atlas_left: 24.500000,
atlas_bottom: 253.500000,
atlas_right: 47.500000,
atlas_top: 221.500000,
},
{
ch: 'd',
advance: 0.456000,
plane_left: 0.021024,
plane_bottom: -0.025627,
plane_right: 0.413976,
plane_top: 0.709023,
atlas_left: 209.500000,
atlas_bottom: 95.500000,
atlas_right: 232.500000,
atlas_top: 52.500000,
},
{
ch: 'e',
advance: 0.430000,
plane_left: 0.021024,
plane_bottom: -0.025627,
plane_right: 0.413976,
plane_top: 0.521089,
atlas_left: 69.500000,
atlas_bottom: 253.500000,
atlas_right: 92.500000,
atlas_top: 221.500000,
},
{
ch: 'f',
advance: 0.283000,
plane_left: 0.009321,
plane_bottom: -0.008542,
plane_right: 0.282679,
plane_top: 0.726108,
atlas_left: 193.500000,
atlas_bottom: 95.500000,
atlas_right: 209.500000,
atlas_top: 52.500000,
},
{
ch: 'g',
advance: 0.448000,
plane_left: 0.020524,
plane_bottom: -0.213561,
plane_right: 0.413476,
plane_top: 0.521089,
atlas_left: 170.500000,
atlas_bottom: 95.500000,
atlas_right: 193.500000,
atlas_top: 52.500000,
},
{
ch: 'h',
advance: 0.449000,
plane_left: 0.039566,
plane_bottom: -0.008542,
plane_right: 0.415434,
plane_top: 0.709023,
atlas_left: 214.500000,
atlas_bottom: 137.500000,
atlas_right: 236.500000,
atlas_top: 95.500000,
},
{
ch: 'i',
advance: 0.184000,
plane_left: 0.032203,
plane_bottom: -0.008542,
plane_right: 0.151797,
plane_top: 0.674853,
atlas_left: 176.500000,
atlas_bottom: 219.500000,
atlas_right: 183.500000,
atlas_top: 179.500000,
},
{
ch: 'j',
advance: 0.187000,
plane_left: -0.051009,
plane_bottom: -0.213561,
plane_right: 0.154009,
plane_top: 0.674853,
atlas_left: 0.500000,
atlas_bottom: 52.500000,
atlas_right: 12.500000,
atlas_top: 0.500000,
},
{
ch: 'k',
advance: 0.434000,
plane_left: 0.042024,
plane_bottom: -0.008542,
plane_right: 0.434976,
plane_top: 0.709023,
atlas_left: 232.500000,
atlas_bottom: 94.500000,
atlas_right: 255.500000,
atlas_top: 52.500000,
},
{
ch: 'l',
advance: 0.190000,
plane_left: 0.035703,
plane_bottom: -0.008542,
plane_right: 0.155297,
plane_top: 0.709023,
atlas_left: 49.500000,
atlas_bottom: 137.500000,
atlas_right: 56.500000,
atlas_top: 95.500000,
},
{
ch: 'm',
advance: 0.690000,
plane_left: 0.039472,
plane_bottom: -0.008542,
plane_right: 0.654528,
plane_top: 0.521089,
atlas_left: 169.500000,
atlas_bottom: 252.500000,
atlas_right: 205.500000,
atlas_top: 221.500000,
},
{
ch: 'n',
advance: 0.446000,
plane_left: 0.036566,
plane_bottom: -0.008542,
plane_right: 0.412434,
plane_top: 0.521089,
atlas_left: 183.500000,
atlas_bottom: 210.500000,
atlas_right: 205.500000,
atlas_top: 179.500000,
},
{
ch: 'o',
advance: 0.442000,
plane_left: 0.015981,
plane_bottom: -0.025627,
plane_right: 0.426019,
plane_top: 0.521089,
atlas_left: 0.500000,
atlas_bottom: 253.500000,
atlas_right: 24.500000,
atlas_top: 221.500000,
},
{
ch: 'p',
advance: 0.457000,
plane_left: 0.043024,
plane_bottom: -0.213561,
plane_right: 0.435976,
plane_top: 0.521089,
atlas_left: 0.500000,
atlas_bottom: 95.500000,
atlas_right: 23.500000,
atlas_top: 52.500000,
},
{
ch: 'q',
advance: 0.455000,
plane_left: 0.021024,
plane_bottom: -0.213561,
plane_right: 0.413976,
plane_top: 0.521089,
atlas_left: 224.500000,
atlas_bottom: 43.500000,
atlas_right: 247.500000,
atlas_top: 0.500000,
},
{
ch: 'r',
advance: 0.298000,
plane_left: 0.038363,
plane_bottom: -0.008542,
plane_right: 0.294637,
plane_top: 0.521089,
atlas_left: 240.500000,
atlas_bottom: 168.500000,
atlas_right: 255.500000,
atlas_top: 137.500000,
},
{
ch: 's',
advance: 0.400000,
plane_left: 0.011066,
plane_bottom: -0.025627,
plane_right: 0.386934,
plane_top: 0.521089,
atlas_left: 47.500000,
atlas_bottom: 253.500000,
atlas_right: 69.500000,
atlas_top: 221.500000,
},
{
ch: 't',
advance: 0.293000,
plane_left: 0.004321,
plane_bottom: -0.025627,
plane_right: 0.277679,
plane_top: 0.657768,
atlas_left: 160.500000,
atlas_bottom: 219.500000,
atlas_right: 176.500000,
atlas_top: 179.500000,
},
{
ch: 'u',
advance: 0.440000,
plane_left: 0.029566,
plane_bottom: -0.025627,
plane_right: 0.405434,
plane_top: 0.521089,
atlas_left: 92.500000,
atlas_bottom: 253.500000,
atlas_right: 114.500000,
atlas_top: 221.500000,
},
{
ch: 'v',
advance: 0.419000,
plane_left: -0.004061,
plane_bottom: -0.008542,
plane_right: 0.423061,
plane_top: 0.521089,
atlas_left: 144.500000,
atlas_bottom: 252.500000,
atlas_right: 169.500000,
atlas_top: 221.500000,
},
{
ch: 'w',
advance: 0.658000,
plane_left: 0.004387,
plane_bottom: -0.008542,
plane_right: 0.653613,
plane_top: 0.521089,
atlas_left: 205.500000,
atlas_bottom: 210.500000,
atlas_right: 243.500000,
atlas_top: 179.500000,
},
{
ch: 'x',
advance: 0.412000,
plane_left: 0.000981,
plane_bottom: -0.008542,
plane_right: 0.411019,
plane_top: 0.521089,
atlas_left: 205.500000,
atlas_bottom: 252.500000,
atlas_right: 229.500000,
atlas_top: 221.500000,
},
{
ch: 'y',
advance: 0.421000,
plane_left: -0.002561,
plane_bottom: -0.213561,
plane_right: 0.424561,
plane_top: 0.521089,
atlas_left: 96.500000,
atlas_bottom: 95.500000,
atlas_right: 121.500000,
atlas_top: 52.500000,
},
{
ch: 'z',
advance: 0.383000,
plane_left: 0.002066,
plane_bottom: -0.008542,
plane_right: 0.377934,
plane_top: 0.521089,
atlas_left: 229.500000,
atlas_bottom: 252.500000,
atlas_right: 251.500000,
atlas_top: 221.500000,
},
],
};

View File

@ -9,12 +9,6 @@ import core.simd;
import math; import math;
import core.stdc.string : memcpy; import core.stdc.string : memcpy;
import font;
import alloc;
import assets;
FontAtlasBuf FONT_ATLAS_TEST;
// TODO: // TODO:
// 1. Determine how to better handle inputs // 1. Determine how to better handle inputs
// 2. Set up multisampling // 2. Set up multisampling

View File

@ -3,6 +3,48 @@ import includes;
import util; import util;
import alloc; import alloc;
enum AtlasType
{
None = 0,
SoftMask,
}
enum YOrigin
{
None = 0,
Bottom,
}
struct FontAtlas
{
AtlasType type;
f32 size;
u32 width;
u32 height;
YOrigin y_origin;
f32 em_size;
f32 line_height;
f32 ascender;
f32 descender;
f32 underline_y;
f32 underline_thickness;
Glyph[] glyphs;
}
struct Glyph
{
dchar ch;
f32 advance;
f32 plane_left;
f32 plane_bottom;
f32 plane_right;
f32 plane_top;
f32 atlas_left;
f32 atlas_bottom;
f32 atlas_right;
f32 atlas_top;
}
FT_Library FT_LIB; FT_Library FT_LIB;
alias FontFace = FT_Face; alias FontFace = FT_Face;