Radium Engine  1.5.0
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. More...
 
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 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.

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.

◆ 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:

◆ 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.

◆ 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:

◆ 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:

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.


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