* [spine-cocos2d-iphone] update SkeletonRenderer to latest refactor

* [spine-cocos2dx/2] update SkeletonRenderer to latest refactor
This commit is contained in:
jpoag 2014-09-01 11:55:02 -04:00
parent 60fc7ac56e
commit 059f1c57b7
3 changed files with 36 additions and 36 deletions

View File

@ -149,14 +149,14 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
const int* triangles = 0; const int* triangles = 0;
int trianglesCount = 0; int trianglesCount = 0;
float r = 0, g = 0, b = 0, a = 0; float r = 0, g = 0, b = 0, a = 0;
for (int i = 0, n = _skeleton->slotCount; i < n; i++) { for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
spSlot* slot = _skeleton->drawOrder[i]; spSlot* slot = _skeleton->drawOrder[i];
if (!slot->attachment) continue; if (!slot->attachment) continue;
CCTexture2D *texture = 0; CCTexture2D *texture = 0;
switch (slot->attachment->type) { switch (slot->attachment->type) {
case SP_ATTACHMENT_REGION: { case SP_ATTACHMENT_REGION: {
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
texture = [self getTextureForRegion:attachment]; texture = [self getTextureForRegion:attachment];
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = 8; verticesCount = 8;
@ -170,7 +170,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
} }
case SP_ATTACHMENT_MESH: { case SP_ATTACHMENT_MESH: {
spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment; spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment;
spMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spMeshAttachment_computeWorldVertices(attachment, slot, worldVertices);
texture = [self getTextureForMesh:attachment]; texture = [self getTextureForMesh:attachment];
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = attachment->verticesCount; verticesCount = attachment->verticesCount;
@ -184,7 +184,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
} }
case SP_ATTACHMENT_SKINNED_MESH: { case SP_ATTACHMENT_SKINNED_MESH: {
spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment; spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment;
spSkinnedMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spSkinnedMeshAttachment_computeWorldVertices(attachment, slot, worldVertices);
texture = [self getTextureForSkinnedMesh:attachment]; texture = [self getTextureForSkinnedMesh:attachment];
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = attachment->uvsCount; verticesCount = attachment->uvsCount;
@ -220,11 +220,11 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
ccDrawColor4B(0, 0, 255, 255); ccDrawColor4B(0, 0, 255, 255);
glLineWidth(1); glLineWidth(1);
CGPoint points[4]; CGPoint points[4];
for (int i = 0, n = _skeleton->slotCount; i < n; i++) { for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
spSlot* slot = _skeleton->drawOrder[i]; spSlot* slot = _skeleton->drawOrder[i];
if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue; if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue;
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
points[0] = ccp(worldVertices[0], worldVertices[1]); points[0] = ccp(worldVertices[0], worldVertices[1]);
points[1] = ccp(worldVertices[2], worldVertices[3]); points[1] = ccp(worldVertices[2], worldVertices[3]);
points[2] = ccp(worldVertices[4], worldVertices[5]); points[2] = ccp(worldVertices[4], worldVertices[5]);
@ -236,7 +236,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
// Bone lengths. // Bone lengths.
glLineWidth(2); glLineWidth(2);
ccDrawColor4B(255, 0, 0, 255); ccDrawColor4B(255, 0, 0, 255);
for (int i = 0, n = _skeleton->boneCount; i < n; i++) { for (int i = 0, n = _skeleton->bonesCount; i < n; i++) {
spBone *bone = _skeleton->bones[i]; spBone *bone = _skeleton->bones[i];
float x = bone->data->length * bone->m00 + bone->worldX; float x = bone->data->length * bone->m00 + bone->worldX;
float y = bone->data->length * bone->m10 + bone->worldY; float y = bone->data->length * bone->m10 + bone->worldY;
@ -245,7 +245,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
// Bone origins. // Bone origins.
ccPointSize(4); ccPointSize(4);
ccDrawColor4B(0, 0, 255, 255); // Root bone is blue. ccDrawColor4B(0, 0, 255, 255); // Root bone is blue.
for (int i = 0, n = _skeleton->boneCount; i < n; i++) { for (int i = 0, n = _skeleton->bonesCount; i < n; i++) {
spBone *bone = _skeleton->bones[i]; spBone *bone = _skeleton->bones[i];
ccDrawPoint(ccp(bone->worldX, bone->worldY)); ccDrawPoint(ccp(bone->worldX, bone->worldY));
if (i == 0) ccDrawColor4B(0, 255, 0, 255); if (i == 0) ccDrawColor4B(0, 255, 0, 255);
@ -268,21 +268,21 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
- (CGRect) boundingBox { - (CGRect) boundingBox {
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN; float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
float scaleX = self.scaleX, scaleY = self.scaleY; float scaleX = self.scaleX, scaleY = self.scaleY;
for (int i = 0; i < _skeleton->slotCount; ++i) { for (int i = 0; i < _skeleton->slotsCount; ++i) {
spSlot* slot = _skeleton->slots[i]; spSlot* slot = _skeleton->slots[i];
if (!slot->attachment) continue; if (!slot->attachment) continue;
int verticesCount; int verticesCount;
if (slot->attachment->type == SP_ATTACHMENT_REGION) { if (slot->attachment->type == SP_ATTACHMENT_REGION) {
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
verticesCount = 8; verticesCount = 8;
} else if (slot->attachment->type == SP_ATTACHMENT_MESH) { } else if (slot->attachment->type == SP_ATTACHMENT_MESH) {
spMeshAttachment* mesh = (spMeshAttachment*)slot->attachment; spMeshAttachment* mesh = (spMeshAttachment*)slot->attachment;
spMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spMeshAttachment_computeWorldVertices(mesh, slot, worldVertices);
verticesCount = mesh->verticesCount; verticesCount = mesh->verticesCount;
} else if (slot->attachment->type == SP_ATTACHMENT_SKINNED_MESH) { } else if (slot->attachment->type == SP_ATTACHMENT_SKINNED_MESH) {
spSkinnedMeshAttachment* mesh = (spSkinnedMeshAttachment*)slot->attachment; spSkinnedMeshAttachment* mesh = (spSkinnedMeshAttachment*)slot->attachment;
spSkinnedMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spSkinnedMeshAttachment_computeWorldVertices(mesh, slot, worldVertices);
verticesCount = mesh->uvsCount; verticesCount = mesh->uvsCount;
} else } else
continue; continue;

View File

@ -147,7 +147,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
const int* triangles = 0; const int* triangles = 0;
int trianglesCount = 0; int trianglesCount = 0;
float r = 0, g = 0, b = 0, a = 0; float r = 0, g = 0, b = 0, a = 0;
for (int i = 0, n = _skeleton->slotCount; i < n; i++) { for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
spSlot* slot = _skeleton->drawOrder[i]; spSlot* slot = _skeleton->drawOrder[i];
if (!slot->attachment) continue; if (!slot->attachment) continue;
@ -155,7 +155,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
switch (slot->attachment->type) { switch (slot->attachment->type) {
case SP_ATTACHMENT_REGION: { case SP_ATTACHMENT_REGION: {
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
texture = [self getTextureForRegion:attachment]; texture = [self getTextureForRegion:attachment];
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = 8; verticesCount = 8;
@ -170,7 +170,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
case SP_ATTACHMENT_MESH: { case SP_ATTACHMENT_MESH: {
spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment; spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment;
spMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spMeshAttachment_computeWorldVertices(attachment, slot, worldVertices);
texture = [self getTextureForMesh:attachment]; texture = [self getTextureForMesh:attachment];
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = attachment->verticesCount; verticesCount = attachment->verticesCount;
@ -185,7 +185,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
case SP_ATTACHMENT_SKINNED_MESH: { case SP_ATTACHMENT_SKINNED_MESH: {
spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment; spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment;
spSkinnedMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spSkinnedMeshAttachment_computeWorldVertices(attachment, slot, worldVertices);
texture = [self getTextureForSkinnedMesh:attachment]; texture = [self getTextureForSkinnedMesh:attachment];
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = attachment->uvsCount; verticesCount = attachment->uvsCount;
@ -233,11 +233,11 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
if (_debugSlots) { if (_debugSlots) {
// Slots. // Slots.
CGPoint points[4]; CGPoint points[4];
for (int i = 0, n = _skeleton->slotCount; i < n; i++) { for (int i = 0, n = _skeleton->slotsCount; i < n; i++) {
spSlot* slot = _skeleton->drawOrder[i]; spSlot* slot = _skeleton->drawOrder[i];
if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue; if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue;
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
points[0] = ccp(worldVertices[0], worldVertices[1]); points[0] = ccp(worldVertices[0], worldVertices[1]);
points[1] = ccp(worldVertices[2], worldVertices[3]); points[1] = ccp(worldVertices[2], worldVertices[3]);
points[2] = ccp(worldVertices[4], worldVertices[5]); points[2] = ccp(worldVertices[4], worldVertices[5]);
@ -248,7 +248,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
} }
if (_debugBones) { if (_debugBones) {
// Bone lengths. // Bone lengths.
for (int i = 0, n = _skeleton->boneCount; i < n; i++) { for (int i = 0, n = _skeleton->bonesCount; i < n; i++) {
spBone *bone = _skeleton->bones[i]; spBone *bone = _skeleton->bones[i];
float x = bone->data->length * bone->m00 + bone->worldX; float x = bone->data->length * bone->m00 + bone->worldX;
float y = bone->data->length * bone->m10 + bone->worldY; float y = bone->data->length * bone->m10 + bone->worldY;
@ -256,7 +256,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
} }
// Bone origins. // Bone origins.
for (int i = 0, n = _skeleton->boneCount; i < n; i++) { for (int i = 0, n = _skeleton->bonesCount; i < n; i++) {
spBone *bone = _skeleton->bones[i]; spBone *bone = _skeleton->bones[i];
[_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor greenColor]]; [_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor greenColor]];
if (i == 0) [_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor blueColor]]; if (i == 0) [_drawNode drawDot:ccp(bone->worldX, bone->worldY) radius:4 color:[CCColor blueColor]];
@ -279,21 +279,21 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0};
- (CGRect) boundingBox { - (CGRect) boundingBox {
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN; float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
float scaleX = self.scaleX, scaleY = self.scaleY; float scaleX = self.scaleX, scaleY = self.scaleY;
for (int i = 0; i < _skeleton->slotCount; ++i) { for (int i = 0; i < _skeleton->slotsCount; ++i) {
spSlot* slot = _skeleton->slots[i]; spSlot* slot = _skeleton->slots[i];
if (!slot->attachment) continue; if (!slot->attachment) continue;
int verticesCount; int verticesCount;
if (slot->attachment->type == SP_ATTACHMENT_REGION) { if (slot->attachment->type == SP_ATTACHMENT_REGION) {
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
verticesCount = 8; verticesCount = 8;
} else if (slot->attachment->type == SP_ATTACHMENT_MESH) { } else if (slot->attachment->type == SP_ATTACHMENT_MESH) {
spMeshAttachment* mesh = (spMeshAttachment*)slot->attachment; spMeshAttachment* mesh = (spMeshAttachment*)slot->attachment;
spMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spMeshAttachment_computeWorldVertices(mesh, slot, worldVertices);
verticesCount = mesh->verticesCount; verticesCount = mesh->verticesCount;
} else if (slot->attachment->type == SP_ATTACHMENT_SKINNED_MESH) { } else if (slot->attachment->type == SP_ATTACHMENT_SKINNED_MESH) {
spSkinnedMeshAttachment* mesh = (spSkinnedMeshAttachment*)slot->attachment; spSkinnedMeshAttachment* mesh = (spSkinnedMeshAttachment*)slot->attachment;
spSkinnedMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spSkinnedMeshAttachment_computeWorldVertices(mesh, slot, worldVertices);
verticesCount = mesh->uvsCount; verticesCount = mesh->uvsCount;
} else } else
continue; continue;

View File

@ -151,14 +151,14 @@ void SkeletonRenderer::draw () {
const int* triangles = nullptr; const int* triangles = nullptr;
int trianglesCount = 0; int trianglesCount = 0;
float r = 0, g = 0, b = 0, a = 0; float r = 0, g = 0, b = 0, a = 0;
for (int i = 0, n = skeleton->slotCount; i < n; i++) { for (int i = 0, n = skeleton->slotsCount; i < n; i++) {
spSlot* slot = skeleton->drawOrder[i]; spSlot* slot = skeleton->drawOrder[i];
if (!slot->attachment) continue; if (!slot->attachment) continue;
CCTexture2D *texture = nullptr; CCTexture2D *texture = nullptr;
switch (slot->attachment->type) { switch (slot->attachment->type) {
case SP_ATTACHMENT_REGION: { case SP_ATTACHMENT_REGION: {
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
texture = getTexture(attachment); texture = getTexture(attachment);
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = 8; verticesCount = 8;
@ -172,7 +172,7 @@ void SkeletonRenderer::draw () {
} }
case SP_ATTACHMENT_MESH: { case SP_ATTACHMENT_MESH: {
spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment; spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment;
spMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spMeshAttachment_computeWorldVertices(attachment, slot, worldVertices);
texture = getTexture(attachment); texture = getTexture(attachment);
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = attachment->verticesCount; verticesCount = attachment->verticesCount;
@ -186,7 +186,7 @@ void SkeletonRenderer::draw () {
} }
case SP_ATTACHMENT_SKINNED_MESH: { case SP_ATTACHMENT_SKINNED_MESH: {
spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment; spSkinnedMeshAttachment* attachment = (spSkinnedMeshAttachment*)slot->attachment;
spSkinnedMeshAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spSkinnedMeshAttachment_computeWorldVertices(attachment, slot, worldVertices);
texture = getTexture(attachment); texture = getTexture(attachment);
uvs = attachment->uvs; uvs = attachment->uvs;
verticesCount = attachment->uvsCount; verticesCount = attachment->uvsCount;
@ -220,11 +220,11 @@ void SkeletonRenderer::draw () {
ccDrawColor4B(0, 0, 255, 255); ccDrawColor4B(0, 0, 255, 255);
glLineWidth(1); glLineWidth(1);
CCPoint points[4]; CCPoint points[4];
for (int i = 0, n = skeleton->slotCount; i < n; i++) { for (int i = 0, n = skeleton->slotsCount; i < n; i++) {
spSlot* slot = skeleton->drawOrder[i]; spSlot* slot = skeleton->drawOrder[i];
if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue; if (!slot->attachment || slot->attachment->type != SP_ATTACHMENT_REGION) continue;
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
points[0] = ccp(worldVertices[0], worldVertices[1]); points[0] = ccp(worldVertices[0], worldVertices[1]);
points[1] = ccp(worldVertices[2], worldVertices[3]); points[1] = ccp(worldVertices[2], worldVertices[3]);
points[2] = ccp(worldVertices[4], worldVertices[5]); points[2] = ccp(worldVertices[4], worldVertices[5]);
@ -236,7 +236,7 @@ void SkeletonRenderer::draw () {
// Bone lengths. // Bone lengths.
glLineWidth(2); glLineWidth(2);
ccDrawColor4B(255, 0, 0, 255); ccDrawColor4B(255, 0, 0, 255);
for (int i = 0, n = skeleton->boneCount; i < n; i++) { for (int i = 0, n = skeleton->bonesCount; i < n; i++) {
spBone *bone = skeleton->bones[i]; spBone *bone = skeleton->bones[i];
float x = bone->data->length * bone->m00 + bone->worldX; float x = bone->data->length * bone->m00 + bone->worldX;
float y = bone->data->length * bone->m10 + bone->worldY; float y = bone->data->length * bone->m10 + bone->worldY;
@ -245,7 +245,7 @@ void SkeletonRenderer::draw () {
// Bone origins. // Bone origins.
ccPointSize(4); ccPointSize(4);
ccDrawColor4B(0, 0, 255, 255); // Root bone is blue. ccDrawColor4B(0, 0, 255, 255); // Root bone is blue.
for (int i = 0, n = skeleton->boneCount; i < n; i++) { for (int i = 0, n = skeleton->bonesCount; i < n; i++) {
spBone *bone = skeleton->bones[i]; spBone *bone = skeleton->bones[i];
ccDrawPoint(ccp(bone->worldX, bone->worldY)); ccDrawPoint(ccp(bone->worldX, bone->worldY));
if (i == 0) ccDrawColor4B(0, 255, 0, 255); if (i == 0) ccDrawColor4B(0, 255, 0, 255);
@ -268,21 +268,21 @@ CCTexture2D* SkeletonRenderer::getTexture (spSkinnedMeshAttachment* attachment)
CCRect SkeletonRenderer::boundingBox () { CCRect SkeletonRenderer::boundingBox () {
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN; float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
float scaleX = getScaleX(), scaleY = getScaleY(); float scaleX = getScaleX(), scaleY = getScaleY();
for (int i = 0; i < skeleton->slotCount; ++i) { for (int i = 0; i < skeleton->slotsCount; ++i) {
spSlot* slot = skeleton->slots[i]; spSlot* slot = skeleton->slots[i];
if (!slot->attachment) continue; if (!slot->attachment) continue;
int verticesCount; int verticesCount;
if (slot->attachment->type == SP_ATTACHMENT_REGION) { if (slot->attachment->type == SP_ATTACHMENT_REGION) {
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spRegionAttachment_computeWorldVertices(attachment, slot->skeleton->x, slot->skeleton->y, slot->bone, worldVertices); spRegionAttachment_computeWorldVertices(attachment, slot->bone, worldVertices);
verticesCount = 8; verticesCount = 8;
} else if (slot->attachment->type == SP_ATTACHMENT_MESH) { } else if (slot->attachment->type == SP_ATTACHMENT_MESH) {
spMeshAttachment* mesh = (spMeshAttachment*)slot->attachment; spMeshAttachment* mesh = (spMeshAttachment*)slot->attachment;
spMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spMeshAttachment_computeWorldVertices(mesh, slot, worldVertices);
verticesCount = mesh->verticesCount; verticesCount = mesh->verticesCount;
} else if (slot->attachment->type == SP_ATTACHMENT_SKINNED_MESH) { } else if (slot->attachment->type == SP_ATTACHMENT_SKINNED_MESH) {
spSkinnedMeshAttachment* mesh = (spSkinnedMeshAttachment*)slot->attachment; spSkinnedMeshAttachment* mesh = (spSkinnedMeshAttachment*)slot->attachment;
spSkinnedMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices); spSkinnedMeshAttachment_computeWorldVertices(mesh, slot, worldVertices);
verticesCount = mesh->uvsCount; verticesCount = mesh->uvsCount;
} else } else
continue; continue;