X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_model.h;h=e0693b16433aad19987cf4b81ade116c0d6269e4;hb=c2d67378dd5c82de50b8fbbbe222ec6be2da4eee;hp=a2379fca6e3db158655a83e2bd53de5663afd2b5;hpb=2ca677a0ec9d00db46a8b97bec30dbea8280a79b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_model.h b/player_model.h index a2379fc..e0693b1 100644 --- a/player_model.h +++ b/player_model.h @@ -11,17 +11,25 @@ vg_tex2d tex_characters = { .path = "textures/ch_gradient.qoi" }; -static void player_model_register(void) +static int player_model_init(void) { shader_viewchar_register(); + + if( vg_acquire_thread_sync(1) ) + { + vg_tex2d_init( (vg_tex2d *[]){ &tex_characters }, 1 ); + vg_release_thread_sync(1); + return 1; + } + else + return 0; } -static void player_model_init(void) +static void player_model_free(void *_) { - vg_tex2d_init( (vg_tex2d *[]){ &tex_characters }, 1 ); + vg_tex2d_free( (vg_tex2d *[]){ &tex_characters }, 1 ); } - /* * Load model from file (.mdl) */ @@ -37,7 +45,9 @@ static int player_load_model( const char *name ) struct player_model *mdl = &player.mdl; - mdl_unpack_glmesh( src, &mdl->mesh ); + if( !mdl_unpack_glmesh( src, &mdl->mesh ) ) + goto il_free_err; + skeleton_setup( &mdl->sk, src ); /*