I'm implementing support for the Spine runtime.
Problem:
I have a Skeleton that shows up in the correct orientation in the editor, but it's flipped inside of the game.
I tried inverting the value of uv.y by multiplying by -1, but doesn't work. I tried a few other things, to no avail.
Any ideas on how to fix this?
The draw code is based on the CPP examples:
for (size_t i = 0; i < slotCount; ++i) {
auto slot = drawOrder[i];
auto attachment = slot->getAttachment();
if (attachment == nullptr) { continue; }
auto& rtti = attachment->getRTTI();
if (rtti.isExactly(spine::RegionAttachment::rtti)) {
auto regionAtt = static_cast<spine::RegionAttachment*>(attachment);
if (regionAtt->getColor().a == 0) { // Not visible, so doesn't need to be drawn.
continue;
}
computedVertices.setSize(8, 0);
auto atlas = (Atlas *)((spine::AtlasRegion *)regionAtt->getRendererObject())->page->getRendererObject();
regionAtt->computeWorldVertices(slot->getBone(), computedVertices, 0, 2);
auto uvs = ®ionAtt->getUVs();
constexpr int8_t indexCount = 6;
constexpr int8_t vertexCount = 4;
auto indexOffset = i * vertexCount;
for (uint8_t j = 0; j < indexCount; ++j) {
uint16_t index = quadIndexes[j];
mIndexes.push_back(uint16_t(index + indexOffset));
}
for (uint8_t j = 0, k = 0; j < vertexCount; ++j, k += 2) {
mVertices.emplace_back();
auto& vert = mVertices.back();
vert.mPos.x = computedVertices[k];
vert.mPos.y = computedVertices[k + 1];
vert.mCoord.x = (*uvs)[k];
vert.mCoord.y = ((*uvs)[k + 1]);
}
}
}