void Chams::RenderPlayer(Player* player) {
// prevent recruisive model cancelation.
m_running = true;
// restore.
g_csgo.m_studio_render->ForcedMaterialOverride(nullptr);
g_csgo.m_render_view->SetColorModulation(colors::white);
g_csgo.m_render_view->SetBlend(1.f);
// this is the local player.
// we always draw the local player manually in drawmodel.
if (player->m_bIsLocalPlayer()) {
// render the fake model.
RenderFakeChams();
if (g_menu.main.players.blend_if_scoped.get() && player->m_bIsScoped())
SetAlpha(1.f - (g_menu.main.players.blend_amount.get() / 100.f));
else if (g_menu.main.players.chams_local.get()) {
Color color = g_menu.main.players.chams_local_color.get();
SetAlpha(g_menu.main.players.chams_local_alpha.get() / 100.f);
// set material and color.
//SetupMaterial( g_cfg[ XOR( "esp_chams_local_material" ) ].get<int>( ) == 0 ? debugambientcube : debugdrawflat, color, false );
switch (g_menu.main.players.chams_local_material.get()) {
case 0:
break;
case 1: SetupMaterial(g_chams.debugambientcube, color, false);
break;
case 2: SetupMaterial(g_chams.debugdrawflat, color, false);
break;
case 3: SetupMaterial(g_chams.glowarmsrace, color, false);
break;
case 4: SetupMaterial(g_chams.esoglow, color, false);
break;
case 5: SetupMaterial(g_chams.glass, color, false);
break;
case 6: SetupMaterial(g_chams.crystal, color, false);
break;
}
c_material_var* tint = g_chams.esoglow->find_var(XOR("$envmaptint"));
c_material_var* tint2 = g_chams.glowarmsrace->find_var(XOR("$envmaptint"));
c_material_var* tint3 = g_chams.glass->find_var(XOR("$envmaptint"));
c_material_var* tint4 = g_chams.crystal->find_var(XOR("$envmaptint"));
if (tint)
tint->set_vector(vec3_t(color.r() / 255.f, color.g() / 255.f, color.b() / 255.f));
if (tint2)
tint2->set_vector(vec3_t(color.r() / 255.f, color.g() / 255.f, color.b() / 255.f));
if (tint3)
tint3->set_vector(vec3_t(color.r() / 255.f, color.g() / 255.f, color.b() / 255.f));
if (tint4)
tint4->set_vector(vec3_t(color.r() / 255.f, color.g() / 255.f, color.b() / 255.f));
SetAlpha(g_menu.main.players.chams_local_alpha.get() / 100.f);
}
// manually draw the model.
player->DrawModel();
}