mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-16 14:22:24 +08:00
~ fix images being rendered fliped horizontally
+ added support for arrays in shaders Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
8d2f2adcfa
commit
274bb08e4f
@ -45,10 +45,10 @@ CImage::CImage (CScene* scene, Core::Objects::CImage* image) :
|
|||||||
// bottom left
|
// bottom left
|
||||||
this->m_vertex [3].Pos = irr::core::vector3df (xleft, zbottom, z);
|
this->m_vertex [3].Pos = irr::core::vector3df (xleft, zbottom, z);
|
||||||
|
|
||||||
this->m_vertex [0].TCoords = irr::core::vector2df (1.0f, 0.0f);
|
this->m_vertex [1].TCoords = irr::core::vector2df (1.0f, 0.0f);
|
||||||
this->m_vertex [1].TCoords = irr::core::vector2df (0.0f, 0.0f);
|
this->m_vertex [0].TCoords = irr::core::vector2df (0.0f, 0.0f);
|
||||||
this->m_vertex [2].TCoords = irr::core::vector2df (0.0f, 1.0f);
|
this->m_vertex [3].TCoords = irr::core::vector2df (0.0f, 1.0f);
|
||||||
this->m_vertex [3].TCoords = irr::core::vector2df (1.0f, 1.0f);
|
this->m_vertex [2].TCoords = irr::core::vector2df (1.0f, 1.0f);
|
||||||
|
|
||||||
this->m_vertex [0].Color = irr::video::SColor (255, 255, 255, 255);
|
this->m_vertex [0].Color = irr::video::SColor (255, 255, 255, 255);
|
||||||
this->m_vertex [1].Color = irr::video::SColor (255, 255, 255, 255);
|
this->m_vertex [1].Color = irr::video::SColor (255, 255, 255, 255);
|
||||||
|
@ -165,6 +165,30 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
return std::string (begin, cur);
|
return std::string (begin, cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Compiler::extractArray(std::string::const_iterator &it, bool mustExists)
|
||||||
|
{
|
||||||
|
std::string::const_iterator cur = it;
|
||||||
|
std::string::const_iterator begin = cur;
|
||||||
|
|
||||||
|
if (*cur != '[')
|
||||||
|
{
|
||||||
|
if (mustExists == false)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
this->m_error = true;
|
||||||
|
this->m_errorInfo = "Expected an array but found nothing";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
cur ++;
|
||||||
|
|
||||||
|
while (cur != this->m_content.end () && *cur != ']') cur ++;
|
||||||
|
|
||||||
|
it = ++cur;
|
||||||
|
|
||||||
|
return std::string (begin, cur);
|
||||||
|
}
|
||||||
|
|
||||||
bool Compiler::isChar (std::string::const_iterator& it)
|
bool Compiler::isChar (std::string::const_iterator& it)
|
||||||
{
|
{
|
||||||
return ((*it) >= 'A' && (*it) <= 'Z') || ((*it) >= 'a' && (*it) <= 'z');
|
return ((*it) >= 'A' && (*it) <= 'Z') || ((*it) >= 'a' && (*it) <= 'z');
|
||||||
@ -294,6 +318,8 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
this->ignoreSpaces (it);
|
this->ignoreSpaces (it);
|
||||||
std::string name = this->extractName (it); BREAK_IF_ERROR
|
std::string name = this->extractName (it); BREAK_IF_ERROR
|
||||||
this->ignoreSpaces (it);
|
this->ignoreSpaces (it);
|
||||||
|
std::string array = this->extractArray (it); BREAK_IF_ERROR
|
||||||
|
this->ignoreSpaces (it);
|
||||||
this->expectSemicolon (it); BREAK_IF_ERROR
|
this->expectSemicolon (it); BREAK_IF_ERROR
|
||||||
this->ignoreSpaces (it);
|
this->ignoreSpaces (it);
|
||||||
|
|
||||||
@ -308,11 +334,11 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
|
|
||||||
// parse the parameter information
|
// parse the parameter information
|
||||||
this->parseParameterConfiguration (type, name, configuration); BREAK_IF_ERROR
|
this->parseParameterConfiguration (type, name, configuration); BREAK_IF_ERROR
|
||||||
this->m_compiledContent += "uniform " + type + " " + name + "; // " + configuration;
|
this->m_compiledContent += "uniform " + type + " " + name + array + "; // " + configuration;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->m_compiledContent += "uniform " + type + " " + name + ";";
|
this->m_compiledContent += "uniform " + type + " " + name + array + ";";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,11 +352,11 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
this->ignoreSpaces (it);
|
this->ignoreSpaces (it);
|
||||||
std::string name = this->extractName (it); BREAK_IF_ERROR
|
std::string name = this->extractName (it); BREAK_IF_ERROR
|
||||||
this->ignoreSpaces (it);
|
this->ignoreSpaces (it);
|
||||||
|
std::string array = this->extractArray (it); BREAK_IF_ERROR
|
||||||
|
this->ignoreSpaces (it);
|
||||||
this->expectSemicolon (it); BREAK_IF_ERROR
|
this->expectSemicolon (it); BREAK_IF_ERROR
|
||||||
|
|
||||||
this->m_compiledContent += "// attribute";
|
this->m_compiledContent += "// attribute " + type + " " + name + array;
|
||||||
this->m_compiledContent += " " + type + " ";
|
|
||||||
this->m_compiledContent += name;
|
|
||||||
this->m_compiledContent += "; /* replaced by " + this->lookupReplaceSymbol (name) + " */";
|
this->m_compiledContent += "; /* replaced by " + this->lookupReplaceSymbol (name) + " */";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -132,6 +132,14 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
* @return The variable name
|
* @return The variable name
|
||||||
*/
|
*/
|
||||||
std::string extractName (std::string::const_iterator& it);
|
std::string extractName (std::string::const_iterator& it);
|
||||||
|
/**
|
||||||
|
* Parses the current position as an array indicator
|
||||||
|
*
|
||||||
|
* @param it The position to start extracting the array from
|
||||||
|
* @param mustExists Whether the array indicator must exists or not
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
std::string extractArray(std::string::const_iterator &it, bool mustExists = false);
|
||||||
/**
|
/**
|
||||||
* Parses the current position as a quoted value, extracting it's value
|
* Parses the current position as a quoted value, extracting it's value
|
||||||
* and increasing the iterator at the same time
|
* and increasing the iterator at the same time
|
||||||
|
Loading…
Reference in New Issue
Block a user