IMaterial* create_material1(bool shade, bool wireframe, bool ignorez, int rimlight_boost = 0) {
static const std::string material_name = "glowOverlay.vmt";
const std::string material_type = shade ? "VertexLitGeneric" : "UnlitGeneric";
std::string material_data;
material_data += "\"" + material_type + "\"\n{\n";
material_data += "\t\"$additive\" \"1\"\n";
material_data += "\t\"$envmap\" \"models/effects/cube_white\"\n";
material_data += "\t\"$envmapfresnelminmaxexp\" \"[0 1 2]\"\n";
//material_data += "\t\"$envmaptint\" \"[0 0.1 0.3]\"\n";
material_data += "\t\"$envmapfresnel\" \"1\"\n";
material_data += "\t\"$alpha\" \"0.8\"\n";
material_data += "\t\"$ignorez\" \"" + std::to_string(ignorez) + "\"\n";
material_data += "}\n";
auto init_key_values = [](KeyValuesv2* keyvalues, const char* key_name) -> void {
using InitKeyValues_t = void(__thiscall*)(void*, const char*);
static InitKeyValues_t InitKeyValuesEx = nullptr;
static auto pThis = *reinterpret_cast<DWORD**>(Utils::FindSignature("client_panorama.dll", "B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08") + 1);
if (!InitKeyValuesEx)
InitKeyValuesEx = *reinterpret_cast<InitKeyValues_t>(Utils::FindSignature("client_panorama.dll", "55 8B EC 51 33 C0 C7 45"));
InitKeyValuesEx(keyvalues, key_name);
};
auto load_from_buffer = [](KeyValuesv2* key_values, const char* resource_name, const char* buf, void* file_sys = nullptr, const char* path_id = nullptr, void* eval_sym_proc = nullptr, void* unk = nullptr) -> void {
using LoadFromBuffer_t = void(__thiscall*)(void*, const char*, const char*, void*, const char*, void*, void*);
static LoadFromBuffer_t LoadFromBufferEx = nullptr;
if (!LoadFromBufferEx)
LoadFromBufferEx = *reinterpret_cast<LoadFromBuffer_t>(Utils::FindSignature("client_panorama.dll", "55 8B EC 83 E4 F8 83 EC 34 53 8B 5D 0C 89"));
LoadFromBufferEx(key_values, resource_name, buf, file_sys, path_id, eval_sym_proc, unk);
};
auto* key_values = new KeyValuesv2();
init_key_values(key_values, material_type.c_str());
load_from_buffer(key_values, material_name.c_str(), material_data.c_str());
return g_pMaterialSys->CreateMaterial(material_name.c_str(), key_values);
}