mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
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:
parent
f6261205d4
commit
3a2de2bc6a
1 changed files with 13 additions and 5 deletions
|
@ -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 void _updateLayer(LottieLayer* root, LottieLayer* layer, int32_t frameNo);
|
||||||
static bool _buildPrecomp(LottieComposition* comp, LottieGroup* parent);
|
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)
|
static void _rotateY(Matrix* m, float degree)
|
||||||
{
|
{
|
||||||
if (degree == 0.0f) return;
|
if (degree == 0.0f) return;
|
||||||
auto radian = degree / 180.0f * M_PI;
|
auto radian = degree / 180.0f * M_PI;
|
||||||
m->e11 = cosf(radian);
|
m->e11 *= cosf(radian);
|
||||||
m->e31 = -sinf(radian);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _rotateX(Matrix* m, float degree)
|
static void _rotationZ(Matrix* m, float degree)
|
||||||
{
|
{
|
||||||
if (degree == 0.0f) return;
|
if (degree == 0.0f) return;
|
||||||
auto radian = degree / 180.0f * M_PI;
|
auto radian = degree / 180.0f * M_PI;
|
||||||
|
m->e11 = cosf(radian);
|
||||||
|
m->e12 = -sinf(radian);
|
||||||
|
m->e21 = sinf(radian);
|
||||||
m->e22 = cosf(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;
|
auto angle = 0.0f;
|
||||||
if (autoOrient) angle = transform->position.angle(frameNo);
|
if (autoOrient) angle = transform->position.angle(frameNo);
|
||||||
mathRotate(&matrix, transform->rotation(frameNo) + angle);
|
_rotationZ(&matrix, transform->rotation(frameNo) + angle);
|
||||||
|
|
||||||
if (transform->rotationEx) {
|
if (transform->rotationEx) {
|
||||||
_rotateY(&matrix, transform->rotationEx->y(frameNo));
|
_rotateY(&matrix, transform->rotationEx->y(frameNo));
|
||||||
|
|
Loading…
Add table
Reference in a new issue