X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=scene.h;h=acfc56b95c501dba14a0ecf456fcf6e63973e50d;hb=c2d67378dd5c82de50b8fbbbe222ec6be2da4eee;hp=8754d00985ba6f1a22af9a42b423bbf736c6b790;hpb=1740c935bfdacc65c5c7e4bb95fba1ada1f7118a;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/scene.h b/scene.h index 8754d00..acfc56b 100644 --- a/scene.h +++ b/scene.h @@ -84,25 +84,6 @@ static void scene_init( scene *pscene ) #endif } -static void *buffer_reserve( void *buffer, u32 count, u32 *cap, u32 amount, - size_t emsize ) -{ - if( count+amount > *cap ) - { - *cap = VG_MAX( (*cap)*2, (*cap)+amount ); - - return realloc( buffer, (*cap) * emsize ); - } - - return buffer; -} - -static void *buffer_fix( void *buffer, u32 count, u32 *cap, size_t emsize ) -{ - *cap = count; - return realloc( buffer, (*cap) * emsize ); -} - /* * Append a model into the scene with a given transform */ @@ -199,15 +180,21 @@ static void scene_fix( scene *pscene ) &pscene->indice_cap, sizeof( mdl_vert )); } -static void scene_upload( scene *pscene ) +__attribute__((warn_unused_result)) +static int scene_upload( scene *pscene ) { - mesh_upload( &pscene->mesh, + if( ! mesh_upload( &pscene->mesh, pscene->verts, pscene->vertex_count, - pscene->indices, pscene->indice_count ); + pscene->indices, pscene->indice_count ) ) + { + return 0; + } vg_info( "Scene upload\n" ); vg_info( " indices:%u\n", pscene->indice_count ); vg_info( " verts:%u\n", pscene->vertex_count ); + + return 1; } static void scene_bind( scene *pscene ) @@ -232,10 +219,6 @@ static void scene_free( scene *pscene ) /* TODO: bvh */ } -static void scene_register(void) -{ -} - /* * BVH implementation */