1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-05 05:42:18 +00:00

Update Aquaria/BBGE/External sources to comply with the new ttvfs API

This commit is contained in:
fgenesis 2014-04-07 02:10:05 +02:00
commit 6203bc7ce4
17 changed files with 179 additions and 390 deletions

View file

@ -437,19 +437,11 @@ void Texture::loadPNG(const std::string &file)
pngType = PNG_LUMINANCEALPHA;
}
#ifdef BBGE_BUILD_VFS
ttvfs::VFSFile *vf = vfs.GetFile(file.c_str());
const char *memptr = vf ? (const char*)vf->getBuf() : NULL;
if(!memptr)
{
debugLog("Can't load PNG file: " + file);
width = 64;
height = 64;
Texture::textureError = TEXERR_FILENOTFOUND;
return;
}
unsigned long memsize = 0;
const char *memptr = readFile(file, &memsize);
if(!memptr || !memsize)
goto fail;
int memsize = vf->size();
if (filter == GL_NEAREST)
{
textures[0] = pngBindMem(memptr, memsize, PNG_NOMIPMAPS, pngType, &info, GL_CLAMP_TO_EDGE, filter, filter);
@ -458,18 +450,6 @@ void Texture::loadPNG(const std::string &file)
{
textures[0] = pngBindMem(memptr, memsize, PNG_BUILDMIPMAPS, pngType, &info, GL_CLAMP_TO_EDGE, GL_LINEAR_MIPMAP_LINEAR, filter);
}
vf->dropBuf(true);
#else
if (filter == GL_NEAREST)
{
textures[0] = pngBind(file.c_str(), PNG_NOMIPMAPS, pngType, &info, GL_CLAMP_TO_EDGE, filter, filter);
}
else
{
textures[0] = pngBind(file.c_str(), PNG_BUILDMIPMAPS, pngType, &info, GL_CLAMP_TO_EDGE, GL_LINEAR_MIPMAP_LINEAR, filter);
}
#endif
if (textures[0] != 0)
{
@ -478,12 +458,16 @@ void Texture::loadPNG(const std::string &file)
}
else
{
fail:
debugLog("Can't load PNG file: " + file);
width = 64;
height = 64;
Texture::textureError = TEXERR_FILENOTFOUND;
}
if(memptr)
delete [] memptr;
#endif
}