mirror of https://github.com/axmolengine/axmol.git
Fix spine RotateTimeline
This commit is contained in:
parent
a657ba7585
commit
e39d3de685
|
@ -98,37 +98,7 @@ void SkeletonRenderer::initialize () {
|
|||
_skeleton->updateWorldTransform();
|
||||
}
|
||||
|
||||
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
||||
if (twoColorTintEnabled) {
|
||||
#if COCOS2D_VERSION < 0x00040000
|
||||
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Texture2D *texture = nullptr;
|
||||
for (int i = 0, n = _skeleton->getSlots().size(); i < n; i++) {
|
||||
Slot* slot = _skeleton->getDrawOrder()[i];
|
||||
Attachment* const attachment = slot->getAttachment();
|
||||
if (!attachment) continue;
|
||||
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
RegionAttachment* regionAttachment = static_cast<RegionAttachment*>(attachment);
|
||||
texture = static_cast<AttachmentVertices*>(regionAttachment->getRendererObject())->_texture;
|
||||
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
MeshAttachment* meshAttachment = static_cast<MeshAttachment*>(attachment);
|
||||
texture = static_cast<AttachmentVertices*>(meshAttachment->getRendererObject())->_texture;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (texture != nullptr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if COCOS2D_VERSION < 0x00040000
|
||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP, texture));
|
||||
#endif
|
||||
}
|
||||
void SkeletonRenderer::setupGLProgramState (bool /*twoColorTintEnabled*/) {}
|
||||
|
||||
void SkeletonRenderer::setSkeletonData (SkeletonData *skeletonData, bool ownsSkeletonData) {
|
||||
_skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData);
|
||||
|
|
|
@ -67,7 +67,7 @@ void RotateTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
|
|||
}
|
||||
case MixBlend_First: {
|
||||
float r = bone->_data._rotation - bone->_rotation;
|
||||
bone->_rotation += (r - (16384 - (int) (16384.499999999996 - r / 360)) * 360) * alpha;
|
||||
bone->_rotation += r * alpha;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
@ -87,7 +87,6 @@ void RotateTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
|
|||
case MixBlend_First:
|
||||
case MixBlend_Replace:
|
||||
r += bone->_data._rotation - bone->_rotation;
|
||||
r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
|
||||
// Fall through.
|
||||
case MixBlend_Add:
|
||||
bone->_rotation += r * alpha;
|
||||
|
@ -105,14 +104,14 @@ void RotateTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
|
|||
r = prevRotation + (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * percent;
|
||||
switch (blend) {
|
||||
case MixBlend_Setup:
|
||||
bone->_rotation = bone->_data._rotation + (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha;
|
||||
bone->_rotation = bone->_data._rotation + r * alpha;
|
||||
break;
|
||||
case MixBlend_First:
|
||||
case MixBlend_Replace:
|
||||
r += bone->_data._rotation - bone->_rotation;
|
||||
// Fall through.
|
||||
case MixBlend_Add:
|
||||
bone->_rotation += (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha;
|
||||
bone->_rotation += r * alpha; // don't needs mod degree again
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue