Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/client.cpp b/src/client.cpp
- index e47bce1..7f54217 100644
- --- a/src/client.cpp
- +++ b/src/client.cpp
- @@ -41,6 +41,7 @@
- #include "sound.h"
- #include "util/string.h"
- #include "hex.h"
- +#include "IMeshCache.h"
- static std::string getMediaCacheDir()
- {
- @@ -820,8 +821,8 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
- name = removeStringEnd(filename, image_ext);
- if(name != "")
- {
- - verbosestream<<"Client: Attempting to load image "
- - <<"file \""<<filename<<"\""<<std::endl;
- + verbosestream<<"Client: Storing image into Irrlicht: "
- + <<"\""<<filename<<"\""<<std::endl;
- io::IFileSystem *irrfs = m_device->getFileSystem();
- video::IVideoDriver *vdrv = m_device->getVideoDriver();
- @@ -854,12 +855,34 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
- name = removeStringEnd(filename, sound_ext);
- if(name != "")
- {
- - verbosestream<<"Client: Attempting to load sound "
- - <<"file \""<<filename<<"\""<<std::endl;
- + verbosestream<<"Client: Storing sound into Irrlicht: "
- + <<"\""<<filename<<"\""<<std::endl;
- m_sound->loadSoundData(name, data);
- return true;
- }
- + const char *model_ext[] = {
- + ".x", ".b3d", ".md2", ".obj",
- + NULL
- + };
- + name = removeStringEnd(filename, model_ext);
- + if(name != "")
- + {
- + verbosestream<<"Client: Storing model into Irrlicht: "
- + <<"\""<<filename<<"\""<<std::endl;
- +
- + io::IFileSystem *irrfs = m_device->getFileSystem();
- + io::IReadFile *rfile = irrfs->createMemoryReadFile(
- + *data_rw, data_rw.getSize(), filename.c_str());
- + assert(rfile);
- +
- + scene::ISceneManager *smgr = m_device->getSceneManager();
- + scene::IAnimatedMesh *mesh = smgr->getMesh(rfile);
- + smgr->getMeshCache()->addMesh(filename.c_str(), mesh);
- +
- + return true;
- + }
- +
- errorstream<<"Client: Don't know how to load file \""
- <<filename<<"\""<<std::endl;
- return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement