Skip to content

Commit

Permalink
fix: support shaders without textures (like flat), improves #184
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Maiquez <[email protected]>
  • Loading branch information
Almamu committed Dec 14, 2023
1 parent 170af5f commit bd5e452
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/WallpaperEngine/Core/Objects/CEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ CEffect* CEffect::fromJSON (json data, CUserSettingBoolean* visible, CObject* ob
if (textureNumber == 0) {
auto* image = object->as<CImage> ();

texture = (*(*image->getMaterial ()->getPasses ().begin ())->getTextures ().begin ());
auto passTextures = (*image->getMaterial ()->getPasses ().begin ())->getTextures ();

if (passTextures.empty ()) {
// TODO: SET CHECKERBOARD TEXTURE AS DEFAULT IN THESE SITUATIONS
texture = "";
} else {
texture = *passTextures.begin ();
}
} else {
texture = "";
}
Expand Down
4 changes: 1 addition & 3 deletions src/WallpaperEngine/Render/CWallpaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,10 @@ CFBO* CWallpaper::createFBO (const std::string& name, ITexture::TextureFormat fo
return fbo;
}

void CWallpaper::aliasFBO(const std::string& alias, CFBO* original)
{
void CWallpaper::aliasFBO (const std::string& alias, CFBO* original) {
this->m_fbos.insert (std::make_pair (alias, original));
}


const std::map<std::string, CFBO*>& CWallpaper::getFBOs () const {
return this->m_fbos;
}
Expand Down
2 changes: 1 addition & 1 deletion src/WallpaperEngine/Render/Objects/Effects/CPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ void CPass::setupUniforms () {
this->addUniform ("g_UserAlpha", this->m_material->getImage ()->getImage ()->getAlpha ());
this->addUniform ("g_Alpha", this->m_material->getImage ()->getImage ()->getAlpha ());
this->addUniform ("g_Color", this->m_material->getImage ()->getImage ()->getColor ());
this->addUniform ("g_Color4", glm::vec4(this->m_material->getImage ()->getImage ()->getColor (), 1));
this->addUniform ("g_Color4", glm::vec4 (this->m_material->getImage ()->getImage ()->getColor (), 1));
// TODO: VALIDATE THAT G_COMPOSITECOLOR REALLY COMES FROM THIS ONE
this->addUniform ("g_CompositeColor", this->m_material->getImage ()->getImage ()->getColor ());
// add some external variables
Expand Down

0 comments on commit bd5e452

Please sign in to comment.