![]() |
Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
|
2D drawable component for rendering textured quad. More...
#include <sprite_2d.hpp>
Inherits rendering_engine::Drawable2D.
Public Member Functions | |
| Sprite2D (RenderResourceContext renderContext, Scene &scene, std::string textureName) | |
| Constructs the Sprite2D with a render context. More... | |
| void | Initialize () override |
| Initializes render resource pointers (material, mesh, etc.). Must be called after setting material and mesh names. More... | |
| void | Update (float deltaTime) override |
| Updates logic (animation, movement, etc.) for this drawable. More... | |
| void | Draw (const Camera2D &camera) override |
| Submits this quad to the renderer for drawing. More... | |
| void | SetSpriteScale (float scale) |
| Sets a uniform scale relative to the sprite's texture size. More... | |
| Sprite2D (const Sprite2D &rhs)=delete | |
| Sprite2D & | operator= (const Sprite2D &rhs)=delete |
Public Member Functions inherited from rendering_engine::Drawable2D | |
| 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 | |
| std::string | mTextureName |
| glm::vec2 | mTextureRespectiveScale |
Protected Attributes inherited from rendering_engine::Drawable2D | |
| 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 textured quad.
Definition at line 21 of file sprite_2d.hpp.
| rendering_engine::Sprite2D::Sprite2D | ( | RenderResourceContext | renderContext, |
| Scene & | scene, | ||
| std::string | textureName | ||
| ) |
Constructs the Sprite2D with a render context.
| renderContext | Resource context. |
Definition at line 15 of file sprite_2d.cpp.
|
delete |
|
overridevirtual |
Submits this quad to the renderer for drawing.
Implements rendering_engine::Drawable2D.
Definition at line 62 of file sprite_2d.cpp.
|
overridevirtual |
Initializes render resource pointers (material, mesh, etc.). Must be called after setting material and mesh names.
Reimplemented from rendering_engine::Drawable2D.
Definition at line 21 of file sprite_2d.cpp.
| void rendering_engine::Sprite2D::SetSpriteScale | ( | float | scale | ) |
Sets a uniform scale relative to the sprite's texture size.
The scale factor is applied to the original texture dimensions, allowing convenient uniform resizing of the sprite.
| scale | Uniform scale factor (1.0 = original texture size). |
Definition at line 75 of file sprite_2d.cpp.
|
overridevirtual |
Updates logic (animation, movement, etc.) for this drawable.
| deltaTime | Time step (seconds). |
Reimplemented from rendering_engine::Drawable2D.
Definition at line 57 of file sprite_2d.cpp.
|
protected |
Definition at line 60 of file sprite_2d.hpp.
|
protected |
Definition at line 61 of file sprite_2d.hpp.