# Building a 3D Game Engine in C++ & DirectX 12 — Day 7: Reference Grid, Line PSO & Camera Controls

**URL:** <https://forums.unrealengine.com/t/building-a-3d-game-engine-in-c-directx-12-day-7-reference-grid-line-pso-camera-controls/2875595>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, CPP\
**Created:** [December 1, 2026, 4:37pm UTC](https://forums.unrealengine.com/t/building-a-3d-game-engine-in-c-directx-12-day-7-reference-grid-line-pso-camera-controls/2875595 "2026-12-01T16:37:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinpc\_1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kevinpc_1/32/1215238_2.png) [@kevinpc\_1](https://forums.unrealengine.com/u/kevinpc_1)\
**Post date:** [December 1, 2026, 4:37pm UTC](https://forums.unrealengine.com/t/building-a-3d-game-engine-in-c-directx-12-day-7-reference-grid-line-pso-camera-controls/2875595/1 "2026-12-01T16:37:29Z")

</div>

Day 7 of building a custom 3D game engine from scratch in C++ and DirectX 12 using the Microsoft GDK.

In today’s update, I implemented a 40x40 world-space reference grid underneath the 3D scene and upgraded the free-roam camera controls for smoother navigation.

What’s new in Day 7:

- 40x40 Reference Grid (Y = -1.5f): Built a custom line-list vertex buffer spanning -20 to +20 units along X and Z with major grid subdivisions and highlighted center axes for spatial orientation.
- Dual Pipeline State Objects (PSOs): Added a dedicated LINE PSO (D3D12\_PRIMITIVE\_TOPOLOGY\_TYPE\_LINE) alongside the TRIANGLE PSO so line-list geometry and triangle-list meshes render cleanly without DirectX 12 topology mismatches.
- Dedicated Grid Constant Buffer: Mapped an independent 256-byte aligned Constant Buffer for the world grid using the View-Projection matrix.
- Camera Quality-of-Life Upgrades: Added WM\_MOUSEWHEEL support to dynamically adjust camera movement speed (0.5 to 40.0) and debounced R-key camera reset back to the default origin.

Current Engine Controls:

- W / A / S / D: Move forward, left, backward, right
- Q / E: Move down / up
- Right Mouse Button + Move: Free look (Yaw & Pitch)
- Left Shift: 2.5x movement speed boost
- Mouse Wheel: Adjust base camera speed
- R: Reset camera to default position and orientation
- Link of video 7:[https://youtu.be/dxQiI1t7USs](https://youtu.be/dxQiI1t7USs)

Tech Stack: C++, DirectX 12, HLSL, DirectXMath, Win32 API, Microsoft GDK.

Follow the daily engine development journey here on Low-Level Code | USA.

#CPP #DirectX12 #GameEngine #GraphicsProgramming #EngineProgrammer #LowLevelProgramming #GameDev #MicrosoftGDK #hlsl #3DEngine
