I've been writing a program that loads Half-Life BSP files. So far, all is pretty good, but I'm trying to pull textures out of the BSP file. The individual texture files in the BSP appear to be identical to the ones in WAD3 files, and Irrlicht 1.8 has a loader that appears to be what I need (CImageLoaderWAL2::loadImage) , but I don't know how to access it.
Because loadImage() wants a file, I am creating a memory file and putting the texture-specific data in there like such:
Code: Select all
long buffersize = (sizeoflump - TextureSpecificOffset);
c8* buffer = new c8[buffersize];
io::IReadFile* memoryFile = device->getFileSystem()->createMemoryReadFile(buffer, buffersize, "foo.wal2", true);
BSPfile->seek(TextureSpecificOffset);
BSPfile->read(buffer, buffersize);
video::IImage* image = Driver->createImageFromFile(memoryFile);
Conceptually, this makes sense, but in essence I suppose what I'm looking for is a. How to I access "CImageLoaderWAL2" specifically and b. if my virtual file approach is correct or if I'm doing something stupid? I am unsure if there is a bug in my approach or if I'm doing something inherently wrong.