1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add a subfolder for models and transfer models from server to client

(obj, md2 and md3 are currently allowed)

Get rid of the texture string and use the existing textures array. Segmented meshes have multiple materials, and this will allow us to texture each. Do not switch to this commit yet!

If a texture string is left empty in LUA, don't modify that material. Useful so a script can change specific textures without affecting others
This commit is contained in:
MirceaKitsune 2012-10-24 00:11:24 +03:00 committed by Perttu Ahola
parent cb40b3517a
commit f9675bd2b4
6 changed files with 42 additions and 15 deletions

View file

@ -860,6 +860,25 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
return true;
}
const char *model_ext[] = {
".b3d", ".md2", ".obj",
NULL
};
name = removeStringEnd(filename, model_ext);
if(name != "")
{
verbosestream<<"Client: Storing model into Irrlicht: "
<<"file \""<<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);
assert(rfile);
//rfile->drop();
return true;
}
errorstream<<"Client: Don't know how to load file \""
<<filename<<"\""<<std::endl;
return false;