diff options
author | MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com> | 2012-10-24 22:10:05 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-11-25 18:14:15 +0200 |
commit | 9c8ba427503cbf73f0263495a791656b905c2efc (patch) | |
tree | 098f163a19b5cedd11e040e68bfc5b920e21c51b /src/client.cpp | |
parent | f9675bd2b4d48b9517cd4939a5cfe1ea9c775b6c (diff) | |
download | minetest-9c8ba427503cbf73f0263495a791656b905c2efc.tar.gz minetest-9c8ba427503cbf73f0263495a791656b905c2efc.tar.bz2 minetest-9c8ba427503cbf73f0263495a791656b905c2efc.zip |
Get the mesh working through the memory cache properly. Most credit goes to celeron55 for the help on this code
Get the texture from memory as well
Add .x to the list of supported formats
Update LUA API documentation
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/client.cpp b/src/client.cpp index 504297a6d..7f5421747 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -41,6 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #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,28 +855,31 @@ 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[] = { - ".b3d", ".md2", ".obj", + ".x", ".b3d", ".md2", ".obj", NULL }; name = removeStringEnd(filename, model_ext); if(name != "") { verbosestream<<"Client: Storing model into Irrlicht: " - <<"file \""<<filename<<"\""<<std::endl; + <<"\""<<filename<<"\""<<std::endl; io::IFileSystem *irrfs = m_device->getFileSystem(); - - // Create an irrlicht memory file - io::IReadFile *rfile = irrfs->createMemoryReadFile(*data_rw, data_rw.getSize(), filename.c_str(), true); + io::IReadFile *rfile = irrfs->createMemoryReadFile( + *data_rw, data_rw.getSize(), filename.c_str()); assert(rfile); - //rfile->drop(); + + scene::ISceneManager *smgr = m_device->getSceneManager(); + scene::IAnimatedMesh *mesh = smgr->getMesh(rfile); + smgr->getMeshCache()->addMesh(filename.c_str(), mesh); + return true; } |