Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.6.3
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CameraManager.hpp
1#pragma once
2#include <Core/Asset/Camera.hpp>
3#include <Core/Utils/Index.hpp>
4#include <Core/Utils/Observable.hpp>
5#include <Engine/RaEngine.hpp>
6#include <Engine/Scene/CameraStorage.hpp>
7#include <Engine/Scene/System.hpp>
8#include <memory>
9
10namespace Ra {
11namespace Core {
12class TaskQueue;
13namespace Asset {
14class FileData;
15} // namespace Asset
16} // namespace Core
17
18namespace Engine {
19struct FrameInfo;
20
21namespace Scene {
22class CameraComponent;
23class Component;
24class Entity;
25
37class RA_ENGINE_API CameraManager : public System
38{
39 // Radium-V2 : make Camera manager compatible with range for ...
40 public:
43
44 // Make copies impossible
45 CameraManager( const CameraManager& ) = delete;
46 CameraManager& operator=( const CameraManager& ) = delete;
47
49 ~CameraManager() override = default;
50
52 virtual const CameraComponent* getCamera( size_t i ) const = 0;
53
55 virtual void addCamera( CameraComponent* cam ) = 0;
56
59 virtual Core::Utils::Index getCameraIndex( const CameraComponent* cam );
60
62 virtual void initialize();
63
71 void activate( Core::Utils::Index index );
72
74 void updateActiveCameraData();
75
76 //
77 // Calls for the Renderer
78 //
79
83 virtual size_t count() const;
84
85 //
86 // System methods
87 //
88 void generateTasks( Core::TaskQueue* taskQueue, const Engine::FrameInfo& frameInfo ) override;
89
90 void handleAssetLoading( Entity* entity, const Core::Asset::FileData* data ) override;
91
95
97 Ra::Core::Asset::Camera* getActiveCamera() { return &m_activeCamera; }
98
100 Core::Utils::Index getActiveCameraIndex() const { return m_activeIndex; }
101
104 m_activeCamera = defaultCamera;
105 m_activeIndex = -1;
106 m_activeCameraObservers.notify( m_activeIndex );
107 }
108
111 return m_activeCameraObservers;
112 }
113
114 protected:
118 void registerComponent( const Entity* entity, Component* component ) final;
119
122 void unregisterComponent( const Entity* entity, Component* component ) final;
123
126 void unregisterAllComponents( const Entity* entity ) final;
127
128 protected:
131
134
136 Core::Utils::Index m_activeIndex;
137
140};
141
142} // namespace Scene
143} // namespace Engine
144} // 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:50
~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:4
Structure passed to each system before they fill the task queue.
Definition FrameInfo.hpp:8