summaryrefslogtreecommitdiff
path: root/src/content_cao.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r--src/content_cao.cpp30
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)