+ Added handling for floating point precision qualifiers on type detection

+ Fixed textures not being detected properly on images that do not have any source

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2021-12-02 21:33:50 +01:00
parent 13bcd52e8c
commit 342522cd1d
2 changed files with 24 additions and 5 deletions

View File

@ -39,16 +39,29 @@ CImage::CImage (CScene* scene, Core::Objects::CImage* image) :
throw std::runtime_error ("Only centered images are supported for now!"); throw std::runtime_error ("Only centered images are supported for now!");
} }
std::string textureName = (*(*this->m_image->getMaterial ()->getPasses ().begin ())->getTextures ().begin ()); // detect texture (if any)
auto textures = (*this->m_image->getMaterial ()->getPasses ().begin ())->getTextures ();
if (textureName.find ("_rt_") == 0) if (textures.empty() == false)
{ {
this->m_texture = this->getScene ()->findFBO (textureName); std::string textureName = *textures.begin ();
if (textureName.find ("_rt_") == 0)
{
this->m_texture = this->getScene ()->findFBO (textureName);
}
else
{
// get the first texture on the first pass (this one represents the image assigned to this object)
this->m_texture = this->getScene ()->getContainer ()->readTexture (textureName);
}
} }
else else
{ {
// get the first texture on the first pass (this one represents the image assigned to this object) glm::vec2 realSize = size * glm::vec2 (scale);
this->m_texture = this->getScene ()->getContainer ()->readTexture (textureName);
// TODO: create a dummy texture of correct size, fbo constructors should be enough, but this should be properly handled
this->m_texture = new CFBO ("", ITexture::TextureFormat::ARGB8888, 1, realSize.x, realSize.y, realSize.x, realSize.y);
} }
// register both FBOs into the scene // register both FBOs into the scene

View File

@ -106,6 +106,12 @@ namespace WallpaperEngine::Render::Shaders
std::string Compiler::extractType (std::string::const_iterator& it) std::string Compiler::extractType (std::string::const_iterator& it)
{ {
// first of all check for highp/mediump/lowp as these operators have to be ignored
this->peekString ("highp", it);
this->peekString ("mediump", it);
this->peekString ("lowp", it);
this->ignoreSpaces (it);
auto cur = sTypes.begin (); auto cur = sTypes.begin ();
auto end = sTypes.end (); auto end = sTypes.end ();