mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-15 03:21:35 +08:00
[cpp] Fix DeformTimeline, Slot::setAttachment
DeformTimeline had a misplaced return, Slot::setAttachment was not exactly matching the reference implementation if _attachment or inValue where NULL.
This commit is contained in:
parent
c41cc94008
commit
eedaccc418
@ -100,23 +100,23 @@ void DeformTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vecto
|
||||
return;
|
||||
}
|
||||
deformArray.setSize(vertexCount, 0);
|
||||
Vector<float> &deformInner = deformArray;
|
||||
Vector<float> &deform = deformArray;
|
||||
if (attachment->getBones().size() == 0) {
|
||||
// Unweighted vertex positions.
|
||||
Vector<float> &setupVertices = attachment->getVertices();
|
||||
for (size_t i = 0; i < vertexCount; i++)
|
||||
deformInner[i] += (setupVertices[i] - deformInner[i]) * alpha;
|
||||
deform[i] += (setupVertices[i] - deform[i]) * alpha;
|
||||
} else {
|
||||
// Weighted deform offsets.
|
||||
alpha = 1 - alpha;
|
||||
for (size_t i = 0; i < vertexCount; i++)
|
||||
deformInner[i] *= alpha;
|
||||
deform[i] *= alpha;
|
||||
}
|
||||
}
|
||||
case MixBlend_Replace:
|
||||
case MixBlend_Add:
|
||||
return;
|
||||
case MixBlend_Add: {}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
deformArray.setSize(vertexCount, 0);
|
||||
|
||||
@ -99,7 +99,9 @@ void Slot::setAttachment(Attachment *inValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inValue && _attachment) {
|
||||
if (!inValue || !_attachment) {
|
||||
_deform.clear();
|
||||
} else {
|
||||
if (!(inValue->getRTTI().instanceOf(VertexAttachment::rtti)) ||
|
||||
!(_attachment->getRTTI().instanceOf(VertexAttachment::rtti)) ||
|
||||
(static_cast<VertexAttachment *>(inValue)->getDeformAttachment() !=
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user