mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Formatting.
This commit is contained in:
parent
11006baa65
commit
13b3b2e011
@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
|
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -63,7 +62,6 @@ namespace spine {
|
|||||||
#define VLA_FREE(arr)
|
#define VLA_FREE(arr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SkeletonRenderer* SkeletonRenderer::createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
|
SkeletonRenderer* SkeletonRenderer::createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
|
||||||
SkeletonRenderer* node = new SkeletonRenderer(skeleton, ownsSkeleton, ownsSkeletonData);
|
SkeletonRenderer* node = new SkeletonRenderer(skeleton, ownsSkeleton, ownsSkeletonData);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
@ -119,8 +117,7 @@ namespace spine {
|
|||||||
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||||
MeshAttachment* meshAttachment = static_cast<MeshAttachment*>(attachment);
|
MeshAttachment* meshAttachment = static_cast<MeshAttachment*>(attachment);
|
||||||
texture = static_cast<AttachmentVertices*>(meshAttachment->getRendererObject())->_texture;
|
texture = static_cast<AttachmentVertices*>(meshAttachment->getRendererObject())->_texture;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +252,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t transformFlags) {
|
void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t transformFlags) {
|
||||||
// Early exit if the skeleton is invisible
|
// Early exit if the skeleton is invisible.
|
||||||
if (getDisplayedOpacity() == 0 || _skeleton->getColor().a == 0) {
|
if (getDisplayedOpacity() == 0 || _skeleton->getColor().a == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -337,7 +334,7 @@ namespace spine {
|
|||||||
dstTriangleVertices = reinterpret_cast<float*>(trianglesTwoColor.verts);
|
dstTriangleVertices = reinterpret_cast<float*>(trianglesTwoColor.verts);
|
||||||
dstStride = sizeof(V3F_C4B_C4B_T2F) / sizeof(float);
|
dstStride = sizeof(V3F_C4B_C4B_T2F) / sizeof(float);
|
||||||
}
|
}
|
||||||
// Copy world vertices to triangle vertices
|
// Copy world vertices to triangle vertices.
|
||||||
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, 4, dstStride);
|
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, 4, dstStride);
|
||||||
worldCoordPtr += 8;
|
worldCoordPtr += 8;
|
||||||
|
|
||||||
@ -372,7 +369,7 @@ namespace spine {
|
|||||||
dstVertexCount = trianglesTwoColor.vertCount;
|
dstVertexCount = trianglesTwoColor.vertCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy world vertices to triangle vertices
|
// Copy world vertices to triangle vertices.
|
||||||
//assert(dstVertexCount * 2 == attachment->super.worldVerticesLength);
|
//assert(dstVertexCount * 2 == attachment->super.worldVerticesLength);
|
||||||
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, dstVertexCount, dstStride);
|
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, dstVertexCount, dstStride);
|
||||||
worldCoordPtr += dstVertexCount * 2;
|
worldCoordPtr += dstVertexCount * 2;
|
||||||
@ -398,7 +395,6 @@ namespace spine {
|
|||||||
darkColor.a = darkPremultipliedAlpha;
|
darkColor.a = darkPremultipliedAlpha;
|
||||||
|
|
||||||
color.a *= nodeColor.a * _skeleton->getColor().a * slot->getColor().a;
|
color.a *= nodeColor.a * _skeleton->getColor().a * slot->getColor().a;
|
||||||
// skip rendering if the color of this attachment is 0
|
|
||||||
if (color.a == 0) {
|
if (color.a == 0) {
|
||||||
_clipper->clipEnd(*slot);
|
_clipper->clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
@ -406,8 +402,7 @@ namespace spine {
|
|||||||
color.r *= nodeColor.r * _skeleton->getColor().r * slot->getColor().r;
|
color.r *= nodeColor.r * _skeleton->getColor().r * slot->getColor().r;
|
||||||
color.g *= nodeColor.g * _skeleton->getColor().g * slot->getColor().g;
|
color.g *= nodeColor.g * _skeleton->getColor().g * slot->getColor().g;
|
||||||
color.b *= nodeColor.b * _skeleton->getColor().b * slot->getColor().b;
|
color.b *= nodeColor.b * _skeleton->getColor().b * slot->getColor().b;
|
||||||
if (_premultipliedAlpha)
|
if (_premultipliedAlpha) {
|
||||||
{
|
|
||||||
color.r *= color.a;
|
color.r *= color.a;
|
||||||
color.g *= color.a;
|
color.g *= color.a;
|
||||||
color.b *= color.a;
|
color.b *= color.a;
|
||||||
@ -466,7 +461,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not clipping
|
// Not clipping.
|
||||||
#if COCOS2D_VERSION < 0x00040000
|
#if COCOS2D_VERSION < 0x00040000
|
||||||
cocos2d::TrianglesCommand* batchedTriangles = batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture, _glProgramState, blendFunc, triangles, transform, transformFlags);
|
cocos2d::TrianglesCommand* batchedTriangles = batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture, _glProgramState, blendFunc, triangles, transform, transformFlags);
|
||||||
#else
|
#else
|
||||||
@ -489,7 +484,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Two tints
|
// Two color tinting.
|
||||||
|
|
||||||
if (_clipper->isClipping()) {
|
if (_clipper->isClipping()) {
|
||||||
_clipper->clipTriangles((float*)&trianglesTwoColor.verts[0].position, trianglesTwoColor.indices, trianglesTwoColor.indexCount, (float*)&trianglesTwoColor.verts[0].texCoords, sizeof(V3F_C4B_C4B_T2F) / 4);
|
_clipper->clipTriangles((float*)&trianglesTwoColor.verts[0].position, trianglesTwoColor.indices, trianglesTwoColor.indexCount, (float*)&trianglesTwoColor.verts[0].texCoords, sizeof(V3F_C4B_C4B_T2F) / 4);
|
||||||
@ -572,13 +567,10 @@ namespace spine {
|
|||||||
if (lastTwoColorTrianglesCommand) {
|
if (lastTwoColorTrianglesCommand) {
|
||||||
Node* parent = this->getParent();
|
Node* parent = this->getParent();
|
||||||
|
|
||||||
// We need to decide if we can postpone flushing the current
|
// We need to decide if we can postpone flushing the current batch. We can postpone if the next sibling node is a two color
|
||||||
// batch. We can postpone if the next sibling node is a
|
// tinted skeleton with the same global-z.
|
||||||
// two color tinted skeleton with the same global-z.
|
// The parent->getChildrenCount() > 100 check is a hack as checking for a sibling is an O(n) operation, and if all children
|
||||||
// The parent->getChildrenCount() > 100 check is a hack
|
// of this nodes parent are skeletons, we are in O(n2) territory.
|
||||||
// as checking for a sibling is an O(n) operation, and if
|
|
||||||
// all children of this nodes parent are skeletons, we
|
|
||||||
// are in O(n2) territory.
|
|
||||||
if (!parent || parent->getChildrenCount() > 100 || getChildrenCount() != 0) {
|
if (!parent || parent->getChildrenCount() > 100 || getChildrenCount() != 0) {
|
||||||
lastTwoColorTrianglesCommand->setForceFlush(true);
|
lastTwoColorTrianglesCommand->setForceFlush(true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user