In this assignment we introduced textures. Textures are set in a material and mapped to a mesh using uv coordinates. The fragment shader has a texture sampler that samples the texture at each coordinate and outputs the corresponding color from the texture for that fragment.
I have made the textures as part of the material class because it seemed to be the simpler approach. Ideally I would have it in its own class but at this point the texture on code side is really just a pointer and a sampler id. So it was easy to just add this to the material class.
Here is my binary material file with the data highlighted:
Its simply two null terminated strings that appear after the effect path. Each string is prefixed with a byte that tells us how long that string is. The first string ist he name of the texture sampler and the second is the path to the texture file. Because I know they appear immediately after the effect, I just read the two strings and move on with reading the rest of the file as before.
We also have a TextureBuilder which takes a texture file in a image format like jpg, png, tga etc. and builds into a .dds file. This dds file is loaded by code during runtime.
The scene is pretty simple and tests opaque and transparent materials with textures.
WASD to move camera.