|
Muto 0.0.1
|
A 2D renderer for drawing quads and sprites. More...
#include <Renderer2D.h>
Classes | |
| struct | Statistics |
| 2D Renderer Statistics More... | |
Static Public Member Functions | |
| static void | BeginScene (const Camera &camera, const glm::mat4 &transform) |
| Begins a new scene with the given camera and transform. | |
| static void | BeginScene (const EditorCamera &camera) |
| Begins a new scene with the given editor camera. | |
| static void | BeginScene (const OrthographicCamera &camera) |
| Begins a new scene with the given orthographic camera. | |
| static void | DrawQuad (const glm::mat4 &transform, const glm::vec4 &color) |
| Draws a colored quad with the given transform and color. | |
| static void | DrawQuad (const glm::mat4 &transform, const Ref< SubTexture2D > &subtexture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a textured quad with the given transform, subtexture, tiling factor, and tint color. | |
| static void | DrawQuad (const glm::mat4 &transform, const Ref< Texture2D > &texture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a textured quad with the given transform, texture, tiling factor, and tint color. | |
| static void | DrawQuad (const glm::vec2 &position, const glm::vec2 &size, const glm::vec4 &color) |
| Draws a colored quad at the specified position and size. | |
| static void | DrawQuad (const glm::vec2 &position, const glm::vec2 &size, const Ref< SubTexture2D > &subtexture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a textured quad at the specified position and size. | |
| static void | DrawQuad (const glm::vec2 &position, const glm::vec2 &size, const Ref< Texture2D > &texture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a textured quad at the specified position and size. | |
| static void | DrawQuad (const glm::vec3 &position, const glm::vec2 &size, const glm::vec4 &color) |
| Draws a colored quad at the specified position and size. | |
| static void | DrawQuad (const glm::vec3 &position, const glm::vec2 &size, const Ref< SubTexture2D > &subtexture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a textured quad at the specified position and size. | |
| static void | DrawQuad (const glm::vec3 &position, const glm::vec2 &size, const Ref< Texture2D > &texture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a textured quad at the specified position and size. | |
| static void | DrawRotatedQuad (const glm::mat4 &transform, const glm::vec4 &color) |
| Draws a rotated colored quad with the given transform and color. | |
| static void | DrawRotatedQuad (const glm::mat4 &transform, const Ref< SubTexture2D > &subtexture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a rotated textured quad with the given transform, subtexture, tiling factor, and tint color. | |
| static void | DrawRotatedQuad (const glm::mat4 &transform, const Ref< Texture2D > &texture, float tilingFactor, const glm::vec4 tintColor) |
| Draws a rotated textured quad with the given transform, texture, tiling factor, and tint color. | |
| static void | DrawRotatedQuad (const glm::vec2 &position, const glm::vec2 &size, const Ref< SubTexture2D > &subtexture, float rotationRads, float tilingFactor, const glm::vec4 tintColor) |
| Draws a rotated textured quad at the specified position, size, and rotation. | |
| static void | DrawRotatedQuad (const glm::vec2 &position, const glm::vec2 &size, const Ref< Texture2D > &texture, float rotationRads, float tilingFactor, const glm::vec4 tintColor) |
| Draws a rotated textured quad at the specified position, size, and rotation. | |
| static void | DrawRotatedQuad (const glm::vec2 &position, const glm::vec2 &size, float rotationRads, const glm::vec4 &color) |
| Draws a rotated colored quad at the specified position, size, and rotation. | |
| static void | DrawRotatedQuad (const glm::vec3 &position, const glm::vec2 &size, const Ref< SubTexture2D > &subtexture, float rotationRads, float tilingFactor, const glm::vec4 tintColor) |
| Draws a rotated textured quad at the specified position, size, and rotation. | |
| static void | DrawRotatedQuad (const glm::vec3 &position, const glm::vec2 &size, const Ref< Texture2D > &texture, float rotationRads, float tilingFactor, const glm::vec4 tintColor) |
| Draws a rotated textured quad at the specified position, size, and rotation. | |
| static void | DrawRotatedQuad (const glm::vec3 &position, const glm::vec2 &size, float rotationRads, const glm::vec4 &color) |
| Draws a rotated colored quad at the specified position, size, and rotation. | |
| static void | EndScene () |
| Ends the current scene. | |
| static void | Flush () |
| Flushes the current batch of rendering commands. | |
| static Statistics | GetStats () |
| Retrieves the current rendering statistics. | |
| static Ref< Texture2D > | GetWhiteTexture () |
| Returns a reference to the default white texture that allows for coloring. | |
| static void | Init () |
| Initializes the 2D renderer. | |
| static void | ResetStats () |
| Resets the rendering statistics. | |
| static void | Shutdown () |
| Shuts down the 2D renderer. | |
Static Private Member Functions | |
| static void | FlushAndReset () |
| static void | StartBatch () |
A 2D renderer for drawing quads and sprites.
Begins a new scene with the given camera and transform.
| camera | The camera to use for the scene. |
| transform | The transform matrix for the camera. |
References Muto::s_Data, and StartBatch().
|
static |
Begins a new scene with the given editor camera.
| camera | The editor camera to use for the scene. |
References Muto::s_Data, and StartBatch().
Referenced by Muto::Scene::OnUpdateEditor().
|
static |
Begins a new scene with the given orthographic camera.
| camera | The orthographic camera to use for the scene. |
References Muto::s_Data, and StartBatch().
Draws a colored quad with the given transform and color.
| transform | The transform matrix for the quad. |
| color | The color of the quad. |
References FlushAndReset(), Muto::Renderer2DData::MaxIndices, Muto::Renderer2D::Statistics::QuadCount, Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferPtr, Muto::s_Data, Muto::Renderer2DData::Stats, Muto::QuadVertex::TexIndex, and Muto::QuadVertex::TilingFactor.
|
static |
Draws a textured quad with the given transform, subtexture, tiling factor, and tint color.
| transform | The transform matrix for the quad. |
| subtexture | The subtexture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
References FlushAndReset(), Muto::Renderer2DData::MaxIndices, Muto::Renderer2DData::MaxTextureSlots, Muto::Renderer2D::Statistics::QuadCount, Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferPtr, Muto::s_Data, Muto::Renderer2DData::Stats, Muto::QuadVertex::TexIndex, Muto::Renderer2DData::TextureSlotIndex, and Muto::QuadVertex::TilingFactor.
|
static |
Draws a textured quad with the given transform, texture, tiling factor, and tint color.
| transform | The transform matrix for the quad. |
| texture | The texture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
References FlushAndReset(), Muto::Renderer2DData::MaxIndices, Muto::Renderer2DData::MaxTextureSlots, Muto::Renderer2D::Statistics::QuadCount, Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferPtr, Muto::s_Data, Muto::Renderer2DData::Stats, Muto::QuadVertex::TexIndex, Muto::Renderer2DData::TextureSlotIndex, and Muto::QuadVertex::TilingFactor.
|
static |
Draws a colored quad at the specified position and size.
| position | The position of the quad in 2D space. |
| size | The size of the quad. |
| color | The color of the quad. |
|
static |
Draws a textured quad at the specified position and size.
| position | The position of the quad in 2D space. |
| size | The size of the quad. |
| subtexture | The subtexture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a textured quad at the specified position and size.
| position | The position of the quad in 2D space. |
| size | The size of the quad. |
| texture | The texture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a colored quad at the specified position and size.
| position | The position of the quad in 3D space. |
| size | The size of the quad. |
| color | The color of the quad. |
|
static |
Draws a textured quad at the specified position and size.
| position | The position of the quad in 3D space. |
| size | The size of the quad. |
| subtexture | The subtexture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a textured quad at the specified position and size.
| position | The position of the quad in 3D space. |
| size | The size of the quad. |
| texture | The texture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a rotated colored quad with the given transform and color.
| transform | The transform matrix for the quad. |
| color | The color of the quad. |
References FlushAndReset(), Muto::Renderer2DData::MaxIndices, Muto::Renderer2D::Statistics::QuadCount, Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferPtr, Muto::s_Data, Muto::Renderer2DData::Stats, Muto::QuadVertex::TexIndex, and Muto::QuadVertex::TilingFactor.
|
static |
Draws a rotated textured quad with the given transform, subtexture, tiling factor, and tint color.
| transform | The transform matrix for the quad. |
| subtexture | The subtexture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
References FlushAndReset(), Muto::Renderer2DData::MaxIndices, Muto::Renderer2DData::MaxTextureSlots, Muto::Renderer2D::Statistics::QuadCount, Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferPtr, Muto::s_Data, Muto::Renderer2DData::Stats, Muto::QuadVertex::TexIndex, Muto::Renderer2DData::TextureSlotIndex, and Muto::QuadVertex::TilingFactor.
|
static |
Draws a rotated textured quad with the given transform, texture, tiling factor, and tint color.
| transform | The transform matrix for the quad. |
| texture | The texture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
References FlushAndReset(), Muto::Renderer2DData::MaxIndices, Muto::Renderer2DData::MaxTextureSlots, Muto::Renderer2D::Statistics::QuadCount, Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferPtr, Muto::s_Data, Muto::Renderer2DData::Stats, Muto::QuadVertex::TexIndex, Muto::Renderer2DData::TextureSlotIndex, and Muto::QuadVertex::TilingFactor.
|
static |
Draws a rotated textured quad at the specified position, size, and rotation.
| position | The position of the quad in 2D space. |
| size | The size of the quad. |
| rotationRads | The rotation of the quad in radians. |
| subtexture | The subtexture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a rotated textured quad at the specified position, size, and rotation.
| position | The position of the quad in 2D space. |
| size | The size of the quad. |
| rotationRads | The rotation of the quad in radians. |
| texture | The texture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a rotated colored quad at the specified position, size, and rotation.
| position | The position of the quad in 2D space. |
| size | The size of the quad. |
| rotationRads | The rotation of the quad in radians. |
| color | The color of the quad. |
|
static |
Draws a rotated textured quad at the specified position, size, and rotation.
| position | The position of the quad in 3D space. |
| size | The size of the quad. |
| rotationRads | The rotation of the quad in radians. |
| subtexture | The subtexture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a rotated textured quad at the specified position, size, and rotation.
| position | The position of the quad in 3D space. |
| size | The size of the quad. |
| rotationRads | The rotation of the quad in radians. |
| texture | The texture to apply to the quad. |
| tilingFactor | The tiling factor for the texture. |
| tintColor | The tint color to apply to the texture. |
|
static |
Draws a rotated colored quad at the specified position, size, and rotation.
| position | The position of the quad in 3D space. |
| size | The size of the quad. |
| rotationRads | The rotation of the quad in radians. |
| color | The color of the quad. |
|
static |
Ends the current scene.
References Flush(), Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferBase, Muto::Renderer2DData::QuadVertexBufferPtr, and Muto::s_Data.
Referenced by FlushAndReset(), Sandbox2D::OnUpdate(), Muto::Scene::OnUpdateEditor(), and Muto::Scene::OnUpdateRuntime().
|
static |
Flushes the current batch of rendering commands.
Resets the batch for a new set of draw calls.
References Muto::Renderer2D::Statistics::DrawCalls, Muto::Renderer2DData::QuadIndexCount, Muto::s_Data, Muto::Renderer2DData::Stats, and Muto::Renderer2DData::TextureSlotIndex.
Referenced by EndScene().
|
staticprivate |
References EndScene(), and StartBatch().
Referenced by DrawQuad(), DrawQuad(), DrawQuad(), DrawRotatedQuad(), DrawRotatedQuad(), and DrawRotatedQuad().
|
static |
Retrieves the current rendering statistics.
References Muto::s_Data, and Muto::Renderer2DData::Stats.
Referenced by Muto::EditorLayer::OnImGuiRender(), and Sandbox2D::OnImGuiRender().
Returns a reference to the default white texture that allows for coloring.
References Muto::s_Data.
|
static |
Initializes the 2D renderer.
References Muto::AssetsDirectory, Muto::Application::Get(), Muto::JoinPaths(), Muto::Renderer2DData::MaxIndices, Muto::Renderer2DData::MaxTextureSlots, Muto::Renderer2DData::MaxVertices, Muto::Renderer2DData::QuadVertexBufferBase, Muto::Application::ResolvePath(), Muto::s_Data, Muto::SDT_Float, Muto::SDT_Float2, Muto::SDT_Float3, and Muto::SDT_Float4.
Referenced by Muto::Renderer::Init().
|
static |
Resets the rendering statistics.
References Muto::s_Data, and Muto::Renderer2DData::Stats.
Referenced by Sandbox2D::OnUpdate(), and Muto::EditorLayer::OnUpdate().
|
static |
Shuts down the 2D renderer.
References Muto::Renderer2DData::QuadVertexBufferBase, and Muto::s_Data.
|
staticprivate |
References Muto::Renderer2DData::QuadIndexCount, Muto::Renderer2DData::QuadVertexBufferBase, Muto::Renderer2DData::QuadVertexBufferPtr, Muto::s_Data, and Muto::Renderer2DData::TextureSlotIndex.
Referenced by BeginScene(), BeginScene(), BeginScene(), and FlushAndReset().