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

@@ -123,6 +123,23 @@ class AtlasRenderer {
*/
void Clear();
/**
* @brief Render a single bitmap using atlas (convenience method)
* @param atlas_id Atlas ID of bitmap to render
* @param x X position on screen
* @param y Y position on screen
* @param scale_x Horizontal scale factor
* @param scale_y Vertical scale factor
*/
void RenderBitmap(int atlas_id, float x, float y, float scale_x = 1.0f, float scale_y = 1.0f);
/**
* @brief Get UV coordinates for a bitmap in the atlas
* @param atlas_id Atlas ID of bitmap
* @return UV rectangle (0-1 normalized coordinates)
*/
SDL_Rect GetUVCoordinates(int atlas_id) const;
private:
AtlasRenderer() = default;
~AtlasRenderer();