Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
quad_2d.cpp
Go to the documentation of this file.
1#include "quad_2d.hpp"
2#include "camera_2d.hpp"
5
6namespace rendering_engine
7{
8
10 :
11 Drawable2D(renderContext)
12{}
13
18
19void Quad2D::Update(float deltaTime)
20{
21 Drawable2D::Update(deltaTime);
22}
23
24void Quad2D::Draw(const Camera2D& camera)
25{
26 Transformations2D transformations;
27 transformations.model = GetTransform().GetModelMatrix();
28 transformations.view = camera.GetWorldView();
29 transformations.proj = camera.GetProjectionMatrix();
30
31 mRenderResources->SubmitResources(transformations, mMaterialParameters);
32}
33
34} // namespace rendering_engine
Represents a 2D camera with position, rotation, and zoom control.
Definition camera_2d.hpp:36
glm::mat4 GetProjectionMatrix() const
Returns the current orthographic projection matrix.
Definition camera_2d.cpp:30
const glm::mat4 & GetWorldView() const
Gets the world-view (model) matrix for the camera.
Definition camera_2d.cpp:87
SceneComponent2D & GetTransform()
Access to the underlying SceneComponent2D (transform).
Drawable2D(RenderResourceContext renderContext)
Constructs the Drawable2D with a resource context.
void Update(float deltaTime) override
Updates model matrix (and any other logic).
void Initialize() override
Initializes render resources.
std::unique_ptr< IRenderResources > mRenderResources
void Initialize() override
Initializes render resource pointers (material, mesh, etc.). Must be called after setting material an...
Definition quad_2d.cpp:14
void Update(float deltaTime) override
Updates logic (animation, movement, etc.) for this drawable.
Definition quad_2d.cpp:19
Quad2D(RenderResourceContext renderContext)
Constructs the Quad2D with a render context.
Definition quad_2d.cpp:9
void Draw(const Camera2D &camera) override
Submits this quad to the renderer for drawing.
Definition quad_2d.cpp:24
const glm::mat4 & GetModelMatrix() const
Gets the model matrix for this component.
Aggregates pointers to global rendering resource managers.
Contains transformation matrices for 2D rendering.
glm::mat4 view
View (camera) transformation matrix.
glm::mat4 proj
Projection transformation matrix.
glm::mat4 model
Model transformation matrix.