1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +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

@ -1060,16 +1060,26 @@ public:
{
if(m_prop.visual == "mesh")
{
// fallback texture
if(m_prop.texture == "")
m_prop.texture = "unknown_block.png";
video::IVideoDriver* driver = m_animated_meshnode->getSceneManager()->getVideoDriver();
m_animated_meshnode->setMaterialTexture(0, driver->getTexture(m_prop.texture.c_str()));
for (u32 i = 0; i < m_prop.textures.size(); ++i)
{
std::string texturestring = m_prop.textures[i];
if(texturestring == "")
continue; // Empty texture string means don't modify that material
texturestring += mod;
video::IVideoDriver* driver = m_animated_meshnode->getSceneManager()->getVideoDriver();
video::ITexture* texture = driver->getTexture(texturestring.c_str());
if(!texture)
{
errorstream<<"GenericCAO::updateTextures(): Could not load texture "<<texturestring<<std::endl;
continue;
}
// Set material flags and texture
video::SMaterial& material = m_animated_meshnode->getMaterial(0);
material.setFlag(video::EMF_LIGHTING, false);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
// Set material flags and texture
m_animated_meshnode->setMaterialTexture(i, texture);
video::SMaterial& material = m_animated_meshnode->getMaterial(i);
material.setFlag(video::EMF_LIGHTING, false);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
}
}
}
if(m_meshnode)