vg_linear_clear( vg_mem.scratch );
mdl_load_mesh_block( &font->mdl, vg_mem.scratch );
- mdl_load_pack_block( &font->mdl, vg_mem.scratch );
- mdl_close( &font->mdl );
+
+ if( !mdl_arrcount( &font->mdl.textures ) )
+ vg_fatal_exit_loop( "No texture in font file" );
+
+ mdl_texture *tex0 = mdl_arritm( &font->mdl.textures, 0 );
+ void *data = vg_linear_alloc( vg_mem.scratch, tex0->file.pack_size );
+ mdl_fread_pack_file( &font->mdl, &tex0->file, data );
vg_acquire_thread_sync();
{
/* upload first texture */
font->texture = vg_tex2d_new();
- mdl_texture *tex0 = mdl_arritm( &font->mdl.textures, 0 );
vg_tex2d_set_error();
- vg_tex2d_qoi( mdl_arritm( &font->mdl.pack, tex0->file.pack_offset ),
- tex0->file.pack_size,
+ vg_tex2d_qoi( data, tex0->file.pack_size,
mdl_pstr( &font->mdl, tex0->file.pstr_path ));
vg_tex2d_nearest();
vg_tex2d_repeat();
}
vg_release_thread_sync();
+
+ mdl_close( &font->mdl );
}
VG_STATIC void font3d_init(void)