2D drawable component for rendering rectangle.
More...
#include <rectangle_2d.hpp>
Inherits rendering_engine::Drawable2D.
2D drawable component for rendering rectangle.
- Note
- Not copyable or assignable.
- See also
- Sprite2D, Quad2D, Drawable2D, DrawableComponent, SceneComponent2D, Camera2D
Definition at line 21 of file rectangle_2d.hpp.
◆ Rectangle2D() [1/2]
Constructs the Rectangle2D with a render context.
- Parameters
-
| renderContext | Resource context. |
Definition at line 7 of file rectangle_2D.cpp.
8 :
11{}
Drawable2D(RenderResourceContext renderContext, Scene &scene)
Constructs the Drawable2D with a resource context.
◆ Rectangle2D() [2/2]
| rendering_engine::Rectangle2D::Rectangle2D |
( |
const Rectangle2D & |
rhs | ) |
|
|
delete |
◆ Draw()
| void rendering_engine::Rectangle2D::Draw |
( |
const Camera2D & |
camera | ) |
|
|
overridevirtual |
Submits this quad to the renderer for drawing.
Implements rendering_engine::Drawable2D.
Definition at line 31 of file rectangle_2D.cpp.
32{
33 Transformations2D transformations;
35 transformations.view = camera.GetWorldView();
36 transformations.proj = camera.GetProjectionMatrix();
37
39 {
40 renderBatch.renderResources->SubmitResources(transformations, renderBatch.materialParameters);
41 }
42}
SceneComponent2D & GetTransform()
Access to the underlying SceneComponent2D (transform).
std::vector< RenderBatch > mRenderBatches
const glm::mat4 & GetWorldMatrix()
Returns the world transformation matrix.
◆ Initialize()
| void rendering_engine::Rectangle2D::Initialize |
( |
| ) |
|
|
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 13 of file rectangle_2D.cpp.
14{
15 const std::string meshName = "Quad2D";
16 const std::string materialName = "Rectangle2D";
17
19
21
24}
void Initialize() override
Initializes render resources.
void SetScale(const glm::vec2 &scale)
Sets the quad scale along each axis.
void AddRenderBatch(std::string meshName, std::string materialName)
void SetColor(glm::vec4 color)
Sets color.
◆ operator=()
◆ SetColor()
| void rendering_engine::Rectangle2D::SetColor |
( |
glm::vec4 |
color | ) |
|
Sets color.
- Parameters
-
Definition at line 44 of file rectangle_2D.cpp.
45{
47 {
48 renderBatch.materialParameters.SetMaterialVec4("Color", color);
49 }
50}
◆ Update()
| void rendering_engine::Rectangle2D::Update |
( |
float |
deltaTime | ) |
|
|
overridevirtual |
Updates logic (animation, movement, etc.) for this drawable.
- Parameters
-
| deltaTime | Time step (seconds). |
Reimplemented from rendering_engine::Drawable2D.
Definition at line 26 of file rectangle_2D.cpp.
27{
29}
void Update(float deltaTime) override
Updates model matrix (and any other logic).
◆ mProperties
| Properties rendering_engine::Rectangle2D::mProperties |
|
protected |
The documentation for this class was generated from the following files: