Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Engine::Scene::CameraManager Class Referenceabstract

#include <Engine/Scene/CameraManager.hpp>

+ Inheritance diagram for Ra::Engine::Scene::CameraManager:
+ Collaboration diagram for Ra::Engine::Scene::CameraManager:

Public Member Functions

 CameraManager ()
 Constructor.
 
 CameraManager (const CameraManager &)=delete
 
CameraManageroperator= (const CameraManager &)=delete
 
 ~CameraManager () override=default
 Virtual destructor.
 
virtual const CameraComponentgetCamera (size_t i) const =0
 Get a pointer to the i-th Camera.
 
virtual void addCamera (CameraComponent *cam)=0
 Add a Camera to the manager ...
 
virtual Core::Utils::Index getCameraIndex (const CameraComponent *cam)
 
virtual void initialize ()
 Add a default camera.
 
void activate (Core::Utils::Index index)
 
void updateActiveCameraData ()
 update the active camera data
 
virtual size_t count () const
 Number of managed Cameras.
 
void generateTasks (Core::TaskQueue *taskQueue, const Engine::FrameInfo &frameInfo) override
 Pure virtual method to be overridden by any system. Must register in taskQueue the operations that must be done ate each frame.
 
void handleAssetLoading (Entity *entity, const Core::Asset::FileData *data) override
 
Ra::Core::Asset::CameragetActiveCamera ()
 Get the pointer on the active camera data.
 
Core::Utils::Index getActiveCameraIndex () const
 Get the index of the currently active camera.
 
void resetActiveCamera ()
 reset the active camera data to default camera
 
Core::Utils::Observable< Core::Utils::Index > & activeCameraObservers ()
 get a ref to active camera observers to add/remove an observer
 
- Public Member Functions inherited from Ra::Engine::Scene::System
std::vector< Component * > getEntityComponents (const Entity *entity)
 
void addComponent (Entity *entity, Component *component)
 

Static Public Attributes

static Ra::Core::Asset::Camera defaultCamera
 

Protected Member Functions

void registerComponent (const Entity *entity, Component *component) final
 
void unregisterComponent (const Entity *entity, Component *component) final
 
void unregisterAllComponents (const Entity *entity) final
 
- Protected Member Functions inherited from Ra::Engine::Scene::System

Protected Attributes

std::unique_ptr< CameraStoragem_data { nullptr }
 Stores the object that stores the Cameras...
 
Ra::Core::Asset::Camera m_activeCamera
 active camera data, active camera hasn't any component just pure data.
 
Core::Utils::Index m_activeIndex
 active camera index
 
Core::Utils::Observable< Core::Utils::Index > m_activeCameraObservers
 Observers on active camera changes.
 
- Protected Attributes inherited from Ra::Engine::Scene::System
std::vector< std::pair< const Entity *, Component * > > m_components
 List of active components.
 

Detailed Description

Interface providing functions to manage a group or type of Cameras in a specific way. CameraManager handle one "active camera" for rendering as m_activeCamera; this rendering camera has no Component associated, and it can retrieve it's data from any managed camera with activate(index). Manipulator and renderer can access (and even store as a visiting ptr) this data with getActiveCamera() Default camera data is used to intializad camera. Client code can set this static data to control default camera initialization.

Definition at line 25 of file CameraManager.hpp.

Constructor & Destructor Documentation

◆ CameraManager()

Ra::Engine::Scene::CameraManager::CameraManager ( )

Constructor.

Definition at line 24 of file CameraManager.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

void Ra::Engine::Scene::CameraManager::activate ( Core::Utils::Index index)

activate camera at index given its index. index-th camera data is copied to the "active camera" stored explicitly by the manager. width and height of previous active camera is kept during this process, since it's likely to be screen size, while index-th camera width height might be something else. When a camera is activated, the frame of the active camera is computed to take the entity's transformation into account.

Parameters
indexcamera's index to activate, if invalid or out of bound, activation is ignored.

Definition at line 39 of file CameraManager.cpp.

+ Here is the call graph for this function:

◆ activeCameraObservers()

Core::Utils::Observable< Core::Utils::Index > & Ra::Engine::Scene::CameraManager::activeCameraObservers ( )
inline

get a ref to active camera observers to add/remove an observer

Definition at line 98 of file CameraManager.hpp.

◆ addCamera()

virtual void Ra::Engine::Scene::CameraManager::addCamera ( CameraComponent * cam)
pure virtual

Add a Camera to the manager ...

Implemented in Ra::Engine::Scene::DefaultCameraManager.

◆ count()

size_t Ra::Engine::Scene::CameraManager::count ( ) const
virtual

Number of managed Cameras.

Definition at line 71 of file CameraManager.cpp.

◆ generateTasks()

void Ra::Engine::Scene::CameraManager::generateTasks ( Core::TaskQueue * taskQueue,
const Engine::FrameInfo & frameInfo )
overridevirtual

Pure virtual method to be overridden by any system. Must register in taskQueue the operations that must be done ate each frame.

