#include "player_render.h"
#include "network_common.h"
#include "addon.h"
+#include "font.h"
+#include "gui.h"
static void player_remote_clear( struct network_player *player ){
addon_cache_unwatch( k_addon_type_player, player->playermodel_view_slot );
}
static void remote_player_nametag( m4x4f pv, v3f co, const char *name ){
+ return;
vg_ui.font = &vg_ui_font_big;
v4f wpos;
v3_copy( co, wpos );
* Draw remote players
*/
static void render_remote_players( world_instance *world, camera *cam ){
-
SDL_AtomicLock( &addon_system.sl_cache_using_resources );
for( u32 i=0; i<NETWORK_MAX_PLAYERS; i ++ ){
SDL_AtomicUnlock( &addon_system.sl_cache_using_resources );
}
+static void render_remote_player_nametag( v3f co, const char *name ){
+ m4x3f mlocal;
+ m4x3_identity( mlocal );
+ mlocal[3][0] -= font3d_string_width( 2, name ) * 0.5f;
+
+ m4x3f mmdl;
+ m3x3_identity( mmdl );
+ for( int i=0; i<3; i++ )
+ v3_muls( skaterift.cam.mtx.v[i], 0.2f, mmdl[i] );
+ m3x3_transpose( mmdl, mmdl );
+ v3_add( co, (v3f){0.0f,2.0f,0.0f}, mmdl[3] );
+
+ m4x3_mul( mmdl, mlocal, mmdl );
+ font3d_simple_draw( 2, name, &skaterift.cam, mmdl );
+}
+
+static void render_remote_players_tags( world_instance *world, camera *cam ){
+ glEnable(GL_BLEND);
+ glEnable(GL_DEPTH_TEST);
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glBlendEquation(GL_FUNC_ADD);
+
+ font3d_bind( &gui.font, k_font_shader_default, 1, NULL, &skaterift.cam );
+ font3d_setcolour( (v4f){1.0f,1.0f,1.0f,1.0f} );
+
+ render_remote_player_nametag(
+ localplayer.final_mtx[0][3],
+ steam_username_at_startup );
+
+ for( u32 i=0; i<NETWORK_MAX_PLAYERS; i ++ ){
+ struct network_player *player = &netplayers.list[i];
+ if( !player->active ) continue;
+ if( player->active_world != world ) continue;
+
+ struct player_avatar *av = localplayer.playeravatar;
+ render_remote_player_nametag(
+ netplayers.final_mtx[av->sk.bone_count*i][3],
+ player->username );
+ }
+
+ glDisable(GL_BLEND);
+}
+
static void remote_players_init(void){
for( u32 i=0; i<NETWORK_SFX_QUEUE_LENGTH; i ++ ){
netplayers.sfx_queue[i].system = k_player_subsystem_invalid;