1 // Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved
6 // Super basic model compiler
7 int main( int argc
, char *argv
[] )
11 vg_error( "Need input/output files\n" );
18 unsigned char *data
= stbi_load( argv
[1], &x
, &y
, &n
, 4 );
22 output
= fopen( argv
[2], "w" );
25 vg_error( "couldn't open output for writing\n" );
30 fprintf( output
, "/* Font buffer generated from source file: '%s' */\n", argv
[1] );
33 u32 pixel
= 0, chars
= 0;
37 for( int b
= 31; b
>= 0; b
-- )
39 buff
|= data
[pixel
*4+3]>128?0x1<<b
:0;
42 if( pixel
>= pixel_max
)
49 fprintf( output
, "%#x,", buff
);
50 if( (++chars
) % 8 == 0 )
51 fprintf( output
, "\n" );
59 vg_error( "Couldn't open source file\n" );