Learning how to use DirectX 11 through
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.
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.
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 Transform
s of objects could be
immediately moved out.
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
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.
Material
contains the data read in from the .mtl
that is referenced in the .obj
.
Transform
contains the XMFLOAT4X4
which represents the World Matrix of the object.
Transform
also holds a pointer to the RenderObject
.