-
- // If none of the above standard cases worked, use the wield mesh from ClientCached
- scene::IMesh *mesh = idef->getWieldMesh(item.name, gamedef);
- if (mesh) {
- changeToMesh(mesh);
- m_meshnode->setScale(def.wield_scale * WIELD_SCALE_FACTOR);
- return;
+ for (u32 i = 0; i < m_meshnode->getMaterialCount(); ++i) {
+ assert(i < 6);
+ 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);
+ bool animated = (f.tiles[i].animation_frame_count > 1);
+ if (animated) {
+ FrameSpec animation_frame = f.tiles[i].frames.find(0)->second;
+ material.setTexture(0, animation_frame.texture);
+ } else {
+ material.setTexture(0, f.tiles[i].texture);
+ }
+ material.MaterialType = m_material_type;
+ if (m_enable_shaders) {
+ if (f.tiles[i].normal_texture) {
+ if (animated) {
+ FrameSpec animation_frame = f.tiles[i].frames.find(0)->second;
+ material.setTexture(1, animation_frame.normal_texture);
+ } else {
+ material.setTexture(1, f.tiles[i].normal_texture);
+ }
+ material.setTexture(2, tsrc->getTexture("enable_img.png"));
+ } else {
+ material.setTexture(2, tsrc->getTexture("disable_img.png"));
+ }
+ }