1 #include <Engine/Data/PlainMaterial.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>
15 static const std::string materialName {
"Plain" };
17 nlohmann::json PlainMaterial::s_parametersMetadata = {};
26 auto resourcesRootDir { RadiumEngine::getInstance()->getResourcesDir() };
27 auto shaderProgramManager = RadiumEngine::getInstance()->getShaderProgramManager();
29 shaderProgramManager->addNamedString(
"/Plain.glsl",
30 resourcesRootDir +
"Shaders/Materials/Plain/Plain.glsl" );
34 resourcesRootDir +
"Shaders/Materials/Plain/Plain.vert.glsl",
35 resourcesRootDir +
"Shaders/Materials/Plain/Plain.frag.glsl" );
41 resourcesRootDir +
"Shaders/Materials/Plain/Plain.vert.glsl",
42 resourcesRootDir +
"Shaders/Materials/Plain/PlainZPrepass.frag.glsl" );
46 Rendering::EngineRenderTechniques::registerDefaultTechnique(
50 rt.
setConfiguration( *lightpass, Rendering::DefaultRenderingPasses::LIGHTING_OPAQUE );
53 rt.
setConfiguration( *zprepass, Rendering::DefaultRenderingPasses::Z_PREPASS );
61 Rendering::EngineRenderTechniques::removeDefaultTechnique(
"Plain" );
65 auto& renderParameters = getParameters();
67 m_perVertexColor = renderParameters.getParameter<
bool>(
"material.perVertexColor" );
71 return s_parametersMetadata;
nlohmann::json getParametersMetadata() const override
~PlainMaterial() override
PlainMaterial(const std::string &instanceName)
static void unregisterMaterial()
void updateFromParameters() override
Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParam...
static void registerMaterial()
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)