Formatting.

This commit is contained in:
Nathan Sweet 2020-08-10 23:47:50 +02:00 committed by GitHub
parent 11006baa65
commit 13b3b2e011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,6 @@
USING_NS_CC;
namespace spine {
namespace {
@ -63,7 +62,6 @@ namespace spine {
#define VLA_FREE(arr)
#endif
SkeletonRenderer* SkeletonRenderer::createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
SkeletonRenderer* node = new SkeletonRenderer(skeleton, ownsSkeleton, ownsSkeletonData);
node->autorelease();
@ -119,8 +117,7 @@ namespace spine {
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
MeshAttachment* meshAttachment = static_cast<MeshAttachment*>(attachment);
texture = static_cast<AttachmentVertices*>(meshAttachment->getRendererObject())->_texture;
}
else {
} else {
continue;
}
@ -255,7 +252,7 @@ namespace spine {
}
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) {
return;
}
@ -337,7 +334,7 @@ namespace spine {
dstTriangleVertices = reinterpret_cast<float*>(trianglesTwoColor.verts);
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);
worldCoordPtr += 8;
@ -372,7 +369,7 @@ namespace spine {
dstVertexCount = trianglesTwoColor.vertCount;
}
// Copy world vertices to triangle vertices
// Copy world vertices to triangle vertices.
//assert(dstVertexCount * 2 == attachment->super.worldVerticesLength);
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, dstVertexCount, dstStride);
worldCoordPtr += dstVertexCount * 2;
@ -398,7 +395,6 @@ namespace spine {
darkColor.a = darkPremultipliedAlpha;
color.a *= nodeColor.a * _skeleton->getColor().a * slot->getColor().a;
// skip rendering if the color of this attachment is 0
if (color.a == 0) {
_clipper->clipEnd(*slot);
continue;
@ -406,8 +402,7 @@ namespace spine {
color.r *= nodeColor.r * _skeleton->getColor().r * slot->getColor().r;
color.g *= nodeColor.g * _skeleton->getColor().g * slot->getColor().g;
color.b *= nodeColor.b * _skeleton->getColor().b * slot->getColor().b;
if (_premultipliedAlpha)
{
if (_premultipliedAlpha) {
color.r *= color.a;
color.g *= color.a;
color.b *= color.a;
@ -466,7 +461,7 @@ namespace spine {
}
}
} else {
// Not clipping
// Not clipping.
#if COCOS2D_VERSION < 0x00040000
cocos2d::TrianglesCommand* batchedTriangles = batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture, _glProgramState, blendFunc, triangles, transform, transformFlags);
#else
@ -489,7 +484,7 @@ namespace spine {
}
}
} else {
// Two tints
// Two color tinting.
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);
@ -572,13 +567,10 @@ namespace spine {
if (lastTwoColorTrianglesCommand) {
Node* parent = this->getParent();
// We need to decide if we can postpone flushing the current
// batch. We can postpone if the next sibling node is a
// 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 of this nodes parent are skeletons, we
// are in O(n2) territory.
// We need to decide if we can postpone flushing the current batch. We can postpone if the next sibling node is a 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
// of this nodes parent are skeletons, we are in O(n2) territory.
if (!parent || parent->getChildrenCount() > 100 || getChildrenCount() != 0) {
lastTwoColorTrianglesCommand->setForceFlush(true);
} else {