mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Improved the renderer scaling accuracy.
This commit is contained in:
parent
d242c84ea8
commit
dda63403fa
|
@ -206,7 +206,7 @@ void GuiComponent::setDimming(float dimming)
|
||||||
const glm::mat4& GuiComponent::getTransform()
|
const glm::mat4& GuiComponent::getTransform()
|
||||||
{
|
{
|
||||||
mTransform = Renderer::getIdentity();
|
mTransform = Renderer::getIdentity();
|
||||||
mTransform = glm::translate(mTransform, mPosition);
|
mTransform = glm::translate(mTransform, glm::round(mPosition));
|
||||||
|
|
||||||
if (mScale != 1.0f)
|
if (mScale != 1.0f)
|
||||||
mTransform = glm::scale(mTransform, glm::vec3 {mScale});
|
mTransform = glm::scale(mTransform, glm::vec3 {mScale});
|
||||||
|
@ -228,8 +228,10 @@ const glm::mat4& GuiComponent::getTransform()
|
||||||
if (xOff != 0.0f || yOff != 0.0f)
|
if (xOff != 0.0f || yOff != 0.0f)
|
||||||
mTransform = glm::translate(mTransform, glm::vec3 {xOff, yOff, 0.0f});
|
mTransform = glm::translate(mTransform, glm::vec3 {xOff, yOff, 0.0f});
|
||||||
}
|
}
|
||||||
mTransform = glm::translate(
|
|
||||||
mTransform, glm::vec3 {mOrigin.x * mSize.x * -1.0f, mOrigin.y * mSize.y * -1.0f, 0.0f});
|
mTransform =
|
||||||
|
glm::translate(mTransform, glm::vec3 {std::round(mOrigin.x * mSize.x * -1.0f),
|
||||||
|
std::round(mOrigin.y * mSize.y * -1.0f), 0.0f});
|
||||||
|
|
||||||
return mTransform;
|
return mTransform;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ void TextComponent::render(const glm::mat4& parentTrans)
|
||||||
mRenderer->drawRect(0.0f, 0.0f, mSize.x, mSize.y, 0x0000FF33, 0x0000FF33);
|
mRenderer->drawRect(0.0f, 0.0f, mSize.x, mSize.y, 0x0000FF33, 0x0000FF33);
|
||||||
}
|
}
|
||||||
|
|
||||||
trans = glm::translate(trans, glm::vec3 {0.0f, yOff, 0.0f});
|
trans = glm::translate(trans, glm::vec3 {0.0f, std::round(yOff), 0.0f});
|
||||||
mRenderer->setMatrix(trans);
|
mRenderer->setMatrix(trans);
|
||||||
|
|
||||||
// Draw the text area, where the text actually is located.
|
// Draw the text area, where the text actually is located.
|
||||||
|
|
|
@ -278,7 +278,6 @@ void RendererOpenGL::destroyContext()
|
||||||
void RendererOpenGL::setMatrix(const glm::mat4& matrix)
|
void RendererOpenGL::setMatrix(const glm::mat4& matrix)
|
||||||
{
|
{
|
||||||
mTrans = matrix;
|
mTrans = matrix;
|
||||||
mTrans[3] = glm::round(mTrans[3]);
|
|
||||||
mTrans = getProjectionMatrix() * mTrans;
|
mTrans = getProjectionMatrix() * mTrans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue