X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_gen.h;h=49ea4953480bb8b3455c3a2ce1dc2ce70cf833ce;hb=d00b1df8f80e4714dc2f9aa2189d242bb4d09a2f;hp=d9037c9191fb0e97eb2e59cf5bf8f7c5be9c6ee4;hpb=c2d67378dd5c82de50b8fbbbe222ec6be2da4eee;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_gen.h b/world_gen.h index d9037c9..49ea495 100644 --- a/world_gen.h +++ b/world_gen.h @@ -1,8 +1,16 @@ +/* + * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved + */ + #ifndef WORLD_GEN_H #define WORLD_GEN_H -#include "world.h" +/* + * FUTURE: + * If we have multiple levels, write an unloader + */ +#include "world.h" static void world_add_all_if_material( m4x3f transform, scene *pscene, mdl_header *mdl, u32 id ) @@ -87,7 +95,7 @@ static void world_apply_procedural_foliage(void) } } - free( mfoliage ); + vg_free( mfoliage ); } static void world_load(void) @@ -129,17 +137,13 @@ static void world_load(void) if( sm ) { - - if( vg_acquire_thread_sync(1) ) + vg_acquire_thread_sync(); { glmesh surf; - if( mdl_unpack_submesh( mworld, &surf, sm ) ) - { - water_set_surface( &surf, pnode->co[1] ); - } - - vg_release_thread_sync(1); + mdl_unpack_submesh( mworld, &surf, sm ); + water_set_surface( &surf, pnode->co[1] ); } + vg_release_thread_sync(); } } else if( pnode->classtype == k_classtype_car_path ) @@ -270,15 +274,9 @@ static void world_load(void) world_add_all_if_material( midentity, &world.geo,mworld,mat_vertex_blend); scene_copy_slice( &world.geo, &world.sm_geo_vb ); - if( vg_acquire_thread_sync(1) ) - { - if( !scene_upload( &world.geo ) ) - { - - } - - vg_release_thread_sync(1); - } + vg_acquire_thread_sync(); + scene_upload( &world.geo ); + vg_release_thread_sync(); scene_bh_create( &world.geo ); @@ -298,12 +296,9 @@ static void world_load(void) scene_copy_slice( &world.foliage, &world.sm_graffiti ); - if( vg_acquire_thread_sync(1) ) + vg_acquire_thread_sync(); { - if( !scene_upload( &world.foliage ) ) - { - - } + scene_upload( &world.foliage ); /* * Rendering the depth map @@ -360,17 +355,17 @@ static void world_load(void) winfo->g_water_fog = 0.04f; render_update_lighting_ub(); - - vg_release_thread_sync(1); } + vg_release_thread_sync(); + world_routes_loadfrom( mworld ); for( int i=0; i