3 #include <Core/Utils/Index.hpp>
4 #include <Engine/RaEngine.hpp>
6 #include <Engine/Data/ShaderConfiguration.hpp>
17 class ShaderParameterProvider;
25 enum DefaultRenderingPasses :
int {
37 LIGHTING_OPAQUE = DEFAULT_PASS,
79 Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE );
87 hasConfiguration( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE )
const;
94 setConfiguration( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE );
101 clearConfiguration( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE );
109 getConfiguration( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE )
const;
117 getShader( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE )
const;
127 void setParametersProvider( std::shared_ptr<Data::ShaderParameterProvider> provider,
128 Core::Utils::Index pass = Core::Utils::Index( -1 ) );
136 Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE )
const;
148 inline bool isDirty( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE )
const;
154 inline void setDirty( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE );
160 inline void clearDirty( Core::Utils::Index pass = DefaultRenderingPasses::LIGHTING_OPAQUE );
167 void addPassProperties(
const std::list<std::string>& props,
168 Core::Utils::Index pass = Core::Utils::Index {} );
180 static constexpr
int s_maxNbPasses { 32 };
183 using PassConfiguration = std::pair<Data::ShaderConfiguration, const Data::ShaderProgram*>;
185 using ConfigurationSet = std::array<PassConfiguration, s_maxNbPasses>;
187 using PassesParameters =
188 std::array<std::shared_ptr<Data::ShaderParameterProvider>, s_maxNbPasses>;
191 ConfigurationSet m_activePasses;
193 PassesParameters m_passesParameters;
196 Core::Utils::Index m_numActivePass;
200 unsigned int m_dirtyBits { 0xFFFFFFFF };
202 unsigned int m_setPasses { 0x00000000 };
208 namespace EngineRenderTechniques {
216 using DefaultTechniqueBuilder = std::function<void(
RenderTechnique& rt,
bool isTransparent )>;
221 RA_ENGINE_API
bool registerDefaultTechnique(
const std::string& name,
222 DefaultTechniqueBuilder builder );
227 RA_ENGINE_API
bool removeDefaultTechnique(
const std::string& name );
234 RA_ENGINE_API std::pair<bool, DefaultTechniqueBuilder>
235 getDefaultTechnique(
const std::string& name );
237 RA_ENGINE_API
bool cleanup();
246 return m_dirtyBits & ( 1 << pass );
254 m_dirtyBits |= ( 1 << pass );
258 m_dirtyBits &= ~( 1 << pass );
262 return m_setPasses & ( 1 << pass );
266 m_setPasses |= ( 1 << pass );
270 m_setPasses &= ~( 1 << pass );
275 return m_activePasses[pass].first;
void clearDirty(Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE)
void clearConfiguration(Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE)
const Data::ShaderConfiguration & getConfiguration(Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE) const
void setConfiguration(const Data::ShaderConfiguration &newConfig, Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE)
bool hasConfiguration(Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE) const
bool isDirty(Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE) const
void setDirty(Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE)