diff options
| author | fschildt <florian.schildt@protonmail.com> | 2025-11-24 19:55:42 +0100 |
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2025-11-24 19:55:42 +0100 |
| commit | e4584401ad865afb5a0fec8b7cab67794490a10d (patch) | |
| tree | 6e13bfdac6b2687be6f3c180132e2a57ee71891d /src/renderer/Renderer.hpp | |
| parent | feb4bc8cbc66ba928319ddb2cc1bf48010487863 (diff) | |
rendering: refactor z-based sorting/drawing
Diffstat (limited to 'src/renderer/Renderer.hpp')
| -rw-r--r-- | src/renderer/Renderer.hpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/renderer/Renderer.hpp b/src/renderer/Renderer.hpp index 47837ee..da57e29 100644 --- a/src/renderer/Renderer.hpp +++ b/src/renderer/Renderer.hpp @@ -29,7 +29,7 @@ enum REntityType : int32_t { struct REntity_AlphaBitmap { REntityType type; AlphaBitmap& bitmap; - V3F32 pos; + V2F32 pos; Color color; }; @@ -49,7 +49,7 @@ struct REntity_Text { REntityType type; std::u32string& text; Font& font; - V3F32 pos; + V2F32 pos; Color color; }; @@ -62,9 +62,9 @@ union REntity { REntity_Text text; }; -struct RSortEntry { - float z; - size_t entity_index; +struct RZBuffEntry { + uint32_t z; + uint32_t entity_index; }; @@ -82,15 +82,14 @@ public: void SetScreenSize(int32_t w, int32_t h); void SetCameraSize(float w, float h); - void PushAlphaBitmap(AlphaBitmap& bitmap, V3F32 pos, Color color); - void PushRectangle(Rectangle rect, Color color, float z); - void PushCircle(Circle circle, Color color, float z); - void PushText(std::u32string& text, Font& font, V3F32 pos, Color color); + void PushAlphaBitmap(AlphaBitmap& bitmap, V2F32 pos, Color color, uint32_t z); + void PushRectangle(Rectangle rect, Color color, uint32_t z); + void PushCircle(Circle circle, Color color, uint32_t z); + void PushText(std::u32string& text, Font& font, V2F32 pos, Color color, uint32_t z); /* helper functions */ - int32_t WorldXToScreenX(float x); int32_t WorldYToScreenY(float y); int32_t WorldWidthToScreenWidth(float w); @@ -109,11 +108,9 @@ public: Color m_clear_color {}; std::vector<REntity> m_render_entities; - std::vector<RSortEntry> m_sort_entries; + std::vector<RZBuffEntry> m_z_buff; std::unique_ptr<RSoftwareBackend> m_backend; - - friend class RSoftwareBackend; }; |
