Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
rendering_engine::Drawable3D Class Referenceabstract

3D drawable component for rendering objects in 3D space. More...

#include <drawable_3d.hpp>

Inherits rendering_engine::DrawableComponent.

Inherited by rendering_engine::StaticMesh.

Public Member Functions

 Drawable3D (RenderResourceContext renderContext, Scene &scene)
 Constructs the Drawable3D 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...
 
virtual void Draw (const Camera &camera)=0
 Submits this mesh to the renderer for drawing. More...
 
void SetPosition (const glm::vec3 &position)
 Sets the mesh position in world space. More...
 
void SetRotation (const glm::vec3 &rotation)
 Sets the mesh rotation in degrees. More...
 
void SetScale (const glm::vec3 &scale)
 Sets the mesh scale along each axis. More...
 
const glm::vec3 & GetPosition () const
 Gets the mesh position. More...
 
const glm::vec3 & GetRotation () const
 Gets the mesh rotation (pitch, yaw, roll in degrees). More...
 
const glm::vec3 & GetScale () const
 Gets the mesh scale. More...
 
SceneComponentGetTransform ()
 Access to the underlying SceneComponent (transform). More...
 
const SceneComponentGetTransform () const
 
void Destroy () override
 Requests destruction of this drawable. More...
 
 Drawable3D (const Drawable3D &rhs)=delete
 
Drawable3Doperator= (const Drawable3D &rhs)=delete
 
- 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
 
DrawableComponentoperator= (const DrawableComponent &)=delete
 

Protected Attributes

SceneComponent mSceneComponent
 
- Protected Attributes inherited from rendering_engine::DrawableComponent
RenderResourceContext mRenderContext
 
ScenemScene
 
std::vector< RenderBatchmRenderBatches
 
bool bUpdateOnTick
 

Additional Inherited Members

- Protected Member Functions inherited from rendering_engine::DrawableComponent
void AddRenderBatch (std::string meshName, std::string materialName)
 

Detailed Description

3D drawable component for rendering objects in 3D space.

Encapsulates a transform (SceneComponent). Provides per-frame update, world transform access, and render submission.

Note
Not copyable or assignable.
See also
DrawableComponent, SceneComponent, Camera

Definition at line 26 of file drawable_3d.hpp.

Constructor & Destructor Documentation

◆ Drawable3D() [1/2]

rendering_engine::Drawable3D::Drawable3D ( RenderResourceContext  renderContext,
Scene scene 
)

Constructs the Drawable3D with a render context.

Parameters
renderContextResource context.

Definition at line 7 of file drawable_3d.cpp.

7 :
8 DrawableComponent(renderContext, scene)
9{}
DrawableComponent(RenderResourceContext renderContext, Scene &scene)
Constructs the DrawableComponent with a resource context.

◆ Drawable3D() [2/2]

rendering_engine::Drawable3D::Drawable3D ( const Drawable3D rhs)
delete

Member Function Documentation

◆ Destroy()

void rendering_engine::Drawable3D::Destroy ( )
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.

Note
This function must be used instead of deleting the object directly.

Reimplemented from rendering_engine::DrawableComponent.

Definition at line 64 of file drawable_3d.cpp.

65{
67}
void DestroyDrawable3D(Drawable3D *drawable3D)
Schedules a 3D drawable for deferred destruction.
Definition: scene.cpp:149

◆ Draw()

virtual void rendering_engine::Drawable3D::Draw ( const Camera camera)
pure virtual

Submits this mesh to the renderer for drawing.

Implemented in rendering_engine::StaticMesh.

◆ GetPosition()

const glm::vec3 & rendering_engine::Drawable3D::GetPosition ( ) const

Gets the mesh position.

Definition at line 39 of file drawable_3d.cpp.

40{
42}
SceneComponent mSceneComponent
Definition: drawable_3d.hpp:99
const glm::vec3 & GetPosition() const
Gets the current position.

◆ GetRotation()

const glm::vec3 & rendering_engine::Drawable3D::GetRotation ( ) const

Gets the mesh rotation (pitch, yaw, roll in degrees).

Definition at line 44 of file drawable_3d.cpp.

45{
47}
const glm::vec3 & GetRotation() const
Gets the current rotation as Euler angles (in radians).

◆ GetScale()

const glm::vec3 & rendering_engine::Drawable3D::GetScale ( ) const

Gets the mesh scale.

Definition at line 49 of file drawable_3d.cpp.

50{
52}
const glm::vec3 & GetScale() const
Gets the current scale.

◆ GetTransform() [1/2]

SceneComponent & rendering_engine::Drawable3D::GetTransform ( )

Access to the underlying SceneComponent (transform).

Definition at line 54 of file drawable_3d.cpp.

55{
56 return mSceneComponent;
57}

◆ GetTransform() [2/2]

const SceneComponent & rendering_engine::Drawable3D::GetTransform ( ) const

Definition at line 59 of file drawable_3d.cpp.

60{
61 return mSceneComponent;
62}

◆ Initialize()

void rendering_engine::Drawable3D::Initialize ( )
overridevirtual

Initializes render resource pointers (material, mesh, etc.). Must be called after setting material and mesh names.

Reimplemented from rendering_engine::DrawableComponent.

Reimplemented in rendering_engine::StaticMesh.

Definition at line 11 of file drawable_3d.cpp.

12{
14}
virtual void Initialize()
Initializes render resource pointers (material, mesh, etc.). Must be called after setting material an...

◆ operator=()

Drawable3D & rendering_engine::Drawable3D::operator= ( const Drawable3D rhs)
delete

◆ SetPosition()

void rendering_engine::Drawable3D::SetPosition ( const glm::vec3 &  position)

Sets the mesh position in world space.

Parameters
positionNew position vector (x, y, z).

Definition at line 24 of file drawable_3d.cpp.

25{
27}
void SetPosition(const glm::vec3 &position)
Sets the position of the component in world space.

◆ SetRotation()

void rendering_engine::Drawable3D::SetRotation ( const glm::vec3 &  rotation)

Sets the mesh rotation in degrees.

Parameters
rotationNew rotation vector (pitch, yaw, roll), in degrees.

Definition at line 29 of file drawable_3d.cpp.

30{
32}
void SetRotation(const glm::quat &rotation)
Sets the rotation using a quaternion.

◆ SetScale()

void rendering_engine::Drawable3D::SetScale ( const glm::vec3 &  scale)

Sets the mesh scale along each axis.

Parameters
scaleNew scale vector (x, y, z).

Definition at line 34 of file drawable_3d.cpp.

35{
37}
void SetScale(const glm::vec3 &scale)
Sets the scale for each dimension.

◆ Update()

void rendering_engine::Drawable3D::Update ( float  deltaTime)
overridevirtual

Updates logic (animation, movement, etc.) for this drawable.

Parameters
deltaTimeTime step (seconds).

Implements rendering_engine::DrawableComponent.

Reimplemented in rendering_engine::StaticMesh.

Definition at line 16 of file drawable_3d.cpp.

Member Data Documentation

◆ mSceneComponent

SceneComponent rendering_engine::Drawable3D::mSceneComponent
protected

Definition at line 99 of file drawable_3d.hpp.


The documentation for this class was generated from the following files: