23 ~RaylibRenderer()
override;
25 RaylibRenderer(
const RaylibRenderer &) =
delete;
26 RaylibRenderer &operator=(
const RaylibRenderer &) =
delete;
46 std::span<const uint32_t> indices,
56 std::string_view vsSource = {})
override;
88 bool clipActive{
false};
89 Rect currentClip{0, 0, 0, 0};
90 std::vector<Rect> clipStack;
91 std::vector<Transform2D> transformStack;
96 Rect transformClipToScreen(
const Rect &local)
const;
97 void applyScissor(
const Rect &clip);
98 void suspendRenderState();
99 void restoreRenderState();
101 std::unique_ptr<Resources> res_;
103 std::vector<TargetState> targetStates_;
104 std::vector<Rect> clipStack_;
105 std::vector<Transform2D> transformStack_;
106 std::vector<EffectHandle> effectStack_;
108 bool clipActive_{
false};
109 Rect currentClip_{0, 0, 0, 0};
110 float dpiScale_{1.0f};
113 bool insideTarget_{
false};
114 TargetHandle currentTarget_{};
115 int currentTargetW_{0};
116 int currentTargetH_{0};
Per-application state: renderer, platform, pointer, focus, portals.
Abstract 2D rendering backend.
Definition UIContext.hpp:106
void setEffectVec4(EffectHandle e, const char *name, Color value) override
Set a normalized RGBA vec4 uniform (0..1 per channel) named name on effect e.
ShaderLanguage shaderLanguage() const override
Return the shading language expected by IAssetProvider::loadEffect on this renderer.
Definition RaylibRenderer.hpp:39
void drawNineSlice(TextureHandle t, NineSlice s, Rect dst, Color tint) override
Draw texture t stretched into dst using the 9-slice insets s (fixed corners, stretched edges/center).
void setEffectFloat(EffectHandle e, const char *name, float value) override
Set a float uniform named name on effect e.
void popTarget() override
Finish drawing into the active target and restore the previous target (or main framebuffer) and stack...
void destroyTarget(TargetHandle t) override
Release a render target previously allocated by createTarget.
void popClip() override
Pop the current clip rectangle and restore the previous scissor region.
void drawGeometry(std::span< const Vertex2D > vertices, std::span< const uint32_t > indices, TextureHandle tex={}) override
Draw an indexed triangle list in logical screen coordinates.
TargetHandle createTarget(int w, int h) override
Allocate an off-screen RGBA render target of w x h pixels (used when Feature::NestedTargets is suppor...
TextureHandle createTexture(int w, int h, const uint8_t *rgbaPixels=nullptr) override
Allocate a dynamic RGBA8 2D texture of w x h pixels.
void setBlendMode(BlendMode mode) override
Switch the active color-blending mode.
bool inTarget() const override
Return true while a pushTarget is active without a matching popTarget.
void endFrame() override
Called at the end of Layout::renderFrame after all draw calls and portals have rendered.
void destroyTexture(TextureHandle t) override
Release a dynamic texture previously created by createTexture.
void updateTexture(TextureHandle t, Rect region, const uint8_t *rgbaPixels) override
Upload tightly-packed RGBA8 pixels into sub-rectangle region of texture t.
void pushClip(Rect r) override
Push a local-space clip rectangle r, intersecting it with the current clip.
void setEffectVec3(EffectHandle e, const char *name, Vec3 value) override
Set a vec3 uniform named name on effect e.
bool supports(Feature f) const override
Query whether this backend implements an optional Feature.
Definition RaylibRenderer.hpp:32
void pushEffect(EffectHandle e) override
Bind shader effect e and push it onto the effect stack (used when Feature::Effects is supported).
void drawTarget(TargetHandle t, Rect dst, Color tint) override
Composite the entire render target t into logical destination rect dst, multiplied by tint.
void drawTarget(TargetHandle t, Rect src, Rect dst, Color tint) override
Composite sub-rectangle src (target pixels) of t into logical rect dst.
void setDpiScale(float scale) override
Notify the renderer of the active logical-to-physical DPI scale factor for the current frame.
void popEffect() override
Pop the active shader effect and restore the previous one (if any).
void drawTexture(TextureHandle t, Rect src, Rect dst, Color tint) override
Draw sub-rectangle src (texture pixels) of texture t into logical rect dst, multiplied by tint.
void beginFrame() override
Called at the start of Layout::renderFrame before any draw calls (e.g.
void fillCircle(Vec2 center, float radius, Color c) override
Fill a circle centered at center with the given logical radius.
void fillRect(Rect r, Color c) override
Fill an axis-aligned rectangle r with solid color c.
EffectHandle createEffect(std::string_view fsSource, std::string_view vsSource={}) override
Compile and allocate a shader effect from GLSL/backend source strings.
void pushTarget(TargetHandle t) override
Redirect subsequent draw calls to target t and clear it to transparent black.
void strokeRect(Rect r, float thickness, Color c) override
Stroke a rectangular border strictly inside r (CSS border-box).
void setEffectVec2(EffectHandle e, const char *name, Vec2 value) override
Set a vec2 uniform named name on effect e.
void popTransform() override
Pop the most recently pushed transform from the stack.
void clearTarget(TargetHandle t, Color c) override
Clear render target t to solid color c.
void setEffectVec4f(EffectHandle e, const char *name, Vec4 value) override
Set a vec4 uniform named name on effect e.
void fillRoundedRect(Rect r, float radiusPx, Color c) override
Fill a rectangle r with corner radius radiusPx (clamped to half the shorter side).
void pushTransform(const Transform2D &t) override
Push a 2D pivot-based transform onto the transform stack.
Rect getClipRect() const override
Return the active screen-space clip rectangle in logical pixels (used for culling).
void destroyEffect(EffectHandle e) override
Release a shader effect previously created by createEffect.
ShaderLanguage
Shading language consumed by an IRenderer that supports Feature::Effects.
Definition UIContext.hpp:73
BlendMode
Color-blending mode used by IRenderer draw calls.
Definition UIContext.hpp:88
Feature
Optional renderer capabilities queried via IRenderer::supports.
Definition UIContext.hpp:62
@ GLSL330
OpenGL 3.3 Core GLSL (.fs / .vs, Raylib & SDL3 GL convention).
Definition UIContext.hpp:75
@ Alpha
Standard straight-alpha compositing (default).
Definition UIContext.hpp:89
@ NestedTargets
Supports off-screen render targets (createTarget, pushTarget, popTarget, drawTarget).
Definition UIContext.hpp:64
@ TargetSubRect
Supports sub-rectangle blitting via drawTarget(t, src, dst, tint) for pooled targets.
Definition UIContext.hpp:65
@ Effects
Supports fragment shaders (pushEffect, popEffect, setEffect*).
Definition UIContext.hpp:63
8-bit-per-channel RGBA color, non-premultiplied.
Definition CoreTypes.hpp:78
Opaque handle to a shader/effect owned by the asset provider.
Definition CoreTypes.hpp:142
Nine-slice inset values for scalable textures.
Definition CoreTypes.hpp:163
Axis-aligned rectangle in screen coordinates.
Definition CoreTypes.hpp:46
Opaque handle to an off-screen render target.
Definition CoreTypes.hpp:155
Opaque handle to a GPU/software texture owned by the asset provider.
Definition CoreTypes.hpp:127
2D vector with component-wise arithmetic.
Definition CoreTypes.hpp:25
3D vector.
Definition CoreTypes.hpp:34
4D vector with an implicit w = 1 default.
Definition CoreTypes.hpp:40