-
Notifications
You must be signed in to change notification settings - Fork 2
/
Materials.h
117 lines (100 loc) · 3.54 KB
/
Materials.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
Syn's AyyWare Framework 2015
*/
#pragma once
#include "MiscDefinitions.h"
#include "ClientRecvProps.h"
#include "offsets.h"
#include "Vector.h"
#include "MiscClasses.h"
#include "Vector2D.h"
class IMaterial
{
public:
const char* GetName()
{
typedef const char*(__thiscall* oGetName)(PVOID);
return call_vfunc< oGetName >(this, Offsets::VMT::Material_GetName)(this);
}
void SetMaterialVarFlag(MaterialVarFlags_t flag, bool value)
{
typedef void(__thiscall* oSetMatFlag)(PVOID, MaterialVarFlags_t, bool);
return call_vfunc< oSetMatFlag >(this, Offsets::VMT::Material_SetMaterialVarFlag)(this, flag, value);
}
bool GetMaterialVarFlag(MaterialVarFlags_t flag)
{
typedef bool(__thiscall* oGetMatFlag)(PVOID, MaterialVarFlags_t);
return call_vfunc< oGetMatFlag >(this, Offsets::VMT::Material_GetMaterialVarFlag)(this, flag);
}
void AlphaModulate(float a)
{
typedef void(__thiscall* oAlphaModulate)(PVOID, float);
return call_vfunc< oAlphaModulate >(this, Offsets::VMT::Material_AlphaModulate)(this, a);
}
void ColorModulate(float r, float g, float b)
{
typedef void(__thiscall* oColorModulate)(PVOID, float, float, float);
return call_vfunc< oColorModulate >(this, Offsets::VMT::Material_ColorModulate)(this, r, g, b);
}
void IncrementReferenceCount(void)
{
typedef void(__thiscall* oIncrementReferenceCount)(PVOID);
return call_vfunc< oIncrementReferenceCount >(this, Offsets::VMT::Material_IncrementReferenceCount)(this);
}
};
class CMaterialSystem
{
public:
IMaterial* FindMaterial(char const* pMaterialName, const char *pTextureGroupName, bool complain = true, const char *pComplainPrefix = NULL)
{
typedef IMaterial*(__thiscall* oFindMaterial)(PVOID, char const*, char const*, bool, char const*);
return call_vfunc< oFindMaterial >(this, Offsets::VMT::MaterialSystem_FindMaterial)(this, pMaterialName, pTextureGroupName, complain, pComplainPrefix);
}
IMaterial* CreateMaterial(const char *pMaterialName, KeyValues *pVMTKeyValues)
{
typedef IMaterial* (__thiscall* oCreateMaterial)(PVOID, const char *, KeyValues*);
return call_vfunc<oCreateMaterial>(this, Offsets::VMT::MaterialSystem_CreateMaterial)(this, pMaterialName, pVMTKeyValues);
}
};
class IVModelRender
{
public:
void ForcedMaterialOverride(IMaterial *material, OverrideType_t type = OVERRIDE_NORMAL, int idk = NULL)
{
typedef void(__thiscall* Fn)(void*, IMaterial*, OverrideType_t, int);
return call_vfunc<Fn>(this, Offsets::VMT::ModelRender_ForcedMaterialOverride)(this, material, type, idk);
}
};
class CModelInfo
{
public:
int GetModelIndex(const char *name)
{
typedef int (__thiscall* oGetModelName)(PVOID, const char *);
return call_vfunc< oGetModelName >(this, 2)(this, name);
}
const char *GetModelName(const model_t *mod)
{
typedef const char *(__thiscall* oGetModelName)(PVOID, const model_t*);
return call_vfunc< oGetModelName >(this, Offsets::VMT::ModelInfo_GetModelName)(this, mod);
}
studiohdr_t *GetStudiomodel(const model_t *mod)
{
typedef studiohdr_t *(__stdcall* oGetStudiomodel)(const model_t*);
return call_vfunc< oGetStudiomodel >(this, Offsets::VMT::ModelInfo_GetStudiomodel)(mod);
}
};
class CVRenderView
{
public:
void SetBlend(float alpha)
{
typedef void(__thiscall* oDrawModelExecute)(PVOID, float);
return call_vfunc< oDrawModelExecute >(this, Offsets::VMT::RenderView_SetBlend)(this, alpha);
}
void SetColorModulation(float const* colors)
{
typedef void(__thiscall* oDrawModelExecute)(PVOID, float const*);
return call_vfunc< oDrawModelExecute >(this, Offsets::VMT::RenderView_SetColorModulation)(this, colors);
}
};