mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 16:48:43 +08:00
[c] Closes #2509, SP_INHERIT_NOSCALE was incorrectly implemented
This commit is contained in:
parent
39635f7566
commit
04c132f4af
@ -161,21 +161,26 @@ void spBone_updateWorldTransformWith(spBone *self, float x, float y, float rotat
|
||||
float za = (pa * cosine + pb * sine) / sx;
|
||||
float zc = (pc * cosine + pd * sine) / sy;
|
||||
float s = SQRT(za * za + zc * zc);
|
||||
if (self->data->inherit == SP_INHERIT_NOSCALE && (pa * pd - pb * pc < 0) != (sx < 0 != sy < 0))
|
||||
s = -s;
|
||||
rotation = PI / 2 + ATAN2(zc, za);
|
||||
float zb = COS(rotation) * s;
|
||||
float zd = SIN(rotation) * s;
|
||||
shearX *= DEG_RAD;
|
||||
shearY = (90 + shearY) * DEG_RAD;
|
||||
float la = COS(shearX) * scaleX;
|
||||
float lb = COS(shearY) * scaleY;
|
||||
float lc = SIN(shearX) * scaleX;
|
||||
float ld = SIN(shearY) * scaleY;
|
||||
self->a = za * la + zb * lc;
|
||||
self->b = za * lb + zb * ld;
|
||||
self->c = zc * la + zd * lc;
|
||||
self->d = zc * lb + zd * ld;
|
||||
if (s > 0.00001f) s = 1 / s;
|
||||
za *= s;
|
||||
zc *= s;
|
||||
s = SQRT(za * za + zc * zc);
|
||||
if (self->inherit == SP_INHERIT_NOSCALE &&
|
||||
(pa * pd - pb * pc < 0) != (sx < 0 != sy < 0))
|
||||
s = -s;
|
||||
rotation = PI / 2 + ATAN2(zc, za);
|
||||
float zb = COS(rotation) * s;
|
||||
float zd = SIN(rotation) * s;
|
||||
shearX *= DEG_RAD;
|
||||
shearY = (90 + shearY) * DEG_RAD;
|
||||
float la = COS(shearX) * scaleX;
|
||||
float lb = COS(shearY) * scaleY;
|
||||
float lc = SIN(shearX) * scaleX;
|
||||
float ld = SIN(shearY) * scaleY;
|
||||
self->a = za * la + zb * lc;
|
||||
self->b = za * lb + zb * ld;
|
||||
self->c = zc * la + zd * lc;
|
||||
self->d = zc * lb + zd * ld;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user