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,
159 const AString&
string,
160 const AFontStyle& fs) override;
164 void drawRectImpl(glm::vec2 position, glm::vec2 size);
170 glm::mat4 getProjectionMatrix() const override;
172 void lines(const ABrush& brush, AArrayView<glm::vec2>
points, const ABorderStyle& style, AMetric width) override;
174 void lines(const ABrush& brush, AArrayView<std::pair<glm::vec2, glm::vec2>>
points, const ABorderStyle& style, AMetric width) override;
176 void points(const ABrush& brush, AArrayView<glm::vec2>
points, AMetric size) override;
179 const glm::vec2& position,
180 const glm::vec2& size,
182 AAngleRadians end) override;
192 void beginPaint(glm::uvec2 windowSize);
195 uint32_t getDefaultFb() const noexcept;
196 void bindTemporaryVao() const noexcept;
A std::deque with AUI extensions.
Definition ADeque.h:27
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition AOptional.h:32
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.
Definition OpenGLRenderer.cpp:964
void roundedRectangle(const ABrush &brush, glm::vec2 position, glm::vec2 size, float radius) override
Draws rounded rect (with antialiasing, if msaa enabled).
Definition OpenGLRenderer.cpp:334
void points(const ABrush &brush, AArrayView< glm::vec2 > points, AMetric size) override
Draws points list.
Definition OpenGLRenderer.cpp:934
void setBlending(Blending blending) override
Sets blending mode.
Definition OpenGLRenderer.cpp:494
void popMaskAfter() override
Switches drawing to the color buffer back from the stencil. Decreases stencil depth.
Definition OpenGLRenderer.cpp:833
void pushMaskBefore() override
witches drawing to the stencil buffer instead of color buffer.
Definition OpenGLRenderer.cpp:813
void popMaskBefore() override
Switches drawing to the stencil buffer instead of color buffer.
Definition OpenGLRenderer.cpp:826
_< 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...
Definition OpenGLRenderer.cpp:777
void rectangle(const ABrush &brush, glm::vec2 position, glm::vec2 size) override
Draws simple rectangle.
Definition OpenGLRenderer.cpp:304
void lines(const ABrush &brush, AArrayView< glm::vec2 > points, const ABorderStyle &style, AMetric width) override
Draws polyline (non-loop line strip).
Definition OpenGLRenderer.cpp:879
_< IMultiStringCanvas > newMultiStringCanvas(const AFontStyle &style) override
Creates new canvas for batching multiple prerender string calls.
Definition OpenGLRenderer.cpp:805
void roundedRectangleBorder(const ABrush &brush, glm::vec2 position, glm::vec2 size, float radius, int borderWidth) override
Draws rounded rectangle's border.
Definition OpenGLRenderer.cpp:391
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.
Definition OpenGLRenderer.cpp:451
void pushMaskAfter() override
Switches drawing to the color buffer back from the stencil. Increases stencil depth.
Definition OpenGLRenderer.cpp:820
void boxShadow(glm::vec2 position, glm::vec2 size, float blurRadius, const AColor &color) override
Draws a rectangle-shaped shadow.
Definition OpenGLRenderer.cpp:414
_unique< IRenderViewToTexture > newRenderViewToTexture() noexcept override
Returns a new instance of IRenderViewToTexture interface associated with this renderer.
Definition OpenGLRenderer.cpp:1035
void rectangleBorder(const ABrush &brush, glm::vec2 position, glm::vec2 size, float lineWidth) override
Draws rectangle's border.
Definition OpenGLRenderer.cpp:351
Definition SimpleTexturePacker.h:18
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:178
Definition Framebuffer.h:26
Definition Texture2D.h:20
Definition OpenGLRenderer.h:26
Forbids copy of your class.
Definition values.h:40