Class Renderer2D#
Defined in File Renderer2D.h
Nested Relationships#
Nested Types#
Class Documentation#
-
class Renderer2D#
Public Static Functions
-
static void Init()#
Initialize Renderer2D.
-
static void Shutdown()#
Shutdown Renderer2D.
-
static void Reset() noexcept#
Reset the Renderer2D for a new frame.
Note
This functions gets called by TRAP::Application
-
static void BeginScene(const Camera &camera, const Math::Mat4 &transform)#
Begin a Renderer2D scene.
- Parameters:
camera – Main camera.
transform – Camera transform.
-
static void BeginScene(const OrthographicCamera &camera)#
Begin a Renderer2D scene.
- Parameters:
camera – Orthographic camera.
-
static void BeginScene(const EditorCamera &camera)#
Begin a Renderer2D scene.
Remark
Headless mode: This function is not available in headless mode.
- Parameters:
camera – Editor camera.
-
static void EndScene()#
End a running Renderer2D scene.
-
static void SetCustomSampler(const TRAP::Ref<TRAP::Graphics::Sampler> &sampler)#
Set a custom sampler to use by the 2D renderer.
- Parameters:
sampler – Sampler to use.
-
static void DrawQuad(const Transform &transform, const Math::Vec4 &color)#
Draw a colored quad.
- Parameters:
transform – Transform of the quad.
color – Color for the quad.
-
static void DrawQuad(const Transform &transform, const Ref<Texture> &texture)#
Draw a textured quad.
-
static void DrawQuad(const Transform &transform, const Math::Vec4 &color, const Ref<Texture> &texture)#
Draw a colored and textured quad.
-
static void DrawQuad(const Transform &transform, const TRAP::Ref<SubTexture2D> &texture)#
Draw a textured quad.
-
static void DrawQuad(const Transform &transform, const Math::Vec4 &color, const TRAP::Ref<SubTexture2D> &texture)#
Draw a colored and textured quad.
-
static void DrawQuad(const TRAP::Math::Mat4 &transform, const Math::Vec4 &color, const Ref<Texture> &texture, const std::array<Math::Vec2, 4> *texCoords, i32 entityID = -1)#
Draw a colored and textured quad. This is the base function for all the other DrawQuad functions.
-
static void DrawCircle(const TRAP::Math::Mat4 &transform, const Math::Vec4 &color, f32 thickness = 1.0f, f32 fade = 0.005f, i32 entityID = -1)#
Draw a colored circle with given thickness and fading. This is the base function for all the other DrawCircle functions.
-
static void DrawSprite(const TRAP::Math::Mat4 &transform, const SpriteRendererComponent &sprite, i32 entityID = -1)#
Draw a sprite.
-
static void DrawLine(const TRAP::Math::Vec3 &p0, const TRAP::Math::Vec3 &p1, const TRAP::Math::Vec4 &color, i32 entityID = -1)#
Draw a colored line from point p0 to point p1.
- Parameters:
p0 – First point of the line.
p1 – Second point of the line.
color – Color for the line.
entityID – Entity ID of this line.
-
static void DrawRect(const TRAP::Math::Vec3 &position, const TRAP::Math::Vec2 &size, const TRAP::Math::Vec4 &color, i32 entityID = -1)#
Draw a rectangle (not filled).
- Parameters:
position – Position of the rectangle.
size – Size of the rectangle.
color – Color for the rectangle.
entityID – Entity ID of this rectangle.
-
static void DrawRect(const TRAP::Math::Mat4 &transform, const TRAP::Math::Vec4 &color, i32 entityID = -1)#
Draw a rectangle (not filled).
- Parameters:
transform – Transformation of the rectangle.
color – Color for the rectangle.
entityID – Entity ID of this rectangle.
-
static Statistics GetStats() noexcept#
Retrieve the current Renderer2D statistics.
- Returns:
Renderer2D statistics.
-
static void ResetStats() noexcept#
Reset the Renderer2D statistics.
-
struct Statistics#
-
struct Transform#
Struct to describe position, rotation and scale.
-
static void Init()#