From 254d76308dc12891c65b8fb5d5edae7152164e9a Mon Sep 17 00:00:00 2001 From: hgn Date: Mon, 27 Nov 2023 13:57:12 +0000 Subject: [PATCH] render placeholder boards at store --- ent_skateshop.c | 31 +++++++++++++++++++++++++++++++ ent_skateshop.h | 1 + world_entity.c | 6 ++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ent_skateshop.c b/ent_skateshop.c index ec32694..da8a0d3 100644 --- a/ent_skateshop.c +++ b/ent_skateshop.c @@ -726,6 +726,37 @@ static void skateshop_render( ent_skateshop *shop ){ vg_fatal_error( "Unknown store (%u)\n", shop->type ); } +static void skateshop_render_nonfocused( world_instance *world, camera *cam ){ + for( u32 j=0; jent_skateshop ); j ++ ){ + ent_skateshop *shop = mdl_arritm(&world->ent_skateshop, j ); + + if( shop->type != k_skateshop_type_boardshop ) continue; + + f32 dist2 = v3_dist2( cam->pos, shop->transform.co ), + maxdist = 50.0f; + + if( dist2 > maxdist*maxdist ) continue; + ent_marker *mark_rack = mdl_arritm( &world->ent_marker, + mdl_entity_id_id(shop->boards.id_rack)); + + u32 slot_count = vg_list_size(global_skateshop.shop_view_slots); + for( u32 i=0; itransform, &xform, &xform ); + + struct player_board_pose pose = {0}; + m4x3f mmdl; + mdl_transform_m4x3( &xform, mmdl ); + render_board( cam, world, board, mmdl, &pose, k_board_shader_entity ); + } + } +} + static void ent_skateshop_helpers_pickable( const char *acceptance ){ vg_str text; diff --git a/ent_skateshop.h b/ent_skateshop.h index d39e3d9..455c61d 100644 --- a/ent_skateshop.h +++ b/ent_skateshop.h @@ -49,5 +49,6 @@ static global_skateshop={ static void ent_skateshop_preupdate( ent_skateshop *shop, int active ); static void skateshop_render( ent_skateshop *shop ); +static void skateshop_render_nonfocused( world_instance *world, camera *cam ); #endif /* ENT_SKATESHOP_H */ diff --git a/world_entity.c b/world_entity.c index 04bbec9..947a3bd 100644 --- a/world_entity.c +++ b/world_entity.c @@ -81,12 +81,14 @@ static void world_entity_focus_preupdate(void){ /* additional renderings like text etc.. */ static void world_entity_focus_render(void){ - if( skaterift.activity != k_skaterift_ent_focus ) + world_instance *world = world_current_instance(); + if( skaterift.activity != k_skaterift_ent_focus ){ + skateshop_render_nonfocused( world, &skaterift.cam ); return; + } u32 type = mdl_entity_id_type( world_static.focused_entity ), index = mdl_entity_id_id( world_static.focused_entity ); - world_instance *world = world_current_instance(); if( type == k_ent_skateshop ){ ent_skateshop *skateshop = mdl_arritm( &world->ent_skateshop, index ); -- 2.25.1