Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < g_Options.hands.layers; i++) {
- if (!g_Options.hands.layer[i].enabled)
- continue;
- // has our material been created yet?
- IMaterial* material = GetMat(g_Options.hands.layer[i].mat, i);
- if (!material) {
- // before we exit, we need to safely generate this material so this won't happen again
- return;
- }
- // COLOR
- if (g_Options.hands.layer[i].mat != 2) { // mat type != 2 then
- material->ColorModulate( // normal colour modulate the material
- g_Options.hands.layer[i].r,
- g_Options.hands.layer[i].g,
- g_Options.hands.layer[i].b);
- }
- else { // otherwise
- static bool IsGood = false; // Could the variable be found?
- static auto envmaptints = material->FindVar("$envmaptint", &IsGood); // Search for the material's variable
- if (IsGood) {
- envmaptints->SetVecValue(Vector( // Set the r g b values of the environment map tiny
- int(g_Options.hands.layer[i].r * 255),
- int(g_Options.hands.layer[i].g * 255
- int(g_Options.hands.layer[i].b * 255)));
- }
- else {
- // Error handling for a person with a debugger (where X is the mat name etc)
- OutputDebugString(L"Couldn't find material X");
- }
- }
- // ALPHA
- static float alpha;
- if (!g_Options.hands.layer[i].pulse) alpha = g_Options.hands.layer[i].a;
- if (g_Options.hands.layer[i].pulse) {
- static bool reverse; // Should flip alpha ticker?
- if (reverse) alpha -= g_Options.hands.layer[i].p_speed; //
- if (!reverse) alpha += g_Options.hands.layer[i].p_speed; //
- if (alpha > g_Options.hands.layer[i].p_max) reverse = true; // Has the alpha value hit the max?
- if (alpha < g_Options.hands.layer[i].p_min) reverse = false; // Has the alpha value hit the min?
- }
- material->AlphaModulate(alpha);
- /* ===============
- I believe the issues
- */ ===============
- // Force the material to be used
- g_MdlRender->ForcedMaterialOverride(material);
- // Render the mesh with our forced material
- fnDME(g_MdlRender, ctx, state, info, matrix);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement