Implement atlas rendering features and performance enhancements

- Added RenderBitmap and GetUVCoordinates methods to AtlasRenderer for improved bitmap rendering capabilities.
- Introduced RenderTilesBatch function in Tilemap for batch rendering of tiles using atlas, reducing draw calls and enhancing performance.
- Updated Clear method in AtlasRenderer to properly clean up SDL textures.
- Enhanced performance monitoring in PerformanceDashboard to include atlas renderer statistics.
- Added unit tests to benchmark atlas rendering performance, confirming efficiency improvements over individual rendering.
This commit is contained in:
scawful
2025-09-28 23:40:04 -04:00
parent 2d10437888
commit a49c31c84b
6 changed files with 236 additions and 5 deletions

View File

@@ -138,6 +138,18 @@ void ComposeTile16(Tilemap &tilemap, const std::vector<uint8_t> &data,
std::vector<uint8_t> GetTilemapData(Tilemap &tilemap, int tile_id);
/**
* @brief Render multiple tiles using atlas rendering for improved performance
* @param tilemap Tilemap containing tiles to render
* @param tile_ids Vector of tile IDs to render
* @param positions Vector of screen positions for each tile
* @param scales Vector of scale factors for each tile (optional, defaults to 1.0)
* @note This function uses atlas rendering to reduce draw calls significantly
*/
void RenderTilesBatch(Tilemap& tilemap, const std::vector<int>& tile_ids,
const std::vector<std::pair<float, float>>& positions,
const std::vector<std::pair<float, float>>& scales = {});
} // namespace gfx
} // namespace yaze