Help with CImageLoaderWAL2

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
saderbiscut
Posts: 4
Joined: Wed Jul 18, 2012 4:06 pm

Help with CImageLoaderWAL2

Post by saderbiscut »

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.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Help with CImageLoaderWAL2

Post by hendu »

Your approach is correct, though I would use straight getTexture and not go via a software image.

You only need specific access to the wal2 loader if it can't be autodetected as being wal2.
saderbiscut
Posts: 4
Joined: Wed Jul 18, 2012 4:06 pm

Re: Help with CImageLoaderWAL2

Post by saderbiscut »

What's the proper way to invoke a specific image loader?

e: I think I've got it.
Post Reply