Fixed some graphical glitches in NinePatchComponent and ButtonComponent.

This commit is contained in:
Leon Styhre 2022-04-21 20:29:17 +02:00
parent dbfab96e03
commit 440e089847
2 changed files with 2 additions and 0 deletions

View file

@ -133,6 +133,7 @@ void ButtonComponent::render(const glm::mat4& parentTrans)
glm::vec3 centerOffset {(mSize.x - mTextCache->metrics.size.x) / 2.0f, glm::vec3 centerOffset {(mSize.x - mTextCache->metrics.size.x) / 2.0f,
(mSize.y - mTextCache->metrics.size.y) / 2.0f, 0.0f}; (mSize.y - mTextCache->metrics.size.y) / 2.0f, 0.0f};
trans = glm::translate(trans, centerOffset); trans = glm::translate(trans, centerOffset);
trans[3] = glm::round(trans[3]);
if (Settings::getInstance()->getBool("DebugText")) { if (Settings::getInstance()->getBool("DebugText")) {
mRenderer->drawRect(centerOffset.x, 0.0f, mTextCache->metrics.size.x, mSize.y, mRenderer->drawRect(centerOffset.x, 0.0f, mTextCache->metrics.size.x, mSize.y,

View file

@ -132,6 +132,7 @@ void NinePatchComponent::render(const glm::mat4& parentTrans)
glm::mat4 trans {parentTrans * getTransform()}; glm::mat4 trans {parentTrans * getTransform()};
if (mTexture && mVertices != nullptr) { if (mTexture && mVertices != nullptr) {
trans[3] = glm::round(trans[3]);
mRenderer->setMatrix(trans); mRenderer->setMatrix(trans);
mVertices->opacity = mOpacity; mVertices->opacity = mOpacity;
mTexture->bind(); mTexture->bind();