From e8baea58dd5c92b62c4eef1b5c1ca9648f44e7d7 Mon Sep 17 00:00:00 2001 From: quou Date: Mon, 30 Dec 2024 12:44:28 +1100 Subject: ui renderer clipping --- ui.hpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'ui.hpp') diff --git a/ui.hpp b/ui.hpp index 4dc0dd9..2b671ae 100644 --- a/ui.hpp +++ b/ui.hpp @@ -19,15 +19,26 @@ struct UI { float a_f() { return (float)a / 255.0f; }; }; + struct Rect { + int x, y, w, h; + + Rect() = default; + Rect(int x, int y, int w, int h); + }; + struct Vertex_Buffer { + Rect clip; + bool dirty; Staged_Buffer buf; Buffer_Id indices; - int usage; + int start, usage; void init(Device* dev); void init_indices(Device* dev); void destroy(UI* ui); void update_buffer(Context& ctx); + void reset(const Rect& clip); + void set_clip(const Rect& clip); void add_quad( UI* ui, @@ -66,10 +77,6 @@ struct UI { Vertex_Buffer* next; }; - struct Rect { - int x, y, w, h; - }; - Heap* heap; Device* device; Texture_Id atlas; @@ -78,6 +85,8 @@ struct UI { Sampler_Id sampler; Staged_Buffer cbuffer; Vertex_Buffer mesh; + Pipeline* pipeline; + Render_Pass* render_pass; struct UI_CBuffer { m4f projection; -- cgit v1.2.3-54-g00ecf