X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_gen.h;fp=world_gen.h;h=e8e9293ddcd6401addfbdf28a2177dddeede21b1;hb=89113e9bc9544336b5ac4f53696c3de2d30698a2;hp=3f574987d3335f24af95443ca459ec414ed1d331;hpb=1b522daa02f28128498b04def4d60b63e590d1f3;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_gen.h b/world_gen.h index 3f57498..e8e9293 100644 --- a/world_gen.h +++ b/world_gen.h @@ -196,6 +196,43 @@ VG_STATIC void world_generate( world_instance *world ) scene_copy_slice( world->scene_no_collide, &mat->sm_no_collide ); } + /* this FIXME TODO IMPORTANT is going here because need to write down. + * + * acuire_thread_sync; replace this with a buffer that you fill up with + * opengl loader commands in a seperate memory area. the operation blocks + * if the buffer is full, then those instructions get ran on the sync line. + * (start of the frame) + * + * also blocks if the other thread is executing the instructions, obviously. + * + * this prevents rapid context swaps between threads. + * + * guessing a 50mb loader buffer approx. + * + * TODO also: fadeout loading screen! + */ + + for( u32 i=0; ient_traffic ); i++ ){ + ent_traffic *vehc = mdl_arritm( &world->ent_traffic, i ); + + for( u32 j=0; jsubmesh_count; j++ ){ + mdl_submesh *sm = mdl_arritm( &world->meta.submeshs, + vehc->submesh_start+j ); + + if( sm->flags & k_submesh_flag_consumed ){ + continue; + } + + m4x3f identity; + m4x3_identity( identity ); + scene_add_mdl_submesh( world->scene_no_collide, &world->meta, + sm, identity ); + + scene_copy_slice( world->scene_no_collide, sm ); + sm->flags |= k_submesh_flag_consumed; + } + } + /* upload and free that */ vg_acquire_thread_sync(); { @@ -530,6 +567,13 @@ VG_STATIC void world_process_resources( world_instance *world ) world->textures = vg_linear_alloc( world->heap, vg_align8(sizeof(GLuint)*world->texture_count) ); + /* TODO FIXME IMPORTANT + * + * this is another area that would benefit from our load thread buffer idea. + * could get a stall if lots of textures, since its freading, we're locking + * the frame up from drawing based on that disk read!!! terrible! + */ + vg_acquire_thread_sync(); { /* error texture */ @@ -813,6 +857,7 @@ VG_STATIC void world_load( u32 index, const char *path ) mdl_load_array( meta, &world->ent_audio_clip,"ent_audio_clip", heap ); mdl_load_array( meta, &world->ent_audio, "ent_audio", heap ); mdl_load_array( meta, &world->ent_volume, "ent_volume", heap ); + mdl_load_array( meta, &world->ent_traffic, "ent_traffic", heap ); /* process resources from pack */ world_process_resources( world );