Rendering Engine
0.2.9
Modular Graphics Rendering Engine | v0.2.9
drawable_2d.hpp
Go to the documentation of this file.
1
// This file is part of the Rendering Engine project.
2
// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3
// Copyright (c) 2026 Alexander Obzherin
4
// Distributed under the terms of the zlib License. See LICENSE.md for details.
5
6
#pragma once
7
8
#include "
rendering_engine_export.hpp
"
9
#include "
drawable_component.hpp
"
10
#include "
scene_component_2d.hpp
"
11
12
namespace
rendering_engine
13
{
14
class
RE_API
Camera2D
;
15
16
/**
17
* @class Drawable2D
18
* @brief 2D drawable component for rendering objects in 2D space.
19
*
20
* Encapsulates a 2D transform (SceneComponent2D).
21
* Provides per-frame update, transform access, and render submission.
22
*
23
* @note Not copyable or assignable.
24
* @see DrawableComponent, SceneComponent2D, Camera2D
25
*/
26
class
RE_API
Drawable2D
:
public
DrawableComponent
27
{
28
public
:
29
/**
30
* @brief Constructs the Drawable2D with a resource context.
31
* @param renderContext Rendering resource context (renderer, caches).
32
*/
33
Drawable2D
(
RenderResourceContext
renderContext,
Scene
& scene);
34
35
/**
36
* @brief Initializes render resources.
37
*/
38
void
Initialize()
override
;
39
40
/**
41
* @brief Updates model matrix (and any other logic).
42
* @param deltaTime Time step (seconds).
43
*/
44
void
Update(
float
deltaTime)
override
;
45
46
/**
47
* @brief Submits this quad to the renderer for drawing.
48
*/
49
virtual
void
Draw
(
const
Camera2D
& camera) = 0;
50
51
/**
52
* @brief Sets the quad position in 2D space.
53
* @param position New position vector (x, y).
54
*/
55
void
SetPosition(
const
glm::vec2& position);
56
57
/**
58
* @brief Sets the quad rotation.
59
* @param angleDegrees Rotation angle in degrees (counterclockwise).
60
*/
61
void
SetRotation(
float
angleDegrees);
62
63
/**
64
* @brief Sets the quad scale along each axis.
65
* @param scale New scale vector (x, y).
66
*/
67
void
SetScale(
const
glm::vec2& scale);
68
69
/**
70
* @brief Gets the quad position.
71
*/
72
const
glm::vec2& GetPosition()
const
;
73
74
/**
75
* @brief Gets the quad rotation angle (degrees).
76
*/
77
float
GetRotation()
const
;
78
79
/**
80
* @brief Gets the quad scale.
81
*/
82
const
glm::vec2& GetScale()
const
;
83
84
/**
85
* @brief Access to the underlying SceneComponent2D (transform).
86
*/
87
SceneComponent2D
& GetTransform();
88
const
SceneComponent2D
& GetTransform()
const
;
89
///@}
90
91
/**
92
* @copydoc DrawableComponent::Destroy
93
*/
94
void
Destroy()
override
;
95
96
protected
:
97
SceneComponent2D
mSceneComponent
;
98
};
99
100
}
// namespace rendering_engine
rendering_engine::Camera2D
Represents a 2D camera with position, rotation, and zoom control.
Definition:
camera_2d.hpp:36
rendering_engine::Drawable2D
2D drawable component for rendering objects in 2D space.
Definition:
drawable_2d.hpp:27
rendering_engine::Drawable2D::mSceneComponent
SceneComponent2D mSceneComponent
Definition:
drawable_2d.hpp:97
rendering_engine::Drawable2D::Draw
virtual void Draw(const Camera2D &camera)=0
Submits this quad to the renderer for drawing.
rendering_engine::DrawableComponent
Abstract base for all drawable (renderable) objects in the engine.
Definition:
drawable_component.hpp:48
rendering_engine::SceneComponent2D
Represents a hierarchical 2D transform component.
Definition:
scene_component_2d.hpp:52
rendering_engine::Scene
Base class representing a renderable scene.
Definition:
scene.hpp:44
drawable_component.hpp
rendering_engine
Definition:
actor.hpp:13
rendering_engine_export.hpp
RE_API
#define RE_API
Definition:
rendering_engine_export.hpp:10
scene_component_2d.hpp
rendering_engine::RenderResourceContext
Aggregates pointers to global rendering resource managers.
Definition:
render_resource_context.hpp:26
RenderingEngine
RenderingLibrary
Include
drawable_2d.hpp
Generated by
1.9.4