Remove some format rule (#10919)

* remove some rules
* format all codes with new format rule
This commit is contained in:
minggo
2022-05-04 13:09:24 +08:00
committed by GitHub
parent e9a4bdd4dc
commit 271cc5cf23
1148 changed files with 32411 additions and 34416 deletions
@@ -36,7 +36,7 @@ using namespace cc; // NOLINT(google-build-using-namespace)
namespace spine {
float SkeletonCache::FrameTime = 1.0F / 60.0F;
float SkeletonCache::FrameTime = 1.0F / 60.0F;
float SkeletonCache::MaxCacheTime = 120.0F;
SkeletonCache::SegmentData::SegmentData() = default;
@@ -125,7 +125,7 @@ void SkeletonCache::AnimationData::reset() {
}
_frames.clear();
_isComplete = false;
_totalTime = 0.0F;
_totalTime = 0.0F;
}
bool SkeletonCache::AnimationData::needUpdate(int toFrameIdx) const {
@@ -165,13 +165,13 @@ SkeletonCache::~SkeletonCache() {
SkeletonCache::AnimationData *SkeletonCache::buildAnimationData(const std::string &animationName) {
AnimationData *aniData = nullptr;
auto it = _animationCaches.find(animationName);
auto it = _animationCaches.find(animationName);
if (it == _animationCaches.end()) {
auto *animation = findAnimation(animationName);
if (animation == nullptr) return nullptr;
aniData = new AnimationData();
aniData->_animationName = animationName;
aniData = new AnimationData();
aniData->_animationName = animationName;
_animationCaches[animationName] = aniData;
} else {
aniData = it->second;
@@ -225,7 +225,7 @@ void SkeletonCache::updateToFrame(const std::string &animationName, int toFrameI
void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
std::size_t frameIndex = animationData->getFrameCount();
FrameData * frameData = animationData->buildFrameData(frameIndex);
FrameData *frameData = animationData->buildFrameData(frameIndex);
if (!_skeleton) return;
@@ -240,9 +240,9 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
Color4F color;
Color4F darkColor;
AttachmentVertices * attachmentVertices = nullptr;
middleware::IOBuffer &vb = frameData->vb;
middleware::IOBuffer &ib = frameData->ib;
AttachmentVertices *attachmentVertices = nullptr;
middleware::IOBuffer &vb = frameData->vb;
middleware::IOBuffer &ib = frameData->ib;
// vertex size int bytes with two color
int vbs2 = sizeof(V2F_T2F_C4F_C4F);
@@ -252,24 +252,24 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
int vbSize = 0;
int ibSize = 0;
int preBlendMode = -1;
int preBlendMode = -1;
int preTextureIndex = -1;
int curTextureIndex = -1;
int preISegWritePos = -1;
int curISegLen = 0;
int curVSegLen = 0;
int curISegLen = 0;
int curVSegLen = 0;
int materialLen = 0;
Slot *slot = nullptr;
int materialLen = 0;
Slot *slot = nullptr;
middleware::Texture2D *texture = nullptr;
auto flush = [&]() {
// fill pre segment count field
if (preISegWritePos != -1) {
SegmentData *preSegmentData = frameData->buildSegmentData(materialLen - 1);
preSegmentData->indexCount = curISegLen;
SegmentData *preSegmentData = frameData->buildSegmentData(materialLen - 1);
preSegmentData->indexCount = curISegLen;
preSegmentData->vertexFloatCount = curVSegLen;
}
@@ -293,16 +293,16 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
auto &bones = _skeleton->getBones();
for (std::size_t i = 0, n = bones.size(); i < n; i++) {
auto & bone = bones[i];
auto boneCount = frameData->getBoneCount();
BoneData *boneData = frameData->buildBoneData(boneCount);
auto & matm = boneData->globalTransformMatrix.m;
matm[0] = bone->getA();
matm[1] = bone->getC();
matm[4] = bone->getB();
matm[5] = bone->getD();
matm[12] = bone->getWorldX();
matm[13] = bone->getWorldY();
auto &bone = bones[i];
auto boneCount = frameData->getBoneCount();
BoneData *boneData = frameData->buildBoneData(boneCount);
auto &matm = boneData->globalTransformMatrix.m;
matm[0] = bone->getA();
matm[1] = bone->getC();
matm[4] = bone->getB();
matm[5] = bone->getD();
matm[12] = bone->getWorldX();
matm[13] = bone->getWorldY();
}
auto &drawOrder = _skeleton->getDrawOrder();
@@ -327,7 +327,7 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
TwoColorTriangles trianglesTwoColor;
if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
auto *attachment = dynamic_cast<RegionAttachment *>(slot->getAttachment());
auto *attachment = dynamic_cast<RegionAttachment *>(slot->getAttachment());
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRendererObject());
// Early exit if attachment is invisible
@@ -337,7 +337,7 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
}
trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount;
vbSize = static_cast<int32_t>(trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4F_C4F));
vbSize = static_cast<int32_t>(trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4F_C4F));
vb.checkSpace(vbSize, true);
trianglesTwoColor.verts = reinterpret_cast<V2F_T2F_C4F_C4F *>(vb.getCurBuffer());
for (int ii = 0; ii < trianglesTwoColor.vertCount; ii++) {
@@ -346,7 +346,7 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
attachment->computeWorldVertices(slot->getBone(), reinterpret_cast<float *>(trianglesTwoColor.verts), 0, vs2);
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
ibSize = static_cast<int32_t>(trianglesTwoColor.indexCount * sizeof(uint16_t));
ibSize = static_cast<int32_t>(trianglesTwoColor.indexCount * sizeof(uint16_t));
ib.checkSpace(ibSize, true);
trianglesTwoColor.indices = reinterpret_cast<uint16_t *>(ib.getCurBuffer());
memcpy(trianglesTwoColor.indices, attachmentVertices->_triangles->indices, ibSize);
@@ -357,7 +357,7 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
color.a = attachment->getColor().a;
} else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) {
auto *attachment = dynamic_cast<MeshAttachment *>(slot->getAttachment());
auto *attachment = dynamic_cast<MeshAttachment *>(slot->getAttachment());
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRendererObject());
// Early exit if attachment is invisible
@@ -367,7 +367,7 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
}
trianglesTwoColor.vertCount = attachmentVertices->_triangles->vertCount;
vbSize = static_cast<int32_t>(trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4F_C4F));
vbSize = static_cast<int32_t>(trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4F_C4F));
vb.checkSpace(vbSize, true);
trianglesTwoColor.verts = reinterpret_cast<V2F_T2F_C4F_C4F *>(vb.getCurBuffer());
for (int ii = 0; ii < trianglesTwoColor.vertCount; ii++) {
@@ -376,7 +376,7 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
attachment->computeWorldVertices(*slot, 0, attachment->getWorldVerticesLength(), reinterpret_cast<float *>(trianglesTwoColor.verts), 0, vs2);
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
ibSize = static_cast<int32_t>(trianglesTwoColor.indexCount * sizeof(uint16_t));
ibSize = static_cast<int32_t>(trianglesTwoColor.indexCount * sizeof(uint16_t));
ib.checkSpace(ibSize, true);
trianglesTwoColor.indices = reinterpret_cast<uint16_t *>(ib.getCurBuffer());
memcpy(trianglesTwoColor.indices, attachmentVertices->_triangles->indices, ibSize);
@@ -402,9 +402,9 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
continue;
}
float red = _skeleton->getColor().r * color.r * 255;
float red = _skeleton->getColor().r * color.r * 255;
float green = _skeleton->getColor().g * color.g * 255;
float blue = _skeleton->getColor().b * color.b * 255;
float blue = _skeleton->getColor().b * color.b * 255;
color.r = red * slot->getColor().r;
color.g = green * slot->getColor().g;
@@ -422,16 +422,16 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
darkColor.a = 0;
if (preColor != color || preDarkColor != darkColor) {
preColor = color;
preDarkColor = darkColor;
preColor = color;
preDarkColor = darkColor;
auto colorCount = frameData->getColorCount();
if (colorCount > 0) {
ColorData *preColorData = frameData->buildColorData(colorCount - 1);
ColorData *preColorData = frameData->buildColorData(colorCount - 1);
preColorData->vertexFloatOffset = static_cast<int>(vb.getCurPos() / sizeof(float));
}
ColorData *colorData = frameData->buildColorData(colorCount);
ColorData *colorData = frameData->buildColorData(colorCount);
colorData->finalColor = color;
colorData->darkColor = darkColor;
colorData->darkColor = darkColor;
}
// Two color tint logic
@@ -444,49 +444,49 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
}
trianglesTwoColor.vertCount = static_cast<int>(_clipper->getClippedVertices().size()) >> 1;
vbSize = static_cast<int32_t>(trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4F_C4F));
vbSize = static_cast<int32_t>(trianglesTwoColor.vertCount * sizeof(V2F_T2F_C4F_C4F));
vb.checkSpace(vbSize, true);
trianglesTwoColor.verts = reinterpret_cast<V2F_T2F_C4F_C4F *>(vb.getCurBuffer());
trianglesTwoColor.indexCount = static_cast<int>(_clipper->getClippedTriangles().size());
ibSize = static_cast<int32_t>(trianglesTwoColor.indexCount * sizeof(uint16_t));
ibSize = static_cast<int32_t>(trianglesTwoColor.indexCount * sizeof(uint16_t));
ib.checkSpace(ibSize, true);
trianglesTwoColor.indices = reinterpret_cast<uint16_t *>(ib.getCurBuffer());
memcpy(trianglesTwoColor.indices, _clipper->getClippedTriangles().buffer(), sizeof(uint16_t) * _clipper->getClippedTriangles().size());
float *verts = _clipper->getClippedVertices().buffer();
float *uvs = _clipper->getClippedUVs().buffer();
float *uvs = _clipper->getClippedUVs().buffer();
for (int v = 0, vn = trianglesTwoColor.vertCount, vv = 0; v < vn; ++v, vv += 2) {
V2F_T2F_C4F_C4F *vertex = trianglesTwoColor.verts + v;
vertex->vertex.x = verts[vv];
vertex->vertex.y = verts[vv + 1];
vertex->texCoord.u = uvs[vv];
vertex->texCoord.v = uvs[vv + 1];
vertex->color.r = color.r / 255.0F;
vertex->color.g = color.g / 255.0F;
vertex->color.b = color.b / 255.0F;
vertex->color.a = color.a / 255.0F;
vertex->color2.r = darkColor.r / 255.0F;
vertex->color2.g = darkColor.g / 255.0F;
vertex->color2.b = darkColor.b / 255.0F;
vertex->color2.a = darkColor.a / 255.0F;
vertex->vertex.x = verts[vv];
vertex->vertex.y = verts[vv + 1];
vertex->texCoord.u = uvs[vv];
vertex->texCoord.v = uvs[vv + 1];
vertex->color.r = color.r / 255.0F;
vertex->color.g = color.g / 255.0F;
vertex->color.b = color.b / 255.0F;
vertex->color.a = color.a / 255.0F;
vertex->color2.r = darkColor.r / 255.0F;
vertex->color2.g = darkColor.g / 255.0F;
vertex->color2.b = darkColor.b / 255.0F;
vertex->color2.a = darkColor.a / 255.0F;
}
} else {
for (int v = 0, vn = trianglesTwoColor.vertCount; v < vn; ++v) {
V2F_T2F_C4F_C4F *vertex = trianglesTwoColor.verts + v;
vertex->color.r = color.r / 255.0F;
vertex->color.g = color.g / 255.0F;
vertex->color.b = color.b / 255.0F;
vertex->color.a = color.a / 255.0F;
vertex->color2.r = darkColor.r / 255.0F;
vertex->color2.g = darkColor.g / 255.0F;
vertex->color2.b = darkColor.b / 255.0F;
vertex->color2.a = darkColor.a / 255.0F;
vertex->color.r = color.r / 255.0F;
vertex->color.g = color.g / 255.0F;
vertex->color.b = color.b / 255.0F;
vertex->color.a = color.a / 255.0F;
vertex->color2.r = darkColor.r / 255.0F;
vertex->color2.g = darkColor.g / 255.0F;
vertex->color2.b = darkColor.b / 255.0F;
vertex->color2.a = darkColor.a / 255.0F;
}
}
texture = attachmentVertices->_texture;
texture = attachmentVertices->_texture;
curTextureIndex = attachmentVertices->_texture->getRealTextureIndex();
// If texture or blendMode change,will change material.
if (preTextureIndex != curTextureIndex || preBlendMode != slot->getData().getBlendMode()) {
@@ -516,14 +516,14 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
_clipper->clipEnd();
if (preISegWritePos != -1) {
SegmentData *preSegmentData = frameData->buildSegmentData(materialLen - 1);
preSegmentData->indexCount = curISegLen;
SegmentData *preSegmentData = frameData->buildSegmentData(materialLen - 1);
preSegmentData->indexCount = curISegLen;
preSegmentData->vertexFloatCount = curVSegLen;
}
auto colorCount = frameData->getColorCount();
if (colorCount > 0) {
ColorData *preColorData = frameData->buildColorData(colorCount - 1);
ColorData *preColorData = frameData->buildColorData(colorCount - 1);
preColorData->vertexFloatOffset = static_cast<int>(vb.getCurPos() / sizeof(float));
}
}