Nameless Engine
Loading...
Searching...
No Matches
ne::CameraManager Class Reference

#include <CameraManager.h>

Public Member Functions

 CameraManager (Renderer *pRenderer)
 
void setActiveCamera (const sgc::GcPtr< CameraNode > &pCameraNode)
 
void clearActiveCamera ()
 
std::pair< std::recursive_mutex, sgc::GcPtr< CameraNode > > * getActiveCamera ()
 

Private Member Functions

void onCameraNodeDespawning (CameraNode *pCameraNode)
 

Private Attributes

RendererpRenderer = nullptr
 
std::pair< std::recursive_mutex, sgc::GcPtr< CameraNode > > mtxActiveCamera
 

Friends

class CameraNode
 

Detailed Description

Determines what camera is used to draw on the screen.

Constructor & Destructor Documentation

◆ CameraManager()

ne::CameraManager::CameraManager ( Renderer pRenderer)

Creates a new manager.

Parameters
pRendererUsed renderer.

Member Function Documentation

◆ clearActiveCamera()

void ne::CameraManager::clearActiveCamera ( )

Removes the currently active camera so that there will be no active camera.

◆ getActiveCamera()

std::pair< std::recursive_mutex, sgc::GcPtr< CameraNode > > * ne::CameraManager::getActiveCamera ( )

Returns the currently active camera.

Warning
Don't change pointers to cameras in returned object, only copy pointers or modify camera/node properties.
Must be used with the mutex.
Returns
nullptr if there is no active camera, otherwise valid camera.

◆ onCameraNodeDespawning()

void ne::CameraManager::onCameraNodeDespawning ( CameraNode pCameraNode)
private

Called by an active camera node when it's being despawned.

Parameters
pCameraNodeCamera node that's being despawned.

◆ setActiveCamera()

void ne::CameraManager::setActiveCamera ( const sgc::GcPtr< CameraNode > &  pCameraNode)

Makes a camera node to be the primary camera.

Remarks
Only spawned camera nodes can be used here, otherwise an error will be shown.
Previously active camera (if there was one) will become inactive.
Parameters
pCameraNodeSpawned camera node to make active.

Member Data Documentation

◆ mtxActiveCamera

std::pair<std::recursive_mutex, sgc::GcPtr<CameraNode> > ne::CameraManager::mtxActiveCamera
private

Stores active camera.

◆ pRenderer

Renderer* ne::CameraManager::pRenderer = nullptr
private

Used renderer.


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