+ mUrlIndex = frameIndex;
+ while( !mQueue.IsEmpty() )
+ {
+ ImageFrame imageFrame = mQueue.PopFront();
+ mTextureManager.Remove( mImageUrls[ imageFrame.mUrlIndex ].mTextureId, this );
+ mImageUrls[ imageFrame.mUrlIndex ].mTextureId = TextureManager::INVALID_TEXTURE_ID;
+ }
+ LoadBatch();
+ }
+ // If the frame is already loaded, remove previous frames of the frame in the queue
+ // and load new frames amount of removed frames.
+ else
+ {
+ bool popExist = false;
+ while( !mQueue.IsEmpty() && mQueue.Front().mUrlIndex != frameIndex )
+ {
+ ImageFrame imageFrame = mQueue.PopFront();
+ mTextureManager.Remove( mImageUrls[ imageFrame.mUrlIndex ].mTextureId, this );
+ mImageUrls[ imageFrame.mUrlIndex ].mTextureId = TextureManager::INVALID_TEXTURE_ID;
+ popExist = true;
+ }
+ if( popExist )
+ {
+ mUrlIndex = ( mQueue.Back().mUrlIndex + 1 ) % mImageUrls.size();
+ LoadBatch();
+ }