Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/renderer/RenderingOptions.h
Show All 39 Lines | |||||
}; | }; | ||||
struct RenderPathEnum | struct RenderPathEnum | ||||
{ | { | ||||
static RenderPath FromString(const CStr8& name); | static RenderPath FromString(const CStr8& name); | ||||
static CStr8 ToString(RenderPath); | static CStr8 ToString(RenderPath); | ||||
}; | }; | ||||
struct SRenderingOptions | class CRenderingOptions | ||||
{ | { | ||||
// The renderer needs access to our private variables directly because capabilities have not yet been extracted | // The renderer needs access to our private variables directly because capabilities have not yet been extracted | ||||
// and thus sometimes it needs to change the rendering options without the side-effects. | // and thus sometimes it needs to change the rendering options without the side-effects. | ||||
friend class CRenderer; | friend class CRenderer; | ||||
SRenderingOptions(); | public: | ||||
CRenderingOptions(); | |||||
~CRenderingOptions(); | |||||
void ReadConfig(); | void ReadConfig(); | ||||
#define OPTION_DEFAULT_SETTER(NAME, TYPE) \ | #define OPTION_DEFAULT_SETTER(NAME, TYPE) \ | ||||
public: void Set##NAME(TYPE value) { m_##NAME = value; }\ | public: void Set##NAME(TYPE value) { m_##NAME = value; }\ | ||||
#define OPTION_CUSTOM_SETTER(NAME, TYPE) \ | #define OPTION_CUSTOM_SETTER(NAME, TYPE) \ | ||||
public: void Set##NAME(TYPE value);\ | public: void Set##NAME(TYPE value);\ | ||||
Show All 40 Lines | OPTION_CUSTOM_SETTER(NAME, TYPE); OPTION_GETTER(NAME, TYPE); OPTION_DEF(NAME, TYPE); | ||||
OPTION(RenderActors, bool); | OPTION(RenderActors, bool); | ||||
#undef OPTION_DEFAULT_SETTER | #undef OPTION_DEFAULT_SETTER | ||||
#undef OPTION_CUSTOM_SETTER | #undef OPTION_CUSTOM_SETTER | ||||
#undef OPTION_GETTER | #undef OPTION_GETTER | ||||
#undef OPTION_DEF | #undef OPTION_DEF | ||||
#undef OPTION | #undef OPTION | ||||
#undef OPTION_WITH_SIDE_EFFECT | #undef OPTION_WITH_SIDE_EFFECT | ||||
private: | |||||
/** | |||||
* Registers a config hook for config variable @name that updates @variable. | |||||
* Also immediately updates variable with the value of the config. | |||||
*/ | |||||
template<typename T> | |||||
void SetupConfig(CStr8 name, T& variable); | |||||
/** | |||||
* Registers a config hook for config variable @name. | |||||
* Also immediately triggers the hook. | |||||
*/ | |||||
void SetupConfig(CStr8 name, std::function<void()> hook); | |||||
class ConfigHooks; | |||||
std::unique_ptr<ConfigHooks> m_ConfigHooks; // Hide this via PImpl to avoid including ConfigDB.h here. | |||||
}; | }; | ||||
extern SRenderingOptions g_RenderingOptions; | extern CRenderingOptions g_RenderingOptions; | ||||
#endif // INCLUDED_RENDERINGOPTIONS | #endif // INCLUDED_RENDERINGOPTIONS |
Wildfire Games · Phabricator