batched children work as expected

Fixed order in the multi matrix.
This commit is contained in:
Ricardo Quesada 2013-12-19 16:33:47 -08:00
parent 1163d23692
commit f5d0d1ce43
2 changed files with 1 additions and 25 deletions

View File

@ -528,7 +528,7 @@ void Sprite::updateTransform(void)
CCASSERT( dynamic_cast<Sprite*>(_parent), "Logic error in Sprite. Parent must be a Sprite");
kmMat4 nodeToParent = getNodeToParentTransform();
kmMat4 parentTransform = static_cast<Sprite*>(_parent)->_transformToBatch;
kmMat4Multiply(&_transformToBatch, &nodeToParent, &parentTransform);
kmMat4Multiply(&_transformToBatch, &parentTransform, &nodeToParent);
}
//

View File

@ -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<length; i++)
{
j = i-1;
auto tempI = static_cast<Node*>( _children->getObjectAtIndex(i) );
auto tempJ = static_cast<Node*>( _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<Node*>( _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())