From 755b2c9f5059f85427de077b6b6b8e85ad97bed0 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 11 Mar 2022 23:51:41 +0100 Subject: [PATCH] Changed some render variables to more verbose names. Also fixed an issue with fade transitions for legacy themes. --- es-app/src/Screensaver.cpp | 4 +-- es-app/src/views/SystemView.cpp | 10 +++---- es-core/src/GuiComponent.cpp | 10 +++---- es-core/src/GuiComponent.h | 6 ++--- es-core/src/Window.cpp | 4 +-- es-core/src/components/ComponentList.cpp | 10 +++---- es-core/src/components/GIFAnimComponent.cpp | 4 +-- es-core/src/components/ImageComponent.cpp | 22 ++++++++-------- es-core/src/components/ImageComponent.h | 2 +- .../src/components/LottieAnimComponent.cpp | 4 +-- es-core/src/components/NinePatchComponent.cpp | 6 ++--- es-core/src/components/RatingComponent.cpp | 6 ++--- es-core/src/components/TextComponent.cpp | 8 +++--- es-core/src/components/TextComponent.h | 2 +- es-core/src/components/VideoComponent.cpp | 2 +- .../src/components/VideoFFmpegComponent.cpp | 4 +-- es-core/src/renderers/Renderer.cpp | 6 ++--- es-core/src/renderers/Renderer.h | 26 +++++++++---------- es-core/src/renderers/Renderer_GL21.cpp | 20 +++++++------- es-core/src/renderers/Shader_GL21.cpp | 10 +++---- es-core/src/renderers/Shader_GL21.h | 4 +-- es-core/src/resources/Font.cpp | 8 +++--- es-core/src/resources/Font.h | 2 +- resources/shaders/glsl/core.glsl | 4 +-- 24 files changed, 92 insertions(+), 92 deletions(-) diff --git a/es-app/src/Screensaver.cpp b/es-app/src/Screensaver.cpp index 92018cc83..12ceb5fdc 100644 --- a/es-app/src/Screensaver.cpp +++ b/es-app/src/Screensaver.cpp @@ -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); diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 1a8c3cc0d..3ceeac473 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -1055,8 +1055,8 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary) if (mLegacyMode && mSystemElements.size() > static_cast(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); } diff --git a/es-core/src/GuiComponent.cpp b/es-core/src/GuiComponent.cpp index 1435644d7..0e4f21c36 100644 --- a/es-core/src/GuiComponent.cpp +++ b/es-core/src/GuiComponent.cpp @@ -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() diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h index c935339b9..51264766a 100644 --- a/es-core/src/GuiComponent.h +++ b/es-core/src/GuiComponent.h @@ -196,8 +196,8 @@ public: virtual void setOpacity(float opacity); virtual float getSaturation() const { return static_cast(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; diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 127686f8a..2d90a2402 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -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]); } diff --git a/es-core/src/components/ComponentList.cpp b/es-core/src/components/ComponentList.cpp index 020657b85..86a4839a9 100644 --- a/es-core/src/components/ComponentList.cpp +++ b/es-core/src/components/ComponentList.cpp @@ -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(); } diff --git a/es-core/src/components/GIFAnimComponent.cpp b/es-core/src/components/GIFAnimComponent.cpp index 642a57951..6a3b82775 100644 --- a/es-core/src/components/GIFAnimComponent.cpp +++ b/es-core/src/components/GIFAnimComponent.cpp @@ -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. diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index ca66f1a55..bd9efd8f0 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -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((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); } diff --git a/es-core/src/components/ImageComponent.h b/es-core/src/components/ImageComponent.h index 97afc4067..4c6873e61 100644 --- a/es-core/src/components/ImageComponent.h +++ b/es-core/src/components/ImageComponent.h @@ -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. diff --git a/es-core/src/components/LottieAnimComponent.cpp b/es-core/src/components/LottieAnimComponent.cpp index 6b1bb4b87..0cf973ce7 100644 --- a/es-core/src/components/LottieAnimComponent.cpp +++ b/es-core/src/components/LottieAnimComponent.cpp @@ -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. diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp index d34c3f175..907ed451c 100644 --- a/es-core/src/components/NinePatchComponent.cpp +++ b/es-core/src/components/NinePatchComponent.cpp @@ -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]; diff --git a/es-core/src/components/RatingComponent.cpp b/es-core/src/components/RatingComponent.cpp index 81793d3ce..9f4c9625b 100644 --- a/es-core/src/components/RatingComponent.cpp +++ b/es-core/src/components/RatingComponent.cpp @@ -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); diff --git a/es-core/src/components/TextComponent.cpp b/es-core/src/components/TextComponent.cpp index 84cca138b..77307920c 100644 --- a/es-core/src/components/TextComponent.cpp +++ b/es-core/src/components/TextComponent.cpp @@ -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}; diff --git a/es-core/src/components/TextComponent.h b/es-core/src/components/TextComponent.h index 239c5b54d..23b7a150f 100644 --- a/es-core/src/components/TextComponent.h +++ b/es-core/src/components/TextComponent.h @@ -62,7 +62,7 @@ public: return static_cast((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; } diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index 5e964ae90..7fdd63c88 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -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); } } diff --git a/es-core/src/components/VideoFFmpegComponent.cpp b/es-core/src/components/VideoFFmpegComponent.cpp index 9bcb0e107..5f02c6468 100644 --- a/es-core/src/components/VideoFFmpegComponent.cpp +++ b/es-core/src/components/VideoFFmpegComponent.cpp @@ -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 pictureLock(mPictureMutex); diff --git a/es-core/src/renderers/Renderer.cpp b/es-core/src/renderers/Renderer.cpp index d31767e4b..159a8d59a 100644 --- a/es-core/src/renderers/Renderer.cpp +++ b/es-core/src/renderers/Renderer.cpp @@ -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); diff --git a/es-core/src/renderers/Renderer.h b/es-core/src/renderers/Renderer.h index 95f72df36..ea78693c4 100644 --- a/es-core/src/renderers/Renderer.h +++ b/es-core/src/renderers/Renderer.h @@ -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} @@ -68,7 +68,7 @@ namespace Renderer LOG(LogError) << "OpenGL error: " << _funcName << " failed with error code: 0x" << std::hex << errorCode; #else - LOG(LogError) << "OpenGLES error: " << _funcName << " failed with error code: 0x" + LOG(LogError) << "OpenGL ES error: " << _funcName << " failed with error code: 0x" << std::hex << errorCode; #endif } @@ -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(); diff --git a/es-core/src/renderers/Renderer_GL21.cpp b/es-core/src/renderers/Renderer_GL21.cpp index 6a219356d..1db4eba40 100644 --- a/es-core/src/renderers/Renderer_GL21.cpp +++ b/es-core/src/renderers/Renderer_GL21.cpp @@ -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); diff --git a/es-core/src/renderers/Shader_GL21.cpp b/es-core/src/renderers/Shader_GL21.cpp index 8725dafe1..1051f14ec 100644 --- a/es-core/src/renderers/Shader_GL21.cpp +++ b/es-core/src/renderers/Shader_GL21.cpp @@ -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) diff --git a/es-core/src/renderers/Shader_GL21.h b/es-core/src/renderers/Shader_GL21.h index eca5f1bd4..faa273ebd 100644 --- a/es-core/src/renderers/Shader_GL21.h +++ b/es-core/src/renderers/Shader_GL21.h @@ -51,7 +51,7 @@ namespace Renderer void setTextureCoordinates(std::array 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; }; diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index 0e82f7579..b9275afbc 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -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; } } diff --git a/es-core/src/resources/Font.h b/es-core/src/resources/Font.h index d4c786477..99190d490 100644 --- a/es-core/src/resources/Font.h +++ b/es-core/src/resources/Font.h @@ -207,7 +207,7 @@ public: void setColor(unsigned int color); void setOpacity(float opacity); - void setDim(float dim); + void setDimming(float dimming); friend Font; }; diff --git a/resources/shaders/glsl/core.glsl b/resources/shaders/glsl/core.glsl index 5bf72fe14..91a423406 100644 --- a/resources/shaders/glsl/core.glsl +++ b/resources/shaders/glsl/core.glsl @@ -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.