Qt brings a very nice resource system that allows you to easily embed files to your executable (http://qt-project.org/doc/qt-4.8/resources.html).
Normally, you just pass ":/your/file/within/the/resources.png" as parameter to open a file from the resources. But that, of course, only works for the Qt file classes, not for the Irrlicht ones.
To be able to e.g. load mesh files, textures etc. from the resources, I wrote a small wrapper class that wraps the functionality of QIODevice (and thus also QFile) to the irr::io::IReadFile and irr::io::IWriteFile interfaces.
Code:
The code is available here:
https://bitbucket.org/hedgeware/irrlichtqtfile/src
Licence:
I don't know if it is neccessary, but just to be clear and assure best licence compatibility with Irrlicht: The above code is licenced under the Irrlicht licence, so you are free to use it in almost every way imaginable.
Example:
Code: Select all
#include "CQtReadFile.h"
// ...
CQtReadFile* myfile = new CQtReadFile(":/my_resources/skybox_texture.png");
ITexture* my_texture = video_driver->getTexture(myfile);
myfile->drop();
I have not yet tried, but since you can pass any QIODevice to the constructor of CQtReadFile, it should be possible to use QBuffer and even use network sockets (which in Qt also derive from QIODevice) to read meshes, although the whole data probably needs to be available (and thus already sent). I may look into that later on (or maybe someone else? )
Thanks,
marsupial