diff options
author | MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com> | 2012-10-24 00:11:24 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-11-25 18:14:15 +0200 |
commit | f9675bd2b4d48b9517cd4939a5cfe1ea9c775b6c (patch) | |
tree | f5f61bb83f24383251660ee817d5e014d9bd87aa /src/content_cao.cpp | |
parent | cb40b3517a2dfac96c6733ce6e89e13822998cf9 (diff) | |
download | minetest-f9675bd2b4d48b9517cd4939a5cfe1ea9c775b6c.tar.gz minetest-f9675bd2b4d48b9517cd4939a5cfe1ea9c775b6c.tar.bz2 minetest-f9675bd2b4d48b9517cd4939a5cfe1ea9c775b6c.zip |
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
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp index c0be4e4cd..b3c0370b8 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -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())); - - // 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); + 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 + 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) |