mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-17 14:55:13 -05:00
fix extruded items texture leak
This commit is contained in:
parent
9449026839
commit
58fd39de35
@ -234,6 +234,7 @@ public:
|
|||||||
m_item_definitions.clear();
|
m_item_definitions.clear();
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
m_main_thread = get_current_thread_id();
|
m_main_thread = get_current_thread_id();
|
||||||
|
m_driver = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
@ -249,6 +250,14 @@ public:
|
|||||||
cc->wield_mesh->drop();
|
cc->wield_mesh->drop();
|
||||||
delete cc;
|
delete cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_driver != NULL) {
|
||||||
|
for (unsigned int i = 0; i < m_extruded_textures.size(); i++) {
|
||||||
|
m_driver->removeTexture(m_extruded_textures[i]);
|
||||||
|
}
|
||||||
|
m_extruded_textures.clear();
|
||||||
|
}
|
||||||
|
m_driver = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
virtual const ItemDefinition& get(const std::string &name_) const
|
virtual const ItemDefinition& get(const std::string &name_) const
|
||||||
@ -297,6 +306,10 @@ public:
|
|||||||
return m_item_definitions.find(name) != m_item_definitions.end();
|
return m_item_definitions.find(name) != m_item_definitions.end();
|
||||||
}
|
}
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
|
private:
|
||||||
|
static video::IVideoDriver * m_driver;
|
||||||
|
static std::vector<video::ITexture*> m_extruded_textures;
|
||||||
|
public:
|
||||||
ClientCached* createClientCachedDirect(const std::string &name,
|
ClientCached* createClientCachedDirect(const std::string &name,
|
||||||
IGameDef *gamedef) const
|
IGameDef *gamedef) const
|
||||||
{
|
{
|
||||||
@ -435,6 +448,13 @@ public:
|
|||||||
tsrc->getTextureRaw(f.tiledef[0].name);
|
tsrc->getTextureRaw(f.tiledef[0].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_driver == 0)
|
||||||
|
m_driver = driver;
|
||||||
|
|
||||||
|
m_extruded_textures.push_back(cc->inventory_texture);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use the node mesh as the wield mesh
|
Use the node mesh as the wield mesh
|
||||||
@ -661,3 +681,8 @@ IWritableItemDefManager* createItemDefManager()
|
|||||||
return new CItemDefManager();
|
return new CItemDefManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SERVER
|
||||||
|
//TODO very very very dirty hack!
|
||||||
|
video::IVideoDriver * CItemDefManager::m_driver = 0;
|
||||||
|
std::vector<video::ITexture*> CItemDefManager::m_extruded_textures;
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user