+
+ /*
+ * Unpack the indices (if there are meshes)
+ * ---------------------------------------------------------
+ */
+
+ if( mdl_arrcount( &mdl->submeshs ) ){
+ mdl_submesh *sm = mdl_arritm( &mdl->submeshs, 0 );
+ u32 offset = sm->vertex_count;
+
+ for( u32 i=1; i<mdl_arrcount( &mdl->submeshs ); i++ ){
+ mdl_submesh *sm = mdl_arritm( &mdl->submeshs, i );
+ u32 *indices = job->indices + sm->indice_start;
+
+ for( u32 j=0; j<sm->indice_count; j++ )
+ indices[j] += offset;
+
+ offset += sm->vertex_count;
+ }
+ }
+
+ /*
+ * Dispatch
+ * -------------------------
+ */
+
+ vg_async_dispatch( call, async_mdl_load_glmesh );
+ }
+ else{
+ vg_fatal_error( "no vertex/indice data\n" );
+ }
+}
+
+/* uploads the glmesh, and textures. everything is saved into the mdl_context */
+static void mdl_async_full_load_std( mdl_context *mdl ){
+ mdl_async_load_glmesh( mdl, &mdl->mesh, NULL );
+
+ for( u32 i=0; i<mdl_arrcount( &mdl->textures ); i ++ ){
+ vg_linear_clear( vg_mem.scratch );
+ mdl_texture *tex = mdl_arritm( &mdl->textures, i );
+
+ void *data = vg_linear_alloc( vg_mem.scratch, tex->file.pack_size );
+ mdl_fread_pack_file( mdl, &tex->file, data );
+
+ vg_tex2d_load_qoi_async( data, tex->file.pack_size,
+ VG_TEX2D_CLAMP|VG_TEX2D_NEAREST, &tex->glname );