Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
drawable_3d.hpp
Go to the documentation of this file.
1// This file is part of the Rendering Engine project.
2// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3// Copyright (c) 2025 Alexander Obzherin
4// Distributed under the terms of the zlib License. See LICENSE.md for details.
5
6#pragma once
7
10#include "scene_component.hpp"
11
12namespace rendering_engine
13{
14class Camera;
15
16/**
17 * @class Drawable3D
18 * @brief 3D drawable component for rendering objects in 3D space.
19 *
20 * Encapsulates a transform (SceneComponent).
21 * Provides per-frame update, world transform access, and render submission.
22 *
23 * @note Not copyable or assignable.
24 * @see DrawableComponent, SceneComponent, Camera
25 */
27{
28public:
29 /**
30 * @brief Constructs the Drawable3D with a render context.
31 * @param renderContext Resource context.
32 */
33 Drawable3D(RenderResourceContext renderContext);
34
35 /**
36 * @copydoc DrawableComponent::Initialize
37 */
38 void Initialize() override;
39
40 /**
41 * @copydoc DrawableComponent::Update
42 */
43 void Update(float deltaTime) override;
44
45 /**
46 * @brief Submits this mesh to the renderer for drawing.
47 */
48 virtual void Draw(const Camera& camera) = 0;
49
50 /**
51 * @brief Sets the mesh position in world space.
52 * @param position New position vector (x, y, z).
53 */
54 void SetPosition(const glm::vec3& position);
55
56 /**
57 * @brief Sets the mesh rotation in degrees.
58 * @param rotation New rotation vector (pitch, yaw, roll), in degrees.
59 */
60 void SetRotation(const glm::vec3& rotation);
61
62 /**
63 * @brief Sets the mesh scale along each axis.
64 * @param scale New scale vector (x, y, z).
65 */
66 void SetScale(const glm::vec3& scale);
67
68 /**
69 * @brief Gets the mesh position.
70 */
71 const glm::vec3& GetPosition() const;
72
73 /**
74 * @brief Gets the mesh rotation (pitch, yaw, roll in degrees).
75 */
76 const glm::vec3& GetRotation() const;
77
78 /**
79 * @brief Gets the mesh scale.
80 */
81 const glm::vec3& GetScale() const;
82
83 /**
84 * @brief Access to the underlying SceneComponent (transform).
85 */
87 const SceneComponent& GetTransform() const;
88 ///@}
89
90 Drawable3D(const Drawable3D& rhs) = delete;
91 Drawable3D& operator=(const Drawable3D& rhs) = delete;
92
93protected:
95};
96
97} // namespace rendering_engine
Represents a 3D perspective camera with world transform and projection settings.
Definition camera.hpp:48
void Initialize() override
Initializes render resource pointers (material, mesh, etc.). Must be called after setting material an...
const glm::vec3 & GetRotation() const
Gets the mesh rotation (pitch, yaw, roll in degrees).
SceneComponent & GetTransform()
Access to the underlying SceneComponent (transform).
const glm::vec3 & GetScale() const
Gets the mesh scale.
Drawable3D(const Drawable3D &rhs)=delete
Drawable3D(RenderResourceContext renderContext)
Constructs the Drawable3D with a render context.
void SetRotation(const glm::vec3 &rotation)
Sets the mesh rotation in degrees.
Drawable3D & operator=(const Drawable3D &rhs)=delete
void SetScale(const glm::vec3 &scale)
Sets the mesh scale along each axis.
virtual void Draw(const Camera &camera)=0
Submits this mesh to the renderer for drawing.
void SetPosition(const glm::vec3 &position)
Sets the mesh position in world space.
const glm::vec3 & GetPosition() const
Gets the mesh position.
void Update(float deltaTime) override
Updates logic (animation, movement, etc.) for this drawable.
DrawableComponent(RenderResourceContext renderContext)
Constructs the DrawableComponent with a resource context.
Represents a 3D transformable scene component with position, rotation, and scale.
#define RE_API
Aggregates pointers to global rendering resource managers.