RenderDoc导出纹理时只能一张张导出,非常麻烦,改一下RenderDoc,效果如下

一、qrenderdoc\Windows\TextureViewer.ui中追加2个按钮

<item><widget class="QToolButton" name="saveTex"><property name="toolTip"><string>Save selected Texture</string></property><property name="text"><string/></property><property name="icon"><iconset resource="../Resources/resources.qrc"><normaloff>:/save.png</normaloff>:/save.png</iconset></property><property name="autoRaise"><bool>true</bool></property></widget></item>
<item>// 追加以下代码<widget class="QToolButton" name="saveTexs"><property name="toolTip"><string>Batch Save Textures => d:\\capture\\ </string></property><property name="text"><string/></property><property name="icon"><iconset resource="../Resources/resources.qrc"><normaloff>:/save2.png</normaloff>:/save2.png</iconset></property><property name="autoRaise"><bool>true</bool></property></widget></item><item><widget class="QToolButton" name="saveAllTex"><property name="toolTip"><string>Save all Textures => d:\\capture\\ </string></property><property name="text"><string/></property><property name="icon"><iconset resource="../Resources/resources.qrc"><normaloff>:/save3.png</normaloff>:/save3.png</iconset></property><property name="autoRaise"><bool>true</bool></property></widget></item><item>

二、qrenderdoc/Code/Resources.h中追加2个图标

  RESOURCE_DEF(save, "save.png")                                        \RESOURCE_DEF(save2, "save2.png")                                      \RESOURCE_DEF(save3, "save3.png")                                      \

三、qrenderdoc/Resources/目录中添加几个新图标,save2.png, save2@2x.png, save3.png, save3@2x.png

四、qrenderdoc/Resources/resources.qrc中追加2个图标

        <file>save.png</file><file>save2.png</file><file>save3.png</file>

五、在qrenderdoc/Windows/TextureViewer.cpp中追加代码


