Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
drawable_2d.cpp
Go to the documentation of this file.
1#include "drawable_2d.hpp"
3#include "scene.hpp"
4
5namespace rendering_engine
6{
8 :
9 DrawableComponent(renderContext, scene)
10{}
11
13{
15}
16
17void Drawable2D::Update(float deltaTime)
18{
19 if (bUpdateOnTick)
20 {
22 }
23}
24
25void Drawable2D::SetPosition(const glm::vec2& position)
26{
28}
29
30void Drawable2D::SetRotation(float angleDegrees)
31{
32 mSceneComponent.SetRotation(angleDegrees);
33}
34
35void Drawable2D::SetScale(const glm::vec2& scale)
36{
38}
39
40const glm::vec2& Drawable2D::GetPosition() const
41{
43}
44
46{
48}
49
50const glm::vec2& Drawable2D::GetScale() const
51{
53}
54
56{
57 return mSceneComponent;
58}
59
61{
62 return mSceneComponent;
63}
64
66{
68}
69
70} // namespace rendering_engine
SceneComponent2D & GetTransform()
Access to the underlying SceneComponent2D (transform).
Definition: drawable_2d.cpp:55
const glm::vec2 & GetScale() const
Gets the quad scale.
Definition: drawable_2d.cpp:50
void Update(float deltaTime) override
Updates model matrix (and any other logic).
Definition: drawable_2d.cpp:17
SceneComponent2D mSceneComponent
Definition: drawable_2d.hpp:97
void Initialize() override
Initializes render resources.
Definition: drawable_2d.cpp:12
void Destroy() override
Requests destruction of this drawable.
Definition: drawable_2d.cpp:65
float GetRotation() const
Gets the quad rotation angle (degrees).
Definition: drawable_2d.cpp:45
void SetPosition(const glm::vec2 &position)
Sets the quad position in 2D space.
Definition: drawable_2d.cpp:25
void SetRotation(float angleDegrees)
Sets the quad rotation.
Definition: drawable_2d.cpp:30
Drawable2D(RenderResourceContext renderContext, Scene &scene)
Constructs the Drawable2D with a resource context.
Definition: drawable_2d.cpp:7
void SetScale(const glm::vec2 &scale)
Sets the quad scale along each axis.
Definition: drawable_2d.cpp:35
const glm::vec2 & GetPosition() const
Gets the quad position.
Definition: drawable_2d.cpp:40
Abstract base for all drawable (renderable) objects in the engine.
virtual void Initialize()
Initializes render resource pointers (material, mesh, etc.). Must be called after setting material an...
Represents a hierarchical 2D transform component.
const glm::vec2 & GetScale() const
Gets the current scale.
void UpdateWorldMatrix()
Recomputes the world transformation matrix.
const glm::vec2 & GetPosition() const
Gets the current position.
void SetScale(const glm::vec2 &scale)
Sets the scale in each dimension.
float GetRotation() const
Gets the current rotation angle (in degrees).
void SetRotation(float angleDegrees)
Sets the rotation angle in degrees.
void SetPosition(const glm::vec2 &position)
Sets the local position of this component.
Base class representing a renderable scene.
Definition: scene.hpp:44
void DestroyDrawable2D(Drawable2D *drawable2D)
Schedules a 2D drawable for deferred destruction.
Definition: scene.cpp:154
Aggregates pointers to global rendering resource managers.