From f5d0d1ce43ec8931d01f617a3a3d1e26f80912d2 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Thu, 19 Dec 2013 16:33:47 -0800 Subject: [PATCH] batched children work as expected Fixed order in the multi matrix. --- cocos/2d/CCSprite.cpp | 2 +- cocos/2d/CCSpriteBatchNode.cpp | 24 ------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index b826db422e..6c940d3de3 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -528,7 +528,7 @@ void Sprite::updateTransform(void) CCASSERT( dynamic_cast(_parent), "Logic error in Sprite. Parent must be a Sprite"); kmMat4 nodeToParent = getNodeToParentTransform(); kmMat4 parentTransform = static_cast(_parent)->_transformToBatch; - kmMat4Multiply(&_transformToBatch, &nodeToParent, &parentTransform); + kmMat4Multiply(&_transformToBatch, &parentTransform, &nodeToParent); } // diff --git a/cocos/2d/CCSpriteBatchNode.cpp b/cocos/2d/CCSpriteBatchNode.cpp index 5e8819e721..d84f5983bd 100644 --- a/cocos/2d/CCSpriteBatchNode.cpp +++ b/cocos/2d/CCSpriteBatchNode.cpp @@ -240,31 +240,7 @@ void SpriteBatchNode::sortAllChildren() { if (_reorderChildDirty) { -#if 0 - int i = 0,j = 0,length = _children->count(); - - // insertion sort - for(i=1; i( _children->getObjectAtIndex(i) ); - auto tempJ = static_cast( _children->getObjectAtIndex(j) ); - - //continue moving element downwards while zOrder is smaller or when zOrder is the same but mutatedIndex is smaller - while(j>=0 && ( tempI->getZOrder() < tempJ->getZOrder() || - ( tempI->getZOrder() == tempJ->getZOrder() && - tempI->getOrderOfArrival() < tempJ->getOrderOfArrival() ) ) ) - { - _children->fastSetObject( tempJ, j+1 ); - j = j-1; - if(j>=0) - tempJ = static_cast( _children->getObjectAtIndex(j) ); - } - _children->fastSetObject(tempI, j+1); - } -#else std::sort(std::begin(_children), std::end(_children), nodeComparisonLess); -#endif //sorted now check all children if (!_children.empty())