1#ifndef YAZE_APP_GFX_ATLAS_RENDERER_H
2#define YAZE_APP_GFX_ATLAS_RENDERER_H
6#include <unordered_map>
27 float sx = 1.0f,
float sy = 1.0f,
28 float rot = 0.0f, SDL_Color color = {255, 255, 255, 255})
117 void RenderBatch(
const std::vector<RenderCommand>& render_commands);
125 const std::unordered_map<
BppFormat, std::vector<int>>& bpp_groups);
151 void RenderBitmap(
int atlas_id,
float x,
float y,
float scale_x = 1.0f,
float scale_y = 1.0f);
174 int width = 0,
int height = 0)
Atlas-based rendering system for efficient graphics operations.
SDL_Rect FindFreeRegion(Atlas &atlas, int width, int height)
AtlasStats GetStats() const
Get atlas statistics.
bool PackBitmap(Atlas &atlas, const Bitmap &bitmap, SDL_Rect &uv_rect)
void UpdateBitmap(int atlas_id, const Bitmap &bitmap)
Update a bitmap in the atlas.
std::vector< std::unique_ptr< Atlas > > atlases_
void RebuildAtlas(Atlas &atlas)
void Clear()
Clear all atlases.
int AddBitmapWithBppOptimization(const Bitmap &bitmap, BppFormat target_bpp)
Add a bitmap to the atlas with BPP format optimization.
void RenderBitmap(int atlas_id, float x, float y, float scale_x=1.0f, float scale_y=1.0f)
Render a single bitmap using atlas (convenience method)
void MarkRegionUsed(Atlas &atlas, const SDL_Rect &rect, bool used)
std::unordered_map< int, AtlasEntry * > atlas_lookup_
void RenderBatch(const std::vector< RenderCommand > &render_commands)
Render multiple bitmaps in a single draw call.
void RemoveBitmap(int atlas_id)
Remove a bitmap from the atlas.
void Defragment()
Defragment the atlas to reclaim space.
SDL_Rect GetUVCoordinates(int atlas_id) const
Get UV coordinates for a bitmap in the atlas.
int AddBitmap(const Bitmap &bitmap)
Add a bitmap to the atlas.
static AtlasRenderer & Get()
void Initialize(IRenderer *renderer, int initial_size=1024)
Initialize the atlas renderer.
void RenderBatchWithBppOptimization(const std::vector< RenderCommand > &render_commands, const std::unordered_map< BppFormat, std::vector< int > > &bpp_groups)
Render multiple bitmaps with BPP-aware batching.
Represents a bitmap image optimized for SNES ROM hacking.
Defines an abstract interface for all rendering operations.
void * TextureHandle
An abstract handle representing a texture.
BppFormat
BPP format enumeration for SNES graphics.
@ kBpp8
8 bits per pixel (256 colors)
Main namespace for the application.
AtlasEntry(int id, const SDL_Rect &rect, TextureHandle tex, BppFormat bpp=BppFormat::kBpp8, int width=0, int height=0)
std::vector< AtlasEntry > entries
std::vector< bool > used_regions
float utilization_percent
Render command for batch rendering.
float rotation
Rotation angle in degrees.
SDL_Color tint
Color tint.
int atlas_id
Atlas ID of bitmap to render.
float y
Screen coordinates.
RenderCommand(int id, float x_pos, float y_pos, float sx=1.0f, float sy=1.0f, float rot=0.0f, SDL_Color color={255, 255, 255, 255})
float scale_y
Scale factors.