mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[cpp] Fix more warnings on latest Clang.
This commit is contained in:
parent
2e179b4e03
commit
4a89b2b84d
@ -61,7 +61,7 @@ namespace spine {
|
||||
void updateRegion();
|
||||
|
||||
/// Transforms the attachment's four vertices to world coordinates.
|
||||
/// @param bone The parent bone.
|
||||
/// @param slot The parent slot.
|
||||
/// @param worldVertices The output world vertices. Must have a length greater than or equal to offset + 8.
|
||||
/// @param offset The worldVertices index to begin writing values.
|
||||
/// @param stride The number of worldVertices entries between the value pairs written.
|
||||
|
||||
@ -523,7 +523,7 @@ void Bone::updateAppliedTransform() {
|
||||
break;
|
||||
}
|
||||
case TransformMode_NoScale:
|
||||
case TransformMode_NoScaleOrReflection:
|
||||
case TransformMode_NoScaleOrReflection: {
|
||||
float cos = MathUtil::cosDeg(_rotation), sin = MathUtil::sinDeg(_rotation);
|
||||
pa = (pa * cos + pb * sin) / _skeleton.getScaleX();
|
||||
pc = (pc * cos + pd * sin) / _skeleton.getScaleY();
|
||||
@ -540,7 +540,11 @@ void Bone::updateAppliedTransform() {
|
||||
ia = pd * pid;
|
||||
ib = pb * pid;
|
||||
ic = pc * pid;
|
||||
id = pa * pid;
|
||||
id = pa * pid;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ra = ia * _a - ib * _c;
|
||||
rb = ia * _b - ib * _d;
|
||||
|
||||
@ -154,11 +154,11 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY
|
||||
}
|
||||
x = targetX - pp->_worldX;
|
||||
y = targetY - pp->_worldY;
|
||||
tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py;
|
||||
tx = (x * d - y * b) * id - px; ty = (y * a - x * c) * id - py;
|
||||
dd = tx * tx + ty * ty;
|
||||
if (softness != 0) {
|
||||
softness *= psx * (csx + 1) * 0.5f;
|
||||
td = MathUtil::sqrt(dd), sd = td - l1 - l2 * psx + softness;
|
||||
td = MathUtil::sqrt(dd); sd = td - l1 - l2 * psx + softness;
|
||||
if (sd > 0) {
|
||||
p = MathUtil::min(1.0f, sd / (softness * 2)) - 1;
|
||||
p = (sd - softness * (1 - p * p)) / td;
|
||||
@ -188,7 +188,7 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY
|
||||
b = l2 * MathUtil::sin(a2);
|
||||
a1 = MathUtil::atan2(ty * a - tx * b, tx * a + ty * b);
|
||||
} else {
|
||||
a = psx * l2, b = psy * l2;
|
||||
a = psx * l2; b = psy * l2;
|
||||
float aa = a * a, bb = b * b, ll = l1 * l1, ta = MathUtil::atan2(ty, tx);
|
||||
float c0 = bb * ll + aa * dd - aa * bb, c1 = -2 * bb * l1, c2 = bb - aa;
|
||||
d = c1 * c1 - 4 * c2 * c0;
|
||||
|
||||
@ -109,9 +109,9 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
||||
int lowHash = readInt(input);
|
||||
int hightHash = readInt(input);
|
||||
String hashString;
|
||||
sprintf(buffer, "%x", hightHash);
|
||||
snprintf(buffer, 16, "%x", hightHash);
|
||||
hashString.append(buffer);
|
||||
sprintf(buffer, "%x", lowHash);
|
||||
snprintf(buffer, 16, "%x", lowHash);
|
||||
hashString.append(buffer);
|
||||
skeletonData->_hash = hashString;
|
||||
|
||||
@ -120,7 +120,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
||||
|
||||
if (!skeletonData->_version.startsWith(SPINE_VERSION_STRING)) {
|
||||
char errorMsg[255];
|
||||
sprintf(errorMsg, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
|
||||
snprintf(errorMsg, 255, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
|
||||
setError(errorMsg, "");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
|
||||
skeletonData->_version = Json::getString(skeleton, "spine", 0);
|
||||
if (!skeletonData->_version.startsWith(SPINE_VERSION_STRING)) {
|
||||
char errorMsg[255];
|
||||
sprintf(errorMsg, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
|
||||
snprintf(errorMsg, 255, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
|
||||
setError(NULL, errorMsg, "");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user