mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-16 22:32:25 +08:00
+ Added brightness reading for image objects
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
afe7452340
commit
e08a252f03
@ -18,13 +18,15 @@ CImage::CImage (
|
|||||||
const glm::vec2& size,
|
const glm::vec2& size,
|
||||||
std::string alignment,
|
std::string alignment,
|
||||||
const glm::vec3& color,
|
const glm::vec3& color,
|
||||||
float alpha) :
|
float alpha,
|
||||||
|
float brightness) :
|
||||||
CObject (visible, id, std::move(name), Type, origin, scale, angles),
|
CObject (visible, id, std::move(name), Type, origin, scale, angles),
|
||||||
m_size (size),
|
m_size (size),
|
||||||
m_material (material),
|
m_material (material),
|
||||||
m_alignment (std::move(alignment)),
|
m_alignment (std::move(alignment)),
|
||||||
m_color (color),
|
m_color (color),
|
||||||
m_alpha (alpha)
|
m_alpha (alpha),
|
||||||
|
m_brightness (brightness)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +45,7 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
|
|||||||
auto alignment = jsonFindDefault <std::string> (data, "alignment", "center");
|
auto alignment = jsonFindDefault <std::string> (data, "alignment", "center");
|
||||||
auto alpha = jsonFindDefault <float> (data, "alpha", 1.0);
|
auto alpha = jsonFindDefault <float> (data, "alpha", 1.0);
|
||||||
auto color_val = jsonFindDefault <std::string> (data, "color", "1.0 1.0 1.0");
|
auto color_val = jsonFindDefault <std::string> (data, "color", "1.0 1.0 1.0");
|
||||||
|
auto brightness_val = jsonFindDefault <float> (data, "brightness", 1.0);
|
||||||
|
|
||||||
json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*image_it).get <std::string> (), container));
|
json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*image_it).get <std::string> (), container));
|
||||||
|
|
||||||
@ -59,7 +62,8 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
|
|||||||
WallpaperEngine::Core::aToVector2 (size_val),
|
WallpaperEngine::Core::aToVector2 (size_val),
|
||||||
alignment,
|
alignment,
|
||||||
WallpaperEngine::Core::aToVector3 (color_val),
|
WallpaperEngine::Core::aToVector3 (color_val),
|
||||||
alpha
|
alpha,
|
||||||
|
brightness_val
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,4 +92,9 @@ const glm::vec3& CImage::getColor () const
|
|||||||
return this->m_color;
|
return this->m_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float CImage::getBrightness () const
|
||||||
|
{
|
||||||
|
return this->m_brightness;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string CImage::Type = "image";
|
const std::string CImage::Type = "image";
|
@ -33,6 +33,7 @@ namespace WallpaperEngine::Core::Objects
|
|||||||
const std::string& getAlignment () const;
|
const std::string& getAlignment () const;
|
||||||
const float getAlpha () const;
|
const float getAlpha () const;
|
||||||
const glm::vec3& getColor () const;
|
const glm::vec3& getColor () const;
|
||||||
|
const float getBrightness () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CImage (
|
CImage (
|
||||||
@ -46,7 +47,8 @@ namespace WallpaperEngine::Core::Objects
|
|||||||
const glm::vec2& size,
|
const glm::vec2& size,
|
||||||
std::string alignment,
|
std::string alignment,
|
||||||
const glm::vec3& color,
|
const glm::vec3& color,
|
||||||
float alpha
|
float alpha,
|
||||||
|
float brightness
|
||||||
);
|
);
|
||||||
|
|
||||||
static const std::string Type;
|
static const std::string Type;
|
||||||
@ -56,6 +58,7 @@ namespace WallpaperEngine::Core::Objects
|
|||||||
Images::CMaterial* m_material;
|
Images::CMaterial* m_material;
|
||||||
std::string m_alignment;
|
std::string m_alignment;
|
||||||
float m_alpha;
|
float m_alpha;
|
||||||
|
float m_brightness;
|
||||||
glm::vec3 m_color;
|
glm::vec3 m_color;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -465,8 +465,8 @@ void CPass::setupUniforms ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register variables like brightness and alpha with some default value
|
// register variables like brightness and alpha with some default value
|
||||||
this->addUniform ("g_Brightness", 1.0f); // TODO: GET FROM THE IMAGE
|
this->addUniform ("g_Brightness", this->m_material->getImage ()->getImage ()->getBrightness ());
|
||||||
this->addUniform ("g_UserAlpha", 1.0f);
|
this->addUniform ("g_UserAlpha", this->m_material->getImage ()->getImage ()->getAlpha ());
|
||||||
this->addUniform ("g_Alpha", 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_Color", this->m_material->getImage ()->getImage ()->getColor ());
|
||||||
// add some external variables
|
// add some external variables
|
||||||
|
Loading…
Reference in New Issue
Block a user