MCPcopy Create free account
hub / github.com/axmolengine/axmol / reloadAllTextures

Method reloadAllTextures

core/renderer/TextureCache.cpp:940–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938}
939
940void VolatileTextureMgr::reloadAllTextures()
941{
942 _isReloading = true;
943 AXLOGD("reload all texture");
944
945 for (auto&& texture : _textures)
946 {
947 VolatileTexture* vt = texture;
948
949 switch (vt->_cashedImageType)
950 {
951 case VolatileTexture::kImageFile:
952 {
953 reloadTexture(vt->_texture, vt->_fileName, vt->_pixelFormat);
954
955 // etc1 support check whether alpha texture exists & load it
956 Image image;
957 if (image.initWithImageFile(vt->_fileName + TextureCache::getETC1AlphaFileSuffix()))
958 {
959 vt->_texture->updateWithImage(&image, vt->_pixelFormat, 1);
960 }
961 }
962 break;
963 case VolatileTexture::kImageData:
964 {
965 vt->_texture->initWithData(vt->_textureData, vt->_dataLen, vt->_pixelFormat, vt->_textureSize.width,
966 vt->_textureSize.height);
967 }
968 break;
969 case VolatileTexture::kString:
970 {
971 vt->_texture->initWithString(vt->_text, vt->_fontDefinition);
972 }
973 break;
974 case VolatileTexture::kImage:
975 {
976 vt->_texture->initWithImage(vt->_uiImage, vt->_pixelFormat);
977 }
978 break;
979 default:
980 break;
981 }
982 }
983
984 _isReloading = false;
985}
986
987void VolatileTextureMgr::reloadTexture(Texture2D* texture, std::string_view filename, backend::PixelFormat pixelFormat)
988{

Callers

nothing calls this directly

Calls 5

initWithImageFileMethod · 0.80
updateWithImageMethod · 0.80
initWithImageMethod · 0.80
initWithDataMethod · 0.45
initWithStringMethod · 0.45

Tested by

no test coverage detected