static TextureSave tmpSaveCfg;void TextureViewer::SaveStageResourcePreviews(ShaderStage stage,const rdcarray<ShaderResource> &resourceDetails,const rdcarray<Bindpoint> &mapping,rdcarray<BoundResourceArray> &ResList,int &prevIndex, bool copy,bool rw, const QString& savePath)
{for(int idx=0; idx < mapping.count(); idx++){const Bindpoint &key = mapping[idx];const rdcarray<BoundResource> *resArray = NULL;uint32_t dynamicallyUsedResCount = 1;int32_t firstIndex = 0;int residx = ResList.indexOf(key);if(residx >= 0){resArray = &ResList[residx].resources;dynamicallyUsedResCount = ResList[residx].dynamicallyUsedCount;firstIndex = ResList[residx].firstIndex;}int arrayLen = resArray != NULL ? resArray->count() : 1;const bool collapseArray = arrayLen > 8 && (dynamicallyUsedResCount > 20 || m_ShowUnused);for(int i = 0; i < arrayLen; i++){int arrayIdx = firstIndex + i;if(resArray && i >= resArray->count())break;if(resArray && !resArray->at(i).dynamicallyUsed)continue;BoundResource res = {};if(resArray)res = resArray->at(i);Following follow(*this, rw ? FollowType::ReadWrite : FollowType::ReadOnly, stage, idx,arrayIdx);// show if it's referenced by the shader - regardless of empty or notbool show = key.used || copy;// it's bound, but not referenced, and we have "show disabled"show = show || (m_ShowUnused && res.resourceId != ResourceId());// it's empty, and we have "show empty"show = show || (m_ShowEmpty && res.resourceId == ResourceId());// it's the one we're followingshow = show || (follow == m_Following);if(!show){continue;}tmpSaveCfg.resourceId = res.resourceId;tmpSaveCfg.destType = FileType::TGA;tmpSaveCfg.channelExtract = -1;tmpSaveCfg.alphaCol = FloatVector(0, 0, 0, 0);uint64_t currId = *((uint64_t*)&res.resourceId);QString fn = QString(tr("%1\\%2.tga")).arg(savePath).arg(currId);bool ret = false;m_Ctx.Replay().BlockInvoke([this, &ret, fn](IReplayController *r) {ret = r->SaveTexture(tmpSaveCfg, fn.toUtf8().data());});}}
}static uint captureBatch = 0;void TextureViewer::on_saveTexs_clicked()
{int outIndex = 0;int inIndex = 0;bool copy = false, clear = false, compute = false;Following::GetDrawContext(m_Ctx, copy, clear, compute);ShaderStage stages[] = {ShaderStage::Vertex, ShaderStage::Hull, ShaderStage::Domain,ShaderStage::Geometry, ShaderStage::Pixel};int count = 5;if(compute){stages[0] = ShaderStage::Compute;count = 1;}const rdcarray<ShaderResource> empty;QString currDir;for(int i = 0; i < 2048; ++i){++captureBatch;currDir = QString(tr("d:\\capture\\cap_%1")).arg(captureBatch);QDir dir(currDir);if(dir.exists()){continue;}dir.mkpath(currDir);break;}// display resources used for all stagesfor(int i = 0; i < count; i++){ShaderStage stage = stages[i];m_ReadWriteResources[(uint32_t)stage] =Following::GetReadWriteResources(m_Ctx, stage, !m_ShowUnused);m_ReadOnlyResources[(uint32_t)stage] =Following::GetReadOnlyResources(m_Ctx, stage, !m_ShowUnused);const ShaderReflection *details = Following::GetReflection(m_Ctx, stage);const ShaderBindpointMapping &mapping = Following::GetMapping(m_Ctx, stage);SaveStageResourcePreviews(stage, details != NULL ? details->readOnlyResources : empty,mapping.readOnlyResources, m_ReadOnlyResources[(uint32_t)stage],inIndex, copy, false, currDir);}
}void TextureViewer::on_saveAllTex_clicked()
{for(const TextureDescription &tex : m_Ctx.GetTextures()){tmpSaveCfg.resourceId = tex.resourceId;tmpSaveCfg.destType = FileType::TGA;tmpSaveCfg.channelExtract = -1;tmpSaveCfg.alphaCol = FloatVector(0, 0, 0, 0);QString fn;fn.sprintf("d:\\capture\\%d.tga", tex.resourceId);QFileInfo qi(fn);QDir dir(qi.absoluteDir());if (!dir.exists()){dir.makeAbsolute();}bool ret = false;m_Ctx.Replay().BlockInvoke([this, &ret, fn](IReplayController *r) {ret = r->SaveTexture(tmpSaveCfg, fn.toUtf8().data());});}
}

然后头文件中追加

void on_saveTexs_clicked();
void on_saveAllTex_clicked();void SaveStageResourcePreviews(ShaderStage stage, const rdcarray &resourceDetails, const rdcarray &mapping, rdcarray &ResList, int &prevIndex, bool copy, bool rw, const QString& savePath);

然后构建后,点黄色按钮可批量导出纹理到 d:\capture\cap_XXX 目录中
点紫色按钮可导出所有纹理到 d:\capture\目录中
也不会弹出对话框了,实乃挖图利器

导出Mesh可以参考这个

--转载请注明: http://blog.coolcoding.cn/?p=2750

让RenderDoc批量导出纹理相关推荐

  1. python做的游戏可以导出吗_Python for RenderDoc批量导出模型和贴图

    故事背景: 美术那里有需求,需要别人游戏的模型,来借鉴一下,问我是否有工具可以一键导出模型.我就搜索了一下RenderDoc批量导出图片,结果搜到了用C++改RenderDoc源码的文章.让Rende ...

  2. php批量导出pdf文件大小,php完美导出pdf,pdf合并批量导出

    使用到的工具 pdftk      https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/      pdf合并工具 wkhtmltopdf      ...

  3. PHP 利用PHPExcel类库批量导出数据

    2019独角兽企业重金招聘Python工程师标准>>> 之前做健康档案系统时,有一个将统计的数据批量导出到Excel的需求,后来实现后就没怎么做记录,最近一个小伙伴问我这块的问题,我 ...

  4. Oracle批量导出AWR报告

    Oracle批量导出AWR报告 工作需求:项目中需要把生产库中所有的AWR报告dump出来,然后导入到方便测试的数据库中.在测试库中的AWR报告需要根据dbid和实例名逐个导出,如果遇到很多再加上RA ...

  5. pip和conda批量导出、安装第三方依赖库(requirements.txt)

    pip批量导出包含环境中所有组件的requirements.txt文件 pip freeze > requirements.txt pip批量安装requirements.txt文件中包含的组件 ...

  6. mysql+用户批量导出,python批量导出导入MySQL用户的方法

    详细出处参考:http://www.jb51.net/article/43294.htm #!/usr/bin/env python #-*-encoding:utf-8-*- #---------- ...

  7. cdrx8如何批量导出jpg_SU基础教程——如何批量导出效果图

    "欢迎关注的我的头条号,私信"福利+头条",可免费获得景观资料大礼包 Sketchup导出二维图形的操作相信很多同学都已经不陌生.调整好角度和阴影,然后点击文件-导出-二 ...

  8. python从mysql导出大量数据_python批量导出导入MySQL用户的方法

    数据库迁移(A -> B),需要把用户也迁移过去,而用户表(mysql.user)有上百个用户.有2种方法进行快速迁移: 1,在同版本的条件下,直接备份A服务器的mysql数据库,还原到B服务器 ...

  9. 《PowerShell V3——SQL Server 2012数据库自动化运维权威指南》——2.19 使用bcp实施批量导出...

    本节书摘来自异步社区出版社<PowerShell V3-SQL Server 2012数据库自动化运维权威指南>一书中的第2章,第2.19节,作者:[加拿大]Donabel Santos, ...

最新文章

  1. 资源 | 盘点国外NLP领域40大高校及相关知名学者
  2. java.net.SocketException四大异常解决方案
  3. 当汇错款时该怎么办?
  4. Windows内存管理学习笔记(三)—— 无处不在的缺页异常
  5. Linux Ubuntu安装sogou中文输入法
  6. 零基础入门 Kubernetes,你需要知道这些
  7. webpack常用命令总结
  8. gcn在图像上的应用_每日摘要|基于CNN 特征的图像卷积网络识别杂草和作物
  9. [链接].VGA信号时序
  10. 在相册查看保存的图片
  11. Linux C++ glog日志库的简单使用
  12. this调用语句必须是构造函数中的第一个可执行语句_详解-JavaScript 的 this 指向和绑定...
  13. express 写接口
  14. 将数据追加到html 表格中,【HTML】使用Jquery实现将输入数据添加至表格中
  15. redis底层数据结构--简单动态字符串 链表 字典 跳跃表 整数集合 压缩列表
  16. python画函数图像 保留_如何使用python的matplotlib画反正切函数图像
  17. RadarNet: Efficient Gesture Recognition Technique Utilizing a Miniaturized Radar Sensor
  18. 远程桌面连接只有2个会话活动
  19. mysql5.7卸载服务_Mysql5.7.28安装配置、卸载—CentOS7.6生产环境下的微服务部署(四)...
  20. python羊车门问题的蒙特卡洛解法

热门文章

  1. K-means及其改进
  2. 法大大SDK使用-实名认证
  3. c语言如何输入大括号,杨宗德教你c语言使用大括号的正确方法
  4. 手机库存或达数亿,高傲的国产手机无奈低头,纷纷降价超千元促销
  5. 1024程序员节,发表一个拯救程序员的开箱。
  6. java oop_java面试提问:什么是OOP?
  7. @RequestBody的使用
  8. android有病毒怎么清除,安卓手机幽灵推病毒怎么彻底清除?手机幽灵推病毒彻底清除方法...
  9. sql语句中with as 的用法
  10. 无线路由器QoS设置——连接数限制