10namespace sdl_painter {
17using TextureHandle = uint32_t;
20constexpr TextureHandle kInvalidTexture = 0;
23enum class RendererBackend : uint8_t {
34 IRenderer() =
default;
35 virtual ~IRenderer() =
default;
39 IRenderer(
const IRenderer&) =
delete;
40 IRenderer& operator=(
const IRenderer&) =
delete;
41 IRenderer(IRenderer&&) =
delete;
42 IRenderer& operator=(IRenderer&&) =
delete;
65 virtual void SetScissor(int32_t x, int32_t y, int32_t width,
86 int32_t height, int32_t channels) = 0;
92 virtual void DrawTextured(
const std::vector<TexturedVertex>& vertices,
93 TextureHandle texture) = 0;
98 [[nodiscard]]
virtual RendererBackend
GetBackend()
const = 0;
109std::unique_ptr<IRenderer> CreateRenderer(RendererBackend backend);
virtual void DestroyTexture(TextureHandle handle)=0
Texture'ı sil.
virtual void BeginFrame()=0
Yeni frame'e başla.
virtual void ClearScissor()=0
Scissor kırpmasını kaldır.
virtual bool Initialize(SDL_Window *window)=0
Renderer'ı verilen pencere için başlat.
virtual void SetScissor(int32_t x, int32_t y, int32_t width, int32_t height)=0
Scissor (kırpma) dikdörtgeni ayarla.
virtual RendererBackend GetBackend() const =0
Backend tipini döndür — projeksiyon yönü için kullanılır.
virtual void EndFrame()=0
Frame'i tamamla ve ekrana sun.
virtual TextureHandle CreateTexture(const uint8_t *data, int32_t width, int32_t height, int32_t channels)=0
Ham piksel verisinden texture oluştur. Başarısızlıkta kInvalidTexture döner.
virtual void SetProjectionMatrix(const float *mat4)=0
Ortografik projeksiyon matrisini ayarla (4x4, sütun-major).
virtual void Shutdown()=0
Kaynakları serbest bırak.
virtual void DrawTextured(const std::vector< TexturedVertex > &vertices, TextureHandle texture)=0
Texture'lı vertex'leri çiz. Tint rengi vertex'te taşınır.
virtual void SetViewport(int32_t x, int32_t y, int32_t width, int32_t height)=0
Viewport'u ayarla (piksel koordinatları).
virtual void SetModelMatrix(const float *mat3)=0
Model dönüşüm matrisini ayarla (3x3, sütun-major — glm::mat3 / glm::value_ptr düzeni).
virtual void DrawTriangles(const std::vector< Vertex > &vertices)=0
Üçgenler çiz. Vertex listesi 3'ün katı olmalı. Renk vertex'te taşınır.
virtual void Clear(const Color &color)=0
Ekranı belirtilen renkle temizle.
virtual void SetOpacity(float alpha)=0
Global opaklığı ayarla [0.0, 1.0].
RGBA renk temsili. Her kanal [0, 255] aralığında.
Definition color.h:8
Doku koordinatlı vertex — pozisyon + UV + renk (tint).
Definition vertex.h:21
Temel vertex — pozisyon + renk.
Definition vertex.h:8