mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
[cpp] MSVC fixes
This commit is contained in:
parent
b33e13f985
commit
ef57000eab
@ -163,12 +163,12 @@ void BonePose::updateLocalTransform(Skeleton &skeleton) {
|
|||||||
if (_bone->getParent() == nullptr) {
|
if (_bone->getParent() == nullptr) {
|
||||||
_x = _worldX - skeleton.getX();
|
_x = _worldX - skeleton.getX();
|
||||||
_y = _worldY - skeleton.getY();
|
_y = _worldY - skeleton.getY();
|
||||||
float _a = this->_a, _b = this->_b, _c = this->_c, _d = this->_d;
|
float a = this->_a, b = this->_b, c = this->_c, d = this->_d;
|
||||||
_rotation = MathUtil::atan2(_c, _a) * MathUtil::Rad_Deg;
|
_rotation = MathUtil::atan2(c, a) * MathUtil::Rad_Deg;
|
||||||
_scaleX = MathUtil::sqrt(_a * _a + _c * _c);
|
_scaleX = MathUtil::sqrt(a * a + c * c);
|
||||||
_scaleY = MathUtil::sqrt(_b * _b + _d * _d);
|
_scaleY = MathUtil::sqrt(b * b + d * d);
|
||||||
_shearX = 0;
|
_shearX = 0;
|
||||||
_shearY = MathUtil::atan2(_a * _b + _c * _d, _a * _d - _b * _c) * MathUtil::Rad_Deg;
|
_shearY = MathUtil::atan2(a * b + c * d, a * d - b * c) * MathUtil::Rad_Deg;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,16 +306,16 @@ float BonePose::getWorldX() {
|
|||||||
return _worldX;
|
return _worldX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BonePose::setWorldX(float _worldX) {
|
void BonePose::setWorldX(float worldX) {
|
||||||
this->_worldX = _worldX;
|
this->_worldX = worldX;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BonePose::getWorldY() {
|
float BonePose::getWorldY() {
|
||||||
return _worldY;
|
return _worldY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BonePose::setWorldY(float _worldY) {
|
void BonePose::setWorldY(float worldY) {
|
||||||
this->_worldY = _worldY;
|
this->_worldY = worldY;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BonePose::getWorldRotationX() {
|
float BonePose::getWorldRotationX() {
|
||||||
@ -337,9 +337,9 @@ float BonePose::getWorldScaleY() {
|
|||||||
|
|
||||||
void BonePose::worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY) {
|
void BonePose::worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY) {
|
||||||
float det = _a * _d - _b * _c;
|
float det = _a * _d - _b * _c;
|
||||||
float _x = worldX - _worldX, _y = worldY - _worldY;
|
float x = worldX - _worldX, y = worldY - _worldY;
|
||||||
outLocalX = (_x * _d - _y * _b) / det;
|
outLocalX = (x * _d - y * _b) / det;
|
||||||
outLocalY = (_y * _a - _x * _c) / det;
|
outLocalY = (y * _a - x * _c) / det;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BonePose::localToWorld(float localX, float localY, float &outWorldX, float &outWorldY) {
|
void BonePose::localToWorld(float localX, float localY, float &outWorldX, float &outWorldY) {
|
||||||
|
|||||||
@ -116,7 +116,7 @@ SkeletonData *SkeletonBinary::readSkeletonDataFile(const String &path) {
|
|||||||
String nameWithoutExtension(filename);
|
String nameWithoutExtension(filename);
|
||||||
const char *lastDot = strrchr(nameWithoutExtension.buffer(), '.');
|
const char *lastDot = strrchr(nameWithoutExtension.buffer(), '.');
|
||||||
if (lastDot) {
|
if (lastDot) {
|
||||||
int length = (int) (lastDot - nameWithoutExtension.buffer());
|
length = (int) (lastDot - nameWithoutExtension.buffer());
|
||||||
nameWithoutExtension = nameWithoutExtension.substring(0, length);
|
nameWithoutExtension = nameWithoutExtension.substring(0, length);
|
||||||
}
|
}
|
||||||
skeletonData->_name = nameWithoutExtension;
|
skeletonData->_name = nameWithoutExtension;
|
||||||
@ -464,7 +464,8 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
|
|
||||||
/* Linked meshes. */
|
/* Linked meshes. */
|
||||||
Array<LinkedMesh *> &items = _linkedMeshes;
|
Array<LinkedMesh *> &items = _linkedMeshes;
|
||||||
for (int i = 0, n = (int) items.size(); i < n; i++) {
|
n = (int) items.size();
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
LinkedMesh *linkedMesh = items[i];
|
LinkedMesh *linkedMesh = items[i];
|
||||||
Skin *skin = skeletonData->_skins[linkedMesh->_skinIndex];
|
Skin *skin = skeletonData->_skins[linkedMesh->_skinIndex];
|
||||||
Attachment *parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent);
|
Attachment *parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent);
|
||||||
@ -1248,7 +1249,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
if (end == 0) {
|
if (end == 0) {
|
||||||
if (weighted) {
|
if (weighted) {
|
||||||
deform.setSize(deformLength, 0);
|
deform.setSize(deformLength, 0);
|
||||||
for (int i = 0; i < deformLength; ++i) deform[i] = 0;
|
for (int iiii = 0; iiii < deformLength; ++iiii) deform[iiii] = 0;
|
||||||
} else {
|
} else {
|
||||||
deform.clearAndAddAll(vertices);
|
deform.clearAndAddAll(vertices);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user