Simplify Drawable code

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-10-18 22:06:52 -03:00
parent a844c16657
commit b8b670e0ae
23 changed files with 93 additions and 159 deletions
+6 -8
View File
@@ -182,21 +182,19 @@ void Text::set(const std::vector<Font::ColoredString> &text, float wrap, Font::A
Font::ColoredCodepoints codepoints;
Font::getCodepointsFromString(text, codepoints);
addTextData({codepoints, wrap, align, {}, false, false, Matrix3()});
addTextData({codepoints, wrap, align, {}, false, false, Matrix4()});
}
int Text::add(const std::vector<Font::ColoredString> &text, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
int Text::add(const std::vector<Font::ColoredString> &text, const Matrix4 &m)
{
return addf(text, -1.0f, Font::ALIGN_MAX_ENUM, x, y, angle, sx, sy, ox, oy, kx, ky);
return addf(text, -1.0f, Font::ALIGN_MAX_ENUM, m);
}
int Text::addf(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
int Text::addf(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align, const Matrix4 &m)
{
Font::ColoredCodepoints codepoints;
Font::getCodepointsFromString(text, codepoints);
Matrix3 m(x, y, angle, sx, sy, ox, oy, kx, ky);
addTextData({codepoints, wrap, align, {}, true, true, m});
return (int) text_data.size() - 1;
@@ -210,7 +208,7 @@ void Text::clear()
vert_offset = 0;
}
void Text::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
void Text::draw(const Matrix4 &m)
{
if (vbo == nullptr || draw_commands.empty())
return;
@@ -227,7 +225,7 @@ void Text::draw(float x, float y, float angle, float sx, float sy, float ox, flo
const size_t stride = sizeof(Font::GlyphVertex);
OpenGL::TempTransform transform(gl);
transform.get() *= Matrix4(x, y, angle, sx, sy, ox, oy, kx, ky);
transform.get() *= m;
{
GLBuffer::Bind bind(*vbo);