void draw_hit_matrix()
{
if (!g_cl.m_local)
g_cl.m_Hitmatrix.clear();
if (g_cl.m_Hitmatrix.empty())
return;
if (!g_csgo.m_model_render)
return;
auto ctx = g_csgo.m_material_system->GetRenderContext();
if (!ctx)
return;
auto it = g_cl.m_Hitmatrix.begin();
while (it != g_cl.m_Hitmatrix.end()) {
if (!it->state.m_pModelToWorld || !it->state.m_pRenderable || !it->state.m_pStudioHdr || !it->state.m_pStudioHWData ||
!it->info.m_renderable || !it->info.m_model_to_world || !it->info.m_model) {
++it;
continue;
}
auto alpha = 1.0f;
auto delta = g_csgo.m_globals->m_realtime - it->time;
if (delta > 0.0f) {
alpha -= delta;
if (delta > 1.0f) {
it = g_cl.m_Hitmatrix.erase(it);
continue;
}
}
Color color = g_loser.player_esp.hitmatrix_color;
static IMaterial* material = g_csgo.m_material_system->FindMaterial(XOR("dev/glow_armsrace.vmt"), nullptr);
auto alpha_c = 1.0f;
g_csgo.m_render_view->SetBlend(alpha_c * alpha);
g_chams.SetColor(color, material);
c_material_var* tint = material->find_var(XOR("$envmaptint"));
if (tint)
tint->set_vector(vec3_t(color.r() / 255.f, color.g() / 255.f, color.b() / 255.f));
material->IncrementReferenceCount();
material->SetFlag(MATERIAL_VAR_IGNOREZ, false);
g_csgo.m_model_render->ForcedMaterialOverride(material);
g_csgo.m_model_render->DrawModelExecute(ctx, it->state, it->info, it->pBoneToWorld);
g_csgo.m_model_render->ForcedMaterialOverride(nullptr);
++it;
}
}