I am writing a game engine for Linux. It has a sufficiently large number of effects that can be turned on / off. Effects are defined before compiling with
#ifdef. But the problem is that I literally have to “wrap” each variable in
#ifdef. Another problem is that when adding new effects, I have to rewrite the conditions, since one variable can refer to several effects at once. For example:
#if defined ALGINE_LIGHTING_MODE_ENABLED || defined ALGINE_SHADOW_MAPPING_MODE_ENABLED uniform vec3 viewPos; // Camera position #endif #ifdef ALGINE_DOF_MODE_ENABLED uniform float focalDepth; uniform float focalRange; #endif
How could I reduce the amount of re-write needed when adding new effects?