|
@@ -154,6 +154,7 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
|
|
|
|
|
|
} else if (attachment->type == ATTACHMENT_MESH) {
|
|
} else if (attachment->type == ATTACHMENT_MESH) {
|
|
MeshAttachment* mesh = (MeshAttachment*)attachment;
|
|
MeshAttachment* mesh = (MeshAttachment*)attachment;
|
|
|
|
+ if (mesh->uvsCount > SPINE_MESH_VERTEX_COUNT_MAX) continue;
|
|
texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject;
|
|
texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject;
|
|
MeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);
|
|
MeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);
|
|
|
|
|
|
@@ -166,6 +167,31 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
|
|
vertex.color.b = b;
|
|
vertex.color.b = b;
|
|
vertex.color.a = a;
|
|
vertex.color.a = a;
|
|
|
|
|
|
|
|
+ Vector2u size = texture->getSize();
|
|
|
|
+ for (int i = 0; i < mesh->trianglesCount; ++i) {
|
|
|
|
+ int index = mesh->triangles[i] << 1;
|
|
|
|
+ vertex.position.x = worldVertices[index];
|
|
|
|
+ vertex.position.y = worldVertices[index + 1];
|
|
|
|
+ vertex.texCoords.x = mesh->uvs[index] * size.x;
|
|
|
|
+ vertex.texCoords.y = mesh->uvs[index + 1] * size.y;
|
|
|
|
+ vertexArray->append(vertex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (attachment->type == ATTACHMENT_SKINNED_MESH) {
|
|
|
|
+ SkinnedMeshAttachment* mesh = (SkinnedMeshAttachment*)attachment;
|
|
|
|
+ if (mesh->uvsCount > SPINE_MESH_VERTEX_COUNT_MAX) continue;
|
|
|
|
+ texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject;
|
|
|
|
+ SkinnedMeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);
|
|
|
|
+
|
|
|
|
+ Uint8 r = skeleton->r * slot->r * 255;
|
|
|
|
+ Uint8 g = skeleton->g * slot->g * 255;
|
|
|
|
+ Uint8 b = skeleton->b * slot->b * 255;
|
|
|
|
+ Uint8 a = skeleton->a * slot->a * 255;
|
|
|
|
+ vertex.color.r = r;
|
|
|
|
+ vertex.color.g = g;
|
|
|
|
+ vertex.color.b = b;
|
|
|
|
+ vertex.color.a = a;
|
|
|
|
+
|
|
Vector2u size = texture->getSize();
|
|
Vector2u size = texture->getSize();
|
|
for (int i = 0; i < mesh->trianglesCount; ++i) {
|
|
for (int i = 0; i < mesh->trianglesCount; ++i) {
|
|
int index = mesh->triangles[i] << 1;
|
|
int index = mesh->triangles[i] << 1;
|