Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IMaterial* create_material_galaxy(bool ignorez, bool lit, bool wireframe)
- {
- static auto created = 0;
- std::string type = lit ? "VertexLitGeneric" : "UnlitGeneric";
- auto matdata =
- "\"" + type + "\"\
- \n{\
- \n\t\"$basetexture\" \"dev/zone_warning proxies { texturescroll { texturescrollvar $basetexturetransform texturescrollrate 0.6 texturescrollangle 90 } } }\"\
- \n\t\"$envmap\" \"editor/cube_vertigo\"\
- \n\t\"$envmapcontrast\" \"1\"\
- \n\t\"$envmaptint\" \"[.6 .6 .6]\"\
- \n\t\"$model\" \"1\"\
- \n\t\"$normalmapalphaenvmapmask\" \"1\"\
- \n\t\"$envmapcontrast\" \"1\"\
- \n\t\"$flat\" \"1\"\
- \n\t\"$nocull\" \"0\"\
- \n\t\"$selfillum\" \"1\"\
- \n\t\"$halflambert\" \"1\"\
- \n\t\"$nofog\" \"0\"\
- \n\t\"$ignorez\" \"" + std::to_string(ignorez) + "\"\
- \n\t\"$znearer\" \"0\"\
- \n\t\"$wireframe\" \"" + std::to_string(wireframe) + "\"\
- \n}\n";
- auto matname = "custom_" + std::to_string(created);
- ++created;
- 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, type.c_str());
- load_from_buffer(key_values, matname.c_str(), matdata.c_str());
- return g_pMaterialSys->CreateMaterial(matname.c_str(), key_values);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement