1 #include <Engine/Data/LambertianMaterial.hpp>
3 #include <Engine/Data/ShaderConfigFactory.hpp>
4 #include <Engine/Data/ShaderProgramManager.hpp>
5 #include <Engine/Data/TextureManager.hpp>
6 #include <Engine/RadiumEngine.hpp>
7 #include <Engine/Rendering/RenderTechnique.hpp>
14 static const std::string materialName {
"Lambertian" };
16 nlohmann::json LambertianMaterial::s_parametersMetadata = {};
25 auto resourcesRootDir { RadiumEngine::getInstance()->getResourcesDir() };
26 auto shaderProgramManager = RadiumEngine::getInstance()->getShaderProgramManager();
28 shaderProgramManager->addNamedString(
29 "/Lambertian.glsl", resourcesRootDir +
"Shaders/Materials/Lambertian/Lambertian.glsl" );
33 resourcesRootDir +
"Shaders/Materials/Lambertian/Lambertian.vert.glsl",
34 resourcesRootDir +
"Shaders/Materials/Lambertian/Lambertian.frag.glsl" );
40 resourcesRootDir +
"Shaders/Materials/Lambertian/Lambertian.vert.glsl",
41 resourcesRootDir +
"Shaders/Materials/Lambertian/LambertianZPrepass.frag.glsl" );
45 Rendering::EngineRenderTechniques::registerDefaultTechnique(
49 rt.
setConfiguration( *lightpass, Rendering::DefaultRenderingPasses::LIGHTING_OPAQUE );
53 rt.
setConfiguration( *zprepass, Rendering::DefaultRenderingPasses::Z_PREPASS );
61 Rendering::EngineRenderTechniques::removeDefaultTechnique( materialName );
65 auto& renderParameters = getParameters();
67 m_perVertexColor = renderParameters.getParameter<
bool>(
"material.perVertexColor" );
71 return s_parametersMetadata;
LambertianMaterial(const std::string &instanceName)
void updateFromParameters() override
Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParam...
static void unregisterMaterial()
nlohmann::json getParametersMetadata() const override
static void registerMaterial()
~LambertianMaterial() override
static void loadMetaData(nlohmann::json &destination)
Load the material parameter description.
Core::Utils::Color m_color
The base color of the material.
void setConfiguration(const Data::ShaderConfiguration &newConfig, Core::Utils::Index pass=DefaultRenderingPasses::LIGHTING_OPAQUE)
void addConfiguration(const ShaderConfiguration &config)
Core::Utils::optional< ShaderConfiguration > getConfiguration(const std::string &name)