Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. for (int i = 0; i < g_Options.hands.layers; i++) {
  2. if (!g_Options.hands.layer[i].enabled)
  3. continue;
  4.  
  5. // has our material been created yet?
  6. IMaterial* material = GetMat(g_Options.hands.layer[i].mat, i);
  7. if (!material) {
  8. // before we exit, we need to safely generate this material so this won't happen again
  9. return;
  10. }
  11.  
  12. // COLOR
  13. if (g_Options.hands.layer[i].mat != 2) { // mat type != 2 then
  14. material->ColorModulate( // normal colour modulate the material
  15. g_Options.hands.layer[i].r,
  16. g_Options.hands.layer[i].g,
  17. g_Options.hands.layer[i].b);
  18. }
  19. else { // otherwise
  20. static bool IsGood = false; // Could the variable be found?
  21. static auto envmaptints = material->FindVar("$envmaptint", &IsGood); // Search for the material's variable
  22. if (IsGood) {
  23. envmaptints->SetVecValue(Vector( // Set the r g b values of the environment map tiny
  24. int(g_Options.hands.layer[i].r * 255),
  25. int(g_Options.hands.layer[i].g * 255
  26. int(g_Options.hands.layer[i].b * 255)));
  27. }
  28. else {
  29. // Error handling for a person with a debugger (where X is the mat name etc)
  30. OutputDebugString(L"Couldn't find material X");
  31. }
  32. }
  33.  
  34. // ALPHA
  35. static float alpha;
  36. if (!g_Options.hands.layer[i].pulse) alpha = g_Options.hands.layer[i].a;
  37. if (g_Options.hands.layer[i].pulse) {
  38. static bool reverse; // Should flip alpha ticker?
  39. if (reverse) alpha -= g_Options.hands.layer[i].p_speed; //
  40. if (!reverse) alpha += g_Options.hands.layer[i].p_speed; //
  41. if (alpha > g_Options.hands.layer[i].p_max) reverse = true; // Has the alpha value hit the max?
  42. if (alpha < g_Options.hands.layer[i].p_min) reverse = false; // Has the alpha value hit the min?
  43. }
  44.  
  45. material->AlphaModulate(alpha);
  46.  
  47. /* ===============
  48. I believe the issues
  49. */ ===============
  50.  
  51. // Force the material to be used
  52. g_MdlRender->ForcedMaterialOverride(material);
  53.  
  54. // Render the mesh with our forced material
  55. fnDME(g_MdlRender, ctx, state, info, matrix);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement