X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_render.c;h=df0dd6b1d3717e12b84529aecaf7edb90a38dc1e;hb=b4a83d4fcab39bee5a8cd6e8e6eec06314864e5b;hp=ab8942207366aa30d30a435e009b997d0c5c62d5;hpb=1b522daa02f28128498b04def4d60b63e590d1f3;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_render.c b/player_render.c index ab89422..df0dd6b 100644 --- a/player_render.c +++ b/player_render.c @@ -43,30 +43,19 @@ VG_STATIC void player_model_load( struct player_model *mdl, const char *path ) mdl_context ctx; mdl_open( &ctx, path, vg_mem.scratch ); mdl_load_metadata_block( &ctx, vg_mem.scratch ); - mdl_load_mesh_block( &ctx, vg_mem.scratch ); if( !mdl_arrcount( &ctx.textures ) ) - vg_fatal_exit_loop( "No texture in player model" ); + vg_fatal_error( "No texture in player model" ); mdl_texture *tex0 = mdl_arritm( &ctx.textures, 0 ); void *data = vg_linear_alloc( vg_mem.scratch, tex0->file.pack_size ); mdl_fread_pack_file( &ctx, &tex0->file, data ); - vg_acquire_thread_sync(); - { - mdl_unpack_glmesh( &ctx, &mdl->mesh ); - - /* upload first texture */ - mdl->texture = vg_tex2d_new(); - - vg_tex2d_set_error(); - vg_tex2d_qoi( data, tex0->file.pack_size, - mdl_pstr( &ctx, tex0->file.pstr_path )); - vg_tex2d_nearest(); - vg_tex2d_clamp(); - } - vg_release_thread_sync(); + vg_tex2d_load_qoi_async( data, tex0->file.pack_size, + VG_TEX2D_NEAREST|VG_TEX2D_CLAMP, + &mdl->texture ); + mdl_async_load_glmesh( &ctx, &mdl->mesh ); mdl_close( &ctx ); } @@ -77,33 +66,22 @@ VG_STATIC void player_board_load( struct player_board *mdl, const char *path ) mdl_context ctx; mdl_open( &ctx, path, vg_mem.scratch ); mdl_load_metadata_block( &ctx, vg_mem.scratch ); - mdl_load_mesh_block( &ctx, vg_mem.scratch ); mdl_array_ptr markers; mdl_load_array( &ctx, &markers, "ent_marker", vg_mem.scratch ); if( !mdl_arrcount( &ctx.textures ) ) - vg_fatal_exit_loop( "No texture in board model" ); + vg_fatal_error( "No texture in board model" ); mdl_texture *tex0 = mdl_arritm( &ctx.textures, 0 ); void *data = vg_linear_alloc( vg_mem.scratch, tex0->file.pack_size ); mdl_fread_pack_file( &ctx, &tex0->file, data ); - vg_acquire_thread_sync(); - { - mdl_unpack_glmesh( &ctx, &mdl->mesh ); - - /* upload first texture */ - mdl->texture = vg_tex2d_new(); - - vg_tex2d_set_error(); - vg_tex2d_qoi( data, tex0->file.pack_size, - mdl_pstr( &ctx, tex0->file.pstr_path )); - vg_tex2d_nearest(); - vg_tex2d_clamp(); - } - vg_release_thread_sync(); + vg_tex2d_load_qoi_async( data, tex0->file.pack_size, + VG_TEX2D_CLAMP|VG_TEX2D_NEAREST, + &mdl->texture ); + mdl_async_load_glmesh( &ctx, &mdl->mesh ); mdl_close( &ctx ); for( int i=0; i<4; i++ )