My Project
Loading...
Searching...
No Matches
Engine::MeshComponent Class Reference

Component responsible for storing and managing a mesh for an entity. Used by the rendering system to draw geometry. More...

#include <MeshComponent.hpp>

Inheritance diagram for Engine::MeshComponent:
Engine::Component

Public Member Functions

 MeshComponent ()=default
 Default constructor.
std::shared_ptr< MeshAssetGetMesh () const
 Returns the mesh assigned to this component.
void SetMesh (std::shared_ptr< MeshAsset > mesh)
 Assigns a mesh to this component. Logs the operation for debugging purposes.
void Start () override
 Called when the component starts.
void Update (float dt) override
 Called every frame to update the component.
void OnDestroy () override
 Called when the component is destroyed. Releases the mesh reference.
std::string GetTypeName () const override
 Returns the type name of the component. Used for debugging, serialization, or editor systems.
Public Member Functions inherited from Engine::Component
virtual ~Component ()=default
 Virtual destructor to allow proper cleanup of derived components.

Additional Inherited Members

Public Attributes inherited from Engine::Component
GameObjectgameObject = nullptr
 Pointer to the GameObject that owns this component.
Protected Member Functions inherited from Engine::Component
 Component ()=default
 Protected constructor to prevent direct instantiation of the base class.

Detailed Description

Component responsible for storing and managing a mesh for an entity. Used by the rendering system to draw geometry.

Constructor & Destructor Documentation

◆ MeshComponent()

Engine::MeshComponent::MeshComponent ( )
default

Default constructor.

Member Function Documentation

◆ GetMesh()

std::shared_ptr< MeshAsset > Engine::MeshComponent::GetMesh ( ) const
inline

Returns the mesh assigned to this component.

Returns
Shared pointer to the MeshAsset

◆ GetTypeName()

std::string Engine::MeshComponent::GetTypeName ( ) const
inlineoverridevirtual

Returns the type name of the component. Used for debugging, serialization, or editor systems.

Returns
Component type name

Implements Engine::Component.

◆ OnDestroy()

void Engine::MeshComponent::OnDestroy ( )
inlineoverridevirtual

Called when the component is destroyed. Releases the mesh reference.

Reimplemented from Engine::Component.

◆ SetMesh()

void Engine::MeshComponent::SetMesh ( std::shared_ptr< MeshAsset > mesh)
inline

Assigns a mesh to this component. Logs the operation for debugging purposes.

Parameters
meshMesh asset to assign

◆ Start()

void Engine::MeshComponent::Start ( )
inlineoverridevirtual

Called when the component starts.

Reimplemented from Engine::Component.

◆ Update()

void Engine::MeshComponent::Update ( float dt)
inlineoverridevirtual

Called every frame to update the component.

Parameters
dtDelta time between frames

Reimplemented from Engine::Component.


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