X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fwieldmesh.cpp;h=77a5cf73a92b2f592add73050d90604414231414;hb=91bafceee6606fab79db1bde4cba01b84fed65c7;hp=bc2977a0e2a0fe48c37e914bb9ded7af8e7c6a08;hpb=8b8d17b22b5853c7d32bdb8b369f4523f6c57b95;p=minetest.git diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp index bc2977a0e..77a5cf73a 100644 --- a/src/wieldmesh.cpp +++ b/src/wieldmesh.cpp @@ -283,7 +283,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename, // Customize material video::SMaterial &material = m_meshnode->getMaterial(0); - material.setTexture(0, tsrc->getTexture(imagename)); + material.setTexture(0, tsrc->getTextureForMesh(imagename)); material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; material.MaterialType = m_material_type; @@ -386,6 +386,20 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, IGameDef *gamedef) } return; } + else if (idef->getWieldMesh(def.name, gamedef) != 0) { + irr::scene::IMesh * mesh = idef->getWieldMesh(def.name, gamedef); + m_meshnode->setMesh(mesh); + u32 material_count = m_meshnode->getMaterialCount(); + for (u32 i = 0; i < material_count; ++i) { + video::SMaterial &material = m_meshnode->getMaterial(i); + material.setFlag(video::EMF_BACK_FACE_CULLING, true); + material.setFlag(video::EMF_BILINEAR_FILTER, m_bilinear_filter); + material.setFlag(video::EMF_TRILINEAR_FILTER, m_trilinear_filter); + material.MaterialType = m_material_type; + material.setTexture(0, tsrc->getTexture(def.meshtexture)); + } + return; + } else if (def.inventory_image != "") { setExtruded(def.inventory_image, def.wield_scale, tsrc, 1); return;