- uint32_t index = atlas - 1u;
- uint32_t width = mAtlasList[ index ].mSize.mWidth;
- uint32_t height = mAtlasList[ index ].mSize.mHeight;
- uint32_t blockWidth = mAtlasList[ index ].mSize.mBlockWidth;
- uint32_t blockHeight = mAtlasList[ index ].mSize.mBlockHeight;
-
- SizeType widthInBlocks = width / blockWidth;
- SizeType heightInBlocks = height / blockHeight;
- uint32_t blockCount = widthInBlocks * heightInBlocks;
-
- // Check free previously unallocated blocks and any free blocks
- if ( mAtlasList[ index ].mNextFreeBlock )
- {
- blockCount -= mAtlasList[ index ].mNextFreeBlock -1u - mAtlasList[ index ].mFreeBlocksList.Size();
- }
- else
- {
- blockCount = mAtlasList[ index ].mFreeBlocksList.Size();
- }
- return blockCount;