More image fun – Targa import

Another project I’m working on is adding some COLLADA import functionality to the library, which is going quite nicely. The end goal is that I can knock up some assets in blender and use them for some sample material. So far I’ve got triangle mesh import working, untextured materials and point lighting working. The next step was textured materials.

The first sample I came across however uses TGA’s as the texture. This is a pain as my library only supported PNG and JPEG. So being my usual lazy self off I went to search for a TGA import library that I could wrap around. Sadly I found things very lacking – but I did find the 2.0 specification document. Feeling brave I decided that actually I could roll my own importer pretty quickly. Turns out it was slightly more tricky than I anticipated but not much!

I will write an article about the choices I made and include a simple implementation of this shortly. My implementation covers the whole 2.0 specification, as best as I can tell, indexed (palletized), true colour and black and white images supporting run-length encoding. However I’ve found it difficult to get hold of a library of sample images so in the end have made my own. I’ll make those available too shortly, ideally (given time) I think I’ll clean the whole thing up a little and publish the library as a whole.

The only thing it doesn’t yet cover is I read something about Huffman compression but I guess that’s a later extension.

Leave a Reply

You must be logged in to post a comment.