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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user