1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

Fix oversight in texture loading that could cause the cape to appear as white blorb. Thx Daxar.

This commit is contained in:
fgenesis 2015-06-10 01:49:12 +02:00
parent 1af3a580ed
commit 8bd40be8aa
3 changed files with 14 additions and 8 deletions

View file

@ -4465,14 +4465,18 @@ std::pair<CountedPtr<Texture>, TextureLoadResult> Core::doTextureAdd(const std::
return std::make_pair(t, (TextureLoadResult)res); return std::make_pair(t, (TextureLoadResult)res);
} }
CountedPtr<Texture> Core::addTexture(const std::string &textureName) CountedPtr<Texture> Core::addTexture(const std::string &textureName, TextureLoadResult *pLoadResult /* = 0 */)
{ {
if (textureName.empty()) return NULL;
BBGE_PROF(Core_addTexture); BBGE_PROF(Core_addTexture);
std::pair<CountedPtr<Texture>, TextureLoadResult> texResult; if (textureName.empty())
{
if(pLoadResult)
*pLoadResult = TEX_FAILED;
return NULL;
}
std::pair<CountedPtr<Texture>, TextureLoadResult> texResult;
std::string texture = textureName; std::string texture = textureName;
stringToLowerUserData(texture); stringToLowerUserData(texture);
std::string internalTextureName = texture; std::string internalTextureName = texture;
@ -4513,7 +4517,8 @@ CountedPtr<Texture> Core::addTexture(const std::string &textureName)
debugLog(os.str()); debugLog(os.str());
} }
} }
if(pLoadResult)
*pLoadResult = texResult.second;
return texResult.first; return texResult.first;
} }

View file

@ -1023,7 +1023,7 @@ public:
void removeTexture(Texture *res); void removeTexture(Texture *res);
void clearResources(); void clearResources();
CountedPtr<Texture> addTexture(const std::string &texture); CountedPtr<Texture> addTexture(const std::string &texture, TextureLoadResult *pLoadResult = 0);
PostProcessingFX postProcessingFx; PostProcessingFX postProcessingFx;

View file

@ -1328,9 +1328,10 @@ bool RenderObject::setTexture(const std::string &n)
if(texture && name == texture->name) if(texture && name == texture->name)
return true; // no texture change return true; // no texture change
CountedPtr<Texture> tex = core->addTexture(name); TextureLoadResult res = TEX_FAILED;
CountedPtr<Texture> tex = core->addTexture(name, &res);
setTexturePointer(tex); setTexturePointer(tex);
return !!tex; return !!tex && res != TEX_FAILED;
} }
float RenderObject::getSortDepth() float RenderObject::getSortDepth()