NcEngine
Module.h
Go to the documentation of this file.
1
5#pragma once
6
8
9#include <vector>
10
11namespace nc
12{
13class ModuleRegistry;
14class Registry;
15
17class Module
18{
19 public:
27 Module(size_t id = 0) noexcept
28 : m_id{id} {}
29
30 virtual ~Module() = default;
31
33 auto Id() const noexcept { return m_id; }
34
37
39 virtual void OnBeforeSceneLoad() {}
40
42 virtual void OnBeforeSceneFragmentLoad() {}
43
45 virtual void OnAfterSceneFragmentLoad() {}
46
49 virtual void Clear() noexcept {}
50
51 private:
52 size_t m_id;
53
54 friend class ModuleRegistry;
55
56 void SetId(size_t id) noexcept { m_id = id; }
57};
58} // namespace nc
Modules are extensions that provide functionality to the engine.
Definition: Module.h:18
virtual void OnBeforeSceneFragmentLoad()
Called on registered modules immediately before loading a SceneFragment file.
Definition: Module.h:42
Module(size_t id=0) noexcept
Constructor for the Module interface.
Definition: Module.h:27
virtual void Clear() noexcept
Called on registered modules prior to clearing the Registry. This includes Scene::Unload() and NcEngi...
Definition: Module.h:49
auto Id() const noexcept
Get the module's unique id.
Definition: Module.h:33
virtual void OnAfterSceneFragmentLoad()
Called on registered modules immediately after loading a SceneFragment file.
Definition: Module.h:45
virtual void OnBuildTaskGraph(task::UpdateTasks &, task::RenderTasks &)
Called on registered modules when the task graphs are constructed.
Definition: Module.h:36
virtual void OnBeforeSceneLoad()
Called on registered modules prior to loading a new scene.
Definition: Module.h:39
Definition: ModuleRegistry.h:19
Task graph interface for building a TaskGraphContext with Module tasks.
Definition: TaskGraph.h:36