1 #include <Engine/Data/SimpleMaterial.hpp>
2 #include <Engine/Data/TextureManager.hpp>
3 #include <Engine/RadiumEngine.hpp>
11 const std::string& materialName,
13 Material( instanceName, materialName, aspect ) {}
19 void SimpleMaterial::updateRenderingParameters() {
20 auto& renderParameters = getParameters();
22 renderParameters.addParameter(
"material.color",
m_color );
23 renderParameters.addParameter(
"material.perVertexColor",
m_perVertexColor );
25 if ( tex !=
nullptr ) { renderParameters.addParameter(
"material.tex.color", tex ); }
26 renderParameters.addParameter(
"material.tex.hasColor", tex !=
nullptr );
27 tex =
getTexture( SimpleMaterial::TextureSemantic::TEX_MASK );
28 if ( tex !=
nullptr ) { renderParameters.addParameter(
"material.tex.mask", tex ); }
29 renderParameters.addParameter(
"material.tex.hasMask", tex !=
nullptr );
36 for (
const auto& tex : m_pendingTextures ) {
38 bool tolinear = ( tex.first == TextureSemantic::TEX_COLOR );
40 m_textures[tex.first] = texture;
43 m_pendingTextures.clear();
45 updateRenderingParameters();
static void loadMetaData(const std::string &basename, nlohmann::json &destination)
Load the ParameterSet description.
void updateGL() override final
~SimpleMaterial() override
static void loadMetaData(nlohmann::json &destination)
Load the material parameter description.
Core::Utils::Color m_color
The base color of the material.
SimpleMaterial(const std::string &instanceName, const std::string &materialName, MaterialAspect aspect=MaterialAspect::MAT_OPAQUE)
Texture * getTexture(const TextureSemantic &semantic) const
Texture * getOrLoadTexture(const TextureParameters &texParameters, bool linearize=false)