void render_panel( ) {
if ( i::input->m_in_third_person ) {
// in third person render panel from local head
vec3_t screen_position {};
if ( i::debug_overlay->screen_position( screen_position, g_ctx.m_local_data.m_eye_pos ) )
return;
this->m_panel_position = std::lerp( this->m_panel_position, screen_position + vec3_t( 60.f, 20.f ), 8.f * i::global_vars->m_frmae_time );
render::add_image( this->m_panel_position, this->m_panel_texture, vec2_t( size.x, size.y ) );
}
else {
// in first person render panel from muzzle
vec3_t screen_position {};
if ( i::debug_overlay->screen_position( screen_position, g_ctx.m_local( ).get( )->get_muzzle_pos( ) ) )
return;
this->m_panel_position = std::lerp( this->m_panel_position, screen_position + vec3_t( 60.f, 20.f ), 8.f * i::global_vars->m_frmae_time );
render::add_image( this->m_panel_position, this->m_panel_texture, vec2_t( size.x, size.y ) );
}
}
void add_image( vec2_t pos, ImTexture texture, vec2_t size ) {
m_draw_list->AddImage( texture, ImVec2( pos.x, pos.y ), ImVec2( pos.x + size, pos.y + size ) );
}