* World matrices where not reordered in the sorting pass causing the application to get the wrong value if the world matrix was queried during component sorting. This bug was causing slider handle and value to jump to an erroneous position when panning
* Minor performance improvement to reduce the number of swaps when reordering transform components
Change-Id: Ifde6ef4aaa2052c70042ef46c8909c85c407588a
std::swap( mLocal[i], mLocal[j] );
std::swap( mComponentDirty[i], mComponentDirty[j] );
std::swap( mBoundingSpheres[i], mBoundingSpheres[j] );
std::swap( mLocal[i], mLocal[j] );
std::swap( mComponentDirty[i], mComponentDirty[j] );
std::swap( mBoundingSpheres[i], mBoundingSpheres[j] );
+ std::swap( mWorld[i], mWorld[j] );
mIds[ mComponentId[i] ] = i;
mIds[ mComponentId[j] ] = j;
mIds[ mComponentId[i] ] = i;
mIds[ mComponentId[j] ] = j;
- std::sort( mOrderedComponents.Begin(), mOrderedComponents.End());
- for( size_t i(0); i<mComponentCount-1; ++i )
+ std::stable_sort( mOrderedComponents.Begin(), mOrderedComponents.End());
+ unsigned int previousIndex = 0;
+ for( size_t newIndex(0); newIndex<mComponentCount-1; ++newIndex )
- SwapComponents( mIds[mOrderedComponents[i].id], i);
+ previousIndex = mIds[mOrderedComponents[newIndex].id];
+ if( previousIndex != newIndex )
+ {
+ SwapComponents( previousIndex, newIndex);
+ }