Skip to content

Commit

Permalink
[cocos2dx][c] Fixed call to spVertexAttachment_computeWorldVertices, …
Browse files Browse the repository at this point in the history
…as well as count calcalculation.
  • Loading branch information
badlogic committed Aug 10, 2018
1 parent 9a428a0 commit a578be8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spine-c/spine-c/src/spine/VertexAttachment.c
Expand Up @@ -51,7 +51,7 @@ void spVertexAttachment_computeWorldVertices (spVertexAttachment* self, spSlot*
float* vertices;
int* bones;

count += offset;
count = offset + (count >> 1) * stride;
skeleton = slot->bone->skeleton;
deformLength = slot->attachmentVerticesCount;
deform = slot->attachmentVertices;
Expand Down
4 changes: 2 additions & 2 deletions spine-cocos2dx/src/spine/SkeletonRenderer.cpp
Expand Up @@ -345,7 +345,7 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
triangles.vertCount = attachmentVertices->_triangles->vertCount;
memcpy(triangles.verts, attachmentVertices->_triangles->verts, sizeof(cocos2d::V3F_C4B_T2F) * attachmentVertices->_triangles->vertCount);
int vertexSizeInFloats = sizeof(cocos2d::V3F_C4B_T2F) / sizeof(float);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, triangles.vertCount * vertexSizeInFloats, (float*)triangles.verts, 0, vertexSizeInFloats);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->super.worldVerticesLength, (float*)triangles.verts, 0, vertexSizeInFloats);
} else {
trianglesTwoColor.indices = attachmentVertices->_triangles->indices;
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
Expand All @@ -355,7 +355,7 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
trianglesTwoColor.verts[i].texCoords = attachmentVertices->_triangles->verts[i].texCoords;
}
int vertexSizeInFloats = sizeof(V3F_C4B_C4B_T2F) / sizeof(float);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, trianglesTwoColor.vertCount * vertexSizeInFloats, (float*)trianglesTwoColor.verts, 0, vertexSizeInFloats);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->super.worldVerticesLength, (float*)trianglesTwoColor.verts, 0, vertexSizeInFloats);
}

color.r = attachment->color.r;
Expand Down

0 comments on commit a578be8

Please sign in to comment.