[cocos2dx][cpp] More changes to computeWorldVertices.

This commit is contained in:
badlogic 2018-08-09 15:27:26 +02:00
parent f12728f0d2
commit c405dcd165

View File

@ -363,8 +363,7 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
triangles.verts = batch->allocateVertices(attachmentVertices->_triangles->vertCount); triangles.verts = batch->allocateVertices(attachmentVertices->_triangles->vertCount);
triangles.vertCount = attachmentVertices->_triangles->vertCount; triangles.vertCount = attachmentVertices->_triangles->vertCount;
memcpy(triangles.verts, attachmentVertices->_triangles->verts, sizeof(cocos2d::V3F_C4B_T2F) * 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); attachment->computeWorldVertices(*slot, 0, attachment->getWorldVerticesLength(), (float*)triangles.verts, 0, 6);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->getWorldVerticesLength(), (float*)triangles.verts, 0, vertexSizeInFloats);
} else { } else {
trianglesTwoColor.indices = attachmentVertices->_triangles->indices; trianglesTwoColor.indices = attachmentVertices->_triangles->indices;
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount; trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
@ -373,8 +372,7 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
for (int i = 0; i < trianglesTwoColor.vertCount; i++) { for (int i = 0; i < trianglesTwoColor.vertCount; i++) {
trianglesTwoColor.verts[i].texCoords = attachmentVertices->_triangles->verts[i].texCoords; trianglesTwoColor.verts[i].texCoords = attachmentVertices->_triangles->verts[i].texCoords;
} }
int vertexSizeInFloats = sizeof(V3F_C4B_C4B_T2F) / sizeof(float); attachment->computeWorldVertices(*slot, 0, attachment->getWorldVerticesLength(), (float*)trianglesTwoColor.verts, 0, 7);
spVertexAttachment_computeWorldVertices(SUPER(attachment), slot, 0, attachment->getWorldVerticesLength(), (float*)trianglesTwoColor.verts, 0, vertexSizeInFloats);
} }
color.r = attachment->getColor().r; color.r = attachment->getColor().r;