University Project - DirectX 11

Learning how to use DirectX 11 through

Background

Initially we were given a basic DX11 Project which created a window and initialized most of the under-lying DirectX specifics, such as the Render Pipeline.

Starting Out

The first thing we were taught was how to navigate the project we were given.
Afterward we were told how to change the RasterizerState with RSSetState() to use wireframe instead of solid shading.
At this point I started deviating from the teaching and I implemented a keybind that closed the window on press. This took advantage of WM_CLOSE message which is passed to the WndProc() function to process the Windows Message. I realised that this will close the program even when it is not in focus, so I added a check which uses GetForegroundWindow() and compares it against the HWND of the DX11 window.

Refactoring

At this point the project was becoming a bit of a mess, as the code we were given was all in one .cpp file. This lead to a need to start refactoring much of the code to either be outside the .cpp or into a neater format.

To facility this I created a simple .obj that loads mesh data from a file and using this format, I figured out what data I can move from the main .cpp.
A lot of model data that was hardcoded in (a Cube) and the Transforms of objects could be immediately moved out.

Game or Render Object

As of writing this I am currently working on creating a Game or Render Object which handles each object in the scene.
Currently a RenderObject contains a Mesh and Transform.

Mesh

A Mesh contains the raw data of the model so that it can be rendered to the scene, such as Vertices, Vertex Indices, Material, Vertex Buffer and Index Buffer.
The Material contains the data read in from the .mtl that is referenced in the .obj.

Transform

The Transform contains the XMFLOAT4X4 which represents the World Matrix of the object.
It keeps track of the Local Position of the object, which, if the object has no parent, is also the direct World Position. It also tracks the Scale of the object.
The Transform also holds a pointer to the RenderObject.