VTFLib offers a simply API which allows you to read or write VMT and VTF files through a few simple functions. It also takes care of a lot of formatting and validation of the files.
VMTFile allows you to read and write VMT files using a hierarchical node based system similar to how one might navigate an XML file. The system uses a series of VMTNode objects which have a name and data type. These can be set, read or parented as needed by your application.
You can load an existing VMT file, navigate and modify it or create a new file from scratch. VMTFile will handle indentation and formatting of the file output.
The VTFFile module allows you to read and write binary image data in VTF files. Internally, the module uses RGBA8888 (32-bit) data for images and requires either your own functions or a 3rd party library to read and write more common image formats. We use and have tested it with DevIL.
It supports single frame, multiple frame and cube map files and can read and write compressed and uncompressed formats and allows access to individual frames, faces and MIP levels. It contains functions to automatically create MIP levels for you using a number of different filter types, can automatically generate sphere maps and even create Normal and DuDv maps from RGB and greyscale source images.
VTFLib 1.2.7 supports VTF file versions 7.0 thru 7.4.
Within your projects setting, make sure under Linker Options, that you include the VTFLib.lib file and include the path to it in the library search paths. Alternatively you can use a pragma directive. Next, add VTFLib.h in your source files where you will be wanting to access VTFLib functions.
All being well you should be up and ready to use VTFLib. Don't forget to make sure you place VTFLib.dll in a location where your application can find it.
VTF files are essentially bitmap files containing the data which makes up an image. The format is not dissimilar to Microsoft's DDS format, just organised a little different and with a different header.
Following the header is the data which makes up the low-res version of the image. This low-res image is used to get colour values when you hit a surface covered in the image with a weapon.
After the low-res data comes the main data compressed in the chosen format. The data is stored smallest MIP level first interpolated with data for any additional faces (in the case of cube maps) or frames for animated textures.