Parameters
taskQueueThe queue to fill
frameInfoInformation about the current frame (
See also
FrameInfo)

Implements Ra::Engine::Scene::System.

Definition at line 75 of file CameraManager.cpp.

+ Here is the call graph for this function:

◆ getActiveCamera()

Ra::Core::Asset::Camera * Ra::Engine::Scene::CameraManager::getActiveCamera ( )
inline

Get the pointer on the active camera data.

Definition at line 85 of file CameraManager.hpp.

◆ getActiveCameraIndex()

Core::Utils::Index Ra::Engine::Scene::CameraManager::getActiveCameraIndex ( ) const
inline

Get the index of the currently active camera.

Definition at line 88 of file CameraManager.hpp.

◆ getCamera()

virtual const CameraComponent * Ra::Engine::Scene::CameraManager::getCamera ( size_t i) const
pure virtual

Get a pointer to the i-th Camera.

Implemented in Ra::Engine::Scene::DefaultCameraManager.

◆ getCameraIndex()

Ra::Core::Utils::Index Ra::Engine::Scene::CameraManager::getCameraIndex ( const CameraComponent * cam)
virtual

get camera component's index, if this component is managed.

Returns
valid index if component is managed, invalid index in other case.

Definition at line 64 of file CameraManager.cpp.

◆ handleAssetLoading()

void Ra::Engine::Scene::CameraManager::handleAssetLoading ( Entity * entity,
const Core::Asset::FileData * data )
overridevirtual

Factory method for component creation from file data. From a given file and the corresponding entity, the system will create the corresponding components, add them to the entity, and register the component.

Note
: Issue #325 - As this method register components and might also manage each component outside the m_components vectors (e.g in a buffer on the GPU) the methods, the registerComponent and unregister*Component must be virtual method that could be overriden.

Reimplemented from Ra::Engine::Scene::System.

Definition at line 98 of file CameraManager.cpp.

+ Here is the call graph for this function:

◆ initialize()

void Ra::Engine::Scene::CameraManager::initialize ( )
virtual

Add a default camera.

Definition at line 31 of file CameraManager.cpp.

+ Here is the call graph for this function:

◆ registerComponent()

void Ra::Engine::Scene::CameraManager::registerComponent ( const Entity * entity,
Component * component )
finalprotectedvirtual

Inherited method marked as final to ensure correct memory management even in child classes (e.g. CameraStorage).

register the manager to the entity's transformationObservers to update active camera data on entity's transformation changes

Reimplemented from Ra::Engine::Scene::System.

Definition at line 113 of file CameraManager.cpp.

+ Here is the call graph for this function:

◆ resetActiveCamera()

void Ra::Engine::Scene::CameraManager::resetActiveCamera ( )
inline

reset the active camera data to default camera

Definition at line 91 of file CameraManager.hpp.

◆ unregisterAllComponents()

void Ra::Engine::Scene::CameraManager::unregisterAllComponents ( const Entity * entity)
finalprotectedvirtual

Inherited method marked as final to ensure correct memory management even in child classes (e.g. CameraStorage).

Reimplemented from Ra::Engine::Scene::System.

Definition at line 129 of file CameraManager.cpp.

+ Here is the call graph for this function:

◆ unregisterComponent()

void Ra::Engine::Scene::CameraManager::unregisterComponent ( const Entity * entity,
Component * component )
finalprotectedvirtual

Inherited method marked as final to ensure correct memory management even in child classes (e.g. CameraStorage).

Reimplemented from Ra::Engine::Scene::System.

Definition at line 124 of file CameraManager.cpp.

+ Here is the call graph for this function:

◆ updateActiveCameraData()

void Ra::Engine::Scene::CameraManager::updateActiveCameraData ( )

update the active camera data

Definition at line 49 of file CameraManager.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ defaultCamera

Ra::Core::Asset::Camera Ra::Engine::Scene::CameraManager::defaultCamera
static

this static data member handles default camera values. can be tweaked after ctor and before initalization, or for any kind of reset.

Definition at line 82 of file CameraManager.hpp.

◆ m_activeCamera

Ra::Core::Asset::Camera Ra::Engine::Scene::CameraManager::m_activeCamera
protected

active camera data, active camera hasn't any component just pure data.

Definition at line 121 of file CameraManager.hpp.

◆ m_activeCameraObservers

Core::Utils::Observable<Core::Utils::Index> Ra::Engine::Scene::CameraManager::m_activeCameraObservers
protected

Observers on active camera changes.

Definition at line 127 of file CameraManager.hpp.

◆ m_activeIndex

Core::Utils::Index Ra::Engine::Scene::CameraManager::m_activeIndex
protected

active camera index

Definition at line 124 of file CameraManager.hpp.

◆ m_data

std::unique_ptr<CameraStorage> Ra::Engine::Scene::CameraManager::m_data { nullptr }
protected

Stores the object that stores the Cameras...

Definition at line 118 of file CameraManager.hpp.


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