Claire's Game Engine
Full C++ Engine using OpenGL
Loading...
Searching...
No Matches
RenderComponent Class Referenceabstract

RenderComponent is an abstract base class for all components that need to be rendered. It provides hooks for lifecycle events and defines the interface for rendering and draw order. More...

#include <RenderComponent.h>

Inheritance diagram for RenderComponent:
Component MeshComponent RectangleRenderComponent SpriteRenderComponent AnimatedSpriteRenderComponent

Public Member Functions

 RenderComponent (Actor *pOwner)
 Constructs the RenderComponent and assigns it to the owning Actor.
 
void OnStart () override
 Called when the component is started. Registers the component with the scene's renderer for drawing.
 
void OnEnd () override
 Called when the component is removed or destroyed. Unregisters the component from the renderer.
 
virtual void Render (IRenderer *rRenderer)=0
 Renders the component using the given renderer. Must be implemented by derived classes.
 
virtual RenderType GetRenderType ()=0
 Returns the type of rendering this component belongs to (World or Viewport). Used for organizing rendering passes.
 
virtual int GetDrawOrder () const
 
- Public Member Functions inherited from Component
 Component (Actor *pOwner, int pUpdateOrder=100)
 Constructor for Component.
 
virtual ~Component ()
 
virtual void Update ()
 Called every frame to update the component. This can be used to perform actions that need to be updated periodically.
 
virtual void OnUpdateWorldTrandform ()
 Called when the world transform of the actor is updated. This allows the component to react to changes in the actor's world transform.
 
void SetActive (bool isActive)
 Sets the active status of the component.
 
void SetOwner (Actor *pOwner)
 Sets the actor that owns this component.
 
int GetUpdateOrder () const
 Returns the update order of the component. Components with lower update orders are updated first.
 
ActorGetOwner () const
 Returns the actor that owns this component.
 

Public Attributes

Color mColor { 255,255,255,255 }
 

Additional Inherited Members

- Protected Attributes inherited from Component
ActormOwner = nullptr
 The actor that owns this component.
 

Detailed Description

RenderComponent is an abstract base class for all components that need to be rendered. It provides hooks for lifecycle events and defines the interface for rendering and draw order.

Constructor & Destructor Documentation

◆ RenderComponent()

RenderComponent::RenderComponent ( Actor * pOwner)

Constructs the RenderComponent and assigns it to the owning Actor.

Parameters
pOwnerThe Actor that owns this component.

Member Function Documentation

◆ GetDrawOrder()

int RenderComponent::GetDrawOrder ( ) const
virtual

@briefReturns the draw order priority of this component. Lower values are rendered first. Default is 0.

Reimplemented in SpriteRenderComponent.

◆ GetRenderType()

virtual RenderType RenderComponent::GetRenderType ( )
pure virtual

Returns the type of rendering this component belongs to (World or Viewport). Used for organizing rendering passes.

Implemented in MeshComponent, RectangleRenderComponent, and SpriteRenderComponent.

◆ OnEnd()

void RenderComponent::OnEnd ( )
overridevirtual

Called when the component is removed or destroyed. Unregisters the component from the renderer.

Reimplemented from Component.

◆ OnStart()

void RenderComponent::OnStart ( )
overridevirtual

Called when the component is started. Registers the component with the scene's renderer for drawing.

Reimplemented from Component.

◆ Render()

virtual void RenderComponent::Render ( IRenderer * rRenderer)
pure virtual

Renders the component using the given renderer. Must be implemented by derived classes.

Parameters
rRendererReference to the renderer responsible for drawing.

Implemented in MeshComponent, RectangleRenderComponent, and SpriteRenderComponent.

Member Data Documentation

◆ mColor

Color RenderComponent::mColor { 255,255,255,255 }

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