-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnightmode.h
42 lines (33 loc) · 883 Bytes
/
nightmode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "includes.h"
#include "SDK/IMaterial.h"
class MaterialBackup {
public:
SDK::MaterialHandle_t handle;
SDK::IMaterial* material;
float color[3];
float alpha;
bool translucent;
bool nodraw;
MaterialBackup() {
}
MaterialBackup(SDK::MaterialHandle_t h, SDK::IMaterial* p) {
handle = handle;
material = p;
material->GetColorModulation(&color[0], &color[1], &color[2]);
alpha = material->GetAlphaModulation();
}
void restore() {
material->ColorModulate(color[0], color[1], color[2]);
material->AlphaModulate(alpha);
material->SetMaterialVarFlag(SDK::MATERIAL_VAR_TRANSLUCENT, translucent);
material->SetMaterialVarFlag(SDK::MATERIAL_VAR_NO_DRAW, nodraw);
}
};
class nightmode {
public:
void clear_stored_materials();
void modulate(SDK::MaterialHandle_t i, SDK::IMaterial *material, bool backup);
void apply();
void remove();
};