refine code

This commit is contained in:
owen
2019-06-27 20:43:57 +08:00
parent 077f5c7cf7
commit dad9b052ce
2 changed files with 31 additions and 13 deletions
@@ -447,10 +447,6 @@ void SkeletonRenderer::update (float deltaTime) {
continue;
}
if (!slot->getAttachment()) {
continue;
}
Triangles triangles;
TwoColorTriangles trianglesTwoColor;
+31 -9
View File
@@ -249,18 +249,40 @@ void RenderFlow::calculateWorldMatrix()
for(std::size_t index = 0, count = levelInfos.size(); index < count; index++)
{
auto& info = levelInfos[index];
auto selfDirty = *info.dirty & WORLD_TRANSFORM;
if (info.parentDirty != nullptr && ((*info.parentDirty & WORLD_TRANSFORM_CHANGED) || selfDirty))
auto selfWorldDirty = *info.dirty & WORLD_TRANSFORM;
auto selfOpacityDirty = *info.dirty & OPACITY;
if (info.parentDirty)
{
cocos2d::Mat4::multiply(*info.parentWorldMat, *info.localMat, info.worldMat);
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
if ((*info.parentDirty & WORLD_TRANSFORM_CHANGED) || selfWorldDirty)
{
cocos2d::Mat4::multiply(*info.parentWorldMat, *info.localMat, info.worldMat);
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
}
if ((*info.parentDirty & OPACITY_CHANGED) || selfOpacityDirty)
{
*info.realOpacity = *info.opacity * *info.parentRealOpacity / 255.0f;
*info.dirty |= OPACITY_CHANGED;
*info.dirty &= ~OPACITY;
}
}
else if (selfDirty)
else
{
*info.worldMat = *info.localMat;
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
if (selfWorldDirty)
{
*info.worldMat = *info.localMat;
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
}
if (selfOpacityDirty)
{
*info.realOpacity = *info.opacity;
*info.dirty |= OPACITY_CHANGED;
*info.dirty &= ~OPACITY;
}
}
}
}