lottie/builder: fix a regression bug.

currently thorvg doesn't support full 3d transformation.
orthogonal projection is mandatory.

Issue: https://github.com/thorvg/thorvg/issues/1698
This commit is contained in:
Hermet Park 2023-10-13 14:12:24 +09:00 committed by Hermet Park
parent f6261205d4
commit 3a2de2bc6a

View file

@ -86,22 +86,30 @@ static void _updateChildren(LottieGroup* parent, int32_t frameNo, queue<RenderCo
static void _updateLayer(LottieLayer* root, LottieLayer* layer, int32_t frameNo);
static bool _buildPrecomp(LottieComposition* comp, LottieGroup* parent);
static void _rotateX(Matrix* m, float degree)
{
if (degree == 0.0f) return;
auto radian = degree / 180.0f * M_PI;
m->e22 *= cosf(radian);
}
static void _rotateY(Matrix* m, float degree)
{
if (degree == 0.0f) return;
auto radian = degree / 180.0f * M_PI;
m->e11 = cosf(radian);
m->e31 = -sinf(radian);
m->e11 *= cosf(radian);
}
static void _rotateX(Matrix* m, float degree)
static void _rotationZ(Matrix* m, float degree)
{
if (degree == 0.0f) return;
auto radian = degree / 180.0f * M_PI;
m->e11 = cosf(radian);
m->e12 = -sinf(radian);
m->e21 = sinf(radian);
m->e22 = cosf(radian);
m->e32 = -sinf(radian);
}
@ -123,7 +131,7 @@ static bool _updateTransform(LottieTransform* transform, int32_t frameNo, bool a
auto angle = 0.0f;
if (autoOrient) angle = transform->position.angle(frameNo);
mathRotate(&matrix, transform->rotation(frameNo) + angle);
_rotationZ(&matrix, transform->rotation(frameNo) + angle);
if (transform->rotationEx) {
_rotateY(&matrix, transform->rotationEx->y(frameNo));