15#include <AUI/GL/Program.h>
16#include <AUI/GL/Framebuffer.h>
17#include <AUI/GL/Vao.h>
18#include "AUI/Render/ABorderStyle.h"
19#include "AUI/Render/IRenderer.h"
20#include "AUI/GL/RenderTarget/TextureRenderTarget.h"
22class OpenGLRenderer final:
public IRenderer {
23friend class OpenGLPrerenderedString;
24friend class OpenGLMultiStringCanvas;
29 bool isTextureInvalid =
true;
33 texture.setupNearest();
56 struct CharacterData {
64 struct FramebufferWithTextureRT {
69 struct FramebufferBackToPool {
70 OpenGLRenderer* renderer;
71 void operator()(FramebufferWithTextureRT* framebuffer)
const;
74 using FramebufferFromPool = std::unique_ptr<FramebufferWithTextureRT, FramebufferBackToPool>;
75 using OffscreenFramebufferPool = AVector<FramebufferFromPool>;
80 OffscreenFramebufferPool mFramebuffersForMultiPassEffectsPool;
83 static std::array<glm::vec2, 4> getVerticesForRect(glm::vec2 position, glm::vec2 size);
85 void uploadToShaderCommon();
92 bool setupLineShader(
const ABrush& brush,
const ABorderStyle& style,
float widthPx);
112 FramebufferFromPool getFramebufferForMultiPassEffect(glm::uvec2 minRequiredSize);
114 void backdrops(glm::ivec2 fbSize, glm::ivec2 size, std::span<ass::Backdrop::Preprocessed> backdrops)
override;
117 _unique<ITexture> createNewTexture()
override;
121 ~OpenGLRenderer()
override =
default;
123 bool isVaoAvailable() const noexcept;
127 glm::vec2 size) override;
132 float radius) override;
137 float lineWidth) override;
143 int borderWidth) override;
148 const
AColor& color) override;
156 glm::vec2 offset) override;
158 void string(glm::vec2 position,
164 void drawRectImpl(glm::vec2 position, glm::vec2 size);
170 glm::mat4 getProjectionMatrix() const override;
179 const glm::vec2& position,
180 const glm::vec2& size,
192 void beginPaint(glm::uvec2 windowSize);
195 uint32_t getDefaultFb() const noexcept;
196 void bindTemporaryVao() const noexcept;
Strong type used to store angle in radians.
Definition AAngleRadians.h:42
Definition AArrayView.h:32
Describes border style, like CSS border-style.
Definition ABorderStyle.h:28
Represents a 4-component floating point color (RGBA).
Definition AColor.h:26
A std::deque with AUI extensions.
Definition ADeque.h:27
Stores dimensions in scalable units (dp, pt, etc...).
Definition AMetric.h:75
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition AOptional.h:33
Represents a Unicode character string.
Definition AString.h:38
Rendering view to texture storage interface.
Definition IRenderViewToTexture.h:26
Definition IRenderer.h:158
Definition IRenderer.h:151
void squareSector(const ABrush &brush, const glm::vec2 &position, const glm::vec2 &size, AAngleRadians begin, AAngleRadians end) override
Draws sector in rectangle shape. The sector is drawn clockwise from begin to end angles.
void roundedRectangle(const ABrush &brush, glm::vec2 position, glm::vec2 size, float radius) override
Draws rounded rect (with antialiasing, if msaa enabled).
void points(const ABrush &brush, AArrayView< glm::vec2 > points, AMetric size) override
Draws points list.
void setBlending(Blending blending) override
Sets blending mode.
_< IPrerenderedString > prerenderString(glm::vec2 position, const AString &text, const AFontStyle &fs) override
Analyzes string and creates an instance of IRenderer::IPrerenderedString which helps IRenderer to eff...
void popMaskAfter() override
Switches drawing to the color buffer back from the stencil. Decreases stencil depth.
void pushMaskBefore() override
witches drawing to the stencil buffer instead of color buffer.
void popMaskBefore() override
Switches drawing to the stencil buffer instead of color buffer.
void rectangle(const ABrush &brush, glm::vec2 position, glm::vec2 size) override
Draws simple rectangle.
_< IMultiStringCanvas > newMultiStringCanvas(const AFontStyle &style) override
Creates new canvas for batching multiple prerender string calls.
void lines(const ABrush &brush, AArrayView< glm::vec2 > points, const ABorderStyle &style, AMetric width) override
Draws polyline (non-loop line strip).
void roundedRectangleBorder(const ABrush &brush, glm::vec2 position, glm::vec2 size, float radius, int borderWidth) override
Draws rounded rectangle's border.
void boxShadowInner(glm::vec2 position, glm::vec2 size, float blurRadius, float spreadRadius, float borderRadius, const AColor &color, glm::vec2 offset) override
Draws inner (inset) rectangle-shaped shadow.
void pushMaskAfter() override
Switches drawing to the color buffer back from the stencil. Increases stencil depth.
void boxShadow(glm::vec2 position, glm::vec2 size, float blurRadius, const AColor &color) override
Draws a rectangle-shaped shadow.
_unique< IRenderViewToTexture > newRenderViewToTexture() noexcept override
Returns a new instance of IRenderViewToTexture interface associated with this renderer.
void rectangleBorder(const ABrush &brush, glm::vec2 position, glm::vec2 size, float lineWidth) override
Draws rectangle's border.
Definition SimpleTexturePacker.h:18
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
Definition Framebuffer.h:26
Definition Texture2D.h:20
Definition AFontStyle.h:24
Definition OpenGLRenderer.h:26
Forbids copy of your class.
Definition values.h:45