mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Fixed an issue where unfocusedItemSaturation couldn't be combined with imageSaturation for the carousel and grid elements.
This commit is contained in:
parent
559c56be56
commit
b034fe61fe
|
@ -187,6 +187,7 @@ private:
|
||||||
float mReflectionsFalloff;
|
float mReflectionsFalloff;
|
||||||
float mUnfocusedItemOpacity;
|
float mUnfocusedItemOpacity;
|
||||||
float mUnfocusedItemSaturation;
|
float mUnfocusedItemSaturation;
|
||||||
|
bool mHasUnfocusedItemSaturation;
|
||||||
float mUnfocusedItemDimming;
|
float mUnfocusedItemDimming;
|
||||||
ImageFit mImagefit;
|
ImageFit mImagefit;
|
||||||
unsigned int mCarouselColor;
|
unsigned int mCarouselColor;
|
||||||
|
@ -257,6 +258,7 @@ CarouselComponent<T>::CarouselComponent()
|
||||||
, mReflectionsFalloff {1.0f}
|
, mReflectionsFalloff {1.0f}
|
||||||
, mUnfocusedItemOpacity {0.5f}
|
, mUnfocusedItemOpacity {0.5f}
|
||||||
, mUnfocusedItemSaturation {1.0f}
|
, mUnfocusedItemSaturation {1.0f}
|
||||||
|
, mHasUnfocusedItemSaturation {false}
|
||||||
, mUnfocusedItemDimming {1.0f}
|
, mUnfocusedItemDimming {1.0f}
|
||||||
, mImagefit {ImageFit::CONTAIN}
|
, mImagefit {ImageFit::CONTAIN}
|
||||||
, mCarouselColor {0}
|
, mCarouselColor {0}
|
||||||
|
@ -991,15 +993,17 @@ template <typename T> void CarouselComponent<T>::render(const glm::mat4& parentT
|
||||||
opacity = mUnfocusedItemOpacity + (maxDiff - (maxDiff * fabsf(distance)));
|
opacity = mUnfocusedItemOpacity + (maxDiff - (maxDiff * fabsf(distance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (distance == 0.0f || mUnfocusedItemSaturation == 1.0f) {
|
if (mHasUnfocusedItemSaturation) {
|
||||||
saturation = 1.0f;
|
if (distance == 0.0f) {
|
||||||
}
|
saturation = mImageSaturation;
|
||||||
else if (fabsf(distance) >= 1.0f) {
|
}
|
||||||
saturation = mUnfocusedItemSaturation;
|
else if (fabsf(distance) >= 1.0f) {
|
||||||
}
|
saturation = mUnfocusedItemSaturation;
|
||||||
else {
|
}
|
||||||
const float maxDiff {1.0f - mUnfocusedItemSaturation};
|
else {
|
||||||
saturation = mUnfocusedItemSaturation + (maxDiff - (maxDiff * fabsf(distance)));
|
const float maxDiff {mImageSaturation - mUnfocusedItemSaturation};
|
||||||
|
saturation = mUnfocusedItemSaturation + (maxDiff - (maxDiff * fabsf(distance)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (distance == 0.0f || mUnfocusedItemDimming == 1.0f) {
|
if (distance == 0.0f || mUnfocusedItemDimming == 1.0f) {
|
||||||
|
@ -1185,7 +1189,7 @@ template <typename T> void CarouselComponent<T>::render(const glm::mat4& parentT
|
||||||
|
|
||||||
comp->setScale(renderItem.scale);
|
comp->setScale(renderItem.scale);
|
||||||
comp->setOpacity(renderItem.opacity * metadataOpacity);
|
comp->setOpacity(renderItem.opacity * metadataOpacity);
|
||||||
if (mUnfocusedItemSaturation != 1.0f)
|
if (mHasUnfocusedItemSaturation)
|
||||||
comp->setSaturation(renderItem.saturation);
|
comp->setSaturation(renderItem.saturation);
|
||||||
if (mUnfocusedItemDimming != 1.0f)
|
if (mUnfocusedItemDimming != 1.0f)
|
||||||
comp->setDimming(renderItem.dimming);
|
comp->setDimming(renderItem.dimming);
|
||||||
|
@ -1234,7 +1238,7 @@ template <typename T> void CarouselComponent<T>::render(const glm::mat4& parentT
|
||||||
float falloff {glm::clamp(mReflectionsFalloff, 0.0f, 1.0f)};
|
float falloff {glm::clamp(mReflectionsFalloff, 0.0f, 1.0f)};
|
||||||
falloff = mReflectionsOpacity * (1.0f - falloff);
|
falloff = mReflectionsOpacity * (1.0f - falloff);
|
||||||
comp->setOpacity(comp->getOpacity() * mReflectionsOpacity);
|
comp->setOpacity(comp->getOpacity() * mReflectionsOpacity);
|
||||||
if (mUnfocusedItemSaturation != 1.0f)
|
if (mHasUnfocusedItemSaturation)
|
||||||
comp->setSaturation(renderItem.saturation);
|
comp->setSaturation(renderItem.saturation);
|
||||||
if (mUnfocusedItemDimming != 1.0f)
|
if (mUnfocusedItemDimming != 1.0f)
|
||||||
comp->setDimming(renderItem.dimming);
|
comp->setDimming(renderItem.dimming);
|
||||||
|
@ -1704,9 +1708,11 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mUnfocusedItemOpacity =
|
mUnfocusedItemOpacity =
|
||||||
glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
||||||
|
|
||||||
if (elem->has("unfocusedItemSaturation"))
|
if (elem->has("unfocusedItemSaturation")) {
|
||||||
mUnfocusedItemSaturation =
|
mUnfocusedItemSaturation =
|
||||||
glm::clamp(elem->get<float>("unfocusedItemSaturation"), 0.0f, 1.0f);
|
glm::clamp(elem->get<float>("unfocusedItemSaturation"), 0.0f, 1.0f);
|
||||||
|
mHasUnfocusedItemSaturation = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (elem->has("unfocusedItemDimming"))
|
if (elem->has("unfocusedItemDimming"))
|
||||||
mUnfocusedItemDimming =
|
mUnfocusedItemDimming =
|
||||||
|
|
|
@ -156,6 +156,7 @@ private:
|
||||||
bool mInstantRowTransitions;
|
bool mInstantRowTransitions;
|
||||||
float mUnfocusedItemOpacity;
|
float mUnfocusedItemOpacity;
|
||||||
float mUnfocusedItemSaturation;
|
float mUnfocusedItemSaturation;
|
||||||
|
bool mHasUnfocusedItemSaturation;
|
||||||
float mUnfocusedItemDimming;
|
float mUnfocusedItemDimming;
|
||||||
ImageFit mImagefit;
|
ImageFit mImagefit;
|
||||||
float mImageRelativeScale;
|
float mImageRelativeScale;
|
||||||
|
@ -226,6 +227,7 @@ GridComponent<T>::GridComponent()
|
||||||
, mInstantRowTransitions {false}
|
, mInstantRowTransitions {false}
|
||||||
, mUnfocusedItemOpacity {1.0f}
|
, mUnfocusedItemOpacity {1.0f}
|
||||||
, mUnfocusedItemSaturation {1.0f}
|
, mUnfocusedItemSaturation {1.0f}
|
||||||
|
, mHasUnfocusedItemSaturation {false}
|
||||||
, mUnfocusedItemDimming {1.0f}
|
, mUnfocusedItemDimming {1.0f}
|
||||||
, mImagefit {ImageFit::CONTAIN}
|
, mImagefit {ImageFit::CONTAIN}
|
||||||
, mImageRelativeScale {1.0f}
|
, mImageRelativeScale {1.0f}
|
||||||
|
@ -745,7 +747,8 @@ template <typename T> void GridComponent<T>::render(const glm::mat4& parentTrans
|
||||||
}
|
}
|
||||||
|
|
||||||
opacity = mUnfocusedItemOpacity * metadataOpacity;
|
opacity = mUnfocusedItemOpacity * metadataOpacity;
|
||||||
saturation = mUnfocusedItemSaturation;
|
if (mHasUnfocusedItemSaturation)
|
||||||
|
saturation = mUnfocusedItemSaturation;
|
||||||
dimming = mUnfocusedItemDimming;
|
dimming = mUnfocusedItemDimming;
|
||||||
|
|
||||||
if (*it == static_cast<size_t>(mCursor)) {
|
if (*it == static_cast<size_t>(mCursor)) {
|
||||||
|
@ -753,7 +756,9 @@ template <typename T> void GridComponent<T>::render(const glm::mat4& parentTrans
|
||||||
scale = glm::mix(1.0f, mItemScale, mTransitionFactor);
|
scale = glm::mix(1.0f, mItemScale, mTransitionFactor);
|
||||||
opacity = glm::mix(mUnfocusedItemOpacity * metadataOpacity, 1.0f * metadataOpacity,
|
opacity = glm::mix(mUnfocusedItemOpacity * metadataOpacity, 1.0f * metadataOpacity,
|
||||||
mTransitionFactor);
|
mTransitionFactor);
|
||||||
saturation = glm::mix(mUnfocusedItemSaturation, 1.0f, mTransitionFactor);
|
if (mHasUnfocusedItemSaturation)
|
||||||
|
saturation =
|
||||||
|
glm::mix(mUnfocusedItemSaturation, mImageSaturation, mTransitionFactor);
|
||||||
dimming = glm::mix(mUnfocusedItemDimming, 1.0f, mTransitionFactor);
|
dimming = glm::mix(mUnfocusedItemDimming, 1.0f, mTransitionFactor);
|
||||||
}
|
}
|
||||||
else if (*it == static_cast<size_t>(mLastCursor)) {
|
else if (*it == static_cast<size_t>(mLastCursor)) {
|
||||||
|
@ -761,7 +766,9 @@ template <typename T> void GridComponent<T>::render(const glm::mat4& parentTrans
|
||||||
scale = glm::mix(mItemScale, 1.0f, mTransitionFactor);
|
scale = glm::mix(mItemScale, 1.0f, mTransitionFactor);
|
||||||
opacity = glm::mix(1.0f * metadataOpacity, mUnfocusedItemOpacity * metadataOpacity,
|
opacity = glm::mix(1.0f * metadataOpacity, mUnfocusedItemOpacity * metadataOpacity,
|
||||||
mTransitionFactor);
|
mTransitionFactor);
|
||||||
saturation = glm::mix(1.0f, mUnfocusedItemSaturation, mTransitionFactor);
|
if (mHasUnfocusedItemSaturation)
|
||||||
|
saturation =
|
||||||
|
glm::mix(mImageSaturation, mUnfocusedItemSaturation, mTransitionFactor);
|
||||||
dimming = glm::mix(1.0f, mUnfocusedItemDimming, mTransitionFactor);
|
dimming = glm::mix(1.0f, mUnfocusedItemDimming, mTransitionFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,7 +779,7 @@ template <typename T> void GridComponent<T>::render(const glm::mat4& parentTrans
|
||||||
mBackgroundImage->setPosition(mEntries.at(*it).data.item->getPosition());
|
mBackgroundImage->setPosition(mEntries.at(*it).data.item->getPosition());
|
||||||
mBackgroundImage->setScale(scale);
|
mBackgroundImage->setScale(scale);
|
||||||
mBackgroundImage->setOpacity(opacity);
|
mBackgroundImage->setOpacity(opacity);
|
||||||
if (mUnfocusedItemSaturation != 1.0f)
|
if (mHasUnfocusedItemSaturation)
|
||||||
mBackgroundImage->setSaturation(saturation);
|
mBackgroundImage->setSaturation(saturation);
|
||||||
if (mUnfocusedItemDimming != 1.0f)
|
if (mUnfocusedItemDimming != 1.0f)
|
||||||
mBackgroundImage->setDimming(dimming);
|
mBackgroundImage->setDimming(dimming);
|
||||||
|
@ -806,7 +813,7 @@ template <typename T> void GridComponent<T>::render(const glm::mat4& parentTrans
|
||||||
|
|
||||||
mEntries.at(*it).data.item->setScale(scale);
|
mEntries.at(*it).data.item->setScale(scale);
|
||||||
mEntries.at(*it).data.item->setOpacity(opacity);
|
mEntries.at(*it).data.item->setOpacity(opacity);
|
||||||
if (mUnfocusedItemSaturation != 1.0f)
|
if (mHasUnfocusedItemSaturation)
|
||||||
mEntries.at(*it).data.item->setSaturation(saturation);
|
mEntries.at(*it).data.item->setSaturation(saturation);
|
||||||
if (mUnfocusedItemDimming != 1.0f)
|
if (mUnfocusedItemDimming != 1.0f)
|
||||||
mEntries.at(*it).data.item->setDimming(dimming);
|
mEntries.at(*it).data.item->setDimming(dimming);
|
||||||
|
@ -1217,9 +1224,11 @@ void GridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
if (elem->has("unfocusedItemOpacity"))
|
if (elem->has("unfocusedItemOpacity"))
|
||||||
mUnfocusedItemOpacity = glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
mUnfocusedItemOpacity = glm::clamp(elem->get<float>("unfocusedItemOpacity"), 0.1f, 1.0f);
|
||||||
|
|
||||||
if (elem->has("unfocusedItemSaturation"))
|
if (elem->has("unfocusedItemSaturation")) {
|
||||||
mUnfocusedItemSaturation =
|
mUnfocusedItemSaturation =
|
||||||
glm::clamp(elem->get<float>("unfocusedItemSaturation"), 0.0f, 1.0f);
|
glm::clamp(elem->get<float>("unfocusedItemSaturation"), 0.0f, 1.0f);
|
||||||
|
mHasUnfocusedItemSaturation = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (elem->has("unfocusedItemDimming"))
|
if (elem->has("unfocusedItemDimming"))
|
||||||
mUnfocusedItemDimming = glm::clamp(elem->get<float>("unfocusedItemDimming"), 0.0f, 1.0f);
|
mUnfocusedItemDimming = glm::clamp(elem->get<float>("unfocusedItemDimming"), 0.0f, 1.0f);
|
||||||
|
|
Loading…
Reference in a new issue