[13] Creating Textures
Textures, as commonly known, are two-dimensional images projected onto the surface of 3D objects to simulate a higher level of detail. Although they are mere simulations, they convey a sense of depth and realism. The evolution of textures has advanced significantly over time. Previously, textures were often pixelated and coarse due to limited technology resources. Nowadays, textures can be high-resolution, with fine details that appear realistic even up close. Overall, textures are an extremely important component of the visual experience. For this reason, and because the BRUSH class was also intended for this purpose, there is naturally the possibility to map textures onto objects.
For loading textures, I make use of a ready-made library called stb_image for the sake of simplicity. This library is in the public domain and can be downloaded from GitHub. As always, the initial focus is on understanding the technique. The goal is to abstract complex details and make the use of DirectX 11 as straightforward as possible. It's also very helpful to plan ahead and ensure that what you have envisioned actually works. This particularly pertains to creating layouts and buffer creation. Since many of these processes are now standardized for me, I can access ready-made functions to extend my engine.
I'd like to demonstrate this through some examples: The InputLayout can be easily expanded by adding flags. It looks like this:
GetILM().CreateInputLayoutVertex(&GetSM().GetShader()->inputlayoutVertex, GetSM().GetShader(), GetSM().GetShader()->flagsVertex, D3DVERTEX_POSITION | D3DVERTEX_COLOR | D3DVERTEX_NORMAL | D3DVERTEX_TEX1);
The D3DVERTEX_TEX1 flag effortlessly extends the functionality of the engine. Of course, it's not quite that simple, as adjustments to the shaders still need to be made, but it streamlines the work because when creating the buffer, I only need to call the function to create the buffer, and the engine handles the rest by setting the flag. All of what I explain here is not necessary when using the engine's functions. The described processes are solely related to the internal work on the engine. The result can be seen in the illustration below. Three textures on three objects.
oyname 3D Engine
Implementation of a DirectX11 based 3D engine in C++
More posts
- 1 ‐ Getting StartedApr 25, 2024
- [12] With light, it becomes more beautifulApr 25, 2024
- [11] Not so simple after allApr 25, 2024
- [10] There must be something movingApr 25, 2024
- [9] The Object ManagerMar 30, 2024
- [8] Some considerations on renderingMar 30, 2024
- [7] We need a deviceMar 30, 2024
- [6] System Information Capture in DetailMar 30, 2024
- [5] System Information GatheringMar 30, 2024
Leave a comment
Log in with itch.io to leave a comment.