Hook DrawModelExecute.
These classes are usefull
Code:
IMaterial
IMaterialSystem
IVModelRender
IVModelInfoClient
Example hook: (Wireframe hands)
Code:
namespace DrawModelExecute
{
typedef void(__thiscall* DrawModelExecuteFn)(void*,IMatRenderContext*, const DrawModelState_t&, const ModelRenderInfo_t&, matrix3x4_t*);
void __fastcall DrawModelExecute_Hooked(void* ecx, void* edx, IMatRenderContext* pMatRenderContext, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* pCustomBoneToWorld)
{
if (pEngineClient->IsInGame() && pLocal)
{
std::string ModelName = pModelInfo->GetModelName(info.pModel);
if (MenuObjects::WireframeArms.Get())
{
if (strstr(ModelName.c_str(), "arms"))
{
IMaterial* pArms = pMaterialSystem->FindMaterial(ModelName.c_str(), TEXTURE_GROUP_MODEL);
pArms->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, true);
pModelRender->ForcedMaterialOverride(pArms);
}
}
}
pModelRenderHook->GetOriginal<DrawModelExecuteFn>(21)(ecx, pMatRenderContext, state, info, pCustomBoneToWorld);
}
What's the material btw?