forked from shadeMe/shadeMe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShadowFigures.h
93 lines (70 loc) · 2.3 KB
/
ShadowFigures.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
#pragma once
#include "shadeMeInternals.h"
namespace ShadowFigures
{
class ShadowRenderConstantRegistry;
class ShadowRenderConstant
{
friend class ShadowRenderConstantRegistry;
typedef std::vector<UInt32> PatchLocationListT;
union DataT
{
float f;
long double d;
};
DataT Data;
DataT Default;
bool Wide; // when set, use Data.d. Data.f otherwise
PatchLocationListT PatchLocations;
std::string Name;
void ApplyPatch(void) const;
public:
ShadowRenderConstant(const char* Name, bool Wide, long double DefaultValue, UInt32 PrimaryPatchLocation);
~ShadowRenderConstant();
void AddPatchLocation(UInt32 Location);
void SetValue(long double NewValue);
long double GetValue(void) const;
void ResetDefault(void);
};
class ShadowRenderConstantRegistry
{
struct ValuePair
{
long double Interior;
long double Exterior;
};
typedef std::map<ShadowRenderConstant*, ValuePair> ConstantValueTableT;
static const char* kINIPath;
ConstantValueTableT DataStore;
ShadowRenderConstantRegistry();
void Save(void); // saves the values to the INI file
public:
~ShadowRenderConstantRegistry();
static ShadowRenderConstantRegistry* GetSingleton(void);
void Initialize(void);
void Load(void); // loads the values for the INI file
void Register(ShadowRenderConstant* Constant);
void UpdateConstants(void); // switches b'ween the two sets of values depending upon the cell type
};
class ShadowRenderConstantHotSwapper
{
class Swapper
{
ShadowRenderConstant* Source;
long double OldValue;
bool Reset;
public:
Swapper(ShadowRenderConstant* Constant);
~Swapper();
void Swap(long double NewValue);
};
public:
static void __stdcall HandleLightProjectionStage(ShadowSceneLight* Source, void* AuxParam);
static void __stdcall HandleShadowMapRenderStage(ShadowSceneLight* Source, void* AuxParam);
};
_DeclareMemHdlr(SwapLightProjectionStageConstants, "per-caster shadow render constants");
_DeclareMemHdlr(FixSSLLightSpaceProjectionStack, "fixup the stack");
_DeclareMemHdlr(SwapShadowMapRenderStageConstants, "");
void Patch(void);
void Initialize(void);
}