1
0
mirror of https://github.com/minetest/minetest.git synced 2024-10-31 23:50:17 +01:00

adding function to get texture size

This commit is contained in:
Sascha Heylik 2012-09-05 17:45:12 +02:00
parent 4fccc03f1c
commit 31f7071ec0
3 changed files with 18 additions and 1 deletions

View File

@ -1292,7 +1292,7 @@ int main(int argc, char *argv[])
video::IVideoDriver* driver = device->getVideoDriver(); video::IVideoDriver* driver = device->getVideoDriver();
// Disable mipmaps (because some of them look ugly) // enable mipmaps (because some of them look ugly)
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true); driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
/* /*

View File

@ -732,6 +732,22 @@ std::string TextureSource::getTextureName(u32 id)
return m_atlaspointer_cache[id].name; return m_atlaspointer_cache[id].name;
} }
v2s32 TextureSource::getTextureSize(u32 id)
{
JMutexAutoLock lock(m_atlaspointer_cache_mutex);
id (id >= m_atlaspointer_cache.size())
{
errorstream<<"TextureSource::getTextureName(): id="<<id
<<" >= m_atlaspointer_cache.size()="
<<m_atlaspointer_cache.size()<<std::endl;
return "";
}
return v2s32(m_atlaspointer_cache[id].getSize().Height(),
m_atlaspointer_cache[id].getSize().Width());
}
AtlasPointer TextureSource::getTexture(u32 id) AtlasPointer TextureSource::getTexture(u32 id)
{ {

View File

@ -121,6 +121,7 @@ public:
virtual u32 getTextureId(const std::string &name){return 0;} virtual u32 getTextureId(const std::string &name){return 0;}
virtual u32 getTextureIdDirect(const std::string &name){return 0;} virtual u32 getTextureIdDirect(const std::string &name){return 0;}
virtual std::string getTextureName(u32 id){return "";} virtual std::string getTextureName(u32 id){return "";}
virtual v2s32 getTextureSize(u32 id);
virtual AtlasPointer getTexture(u32 id){return AtlasPointer(0);} virtual AtlasPointer getTexture(u32 id){return AtlasPointer(0);}
virtual AtlasPointer getTexture(const std::string &name) virtual AtlasPointer getTexture(const std::string &name)
{return AtlasPointer(0);} {return AtlasPointer(0);}