mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[sfml] Fix clipping
This commit is contained in:
parent
d33c10f856
commit
b01bac8332
@ -79,7 +79,7 @@ Vector<int> &Triangulator::triangulate(Vector<float> &vertices) {
|
|||||||
if (!isConcaveArray[ii]) continue;
|
if (!isConcaveArray[ii]) continue;
|
||||||
|
|
||||||
int v = indices[ii] << 1;
|
int v = indices[ii] << 1;
|
||||||
float &vx = vertices[v], vy = vertices[v + 1];
|
float vx = vertices[v], vy = vertices[v + 1];
|
||||||
if (positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
|
if (positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
|
||||||
if (positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
|
if (positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
|
||||||
if (positiveArea(p2x, p2y, p3x, p3y, vx, vy)) {
|
if (positiveArea(p2x, p2y, p3x, p3y, vx, vy)) {
|
||||||
|
|||||||
@ -125,10 +125,13 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
|
|||||||
for (int i = 0; i < skeleton->slotsCount; ++i) {
|
for (int i = 0; i < skeleton->slotsCount; ++i) {
|
||||||
Slot* slot = skeleton->drawOrder[i];
|
Slot* slot = skeleton->drawOrder[i];
|
||||||
Attachment* attachment = slot->attachment;
|
Attachment* attachment = slot->attachment;
|
||||||
if (!attachment) continue;
|
if (!attachment) {
|
||||||
|
spSkeletonClipping_clipEnd(clipper, slot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Early out if slot is invisible
|
// Early out if slot is invisible
|
||||||
if (slot->color.a == 0 || !slot->bone->active) {
|
if ((slot->color.a == 0 || !slot->bone->active) && attachment->type != SP_ATTACHMENT_CLIPPING) {
|
||||||
spSkeletonClipping_clipEnd(clipper, slot);
|
spSkeletonClipping_clipEnd(clipper, slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,10 +100,13 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
|
|||||||
for (unsigned i = 0; i < skeleton->getSlots().size(); ++i) {
|
for (unsigned i = 0; i < skeleton->getSlots().size(); ++i) {
|
||||||
Slot &slot = *skeleton->getDrawOrder()[i];
|
Slot &slot = *skeleton->getDrawOrder()[i];
|
||||||
Attachment *attachment = slot.getAttachment();
|
Attachment *attachment = slot.getAttachment();
|
||||||
if (!attachment) continue;
|
if (!attachment) {
|
||||||
|
clipper.clipEnd(slot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Early out if the slot color is 0 or the bone is not active
|
// Early out if the slot color is 0 or the bone is not active
|
||||||
if (slot.getColor().a == 0 || !slot.getBone().isActive()) {
|
if ((slot.getColor().a == 0 || !slot.getBone().isActive()) && !attachment->getRTTI().isExactly(ClippingAttachment::rtti)) {
|
||||||
clipper.clipEnd(slot);
|
clipper.clipEnd(slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user