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

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

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