X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=model.c;h=19f45f2d0466c8d3c55e1aca8160595b6e242431;hb=refs%2Fheads%2Fmaster;hp=9b704cd0df2196b4ccc556237dbd25cf1b5fa2a3;hpb=304647a7672165dd35ffe54884ed9aedcc9bf363;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/model.c b/model.c index 9b704cd..19f45f2 100644 --- a/model.c +++ b/model.c @@ -5,15 +5,18 @@ #pragma once #include "vg/vg_io.h" + +#ifndef C0_STOPGAP #include "vg/vg_async.h" #include "vg/vg_tex.h" +#endif #include "vg/vg_msg.h" #include "vg/vg_string.h" #include #include #include #include "model.h" -#include "render.h" +#include "shader_props.h" static void mdl_load_fatal_corrupt( mdl_context *mdl ) { @@ -81,7 +84,8 @@ static void mdl_load_array_file( mdl_context *mdl, mdl_array_ptr *ptr, if( arr->item_count ) { u32 size = stride*arr->item_count; - ptr->data = vg_linear_alloc( lin_alloc, vg_align8(size) ); + ptr->data = lin_alloc? vg_linear_alloc( lin_alloc, vg_align8(size) ): + malloc( size ); mdl_load_array_file_buffer( mdl, arr, ptr->data, stride ); } else @@ -283,6 +287,9 @@ int mdl_load_materials( mdl_context *mdl, void *lin_alloc ) mdl_array_ptr data; _mdl_load_array( mdl, &data, "shader_data", vg_mem.scratch, 1 ); + if( !lin_alloc ) + return 1; + for( u32 i=0; imaterials); i ++ ) { mdl_material *mat = mdl_arritm( &mdl->materials, i ); @@ -409,6 +416,7 @@ int mdl_pstreq( mdl_context *mdl, u32 pstr, const char *str, u32 djb2 ) * ---------------------------------------------------------------------------- */ +#ifndef C0_STOPGAP static void mesh_upload( glmesh *mesh, mdl_vert *verts, u32 vert_count, u32 *indices, u32 indice_count ) @@ -494,6 +502,7 @@ void mdl_draw_submesh( mdl_submesh *sm ) { mesh_drawn( sm->indice_start, sm->indice_count ); } +#endif mdl_mesh *mdl_find_mesh( mdl_context *mdl, const char *name ) { @@ -518,6 +527,7 @@ mdl_submesh *mdl_find_submesh( mdl_context *mdl, const char *mesh_name ) return mdl_arritm( &mdl->submeshs, mesh->submesh_start ); } +#ifndef C0_STOPGAP struct payload_glmesh_load { mdl_vert *verts; @@ -629,3 +639,4 @@ void mdl_async_full_load_std( mdl_context *mdl ) VG_TEX2D_CLAMP|VG_TEX2D_NEAREST, &tex->glname ); } } +#endif