X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=world_render.c;h=1b1a9c08399d1d68020c58e37d673e18dc5748a2;hb=b440efbe5785d114d08bb3f5ec0e09cad943006d;hp=029a95f62e5f0279ba88004482a023acee683b20;hpb=5f6a4f9df6c8accc89f1920bfe9ace3cbac4c4b6;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_render.c b/world_render.c index 029a95f..1b1a9c0 100644 --- a/world_render.c +++ b/world_render.c @@ -10,6 +10,7 @@ #include "ent_miniworld.h" #include "player_remote.h" #include "ent_skateshop.h" +#include "ent_npc.h" #include "shaders/model_entity.h" struct world_render world_render; @@ -886,13 +887,16 @@ void world_prerender( world_instance *world ) sizeof(struct ub_world_lighting), &world->ub_lighting ); } -static void render_other_entities( world_instance *world, vg_camera *cam ){ +static void render_other_entities( world_instance *world, vg_camera *cam ) +{ f32 radius = 40.0f; bh_iter it; bh_iter_init_range( 0, &it, cam->pos, radius+10.0f ); u32 glider_list[4], - glider_count = 0; + glider_count = 0, + npc_list[4], + npc_count = 0; i32 idx; while( bh_next( world->entity_bh, &it, &idx ) ){ @@ -900,20 +904,26 @@ static void render_other_entities( world_instance *world, vg_camera *cam ){ type = mdl_entity_id_type( id ), index = mdl_entity_id_id( id ); - if( type == k_ent_glider ) { + if( type == k_ent_glider ) + { if( glider_count < vg_list_size(glider_list) ) glider_list[ glider_count ++ ] = index; } + else if( type == k_ent_npc ) + { + if( npc_count < vg_list_size(npc_list) ) + npc_list[ npc_count ++ ] = index; + } } shader_model_entity_use(); shader_model_entity_uTexMain( 0 ); shader_model_entity_uCamera( cam->transform[3] ); shader_model_entity_uPv( cam->mtx.pv ); - WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, model_entity ); - for( u32 j=0; jent_glider, glider_list[j] ); if( !(glider->flags & 0x1) ) @@ -928,6 +938,14 @@ static void render_other_entities( world_instance *world, vg_camera *cam ){ render_glider_model( cam, world, mdl, k_board_shader_entity ); } + + for( u32 j=0; jent_npc, npc_list[j] ); + npc_update( npc ); + npc_render( npc, world, cam ); + } } void render_world( world_instance *world, vg_camera *cam,