vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
system.h
1#pragma once
2
3#include <cstdint>
4
5namespace Vkm::Engine {
6
7class WindowManager;
8class Clock;
9class HostChrome;
10
11class Scene;
12class ResourceManager;
13class EventBus;
14class InputMap;
15class NetSession;
16class PoseBuffer;
17struct RenderSettings;
18struct HostView;
19struct Visibility;
20struct UIDrawData;
21struct SplashFrame;
22struct LiveParticles;
23struct OceanData;
24struct TerrainFrame;
25
34enum class SystemStage : uint8_t {
35 Input = 0,
36 Simulation = 1,
37 Transform = 2,
38 Visibility = 3,
39 Render = 4,
40 Editor = 5,
41
42 Count
43};
44
58 Scene& scene;
59 ResourceManager& resources;
60
61 Clock& clock;
62 EventBus& events;
63 WindowManager& window;
64 InputMap& input;
65 NetSession& net;
66 HostChrome& chrome;
67 RenderSettings& render;
71
72 const HostView* hostView = nullptr;
73 const Visibility* visibility = nullptr;
74 const PoseBuffer* poses = nullptr;
75 const UIDrawData* ui = nullptr;
76 const SplashFrame* splash = nullptr;
77 const LiveParticles* particles = nullptr;
78 const OceanData* ocean = nullptr;
79 const TerrainFrame* terrain = nullptr;
80};
81
87class System {
88 public:
89 virtual ~System() = default;
90
91 System(const System& other) = delete;
92 System& operator=(const System& other) = delete;
93
94 System(System && other) = delete;
95 System& operator=(System && other) = delete;
96
97 public:
111 virtual bool isReplayed() const { return false; }
112
118 virtual void init(FrameContext& ctx) {}
119
123 virtual void shutdown() {}
124
130 virtual void update(FrameContext& ctx) {}
131
143 virtual void fixedUpdate(FrameContext& ctx) {}
144
145 protected:
146 System() = default;
147};
148
149} // namespace Vkm::Engine
The engine's frame clock: real + simulation time and the fixed-step accumulator.
Definition clock.h:18
Typed pub/sub event dispatcher.
Definition event_bus.h:22
What an authoring host tells the engine about the frame it draws over.
Definition host_chrome.h:18
Named actions resolved from physical bindings, sampled once per frame.
Definition input_map.h:79
One end of a game, whether it is the authority or a guest.
Definition net_session.h:118
Every rig's pose for one frame, published on FrameContext::poses.
Definition pose_buffer.h:47
Type-erased resource registry with typed handles and generational lifetimes.
Definition resource_manager.h:46
Central registry managing entities and an open set of component types.
Definition scene.h:29
Abstract base class for per-frame systems.
Definition system.h:87
virtual void update(FrameContext &ctx)
Execute this system for the current frame.
Definition system.h:130
virtual bool isReplayed() const
Whether this system may be re-run over a tick that already happened.
Definition system.h:111
virtual void fixedUpdate(FrameContext &ctx)
Execute this system at the fixed simulation rate.
Definition system.h:143
virtual void init(FrameContext &ctx)
Called once after all systems are registered, before the first update.
Definition system.h:118
virtual void shutdown()
Called once on engine shutdown.
Definition system.h:123
Owns the application's window, its WindowSurface, input, and frame limiting.
Definition window_manager.h:69
Per-frame state bundle passed to every system.
Definition system.h:57
const HostView * hostView
From CameraControllerSystem.
Definition system.h:72
const PoseBuffer * poses
From SkeletalAnimationSystem.
Definition system.h:74
const OceanData * ocean
From OceanSystem.
Definition system.h:78
const TerrainFrame * terrain
From TerrainSystem.
Definition system.h:79
RenderSettings & projectRender
Definition system.h:70
const UIDrawData * ui
From UISystem.
Definition system.h:75
const LiveParticles * particles
From ParticleSystem.
Definition system.h:77
const Visibility * visibility
From VisibilitySystem.
Definition system.h:73
const SplashFrame * splash
From SplashSystem.
Definition system.h:76
A view an authoring host renders the frame through instead of the scene's active camera.
Definition host_view.h:18
Every emitter's live particles: ParticleSystem's per-frame product.
Definition live_particles.h:36
The scene's sea at the moment being computed (OceanSystem): its waves, its ripples and its look - wha...
Definition ocean_data.h:13
Editable render tuning: pass toggles + per-effect parameters.
Definition render_settings.h:101
What the splash looks like this frame, or nothing; SplashSystem's product.
Definition splash_frame.h:13
The scene's terrains as chunks and plants this frame (TerrainSystem): FrameContext::terrain.
Definition terrain_frame.h:60
Local position, rotation and scale of an entity.
Definition transform.h:17
The backend-agnostic UI overlay for one frame, published on FrameContext::ui.
Definition ui_draw_data.h:58
VisibilitySystem's per-frame product: camera data, every scene mesh, and which of them the camera see...
Definition visibility.h:15