|
ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
|
Renderer extends Object with ObjectivelyMVC's UI rendering layer. More...
#include <Renderer.h>
Public Member Functions | |
| Class * | _Renderer (void) |
| The Renderer archetype. | |
| void | beginFrame (Renderer *self) |
Prepares this Renderer for a new frame using self->device's current command buffer and framebuffer. | |
| void | beginFrameWith (Renderer *self, CommandBuffer *commands, Framebuffer *framebuffer) |
| Prepares this Renderer for a new frame using the given command buffer and framebuffer. | |
| void | drawLine (const Renderer *self, const SDL_Point *points, const SDL_Color *color) |
| Records a line segment between two points. | |
| void | drawLines (const Renderer *self, const SDL_Point *points, size_t count, const SDL_Color *color) |
| Records a polyline through the given points. | |
| void | drawRect (const Renderer *self, const SDL_Rect *rect, const SDL_Color *color) |
| Records a rectangle outline. | |
| void | drawRectFilled (const Renderer *self, const SDL_Rect *rect, const SDL_Color *color) |
| Records a filled rectangle. | |
| void | drawTexture (const Renderer *self, Texture *texture, const SDL_Rect *dest, const SDL_Color *color) |
| Records a textured quad in the given destination rectangle. | |
| void | drawView (Renderer *self, View *view) |
| Sets the clipping frame and invokes View::render for the given View. | |
| void | endFrame (Renderer *self) |
Uploads MVC vertices and executes the UI render pass into the Framebuffer given to beginFrame/beginFrameWith (LOAD_OP_LOAD). | |
| Renderer * | initWithDevice (Renderer *self, RenderDevice *device) |
| Initializes this Renderer with the given RenderDevice. | |
| void | pushDrawArrays (const Renderer *self, const MVC_Vertex *verts, size_t count, Texture *texture, const SDL_Color *color) |
| Appends raw vertices and a draw call record to the frame queue. | |
| void | renderDeviceDidReset (Renderer *self) |
| Recreates MVC GPU resources after the backing RenderDevice resets. | |
| void | renderDeviceWillReset (Renderer *self) |
| Releases MVC GPU resources before the backing RenderDevice resets. | |
| void | setClippingFrame (Renderer *self, const SDL_Rect *clippingFrame) |
| Sets the scissor rectangle for subsequent draw calls. | |
Data Fields | |
| RenderDevice * | device |
| The backing RenderDevice. | |
| Object | object |
| The superclass. | |
Protected Attributes | |
| RendererInterface * | interface |
| The interface. | |
Renderer extends Object with ObjectivelyMVC's UI rendering layer.
Create a WindowController to instantiate a default Renderer.
Definition at line 70 of file Renderer.h.
| Class * _Renderer | ( | void | ) |
The Renderer archetype.
Definition at line 522 of file Renderer.c.
| void beginFrame | ( | Renderer * | self | ) |
Prepares this Renderer for a new frame using self->device's current command buffer and framebuffer.
Convenience over beginFrameWith for the common case of rendering the UI into the device's own current frame. Equivalent to $(self, beginFrameWith, self->device->commands, self->device->framebuffer).
| self | The Renderer. |
Definition at line 88 of file Renderer.c.
| void beginFrameWith | ( | Renderer * | self, |
| CommandBuffer * | commands, | ||
| Framebuffer * | framebuffer | ||
| ) |
Prepares this Renderer for a new frame using the given command buffer and framebuffer.
| self | The Renderer. |
| commands | The frame's CommandBuffer. The caller retains ownership and must submit and release it. |
| framebuffer | The target Framebuffer for this frame. Borrowed for the duration of the frame. |
Definition at line 96 of file Renderer.c.
| void drawLine | ( | const Renderer * | self, |
| const SDL_Point * | points, | ||
| const SDL_Color * | color | ||
| ) |
Records a line segment between two points.
| self | The Renderer. |
| points | Two points defining the line segment. |
| color | The line color. |
Definition at line 114 of file Renderer.c.
| void drawLines | ( | const Renderer * | self, |
| const SDL_Point * | points, | ||
| size_t | count, | ||
| const SDL_Color * | color | ||
| ) |
Records a polyline through the given points.
| self | The Renderer. |
| points | The points. |
| count | The number of points. |
| color | The line color. |
Definition at line 125 of file Renderer.c.
| void drawRect | ( | const Renderer * | self, |
| const SDL_Rect * | rect, | ||
| const SDL_Color * | color | ||
| ) |
Records a rectangle outline.
| self | The Renderer. |
| rect | The rectangle. |
| color | The outline color. |
Definition at line 169 of file Renderer.c.
| void drawRectFilled | ( | const Renderer * | self, |
| const SDL_Rect * | rect, | ||
| const SDL_Color * | color | ||
| ) |
Records a filled rectangle.
| self | The Renderer. |
| rect | The rectangle. |
| color | The fill color. |
Definition at line 188 of file Renderer.c.
| void drawTexture | ( | const Renderer * | self, |
| Texture * | texture, | ||
| const SDL_Rect * | dest, | ||
| const SDL_Color * | color | ||
| ) |
Records a textured quad in the given destination rectangle.
| self | The Renderer. |
| texture | The Texture to sample. |
| dest | The destination rectangle in logical screen coordinates. |
| color | The color multiplier (use &Colors.White for no tint). |
Definition at line 211 of file Renderer.c.
Sets the clipping frame and invokes View::render for the given View.
Definition at line 234 of file Renderer.c.
| void endFrame | ( | Renderer * | self | ) |
Uploads MVC vertices and executes the UI render pass into the Framebuffer given to beginFrame/beginFrameWith (LOAD_OP_LOAD).
The caller is responsible for submitting the command buffer after this returns.
| self | The Renderer. |
Definition at line 249 of file Renderer.c.
Initializes this Renderer with the given RenderDevice.
| self | The Renderer. |
| device | The RenderDevice. |
NULL on error. Definition at line 313 of file Renderer.c.
| void pushDrawArrays | ( | const Renderer * | self, |
| const MVC_Vertex * | verts, | ||
| size_t | count, | ||
| Texture * | texture, | ||
| const SDL_Color * | color | ||
| ) |
Appends raw vertices and a draw call record to the frame queue.
Views that need full draw-call control can call this directly instead of going through the drawLine/drawRect/drawTexture helpers.
| self | The Renderer. |
| verts | The vertices to append (in logical screen coordinates). |
| count | The number of vertices. |
| texture | The texture to bind, or NULL to use the 1×1 white fallback. |
| color | The color multiplier applied in the fragment shader. |
Definition at line 334 of file Renderer.c.
| void renderDeviceDidReset | ( | Renderer * | self | ) |
Recreates MVC GPU resources after the backing RenderDevice resets.
| self | The Renderer. |
Definition at line 359 of file Renderer.c.
| void renderDeviceWillReset | ( | Renderer * | self | ) |
Releases MVC GPU resources before the backing RenderDevice resets.
| self | The Renderer. |
Definition at line 462 of file Renderer.c.
| void setClippingFrame | ( | Renderer * | self, |
| const SDL_Rect * | clippingFrame | ||
| ) |
Sets the scissor rectangle for subsequent draw calls.
| self | The Renderer. |
| clippingFrame | The clipping rectangle in logical screen coordinates, or NULL to disable clipping (full window scissor). |
Definition at line 482 of file Renderer.c.
| RenderDevice* Renderer::device |
The backing RenderDevice.
Definition at line 92 of file Renderer.h.
|
protected |
The interface.
Definition at line 81 of file Renderer.h.
| Object Renderer::object |
The superclass.
Definition at line 75 of file Renderer.h.