Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
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)
 Constructs the Drawable3D with a render context.
void Initialize () override
 Initializes render resource pointers (material, mesh, etc.). Must be called after setting material and mesh names.
void Update (float deltaTime) override
 Updates logic (animation, movement, etc.) for this drawable.
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.
void SetRotation (const glm::vec3 &rotation)
 Sets the mesh rotation in degrees.
void SetScale (const glm::vec3 &scale)
 Sets the mesh scale along each axis.
const glm::vec3 & GetPosition () const
 Gets the mesh position.
const glm::vec3 & GetRotation () const
 Gets the mesh rotation (pitch, yaw, roll in degrees).
const glm::vec3 & GetScale () const
 Gets the mesh scale.
SceneComponentGetTransform ()
 Access to the underlying SceneComponent (transform).
const SceneComponentGetTransform () const
 Drawable3D (const Drawable3D &rhs)=delete
Drawable3Doperator= (const Drawable3D &rhs)=delete
Public Member Functions inherited from rendering_engine::DrawableComponent
 DrawableComponent (RenderResourceContext renderContext)
 Constructs the DrawableComponent with a resource context.
virtual ~DrawableComponent ()=default
 Virtual destructor.
virtual void Shutdown ()
 DrawableComponent (const DrawableComponent &)=delete
DrawableComponentoperator= (const DrawableComponent &)=delete

Protected Attributes

SceneComponent mSceneComponent
Protected Attributes inherited from rendering_engine::DrawableComponent
RenderResourceContext mRenderContext
std::unique_ptr< IRenderResourcesmRenderResources
std::string mMaterialName
std::string mMeshName
MaterialmMaterial
PackedMaterialData mMaterialParameters
MeshDataGpumMeshData

Additional Inherited Members

Protected Member Functions inherited from rendering_engine::DrawableComponent
void SetMaterialName (const std::string &materialName)
 Sets the material to use (by name).
void SetMeshName (const std::string &meshName)
 Sets the mesh to use (by name).

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)

Constructs the Drawable3D with a render context.

Parameters
renderContextResource context.

Definition at line 6 of file drawable_3d.cpp.

6 :
7 DrawableComponent(renderContext)
8{}
DrawableComponent(RenderResourceContext renderContext)
Constructs the DrawableComponent with a resource context.

◆ Drawable3D() [2/2]

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

Member Function Documentation

◆ 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 35 of file drawable_3d.cpp.

36{
37 return mSceneComponent.GetPosition();
38}

◆ GetRotation()

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

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

Definition at line 40 of file drawable_3d.cpp.

41{
42 return mSceneComponent.GetRotation();
43}

◆ GetScale()

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

Gets the mesh scale.

Definition at line 45 of file drawable_3d.cpp.

46{
47 return mSceneComponent.GetScale();
48}

◆ GetTransform() [1/2]

SceneComponent & rendering_engine::Drawable3D::GetTransform ( )

Access to the underlying SceneComponent (transform).

Definition at line 50 of file drawable_3d.cpp.

51{
52 return mSceneComponent;
53}

◆ GetTransform() [2/2]

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

Definition at line 55 of file drawable_3d.cpp.

56{
57 return mSceneComponent;
58}

◆ 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 10 of file drawable_3d.cpp.

11{
13}
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 20 of file drawable_3d.cpp.

21{
22 mSceneComponent.SetPosition(position);
23}

◆ 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 25 of file drawable_3d.cpp.

26{
27 mSceneComponent.SetRotation(rotation);
28}

◆ 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 30 of file drawable_3d.cpp.

31{
32 mSceneComponent.SetScale(scale);
33}

◆ 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 15 of file drawable_3d.cpp.

16{
17 mSceneComponent.UpdateWorldMatrix();
18}

Member Data Documentation

◆ mSceneComponent

SceneComponent rendering_engine::Drawable3D::mSceneComponent
protected

Definition at line 94 of file drawable_3d.hpp.


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