mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 09:35:39 +00:00
Changed some render variables to more verbose names.
Also fixed an issue with fade transitions for legacy themes.
This commit is contained in:
parent
6ffd4b1740
commit
755b2c9f50
|
@ -347,7 +347,7 @@ void Screensaver::renderScreensaver()
|
|||
Settings::getInstance()->getString("ScreensaverType") == "dim") {
|
||||
#if defined(USE_OPENGL_21)
|
||||
Renderer::postProcessingParams dimParameters;
|
||||
dimParameters.dim = mDimValue;
|
||||
dimParameters.dimming = mDimValue;
|
||||
Renderer::shaderPostprocessing(Renderer::SHADER_CORE, dimParameters);
|
||||
if (mDimValue > 0.63)
|
||||
mDimValue = glm::clamp(mDimValue - 0.015f, 0.68f, 1.0f);
|
||||
|
@ -363,7 +363,7 @@ void Screensaver::renderScreensaver()
|
|||
else if (Settings::getInstance()->getString("ScreensaverType") == "black") {
|
||||
#if defined(USE_OPENGL_21)
|
||||
Renderer::postProcessingParams blackParameters;
|
||||
blackParameters.dim = mDimValue;
|
||||
blackParameters.dimming = mDimValue;
|
||||
Renderer::shaderPostprocessing(Renderer::SHADER_CORE, blackParameters);
|
||||
if (mDimValue > 0.0)
|
||||
mDimValue = glm::clamp(mDimValue - 0.045f, 0.0f, 1.0f);
|
||||
|
|
|
@ -1055,8 +1055,8 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
|||
|
||||
if (mLegacyMode && mSystemElements.size() > static_cast<size_t>(index)) {
|
||||
for (auto element : mSystemElements[index].legacyExtras) {
|
||||
if (mFadeTransitions)
|
||||
element->setDim(1.0f - mFadeOpacity);
|
||||
if (mFadeTransitions || element->getDimming() != 1.0f)
|
||||
element->setDimming(1.0f - mFadeOpacity);
|
||||
element->render(elementTrans);
|
||||
}
|
||||
}
|
||||
|
@ -1068,8 +1068,8 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
|||
child->render(elementTrans);
|
||||
}
|
||||
else if (!abovePrimary && child->getZIndex() <= primaryZIndex) {
|
||||
if (mFadeTransitions || child->getDim() != 1.0f)
|
||||
child->setDim(1.0f - mFadeOpacity);
|
||||
if (mFadeTransitions || child->getDimming() != 1.0f)
|
||||
child->setDimming(1.0f - mFadeOpacity);
|
||||
child->render(elementTrans);
|
||||
}
|
||||
}
|
||||
|
@ -1077,7 +1077,7 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
|||
|
||||
if (mLegacyMode) {
|
||||
if (mFadeTransitions)
|
||||
mLegacySystemInfo->setDim(1.0f - mFadeOpacity);
|
||||
mLegacySystemInfo->setDimming(1.0f - mFadeOpacity);
|
||||
mLegacySystemInfo->render(elementTrans);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ GuiComponent::GuiComponent()
|
|||
, mSize {0.0f, 0.0f}
|
||||
, mOpacity {1.0f}
|
||||
, mSaturation {1.0f}
|
||||
, mDim {1.0f}
|
||||
, mDimming {1.0f}
|
||||
, mThemeOpacity {1.0f}
|
||||
, mRotation {0.0f}
|
||||
, mScale {1.0f}
|
||||
|
@ -192,14 +192,14 @@ void GuiComponent::setOpacity(float opacity)
|
|||
(*it)->setOpacity(opacity);
|
||||
}
|
||||
|
||||
void GuiComponent::setDim(float dim)
|
||||
void GuiComponent::setDimming(float dimming)
|
||||
{
|
||||
if (mDim == dim)
|
||||
if (mDimming == dimming)
|
||||
return;
|
||||
|
||||
mDim = dim;
|
||||
mDimming = dimming;
|
||||
for (auto it = mChildren.cbegin(); it != mChildren.cend(); ++it)
|
||||
(*it)->setDim(dim);
|
||||
(*it)->setDimming(dimming);
|
||||
}
|
||||
|
||||
const glm::mat4& GuiComponent::getTransform()
|
||||
|
|
|
@ -196,8 +196,8 @@ public:
|
|||
virtual void setOpacity(float opacity);
|
||||
virtual float getSaturation() const { return static_cast<float>(mColor); }
|
||||
virtual void setSaturation(float saturation) { mSaturation = saturation; }
|
||||
virtual const float getDim() const { return mDim; }
|
||||
virtual void setDim(float dim);
|
||||
virtual const float getDimming() const { return mDimming; }
|
||||
virtual void setDimming(float dimming);
|
||||
virtual unsigned int getColor() const { return mColor; }
|
||||
virtual unsigned int getColorShift() const { return mColorShift; }
|
||||
virtual float getLineSpacing() { return 0.0f; }
|
||||
|
@ -301,7 +301,7 @@ protected:
|
|||
|
||||
float mOpacity;
|
||||
float mSaturation;
|
||||
float mDim;
|
||||
float mDimming;
|
||||
float mThemeOpacity;
|
||||
float mRotation;
|
||||
float mScale;
|
||||
|
|
|
@ -481,7 +481,7 @@ void Window::render()
|
|||
// clang-format on
|
||||
|
||||
// Also dim the background slightly.
|
||||
backgroundParameters.dim = 0.60f;
|
||||
backgroundParameters.dimming = 0.60f;
|
||||
|
||||
Renderer::shaderPostprocessing(Renderer::SHADER_BLUR_HORIZONTAL |
|
||||
Renderer::SHADER_BLUR_VERTICAL,
|
||||
|
@ -489,7 +489,7 @@ void Window::render()
|
|||
}
|
||||
else {
|
||||
// Dim the background slightly.
|
||||
backgroundParameters.dim = 0.60f;
|
||||
backgroundParameters.dimming = 0.60f;
|
||||
Renderer::shaderPostprocessing(Renderer::SHADER_CORE, backgroundParameters,
|
||||
&processedTexture[0]);
|
||||
}
|
||||
|
|
|
@ -382,12 +382,12 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
|||
|
||||
if (mOpacity == 1.0f) {
|
||||
Renderer::drawRect(0.0f, mSelectorBarOffset, std::ceil(mSize.x), selectedRowHeight,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, false, mOpacity, mDim,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, false, mOpacity, mDimming,
|
||||
Renderer::Blend::ONE_MINUS_DST_COLOR, Renderer::Blend::ZERO);
|
||||
|
||||
Renderer::drawRect(0.0f, mSelectorBarOffset, std::ceil(mSize.x), selectedRowHeight,
|
||||
0x777777FF, 0x777777FF, false, mOpacity, mDim, Renderer::Blend::ONE,
|
||||
Renderer::Blend::ONE);
|
||||
0x777777FF, 0x777777FF, false, mOpacity, mDimming,
|
||||
Renderer::Blend::ONE, Renderer::Blend::ONE);
|
||||
}
|
||||
|
||||
for (auto it = drawAfterCursor.cbegin(); it != drawAfterCursor.cend(); ++it)
|
||||
|
@ -402,12 +402,12 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
|||
float y = 0;
|
||||
for (unsigned int i = 0; i < mEntries.size(); ++i) {
|
||||
Renderer::drawRect(0.0f, y, std::ceil(mSize.x), 1.0f * Renderer::getScreenHeightModifier(),
|
||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDim);
|
||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
|
||||
y += getRowHeight(mEntries.at(i).data);
|
||||
}
|
||||
|
||||
Renderer::drawRect(0.0f, y, std::ceil(mSize.x), 1.0f * Renderer::getScreenHeightModifier(),
|
||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDim);
|
||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
|
||||
Renderer::popClipRect();
|
||||
}
|
||||
|
||||
|
|
|
@ -485,11 +485,11 @@ void GIFAnimComponent::render(const glm::mat4& parentTrans)
|
|||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
vertices[i].position = glm::round(vertices[i].position);
|
||||
|
||||
vertices->saturation = mSaturation;
|
||||
vertices->opacity = mOpacity * mThemeOpacity;
|
||||
vertices->dim = mDim;
|
||||
vertices->dimming = mDimming;
|
||||
vertices->convertBGRAToRGBA = true;
|
||||
|
||||
// Render it.
|
||||
|
|
|
@ -333,10 +333,10 @@ void ImageComponent::setSaturation(float saturation)
|
|||
updateColors();
|
||||
}
|
||||
|
||||
void ImageComponent::setDim(float dim)
|
||||
void ImageComponent::setDimming(float dimming)
|
||||
{
|
||||
// Set dim value.
|
||||
mDim = dim;
|
||||
// Set dimming value.
|
||||
mDimming = dimming;
|
||||
}
|
||||
|
||||
void ImageComponent::updateVertices()
|
||||
|
@ -362,16 +362,16 @@ void ImageComponent::updateVertices()
|
|||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; ++i)
|
||||
mVertices[i].pos = glm::round(mVertices[i].pos);
|
||||
mVertices[i].position = glm::round(mVertices[i].position);
|
||||
|
||||
if (mFlipX) {
|
||||
for (int i = 0; i < 4; ++i)
|
||||
mVertices[i].tex[0] = px - mVertices[i].tex[0];
|
||||
mVertices[i].texture[0] = px - mVertices[i].texture[0];
|
||||
}
|
||||
|
||||
if (mFlipY) {
|
||||
for (int i = 0; i < 4; ++i)
|
||||
mVertices[i].tex[1] = py - mVertices[i].tex[1];
|
||||
mVertices[i].texture[1] = py - mVertices[i].texture[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,10 +383,10 @@ void ImageComponent::updateColors()
|
|||
const unsigned int colorEnd {(mColorShiftEnd & 0xFFFFFF00) |
|
||||
static_cast<unsigned char>((mColorShiftEnd & 0xFF) * opacity)};
|
||||
|
||||
mVertices[0].col = color;
|
||||
mVertices[1].col = mColorGradientHorizontal ? color : colorEnd;
|
||||
mVertices[2].col = mColorGradientHorizontal ? colorEnd : color;
|
||||
mVertices[3].col = colorEnd;
|
||||
mVertices[0].color = color;
|
||||
mVertices[1].color = mColorGradientHorizontal ? color : colorEnd;
|
||||
mVertices[2].color = mColorGradientHorizontal ? colorEnd : color;
|
||||
mVertices[3].color = colorEnd;
|
||||
}
|
||||
|
||||
void ImageComponent::render(const glm::mat4& parentTrans)
|
||||
|
@ -420,7 +420,7 @@ void ImageComponent::render(const glm::mat4& parentTrans)
|
|||
|
||||
mVertices->saturation = mSaturation;
|
||||
mVertices->opacity = mThemeOpacity;
|
||||
mVertices->dim = mDim;
|
||||
mVertices->dimming = mDimming;
|
||||
|
||||
Renderer::drawTriangleStrips(&mVertices[0], 4);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
|
||||
void setOpacity(float opacity) override;
|
||||
void setSaturation(float saturation) override;
|
||||
void setDim(float dim) override;
|
||||
void setDimming(float dimming) override;
|
||||
|
||||
void setFlipX(bool flip); // Mirror on the X axis.
|
||||
void setFlipY(bool flip); // Mirror on the Y axis.
|
||||
|
|
|
@ -470,11 +470,11 @@ void LottieAnimComponent::render(const glm::mat4& parentTrans)
|
|||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
vertices[i].position = glm::round(vertices[i].position);
|
||||
|
||||
vertices->saturation = mSaturation;
|
||||
vertices->opacity = mOpacity * mThemeOpacity;
|
||||
vertices->dim = mDim;
|
||||
vertices->dimming = mDimming;
|
||||
vertices->convertBGRAToRGBA = true;
|
||||
|
||||
// Render it.
|
||||
|
|
|
@ -36,10 +36,10 @@ NinePatchComponent::~NinePatchComponent()
|
|||
void NinePatchComponent::updateColors()
|
||||
{
|
||||
for (int i = 0; i < 6 * 9; ++i)
|
||||
mVertices[i].col = mEdgeColor;
|
||||
mVertices[i].color = mEdgeColor;
|
||||
|
||||
for (int i = 6 * 4; i < 6; ++i)
|
||||
mVertices[(6 * 4) + i].col = mCenterColor;
|
||||
mVertices[(6 * 4) + i].color = mCenterColor;
|
||||
}
|
||||
|
||||
void NinePatchComponent::buildVertices()
|
||||
|
@ -111,7 +111,7 @@ void NinePatchComponent::buildVertices()
|
|||
|
||||
// Round vertices.
|
||||
for (int i = 1; i < 5; ++i)
|
||||
mVertices[v + i].pos = glm::round(mVertices[v + i].pos);
|
||||
mVertices[v + i].position = glm::round(mVertices[v + i].position);
|
||||
|
||||
// Make duplicates of first and last vertex so this can be rendered as a triangle strip.
|
||||
mVertices[v + 0] = mVertices[v + 1];
|
||||
|
|
|
@ -141,7 +141,7 @@ void RatingComponent::updateVertices()
|
|||
void RatingComponent::updateColors()
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
mVertices[i].col = mColorShift;
|
||||
mVertices[i].color = mColorShift;
|
||||
}
|
||||
|
||||
void RatingComponent::render(const glm::mat4& parentTrans)
|
||||
|
@ -163,8 +163,8 @@ void RatingComponent::render(const glm::mat4& parentTrans)
|
|||
if (mUnfilledTexture->bind()) {
|
||||
if (mUnfilledColor != mColorShift) {
|
||||
for (int i = 0; i < 8; ++i)
|
||||
mVertices[i].col =
|
||||
(mUnfilledColor & 0xFFFFFF00) + (mVertices[i].col & 0x000000FF);
|
||||
mVertices[i].color =
|
||||
(mUnfilledColor & 0xFFFFFF00) + (mVertices[i].color & 0x000000FF);
|
||||
}
|
||||
|
||||
Renderer::drawTriangleStrips(&mVertices[4], 4);
|
||||
|
|
|
@ -107,11 +107,11 @@ void TextComponent::setOpacity(float opacity)
|
|||
mTextCache->setOpacity(mThemeOpacity);
|
||||
}
|
||||
|
||||
void TextComponent::setDim(float dim)
|
||||
void TextComponent::setDimming(float dimming)
|
||||
{
|
||||
mDim = dim;
|
||||
mDimming = dimming;
|
||||
if (mTextCache)
|
||||
mTextCache->setDim(dim);
|
||||
mTextCache->setDimming(dimming);
|
||||
}
|
||||
|
||||
void TextComponent::setText(const std::string& text, bool update)
|
||||
|
@ -165,7 +165,7 @@ void TextComponent::render(const glm::mat4& parentTrans)
|
|||
|
||||
if (mRenderBackground)
|
||||
Renderer::drawRect(0.0f, 0.0f, mSize.x, mSize.y, mBgColor, mBgColor, false,
|
||||
mOpacity * mThemeOpacity, mDim);
|
||||
mOpacity * mThemeOpacity, mDimming);
|
||||
|
||||
if (mTextCache) {
|
||||
const glm::vec2& textSize {mTextCache->metrics.size};
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
return static_cast<float>((mColor & 0x000000FF) / 255.0f);
|
||||
}
|
||||
void setOpacity(float opacity) override;
|
||||
void setDim(float dim) override;
|
||||
void setDimming(float dimming) override;
|
||||
|
||||
void setSelectable(bool status) { mSelectable = status; }
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ void VideoComponent::renderSnapshot(const glm::mat4& parentTrans)
|
|||
|
||||
if (mStaticImagePath != "") {
|
||||
mStaticImage.setOpacity(mOpacity * mThemeOpacity);
|
||||
mStaticImage.setDim(mDim);
|
||||
mStaticImage.setDimming(mDimming);
|
||||
mStaticImage.render(parentTrans);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,13 +160,13 @@ void VideoFFmpegComponent::render(const glm::mat4& parentTrans)
|
|||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
vertices[i].position = glm::round(vertices[i].position);
|
||||
|
||||
if (mDecodedFrame && (mFadeIn < 1.0f || mThemeOpacity < 1.0f))
|
||||
vertices->opacity = mFadeIn * mThemeOpacity;
|
||||
|
||||
vertices->saturation = mSaturation;
|
||||
vertices->dim = mDim;
|
||||
vertices->dimming = mDimming;
|
||||
|
||||
std::unique_lock<std::mutex> pictureLock(mPictureMutex);
|
||||
|
||||
|
|
|
@ -405,7 +405,7 @@ namespace Renderer
|
|||
const unsigned int colorEnd,
|
||||
bool horizontalGradient,
|
||||
const float opacity,
|
||||
const float dim,
|
||||
const float dimming,
|
||||
const Blend::Factor srcBlendFactor,
|
||||
const Blend::Factor dstBlendFactor)
|
||||
{
|
||||
|
@ -430,10 +430,10 @@ namespace Renderer
|
|||
|
||||
// Round vertices.
|
||||
for (int i = 0; i < 4; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
vertices[i].position = glm::round(vertices[i].position);
|
||||
|
||||
vertices->opacity = opacity;
|
||||
vertices->dim = dim;
|
||||
vertices->dimming = dimming;
|
||||
|
||||
bindTexture(0);
|
||||
drawTriangleStrips(vertices, 4, srcBlendFactor, dstBlendFactor);
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Renderer
|
|||
struct postProcessingParams {
|
||||
float opacity;
|
||||
float saturation;
|
||||
float dim;
|
||||
float dimming;
|
||||
bool convertBGRAToRGBA;
|
||||
unsigned int blurPasses;
|
||||
unsigned int shaders;
|
||||
|
@ -38,7 +38,7 @@ namespace Renderer
|
|||
postProcessingParams()
|
||||
: opacity {1.0f}
|
||||
, saturation {1.0f}
|
||||
, dim {1.0f}
|
||||
, dimming {1.0f}
|
||||
, convertBGRAToRGBA {false}
|
||||
, blurPasses {1}
|
||||
, shaders {0}
|
||||
|
@ -117,30 +117,30 @@ namespace Renderer
|
|||
};
|
||||
|
||||
struct Vertex {
|
||||
glm::vec2 pos;
|
||||
glm::vec2 tex;
|
||||
unsigned int col;
|
||||
glm::vec2 position;
|
||||
glm::vec2 texture;
|
||||
unsigned int color;
|
||||
float opacity;
|
||||
float saturation;
|
||||
float dim;
|
||||
float dimming;
|
||||
bool convertBGRAToRGBA;
|
||||
unsigned int shaders;
|
||||
|
||||
Vertex()
|
||||
: opacity {1.0f}
|
||||
, saturation {1.0f}
|
||||
, dim {1.0f}
|
||||
, dimming {1.0f}
|
||||
, convertBGRAToRGBA {false}
|
||||
, shaders {0}
|
||||
{
|
||||
}
|
||||
Vertex(const glm::vec2& position, const glm::vec2& textureCoord, const unsigned int color)
|
||||
: pos(position)
|
||||
, tex(textureCoord)
|
||||
, col(color)
|
||||
: position(position)
|
||||
, texture(textureCoord)
|
||||
, color(color)
|
||||
, opacity {1.0f}
|
||||
, saturation {1.0f}
|
||||
, dim {1.0f}
|
||||
, dimming {1.0f}
|
||||
, convertBGRAToRGBA {false}
|
||||
, shaders {0}
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ namespace Renderer
|
|||
const unsigned int colorEnd,
|
||||
bool horizontalGradient = false,
|
||||
const float opacity = 1.0,
|
||||
const float dim = 1.0,
|
||||
const float dimming = 1.0,
|
||||
const Blend::Factor srcBlendFactor = Blend::SRC_ALPHA,
|
||||
const Blend::Factor dstBlendFactor = Blend::ONE_MINUS_SRC_ALPHA);
|
||||
SDL_Window* getSDLWindow();
|
||||
|
|
|
@ -284,9 +284,9 @@ namespace Renderer
|
|||
const Blend::Factor srcBlendFactor,
|
||||
const Blend::Factor dstBlendFactor)
|
||||
{
|
||||
GL_CHECK_ERROR(glVertexPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].pos));
|
||||
GL_CHECK_ERROR(glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].tex));
|
||||
GL_CHECK_ERROR(glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), &vertices[0].col));
|
||||
GL_CHECK_ERROR(glVertexPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].position));
|
||||
GL_CHECK_ERROR(glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].texture));
|
||||
GL_CHECK_ERROR(glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), &vertices[0].color));
|
||||
|
||||
GL_CHECK_ERROR(
|
||||
glBlendFunc(convertBlendFactor(srcBlendFactor), convertBlendFactor(dstBlendFactor)));
|
||||
|
@ -299,12 +299,12 @@ namespace Renderer
|
|||
const Blend::Factor srcBlendFactor,
|
||||
const Blend::Factor dstBlendFactor)
|
||||
{
|
||||
const float width {vertices[3].pos[0]};
|
||||
const float height {vertices[3].pos[1]};
|
||||
const float width {vertices[3].position[0]};
|
||||
const float height {vertices[3].position[1]};
|
||||
|
||||
GL_CHECK_ERROR(glVertexPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].pos));
|
||||
GL_CHECK_ERROR(glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].tex));
|
||||
GL_CHECK_ERROR(glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), &vertices[0].col));
|
||||
GL_CHECK_ERROR(glVertexPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].position));
|
||||
GL_CHECK_ERROR(glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].texture));
|
||||
GL_CHECK_ERROR(glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), &vertices[0].color));
|
||||
|
||||
GL_CHECK_ERROR(
|
||||
glBlendFunc(convertBlendFactor(srcBlendFactor), convertBlendFactor(dstBlendFactor)));
|
||||
|
@ -316,7 +316,7 @@ namespace Renderer
|
|||
runShader->setModelViewProjectionMatrix(mTrans);
|
||||
runShader->setOpacity(vertices->opacity);
|
||||
runShader->setSaturation(vertices->saturation);
|
||||
runShader->setDim(vertices->dim);
|
||||
runShader->setDimming(vertices->dimming);
|
||||
runShader->setBGRAToRGBA(vertices->convertBGRAToRGBA);
|
||||
GL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, numVertices));
|
||||
runShader->deactivateShaders();
|
||||
|
@ -458,7 +458,7 @@ namespace Renderer
|
|||
|
||||
vertices->opacity = parameters.opacity;
|
||||
vertices->saturation = parameters.saturation;
|
||||
vertices->dim = parameters.dim;
|
||||
vertices->dimming = parameters.dimming;
|
||||
|
||||
shaderList.emplace_back(Renderer::SHADER_CORE);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Renderer
|
|||
, shaderTextureCoord {0}
|
||||
, shaderOpacity {0}
|
||||
, shaderSaturation {0}
|
||||
, shaderDim {0}
|
||||
, shaderDimming {0}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace Renderer
|
|||
shaderTextureCoord = glGetAttribLocation(mProgramID, "TexCoord");
|
||||
shaderOpacity = glGetUniformLocation(mProgramID, "opacity");
|
||||
shaderSaturation = glGetUniformLocation(mProgramID, "saturation");
|
||||
shaderDim = glGetUniformLocation(mProgramID, "dim");
|
||||
shaderDimming = glGetUniformLocation(mProgramID, "dimming");
|
||||
shaderBGRAToRGBA = glGetUniformLocation(mProgramID, "BGRAToRGBA");
|
||||
}
|
||||
|
||||
|
@ -146,10 +146,10 @@ namespace Renderer
|
|||
GL_CHECK_ERROR(glUniform1f(shaderSaturation, saturation));
|
||||
}
|
||||
|
||||
void Renderer::Shader::setDim(GLfloat dim)
|
||||
void Renderer::Shader::setDimming(GLfloat dimming)
|
||||
{
|
||||
if (shaderDim != GL_INVALID_VALUE && shaderDim != GL_INVALID_OPERATION)
|
||||
GL_CHECK_ERROR(glUniform1f(shaderDim, dim));
|
||||
if (shaderDimming != GL_INVALID_VALUE && shaderDimming != GL_INVALID_OPERATION)
|
||||
GL_CHECK_ERROR(glUniform1f(shaderDimming, dimming));
|
||||
}
|
||||
|
||||
void Renderer::Shader::setBGRAToRGBA(GLboolean BGRAToRGBA)
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Renderer
|
|||
void setTextureCoordinates(std::array<GLfloat, 4> shaderVec4);
|
||||
void setOpacity(GLfloat opacity);
|
||||
void setSaturation(GLfloat saturation);
|
||||
void setDim(GLfloat dim);
|
||||
void setDimming(GLfloat dimming);
|
||||
void setBGRAToRGBA(GLboolean BGRAToRGBA);
|
||||
// Sets the shader program to use the loaded shaders.
|
||||
void activateShaders();
|
||||
|
@ -73,7 +73,7 @@ namespace Renderer
|
|||
GLint shaderTextureCoord;
|
||||
GLint shaderOpacity;
|
||||
GLint shaderSaturation;
|
||||
GLint shaderDim;
|
||||
GLint shaderDimming;
|
||||
GLint shaderBGRAToRGBA;
|
||||
};
|
||||
|
||||
|
|
|
@ -670,7 +670,7 @@ TextCache* Font::buildTextCache(const std::string& text,
|
|||
|
||||
// Round vertices.
|
||||
for (int i = 1; i < 5; ++i)
|
||||
vertices[i].pos = glm::round(vertices[i].pos);
|
||||
vertices[i].position = glm::round(vertices[i].position);
|
||||
|
||||
// Make duplicates of first and last vertex so this can be rendered as a triangle strip.
|
||||
vertices[0] = vertices[1];
|
||||
|
@ -711,7 +711,7 @@ void TextCache::setColor(unsigned int color)
|
|||
{
|
||||
for (auto it = vertexLists.begin(); it != vertexLists.end(); ++it)
|
||||
for (auto it2 = it->verts.begin(); it2 != it->verts.end(); ++it2)
|
||||
it2->col = color;
|
||||
it2->color = color;
|
||||
}
|
||||
|
||||
void TextCache::setOpacity(float opacity)
|
||||
|
@ -722,11 +722,11 @@ void TextCache::setOpacity(float opacity)
|
|||
}
|
||||
}
|
||||
|
||||
void TextCache::setDim(float dim)
|
||||
void TextCache::setDimming(float dimming)
|
||||
{
|
||||
for (auto it = vertexLists.begin(); it != vertexLists.end(); ++it) {
|
||||
for (auto it2 = it->verts.begin(); it2 != it->verts.end(); ++it2)
|
||||
it2->dim = dim;
|
||||
it2->dimming = dimming;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ public:
|
|||
|
||||
void setColor(unsigned int color);
|
||||
void setOpacity(float opacity);
|
||||
void setDim(float dim);
|
||||
void setDimming(float dimming);
|
||||
|
||||
friend Font;
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ COMPAT_VARYING vec4 color;
|
|||
COMPAT_VARYING vec2 texCoord;
|
||||
uniform float opacity = 1.0f;
|
||||
uniform float saturation = 1.0f;
|
||||
uniform float dim = 1.0f;
|
||||
uniform float dimming = 1.0f;
|
||||
uniform int BGRAToRGBA = 0;
|
||||
uniform sampler2D myTexture;
|
||||
|
||||
|
@ -62,7 +62,7 @@ void main()
|
|||
}
|
||||
|
||||
// Dimming
|
||||
vec4 dimColor = vec4(dim, dim, dim, 1.0f);
|
||||
vec4 dimColor = vec4(dimming, dimming, dimming, 1.0f);
|
||||
color = vec4(color.rgba) * dimColor;
|
||||
|
||||
// BGRA to RGBA conversion.
|
||||
|
|
Loading…
Reference in a new issue