|
Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine. GitHub | Vesper Updates | Creator |
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 | Init () |
| Initializes the 2D renderer. | |
| static void | Shutdown () |
| Shuts down the 2D renderer. | |
| 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 | EndScene () |
| Ends the current scene. | |
| static void | Flush () |
| Flushes the current batch of rendering commands. | |
| 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::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::vec3 &position, const glm::vec2 &size, const glm::vec4 &color) |
| Draws a colored quad at the specified position and size. | |
| static void | DrawQuadWithTexture (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 | DrawQuadWithTexture (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 | DrawQuadWithTexture (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 | DrawQuadWithTexture (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 | DrawQuadWithTexture (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 | DrawQuadWithTexture (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 | DrawQuadRotated (const glm::mat4 &transform, const glm::vec4 &color) |
| Draws a rotated colored quad with the given transform and color. | |
| static void | DrawQuadRotated (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 | DrawQuadRotated (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 | DrawQuadRotatedWithTexture (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 | DrawQuadRotatedWithTexture (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 | DrawQuadRotatedWithTexture (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 | DrawQuadRotatedWithTexture (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 | DrawQuadRotatedWithTexture (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 | DrawQuadRotatedWithTexture (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 Ref< Texture2D > | GetWhiteTexture () |
| Returns a reference to the default white texture that allows for coloring. | |
| static void | ResetStats () |
| Resets the rendering statistics. | |
| static Statistics | GetStats () |
| Retrieves the current rendering statistics. | |
Static Private Member Functions | |
| static void | FlushAndReset () |
| static void | StartBatch () |
A 2D renderer for drawing quads and sprites.
|
static |
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 Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferBase, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, and Vesper::Renderer2DData::TextureSlotIndex.
|
static |
Begins a new scene with the given editor camera.
| camera | The editor camera to use for the scene. |
References Vesper::s_Data, and StartBatch().
Referenced by Vesper::Scene::OnUpdateEditor().
|
static |
Begins a new scene with the given orthographic camera.
| camera | The orthographic camera to use for the scene. |
References Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferBase, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, and Vesper::Renderer2DData::TextureSlotIndex.
|
static |
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(), Vesper::Renderer2DData::MaxIndices, Vesper::Renderer2D::Statistics::QuadCount, Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, Vesper::Renderer2DData::Stats, Vesper::QuadVertex::TexIndex, and Vesper::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 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 rotated colored quad with the given transform and color.
| transform | The transform matrix for the quad. |
| color | The color of the quad. |
References FlushAndReset(), Vesper::Renderer2DData::MaxIndices, Vesper::Renderer2D::Statistics::QuadCount, Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, Vesper::Renderer2DData::Stats, Vesper::QuadVertex::TexIndex, and Vesper::QuadVertex::TilingFactor.
|
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 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 |
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(), Vesper::Renderer2DData::MaxIndices, Vesper::Renderer2DData::MaxTextureSlots, Vesper::Renderer2D::Statistics::QuadCount, Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, Vesper::Renderer2DData::Stats, Vesper::QuadVertex::TexIndex, Vesper::Renderer2DData::TextureSlotIndex, and Vesper::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(), Vesper::Renderer2DData::MaxIndices, Vesper::Renderer2DData::MaxTextureSlots, Vesper::Renderer2D::Statistics::QuadCount, Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, Vesper::Renderer2DData::Stats, Vesper::QuadVertex::TexIndex, Vesper::Renderer2DData::TextureSlotIndex, and Vesper::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 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 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(), Vesper::Renderer2DData::MaxIndices, Vesper::Renderer2DData::MaxTextureSlots, Vesper::Renderer2D::Statistics::QuadCount, Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, Vesper::Renderer2DData::Stats, Vesper::QuadVertex::TexIndex, Vesper::Renderer2DData::TextureSlotIndex, and Vesper::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(), Vesper::Renderer2DData::MaxIndices, Vesper::Renderer2DData::MaxTextureSlots, Vesper::Renderer2D::Statistics::QuadCount, Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, Vesper::Renderer2DData::Stats, Vesper::QuadVertex::TexIndex, Vesper::Renderer2DData::TextureSlotIndex, and Vesper::QuadVertex::TilingFactor.
|
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 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 |
Ends the current scene.
References Flush(), Vesper::Renderer2DData::QuadVertexBufferBase, Vesper::Renderer2DData::QuadVertexBufferPtr, and Vesper::s_Data.
Referenced by FlushAndReset(), Vesper::EditorLayer::OnUpdate(), Vesper::Scene::OnUpdateEditor(), and Vesper::Scene::OnUpdateRuntime().
|
static |
Flushes the current batch of rendering commands.
References Vesper::Renderer2D::Statistics::DrawCalls, Vesper::Renderer2DData::QuadIndexCount, Vesper::s_Data, Vesper::Renderer2DData::Stats, and Vesper::Renderer2DData::TextureSlotIndex.
Referenced by EndScene().
|
staticprivate |
References EndScene(), Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferBase, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, and Vesper::Renderer2DData::TextureSlotIndex.
Referenced by DrawQuad(), DrawQuadRotated(), DrawQuadRotatedWithTexture(), DrawQuadRotatedWithTexture(), DrawQuadWithTexture(), and DrawQuadWithTexture().
|
static |
Retrieves the current rendering statistics.
References Vesper::s_Data, and Vesper::Renderer2DData::Stats.
Referenced by Vesper::EditorLayer::OnImGuiRender().
Returns a reference to the default white texture that allows for coloring.
References Vesper::s_Data.
|
static |
Initializes the 2D renderer.
References Vesper::Float, Vesper::Float2, Vesper::Float3, Vesper::Float4, Vesper::Renderer2DData::MaxIndices, Vesper::Renderer2DData::MaxTextureSlots, Vesper::Renderer2DData::MaxVertices, Vesper::Renderer2DData::QuadVertexBufferBase, and Vesper::s_Data.
Referenced by Vesper::Renderer::Init().
|
static |
Resets the rendering statistics.
References Vesper::s_Data, and Vesper::Renderer2DData::Stats.
Referenced by Vesper::EditorLayer::OnUpdate().
|
static |
Shuts down the 2D renderer.
References Vesper::Renderer2DData::QuadVertexBufferBase, and Vesper::s_Data.
|
staticprivate |
References Vesper::Renderer2DData::QuadIndexCount, Vesper::Renderer2DData::QuadVertexBufferBase, Vesper::Renderer2DData::QuadVertexBufferPtr, Vesper::s_Data, and Vesper::Renderer2DData::TextureSlotIndex.
Referenced by BeginScene().