Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
blowbox_core.h
1 #pragma once
2 
3 #include "util/functional.h"
4 #include "util/shared_ptr.h"
5 
6 #define BLOWBOX_SWAP_CHAIN_BUFFER_COUNT 2
7 #define BLOWBOX_DESCRIPTOR_HEAP_MAX_RTV_COUNT 256U
8 #define BLOWBOX_DESCRIPTOR_HEAP_MAX_DSV_COUNT 256U
9 #define BLOWBOX_DESCRIPTOR_HEAP_MAX_CBV_SRV_UAV_COUNT 16384U
10 
19 namespace blowbox
20 {
21  class Get;
22  struct BlowboxConfig;
23  class GLFWManager;
24  class Window;
25  class Device;
26  class SwapChain;
27  class CommandManager;
28  class CommandContextManager;
29  class DescriptorHeap;
30  class ForwardRenderer;
31  class DeferredRenderer;
32  class ImGuiManager;
33  class SceneManager;
34  class DebugMenu;
35  class Console;
36  class Time;
37  class PerformanceProfiler;
38  class MemoryProfiler;
39  class FrameStats;
40  class MemoryStats;
41 
54  {
55  public:
60  BlowboxCore();
61 
68  BlowboxCore(BlowboxConfig* config);
69 
71  BlowboxCore(const BlowboxCore& that) = delete;
72 
74  ~BlowboxCore();
75 
86  void Run();
87 
95  void Shutdown();
96 
98  bool IsBlowboxAlive();
99 
100  protected:
101 
103  void StartupGetter();
104 
106  void StartupWin32();
107 
109  void StartupRenderer();
110 
112  void StartupScene();
113 
115  void StartupDebug();
116 
118  void ShutdownGetter();
119 
121  void ShutdownWin32();
122 
124  void ShutdownRenderer();
125 
127  void ShutdownScene();
128 
130  void ShutdownDebug();
131 
138  void Update();
139 
146  void Render();
147 
148  public:
157  void SetRunProcedure(const Function<void>& run_procedure);
158 
167  void SetUpdateProcedure(const Function<void>& update_procedure);
168 
177  void SetPostUpdateProcedure(const Function<void>& post_update_procedure);
178 
187  void SetRenderProcedure(const Function<void>& render_procedure);
188 
197  void SetPostRenderProcedure(const Function<void>& post_render_procedure);
198 
207  void SetShutdownProcedure(const Function<void>& shutdown_procedure);
208 
209  private:
212 
219 
221 
222  // win32 stuff
226 
227  // render stuff
235 
238 
240 
241  // scene stuff
243 
244  // debug stuff
251 
252  public:
253  static bool alive;
254  };
255 }
void ShutdownRenderer()
Shuts down the Renderer subsystems.
Definition: blowbox_core.cc:277
SharedPtr< SwapChain > render_swap_chain_
The SwapChain used by the renderers.
Definition: blowbox_core.h:229
void Shutdown()
Request BlowboxCore to shutdown.
Definition: blowbox_core.cc:149
void ShutdownDebug()
Shuts down the debug subsystems.
Definition: blowbox_core.cc:315
Function< void > user_procedure_render_
The procedure that is defined by the user for the Render step.
Definition: blowbox_core.h:216
Function< void > user_procedure_post_update_
The procedure that is defined by the user for the PostUpdate step.
Definition: blowbox_core.h:215
SharedPtr< DebugMenu > debug_menu_
The DebugMenu instance.
Definition: blowbox_core.h:245
SharedPtr< DescriptorHeap > render_cbv_srv_uav_heap_
DescriptorHeap for cbv/srv/uavs.
Definition: blowbox_core.h:234
void SetShutdownProcedure(const Function< void > &shutdown_procedure)
Sets the Shutdown user procedure.
Definition: blowbox_core.cc:468
void StartupScene()
Starts up the Scene subsystems.
Definition: blowbox_core.cc:243
void SetPostUpdateProcedure(const Function< void > &post_update_procedure)
Set the PostUpdate user procedure.
Definition: blowbox_core.cc:450
SharedPtr< CommandManager > render_command_manager_
The CommandManager instance.
Definition: blowbox_core.h:230
void StartupGetter()
Starts up the Getter system.
Definition: blowbox_core.cc:171
SharedPtr< DescriptorHeap > render_dsv_heap_
DescriptorHeap for depth stencil views.
Definition: blowbox_core.h:233
Provides clean access to all subsystems.
Definition: get.h:44
SharedPtr< ForwardRenderer > render_forward_renderer_
The ForwardRenderer instance.
Definition: blowbox_core.h:236
bool IsBlowboxAlive()
Figures out whether the BlowboxCore should shutdown based on the state of the engine (window...
Definition: blowbox_core.cc:155
SharedPtr< FrameStats > frame_stats_
The FrameStats instance.
Definition: blowbox_core.h:249
SharedPtr< Window > win32_main_window_
The main Window instance.
Definition: blowbox_core.h:224
void Run()
Kicks off the gameloop.
Definition: blowbox_core.cc:102
void StartupDebug()
Starts up the debug subsystems.
Definition: blowbox_core.cc:249
SharedPtr< ImGuiManager > render_imgui_manager_
The ImGuiManager instance.
Definition: blowbox_core.h:239
void Render()
Performs the render step in the game loop.
Definition: blowbox_core.cc:387
void SetPostRenderProcedure(const Function< void > &post_render_procedure)
Sets the PostRender user procedure.
Definition: blowbox_core.cc:462
The core of Blowbox.
Definition: blowbox_core.h:53
BlowboxConfig * config_
The configuration of blowbox.
Definition: blowbox_core.h:210
void SetUpdateProcedure(const Function< void > &update_procedure)
Sets the Update user procedure.
Definition: blowbox_core.cc:444
void SetRunProcedure(const Function< void > &run_procedure)
Sets the Run user procedure.
Definition: blowbox_core.cc:438
SharedPtr< PerformanceProfiler > performance_profiler_
The PerformanceProfiler instance.
Definition: blowbox_core.h:247
void StartupWin32()
Starts up the Win32 subsystems.
Definition: blowbox_core.cc:203
BlowboxCore()
This is a dummy constructor and doesn&#39;t do anything except that it enables this class to have a defau...
Definition: blowbox_core.cc:36
Function< void > user_procedure_post_render_
The procedure that is defined by the user for the PostRender step.
Definition: blowbox_core.h:217
Function< void > user_procedure_run_
The procedure that is defined by the user for the Run step.
Definition: blowbox_core.h:213
bool shutdown_requested_
Tracks whether the engine should still be alive.
Definition: blowbox_core.h:211
SharedPtr< Console > console_
The Console instance.
Definition: blowbox_core.h:246
SharedPtr< SceneManager > scene_manager_
The SceneManager instance.
Definition: blowbox_core.h:242
Function< void > user_procedure_update_
The procedure that is defined by the user for the Update step.
Definition: blowbox_core.h:214
void ShutdownGetter()
Shuts down the Getter system.
Definition: blowbox_core.cc:259
static bool alive
Static variable to determine whether the BlowboxCore is alive.
Definition: blowbox_core.h:253
~BlowboxCore()
Destroys the BlowboxCore.
Definition: blowbox_core.cc:96
SharedPtr< GLFWManager > win32_glfw_manager_
The GLFWManager instance is stored here.
Definition: blowbox_core.h:223
void StartupRenderer()
Starts up the Renderer subsystems.
Definition: blowbox_core.cc:210
SharedPtr< MemoryStats > memory_stats_
The MemoryStats instance.
Definition: blowbox_core.h:250
The main Blowbox namespace.
Definition: image.cc:8
SharedPtr< DescriptorHeap > render_rtv_heap_
DescriptorHeap for render target views.
Definition: blowbox_core.h:232
void ShutdownWin32()
Shuts down the Win32 subsystems.
Definition: blowbox_core.cc:265
void ShutdownScene()
Shuts down the Scene subsystems.
Definition: blowbox_core.cc:306
Configuration of Blowbox.
Definition: blowbox_config.h:16
eastl::shared_ptr< T > SharedPtr
Typedef for wrapping the EASTL shared_ptr.
Definition: shared_ptr.h:14
SharedPtr< Time > win32_time_
The Time instance.
Definition: blowbox_core.h:225
void SetRenderProcedure(const Function< void > &render_procedure)
Sets the Render user procedure.
Definition: blowbox_core.cc:456
SharedPtr< Device > render_device_
The Device used by the renderers.
Definition: blowbox_core.h:228
SharedPtr< DeferredRenderer > render_deferred_renderer_
The DeferredRenderer instance.
Definition: blowbox_core.h:237
Get * getter_
The Get instance that is used in the entire engine.
Definition: blowbox_core.h:220
Function< void > user_procedure_shutdown_
The procedure that is defined by the user for the Shutdown step.
Definition: blowbox_core.h:218
SharedPtr< CommandContextManager > render_command_context_manager_
The CommandContextManager instance.
Definition: blowbox_core.h:231
SharedPtr< MemoryProfiler > memory_profiler_
The MemoryProfiler instance.
Definition: blowbox_core.h:248
eastl::function< Result()> Function
Typedef for wrapping the EASTL function.
Definition: functional.h:30
void Update()
Performs the update step in the game loop.
Definition: blowbox_core.cc:335