Radium Engine  1.5.20
Loading...
Searching...
No Matches
CameraManager.hpp
1#pragma once
2#include <Core/Utils/Observable.hpp>
3
4#include <Engine/RaEngine.hpp>
5#include <Engine/Scene/CameraStorage.hpp>
6#include <Engine/Scene/System.hpp>
7
8#include <memory>
9
10namespace Ra {
11namespace Engine {
12namespace Scene {
13
25class RA_ENGINE_API CameraManager : public System
26{
27 // Radium-V2 : make Camera manager compatible with range for ...
28 public:
31
32 // Make copies impossible
33 CameraManager( const CameraManager& ) = delete;
34 CameraManager& operator=( const CameraManager& ) = delete;
35
37 ~CameraManager() override = default;
38
40 virtual const CameraComponent* getCamera( size_t i ) const = 0;
41
43 virtual void addCamera( CameraComponent* cam ) = 0;
44
47 virtual Core::Utils::Index getCameraIndex( const CameraComponent* cam );
48
50 virtual void initialize();
51
59 void activate( Core::Utils::Index index );
60
62 void updateActiveCameraData();
63
64 //
65 // Calls for the Renderer
66 //
67
71 virtual size_t count() const;
72
73 //
74 // System methods
75 //
76 void generateTasks( Core::TaskQueue* taskQueue, const Engine::FrameInfo& frameInfo ) override;
77
78 void handleAssetLoading( Entity* entity, const Core::Asset::FileData* data ) override;
79
83
85 Ra::Core::Asset::Camera* getActiveCamera() { return &m_activeCamera; }
86
88 Core::Utils::Index getActiveCameraIndex() const { return m_activeIndex; }
89
92 m_activeCamera = defaultCamera;
93 m_activeIndex = -1;
94 m_activeCameraObservers.notify( m_activeIndex );
95 }
96
99 return m_activeCameraObservers;
100 }
101
102 protected:
106 void registerComponent( const Entity* entity, Component* component ) final;
107
110 void unregisterComponent( const Entity* entity, Component* component ) final;
111
114 void unregisterAllComponents( const Entity* entity ) final;
115
116 protected:
119
122
124 Core::Utils::Index m_activeIndex;
125
128};
129
130} // namespace Scene
131} // namespace Engine
132} // namespace Ra
Camera class storing the Camera frame and the projection properties The view direction is -z in camer...
Definition Camera.hpp:16
This class allows tasks to be registered and then executed in parallel on separate threads.
Definition TaskQueue.hpp:48
~CameraManager() override=default
Virtual destructor.
void resetActiveCamera()
reset the active camera data to default camera
Core::Utils::Index m_activeIndex
active camera index
Ra::Core::Asset::Camera * getActiveCamera()
Get the pointer on the active camera data.
Core::Utils::Index getActiveCameraIndex() const
Get the index of the currently active camera.
Core::Utils::Observable< Core::Utils::Index > m_activeCameraObservers
Observers on active camera changes.
Ra::Core::Asset::Camera m_activeCamera
active camera data, active camera hasn't any component just pure data.
virtual const CameraComponent * getCamera(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 ...
static Ra::Core::Asset::Camera defaultCamera
Core::Utils::Observable< Core::Utils::Index > & activeCameraObservers()
get a ref to active camera observers to add/remove an observer
A component is an element that can be updated by a system. It is also linked to some other components...
Definition Component.hpp:31
An entity is an scene element. It ties together components with a transform.
Definition Entity.hpp:23
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3
Structure passed to each system before they fill the task queue.
Definition FrameInfo.hpp:8