From 247f5366501bd98d22c26a6feab3838933f4527a Mon Sep 17 00:00:00 2001 From: Jiajun <75730859+T-rvw@users.noreply.github.com> Date: Sun, 6 Aug 2023 21:33:31 +0800 Subject: [PATCH] ddgi tool (#209) --- examples/CDToDDGIDemoToCD/Main.cpp | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 examples/CDToDDGIDemoToCD/Main.cpp diff --git a/examples/CDToDDGIDemoToCD/Main.cpp b/examples/CDToDDGIDemoToCD/Main.cpp new file mode 100644 index 00000000..229a3c1c --- /dev/null +++ b/examples/CDToDDGIDemoToCD/Main.cpp @@ -0,0 +1,72 @@ +#include "CDConsumer.h" +#include "Framework/Processor.h" +#include "CDProducer.h" +#include "Utilities/PerformanceProfiler.h" +#include "Scene/SceneDatabase.h" + +#include +#include + +int main(int argc, char** argv) +{ + // argv[0] : exe name + // argv[1] : input file path + // argv[2] : output file path + if (argc != 3) + { + return 1; + } + + using namespace cdtools; + + PerformanceProfiler profiler("AssetPipeline"); + + const char* pInputFilePath = argv[1]; + const char* pOutputFilePath = argv[2]; + CDProducer producer(pInputFilePath); + CDConsumer consumer(pOutputFilePath); + + auto pSceneDatabase = std::make_unique(); + { + Processor processor(&producer, nullptr, pSceneDatabase.get()); + processor.SetDumpSceneDatabaseEnable(false); + processor.SetValidateSceneDatabaseEnable(true); + processor.Run(); + } + + { + std::vector removeMaterialNames = { "Floor_Tiles_03", "WoodFloor" }; + for (auto& name : removeMaterialNames) + { + for (auto& material : pSceneDatabase->GetMaterials()) + { + if (strcmp(material.GetName(), name) == 0) + { + material.RemoveTexture(cd::MaterialPropertyGroup::Metallic); + material.RemoveTexture(cd::MaterialPropertyGroup::Occlusion); + material.RemoveTexture(cd::MaterialPropertyGroup::Roughness); + } + } + } + + for (auto& texture : pSceneDatabase->GetTextures()) + { + std::filesystem::path texturePath = texture.GetPath(); + texture.SetPath(texturePath.filename().replace_extension(".dds").string().c_str()); + } + + //for (auto& light : pSceneDatabase->GetLights()) + //{ + // light.SetIntensity(light.GetIntensity() * 0.8f); + //} + } + + { + Processor processor(nullptr, &consumer, pSceneDatabase.get()); + processor.SetDumpSceneDatabaseEnable(true); + processor.SetValidateSceneDatabaseEnable(true); + processor.Run(); + } + + return 0; +} \ No newline at end of file