daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest Nov 9th, 2012 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/src/client.cpp b/src/client.cpp
  2. index e47bce1..7f54217 100644
  3. --- a/src/client.cpp
  4. +++ b/src/client.cpp
  5. @@ -41,6 +41,7 @@
  6.  #include "sound.h"
  7.  #include "util/string.h"
  8.  #include "hex.h"
  9. +#include "IMeshCache.h"
  10.  
  11.  static std::string getMediaCacheDir()
  12.  {
  13. @@ -820,8 +821,8 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
  14.         name = removeStringEnd(filename, image_ext);
  15.         if(name != "")
  16.         {
  17. -               verbosestream<<"Client: Attempting to load image "
  18. -                               <<"file \""<<filename<<"\""<<std::endl;
  19. +               verbosestream<<"Client: Storing image into Irrlicht: "
  20. +                               <<"\""<<filename<<"\""<<std::endl;
  21.  
  22.                 io::IFileSystem *irrfs = m_device->getFileSystem();
  23.                 video::IVideoDriver *vdrv = m_device->getVideoDriver();
  24. @@ -854,12 +855,34 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
  25.         name = removeStringEnd(filename, sound_ext);
  26.         if(name != "")
  27.         {
  28. -               verbosestream<<"Client: Attempting to load sound "
  29. -                               <<"file \""<<filename<<"\""<<std::endl;
  30. +               verbosestream<<"Client: Storing sound into Irrlicht: "
  31. +                               <<"\""<<filename<<"\""<<std::endl;
  32.                 m_sound->loadSoundData(name, data);
  33.                 return true;
  34.         }
  35.  
  36. +       const char *model_ext[] = {
  37. +               ".x", ".b3d", ".md2", ".obj",
  38. +               NULL
  39. +       };
  40. +       name = removeStringEnd(filename, model_ext);
  41. +       if(name != "")
  42. +       {
  43. +               verbosestream<<"Client: Storing model into Irrlicht: "
  44. +                               <<"\""<<filename<<"\""<<std::endl;
  45. +
  46. +               io::IFileSystem *irrfs = m_device->getFileSystem();
  47. +               io::IReadFile *rfile = irrfs->createMemoryReadFile(
  48. +                               *data_rw, data_rw.getSize(), filename.c_str());
  49. +               assert(rfile);
  50. +              
  51. +               scene::ISceneManager *smgr = m_device->getSceneManager();
  52. +               scene::IAnimatedMesh *mesh = smgr->getMesh(rfile);
  53. +               smgr->getMeshCache()->addMesh(filename.c_str(), mesh);
  54. +              
  55. +               return true;
  56. +       }
  57. +
  58.         errorstream<<"Client: Don't know how to load file \""
  59.                         <<filename<<"\""<<std::endl;
  60.         return false;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top