Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
RenderContext Class Reference

Singleton to track the currently active camera during rendering This allows drawing functions to automatically apply camera transforms without requiring CameraTransform parameters in every function call. More...

#include <RenderContext.h>

+ Collaboration diagram for RenderContext:

Public Member Functions

void SetActiveCamera (const CameraTransform &cam)
 Set the active camera for the current rendering pass Call this at the start of rendering for each player/viewport.
 
const CameraTransformGetActiveCamera () const
 Get the currently active camera Returns identity transform (no transformation) if none is set.
 
bool HasActiveCamera () const
 Check if a camera is currently active.
 
void ClearActiveCamera ()
 Clear the active camera (e.g., at end of rendering pass)
 

Static Public Member Functions

static RenderContextGet ()
 

Private Member Functions

 RenderContext ()
 
 ~RenderContext ()=default
 
 RenderContext (const RenderContext &)=delete
 
RenderContextoperator= (const RenderContext &)=delete
 

Private Attributes

CameraTransform activeCamera_
 
CameraTransform identityCamera_
 
bool hasCameraSet_
 

Detailed Description

Singleton to track the currently active camera during rendering This allows drawing functions to automatically apply camera transforms without requiring CameraTransform parameters in every function call.

Definition at line 19 of file RenderContext.h.

Constructor & Destructor Documentation

◆ RenderContext() [1/2]

RenderContext::RenderContext ( )
inlineprivate

◆ ~RenderContext()

RenderContext::~RenderContext ( )
privatedefault

◆ RenderContext() [2/2]

RenderContext::RenderContext ( const RenderContext )
privatedelete

Member Function Documentation

◆ ClearActiveCamera()

void RenderContext::ClearActiveCamera ( )
inline

Clear the active camera (e.g., at end of rendering pass)

Definition at line 50 of file RenderContext.h.

References hasCameraSet_.

Referenced by RenderingSystem::Render().

+ Here is the caller graph for this function:

◆ Get()

static RenderContext & RenderContext::Get ( )
inlinestatic

Definition at line 22 of file RenderContext.h.

References GetComponentTypeID_Static().

Referenced by Draw_Circle(), Draw_FilledCircle(), Draw_FilledHexagon(), Draw_FilledTriangle(), Draw_Hexagon(), Draw_Rectangle(), Draw_Text(), Draw_Triangle(), and RenderingSystem::Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetActiveCamera()

const CameraTransform & RenderContext::GetActiveCamera ( ) const
inline

Get the currently active camera Returns identity transform (no transformation) if none is set.

Definition at line 36 of file RenderContext.h.

References activeCamera_, hasCameraSet_, and identityCamera_.

Referenced by Draw_Circle(), Draw_FilledCircle(), Draw_FilledHexagon(), Draw_FilledTriangle(), Draw_Hexagon(), Draw_Rectangle(), Draw_Text(), and Draw_Triangle().

+ Here is the caller graph for this function:

◆ HasActiveCamera()

bool RenderContext::HasActiveCamera ( ) const
inline

Check if a camera is currently active.

Definition at line 45 of file RenderContext.h.

References hasCameraSet_.

◆ operator=()

RenderContext & RenderContext::operator= ( const RenderContext )
privatedelete

◆ SetActiveCamera()

void RenderContext::SetActiveCamera ( const CameraTransform cam)
inline

Set the active camera for the current rendering pass Call this at the start of rendering for each player/viewport.

Definition at line 29 of file RenderContext.h.

References activeCamera_, GetComponentTypeID_Static(), and hasCameraSet_.

Referenced by RenderingSystem::Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ activeCamera_

CameraTransform RenderContext::activeCamera_
private

Definition at line 66 of file RenderContext.h.

Referenced by GetActiveCamera(), and SetActiveCamera().

◆ hasCameraSet_

bool RenderContext::hasCameraSet_
private

◆ identityCamera_

CameraTransform RenderContext::identityCamera_
private

Definition at line 67 of file RenderContext.h.

Referenced by GetActiveCamera(), and RenderContext().


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