The source code of the 13th tutorial of the C++ 3D Game Tutorial Series is now available in early access on GitHub!
This update represents a significant refactoring of the rendering pipeline and a shift toward a more component-driven scene setup. The monolithic graphics subsystem has been decomposed, and the demo scene has been upgraded to showcase dynamic, multi-object rendering. Here’s what changed under the hood:
Graphics Pipeline Restructuring & Engine Decoupling
The legacy
GraphicsEngine class has been completely removed. Its responsibilities have been split: low-level device
management is now handled directly via a reference-counted GraphicsDevice in the Game class, while
high-level scene rendering has been delegated to a newly introduced WorldRenderer. This decoupling makes
the engine more modular and easier to extend.
New CubeComponent & Dedicated WorldRenderer
A CubeComponent has been
added to the component registry, and paired with a WorldRenderer that takes over all rendering duties.
The renderer handles shader compilation, sets up vertex/index buffers for a standard cube, configures an
orthographic camera, and efficiently iterates through the world to draw every registered CubeComponent
with up-to-date transformation matrices.
Enhanced Transform & Query Capabilities
TransformComponent now exposes
getWorldMatrix() to fetch its final computed matrix on demand. GameObject gains a direct getTransform()
accessor for convenience, while the World class introduces a template-based getComponents<T>()
method. This allows systems like the renderer to query all components of a given type without manual map
iteration, improving both safety and performance.
Demo Scene Overhaul: From Single Object to Animated Grid
The MainGame
initialization has been swapped from spawning a single static object to generating a 3×3 grid of nine
objects, each equipped with a CubeComponent. An onUpdate() animation loop now applies progressive
rotation and sine-driven scaling to each cube, demonstrating the new renderer’s ability to handle
multiple instances with individual transforms.
Overall, this commit streamlines the graphics architecture, introduces a flexible component querying system, and transitions the demo into a dynamic, component-driven scene that better illustrates the engine’s new rendering workflow.
You can find the full source code on GitHub here: GitHub Link
I hope you enjoy the tutorial, and thank you for all your support!