DAVA::uint32 TextureHelper::EnumerateSceneTexturesFileSize(DAVA::Scene* scene, const String& scenePath) { Map<String, Texture *> textureMap; EnumerateTextures(scene, textureMap); String projectPath = scenePath; uint32 sceneTextureFilesSize = 0; for(Map<String, Texture *>::const_iterator it = textureMap.begin(); it != textureMap.end(); ++it) { Texture *t = it->second; if(String::npos == t->GetPathname().find(projectPath)) { // skip all textures that are not related the scene continue; } if(String::npos != t->GetPathname().find(projectPath)) { //We need real info about textures size. In Editor on desktop pvr textures are decompressed to RGBA8888, so they have not real size. String imageFileName = TextureDescriptor::GetPathnameForFormat(t->GetPathname(), t->GetSourceFileFormat()); File * textureFile = File::Create(imageFileName, File::OPEN | File::READ); sceneTextureFilesSize += textureFile->GetSize(); SafeRelease(textureFile); } } return sceneTextureFilesSize; }
uint32 TextureHelper::EnumerateSceneTextures(DAVA::Scene* scene, const String& scenePath) { Map<String, Texture *> textureMap; EnumerateTextures(scene, textureMap); String projectPath = scenePath; uint32 sceneTextureMemory = 0; for(Map<String, Texture *>::const_iterator it = textureMap.begin(); it != textureMap.end(); ++it) { Texture *t = it->second; if(String::npos == t->GetPathname().find(projectPath)) { // skip all textures that are not related the scene continue; } if(String::npos != t->GetPathname().find(projectPath)) { //We need real info about textures size. In Editor on desktop pvr textures are decompressed to RGBA8888, so they have not real size. String imageFileName = TextureDescriptor::GetPathnameForFormat(t->GetPathname(), t->GetSourceFileFormat()); switch (t->GetSourceFileFormat()) { case DAVA::PVR_FILE: { sceneTextureMemory += LibPVRHelper::GetDataLength(imageFileName); break; } case DAVA::DXT_FILE: { sceneTextureMemory += (int32)LibDxtHelper::GetDataSize(imageFileName); break; } default: sceneTextureMemory += t->GetDataSize(); break; } } } return sceneTextureMemory; }