|
CoriEngine
|
The main engine renderer. More...
#include <Renderer2D.hpp>
Classes | |
| struct | Statistics |
Public Types | |
| enum | TextAlignment : uint8_t { RIGHT , CENTER , LEFT } |
| Available text alignment options. More... | |
| enum | DrawSpace : uint8_t { WORLD_SPACE , SCREEN_SPACE , UNSPECIFIED } |
| Defines where to draw the object, in what space. More... | |
| enum | ObjectTransparency : uint8_t { OPAQUE , SEMI_TRANSPARENT } |
Static Public Member Functions | |
| static void | SubmitQuad (const DrawSpace space, const ObjectTransparency transparencyMode, const glm::mat3 &transform, const glm::vec2 halfSize, const glm::vec4 &tintColor, Texture2D *texture, const UVs &uvs, const uint8_t depth, const bool flipX, const bool flipY, const bool flatColored) |
| Submits the quad to the render queue. | |
| static void | SubmitColoredQuad (const DrawSpace space, const glm::vec2 position, const glm::vec2 halfSize, const glm::vec3 &color) |
| Convenience function mainly for debugging, draws a plain colored quad. | |
| static void | SubmitAABB (const Utility::AABB &aabb, const float lineThickness, const glm::vec3 &color) |
| Draws the AABB, also a debug convenience function, always draws in world space. | |
| static void | SubmitText (const DrawSpace space, const TextAlignment alignment, const glm::mat3 &transform, const float fontSize, const std::u32string_view &text, const glm::vec4 &color, Font *font, const uint8_t depth, const float limitX, const float lineSpacing, const float kerning) |
| Draws a UTF-32 fixed length encoded string. | |
| static void | SubmitText (const DrawSpace space, const TextAlignment alignment, const glm::mat3 &transform, const float fontSize, const std::string_view &text, const glm::vec4 &color, Font *font, const uint8_t depth, const float limitX, const float lineSpacing, const float kerning) |
| Draws a UTF-32 fixed length encoded string. | |
| static Statistics | GetStatistics () |
| Gives you the rendering stats of the last rendered frame. | |
| static void | StartFrame () |
| static void | EndFrame () |
| static void | BeginScene (const World::Components::Scene::Camera &camera) |
| static void | EndScene () |
The main engine renderer.
The render is capable of rendering 2D quads, and text for now. It can render in screen space or in world space, supports both opaque object and transparent objects, and also has a layering system to position opaque and transparent objects currently (need to finish it of with a k-way merge). When rendering text it can be aligned to the left, right or center. Render uses instancing.
Definition at line 24 of file Renderer2D.hpp.
| enum Cori::Graphics::Renderer2D::DrawSpace : uint8_t |
Defines where to draw the object, in what space.
Basically if WORLD_SPACE is selected it will use the position, rotation, scale applied to orthographic camera, and if SCREEN_SPACE it will ignore the camera position, rotation, scale and use the initial projection matrix.
| Enumerator | |
|---|---|
| WORLD_SPACE | |
| SCREEN_SPACE | |
| UNSPECIFIED | |
Definition at line 83 of file Renderer2D.hpp.
| enum Cori::Graphics::Renderer2D::ObjectTransparency : uint8_t |
| Enumerator | |
|---|---|
| OPAQUE | |
| SEMI_TRANSPARENT | |
Definition at line 92 of file Renderer2D.hpp.
| enum Cori::Graphics::Renderer2D::TextAlignment : uint8_t |
Available text alignment options.
| Enumerator | |
|---|---|
| RIGHT | |
| CENTER | |
| LEFT | |
Definition at line 29 of file Renderer2D.hpp.
|
static |
Definition at line 86 of file Renderer2D.cpp.
|
static |
Definition at line 386 of file Renderer2D.cpp.
|
static |
Definition at line 116 of file Renderer2D.cpp.
|
static |
Gives you the rendering stats of the last rendered frame.
Definition at line 377 of file Renderer2D.cpp.
|
static |
Definition at line 381 of file Renderer2D.cpp.
|
static |
Draws the AABB, also a debug convenience function, always draws in world space.
| aabb | AABB to draw. |
| lineThickness | Thickness of the AABB border. |
| color | Border color. |
Definition at line 289 of file Renderer2D.cpp.

|
static |
Convenience function mainly for debugging, draws a plain colored quad.
| space | DrawSpace to draw the quad. |
| position | Position defined is the center of the quad. |
| halfSize | Half size of the quad. |
| color | Quad color. |
Definition at line 284 of file Renderer2D.cpp.

|
static |
Submits the quad to the render queue.
| space | DrawSpace to draw the quad. |
| transparencyMode | Transparency mode, defines how to handle the quad. (hint: you can query a Texture2D if it has semi transparency or no) |
| transform | Rendering transform. Position defined is the center of the quad. |
| halfSize | Half size of the quad. |
| tintColor | Tint color of the quad, or a color if flatColored=true. |
| texture | Texture to sample from. |
| uvs | UVs to sample with. |
| depth | Quad Depth, for layering, the higher the "closer". |
| flipX | Flip quad on X axis. |
| flipY | Flip quad on Y axis. |
| flatColored | Ignore the texture and use a plain white texture. |
Definition at line 157 of file Renderer2D.cpp.
|
static |
Draws a UTF-32 fixed length encoded string.
| space | DrawSpace to draw text in. |
| alignment | Text alignment with which to draw the text. |
| transform | Rendering transform. |
| fontSize | Size of the font to render. |
| text | View to the UTF-8 variable length encoded string to render. |
| color | Color of the text to render. |
| font | Font to use when rendering the text. |
| depth | Depth at which to render the text. |
| limitX | Length limit of the one line. |
| lineSpacing | Additional line spacing. |
| kerning | Additional kerning. |
Transform for TextAlignment::LEFT is a lower left border of the char in the first line.
For TextAlignment::CENTER it's the lower bound on y of the first line, and on x the center between the left border of the char in the first line and the right border of the char in the first line.
For TextAlignment::RIGHT it's the left lower border of the last char in the line.
Definition at line 352 of file Renderer2D.cpp.

|
static |
Draws a UTF-32 fixed length encoded string.
| space | DrawSpace to draw text in. |
| alignment | Text alignment with which to draw the text. |
| transform | Rendering transform. |
| fontSize | Size of the font to render. |
| text | View to the UTF-32 fixed length encoded string to render. |
| color | Color of the text to render. |
| font | Font to use when rendering the text. |
| depth | Depth at which to render the text. |
| limitX | Length limit of the one line. |
| lineSpacing | Additional line spacing. |
| kerning | Additional kerning. |
Transform for TextAlignment::LEFT is a lower left border of the char in the first line.
For TextAlignment::CENTER it's the lower bound on y of the first line, and on x the center between the left border of the char in the first line and the right border of the char in the first line.
For TextAlignment::RIGHT it's the left lower border of the last char in the line.
Definition at line 328 of file Renderer2D.cpp.
