From 9cd92339188821d8488d9786ad7c479473198fbf Mon Sep 17 00:00:00 2001 From: t-rvw <429601557@qq.com> Date: Fri, 13 Oct 2023 01:56:34 +0800 Subject: [PATCH 1/3] add empty effekseer producer --- auto/producers.lua | 5 + auto/producers/effekseer_producer.lua | 99 +++++++++++++++++++ auto/producers/fbx_producer.lua | 10 +- .../EffekseerProducer/EffekseerProducer.cpp | 26 +++++ .../EffekseerProducerImpl.cpp | 14 +++ .../EffekseerProducer/EffekseerProducerImpl.h | 23 +++++ .../EffekseerProducer/EffekseerProducer.h | 27 +++++ 7 files changed, 200 insertions(+), 4 deletions(-) create mode 100644 auto/producers/effekseer_producer.lua create mode 100644 private/Producers/EffekseerProducer/EffekseerProducer.cpp create mode 100644 private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp create mode 100644 private/Producers/EffekseerProducer/EffekseerProducerImpl.h create mode 100644 public/Producers/EffekseerProducer/EffekseerProducer.h diff --git a/auto/producers.lua b/auto/producers.lua index cdc93074..9e863402 100644 --- a/auto/producers.lua +++ b/auto/producers.lua @@ -16,6 +16,11 @@ end if CheckSDKExists("FBX_SDK_DIR") and BUILD_FBX then dofile("producers/fbx_producer.lua") end + +--if CheckSDKExists("EFFEKSEER_SDK_DIR") then + dofile("producers/effekseer_producer.lua") +--end + if CheckSDKExists("PHYSX_SDK_DIR") then dofile("producers/physx_producer.lua") end diff --git a/auto/producers/effekseer_producer.lua b/auto/producers/effekseer_producer.lua new file mode 100644 index 00000000..5b91126f --- /dev/null +++ b/auto/producers/effekseer_producer.lua @@ -0,0 +1,99 @@ +-------------------------------------------------------------- +print("Building effekseer_producer") + +-- Define producer dll +project("EffekseerProducer") + kind("SharedLib") + language("C++") + Platform_SetCppDialect() + dependson { "AssetPipelineCore" } + + location(path.join(RootPath, "build")) + + filter { "configurations:Debug" } + objdir(path.join(RootPath, "build/obj/Debug")) + targetdir(path.join(RootPath, "build/bin/Debug")) + libdirs(path.join(RootPath, "build/bin/Release")) + links { + path.join(RootPath, "build/bin/Debug/AssetPipelineCore") + } + filter { "configurations:Release" } + objdir(path.join(RootPath, "build/obj/Release")) + targetdir(path.join(RootPath, "build/bin/Release")) + libdirs(path.join(RootPath, "build/bin/Release")) + links { + path.join(RootPath, "build/bin/Release/AssetPipelineCore") + } + filter {} + + defines { + "TOOL_BUILD_SHARED" + } + + files { + path.join(RootPath, "public/Producers/EffekseerProducer/**.*"), + path.join(RootPath, "private/Producers/EffekseerProducer/**.*"), + } + + vpaths { + ["Source/*"] = { + path.join(RootPath, "public/Producers/EffekseerProducer/**.*"), + path.join(RootPath, "private/Producers/EffekseerProducer/**.*"), + }, + } + + commercialSDKIncludeDirs = {} + commercialSDKLibDirs = {} + commercialSDKLibNames = {} + + local config = CommercialSDKConfigs["EFFEKSEER_SDK_DIR"] + if config then + table.insert(commercialSDKIncludeDirs, config.include) + table.insert(commercialSDKLibDirs, config.lib_dir) + for _, libName in pairs(config.lib_names) do + table.insert(commercialSDKLibNames, libName) + end + end + + includedirs { + path.join(RootPath, "public"), + path.join(RootPath, "private"), + table.unpack(commercialSDKIncludeDirs) + } + + libdirs { + table.unpack(commercialSDKLibDirs), + } + + links { + table.unpack(commercialSDKLibNames), + } + + -- Auto copy dlls + local commercialSDKPostCmds = {} + filter { "configurations:Debug" } + for _, config in pairs(CommercialSDKConfigs) do + for _, dllPath in pairs(config.dll_paths) do + local copyCommand = "{COPYDIR} "..dllPath.." ".."build\\bin\\Debug" + table.insert(commercialSDKPostCmds, copyCommand) + end + end + + postbuildcommands { + "cd "..RootPath, + table.unpack(commercialSDKPostCmds) + } + filter { "configurations:Release" } + for _, config in pairs(CommercialSDKConfigs) do + for _, dllPath in pairs(config.dll_paths) do + local copyCommand = "{COPYDIR} "..dllPath.." ".."build\\bin\\Release" + table.insert(commercialSDKPostCmds, copyCommand) + end + end + + postbuildcommands { + "cd "..RootPath, + table.unpack(commercialSDKPostCmds) + } + filter {} + postbuildmessage "Copying dependencies..." \ No newline at end of file diff --git a/auto/producers/fbx_producer.lua b/auto/producers/fbx_producer.lua index 54729411..e35c8d58 100644 --- a/auto/producers/fbx_producer.lua +++ b/auto/producers/fbx_producer.lua @@ -47,10 +47,12 @@ project("FbxProducer") commercialSDKLibNames = {} local config = CommercialSDKConfigs["FBX_SDK_DIR"] - table.insert(commercialSDKIncludeDirs, config.include) - table.insert(commercialSDKLibDirs, config.lib_dir) - for _, libName in pairs(config.lib_names) do - table.insert(commercialSDKLibNames, libName) + if config then + table.insert(commercialSDKIncludeDirs, config.include) + table.insert(commercialSDKLibDirs, config.lib_dir) + for _, libName in pairs(config.lib_names) do + table.insert(commercialSDKLibNames, libName) + end end includedirs { diff --git a/private/Producers/EffekseerProducer/EffekseerProducer.cpp b/private/Producers/EffekseerProducer/EffekseerProducer.cpp new file mode 100644 index 00000000..845ff670 --- /dev/null +++ b/private/Producers/EffekseerProducer/EffekseerProducer.cpp @@ -0,0 +1,26 @@ +#include "Producers/EffekseerProducer/EffekseerProducer.h" +#include "EffekseerProducerImpl.h" + +namespace cdtools +{ + +EffekseerProducer::EffekseerProducer(const char* pFilePath) +{ + m_pEffekseerProducerImpl = new EffekseerProducerImpl(pFilePath); +} + +EffekseerProducer::~EffekseerProducer() +{ + if (m_pEffekseerProducerImpl) + { + delete m_pEffekseerProducerImpl; + m_pEffekseerProducerImpl = nullptr; + } +} + +void EffekseerProducer::Execute(cd::SceneDatabase* pSceneDatabase) +{ + m_pEffekseerProducerImpl->Execute(pSceneDatabase); +} + +} \ No newline at end of file diff --git a/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp b/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp new file mode 100644 index 00000000..a838ee25 --- /dev/null +++ b/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp @@ -0,0 +1,14 @@ +#include "EffekseerProducerImpl.h" + +namespace cdtools +{ + +EffekseerProducerImpl::EffekseerProducerImpl(std::string filePath) +{ +} + +void EffekseerProducerImpl::Execute(cd::SceneDatabase* pSceneDatabase) +{ +} + +} \ No newline at end of file diff --git a/private/Producers/EffekseerProducer/EffekseerProducerImpl.h b/private/Producers/EffekseerProducer/EffekseerProducerImpl.h new file mode 100644 index 00000000..acd3ead5 --- /dev/null +++ b/private/Producers/EffekseerProducer/EffekseerProducerImpl.h @@ -0,0 +1,23 @@ +#pragma once + +#include "Base/Template.h" +#include "Scene/SceneDatabase.h" + +namespace cdtools +{ + +class EffekseerProducerImpl final +{ +public: + EffekseerProducerImpl() = delete; + explicit EffekseerProducerImpl(std::string filePath); + EffekseerProducerImpl(const EffekseerProducerImpl&) = delete; + EffekseerProducerImpl& operator=(const EffekseerProducerImpl&) = delete; + EffekseerProducerImpl(EffekseerProducerImpl&&) = delete; + EffekseerProducerImpl& operator=(EffekseerProducerImpl&&) = delete; + ~EffekseerProducerImpl() = default; + + void Execute(cd::SceneDatabase* pSceneDatabase); +}; + +} \ No newline at end of file diff --git a/public/Producers/EffekseerProducer/EffekseerProducer.h b/public/Producers/EffekseerProducer/EffekseerProducer.h new file mode 100644 index 00000000..4906e274 --- /dev/null +++ b/public/Producers/EffekseerProducer/EffekseerProducer.h @@ -0,0 +1,27 @@ +#pragma once + +#include "Framework/IProducer.h" + +namespace cdtools +{ + +class EffekseerProducerImpl; + +class TOOL_API EffekseerProducer final : public IProducer +{ +public: + EffekseerProducer() = delete; + explicit EffekseerProducer(const char* pFilePath); + EffekseerProducer(const EffekseerProducer&) = delete; + EffekseerProducer& operator=(const EffekseerProducer&) = delete; + EffekseerProducer(EffekseerProducer&&) = delete; + EffekseerProducer& operator=(EffekseerProducer&&) = delete; + virtual ~EffekseerProducer(); + + virtual void Execute(cd::SceneDatabase* pSceneDatabase) override; + +private: + EffekseerProducerImpl* m_pEffekseerProducerImpl; +}; + +} \ No newline at end of file From 42c3a1d619bf0c09f56fa41fae305b4ca4e4a753 Mon Sep 17 00:00:00 2001 From: t-rvw <429601557@qq.com> Date: Fri, 13 Oct 2023 02:31:56 +0800 Subject: [PATCH 2/3] add test codes --- auto/examples.lua | 9 ++++++ auto/producers.lua | 4 +-- auto/thirdparty.lua | 1 + .../Effekseer/EffekseerToCD/Main.cpp | 32 +++++++++++++++++++ .../EffekseerProducer/EffekseerProducer.cpp | 2 +- .../EffekseerProducerImpl.cpp | 25 ++++++++++++++- .../EffekseerProducer/EffekseerProducerImpl.h | 5 ++- .../EffekseerProducer/EffekseerProducer.h | 2 +- 8 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 examples/Prototype/Effekseer/EffekseerToCD/Main.cpp diff --git a/auto/examples.lua b/auto/examples.lua index b0a5b53d..d0b8ecde 100644 --- a/auto/examples.lua +++ b/auto/examples.lua @@ -21,6 +21,7 @@ local function MakeExample(exampleProjectPath) local doUseGenericConsumer = string.contains(exampleProject, "ToGeneric") local doUseTerrainProducer = string.contains(exampleProject, "TerrainTo") + local doUseEffekseerProducer = string.contains(exampleProject, "EffekseerTo") print("Making example : "..exampleProject) project(exampleProject) @@ -106,6 +107,14 @@ local function MakeExample(exampleProjectPath) print("Using TerrainProducer") end + if doUseEffekseerProducer then + table.insert(extraIncludeDirs, path.join(RootPath, "public/Producers/EffekseerProducer")) + table.insert(extraLinkDebugLibs, path.join(RootPath, "build/bin/Debug/EffekseerProducer")) + table.insert(extraLinkReleaseLibs, path.join(RootPath, "build/bin/Release/EffekseerProducer")) + dependson { "EffekseerProducer" } + print("Using EffekseerProducer") + end + includedirs { path.join(RootPath, "public"), path.join(RootPath, "misc"), diff --git a/auto/producers.lua b/auto/producers.lua index 9e863402..2ef0f4db 100644 --- a/auto/producers.lua +++ b/auto/producers.lua @@ -17,9 +17,9 @@ if CheckSDKExists("FBX_SDK_DIR") and BUILD_FBX then dofile("producers/fbx_producer.lua") end ---if CheckSDKExists("EFFEKSEER_SDK_DIR") then +if CheckSDKExists("EFFEKSEER_SDK_DIR") then dofile("producers/effekseer_producer.lua") ---end +end if CheckSDKExists("PHYSX_SDK_DIR") then dofile("producers/physx_producer.lua") diff --git a/auto/thirdparty.lua b/auto/thirdparty.lua index 0ee12253..db370eb2 100644 --- a/auto/thirdparty.lua +++ b/auto/thirdparty.lua @@ -31,6 +31,7 @@ end DefineSDKConfig("FBX_SDK_DIR") DefineSDKConfig("PHYSX_SDK_DIR") DefineSDKConfig("SPEEDTREE_SDK_DIR") +DefineSDKConfig("EFFEKSEER_SDK_DIR") -------------------------------------------------------------- -- Define ThirdParty projects diff --git a/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp b/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp new file mode 100644 index 00000000..36470eb1 --- /dev/null +++ b/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp @@ -0,0 +1,32 @@ +#include "CDConsumer.h" +#include "Framework/Processor.h" +#include "EffekseerProducer.h" +#include "Utilities/PerformanceProfiler.h" + +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]; + EffekseerProducer producer(pInputFilePath); + CDConsumer consumer(pOutputFilePath); + consumer.SetExportMode(ExportMode::PureBinary); + + Processor processor(&producer, &consumer); + processor.SetDumpSceneDatabaseEnable(true); + processor.SetValidateSceneDatabaseEnable(true); + processor.Run(); + + return 0; +} \ No newline at end of file diff --git a/private/Producers/EffekseerProducer/EffekseerProducer.cpp b/private/Producers/EffekseerProducer/EffekseerProducer.cpp index 845ff670..10e9be03 100644 --- a/private/Producers/EffekseerProducer/EffekseerProducer.cpp +++ b/private/Producers/EffekseerProducer/EffekseerProducer.cpp @@ -4,7 +4,7 @@ namespace cdtools { -EffekseerProducer::EffekseerProducer(const char* pFilePath) +EffekseerProducer::EffekseerProducer(const char16_t* pFilePath) { m_pEffekseerProducerImpl = new EffekseerProducerImpl(pFilePath); } diff --git a/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp b/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp index a838ee25..eaa20744 100644 --- a/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp +++ b/private/Producers/EffekseerProducer/EffekseerProducerImpl.cpp @@ -1,14 +1,37 @@ #include "EffekseerProducerImpl.h" +#include +#include + namespace cdtools { -EffekseerProducerImpl::EffekseerProducerImpl(std::string filePath) +EffekseerProducerImpl::EffekseerProducerImpl(const char16_t* pFilePath) : + m_pFilePath(pFilePath) { } void EffekseerProducerImpl::Execute(cd::SceneDatabase* pSceneDatabase) { + auto efkManager = ::Effekseer::Manager::Create(8000); + auto effect = Effekseer::Effect::Create(efkManager, m_pFilePath); + auto* pEffectData = effect.Get(); + + // Mesh + pEffectData->GetProceduralModelCount(); + pEffectData->GetWaveCount(); + + // Materials and ParticleEmitter + pEffectData->GetMaterialCount(); + pEffectData->GetLoadingParameter(); + pEffectData->GetDefaultDynamicInputs(); + + // Texture + pEffectData->GetColorImageCount(); + pEffectData->GetDistortionImageCount(); + + // Track + pEffectData->GetCurveCount(); } } \ No newline at end of file diff --git a/private/Producers/EffekseerProducer/EffekseerProducerImpl.h b/private/Producers/EffekseerProducer/EffekseerProducerImpl.h index acd3ead5..7bd220cb 100644 --- a/private/Producers/EffekseerProducer/EffekseerProducerImpl.h +++ b/private/Producers/EffekseerProducer/EffekseerProducerImpl.h @@ -10,7 +10,7 @@ class EffekseerProducerImpl final { public: EffekseerProducerImpl() = delete; - explicit EffekseerProducerImpl(std::string filePath); + explicit EffekseerProducerImpl(const char16_t* pFilePath); EffekseerProducerImpl(const EffekseerProducerImpl&) = delete; EffekseerProducerImpl& operator=(const EffekseerProducerImpl&) = delete; EffekseerProducerImpl(EffekseerProducerImpl&&) = delete; @@ -18,6 +18,9 @@ class EffekseerProducerImpl final ~EffekseerProducerImpl() = default; void Execute(cd::SceneDatabase* pSceneDatabase); + +private: + const char16_t* m_pFilePath; }; } \ No newline at end of file diff --git a/public/Producers/EffekseerProducer/EffekseerProducer.h b/public/Producers/EffekseerProducer/EffekseerProducer.h index 4906e274..99b58a48 100644 --- a/public/Producers/EffekseerProducer/EffekseerProducer.h +++ b/public/Producers/EffekseerProducer/EffekseerProducer.h @@ -11,7 +11,7 @@ class TOOL_API EffekseerProducer final : public IProducer { public: EffekseerProducer() = delete; - explicit EffekseerProducer(const char* pFilePath); + explicit EffekseerProducer(const char16_t* pFilePath); EffekseerProducer(const EffekseerProducer&) = delete; EffekseerProducer& operator=(const EffekseerProducer&) = delete; EffekseerProducer(EffekseerProducer&&) = delete; From 2242397d7134259f2a6810593f3c4ed569ddddd3 Mon Sep 17 00:00:00 2001 From: t-rvw <429601557@qq.com> Date: Fri, 13 Oct 2023 02:35:02 +0800 Subject: [PATCH 3/3] update --- examples/Prototype/Effekseer/EffekseerToCD/Main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp b/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp index 36470eb1..ddc43f5f 100644 --- a/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp +++ b/examples/Prototype/Effekseer/EffekseerToCD/Main.cpp @@ -17,7 +17,8 @@ int main(int argc, char** argv) PerformanceProfiler profiler("AssetPipeline"); - const char* pInputFilePath = argv[1]; + // TODO : how to input char16_t string from argv? + const char16_t* pInputFilePath = u"S:/Effekseer/Examples/Resources/Laser01.efkefc"; const char* pOutputFilePath = argv[2]; EffekseerProducer producer(pInputFilePath); CDConsumer consumer(pOutputFilePath);