int32 SceneHelper::EnumerateModifiedTextures(DAVA::Scene *forScene, DAVA::Map<DAVA::Texture *, DAVA::Vector< DAVA::eGPUFamily> > &textures) { int32 retValue = 0; textures.clear(); TexturesMap allTextures; EnumerateSceneTextures(forScene, allTextures, EXCLUDE_NULL); for(TexturesMap::iterator it = allTextures.begin(); it != allTextures.end(); ++it) { DAVA::Texture * texture = it->second; if(NULL == texture) { continue; } DAVA::TextureDescriptor *descriptor = texture->GetDescriptor(); if(NULL == descriptor) { continue; } DVASSERT(descriptor->compression); DAVA::Vector< DAVA::eGPUFamily> markedGPUs; for(int i = 0; i < DAVA::GPU_DEVICE_COUNT; ++i) { eGPUFamily gpu = (eGPUFamily)i; if(GPUFamilyDescriptor::IsFormatSupported(gpu, (PixelFormat)descriptor->compression[gpu].format)) { FilePath texPath = descriptor->GetSourceTexturePathname(); if(texPath.Exists() && !descriptor->IsCompressedTextureActual(gpu)) { markedGPUs.push_back(gpu); retValue++; } } } if(markedGPUs.size() > 0) { textures[texture] = markedGPUs; } } return retValue; }
void TextureBrowser::updateConvertedImageAndInfo(const DAVA::Vector<QImage> &images, DAVA::TextureDescriptor& descriptor) { if(!descriptor.IsCubeMap()) { ui->textureAreaConverted->setImage(images[0]); } else { ui->textureAreaConverted->setImage(images, descriptor.faceDescription); } ui->textureAreaConverted->setEnabled(true); ui->textureAreaConverted->waitbarShow(false); // set info about converted image updateInfoConverted(); }
void CubeMapTextureBrowser::ReloadTextures(const DAVA::String& rootPath) { cubeListItemDelegate.ClearCache(); ui->listTextures->clear(); ui->listTextures->setVisible(false); ui->loadingWidget->setVisible(true); this->paintEvent(NULL); ui->loadingWidget->update(); QApplication::processEvents(); QApplication::flush(); this->setUpdatesEnabled(false); QDir dir(rootPath.c_str()); QStringList filesList = dir.entryList(QStringList("*.tex")); size_t cubemapTextures = 0; if(filesList.size() > 0) { DAVA::Vector<CubeListItemDelegate::ListItemInfo> cubemapList; FilePath fp = rootPath; for(int i = 0; i < filesList.size(); ++i) { QString str = filesList.at(i); fp.ReplaceFilename(str.toStdString()); DAVA::TextureDescriptor* texDesc = DAVA::TextureDescriptor::CreateFromFile(fp); if(texDesc && texDesc->IsCubeMap()) { CubeListItemDelegate::ListItemInfo itemInfo; itemInfo.path = fp; itemInfo.valid = ValidateTextureAndFillThumbnails(fp, itemInfo.icons, itemInfo.actualSize); if(itemInfo.valid) { cubemapList.push_back(itemInfo); } else { //non-valid items should be always at the beginning of the list cubemapList.insert(cubemapList.begin(), itemInfo); } } SafeDelete(texDesc); } cubeListItemDelegate.UpdateCache(cubemapList); for(size_t i = 0; i < cubemapList.size(); ++i) { CubeListItemDelegate::ListItemInfo& itemInfo = cubemapList[i]; QListWidgetItem* listItem = new QListWidgetItem(); listItem->setData(Qt::CheckStateRole, false); listItem->setData(CUBELIST_DELEGATE_ITEMFULLPATH, itemInfo.path.GetAbsolutePathname().c_str()); listItem->setData(CUBELIST_DELEGATE_ITEMFILENAME, itemInfo.path.GetFilename().c_str()); ui->listTextures->addItem(listItem); } cubemapTextures = cubemapList.size(); ui->listTextures->setCurrentItem(ui->listTextures->item(0)); } this->setUpdatesEnabled(true); ui->listTextures->setVisible(cubemapTextures > 0); ui->loadingWidget->setVisible(false); UpdateCheckedState(); }