~ Fixed shaders not compiling properly when define values were used from the JSON, this should solve some backgrounds displaying a black background and nothing else

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2019-08-07 22:31:17 +02:00
parent c5797571f4
commit 85ada97786

View File

@ -44,7 +44,14 @@ namespace wp
"#define ddx dFdx\n" "#define ddx dFdx\n"
"#define ddy(x) dFdy(-(x))\n" "#define ddy(x) dFdy(-(x))\n"
"#define GLSL 1\n\n"; "#define GLSL 1\n\n";
// TODO: Parse COMBO options from shaders and set at least default values
std::map<std::string, int>::const_iterator cur = this->m_combos->begin ();
std::map<std::string, int>::const_iterator end = this->m_combos->end ();
for (; cur != end; cur ++)
{
this->m_content += "#define " + (*cur).first + " " + std::to_string ((*cur).second) + "\n";
}
} }
else else
{ {
@ -464,6 +471,8 @@ namespace wp
// check the combos // check the combos
std::map<std::string, int>::const_iterator entry = this->m_combos->find ((*combo).get <std::string> ()); std::map<std::string, int>::const_iterator entry = this->m_combos->find ((*combo).get <std::string> ());
// if the combo was not found in the predefined values this means that the default value in the JSON data can be used
// so only define the ones that are not already defined
if (entry == this->m_combos->end ()) if (entry == this->m_combos->end ())
{ {
// if no combo is defined just load the default settings // if no combo is defined just load the default settings
@ -484,10 +493,6 @@ namespace wp
wp::irrlicht::device->getLogger ()->log ("Cannot parse combo information, unknown type", irr::ELL_ERROR); wp::irrlicht::device->getLogger ()->log ("Cannot parse combo information, unknown type", irr::ELL_ERROR);
} }
} }
else
{
this->m_compiledContent += "#define " + (*combo).get <std::string> () + " " + std::to_string ((*entry).second);
}
} }
void compiler::parseParameterConfiguration (const std::string& type, const std::string& name, const std::string& content) void compiler::parseParameterConfiguration (const std::string& type, const std::string& name, const std::string& content)