Made the imageSelectedColor carousel property work correctly with reflections.

This commit is contained in:
Leon Styhre 2023-02-13 22:13:09 +01:00
parent f511faff07
commit fc20cde0f3

View file

@ -1155,7 +1155,36 @@ template <typename T> void CarouselComponent<T>::render(const glm::mat4& parentT
if (mReflectionsFalloff > 0.0f) if (mReflectionsFalloff > 0.0f)
comp->setReflectionsFalloff(comp->getSize().y / mReflectionsFalloff); comp->setReflectionsFalloff(comp->getSize().y / mReflectionsFalloff);
comp->setFlipY(true); comp->setFlipY(true);
if (renderItem.index == mCursor && mHasImageSelectedColor) {
comp->setColorShift(mImageSelectedColorGradientHorizontal ? mImageSelectedColor :
mImageSelectedColorEnd);
if (mImageSelectedColorEnd != mImageSelectedColor)
comp->setColorShiftEnd(mImageSelectedColorGradientHorizontal ?
mImageSelectedColorEnd :
mImageSelectedColor);
if (mImageSelectedColorGradientHorizontal != mImageColorGradientHorizontal)
comp->setColorGradientHorizontal(mImageSelectedColorGradientHorizontal);
comp->render(reflectionTrans); comp->render(reflectionTrans);
if (mImageSelectedColorGradientHorizontal != mImageColorGradientHorizontal)
comp->setColorGradientHorizontal(mImageColorGradientHorizontal);
comp->setColorShift(mImageColorShift);
if (mImageColorShiftEnd != mImageColorShift)
comp->setColorShiftEnd(mImageColorShiftEnd);
}
else {
if ((mImageColorShift != 0xFFFFFFFF || mImageColorShiftEnd != 0xFFFFFFFF) &&
!mImageColorGradientHorizontal) {
// We need to reverse the color shift if a vertical gradient is applied.
comp->setColorShift(mImageColorShiftEnd);
comp->setColorShiftEnd(mImageColorShift);
comp->render(reflectionTrans);
comp->setColorShift(mImageColorShift);
comp->setColorShiftEnd(mImageColorShiftEnd);
}
else {
comp->render(reflectionTrans);
}
}
comp->setFlipY(false); comp->setFlipY(false);
comp->setReflectionsFalloff(0.0f); comp->setReflectionsFalloff(0.0f);
} }