Radium Engine  1.5.20
Loading...
Searching...
No Matches
System.hpp
1#pragma once
2
3#include <Engine/RaEngine.hpp>
4
5#include <memory>
6#include <vector>
7
8namespace Ra {
9namespace Core {
10class TaskQueue;
11namespace Asset {
12class FileData;
13}
14} // namespace Core
15
16namespace Engine {
17struct FrameInfo;
18
19namespace Scene {
20
21class Component;
22class Entity;
23
30class RA_ENGINE_API System
31{
32 friend class Component;
33
34 public:
35 System() = default;
36 virtual ~System() = default;
37
46 virtual void handleAssetLoading( Entity* entity, const Core::Asset::FileData* data ) {
47 CORE_UNUSED( entity );
48 CORE_UNUSED( data );
49 }
50
58 virtual void generateTasks( Core::TaskQueue* taskQueue,
59 const Engine::FrameInfo& frameInfo ) = 0;
60
66 std::vector<Component*> getEntityComponents( const Entity* entity );
67
73 void addComponent( Entity* entity, Component* component ) {
74 registerComponent( entity, component );
75 }
76
77 protected:
84 virtual void registerComponent( const Entity* entity, Component* component );
85
92 virtual void unregisterComponent( const Entity* entity, Component* component );
93
99 virtual void unregisterAllComponents( const Entity* entity );
100
101 protected:
104};
105
106} // namespace Scene
107} // namespace Engine
108} // namespace Ra
This class allows tasks to be registered and then executed in parallel on separate threads.
Definition TaskQueue.hpp:48
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
std::vector< std::pair< const Entity *, Component * > > m_components
List of active components.
Definition System.hpp:103
virtual void handleAssetLoading(Entity *entity, const Core::Asset::FileData *data)
Definition System.hpp:46
virtual void generateTasks(Core::TaskQueue *taskQueue, const Engine::FrameInfo &frameInfo)=0
Pure virtual method to be overridden by any system. Must register in taskQueue the operations that mu...
void addComponent(Entity *entity, Component *component)
Definition System.hpp:73
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