common math: enhance matrix functions.

Accumulating matrix value factors would have broader usage.
This commit is contained in:
Hermet Park 2023-07-04 01:13:42 +09:00 committed by Hermet Park
parent b81b23af62
commit 46aa29781a
2 changed files with 6 additions and 6 deletions

View file

@ -109,17 +109,17 @@ static inline void mathIdentity(Matrix* m)
} }
static inline void mathScale(Matrix* m, float scale) static inline void mathScale(Matrix* m, float sx, float sy)
{ {
m->e11 = scale; m->e11 *= sx;
m->e22 = scale; m->e22 *= sy;
} }
static inline void mathTranslate(Matrix* m, float x, float y) static inline void mathTranslate(Matrix* m, float x, float y)
{ {
m->e13 = x; m->e13 += x;
m->e23 = y; m->e23 += y;
} }

View file

@ -53,7 +53,7 @@ bool RenderTransform::update()
mathIdentity(&m); mathIdentity(&m);
mathScale(&m, scale); mathScale(&m, scale, scale);
if (!mathZero(degree)) mathRotate(&m, degree); if (!mathZero(degree)) mathRotate(&m, degree);