![]() |
Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
|
2D drawable component for rendering objects in 2D space. More...
#include <drawable_2d.hpp>
Inherits rendering_engine::DrawableComponent.
Inherited by rendering_engine::Quad2D, rendering_engine::Rectangle2D, rendering_engine::Sprite2D, and rendering_engine::TextBlock2D.
Public Member Functions | |
| Drawable2D (RenderResourceContext renderContext, Scene &scene) | |
| Constructs the Drawable2D with a resource context. More... | |
| void | Initialize () override |
| Initializes render resources. More... | |
| void | Update (float deltaTime) override |
| Updates model matrix (and any other logic). More... | |
| virtual void | Draw (const Camera2D &camera)=0 |
| Submits this quad to the renderer for drawing. More... | |
| void | SetPosition (const glm::vec2 &position) |
| Sets the quad position in 2D space. More... | |
| void | SetRotation (float angleDegrees) |
| Sets the quad rotation. More... | |
| void | SetScale (const glm::vec2 &scale) |
| Sets the quad scale along each axis. More... | |
| const glm::vec2 & | GetPosition () const |
| Gets the quad position. More... | |
| float | GetRotation () const |
| Gets the quad rotation angle (degrees). More... | |
| const glm::vec2 & | GetScale () const |
| Gets the quad scale. More... | |
| SceneComponent2D & | GetTransform () |
| Access to the underlying SceneComponent2D (transform). More... | |
| const SceneComponent2D & | GetTransform () const |
| void | Destroy () override |
| Requests destruction of this drawable. More... | |
Public Member Functions inherited from rendering_engine::DrawableComponent | |
| DrawableComponent (RenderResourceContext renderContext, Scene &scene) | |
| Constructs the DrawableComponent with a resource context. More... | |
| virtual | ~DrawableComponent ()=default |
| Virtual destructor. More... | |
| virtual void | Initialize () |
| Initializes render resource pointers (material, mesh, etc.). Must be called after setting material and mesh names. More... | |
| virtual void | Update (float deltaTime)=0 |
| Updates logic (animation, movement, etc.) for this drawable. More... | |
| virtual void | Shutdown () |
| Releases all render resources owned by this drawable. More... | |
| virtual void | Destroy () |
| Requests destruction of this drawable. More... | |
| void | UpdateOnTick (bool in) |
| DrawableComponent (const DrawableComponent &)=delete | |
| DrawableComponent & | operator= (const DrawableComponent &)=delete |
Protected Attributes | |
| SceneComponent2D | mSceneComponent |
Protected Attributes inherited from rendering_engine::DrawableComponent | |
| RenderResourceContext | mRenderContext |
| Scene & | mScene |
| std::vector< RenderBatch > | mRenderBatches |
| bool | bUpdateOnTick |
Additional Inherited Members | |
Protected Member Functions inherited from rendering_engine::DrawableComponent | |
| void | AddRenderBatch (std::string meshName, std::string materialName) |
2D drawable component for rendering objects in 2D space.
Encapsulates a 2D transform (SceneComponent2D). Provides per-frame update, transform access, and render submission.
Definition at line 26 of file drawable_2d.hpp.
| rendering_engine::Drawable2D::Drawable2D | ( | RenderResourceContext | renderContext, |
| Scene & | scene | ||
| ) |
Constructs the Drawable2D with a resource context.
| renderContext | Rendering resource context (renderer, caches). |
Definition at line 7 of file drawable_2d.cpp.
|
overridevirtual |
Requests destruction of this drawable.
Schedules the drawable for deferred removal via the owning Scene. The drawable is not destroyed immediately; actual cleanup is performed at a safe point during the Scene update cycle.
Reimplemented from rendering_engine::DrawableComponent.
Definition at line 65 of file drawable_2d.cpp.
|
pure virtual |
Submits this quad to the renderer for drawing.
Implemented in rendering_engine::Quad2D, rendering_engine::Rectangle2D, rendering_engine::Sprite2D, and rendering_engine::TextBlock2D.
| const glm::vec2 & rendering_engine::Drawable2D::GetPosition | ( | ) | const |
Gets the quad position.
Definition at line 40 of file drawable_2d.cpp.
| float rendering_engine::Drawable2D::GetRotation | ( | ) | const |
Gets the quad rotation angle (degrees).
Definition at line 45 of file drawable_2d.cpp.
| const glm::vec2 & rendering_engine::Drawable2D::GetScale | ( | ) | const |
Gets the quad scale.
Definition at line 50 of file drawable_2d.cpp.
| SceneComponent2D & rendering_engine::Drawable2D::GetTransform | ( | ) |
Access to the underlying SceneComponent2D (transform).
Definition at line 55 of file drawable_2d.cpp.
| const SceneComponent2D & rendering_engine::Drawable2D::GetTransform | ( | ) | const |
Definition at line 60 of file drawable_2d.cpp.
|
overridevirtual |
Initializes render resources.
Reimplemented from rendering_engine::DrawableComponent.
Reimplemented in rendering_engine::Quad2D, rendering_engine::Rectangle2D, rendering_engine::Sprite2D, and rendering_engine::TextBlock2D.
Definition at line 12 of file drawable_2d.cpp.
| void rendering_engine::Drawable2D::SetPosition | ( | const glm::vec2 & | position | ) |
Sets the quad position in 2D space.
| position | New position vector (x, y). |
Definition at line 25 of file drawable_2d.cpp.
| void rendering_engine::Drawable2D::SetRotation | ( | float | angleDegrees | ) |
Sets the quad rotation.
| angleDegrees | Rotation angle in degrees (counterclockwise). |
Definition at line 30 of file drawable_2d.cpp.
| void rendering_engine::Drawable2D::SetScale | ( | const glm::vec2 & | scale | ) |
Sets the quad scale along each axis.
| scale | New scale vector (x, y). |
Definition at line 35 of file drawable_2d.cpp.
|
overridevirtual |
Updates model matrix (and any other logic).
| deltaTime | Time step (seconds). |
Implements rendering_engine::DrawableComponent.
Reimplemented in rendering_engine::Quad2D, rendering_engine::Rectangle2D, rendering_engine::Sprite2D, and rendering_engine::TextBlock2D.
Definition at line 17 of file drawable_2d.cpp.
|
protected |
Definition at line 97 of file drawable_2d.hpp.