Today managed a couple more simple topics through the excessive complexity of Vulkan.
First off, texture mapping! The image is a bit different from buffers, which required a different set of functions for copying, creating, and transferring image objects. I also had to create a sampler object and combine the layout with the uniform buffer object to make sure it got read through the shader. Luckily enough, the texture coordinates weren't too difficult to add to the shader. Voila!
I also added some quick linear filtering and texture addressing for repeating textures:
We can even quickly multiply a color! But this is simple enough once we get past setting up the proper image object, memory, and view:
But wait! What's this:
The left object is actually behind the right; this means I need to setup depth calculations, which includes testing for the correct depth-stencil format and setting up the proper depth image view along with the swap chain image views when presenting to the screen. That way, we can use the z-buffer to show the correct pixel at the correct depth:
We need some 3D models, though! Time to tackle some model loading.
A shout out to the stb library and the tinyobjloader library for containing single header files instead of static library linking! It definitely makes it easier for multiple platforms and configurations.
No comments:
Post a Comment