Advertisement
encoree1996

Untitled

Jan 6th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. if (engine->IsInGame() && engine->IsConnected())// && !engine->IsTransitioningToLoad())
  2. {//Asus walls test
  3. float fAsusPower = (float)((float)g_Ikaros.m_pConvars->GetConVar(XOR2("asus_walls"))->GetInt() / 100.0f);
  4. static float fAsusPower2 = 0.0f;
  5. bool bNoSky = g_Ikaros.m_pConvars->GetConVar(XOR2("no_sky"))->GetBool();
  6. static bool bNoSky2 = false;
  7. if (fAsusPower != fAsusPower2)
  8. {
  9. fAsusPower2 = fAsusPower;
  10. bMaterials = false;
  11. }
  12. if (bNoSky != bNoSky2)
  13. {
  14. bNoSky2 = bNoSky;
  15. bMaterials = false;
  16. }
  17. static std::vector<IMaterial*> bTranscluent;
  18. if (!bMaterials)
  19. {
  20. bTranscluent.clear();
  21. bMaterials = true;
  22. for (MaterialHandle_t handle = materials->FirstMaterial(); handle != materials->InvalidMaterial(); handle = materials->NextMaterial(handle))
  23. {
  24. IMaterial* Mat = materials->GetMaterial(handle);
  25. if (!Mat || Mat->IsErrorMaterial())
  26. continue;
  27. if (strstr(Mat->GetTextureGroupName(), TEXTURE_GROUP_WORLD))
  28. {
  29. Mat->AlphaModulate(fAsusPower);
  30. if (fAsusPower < 1.0f)
  31. {
  32. if (Mat->IsTranslucent())
  33. bTranscluent.push_back(Mat);
  34. Mat->SetMaterialVarFlag(MATERIAL_VAR_TRANSLUCENT, true);
  35. }
  36. else
  37. {
  38. Mat->SetMaterialVarFlag(MATERIAL_VAR_TRANSLUCENT, false);
  39. }
  40. }
  41. else if (strstr(Mat->GetTextureGroupName(), TEXTURE_GROUP_SKYBOX) || strstr(Mat->GetTextureGroupName(), TEXTURE_GROUP_CUBE_MAP))
  42. {
  43. if (bNoSky)
  44. Mat->ColorModulate(0.0f, 0.0f, 0.0f);
  45. else
  46. Mat->ColorModulate(1.0f, 1.0f, 1.0f);
  47. }
  48. }
  49. if (fAsusPower == 1.0f)
  50. {
  51. for (int i = 0; i < bTranscluent.size(); i++)
  52. {
  53. bTranscluent[i]->SetMaterialVarFlag(MATERIAL_VAR_TRANSLUCENT, true);
  54. }
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement